@jscad/core 2.3.4 → 2.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/jscad-core.min.js
CHANGED
|
@@ -2,120 +2,31 @@
|
|
|
2
2
|
"use strict";exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;function getLens(o){var r=o.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=o.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function byteLength(o){var r=getLens(o),e=r[0],t=r[1];return 3*(e+t)/4-t}function _byteLength(o,r,e){return 3*(r+e)/4-e}function toByteArray(o){var r,e,t=getLens(o),n=t[0],u=t[1],p=new Arr(_byteLength(o,n,u)),a=0,h=u>0?n-4:n;for(e=0;e<h;e+=4)r=revLookup[o.charCodeAt(e)]<<18|revLookup[o.charCodeAt(e+1)]<<12|revLookup[o.charCodeAt(e+2)]<<6|revLookup[o.charCodeAt(e+3)],p[a++]=r>>16&255,p[a++]=r>>8&255,p[a++]=255&r;return 2===u&&(r=revLookup[o.charCodeAt(e)]<<2|revLookup[o.charCodeAt(e+1)]>>4,p[a++]=255&r),1===u&&(r=revLookup[o.charCodeAt(e)]<<10|revLookup[o.charCodeAt(e+1)]<<4|revLookup[o.charCodeAt(e+2)]>>2,p[a++]=r>>8&255,p[a++]=255&r),p}function tripletToBase64(o){return lookup[o>>18&63]+lookup[o>>12&63]+lookup[o>>6&63]+lookup[63&o]}function encodeChunk(o,r,e){for(var t,n=[],u=r;u<e;u+=3)t=(o[u]<<16&16711680)+(o[u+1]<<8&65280)+(255&o[u+2]),n.push(tripletToBase64(t));return n.join("")}function fromByteArray(o){for(var r,e=o.length,t=e%3,n=[],u=0,p=e-t;u<p;u+=16383)n.push(encodeChunk(o,u,u+16383>p?p:u+16383));return 1===t?(r=o[e-1],n.push(lookup[r>>2]+lookup[r<<4&63]+"==")):2===t&&(r=(o[e-2]<<8)+o[e-1],n.push(lookup[r>>10]+lookup[r>>4&63]+lookup[r<<2&63]+"=")),n.join("")}revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63;
|
|
3
3
|
|
|
4
4
|
},{}],2:[function(require,module,exports){
|
|
5
|
-
|
|
6
|
-
},{}],3:[function(require,module,exports){
|
|
7
5
|
(function (Buffer){(function (){
|
|
8
6
|
"use strict";var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;function typedArraySupport(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function createBuffer(e){if(e>K_MAX_LENGTH)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=Buffer.prototype,t}function Buffer(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(e)}return from(e,t,r)}function from(e,t,r){if("string"==typeof e)return fromString(e,t);if(ArrayBuffer.isView(e))return fromArrayLike(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(isInstance(e,ArrayBuffer)||e&&isInstance(e.buffer,ArrayBuffer))return fromArrayBuffer(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return Buffer.from(n,t,r);var f=fromObject(e);if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return Buffer.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function assertSize(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function alloc(e,t,r){return assertSize(e),e<=0?createBuffer(e):void 0!==t?"string"==typeof r?createBuffer(e).fill(t,r):createBuffer(e).fill(t):createBuffer(e)}function allocUnsafe(e){return assertSize(e),createBuffer(e<0?0:0|checked(e))}function fromString(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!Buffer.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|byteLength(e,t),n=createBuffer(r),f=n.write(e,t);return f!==r&&(n=n.slice(0,f)),n}function fromArrayLike(e){for(var t=e.length<0?0:0|checked(e.length),r=createBuffer(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function fromArrayBuffer(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=Buffer.prototype,n}function fromObject(e){if(Buffer.isBuffer(e)){var t=0|checked(e.length),r=createBuffer(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}return void 0!==e.length?"number"!=typeof e.length||numberIsNaN(e.length)?createBuffer(0):fromArrayLike(e):"Buffer"===e.type&&Array.isArray(e.data)?fromArrayLike(e.data):void 0}function checked(e){if(e>=K_MAX_LENGTH)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+K_MAX_LENGTH.toString(16)+" bytes");return 0|e}function SlowBuffer(e){return+e!=e&&(e=0),Buffer.alloc(+e)}function byteLength(e,t){if(Buffer.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||isInstance(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var f=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return utf8ToBytes(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return base64ToBytes(e).length;default:if(f)return n?-1:utf8ToBytes(e).length;t=(""+t).toLowerCase(),f=!0}}function slowToString(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return hexSlice(this,t,r);case"utf8":case"utf-8":return utf8Slice(this,t,r);case"ascii":return asciiSlice(this,t,r);case"latin1":case"binary":return latin1Slice(this,t,r);case"base64":return base64Slice(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function swap(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function bidirectionalIndexOf(e,t,r,n,f){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),numberIsNaN(r=+r)&&(r=f?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(f)return-1;r=e.length-1}else if(r<0){if(!f)return-1;r=0}if("string"==typeof t&&(t=Buffer.from(t,n)),Buffer.isBuffer(t))return 0===t.length?-1:arrayIndexOf(e,t,r,n,f);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?f?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):arrayIndexOf(e,[t],r,n,f);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(e,t,r,n,f){var i,o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(f){var h=-1;for(i=r;i<u;i++)if(a(e,i)===a(t,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===s)return h*o}else-1!==h&&(i-=i-h),h=-1}else for(r+s>u&&(r=u-s),i=r;i>=0;i--){for(var c=!0,l=0;l<s;l++)if(a(e,i+l)!==a(t,l)){c=!1;break}if(c)return i}return-1}function hexWrite(e,t,r,n){r=Number(r)||0;var f=e.length-r;n?(n=Number(n))>f&&(n=f):n=f;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o<n;++o){var u=parseInt(t.substr(2*o,2),16);if(numberIsNaN(u))return o;e[r+o]=u}return o}function utf8Write(e,t,r,n){return blitBuffer(utf8ToBytes(t,e.length-r),e,r,n)}function asciiWrite(e,t,r,n){return blitBuffer(asciiToBytes(t),e,r,n)}function latin1Write(e,t,r,n){return asciiWrite(e,t,r,n)}function base64Write(e,t,r,n){return blitBuffer(base64ToBytes(t),e,r,n)}function ucs2Write(e,t,r,n){return blitBuffer(utf16leToBytes(t,e.length-r),e,r,n)}function base64Slice(e,t,r){return 0===t&&r===e.length?base64.fromByteArray(e):base64.fromByteArray(e.slice(t,r))}function utf8Slice(e,t,r){r=Math.min(e.length,r);for(var n=[],f=t;f<r;){var i,o,u,s,a=e[f],h=null,c=a>239?4:a>223?3:a>191?2:1;if(f+c<=r)switch(c){case 1:a<128&&(h=a);break;case 2:128==(192&(i=e[f+1]))&&(s=(31&a)<<6|63&i)>127&&(h=s);break;case 3:i=e[f+1],o=e[f+2],128==(192&i)&&128==(192&o)&&(s=(15&a)<<12|(63&i)<<6|63&o)>2047&&(s<55296||s>57343)&&(h=s);break;case 4:i=e[f+1],o=e[f+2],u=e[f+3],128==(192&i)&&128==(192&o)&&128==(192&u)&&(s=(15&a)<<18|(63&i)<<12|(63&o)<<6|63&u)>65535&&s<1114112&&(h=s)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),f+=c}return decodeCodePointsArray(n)}exports.kMaxLength=K_MAX_LENGTH,Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(Buffer.prototype,"parent",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.buffer}}),Object.defineProperty(Buffer.prototype,"offset",{enumerable:!0,get:function(){if(Buffer.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),Buffer.poolSize=8192,Buffer.from=function(e,t,r){return from(e,t,r)},Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,Buffer.alloc=function(e,t,r){return alloc(e,t,r)},Buffer.allocUnsafe=function(e){return allocUnsafe(e)},Buffer.allocUnsafeSlow=function(e){return allocUnsafe(e)},Buffer.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==Buffer.prototype},Buffer.compare=function(e,t){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),isInstance(t,Uint8Array)&&(t=Buffer.from(t,t.offset,t.byteLength)),!Buffer.isBuffer(e)||!Buffer.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,f=0,i=Math.min(r,n);f<i;++f)if(e[f]!==t[f]){r=e[f],n=t[f];break}return r<n?-1:n<r?1:0},Buffer.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Buffer.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Buffer.allocUnsafe(t),f=0;for(r=0;r<e.length;++r){var i=e[r];if(isInstance(i,Uint8Array)&&(i=Buffer.from(i)),!Buffer.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,f),f+=i.length}return n},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)swap(this,t,t+1);return this},Buffer.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)swap(this,t,t+3),swap(this,t+1,t+2);return this},Buffer.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)swap(this,t,t+7),swap(this,t+1,t+6),swap(this,t+2,t+5),swap(this,t+3,t+4);return this},Buffer.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?utf8Slice(this,0,e):slowToString.apply(this,arguments)},Buffer.prototype.toLocaleString=Buffer.prototype.toString,Buffer.prototype.equals=function(e){if(!Buffer.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Buffer.compare(this,e)},Buffer.prototype.inspect=function(){var e="",t=exports.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},Buffer.prototype.compare=function(e,t,r,n,f){if(isInstance(e,Uint8Array)&&(e=Buffer.from(e,e.offset,e.byteLength)),!Buffer.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===f&&(f=this.length),t<0||r>e.length||n<0||f>this.length)throw new RangeError("out of range index");if(n>=f&&t>=r)return 0;if(n>=f)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(f>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),u=Math.min(i,o),s=this.slice(n,f),a=e.slice(t,r),h=0;h<u;++h)if(s[h]!==a[h]){i=s[h],o=a[h];break}return i<o?-1:o<i?1:0},Buffer.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Buffer.prototype.indexOf=function(e,t,r){return bidirectionalIndexOf(this,e,t,r,!0)},Buffer.prototype.lastIndexOf=function(e,t,r){return bidirectionalIndexOf(this,e,t,r,!1)},Buffer.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var f=this.length-t;if((void 0===r||r>f)&&(r=f),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return hexWrite(this,e,t,r);case"utf8":case"utf-8":return utf8Write(this,e,t,r);case"ascii":return asciiWrite(this,e,t,r);case"latin1":case"binary":return latin1Write(this,e,t,r);case"base64":return base64Write(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(e){var t=e.length;if(t<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=MAX_ARGUMENTS_LENGTH));return r}function asciiSlice(e,t,r){var n="";r=Math.min(e.length,r);for(var f=t;f<r;++f)n+=String.fromCharCode(127&e[f]);return n}function latin1Slice(e,t,r){var n="";r=Math.min(e.length,r);for(var f=t;f<r;++f)n+=String.fromCharCode(e[f]);return n}function hexSlice(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var f="",i=t;i<r;++i)f+=toHex(e[i]);return f}function utf16leSlice(e,t,r){for(var n=e.slice(t,r),f="",i=0;i<n.length;i+=2)f+=String.fromCharCode(n[i]+256*n[i+1]);return f}function checkOffset(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function checkInt(e,t,r,n,f,i){if(!Buffer.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>f||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function checkIEEE754(e,t,r,n,f,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function writeFloat(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(e,t,r,n,23,4),r+4}function writeDouble(e,t,r,n,f){return t=+t,r>>>=0,f||checkIEEE754(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(e,t,r,n,52,8),r+8}Buffer.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=Buffer.prototype,n},Buffer.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i<t&&(f*=256);)n+=this[e+i]*f;return n},Buffer.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e+--t],f=1;t>0&&(f*=256);)n+=this[e+--t]*f;return n},Buffer.prototype.readUInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),this[e]},Buffer.prototype.readUInt16LE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]|this[e+1]<<8},Buffer.prototype.readUInt16BE=function(e,t){return e>>>=0,t||checkOffset(e,2,this.length),this[e]<<8|this[e+1]},Buffer.prototype.readUInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Buffer.prototype.readUInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Buffer.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=this[e],f=1,i=0;++i<t&&(f*=256);)n+=this[e+i]*f;return n>=(f*=128)&&(n-=Math.pow(2,8*t)),n},Buffer.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||checkOffset(e,t,this.length);for(var n=t,f=1,i=this[e+--n];n>0&&(f*=256);)i+=this[e+--n]*f;return i>=(f*=128)&&(i-=Math.pow(2,8*t)),i},Buffer.prototype.readInt8=function(e,t){return e>>>=0,t||checkOffset(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Buffer.prototype.readInt16LE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt16BE=function(e,t){e>>>=0,t||checkOffset(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Buffer.prototype.readInt32LE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Buffer.prototype.readInt32BE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Buffer.prototype.readFloatLE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!0,23,4)},Buffer.prototype.readFloatBE=function(e,t){return e>>>=0,t||checkOffset(e,4,this.length),ieee754.read(this,e,!1,23,4)},Buffer.prototype.readDoubleLE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!0,52,8)},Buffer.prototype.readDoubleBE=function(e,t){return e>>>=0,t||checkOffset(e,8,this.length),ieee754.read(this,e,!1,52,8)},Buffer.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=1,i=0;for(this[t]=255&e;++i<r&&(f*=256);)this[t+i]=e/f&255;return t+r},Buffer.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||checkInt(this,e,t,r,Math.pow(2,8*r)-1,0);var f=r-1,i=1;for(this[t+f]=255&e;--f>=0&&(i*=256);)this[t+f]=e/i&255;return t+r},Buffer.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,255,0),this[t]=255&e,t+1},Buffer.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},Buffer.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=0,o=1,u=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===u&&0!==this[t+i-1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},Buffer.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var f=Math.pow(2,8*r-1);checkInt(this,e,t,r,f-1,-f)}var i=r-1,o=1,u=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/o>>0)-u&255;return t+r},Buffer.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},Buffer.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},Buffer.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},Buffer.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},Buffer.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||checkInt(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},Buffer.prototype.writeFloatLE=function(e,t,r){return writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function(e,t,r){return writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function(e,t,r){return writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function(e,t,r){return writeDouble(this,e,t,!1,r)},Buffer.prototype.copy=function(e,t,r,n){if(!Buffer.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var f=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=f-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return f},Buffer.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Buffer.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var f=e.charCodeAt(0);("utf8"===n&&f<128||"latin1"===n)&&(e=f)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=Buffer.isBuffer(e)?e:Buffer.from(e,n),u=o.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%u]}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function base64clean(e){if((e=(e=e.split("=")[0]).trim().replace(INVALID_BASE64_RE,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function toHex(e){return e<16?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e,t){var r;t=t||1/0;for(var n=e.length,f=null,i=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!f){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}f=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),f=r;continue}r=65536+(f-55296<<10|r-56320)}else f&&(t-=3)>-1&&i.push(239,191,189);if(f=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function asciiToBytes(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function utf16leToBytes(e,t){for(var r,n,f,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,f=r%256,i.push(f),i.push(n);return i}function base64ToBytes(e){return base64.toByteArray(base64clean(e))}function blitBuffer(e,t,r,n){for(var f=0;f<n&&!(f+r>=t.length||f>=e.length);++f)t[f+r]=e[f];return f}function isInstance(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function numberIsNaN(e){return e!=e}
|
|
9
7
|
|
|
10
8
|
}).call(this)}).call(this,require("buffer").Buffer)
|
|
11
|
-
},{"base64-js":1,"buffer":
|
|
12
|
-
(function (Buffer){(function (){
|
|
13
|
-
function isArray(r){return Array.isArray?Array.isArray(r):"[object Array]"===objectToString(r)}function isBoolean(r){return"boolean"==typeof r}function isNull(r){return null===r}function isNullOrUndefined(r){return null==r}function isNumber(r){return"number"==typeof r}function isString(r){return"string"==typeof r}function isSymbol(r){return"symbol"==typeof r}function isUndefined(r){return void 0===r}function isRegExp(r){return"[object RegExp]"===objectToString(r)}function isObject(r){return"object"==typeof r&&null!==r}function isDate(r){return"[object Date]"===objectToString(r)}function isError(r){return"[object Error]"===objectToString(r)||r instanceof Error}function isFunction(r){return"function"==typeof r}function isPrimitive(r){return null===r||"boolean"==typeof r||"number"==typeof r||"string"==typeof r||"symbol"==typeof r||void 0===r}function objectToString(r){return Object.prototype.toString.call(r)}exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=Buffer.isBuffer;
|
|
14
|
-
|
|
15
|
-
}).call(this)}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
|
|
16
|
-
},{"../../is-buffer/index.js":8}],5:[function(require,module,exports){
|
|
17
|
-
var objectCreate=Object.create||objectCreatePolyfill,objectKeys=Object.keys||objectKeysPolyfill,bind=Function.prototype.bind||functionBindPolyfill;function EventEmitter(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=objectCreate(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0;var hasDefineProperty,defaultMaxListeners=10;try{var o={};Object.defineProperty&&Object.defineProperty(o,"x",{value:0}),hasDefineProperty=0===o.x}catch(e){hasDefineProperty=!1}function $getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function emitNone(e,t,n){if(t)e.call(n);else for(var r=e.length,i=arrayClone(e,r),s=0;s<r;++s)i[s].call(n)}function emitOne(e,t,n,r){if(t)e.call(n,r);else for(var i=e.length,s=arrayClone(e,i),o=0;o<i;++o)s[o].call(n,r)}function emitTwo(e,t,n,r,i){if(t)e.call(n,r,i);else for(var s=e.length,o=arrayClone(e,s),a=0;a<s;++a)o[a].call(n,r,i)}function emitThree(e,t,n,r,i,s){if(t)e.call(n,r,i,s);else for(var o=e.length,a=arrayClone(e,o),l=0;l<o;++l)a[l].call(n,r,i,s)}function emitMany(e,t,n,r){if(t)e.apply(n,r);else for(var i=e.length,s=arrayClone(e,i),o=0;o<i;++o)s[o].apply(n,r)}function _addListener(e,t,n,r){var i,s,o;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]):(s=e._events=objectCreate(null),e._eventsCount=0),o){if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),!o.warned&&(i=$getMaxListeners(e))&&i>0&&o.length>i){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",a.name,a.message)}}else o=s[t]=n,++e._eventsCount;return e}function onceWrapper(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function _onceWrap(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=bind.call(onceWrapper,r);return i.listener=n,r.wrapFn=i,i}function _listeners(e,t,n){var r=e._events;if(!r)return[];var i=r[t];return i?"function"==typeof i?n?[i.listener||i]:[i]:n?unwrapListeners(i):arrayClone(i,i.length):[]}function listenerCount(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function spliceOne(e,t){for(var n=t,r=n+1,i=e.length;r<i;n+=1,r+=1)e[n]=e[r];e.pop()}function arrayClone(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function objectCreatePolyfill(e){var t=function(){};return t.prototype=e,new t}function objectKeysPolyfill(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return n}function functionBindPolyfill(e){var t=this;return function(){return t.apply(e,arguments)}}hasDefineProperty?Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return defaultMaxListeners},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');defaultMaxListeners=e}}):EventEmitter.defaultMaxListeners=defaultMaxListeners,EventEmitter.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function(){return $getMaxListeners(this)},EventEmitter.prototype.emit=function(e){var t,n,r,i,s,o,a="error"===e;if(o=this._events)a=a&&null==o.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(n=o[e]))return!1;var u="function"==typeof n;switch(r=arguments.length){case 1:emitNone(n,u,this);break;case 2:emitOne(n,u,this,arguments[1]);break;case 3:emitTwo(n,u,this,arguments[1],arguments[2]);break;case 4:emitThree(n,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(r-1),s=1;s<r;s++)i[s-1]=arguments[s];emitMany(n,u,this,i)}return!0},EventEmitter.prototype.addListener=function(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.removeListener=function(e,t){var n,r,i,s,o;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=objectCreate(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():spliceOne(n,i),1===n.length&&(r[e]=n[0]),r.removeListener&&this.emit("removeListener",e,o||t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n,r;if(!(n=this._events))return this;if(!n.removeListener)return 0===arguments.length?(this._events=objectCreate(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=objectCreate(null):delete n[e]),this;if(0===arguments.length){var i,s=objectKeys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=objectCreate(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};
|
|
18
|
-
|
|
19
|
-
},{}],6:[function(require,module,exports){
|
|
9
|
+
},{"base64-js":1,"buffer":2,"ieee754":3}],3:[function(require,module,exports){
|
|
20
10
|
exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
|
|
21
11
|
|
|
22
|
-
},{}],
|
|
23
|
-
"function"==typeof Object.create?module.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(t,e){if(e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}};
|
|
24
|
-
|
|
25
|
-
},{}],8:[function(require,module,exports){
|
|
26
|
-
function isBuffer(f){return!!f.constructor&&"function"==typeof f.constructor.isBuffer&&f.constructor.isBuffer(f)}function isSlowBuffer(f){return"function"==typeof f.readFloatLE&&"function"==typeof f.slice&&isBuffer(f.slice(0,0))}module.exports=function(f){return null!=f&&(isBuffer(f)||isSlowBuffer(f)||!!f._isBuffer)};
|
|
27
|
-
|
|
28
|
-
},{}],9:[function(require,module,exports){
|
|
29
|
-
var toString={}.toString;module.exports=Array.isArray||function(r){return"[object Array]"==toString.call(r)};
|
|
30
|
-
|
|
31
|
-
},{}],10:[function(require,module,exports){
|
|
12
|
+
},{}],4:[function(require,module,exports){
|
|
32
13
|
(function (process){(function (){
|
|
33
14
|
function normalizeArray(r,t){for(var e=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function basename(r){"string"!=typeof r&&(r+="");var t,e=0,n=-1,o=!0;for(t=r.length-1;t>=0;--t)if(47===r.charCodeAt(t)){if(!o){e=t+1;break}}else-1===n&&(o=!1,n=t+1);return-1===n?"":r.slice(e,n)}function filter(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}exports.resolve=function(){for(var r="",t=!1,e=arguments.length-1;e>=-1&&!t;e--){var n=e>=0?arguments[e]:process.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(r=n+"/"+r,t="/"===n.charAt(0))}return(t?"/":"")+(r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"))||"."},exports.normalize=function(r){var t=exports.isAbsolute(r),e="/"===substr(r,-1);return(r=normalizeArray(filter(r.split("/"),function(r){return!!r}),!t).join("/"))||t||(r="."),r&&e&&(r+="/"),(t?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(r,function(r,t){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),s=Math.min(n.length,o.length),i=s,u=0;u<s;u++)if(n[u]!==o[u]){i=u;break}var l=[];for(u=i;u<n.length;u++)l.push("..");return(l=l.concat(o.slice(i))).join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){if("string"!=typeof r&&(r+=""),0===r.length)return".";for(var t=r.charCodeAt(0),e=47===t,n=-1,o=!0,s=r.length-1;s>=1;--s)if(47===(t=r.charCodeAt(s))){if(!o){n=s;break}}else o=!1;return-1===n?e?"/":".":e&&1===n?"/":r.slice(0,n)},exports.basename=function(r,t){var e=basename(r);return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){"string"!=typeof r&&(r+="");for(var t=-1,e=0,n=-1,o=!0,s=0,i=r.length-1;i>=0;--i){var u=r.charCodeAt(i);if(47!==u)-1===n&&(o=!1,n=i+1),46===u?-1===t?t=i:1!==s&&(s=1):-1!==t&&(s=-1);else if(!o){e=i+1;break}}return-1===t||-1===n||0===s||1===s&&t===n-1&&t===e+1?"":r.slice(t,n)};var substr="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return t<0&&(t=r.length+t),r.substr(t,e)};
|
|
34
15
|
|
|
35
16
|
}).call(this)}).call(this,require('_process'))
|
|
36
|
-
},{"_process":
|
|
37
|
-
(function (process){(function (){
|
|
38
|
-
"use strict";function nextTick(e,n,c,r){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,t,o=arguments.length;switch(o){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,n)});case 3:return process.nextTick(function(){e.call(null,n,c)});case 4:return process.nextTick(function(){e.call(null,n,c,r)});default:for(s=new Array(o-1),t=0;t<s.length;)s[t++]=arguments[t];return process.nextTick(function(){e.apply(null,s)})}}"undefined"==typeof process||!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?module.exports={nextTick:nextTick}:module.exports=process;
|
|
39
|
-
|
|
40
|
-
}).call(this)}).call(this,require('_process'))
|
|
41
|
-
},{"_process":12}],12:[function(require,module,exports){
|
|
17
|
+
},{"_process":5}],5:[function(require,module,exports){
|
|
42
18
|
var cachedSetTimeout,cachedClearTimeout,process=module.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(e){if(cachedSetTimeout===setTimeout)return setTimeout(e,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(e,0);try{return cachedSetTimeout(e,0)}catch(t){try{return cachedSetTimeout.call(null,e,0)}catch(t){return cachedSetTimeout.call(this,e,0)}}}function runClearTimeout(e){if(cachedClearTimeout===clearTimeout)return clearTimeout(e);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(e);try{return cachedClearTimeout(e)}catch(t){try{return cachedClearTimeout.call(null,e)}catch(t){return cachedClearTimeout.call(this,e)}}}!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var e=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(e)}}function Item(e,t){this.fun=e,this.array=t}function noop(){}process.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];queue.push(new Item(e,t)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.prependListener=noop,process.prependOnceListener=noop,process.listeners=function(e){return[]},process.binding=function(e){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(e){throw new Error("process.chdir is not supported")},process.umask=function(){return 0};
|
|
43
19
|
|
|
44
|
-
},{}],
|
|
45
|
-
module.exports=require("./lib/_stream_duplex.js");
|
|
46
|
-
|
|
47
|
-
},{"./lib/_stream_duplex.js":14}],14:[function(require,module,exports){
|
|
48
|
-
"use strict";var pna=require("process-nextick-args"),objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=Duplex;var util=Object.create(require("core-util-is"));util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++){var method=keys[v];Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method])}function Duplex(e){if(!(this instanceof Duplex))return new Duplex(e);Readable.call(this,e),Writable.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||pna.nextTick(onEndNT,this)}function onEndNT(e){e.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),Duplex.prototype._destroy=function(e,t){this.push(null),this.end(),pna.nextTick(t,e)};
|
|
49
|
-
|
|
50
|
-
},{"./_stream_readable":16,"./_stream_writable":18,"core-util-is":4,"inherits":7,"process-nextick-args":11}],15:[function(require,module,exports){
|
|
51
|
-
"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform"),util=Object.create(require("core-util-is"));function PassThrough(r){if(!(this instanceof PassThrough))return new PassThrough(r);Transform.call(this,r)}util.inherits=require("inherits"),util.inherits(PassThrough,Transform),PassThrough.prototype._transform=function(r,s,t){t(null,r)};
|
|
52
|
-
|
|
53
|
-
},{"./_stream_transform":17,"core-util-is":4,"inherits":7}],16:[function(require,module,exports){
|
|
54
|
-
(function (process,global){(function (){
|
|
55
|
-
"use strict";var pna=require("process-nextick-args");module.exports=Readable;var Duplex,isArray=require("isarray");Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter,EElistenerCount=function(e,t){return e.listeners(t).length},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(e){return Buffer.from(e)}function _isUint8Array(e){return Buffer.isBuffer(e)||e instanceof OurUint8Array}var util=Object.create(require("core-util-is"));util.inherits=require("inherits");var debugUtil=require("util"),debug=void 0;debug=debugUtil&&debugUtil.debuglog?debugUtil.debuglog("stream"):function(){};var StringDecoder,BufferList=require("./internal/streams/BufferList"),destroyImpl=require("./internal/streams/destroy");util.inherits(Readable,Stream);var kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function ReadableState(e,t){e=e||{};var r=t instanceof(Duplex=Duplex||require("./_stream_duplex"));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var n=e.highWaterMark,a=e.readableHighWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(a||0===a)?a:i,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this.decoder=new StringDecoder(e.encoding),this.encoding=e.encoding)}function Readable(e){if(Duplex=Duplex||require("./_stream_duplex"),!(this instanceof Readable))return new Readable(e);this._readableState=new ReadableState(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),Stream.call(this)}function readableAddChunk(e,t,r,n,a){var i,d=e._readableState;null===t?(d.reading=!1,onEofChunk(e,d)):(a||(i=chunkInvalid(d,t)),i?e.emit("error",i):d.objectMode||t&&t.length>0?("string"==typeof t||d.objectMode||Object.getPrototypeOf(t)===Buffer.prototype||(t=_uint8ArrayToBuffer(t)),n?d.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):addChunk(e,d,t,!0):d.ended?e.emit("error",new Error("stream.push() after EOF")):(d.reading=!1,d.decoder&&!r?(t=d.decoder.write(t),d.objectMode||0!==t.length?addChunk(e,d,t,!1):maybeReadMore(e,d)):addChunk(e,d,t,!1))):n||(d.reading=!1));return needMoreData(d)}function addChunk(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&emitReadable(e)),maybeReadMore(e,t)}function chunkInvalid(e,t){var r;return _isUint8Array(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function needMoreData(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),Readable.prototype.destroy=destroyImpl.destroy,Readable.prototype._undestroy=destroyImpl.undestroy,Readable.prototype._destroy=function(e,t){this.push(null),t(e)},Readable.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=Buffer.from(e,t),t=""),r=!0),readableAddChunk(this,e,t,!1,r)},Readable.prototype.unshift=function(e){return readableAddChunk(this,e,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(e){return StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this._readableState.decoder=new StringDecoder(e),this._readableState.encoding=e,this};var MAX_HWM=8388608;function computeNewHighWaterMark(e){return e>=MAX_HWM?e=MAX_HWM:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function howMuchToRead(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=computeNewHighWaterMark(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function onEofChunk(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,emitReadable(e)}}function emitReadable(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(debug("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?pna.nextTick(emitReadable_,e):emitReadable_(e))}function emitReadable_(e){debug("emit readable"),e.emit("readable"),flow(e)}function maybeReadMore(e,t){t.readingMore||(t.readingMore=!0,pna.nextTick(maybeReadMore_,e,t))}function maybeReadMore_(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(debug("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function pipeOnDrain(e){return function(){var t=e._readableState;debug("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&EElistenerCount(e,"data")&&(t.flowing=!0,flow(e))}}function nReadingNextTick(e){debug("readable nexttick read 0"),e.read(0)}function resume(e,t){t.resumeScheduled||(t.resumeScheduled=!0,pna.nextTick(resume_,e,t))}function resume_(e,t){t.reading||(debug("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),flow(e),t.flowing&&!t.reading&&e.read(0)}function flow(e){var t=e._readableState;for(debug("flow",t.flowing);t.flowing&&null!==e.read(););}function fromList(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=fromListPartial(e,t.buffer,t.decoder),r);var r}function fromListPartial(e,t,r){var n;return e<t.head.data.length?(n=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):n=e===t.head.data.length?t.shift():r?copyFromBufferString(e,t):copyFromBuffer(e,t),n}function copyFromBufferString(e,t){var r=t.head,n=1,a=r.data;for(e-=a.length;r=r.next;){var i=r.data,d=e>i.length?i.length:e;if(d===i.length?a+=i:a+=i.slice(0,e),0===(e-=d)){d===i.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(d));break}++n}return t.length-=n,a}function copyFromBuffer(e,t){var r=Buffer.allocUnsafe(e),n=t.head,a=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var i=n.data,d=e>i.length?i.length:e;if(i.copy(r,r.length-e,0,d),0===(e-=d)){d===i.length?(++a,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(d));break}++a}return t.length-=a,r}function endReadable(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,pna.nextTick(endReadableNT,t,e))}function endReadableNT(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function indexOf(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}Readable.prototype.read=function(e){debug("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return debug("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?endReadable(this):emitReadable(this),null;if(0===(e=howMuchToRead(e,t))&&t.ended)return 0===t.length&&endReadable(this),null;var n,a=t.needReadable;return debug("need readable",a),(0===t.length||t.length-e<t.highWaterMark)&&debug("length less than watermark",a=!0),t.ended||t.reading?debug("reading or ended",a=!1):a&&(debug("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=howMuchToRead(r,t))),null===(n=e>0?fromList(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&endReadable(this)),null!==n&&this.emit("data",n),n},Readable.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,debug("pipe count=%d opts=%j",n.pipesCount,t);var a=(!t||!1!==t.end)&&e!==process.stdout&&e!==process.stderr?d:b;function i(t,a){debug("onunpipe"),t===r&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,debug("cleanup"),e.removeListener("close",f),e.removeListener("finish",p),e.removeListener("drain",o),e.removeListener("error",h),e.removeListener("unpipe",i),r.removeListener("end",d),r.removeListener("end",b),r.removeListener("data",s),u=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||o())}function d(){debug("onend"),e.end()}n.endEmitted?pna.nextTick(a):r.once("end",a),e.on("unpipe",i);var o=pipeOnDrain(r);e.on("drain",o);var u=!1;var l=!1;function s(t){debug("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==indexOf(n.pipes,e))&&!u&&(debug("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function h(t){debug("onerror",t),b(),e.removeListener("error",h),0===EElistenerCount(e,"error")&&e.emit("error",t)}function f(){e.removeListener("finish",p),b()}function p(){debug("onfinish"),e.removeListener("close",f),b()}function b(){debug("unpipe"),r.unpipe(e)}return r.on("data",s),prependListener(e,"error",h),e.once("close",f),e.once("finish",p),e.emit("pipe",r),n.flowing||(debug("pipe resume"),r.resume()),e},Readable.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,a=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<a;i++)n[i].emit("unpipe",this,r);return this}var d=indexOf(t.pipes,e);return-1===d?this:(t.pipes.splice(d,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},Readable.prototype.on=function(e,t){var r=Stream.prototype.on.call(this,e,t);if("data"===e)!1!==this._readableState.flowing&&this.resume();else if("readable"===e){var n=this._readableState;n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.emittedReadable=!1,n.reading?n.length&&emitReadable(this):pna.nextTick(nReadingNextTick,this))}return r},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var e=this._readableState;return e.flowing||(debug("resume"),e.flowing=!0,resume(this,e)),this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var a in e.on("end",function(){if(debug("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(a){(debug("wrapped data"),r.decoder&&(a=r.decoder.write(a)),r.objectMode&&null==a)||(r.objectMode||a&&a.length)&&(t.push(a)||(n=!0,e.pause()))}),e)void 0===this[a]&&"function"==typeof e[a]&&(this[a]=function(t){return function(){return e[t].apply(e,arguments)}}(a));for(var i=0;i<kProxyEvents.length;i++)e.on(kProxyEvents[i],this.emit.bind(this,kProxyEvents[i]));return this._read=function(t){debug("wrapped _read",t),n&&(n=!1,e.resume())},this},Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Readable._fromList=fromList;
|
|
56
|
-
|
|
57
|
-
}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
58
|
-
},{"./_stream_duplex":14,"./internal/streams/BufferList":19,"./internal/streams/destroy":20,"./internal/streams/stream":21,"_process":12,"core-util-is":4,"events":5,"inherits":7,"isarray":9,"process-nextick-args":11,"safe-buffer":22,"string_decoder/":23,"util":2}],17:[function(require,module,exports){
|
|
59
|
-
"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex"),util=Object.create(require("core-util-is"));function afterTransform(r,t){var e=this._transformState;e.transforming=!1;var n=e.writecb;if(!n)return this.emit("error",new Error("write callback called multiple times"));e.writechunk=null,e.writecb=null,null!=t&&this.push(t),n(r);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Transform(r){if(!(this instanceof Transform))return new Transform(r);Duplex.call(this,r),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,r&&("function"==typeof r.transform&&(this._transform=r.transform),"function"==typeof r.flush&&(this._flush=r.flush)),this.on("prefinish",prefinish)}function prefinish(){var r=this;"function"==typeof this._flush?this._flush(function(t,e){done(r,t,e)}):done(this,null,null)}function done(r,t,e){if(t)return r.emit("error",t);if(null!=e&&r.push(e),r._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(r._transformState.transforming)throw new Error("Calling transform done when still transforming");return r.push(null)}util.inherits=require("inherits"),util.inherits(Transform,Duplex),Transform.prototype.push=function(r,t){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(r,t,e){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(r,t,e){var n=this._transformState;if(n.writecb=e,n.writechunk=r,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},Transform.prototype._read=function(r){var t=this._transformState;null!==t.writechunk&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0},Transform.prototype._destroy=function(r,t){var e=this;Duplex.prototype._destroy.call(this,r,function(r){t(r),e.emit("close")})};
|
|
60
|
-
|
|
61
|
-
},{"./_stream_duplex":14,"core-util-is":4,"inherits":7}],18:[function(require,module,exports){
|
|
62
|
-
(function (process,global,setImmediate){(function (){
|
|
63
|
-
"use strict";var pna=require("process-nextick-args");function WriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function CorkedRequest(e){var t=this;this.next=null,this.entry=null,this.finish=function(){onCorkedFinish(t,e)}}module.exports=Writable;var Duplex,asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:pna.nextTick;Writable.WritableState=WritableState;var util=Object.create(require("core-util-is"));util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")},Stream=require("./internal/streams/stream"),Buffer=require("safe-buffer").Buffer,OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(e){return Buffer.from(e)}function _isUint8Array(e){return Buffer.isBuffer(e)||e instanceof OurUint8Array}var realHasInstance,destroyImpl=require("./internal/streams/destroy");function nop(){}function WritableState(e,t){Duplex=Duplex||require("./_stream_duplex"),e=e||{};var r=t instanceof Duplex;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(n||0===n)?n:o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===e.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(e){if(Duplex=Duplex||require("./_stream_duplex"),!(realHasInstance.call(Writable,this)||this instanceof Duplex))return new Writable(e);this._writableState=new WritableState(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),Stream.call(this)}function writeAfterEnd(e,t){var r=new Error("write after end");e.emit("error",r),pna.nextTick(t,r)}function validChunk(e,t,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),pna.nextTick(i,o),n=!1),n}function decodeChunk(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=Buffer.from(t,r)),t}function writeOrBuffer(e,t,r,i,n,o){if(!r){var a=decodeChunk(t,i,n);i!==a&&(r=!0,n="buffer",i=a)}var s=t.objectMode?1:i.length;t.length+=s;var f=t.length<t.highWaterMark;if(f||(t.needDrain=!0),t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else doWrite(e,t,!1,s,i,n,o);return f}function doWrite(e,t,r,i,n,o,a){t.writelen=i,t.writecb=a,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function onwriteError(e,t,r,i,n){--t.pendingcb,r?(pna.nextTick(n,i),pna.nextTick(finishMaybe,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),finishMaybe(e,t))}function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function onwrite(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{var o=needFinish(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||clearBuffer(e,r),i?asyncWrite(afterWrite,e,r,o,n):afterWrite(e,r,o,n)}}function afterWrite(e,t,r,i){r||onwriteDrain(e,t),t.pendingcb--,i(),finishMaybe(e,t)}function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function clearBuffer(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var a=0,s=!0;r;)n[a]=r,r.isBuf||(s=!1),r=r.next,a+=1;n.allBuffers=s,doWrite(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new CorkedRequest(t),t.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,u=r.encoding,l=r.callback;if(doWrite(e,t,!1,t.objectMode?1:f.length,f,u,l),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function needFinish(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function callFinal(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),finishMaybe(e,t)})}function prefinish(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,pna.nextTick(callFinal,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function finishMaybe(e,t){var r=needFinish(t);return r&&(prefinish(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),r}function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?pna.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function onCorkedFinish(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}util.inherits(Writable,Stream),WritableState.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(realHasInstance=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(e){return!!realHasInstance.call(this,e)||this===Writable&&(e&&e._writableState instanceof WritableState)}})):realHasInstance=function(e){return e instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&_isUint8Array(e);return o&&!Buffer.isBuffer(e)&&(e=_uint8ArrayToBuffer(e)),"function"==typeof t&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=nop),i.ended?writeAfterEnd(this,r):(o||validChunk(this,i,e,r))&&(i.pendingcb++,n=writeOrBuffer(this,i,o,e,t,r)),n},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||clearBuffer(this,e))},Writable.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||endWritable(this,i,r)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),Writable.prototype.destroy=destroyImpl.destroy,Writable.prototype._undestroy=destroyImpl.undestroy,Writable.prototype._destroy=function(e,t){this.end(),t(e)};
|
|
64
|
-
|
|
65
|
-
}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
|
66
|
-
},{"./_stream_duplex":14,"./internal/streams/destroy":20,"./internal/streams/stream":21,"_process":12,"core-util-is":4,"inherits":7,"process-nextick-args":11,"safe-buffer":22,"timers":31,"util-deprecate":32}],19:[function(require,module,exports){
|
|
67
|
-
"use strict";function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Buffer=require("safe-buffer").Buffer,util=require("util");function copyBuffer(t,e,i){t.copy(e,i)}module.exports=function(){function t(){_classCallCheck(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,i=""+e.data;e=e.next;)i+=t+e.data;return i},t.prototype.concat=function(t){if(0===this.length)return Buffer.alloc(0);if(1===this.length)return this.head.data;for(var e=Buffer.allocUnsafe(t>>>0),i=this.head,n=0;i;)copyBuffer(i.data,e,n),n+=i.data.length,i=i.next;return e},t}(),util&&util.inspect&&util.inspect.custom&&(module.exports.prototype[util.inspect.custom]=function(){var t=util.inspect({length:this.length});return this.constructor.name+" "+t});
|
|
68
|
-
|
|
69
|
-
},{"safe-buffer":22,"util":2}],20:[function(require,module,exports){
|
|
70
|
-
"use strict";var pna=require("process-nextick-args");function destroy(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return a||i?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||pna.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(pna.nextTick(emitErrorNT,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)}function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function emitErrorNT(t,e){t.emit("error",e)}module.exports={destroy:destroy,undestroy:undestroy};
|
|
71
|
-
|
|
72
|
-
},{"process-nextick-args":11}],21:[function(require,module,exports){
|
|
73
|
-
module.exports=require("events").EventEmitter;
|
|
74
|
-
|
|
75
|
-
},{"events":5}],22:[function(require,module,exports){
|
|
76
|
-
var buffer=require("buffer"),Buffer=buffer.Buffer;function copyProps(f,r){for(var e in f)r[e]=f[e]}function SafeBuffer(f,r,e){return Buffer(f,r,e)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(f,r,e){if("number"==typeof f)throw new TypeError("Argument must not be a number");return Buffer(f,r,e)},SafeBuffer.alloc=function(f,r,e){if("number"!=typeof f)throw new TypeError("Argument must be a number");var u=Buffer(f);return void 0!==r?"string"==typeof e?u.fill(r,e):u.fill(r):u.fill(0),u},SafeBuffer.allocUnsafe=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return Buffer(f)},SafeBuffer.allocUnsafeSlow=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(f)};
|
|
77
|
-
|
|
78
|
-
},{"buffer":3}],23:[function(require,module,exports){
|
|
79
|
-
"use strict";var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function normalizeEncoding(t){var e=_normalizeEncoding(t);if("string"!=typeof e&&(Buffer.isEncoding===isEncoding||!isEncoding(t)))throw new Error("Unknown encoding: "+t);return e||t}function StringDecoder(t){var e;switch(this.encoding=normalizeEncoding(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,e=4;break;case"utf8":this.fillLast=utf8FillLast,e=4;break;case"base64":this.text=base64Text,this.end=base64End,e=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(e)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8CheckIncomplete(t,e,s){var i=e.length-1;if(i<s)return 0;var n=utf8CheckByte(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<s||-2===n?0:(n=utf8CheckByte(e[i]))>=0?(n>0&&(t.lastNeed=n-2),n):--i<s||-2===n?0:(n=utf8CheckByte(e[i]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function utf8CheckExtraBytes(t,e,s){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function utf8FillLast(t){var e=this.lastTotal-this.lastNeed,s=utf8CheckExtraBytes(this,t,e);return void 0!==s?s:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function utf8Text(t,e){var s=utf8CheckIncomplete(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var i=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function utf8End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function utf16Text(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var i=s.charCodeAt(s.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function utf16End(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function base64Text(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-s))}function base64End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s<t.length?e?e+this.text(t,s):this.text(t,s):e||""},StringDecoder.prototype.end=utf8End,StringDecoder.prototype.text=utf8Text,StringDecoder.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};
|
|
80
|
-
|
|
81
|
-
},{"safe-buffer":22}],24:[function(require,module,exports){
|
|
82
|
-
module.exports=require("./readable").PassThrough;
|
|
83
|
-
|
|
84
|
-
},{"./readable":25}],25:[function(require,module,exports){
|
|
85
|
-
exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js");
|
|
86
|
-
|
|
87
|
-
},{"./lib/_stream_duplex.js":14,"./lib/_stream_passthrough.js":15,"./lib/_stream_readable.js":16,"./lib/_stream_transform.js":17,"./lib/_stream_writable.js":18}],26:[function(require,module,exports){
|
|
88
|
-
module.exports=require("./readable").Transform;
|
|
89
|
-
|
|
90
|
-
},{"./readable":25}],27:[function(require,module,exports){
|
|
91
|
-
module.exports=require("./lib/_stream_writable.js");
|
|
92
|
-
|
|
93
|
-
},{"./lib/_stream_writable.js":18}],28:[function(require,module,exports){
|
|
94
|
-
var buffer=require("buffer"),Buffer=buffer.Buffer;function copyProps(f,e){for(var r in f)e[r]=f[r]}function SafeBuffer(f,e,r){return Buffer(f,e,r)}Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow?module.exports=buffer:(copyProps(buffer,exports),exports.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(Buffer.prototype),copyProps(Buffer,SafeBuffer),SafeBuffer.from=function(f,e,r){if("number"==typeof f)throw new TypeError("Argument must not be a number");return Buffer(f,e,r)},SafeBuffer.alloc=function(f,e,r){if("number"!=typeof f)throw new TypeError("Argument must be a number");var u=Buffer(f);return void 0!==e?"string"==typeof r?u.fill(e,r):u.fill(e):u.fill(0),u},SafeBuffer.allocUnsafe=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return Buffer(f)},SafeBuffer.allocUnsafeSlow=function(f){if("number"!=typeof f)throw new TypeError("Argument must be a number");return buffer.SlowBuffer(f)};
|
|
95
|
-
|
|
96
|
-
},{"buffer":3}],29:[function(require,module,exports){
|
|
97
|
-
module.exports=Stream;var EE=require("events").EventEmitter,inherits=require("inherits");function Stream(){EE.call(this)}inherits(Stream,EE),Stream.Readable=require("readable-stream/readable.js"),Stream.Writable=require("readable-stream/writable.js"),Stream.Duplex=require("readable-stream/duplex.js"),Stream.Transform=require("readable-stream/transform.js"),Stream.PassThrough=require("readable-stream/passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(e,r){var t=this;function n(r){e.writable&&!1===e.write(r)&&t.pause&&t.pause()}function a(){t.readable&&t.resume&&t.resume()}t.on("data",n),e.on("drain",a),e._isStdio||r&&!1===r.end||(t.on("end",i),t.on("close",s));var o=!1;function i(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function m(e){if(u(),0===EE.listenerCount(this,"error"))throw e}function u(){t.removeListener("data",n),e.removeListener("drain",a),t.removeListener("end",i),t.removeListener("close",s),t.removeListener("error",m),e.removeListener("error",m),t.removeListener("end",u),t.removeListener("close",u),e.removeListener("close",u)}return t.on("error",m),e.on("error",m),t.on("end",u),t.on("close",u),e.on("close",u),e.emit("pipe",t),e};
|
|
98
|
-
|
|
99
|
-
},{"events":5,"inherits":7,"readable-stream/duplex.js":13,"readable-stream/passthrough.js":24,"readable-stream/readable.js":25,"readable-stream/transform.js":26,"readable-stream/writable.js":27}],30:[function(require,module,exports){
|
|
100
|
-
"use strict";var Buffer=require("safe-buffer").Buffer,isEncoding=Buffer.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function _normalizeEncoding(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function normalizeEncoding(t){var e=_normalizeEncoding(t);if("string"!=typeof e&&(Buffer.isEncoding===isEncoding||!isEncoding(t)))throw new Error("Unknown encoding: "+t);return e||t}function StringDecoder(t){var e;switch(this.encoding=normalizeEncoding(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,e=4;break;case"utf8":this.fillLast=utf8FillLast,e=4;break;case"base64":this.text=base64Text,this.end=base64End,e=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=Buffer.allocUnsafe(e)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8CheckIncomplete(t,e,s){var i=e.length-1;if(i<s)return 0;var n=utf8CheckByte(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<s||-2===n?0:(n=utf8CheckByte(e[i]))>=0?(n>0&&(t.lastNeed=n-2),n):--i<s||-2===n?0:(n=utf8CheckByte(e[i]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}function utf8CheckExtraBytes(t,e,s){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}function utf8FillLast(t){var e=this.lastTotal-this.lastNeed,s=utf8CheckExtraBytes(this,t,e);return void 0!==s?s:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function utf8Text(t,e){var s=utf8CheckIncomplete(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var i=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function utf8End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function utf16Text(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var i=s.charCodeAt(s.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function utf16End(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function base64Text(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-s))}function base64End(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}exports.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s<t.length?e?e+this.text(t,s):this.text(t,s):e||""},StringDecoder.prototype.end=utf8End,StringDecoder.prototype.text=utf8Text,StringDecoder.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};
|
|
101
|
-
|
|
102
|
-
},{"safe-buffer":28}],31:[function(require,module,exports){
|
|
103
|
-
(function (setImmediate,clearImmediate){(function (){
|
|
104
|
-
var nextTick=require("process/browser.js").nextTick,apply=Function.prototype.apply,slice=Array.prototype.slice,immediateIds={},nextImmediateId=0;function Timeout(e,t){this._id=e,this._clearFn=t}exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)},exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)},exports.clearTimeout=exports.clearInterval=function(e){e.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(window,this._id)},exports.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},exports.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},exports._unrefActive=exports.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},exports.setImmediate="function"==typeof setImmediate?setImmediate:function(e){var t=nextImmediateId++,i=!(arguments.length<2)&&slice.call(arguments,1);return immediateIds[t]=!0,nextTick(function(){immediateIds[t]&&(i?e.apply(null,i):e.call(null),exports.clearImmediate(t))}),t},exports.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(e){delete immediateIds[e]};
|
|
105
|
-
|
|
106
|
-
}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
|
|
107
|
-
},{"process/browser.js":12,"timers":31}],32:[function(require,module,exports){
|
|
108
|
-
(function (global){(function (){
|
|
109
|
-
function deprecate(r,e){if(config("noDeprecation"))return r;var o=!1;return function(){if(!o){if(config("throwDeprecation"))throw new Error(e);config("traceDeprecation")?console.trace(e):console.warn(e),o=!0}return r.apply(this,arguments)}}function config(r){try{if(!global.localStorage)return!1}catch(r){return!1}var e=global.localStorage[r];return null!=e&&"true"===String(e).toLowerCase()}module.exports=deprecate;
|
|
20
|
+
},{}],6:[function(require,module,exports){
|
|
21
|
+
!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),t=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),r=function(u){if(!t(u))throw TypeError(u+" is not an object!");return u},F=function(u){try{return!!u()}catch(u){return!0}},n=!F(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=t(C)&&t(C.createElement),i=!n&&!F(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:n?Object.defineProperty:function(u,D,e){if(r(u),D=function(u,D){if(!t(u))return u;var e,r;if(D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;if("function"==typeof(e=u.valueOf)&&!t(r=e.call(u)))return r;if(!D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;throw TypeError("Can't convert object to primitive value")}(D,!0),r(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=n?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var t=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return t[u]||(t[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var t,r="Symbol(".concat(void 0===(t="src")?"":t,")_",(++s+f).toString(36)),F=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,t,n){var C="function"==typeof t;C&&(B(t,"name")||a(t,"name",e)),u[e]!==t&&(C&&(B(t,r)||a(t,r,u[e]?""+u[e]:F.join(String(e)))),u===D?u[e]=t:n?u[e]?u[e]=t:a(u,e,t):(delete u[e],a(u,e,t)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,t){return u.call(D,e,t)};case 3:return function(e,t,r){return u.call(D,e,t,r)}}return function(){return u.apply(D,arguments)}},p=function(u,t,r){var F,n,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[t]||(D[t]={}):(D[t]||{}).prototype,f=E?e:e[t]||(e[t]={}),l=f.prototype||(f.prototype={});for(F in E&&(r=t),r)C=((n=!i&&s&&void 0!==s[F])?s:r)[F],A=B&&n?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,F,C,u&p.U),f[F]!=C&&a(f,F,A),c&&l[F]!=C&&(l[F]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},S=(h=!1,function(u,D){var e,t,r=String(function(u){if(null==u)throw TypeError("Can't call method on "+u);return u}(u)),F=w(D),n=r.length;return F<0||F>=n?h?"":void 0:(e=r.charCodeAt(F))<55296||e>56319||F+1===n||(t=r.charCodeAt(F+1))<56320||t>57343?h?r.charAt(F):e:h?r.slice(F,F+2):t-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return S(this,u)}});e.String.codePointAt;var b=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,t,r=arguments,F=[],n=arguments.length,C=0;n>C;){if(D=+r[C++],t=1114111,((e=w(e=D))<0?b(e+t,0):x(e,t))!==D)throw RangeError(D+" is not a valid code point");F.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return F.join("")}});e.String.fromCodePoint;var _,I,O,j,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,ID_Continue:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},U={isSpaceSeparator:function(u){return"string"==typeof u&&G.Space_Separator.test(u)},isIdStartChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||G.ID_Start.test(u))},isIdContinueChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||""===u||""===u||G.ID_Continue.test(u))},isDigit:function(u){return"string"==typeof u&&/[0-9]/.test(u)},isHexDigit:function(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};function Z(){for(T="default",z="",H=!1,$=1;;){R=q();var u=X[T]();if(u)return u}}function q(){if(_[j])return String.fromCodePoint(_.codePointAt(j))}function W(){var u=q();return"\n"===u?(V++,J=0):u?J+=u.length:J++,u&&(j+=u.length),u}var X={default:function(){switch(R){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void W();case"/":return W(),void(T="comment");case void 0:return W(),K("eof")}if(!U.isSpaceSeparator(R))return X[I]();W()},comment:function(){switch(R){case"*":return W(),void(T="multiLineComment");case"/":return W(),void(T="singleLineComment")}throw tu(W())},multiLineComment:function(){switch(R){case"*":return W(),void(T="multiLineCommentAsterisk");case void 0:throw tu(W())}W()},multiLineCommentAsterisk:function(){switch(R){case"*":return void W();case"/":return W(),void(T="default");case void 0:throw tu(W())}W(),T="multiLineComment"},singleLineComment:function(){switch(R){case"\n":case"\r":case"\u2028":case"\u2029":return W(),void(T="default");case void 0:return W(),K("eof")}W()},value:function(){switch(R){case"{":case"[":return K("punctuator",W());case"n":return W(),Q("ull"),K("null",null);case"t":return W(),Q("rue"),K("boolean",!0);case"f":return W(),Q("alse"),K("boolean",!1);case"-":case"+":return"-"===W()&&($=-1),void(T="sign");case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",1/0);case"N":return W(),Q("aN"),K("numeric",NaN);case'"':case"'":return H='"'===W(),z="",void(T="string")}throw tu(W())},identifierNameStartEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":break;default:if(!U.isIdStartChar(u))throw Fu()}z+=u,T="identifierName"},identifierName:function(){switch(R){case"$":case"_":case"":case"":return void(z+=W());case"\\":return W(),void(T="identifierNameEscape")}if(!U.isIdContinueChar(R))return K("identifier",z);z+=W()},identifierNameEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":case"":case"":break;default:if(!U.isIdContinueChar(u))throw Fu()}z+=u,T="identifierName"},sign:function(){switch(R){case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",$*(1/0));case"N":return W(),Q("aN"),K("numeric",NaN)}throw tu(W())},zero:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent");case"x":case"X":return z+=W(),void(T="hexadecimal")}return K("numeric",0*$)},decimalInteger:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalPointLeading:function(){if(U.isDigit(R))return z+=W(),void(T="decimalFraction");throw tu(W())},decimalPoint:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}return U.isDigit(R)?(z+=W(),void(T="decimalFraction")):K("numeric",$*Number(z))},decimalFraction:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalExponent:function(){switch(R){case"+":case"-":return z+=W(),void(T="decimalExponentSign")}if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentSign:function(){if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentInteger:function(){if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},hexadecimal:function(){if(U.isHexDigit(R))return z+=W(),void(T="hexadecimalInteger");throw tu(W())},hexadecimalInteger:function(){if(!U.isHexDigit(R))return K("numeric",$*Number(z));z+=W()},string:function(){switch(R){case"\\":return W(),void(z+=function(){switch(q()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),"\n";case"r":return W(),"\r";case"t":return W(),"\t";case"v":return W(),"\v";case"0":if(W(),U.isDigit(q()))throw tu(W());return"\0";case"x":return W(),function(){var u="",D=q();if(!U.isHexDigit(D))throw tu(W());if(u+=W(),D=q(),!U.isHexDigit(D))throw tu(W());return u+=W(),String.fromCodePoint(parseInt(u,16))}();case"u":return W(),Y();case"\n":case"\u2028":case"\u2029":return W(),"";case"\r":return W(),"\n"===q()&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw tu(W())}return W()}());case'"':return H?(W(),K("string",z)):void(z+=W());case"'":return H?void(z+=W()):(W(),K("string",z));case"\n":case"\r":throw tu(W());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+nu(u)+"' in strings is not valid ECMAScript; consider escaping")}(R);break;case void 0:throw tu(W())}z+=W()},start:function(){switch(R){case"{":case"[":return K("punctuator",W())}T="value"},beforePropertyName:function(){switch(R){case"$":case"_":return z=W(),void(T="identifierName");case"\\":return W(),void(T="identifierNameStartEscape");case"}":return K("punctuator",W());case'"':case"'":return H='"'===W(),void(T="string")}if(U.isIdStartChar(R))return z+=W(),void(T="identifierName");throw tu(W())},afterPropertyName:function(){if(":"===R)return K("punctuator",W());throw tu(W())},beforePropertyValue:function(){T="value"},afterPropertyValue:function(){switch(R){case",":case"}":return K("punctuator",W())}throw tu(W())},beforeArrayValue:function(){if("]"===R)return K("punctuator",W());T="value"},afterArrayValue:function(){switch(R){case",":case"]":return K("punctuator",W())}throw tu(W())},end:function(){throw tu(W())}};function K(u,D){return{type:u,value:D,line:V,column:J}}function Q(u){for(var D=0,e=u;D<e.length;D+=1){var t=e[D];if(q()!==t)throw tu(W());W()}}function Y(){for(var u="",D=4;D-- >0;){var e=q();if(!U.isHexDigit(e))throw tu(W());u+=W()}return String.fromCodePoint(parseInt(u,16))}var uu={start:function(){if("eof"===M.type)throw ru();Du()},beforePropertyName:function(){switch(M.type){case"identifier":case"string":return k=M.value,void(I="afterPropertyName");case"punctuator":return void eu();case"eof":throw ru()}},afterPropertyName:function(){if("eof"===M.type)throw ru();I="beforePropertyValue"},beforePropertyValue:function(){if("eof"===M.type)throw ru();Du()},beforeArrayValue:function(){if("eof"===M.type)throw ru();"punctuator"!==M.type||"]"!==M.value?Du():eu()},afterPropertyValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforePropertyName");case"}":eu()}},afterArrayValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforeArrayValue");case"]":eu()}},end:function(){}};function Du(){var u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}if(void 0===L)L=u;else{var D=O[O.length-1];Array.isArray(D)?D.push(u):D[k]=u}if(null!==u&&"object"==typeof u)O.push(u),I=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var e=O[O.length-1];I=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function eu(){O.pop();var u=O[O.length-1];I=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function tu(u){return Cu(void 0===u?"JSON5: invalid end of input at "+V+":"+J:"JSON5: invalid character '"+nu(u)+"' at "+V+":"+J)}function ru(){return Cu("JSON5: invalid end of input at "+V+":"+J)}function Fu(){return Cu("JSON5: invalid identifier character at "+V+":"+(J-=5))}function nu(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var e=u.charCodeAt(0).toString(16);return"\\x"+("00"+e).substring(e.length)}return u}function Cu(u){var D=new SyntaxError(u);return D.lineNumber=V,D.columnNumber=J,D}return{parse:function(u,D){_=String(u),I="start",O=[],j=0,V=1,J=0,M=void 0,k=void 0,L=void 0;do{M=Z(),uu[I]()}while("eof"!==M.type);return"function"==typeof D?function u(D,e,t){var r=D[e];if(null!=r&&"object"==typeof r)for(var F in r){var n=u(r,F,t);void 0===n?delete r[F]:r[F]=n}return t.call(D,e,r)}({"":L},"",D):L},stringify:function(u,D,e){var t,r,F,n=[],C="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,F=D.quote,D=D.replacer),"function"==typeof D)r=D;else if(Array.isArray(D)){t=[];for(var i=0,E=D;i<E.length;i+=1){var o=E[i],a=void 0;"string"==typeof o?a=o:("number"==typeof o||o instanceof String||o instanceof Number)&&(a=String(o)),void 0!==a&&t.indexOf(a)<0&&t.push(a)}}return e instanceof Number?e=Number(e):e instanceof String&&(e=String(e)),"number"==typeof e?e>0&&(e=Math.min(10,Math.floor(e)),A=" ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),c("",{"":u});function c(u,D){var e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),r&&(e=r.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?B(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,t=[],r=0;r<u.length;r++){var F=c(String(r),u);t.push(void 0!==F?F:"null")}if(0===t.length)e="[]";else if(""===A){var i=t.join(",");e="["+i+"]"}else{var E=",\n"+C,o=t.join(E);e="[\n"+C+o+",\n"+D+"]"}return n.pop(),C=D,e}(e):function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,r,F=t||Object.keys(u),i=[],E=0,o=F;E<o.length;E+=1){var a=o[E],B=c(a,u);if(void 0!==B){var f=s(a)+":";""!==A&&(f+=" "),f+=B,i.push(f)}}if(0===i.length)e="{}";else if(""===A)r=i.join(","),e="{"+r+"}";else{var l=",\n"+C;r=i.join(l),e="{\n"+C+r+",\n"+D+"}"}return n.pop(),C=D,e}(e):void 0}function B(u){for(var D={"'":.1,'"':.2},e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},t="",r=0;r<u.length;r++){var n=u[r];switch(n){case"'":case'"':D[n]++,t+=n;continue;case"\0":if(U.isDigit(u[r+1])){t+="\\x00";continue}}if(e[n])t+=e[n];else if(n<" "){var C=n.charCodeAt(0).toString(16);t+="\\x"+("00"+C).substring(C.length)}else t+=n}var A=F||Object.keys(D).reduce(function(u,e){return D[u]<D[e]?u:e});return A+(t=t.replace(new RegExp(A,"g"),e[A]))+A}function s(u){if(0===u.length)return B(u);var D=String.fromCodePoint(u.codePointAt(0));if(!U.isIdStartChar(D))return B(u);for(var e=D.length;e<u.length;e++)if(!U.isIdContinueChar(String.fromCodePoint(u.codePointAt(e))))return B(u);return u}}}});
|
|
110
22
|
|
|
111
|
-
}
|
|
112
|
-
},{}],33:[function(require,module,exports){
|
|
23
|
+
},{}],7:[function(require,module,exports){
|
|
113
24
|
"use strict";module.exports=(e=>{if("string"!=typeof e)throw new TypeError(`Expected a string, got ${typeof e}`);return 65279===e.charCodeAt(0)?e.slice(1):e});
|
|
114
25
|
|
|
115
|
-
},{}],
|
|
26
|
+
},{}],8:[function(require,module,exports){
|
|
116
27
|
module.exports={
|
|
117
28
|
"name": "@jscad/core",
|
|
118
|
-
"version": "2.3.
|
|
29
|
+
"version": "2.3.8",
|
|
119
30
|
"description": "Core functionality for JSCAD Applications",
|
|
120
31
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
121
32
|
"main": "src/index.js",
|
|
@@ -150,10 +61,11 @@ module.exports={
|
|
|
150
61
|
"license": "MIT",
|
|
151
62
|
"dependencies": {
|
|
152
63
|
"@jscad/array-utils": "2.1.0",
|
|
153
|
-
"@jscad/io": "2.0.
|
|
154
|
-
"@jscad/io-utils": "2.0.
|
|
155
|
-
"@jscad/modeling": "2.
|
|
156
|
-
"@jscad/vtree": "2.0.
|
|
64
|
+
"@jscad/io": "2.0.9",
|
|
65
|
+
"@jscad/io-utils": "2.0.8",
|
|
66
|
+
"@jscad/modeling": "2.5.3",
|
|
67
|
+
"@jscad/vtree": "2.0.9",
|
|
68
|
+
"json5": "2.2.0",
|
|
157
69
|
"strip-bom": "4.0.0"
|
|
158
70
|
},
|
|
159
71
|
"devDependencies": {
|
|
@@ -169,126 +81,121 @@ module.exports={
|
|
|
169
81
|
}
|
|
170
82
|
}
|
|
171
83
|
|
|
172
|
-
},{}],
|
|
84
|
+
},{}],9:[function(require,module,exports){
|
|
173
85
|
module.exports={rebuildGeometry:require("./rebuildGeometry"),rebuildGeometryCli:require("./rebuildGeometryCli"),rebuildGeometryWorker:require("./rebuildGeometryWorker"),serializeSolids:require("./serializeSolids")};
|
|
174
86
|
|
|
175
|
-
},{"./rebuildGeometry":
|
|
87
|
+
},{"./rebuildGeometry":11,"./rebuildGeometryCli":12,"./rebuildGeometryWorker":13,"./serializeSolids":14}],10:[function(require,module,exports){
|
|
176
88
|
const makeBuildCachedGeometryFromTree=require("@jscad/vtree").buildCachedGeometry,isGeom2=require("@jscad/modeling").geometries.geom2.isA,isGeom3=require("@jscad/modeling").geometries.geom3.isA,isPath2=require("@jscad/modeling").geometries.path2.isA,{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),serializeSolids=require("./serializeSolids"),isResultGeometry=e=>!!(Array.isArray(e)&&e.length>0)&&e.reduce((e,o)=>e||isGeom3(o)||isGeom2(o)||isPath2(o),!1),lookupFromCompactBinary=(e={})=>{const o={};return Object.keys(e).forEach(r=>{const t=e[r];let i;0===t[0]&&(i=require("@jscad/modeling").geometries.geom2.fromCompactBinary(t)),1===t[0]&&(i=require("@jscad/modeling").geometries.geom3.fromCompactBinary(t)),2===t[0]&&(i=require("@jscad/modeling").geometries.path2.fromCompactBinary(t)),o[r]=i}),o},toJSON=e=>JSON.stringify(e,(e,o)=>{if(o instanceof Int8Array||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Int16Array||o instanceof Uint16Array||o instanceof Int32Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array){return{constructor:o.constructor.name,data:Array.apply([],o),flag:"FLAG_TYPED_ARRAY"}}return o}),lookupToCompactBinary=e=>{const o={};return Object.keys(e).forEach(r=>{const t=e[r];let i=t;isGeom2(t)?o[r]=require("@jscad/modeling").geometries.geom2.toCompactBinary(t):isGeom3(t)?o[r]=require("@jscad/modeling").geometries.geom3.toCompactBinary(t):isPath2(t)?o[r]=require("@jscad/modeling").geometries.path2.toCompactBinary(t):(i=toJSON(t),o[r]=i)}),o},instanciateDesign=(e,o,r)=>{const{vtreeMode:t,serialize:i}=r;let a;const s=flatten(toArray(e.main(o)));if(t){console.log("input lookup",r.lookup);let e=lookupFromCompactBinary(r.lookup);const o=r.lookupCounts||{};return console.log("lookup after",e),a=makeBuildCachedGeometryFromTree({passesBeforeElimination:5,lookup:e,lookupCounts:o})({},s),console.log("created lookup",e,o),e=lookupToCompactBinary(e),console.log("compact lookup",e),{solids:a=i?serializeSolids(a):a,lookup:e,lookupCounts:o}}if(isResultGeometry(s))return{solids:a=i?serializeSolids(s):s};throw new Error("bad output from script: expected geom3/geom2/path2 objects")};module.exports=instanciateDesign;
|
|
177
89
|
|
|
178
|
-
},{"./serializeSolids":
|
|
90
|
+
},{"./serializeSolids":14,"@jscad/array-utils":483,"@jscad/modeling":185,"@jscad/vtree":535}],11:[function(require,module,exports){
|
|
179
91
|
const loadDesign=require("../code-loading/loadDesign"),instanciateDesign=require("./instanciateDesign"),applyParameterDefinitions=require("../parameters/applyParameterDefinitions"),rebuildSolids=(e,o)=>{console.log("rebuildSolids",e);let{mainPath:i,vtreeMode:a,serialize:s,lookup:l,lookupCounts:t,parameterValues:n}=Object.assign({},{mainPath:"",vtreeMode:!1,serialize:!0,lookup:null,lookupCounts:null,parameterValues:{}},e);const r=e.filesAndFolders,u=loadDesign(i,"@jscad/modeling",r,n);o(null,{type:"params",parameterDefaults:u.parameterValues,parameterDefinitions:u.parameterDefinitions}),n=applyParameterDefinitions(n,u.parameterDefinitions),n=Object.assign({},u.parameterValues,n);const p={vtreeMode:a,lookup:l,lookupCounts:t,serialize:s},d=instanciateDesign(u.rootModule,n,p);o(null,{type:"solids",solids:d.solids,lookup:d.lookup,lookupCounts:d.lookupCounts})};module.exports=rebuildSolids;
|
|
180
92
|
|
|
181
|
-
},{"../code-loading/loadDesign":
|
|
93
|
+
},{"../code-loading/loadDesign":17,"../parameters/applyParameterDefinitions":30,"./instanciateDesign":10}],12:[function(require,module,exports){
|
|
182
94
|
const path=require("path"),{toArray:toArray}=require("@jscad/array-utils"),requireDesignFromModule=require("../code-loading/requireDesignFromModule"),getAllParameterDefintionsAndValues=require("../parameters/getParameterDefinitionsAndValues"),makeWebRequire=require("../code-loading/webRequire"),rebuildSolids=e=>{let{mainPath:r,vtreeMode:a,parameterValues:i,useFakeFs:t}=Object.assign({},{vtreeMode:!1,serialize:!1},e);const s=a?"../code-loading/vtreeApi":"@jscad/modeling";let o=require;if(t){const a=path.parse(r),i=`${a.name}.js`,t=`/${a.name}.js`,u=[{ext:"js",fullPath:t,name:i,source:e.source}];o=makeWebRequire(u,{apiMainPath:s}),r=t}const u=requireDesignFromModule(r,o),n=getAllParameterDefintionsAndValues(u,i);return toArray(u.main(n.parameterValues))};module.exports=rebuildSolids;
|
|
183
95
|
|
|
184
|
-
},{"../code-loading/requireDesignFromModule":
|
|
96
|
+
},{"../code-loading/requireDesignFromModule":21,"../code-loading/webRequire":26,"../parameters/getParameterDefinitionsAndValues":31,"@jscad/array-utils":483,"path":4}],13:[function(require,module,exports){
|
|
185
97
|
const rebuildGeometryWorker=e=>{const o=require("./rebuildGeometry");e.onmessage=function(r){if(r.data instanceof Object){const{data:t}=r;"generate"===t.cmd&&o(t,(o,r)=>e.postMessage(r))}}};module.exports=rebuildGeometryWorker;
|
|
186
98
|
|
|
187
|
-
},{"./rebuildGeometry":
|
|
99
|
+
},{"./rebuildGeometry":11}],14:[function(require,module,exports){
|
|
188
100
|
const{geom2:geom2,geom3:geom3,path2:path2}=require("@jscad/modeling").geometries,serializeSolids=e=>e=e.map(e=>(geom2.isA(e)&&geom2.toSides(e),geom3.isA(e)&&geom3.toPolygons(e),path2.isA(e)&&path2.toPoints(e),e));module.exports=serializeSolids;
|
|
189
101
|
|
|
190
|
-
},{"@jscad/modeling":
|
|
102
|
+
},{"@jscad/modeling":185}],15:[function(require,module,exports){
|
|
191
103
|
module.exports={makeFakeFs:require("./makeFakeFs.js"),requireDesignUtilsFs:require("./requireDesignUtilsFs")};
|
|
192
104
|
|
|
193
|
-
},{"./makeFakeFs.js":
|
|
105
|
+
},{"./makeFakeFs.js":18,"./requireDesignUtilsFs":22}],16:[function(require,module,exports){
|
|
194
106
|
const isCommonJsModule=o=>o.includes("module.exports")||o.includes("require(");module.exports=isCommonJsModule;
|
|
195
107
|
|
|
196
|
-
},{}],
|
|
108
|
+
},{}],17:[function(require,module,exports){
|
|
197
109
|
const{registerAllExtensions:registerAllExtensions}=require("../io/registerExtensions"),transformSources=require("./transformSources"),makeFakeFs=require("./makeFakeFs"),makeWebRequire=require("./webRequire"),normalizeDesignModule=require("./normalizeDesignModule"),getAllParameterDefintionsAndValues=require("../parameters/getParameterDefinitionsAndValues"),loadDesign=(e,r,i,a)=>{(i=transformSources({apiMainPath:r},i)).length>1&&(i=[{fullPath:"/",name:"",children:i}]);const n=makeFakeFs(i),s=makeWebRequire(i,{apiMainPath:r});registerAllExtensions(n,s);let t=s(i[0].fullPath);return{rootModule:t=normalizeDesignModule(t),...getAllParameterDefintionsAndValues(t,a)}};module.exports=loadDesign;
|
|
198
110
|
|
|
199
|
-
},{"../io/registerExtensions":
|
|
111
|
+
},{"../io/registerExtensions":29,"../parameters/getParameterDefinitionsAndValues":31,"./makeFakeFs":18,"./normalizeDesignModule":20,"./transformSources":23,"./webRequire":26}],18:[function(require,module,exports){
|
|
200
112
|
const makeFakeFs=r=>{const e=(n,i=r)=>{for(let r=0;r<i.length;r++){const o=i[r];if(n===o.fullPath||"/"+n===o.fullPath)return o;if(o.children){const r=e(n,o.children);if(void 0!==r)return r}}},n=r=>{const n=e(r);return{isFile:r=>n&&"source"in n&&!("children"in n),isDirectory:r=>n&&!("source"in n)&&"children"in n}};return{statSync:n,existsSync:r=>{return void 0!==e(r)},readdirSync:r=>{return e(r).children.map(r=>r.name)},readDir:(r,n)=>{n(null,e(r))},readFile:(r,i,o)=>{const t=e(r);if(!t)throw new Error(`ENOENT: no such file or directory, open '${r}'`);n(r).isFile()?o(null,t.source):o(new Error(`${t} is not a file, cannot read`))},readFileSync:(r,i)=>{const o=e(r);if(!o)throw new Error(`ENOENT: no such file or directory, open '${r}'`);if(n(r).isFile())return o.source;throw new Error(`${o} is not a file, cannot read`)}}};module.exports=makeFakeFs;
|
|
201
113
|
|
|
202
|
-
},{}],
|
|
114
|
+
},{}],19:[function(require,module,exports){
|
|
203
115
|
const modulifySource=(e,r)=>{const n=e.includes("getParameterDefinitions")?"module.exports.getParameterDefinitions = getParameterDefinitions":"";return`\n const {geom2, geom3, path2, pol2, poly3} = require('${r}').geometries\n\n const {square, circle, polygon, rectangle, ellipse, roundedRectangle} = require('${r}').primitives\n const {cube, cylinder, sphere, polyhedron, torus} = require('${r}').primitives\n const {colorize, hsl2rgb} = require('${r}').colors\n\n const {extrudeFromSlices, extrudeLinear, extrudeRectangular, extrudeRotate, slice} = require('${r}').extrusions\n const {rotate, translate, scale, mirror, transform} = require('${r}').transforms\n const {hull, hullChain} = require('${r}').hulls\n const {expand, offset} = require('${r}').expansions\n const {union, difference, intersection} = require('${r}').booleans\n const { measureArea, measureBounds, measureVolume} = require('${r}').measurements\n\n const connectors = require('${r}').connectors\n\n const {vec2, vec3, vec4, constants, line2, line3, mat4, plane, utils} = require('${r}').maths\n\n const {vectorText, vectorChar} = require('${r}').text\n\n ${e}\n\n module.exports = {main}\n ${n}\n `};module.exports=modulifySource;
|
|
204
116
|
|
|
205
|
-
},{}],
|
|
117
|
+
},{}],20:[function(require,module,exports){
|
|
206
118
|
const normalizeDesignModule=o=>{if(!o)throw new Error("no root module found");if("function"==typeof o&&(console.warn("please use named exports for the main() function"),o={main:o}),!o.main)throw new Error("no main() function, check the exports");if("function"!=typeof o.main)throw new Error("main is not a function, check the exports");return o};module.exports=normalizeDesignModule;
|
|
207
119
|
|
|
208
|
-
},{}],
|
|
120
|
+
},{}],21:[function(require,module,exports){
|
|
209
121
|
const validateDesignModule=require("./validateDesignModule"),normalizeDesignModule=require("./normalizeDesignModule"),requireDesignFromModule=(e,i=require)=>{const r=i(e);return validateDesignModule(r),normalizeDesignModule(r)};module.exports=requireDesignFromModule;
|
|
210
122
|
|
|
211
|
-
},{"./normalizeDesignModule":
|
|
123
|
+
},{"./normalizeDesignModule":20,"./validateDesignModule":24}],22:[function(require,module,exports){
|
|
212
124
|
const path=require("path"),{toArray:toArray}=require("@jscad/array-utils"),splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/,splitPath=e=>splitPathRe.exec(e).slice(1),parsePath=e=>{assertPath(e);const t=splitPath(e);if(!t||4!==t.length)throw new TypeError("Invalid path '"+e+"'");return t[1]=t[1]||"",t[2]=t[2]||"",t[3]=t[3]||"",{root:t[0],dir:t[0]+t[1].slice(0,t[1].length-1),base:t[2],ext:t[3],name:t[2].slice(0,t[2].length-t[3].length)}},assertPath=e=>{if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+e)},getDesignEntryPoint=(e,t)=>{if(!t)return;const a=toArray(t)[0];let r;const n=e.statSync(a);if(n.isFile())return a;if(n.isDirectory()){const t=path.join(a,"package.json");if(e.existsSync(t)){const r=JSON.parse(e.readFileSync(t)).main;if(r)return path.join(a,r)}const n=e.readdirSync(a),i=["main","index",parsePath(path.basename(a)).name],s=i.map(e=>e+".js"),o=i.map(e=>e+".jscad"),c=n.filter(e=>s.concat(o).includes(e));return c.length>0&&(r=path.join(a,c[0])),r}return a},packageNameFromDir=(e,t,a)=>{const r=path.join(t,"package.json");if(e.existsSync(r)){const t=JSON.parse(e.readFileSync(r)).name;if(t)return t}return a?parsePath(path.basename(a)).name:path.basename(t)},getDesignName=(e,t)=>{if(!t)return"undefined";const a=toArray(t)[0],r=e.statSync(a);if(r.isFile()){const t=path.dirname(a);return packageNameFromDir(e,t,a)}return r.isDirectory()?packageNameFromDir(e,a):void 0};module.exports={getDesignEntryPoint:getDesignEntryPoint,getDesignName:getDesignName};
|
|
213
125
|
|
|
214
|
-
},{"@jscad/array-utils":
|
|
126
|
+
},{"@jscad/array-utils":483,"path":4}],23:[function(require,module,exports){
|
|
215
127
|
const{deserializers:deserializers}=require("@jscad/io"),isCommonJsModule=require("./isCommonJsModule"),modulifySource=require("./modulifySource"),passThroughTransform=(e,r)=>r,modulifyTransform=(e,r)=>{const{apiMainPath:s}=e,o=isCommonJsModule(r.source)?r.source:modulifySource(r.source,s);return Object.assign({},r,{source:o})},createJscadEntry=(e,r)=>{const s=e.name.substring(0,e.name.lastIndexOf(".")+1)+"jscad",o="/"+s;return Object.assign({},e,{ext:"jscad",name:s,fullPath:o,source:r})},transformSources=(e,r)=>{if(r&&r.length>1)return r;const s={js:[modulifyTransform],jscad:[modulifyTransform]};return r&&(r=r.map(r=>(r=>{if(r.source&&r.ext){const o=Object.assign({},e,{filename:r.name,output:"script"});if(r.ext in deserializers){const e=(0,deserializers[r.ext])(o,r.source);return createJscadEntry(r,e)}if(r.ext in s)return s[r.ext].reduce((e,r)=>r(o,e),r)}return r})(r))),r};module.exports=transformSources;
|
|
216
128
|
|
|
217
|
-
},{"./isCommonJsModule":
|
|
129
|
+
},{"./isCommonJsModule":16,"./modulifySource":19,"@jscad/io":73}],24:[function(require,module,exports){
|
|
218
130
|
const validateDesignModule=n=>{if(!n)throw new Error("undefined root module passed !");if("function"==typeof n&&console.warn("please use named exports for your main() function ! auto updating"),!("main"in n))throw new Error("no main() function found in the input script")};module.exports=validateDesignModule;
|
|
219
131
|
|
|
220
|
-
},{}],
|
|
132
|
+
},{}],25:[function(require,module,exports){
|
|
221
133
|
module.exports=require("@jscad/vtree").api;
|
|
222
134
|
|
|
223
|
-
},{"@jscad/vtree":
|
|
224
|
-
const path=require("path"),posix=path.posix?path.posix:path,getFileExtensionFromString=require("../utils/getFileExtensionFromString"),findMatch=(e,
|
|
135
|
+
},{"@jscad/vtree":535}],26:[function(require,module,exports){
|
|
136
|
+
const path=require("path"),posix=path.posix?path.posix:path,getFileExtensionFromString=require("../utils/getFileExtensionFromString"),{combineParameterDefinitions:combineParameterDefinitions,getParameterDefinitionsFromSource:getParameterDefinitionsFromSource}=require("../parameters/getParameterDefinitionsFromSource"),findMatch=(e,r)=>{for(let t=0;t<r.length;t++){const n=r[t];if(e===n.fullPath||"/"+e===n.fullPath)return n;if(n.children){const r=findMatch(e,n.children);if(void 0!==r)return r}}},registerJsExtension=(e,r)=>{const t=require("strip-bom");r.extensions[".js"]=((r,n)=>{const i=e.readFileSync(n,"utf8");r._compile(t(i),n)})},registerJsonExtension=(e,r)=>{r.extensions[".json"]=((r,t)=>{const n=e.readFileSync(t,"utf8");r.exports=JSON.parse(n)})},makeWebRequire=(e,r)=>{const t={apiMainPath:"@jscad/modeling",fakeFs:require("./makeFakeFs")(e)},{apiMainPath:n,fakeFs:i}=Object.assign({},t,r),s="@jscad/modeling"===n?require("@jscad/modeling"):require("./vtreeApi"),o={"@jscad/io":{exports:require("@jscad/io")},"@jscad/array-utils":{exports:require("@jscad/array-utils")},"@jscad/modeling":{exports:s},fs:{exports:i}},a={},l=(r,t)=>{const n=o[t];if(n)return n.exports;r&&!t.startsWith("/")||(r="/");const i=r=>{let t=getFileExtensionFromString(r);t||(t="js",r+=".js"),t="."+t;const n=findMatch(r,e);if(!n)return null;if(n.children)return null;if(a[t]){const e={exports:{},_compile:(r,t)=>{new Function("require","module",r)(l.bind(null,n.fullPath),e);const i=r.includes("@jscad-params")?getParameterDefinitionsFromSource(r,t):[],s=e.exports.getParameterDefinitions;e.exports.getParameterDefinitions=(()=>combineParameterDefinitions(i,s&&s()||[]))}};return a[t](e,n.fullPath),e.exports}return null},s=r=>{if(!findMatch(r,e))return null;"/"===r&&(r="");let t=r+"/index.js",n=i(t);return n||((n=i(t=r+"/index.json"))||null)},u=r=>{let t,n=findMatch(r,e);if(!n)return null;if(!n.children)return null;if(n=findMatch(r+"/package.json",e)){const e=JSON.parse(n.source).main;if(e){const n=posix.normalize(r+"/"+e);return(t=i(n))?t:(t=s(n))||null}}return(t=s(r))||null};if(t.startsWith("./")||t.startsWith("/")||t.startsWith("../")){t=posix.normalize(posix.dirname(r)+posix.sep+t);let e=i(t);if(e)return e;if(e=u(t))return e;throw new Error(`Cannot find relative path to module ${t}`)}const c=((e,r)=>{const t=(e=>{const r=e.split("/"),t=[];for(let e=r.length-1;e>0;e--){if("node_modules"===r[e])continue;const n=posix.sep+posix.join(...r.slice(1,e+1),"node_modules");t.push(n)}return t})(r);for(let r=0;r<t.length;r++){const n=t[r],s=posix.join(n,e);let o=i(s);if(o)return o;if(o=u(s))return o}return null})(t,posix.dirname(r));if(c)return c;throw new Error(`Cannot find module ${t}`)},u=l.bind(null,"/");return u.extensions=a,u.resolve=(()=>{}),registerJsExtension(i,u),registerJsonExtension(i,u),u};module.exports=makeWebRequire;
|
|
225
137
|
|
|
226
|
-
},{"../utils/getFileExtensionFromString":
|
|
138
|
+
},{"../parameters/getParameterDefinitionsFromSource":32,"../utils/getFileExtensionFromString":36,"./makeFakeFs":18,"./vtreeApi":25,"@jscad/array-utils":483,"@jscad/io":73,"@jscad/modeling":185,"path":4,"strip-bom":7}],27:[function(require,module,exports){
|
|
227
139
|
module.exports={evaluation:require("./code-evaluation"),io:require("./io"),loading:require("./code-loading"),parameters:require("./parameters"),utils:require("./utils"),web:require("./web")};
|
|
228
140
|
|
|
229
|
-
},{"./code-evaluation":
|
|
141
|
+
},{"./code-evaluation":9,"./code-loading":15,"./io":28,"./parameters":35,"./utils":37,"./web":39}],28:[function(require,module,exports){
|
|
230
142
|
module.exports={registerAllExtensions:require("./registerExtensions").registerAllExtensions,unRegisterAllExtensions:require("./registerExtensions").unRegisterAllExtensions};
|
|
231
143
|
|
|
232
|
-
},{"./registerExtensions":
|
|
144
|
+
},{"./registerExtensions":29}],29:[function(require,module,exports){
|
|
233
145
|
const{deserializers:deserializers}=require("@jscad/io"),registerJscadExtension=(e,s)=>{const i=require("strip-bom");s.extensions[".jscad"]=((s,r)=>{const t=e.readFileSync(r,"utf8");s._compile(i(t),r)})},unRegisterJscadExtension=(e,s)=>{delete s.extensions[".jscad"]},registerDeserializer=(e,s,i)=>{const r=deserializers[e],t="."+e;i.extensions[t]=((e,i)=>{const t=s.readFileSync(i,"utf8"),n=r({filename:i,output:"geometry"},t);e.exports=n})},unregisterDeserializer=(e,s,i)=>{const r="."+e;delete i.extensions[r]},registerAllExtensions=(e,s)=>{registerJscadExtension(e,s);for(const i of Object.keys(deserializers))registerDeserializer(i,e,s)},unRegisterAllExtensions=(e,s)=>{unRegisterJscadExtension(0,s);for(const e of Object.keys(deserializers))unregisterDeserializer(e,0,s)};module.exports={registerAllExtensions:registerAllExtensions,unRegisterAllExtensions:unRegisterAllExtensions};
|
|
234
146
|
|
|
235
|
-
},{"@jscad/io":
|
|
147
|
+
},{"@jscad/io":73,"strip-bom":7}],30:[function(require,module,exports){
|
|
236
148
|
const applyParameterDefinitions=(e,a,r=!1)=>{return Object.keys(e).reduce((t,i)=>{let s=e[i];const n=a.filter(e=>e.name===i),o=n.length>0?n[0]:{type:"unknown"};switch(o.type){case"choice":s=valueForChoices(s,o);break;case"float":case"number":if(isNaN(parseFloat(s))||!isFinite(s))throw new Error("Parameter ("+i+") is not a valid number ("+s+")");s=parseFloat(s);break;case"int":if(isNaN(parseFloat(s))||!isFinite(s))throw new Error("Parameter ("+i+") is not a valid number ("+s+")");s=parseInt(s);break;case"checkbox":s=!!s;break;case"radio":s=valueForChoices(s,o);break;case"slider":if(isNaN(parseFloat(s))||!isFinite(s))throw new Error("Parameter ("+i+") is not a valid number ("+s+")");s=parseFloat(s);break;default:if(r)throw new Error(`Parameter (${i}) has no matching definition`)}return t[i]=s,t},{})},isNumber=e=>!isNaN(parseFloat(e))&&isFinite(e),valueForChoices=(e,a)=>{let r=e;const t=a.captions?a.captions.indexOf(r):a.values.indexOf(r);return r=t>-1&&a.values.length>=t?a.values[t]:r,r=a.values.length>0&&isNumber(a.values[0])?parseFloat(r):r,r=a.values.length>0&&"boolean"==typeof r?!!r:r};module.exports=applyParameterDefinitions;
|
|
237
149
|
|
|
238
|
-
},{}],
|
|
150
|
+
},{}],31:[function(require,module,exports){
|
|
239
151
|
const getParameterValuesFromParameters=require("./getParameterValuesFromParameters"),applyParameterDefinitions=require("./applyParameterDefinitions"),doesModuleExportParameterDefiniitions=e=>e&&"getParameterDefinitions"in e,getRawParameterDefinitionsAndValues=(e,a)=>{let r={},t=[];return doesModuleExportParameterDefiniitions(e)&&(t=e.getParameterDefinitions(a)||[],r=getParameterValuesFromParameters(t)),{parameterDefinitions:t,parameterValues:r}},getAllParameterDefintionsAndValues=(e,a)=>{let{parameterDefinitions:r,parameterValues:t}=getRawParameterDefinitionsAndValues(e,a);return{parameterValues:t=(t=Object.assign({},t,a))?applyParameterDefinitions(t,r):t,parameterDefinitions:r}};module.exports=getAllParameterDefintionsAndValues;
|
|
240
152
|
|
|
241
|
-
},{"./applyParameterDefinitions":
|
|
153
|
+
},{"./applyParameterDefinitions":30,"./getParameterValuesFromParameters":33}],32:[function(require,module,exports){
|
|
154
|
+
const JSON5=require("json5"),countSpaces=e=>{let t=0;for(let n=0;n<e.length;n++)if(" "===e[n])t++;else{if("\t"!==e[n])break;t+=2}return t},getParameterDefinitionsFromSource=e=>{const t=[];e.split("\n").forEach((e,n)=>{const i=e.trim();i&&t.push({code:i,line:e,lineNum:n+1,indent:countSpaces(e)})});let n,i,r,s,o=0;for(;o<t.length&&(i=t[o].code,o++,!(i.length>12&&-1!==i.indexOf("@jscad-params"))););let a=1;const m=[];for(;o<t.length&&(i=t[o].code,n=t[o].lineNum,"}"!==i[0]);){const e="/"===i[0];if(e&&r){if("group"===r.type||s+r.name.length<=t[o].indent){r.hint=r.hint?r.hint+"\n":"",r.hint+=extractTextFromComment(i,n),o++;continue}}if(s=t[o].indent,e){const e="_group_"+a++,t=parseComment(i,n,e);let s=t.caption;">"===s[0]&&(s=s.substring(1).trim(),t.options||(t.options={}),t.options.initial="closed"),m.push(r={name:e,type:"group",caption:s,...t.options})}else{const e=i.indexOf("/");if(-1===e){const e=i.indexOf("}");-1!==e&&(i=i.substring(0,e));const t=parseDef(i,n);if(t.caption=t.name,m.push(r=t),-1!==e)break}else m.push(r=parseOne(i.substring(e).trim(),i.substring(0,e).trim(),n,n))}o++}return m},parseOne=(e,t,n,i)=>{let r=parseDef(t,i);const{caption:s,options:o}=parseComment(e,n,r.name);return r.caption=s||r.name,o&&("checkbox"===(r={...r,...o}).type&&"initial"in r&&(r.checked=!0),"slider"===r.type&&(void 0===r.min&&(r.min=0),void 0===r.max&&(r.max=100))),r},extractTextFromComment=(e,t)=>{const n=e.substring(0,2);if("//"===n&&(e=e.substring(2).trim()),"/*"===n){if("*/"!==e.substring(e.length-2))throw new EvalError(`Multi-line comments not supported in parsed parameter definitions, line:${t}`,"code",t);e=e.substring(2,e.length-2).trim()}return e},parseComment=(e,t,n)=>{const i={},r=(e=extractTextFromComment(e,t)).indexOf("{");if(-1!==r){try{i.options=JSON5.parse(e.substring(r))}catch(i){throw new EvalError(`${i.message}, parameter:${n}, line:${t}: ${e.substring(r)}`,"code",t)}e=e.substring(0,r).trim()}return i.caption=e,i},parseDef=(e,t)=>{","===e[e.length-1]&&(e=e.substring(0,e.length-1).trim());let n=e.indexOf("=");if(-1===n&&(n=e.indexOf(":")),-1===n)return{name:e,type:"text"};{const i=e.substring(n+1).trim(),r={type:"text",name:e.substring(0,n).trim()};if("true"===i||"false"===i)r.type="checkbox",r.checked="true"===i;else if(/^[0-9]+$/.test(i))r.type="int",r.initial=parseFloat(i);else if(/^[0-9]+\.[0-9]+$/.test(i))r.type="number",r.initial=parseFloat(i);else try{r.initial=JSON5.parse(i)}catch(n){throw new EvalError(`Error in the initial value definition for ${e} ${n.message}, line:${t}`,"code",t)}return r}},combineParameterDefinitions=(e,t)=>{const n=[...e];return t&&t.forEach(e=>{const t=n.findIndex(t=>t.name===e.name);-1!==t?n[t]=e:n.push(e)}),n};module.exports={getParameterDefinitionsFromSource:getParameterDefinitionsFromSource,parseOne:parseOne,parseComment:parseComment,parseDef:parseDef,combineParameterDefinitions:combineParameterDefinitions};
|
|
155
|
+
|
|
156
|
+
},{"json5":6}],33:[function(require,module,exports){
|
|
242
157
|
const getParameterValuesFromParameters=(e,a)=>{const t={};for(const a in e){const n=e[a];"default"in n?t[e[a].name]=e[a].default:"initial"in n?t[e[a].name]=e[a].initial:"checked"in n&&(t[e[a].name]=e[a].checked)}for(const e in a)t[e]=a[e];return t};module.exports=getParameterValuesFromParameters;
|
|
243
158
|
|
|
244
|
-
},{}],
|
|
159
|
+
},{}],34:[function(require,module,exports){
|
|
245
160
|
const getParameterValuesFromUIControls=(e,a,r)=>{const t={};let i;for(let a=0;a<e.length;a++){const o=e[a];switch(o.paramType){case"choice":i=o.options[o.selectedIndex].value;break;case"float":case"number":if(i=o.value,isNaN(parseFloat(i))||!isFinite(i))throw new Error("Parameter ("+o.paramName+") is not a valid number ("+i+")");i=parseFloat(i);break;case"int":if(i=o.value,isNaN(parseFloat(i))||!isFinite(i))throw new Error("Parameter ("+o.paramName+") is not a valid number ("+i+")");i=parseInt(i);break;case"checkbox":i=o.checked;break;case"radio":if(!o.checked)continue;i=o.value;break;case"group":i=o.className.includes("open")?"open":"closed";break;default:i=o.value}if(r){if("initial"in o&&o.initial===i)continue;if("default"in o&&o.default===i)continue}t[o.paramName]=i}return t};module.exports=getParameterValuesFromUIControls;
|
|
246
161
|
|
|
247
|
-
},{}],
|
|
162
|
+
},{}],35:[function(require,module,exports){
|
|
248
163
|
module.exports={applyParameterDefinitions:require("./applyParameterDefinitions"),getParameterDefinitionsAndValues:require("./getParameterDefinitionsAndValues"),getParameterValuesFromParameters:require("./getParameterValuesFromParameters"),getParameterValuesFromUIControls:require("./getParameterValuesFromUIControls")};
|
|
249
164
|
|
|
250
|
-
},{"./applyParameterDefinitions":
|
|
165
|
+
},{"./applyParameterDefinitions":30,"./getParameterDefinitionsAndValues":31,"./getParameterValuesFromParameters":33,"./getParameterValuesFromUIControls":34}],36:[function(require,module,exports){
|
|
251
166
|
const getFileExtensionFromString=e=>{if(-1!==e.indexOf("."))return e.substring(e.lastIndexOf(".")+1).toLowerCase()};module.exports=getFileExtensionFromString;
|
|
252
167
|
|
|
253
|
-
},{}],
|
|
168
|
+
},{}],37:[function(require,module,exports){
|
|
254
169
|
module.exports={getFileExtensionFromString:require("./getFileExtensionFromString"),version:require("./version")};
|
|
255
170
|
|
|
256
|
-
},{"./getFileExtensionFromString":
|
|
171
|
+
},{"./getFileExtensionFromString":36,"./version":38}],38:[function(require,module,exports){
|
|
257
172
|
const json=require("../../package.json"),version=json.version;module.exports={version:version};
|
|
258
173
|
|
|
259
|
-
},{"../../package.json":
|
|
174
|
+
},{"../../package.json":8}],39:[function(require,module,exports){
|
|
260
175
|
module.exports={walkFileTree:require("./walkFileTree")};
|
|
261
176
|
|
|
262
|
-
},{"./walkFileTree":
|
|
177
|
+
},{"./walkFileTree":40}],40:[function(require,module,exports){
|
|
263
178
|
const{flatten:flatten}=require("@jscad/array-utils"),{formats:formats}=require("@jscad/io/formats"),getFileExtensionFromString=require("../utils/getFileExtensionFromString"),binaryMimetypes={bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",jpeg:"image/jpeg",png:"image/png",tif:"image/tiff",tiff:"image/tiff",otc:"font/otf",otf:"font/otf",ttc:"font/ttf",ttf:"font/ttf",woff:"font/woff",woff2:"font/woff",stl:"application/sla"},readFileAsync=(e,t)=>{const r=e.fullPath?e.fullPath:t.fullPath?t.fullPath:"",i=getFileExtensionFromString(e.name),n=e.mimetype;return new Promise((t,s)=>{const o=new FileReader;o.onload=(s=>{const o=s.target.result;o.byteLength?t({name:e.name,ext:i,fullPath:r,mimetype:n,source:o}):"string"==typeof o&&t({name:e.name,ext:i,fullPath:r,mimetype:n,source:o})}),o.onerror=(e=>{s(new Error(`Failed to load file: ${r} [${o.error}]`))}),binaryMimetypes[i]?o.readAsArrayBuffer(e):o.readAsText(e)})},isSupportedFormat=e=>{const t=getFileExtensionFromString(e.name),r=formats[t]?formats[t].mimetype:binaryMimetypes[t];return e.mimetype=e.type&&e.type.length?e.type:r,e.mimetype&&e.mimetype.length},pseudoArraytoArray=e=>{const t=[];for(let r=0;r<e.length;r++){const i=e[r];i&&t.push(i.webkitGetAsEntry?i.webkitGetAsEntry():i)}return t},isEmpty=e=>null!=e,processEntries=e=>{const t=pseudoArraytoArray(e.filter(isEmpty)).filter(isEmpty).reduce((e,t)=>{if(t.name.startsWith("."))return e;if(t.isFile)e.push(processFile(t));else if(t.isDirectory)e.push(processDirectory(t));else if(t instanceof File){const r=t.webkitRelativePath?t.webkitRelativePath:void 0,i=isSupportedFormat(t)?readFileAsync(t,{fullPath:r}):void 0;if(!i)throw new Error("Unsuported format (or folder in Safari)!");e.push(i)}return e},[]);return Promise.all(t).then(e=>e.filter(e=>null!=e))},processFile=e=>{return new Promise((t,r)=>{e.file(r=>{isSupportedFormat(r)?t(readFileAsync(r,e)):t(void 0)},t=>{const i=`${t.message} (${t.code})`;r(new Error(`Failed to load file: ${e.fullPath} [${i}]`))})})},processDirectory=e=>{return new Promise((t,r)=>{if(e.entries)e.entries.length?processEntries(e.entries).then(t):t([]);else{e.createReader().readEntries(e=>{e.length?processEntries(e).then(t):t([])},r)}}).then(flatten).then(t=>({children:t=t.map(t=>(t.fullPath.startsWith("/")||(t.fullPath=e.fullPath+"/"+t.name),t)),fullPath:e.fullPath,name:e.name}))},transformFileList=e=>{const t=require("path");if(1===e.length){const r=e[0],i=r.webkitRelativePath?r.webkitRelativePath:r.name;if(i.split(t.sep).length<2){const e=t.sep,n={fullPath:e,name:e,isDirectory:!0,entries:[]};return r.fullPath=t.normalize(e+i),n.entries.push(r),[n]}}let r;const i=new Map,n=(e,n)=>{if(!i.has(e)){const s={fullPath:e,name:n,isDirectory:!0,entries:[]};r||(r=s),i.set(e,s);const o=e.split(t.sep);if(o.length>1){const e=t.sep+t.join(...o.slice(0,-1)),r=i.get(e);r&&r.entries.push(s)}}};for(let r=0;r<e.length;r++){const s=e[r],o=(s.webkitRelativePath?s.webkitRelativePath:s.name).split(t.sep);if(o.reduce((e,t)=>e||t.startsWith("."),!1))continue;if(!isSupportedFormat(s))continue;const l=o.slice(0,-1);for(let e=0;e<l.length;e++){n(t.sep+t.join(...l.slice(0,e+1)),l[e])}const a=t.sep+t.join(...l),f=i.get(a);f&&f.entries.push(s)}return i.clear(),[r]},walkFileTree=e=>{let t=e;return e.length&&e[0]instanceof File&&(t=transformFileList(e)),processEntries(t)};module.exports=walkFileTree;
|
|
264
179
|
|
|
265
|
-
},{"../utils/getFileExtensionFromString":
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
},{}],67:[function(require,module,exports){
|
|
269
|
-
const createObject=require("./objectBuilder"),parse=require("./parse"),instantiate=(e,t)=>{const a={pxPmm:require("./constants").pxPmm};e=Object.assign({},a,e);const{pxPmm:r}=e,{amfObj:s,amfMaterials:i,amfTextures:n,amfConstels:m}=parse(t,r);if(!s)throw new Error("AMF parsing failed, no valid amf data retrieved");return objectify(s,{amfMaterials:i,amfTextures:n,amfConstels:m})},objectify=(e,t)=>{return e.objects.filter(e=>"object"===e.type).map((a,r)=>createObject(a,r,t,{amf:e,instantiate:!0}))};module.exports=instantiate;
|
|
270
|
-
|
|
271
|
-
},{"./constants":66,"./objectBuilder":71,"./parse":73}],68:[function(require,module,exports){
|
|
272
|
-
const amfMesh=a=>{const e={type:"mesh",objects:[]};return e},amfVertices=a=>{const e={type:"vertices",objects:[]};return e},amfCoordinates=a=>{const e={type:"coordinates",objects:[]};return e},amfNormal=a=>{const e={type:"normal",objects:[]};return e},amfX=a=>({type:"x",value:"0"}),amfY=a=>({type:"y",value:"0"}),amfZ=a=>({type:"z",value:"0"}),amfVolume=a=>{const e={type:"volume"};return"MATERIALID"in a&&(e.materialid=a.MATERIALID),e.objects=[],e},amfTriangle=a=>{const e={type:"triangle",objects:[]};return e},amfV1=a=>({type:"v1",value:"0"}),amfV2=a=>({type:"v2",value:"0"}),amfV3=a=>({type:"v3",value:"0"}),amfVertex=a=>{const e={type:"vertex",objects:[]};return e},amfEdge=a=>{const e={type:"edge",objects:[]};return e},amfMetadata=a=>{const e={type:"metadata"};return"TYPE"in a&&(e.mtype=a.TYPE),"ID"in a&&(e.id=a.ID),e},amfMaterial=a=>{const e={type:"material"};return"ID"in a&&(e.id=a.ID),e.objects=[],e},amfColor=a=>{const e={type:"color",objects:[]};return e},amfR=a=>({type:"r",value:"1"}),amfG=a=>({type:"g",value:"1"}),amfB=a=>({type:"b",value:"1"}),amfA=a=>({type:"a",value:"1"}),amfMap=a=>{const e={type:"map"};return"GTEXID"in a&&(e.gtexid=a.GTEXID),"BTEXID"in a&&(e.btexid=a.BTEXID),"RTEXID"in a&&(e.rtexid=a.RTEXID),e.objects=[],e},amfU1=a=>({type:"u1",value:"0"}),amfU2=a=>({type:"u2",value:"0"}),amfU3=a=>({type:"u3",value:"0"});module.exports={amfMesh:amfMesh,amfVertices:amfVertices,amfCoordinates:amfCoordinates,amfX:amfX,amfY:amfY,amfZ:amfZ,amfNormal:amfNormal,amfVolume:amfVolume,amfTriangle:amfTriangle,amfV1:amfV1,amfV2:amfV2,amfV3:amfV3,amfVertex:amfVertex,amfEdge:amfEdge,amfMetadata:amfMetadata,amfMaterial:amfMaterial,amfColor:amfColor,amfR:amfR,amfG:amfG,amfB:amfB,amfA:amfA,amfMap:amfMap,amfU1:amfU1,amfU2:amfU2,amfU3:amfU3};
|
|
180
|
+
},{"../utils/getFileExtensionFromString":36,"@jscad/array-utils":483,"@jscad/io/formats":72,"path":4}],41:[function(require,module,exports){
|
|
181
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHAR="\t\n\r --�𐀀-",exports.S=" \t\r\n",exports.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NAME_CHAR="-"+exports.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.CHAR_RE=new RegExp("^["+exports.CHAR+"]$","u"),exports.S_RE=new RegExp("^["+exports.S+"]+$","u"),exports.NAME_START_CHAR_RE=new RegExp("^["+exports.NAME_START_CHAR+"]$","u"),exports.NAME_CHAR_RE=new RegExp("^["+exports.NAME_CHAR+"]$","u"),exports.NAME_RE=new RegExp("^["+exports.NAME_START_CHAR+"]["+exports.NAME_CHAR+"]*$","u"),exports.NMTOKEN_RE=new RegExp("^["+exports.NAME_CHAR+"]+$","u");var TAB=9,NL=10,CR=13,SPACE=32;function isChar(e){return e>=SPACE&&e<=55295||e===NL||e===CR||e===TAB||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isS(e){return e===SPACE||e===NL||e===CR||e===TAB}function isNameStartChar(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNameChar(e){return isNameStartChar(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}exports.S_LIST=[SPACE,NL,CR,TAB],exports.isChar=isChar,exports.isS=isS,exports.isNameStartChar=isNameStartChar,exports.isNameChar=isNameChar;
|
|
273
182
|
|
|
274
|
-
},{}],
|
|
275
|
-
|
|
183
|
+
},{}],42:[function(require,module,exports){
|
|
184
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHAR="--�𐀀-",exports.RESTRICTED_CHAR="-\b\v\f---",exports.S=" \t\r\n",exports.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NAME_CHAR="-"+exports.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.CHAR_RE=new RegExp("^["+exports.CHAR+"]$","u"),exports.RESTRICTED_CHAR_RE=new RegExp("^["+exports.RESTRICTED_CHAR+"]$","u"),exports.S_RE=new RegExp("^["+exports.S+"]+$","u"),exports.NAME_START_CHAR_RE=new RegExp("^["+exports.NAME_START_CHAR+"]$","u"),exports.NAME_CHAR_RE=new RegExp("^["+exports.NAME_CHAR+"]$","u"),exports.NAME_RE=new RegExp("^["+exports.NAME_START_CHAR+"]["+exports.NAME_CHAR+"]*$","u"),exports.NMTOKEN_RE=new RegExp("^["+exports.NAME_CHAR+"]+$","u");var TAB=9,NL=10,CR=13,SPACE=32;function isChar(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isRestrictedChar(e){return e>=1&&e<=8||11===e||12===e||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}function isCharAndNotRestricted(e){return 9===e||10===e||13===e||e>31&&e<127||133===e||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isS(e){return e===SPACE||e===NL||e===CR||e===TAB}function isNameStartChar(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNameChar(e){return isNameStartChar(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}exports.S_LIST=[SPACE,NL,CR,TAB],exports.isChar=isChar,exports.isRestrictedChar=isRestrictedChar,exports.isCharAndNotRestricted=isCharAndNotRestricted,exports.isS=isS,exports.isNameStartChar=isNameStartChar,exports.isNameChar=isNameChar;
|
|
276
185
|
|
|
277
|
-
},{
|
|
278
|
-
(function (
|
|
279
|
-
!function(t){t.parser=function(t,e){return new s(t,e)},t.SAXParser=s,t.SAXStream=n,t.createStream=function(t,e){return new n(t,e)},t.MAX_BUFFER_LENGTH=65536;var e,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(e,a){if(!(this instanceof s))return new s(e,a);!function(t){for(var e=0,s=i.length;e<s;e++)t[i[e]]=""}(this),this.q=this.c="",this.bufferCheckPosition=t.MAX_BUFFER_LENGTH,this.opt=a||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!e,this.noscript=!(!e&&!this.opt.noscript),this.state=D.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(h)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),C(this,"onready")}t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){}return e.prototype=t,new e}),Object.keys||(Object.keys=function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(i);return e}),s.prototype={end:function(){v(this)},write:function(e){if(this.error)throw this.error;if(this.closed)return R(this,"Cannot write after close. Assign an onready handler.");if(null===e)return v(this);"object"==typeof e&&(e=e.toString());var s=0,a="";for(;a=M(e,s++),this.c=a,a;)switch(this.trackPosition&&(this.position++,"\n"===a?(this.line++,this.column=0):this.column++),this.state){case D.BEGIN:if(this.state=D.BEGIN_WHITESPACE,"\ufeff"===a)continue;G(this,a);continue;case D.BEGIN_WHITESPACE:G(this,a);continue;case D.TEXT:if(this.sawRoot&&!this.closedRoot){for(var n=s-1;a&&"<"!==a&&"&"!==a;)(a=M(e,s++))&&this.trackPosition&&(this.position++,"\n"===a?(this.line++,this.column=0):this.column++);this.textNode+=e.substring(n,s-1)}"<"!==a||this.sawRoot&&this.closedRoot&&!this.strict?(m(a)||this.sawRoot&&!this.closedRoot||P(this,"Text data outside of root node."),"&"===a?this.state=D.TEXT_ENTITY:this.textNode+=a):(this.state=D.OPEN_WAKA,this.startTagPosition=this.position);continue;case D.SCRIPT:"<"===a?this.state=D.SCRIPT_ENDING:this.script+=a;continue;case D.SCRIPT_ENDING:"/"===a?this.state=D.CLOSE_TAG:(this.script+="<"+a,this.state=D.SCRIPT);continue;case D.OPEN_WAKA:if("!"===a)this.state=D.SGML_DECL,this.sgmlDecl="";else if(m(a));else if(_(l,a))this.state=D.OPEN_TAG,this.tagName=a;else if("/"===a)this.state=D.CLOSE_TAG,this.tagName="";else if("?"===a)this.state=D.PROC_INST,this.procInstName=this.procInstBody="";else{if(P(this,"Unencoded <"),this.startTagPosition+1<this.position){var c=this.position-this.startTagPosition;a=new Array(c).join(" ")+a}this.textNode+="<"+a,this.state=D.TEXT}continue;case D.SGML_DECL:(this.sgmlDecl+a).toUpperCase()===r?(O(this,"onopencdata"),this.state=D.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+a==="--"?(this.state=D.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+a).toUpperCase()===o?(this.state=D.DOCTYPE,(this.doctype||this.sawRoot)&&P(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===a?(O(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=D.TEXT):N(a)?(this.state=D.SGML_DECL_QUOTED,this.sgmlDecl+=a):this.sgmlDecl+=a;continue;case D.SGML_DECL_QUOTED:a===this.q&&(this.state=D.SGML_DECL,this.q=""),this.sgmlDecl+=a;continue;case D.DOCTYPE:">"===a?(this.state=D.TEXT,O(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=a,"["===a?this.state=D.DOCTYPE_DTD:N(a)&&(this.state=D.DOCTYPE_QUOTED,this.q=a));continue;case D.DOCTYPE_QUOTED:this.doctype+=a,a===this.q&&(this.q="",this.state=D.DOCTYPE);continue;case D.DOCTYPE_DTD:this.doctype+=a,"]"===a?this.state=D.DOCTYPE:N(a)&&(this.state=D.DOCTYPE_DTD_QUOTED,this.q=a);continue;case D.DOCTYPE_DTD_QUOTED:this.doctype+=a,a===this.q&&(this.state=D.DOCTYPE_DTD,this.q="");continue;case D.COMMENT:"-"===a?this.state=D.COMMENT_ENDING:this.comment+=a;continue;case D.COMMENT_ENDING:"-"===a?(this.state=D.COMMENT_ENDED,this.comment=S(this.opt,this.comment),this.comment&&O(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+a,this.state=D.COMMENT);continue;case D.COMMENT_ENDED:">"!==a?(P(this,"Malformed comment"),this.comment+="--"+a,this.state=D.COMMENT):this.state=D.TEXT;continue;case D.CDATA:"]"===a?this.state=D.CDATA_ENDING:this.cdata+=a;continue;case D.CDATA_ENDING:"]"===a?this.state=D.CDATA_ENDING_2:(this.cdata+="]"+a,this.state=D.CDATA);continue;case D.CDATA_ENDING_2:">"===a?(this.cdata&&O(this,"oncdata",this.cdata),O(this,"onclosecdata"),this.cdata="",this.state=D.TEXT):"]"===a?this.cdata+="]":(this.cdata+="]]"+a,this.state=D.CDATA);continue;case D.PROC_INST:"?"===a?this.state=D.PROC_INST_ENDING:m(a)?this.state=D.PROC_INST_BODY:this.procInstName+=a;continue;case D.PROC_INST_BODY:if(!this.procInstBody&&m(a))continue;"?"===a?this.state=D.PROC_INST_ENDING:this.procInstBody+=a;continue;case D.PROC_INST_ENDING:">"===a?(O(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=D.TEXT):(this.procInstBody+="?"+a,this.state=D.PROC_INST_BODY);continue;case D.OPEN_TAG:_(T,a)?this.tagName+=a:(y(this),">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:(m(a)||P(this,"Invalid character in tag name"),this.state=D.ATTRIB));continue;case D.OPEN_TAG_SLASH:">"===a?(U(this,!0),x(this)):(P(this,"Forward-slash in opening tag not followed by >"),this.state=D.ATTRIB);continue;case D.ATTRIB:if(m(a))continue;">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:_(l,a)?(this.attribName=a,this.attribValue="",this.state=D.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case D.ATTRIB_NAME:"="===a?this.state=D.ATTRIB_VALUE:">"===a?(P(this,"Attribute without value"),this.attribValue=this.attribName,B(this),U(this)):m(a)?this.state=D.ATTRIB_NAME_SAW_WHITE:_(T,a)?this.attribName+=a:P(this,"Invalid attribute name");continue;case D.ATTRIB_NAME_SAW_WHITE:if("="===a)this.state=D.ATTRIB_VALUE;else{if(m(a))continue;P(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",O(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===a?U(this):_(l,a)?(this.attribName=a,this.state=D.ATTRIB_NAME):(P(this,"Invalid attribute name"),this.state=D.ATTRIB)}continue;case D.ATTRIB_VALUE:if(m(a))continue;N(a)?(this.q=a,this.state=D.ATTRIB_VALUE_QUOTED):(P(this,"Unquoted attribute value"),this.state=D.ATTRIB_VALUE_UNQUOTED,this.attribValue=a);continue;case D.ATTRIB_VALUE_QUOTED:if(a!==this.q){"&"===a?this.state=D.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=a;continue}B(this),this.q="",this.state=D.ATTRIB_VALUE_CLOSED;continue;case D.ATTRIB_VALUE_CLOSED:m(a)?this.state=D.ATTRIB:">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:_(l,a)?(P(this,"No whitespace between attributes"),this.attribName=a,this.attribValue="",this.state=D.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case D.ATTRIB_VALUE_UNQUOTED:if(!f(a)){"&"===a?this.state=D.ATTRIB_VALUE_ENTITY_U:this.attribValue+=a;continue}B(this),">"===a?U(this):this.state=D.ATTRIB;continue;case D.CLOSE_TAG:if(this.tagName)">"===a?x(this):_(T,a)?this.tagName+=a:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=D.SCRIPT):(m(a)||P(this,"Invalid tagname in closing tag"),this.state=D.CLOSE_TAG_SAW_WHITE);else{if(m(a))continue;d(l,a)?this.script?(this.script+="</"+a,this.state=D.SCRIPT):P(this,"Invalid tagname in closing tag."):this.tagName=a}continue;case D.CLOSE_TAG_SAW_WHITE:if(m(a))continue;">"===a?x(this):P(this,"Invalid characters in closing tag");continue;case D.TEXT_ENTITY:case D.ATTRIB_VALUE_ENTITY_Q:case D.ATTRIB_VALUE_ENTITY_U:var u,h;switch(this.state){case D.TEXT_ENTITY:u=D.TEXT,h="textNode";break;case D.ATTRIB_VALUE_ENTITY_Q:u=D.ATTRIB_VALUE_QUOTED,h="attribValue";break;case D.ATTRIB_VALUE_ENTITY_U:u=D.ATTRIB_VALUE_UNQUOTED,h="attribValue"}";"===a?(this[h]+=w(this),this.entity="",this.state=u):_(this.entity.length?p:E,a)?this.entity+=a:(P(this,"Invalid character in entity name"),this[h]+="&"+this.entity+a,this.entity="",this.state=u);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(e){for(var s=Math.max(t.MAX_BUFFER_LENGTH,10),a=0,n=0,r=i.length;n<r;n++){var o=e[i[n]].length;if(o>s)switch(i[n]){case"textNode":F(e);break;case"cdata":O(e,"oncdata",e.cdata),e.cdata="";break;case"script":O(e,"onscript",e.script),e.script="";break;default:R(e,"Max buffer length exceeded: "+i[n])}a=Math.max(a,o)}var c=t.MAX_BUFFER_LENGTH-a;e.bufferCheckPosition=c+e.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;F(t=this),""!==t.cdata&&(O(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(O(t,"onscript",t.script),t.script="")}};try{e=require("stream").Stream}catch(t){e=function(){}}var a=t.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function n(t,i){if(!(this instanceof n))return new n(t,i);e.apply(this),this._parser=new s(t,i),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,a.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}n.prototype=Object.create(e.prototype,{constructor:{value:n}}),n.prototype.write=function(t){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)){if(!this._decoder){var e=require("string_decoder").StringDecoder;this._decoder=new e("utf8")}t=this._decoder.write(t)}return this._parser.write(t.toString()),this.emit("data",t),!0},n.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},n.prototype.on=function(t,i){var s=this;return s._parser["on"+t]||-1===a.indexOf(t)||(s._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),s.emit.apply(s,e)}),e.prototype.on.call(s,t,i)};var r="[CDATA[",o="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",u="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:u},l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function m(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function N(t){return'"'===t||"'"===t}function f(t){return">"===t||m(t)}function _(t,e){return t.test(e)}function d(t,e){return!_(t,e)}var g,A,I,D=0;for(var b in t.STATE={BEGIN:D++,BEGIN_WHITESPACE:D++,TEXT:D++,TEXT_ENTITY:D++,OPEN_WAKA:D++,SGML_DECL:D++,SGML_DECL_QUOTED:D++,DOCTYPE:D++,DOCTYPE_QUOTED:D++,DOCTYPE_DTD:D++,DOCTYPE_DTD_QUOTED:D++,COMMENT_STARTING:D++,COMMENT:D++,COMMENT_ENDING:D++,COMMENT_ENDED:D++,CDATA:D++,CDATA_ENDING:D++,CDATA_ENDING_2:D++,PROC_INST:D++,PROC_INST_BODY:D++,PROC_INST_ENDING:D++,OPEN_TAG:D++,OPEN_TAG_SLASH:D++,ATTRIB:D++,ATTRIB_NAME:D++,ATTRIB_NAME_SAW_WHITE:D++,ATTRIB_VALUE:D++,ATTRIB_VALUE_QUOTED:D++,ATTRIB_VALUE_CLOSED:D++,ATTRIB_VALUE_UNQUOTED:D++,ATTRIB_VALUE_ENTITY_Q:D++,ATTRIB_VALUE_ENTITY_U:D++,CLOSE_TAG:D++,CLOSE_TAG_SAW_WHITE:D++,SCRIPT:D++,SCRIPT_ENDING:D++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(e){var i=t.ENTITIES[e],s="number"==typeof i?String.fromCharCode(i):i;t.ENTITIES[e]=s}),t.STATE)t.STATE[t.STATE[b]]=b;function C(t,e,i){t[e]&&t[e](i)}function O(t,e,i){t.textNode&&F(t),C(t,e,i)}function F(t){t.textNode=S(t.opt,t.textNode),t.textNode&&C(t,"ontext",t.textNode),t.textNode=""}function S(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function R(t,e){return F(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,C(t,"onerror",e),t}function v(t){return t.sawRoot&&!t.closedRoot&&P(t,"Unclosed root tag"),t.state!==D.BEGIN&&t.state!==D.BEGIN_WHITESPACE&&t.state!==D.TEXT&&R(t,"Unexpected end"),F(t),t.c="",t.closed=!0,C(t,"onend"),s.call(t,t.strict,t.opt),t}function P(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&R(t,e)}function y(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,i=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(i.ns=e.ns),t.attribList.length=0,O(t,"onopentagstart",i)}function L(t,e){var i=t.indexOf(":")<0?["",t]:t.split(":"),s=i[0],a=i[1];return e&&"xmlns"===t&&(s="xmlns",a=""),{prefix:s,local:a}}function B(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=L(t.attribName,!0),i=e.prefix,s=e.local;if("xmlns"===i)if("xml"===s&&t.attribValue!==c)P(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===s&&t.attribValue!==u)P(t,"xmlns: prefix must be bound to "+u+"\nActual: "+t.attribValue);else{var a=t.tag,n=t.tags[t.tags.length-1]||t;a.ns===n.ns&&(a.ns=Object.create(n.ns)),a.ns[s]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,O(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function U(t,e){if(t.opt.xmlns){var i=t.tag,s=L(t.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(P(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),i.uri=s.prefix);var a=t.tags[t.tags.length-1]||t;i.ns&&a.ns!==i.ns&&Object.keys(i.ns).forEach(function(e){O(t,"onopennamespace",{prefix:e,uri:i.ns[e]})});for(var n=0,r=t.attribList.length;n<r;n++){var o=t.attribList[n],c=o[0],u=o[1],h=L(c,!0),l=h.prefix,T=h.local,E=""===l?"":i.ns[l]||"",p={name:c,value:u,prefix:l,local:T,uri:E};l&&"xmlns"!==l&&!E&&(P(t,"Unbound namespace prefix: "+JSON.stringify(l)),p.uri=l),t.tag.attributes[c]=p,O(t,"onattribute",p)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),O(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=D.TEXT:t.state=D.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function x(t){if(!t.tagName)return P(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=D.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=D.SCRIPT);O(t,"onscript",t.script),t.script=""}var e=t.tags.length,i=t.tagName;t.strict||(i=i[t.looseCase]());for(var s=i;e--;){if(t.tags[e].name===s)break;P(t,"Unexpected close tag")}if(e<0)return P(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=D.TEXT);t.tagName=i;for(var a=t.tags.length;a-- >e;){var n=t.tag=t.tags.pop();t.tagName=t.tag.name,O(t,"onclosetag",t.tagName);var r={};for(var o in n.ns)r[o]=n.ns[o];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&n.ns!==c.ns&&Object.keys(n.ns).forEach(function(e){var i=n.ns[e];O(t,"onclosenamespace",{prefix:e,uri:i})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=D.TEXT}function w(t){var e,i=t.entity,s=i.toLowerCase(),a="";return t.ENTITIES[i]?t.ENTITIES[i]:t.ENTITIES[s]?t.ENTITIES[s]:("#"===(i=s).charAt(0)&&("x"===i.charAt(1)?(i=i.slice(2),a=(e=parseInt(i,16)).toString(16)):(i=i.slice(1),a=(e=parseInt(i,10)).toString(10))),i=i.replace(/^0+/,""),isNaN(e)||a.toLowerCase()!==i?(P(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function G(t,e){"<"===e?(t.state=D.OPEN_WAKA,t.startTagPosition=t.position):m(e)||(P(t,"Non-whitespace before first tag."),t.textNode=e,t.state=D.TEXT)}function M(t,e){var i="";return e<t.length&&(i=t.charAt(e)),i}D=t.STATE,String.fromCodePoint||(g=String.fromCharCode,A=Math.floor,I=function(){var t,e,i=[],s=-1,a=arguments.length;if(!a)return"";for(var n="";++s<a;){var r=Number(arguments[s]);if(!isFinite(r)||r<0||r>1114111||A(r)!==r)throw RangeError("Invalid code point: "+r);r<=65535?i.push(r):(t=55296+((r-=65536)>>10),e=r%1024+56320,i.push(t,e)),(s+1===a||i.length>16384)&&(n+=g.apply(null,i),i.length=0)}return n},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:I,configurable:!0,writable:!0}):String.fromCodePoint=I)}("undefined"==typeof exports?this.sax={}:exports);
|
|
186
|
+
},{}],43:[function(require,module,exports){
|
|
187
|
+
"use strict";function isNCNameStartChar(e){return e>=65&&e<=90||95===e||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNCNameChar(e){return isNCNameStartChar(e)||45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NC_NAME_CHAR="-"+exports.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.NC_NAME_START_CHAR_RE=new RegExp("^["+exports.NC_NAME_START_CHAR+"]$","u"),exports.NC_NAME_CHAR_RE=new RegExp("^["+exports.NC_NAME_CHAR+"]$","u"),exports.NC_NAME_RE=new RegExp("^["+exports.NC_NAME_START_CHAR+"]["+exports.NC_NAME_CHAR+"]*$","u"),exports.isNCNameStartChar=isNCNameStartChar,exports.isNCNameChar=isNCNameChar;
|
|
280
188
|
|
|
281
|
-
}
|
|
282
|
-
},{"buffer":3,"stream":29,"string_decoder":30}],71:[function(require,module,exports){
|
|
283
|
-
const{maths:maths,geometries:geometries}=require("@jscad/modeling");let lastmaterial;const findMaterial=(e,t)=>{if(lastmaterial&&lastmaterial.id===t)return lastmaterial;for(let o=0;o<e.length;o++)if(e[o].id&&e[o].id===t)return lastmaterial=e[o];return null},getValue=(e,t)=>{for(let o=0;o<e.length;o++)if(e[o].type===t)return e[o].value;return null},getColor=e=>{for(let t=0;t<e.length;t++){const o=e[t];if("color"===o.type){let e=parseFloat(getValue(o.objects,"r")),t=parseFloat(getValue(o.objects,"g")),s=parseFloat(getValue(o.objects,"b")),l=parseFloat(getValue(o.objects,"a"));return Number.isNaN(e)&&(e=1),Number.isNaN(t)&&(t=1),Number.isNaN(s)&&(s=1),Number.isNaN(l)&&(l=1),[e,t,s,l]}}return null},findColorByMaterial=(e,t)=>{const o=findMaterial(e,t);return o?getColor(o.objects):null},createObject=(e,t,o,s)=>{const l=[],a=[],r=[],n=o.amfMaterials,c=(e,t)=>{if("coordinates"===e.type){const t=parseFloat(getValue(e.objects,"x")),o=parseFloat(getValue(e.objects,"y")),s=parseFloat(getValue(e.objects,"z"));l.push([t,o,s])}},i=(e,t)=>{"vertex"===e.type&&e.objects.forEach(c)},g=(e,t)=>{if("triangle"===e.type){const t=parseInt(getValue(e.objects,"v1")),o=parseInt(getValue(e.objects,"v2")),s=parseInt(getValue(e.objects,"v3"));a.push([t,o,s]);const l=getColor(e.objects);l?r.push(l):r.push(u)}};let u=null;const p=(e,t)=>{switch(e.type){case"vertices":e.objects.forEach(i);break;case"volume":u=getColor(e.objects),e.materialid&&(u=findColorByMaterial(n,e.materialid)),e.objects.forEach(g)}},h=(e,t)=>{"mesh"===e.type&&e.objects.forEach(p)};if(!0===s.instantiate){const t=s.amf.scale,o=1!==t?([e,o,s])=>maths.vec3.fromValues(e*t,o*t,s*t):e=>maths.vec3.clone(e);e.objects.forEach(h);const n=getColor(e.objects),c=a.length,i=l.length,g=[];for(let e=0;e<c;e++){const t=[];for(let s=0;s<a[e].length;s++)a[e][s]<0||a[e][s]>=i||t.push(o(l[a[e][s]]));const s=geometries.poly3.fromPoints(t),n=r[e]?r[e]:void 0;n&&(s.color=n),g.push(s)}let u=geometries.geom3.create(g);return n&&(u=u.color=n),u}let m="";if(e.objects.length>0){e.objects.forEach(h);const t=getColor(e.objects),o=a.length,n=l.length;m+=`\n// Object ${e.id}\n// faces : ${o}\n// vertices: ${n}\nconst createObject${e.id} = () => {\n let polygons = []\n let polygon\n`;for(let e=0;e<o;e++){m+=" polygon = geometries.poly3.fromPoints([\n";for(let t=0;t<a[e].length;t++)a[e][t]<0||a[e][t]>=n||(m+=` [${l[a[e][t]]}],\n`);m+=" ])\n";const t=r[e];t&&(m+=` polygon.color = [${t}]\n`),m+=" polygons.push(polygon)\n"}m+=" let shape = geometries.geom3.create(polygons)\n";const c=s.scale?s.scale:1;1!==c&&(m+=` shape = transforms.scale([${c},${c},${c}], shape)\n`),t&&(m+=` shape = colors.colorize([${t}], shape)\n`),m+=" return shape\n}\n"}return m};module.exports=createObject;
|
|
189
|
+
},{}],44:[function(require,module,exports){
|
|
190
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ed5=require("xmlchars/xml/1.0/ed5"),ed2=require("xmlchars/xml/1.1/ed2"),NSed3=require("xmlchars/xmlns/1.0/ed3");var isS=ed5.isS,isChar10=ed5.isChar,isNameStartChar=ed5.isNameStartChar,isNameChar=ed5.isNameChar,S_LIST=ed5.S_LIST,NAME_RE=ed5.NAME_RE,isChar11=ed2.isChar,isNCNameStartChar=NSed3.isNCNameStartChar,isNCNameChar=NSed3.isNCNameChar,NC_NAME_RE=NSed3.NC_NAME_RE;const XML_NAMESPACE="http://www.w3.org/XML/1998/namespace",XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/",rootNS={__proto__:null,xml:XML_NAMESPACE,xmlns:XMLNS_NAMESPACE},XML_ENTITIES={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},EOC=-1,NL_LIKE=-2,S_BEGIN=0,S_BEGIN_WHITESPACE=1,S_DOCTYPE=2,S_DOCTYPE_QUOTE=3,S_DTD=4,S_DTD_QUOTED=5,S_DTD_OPEN_WAKA=6,S_DTD_OPEN_WAKA_BANG=7,S_DTD_COMMENT=8,S_DTD_COMMENT_ENDING=9,S_DTD_COMMENT_ENDED=10,S_DTD_PI=11,S_DTD_PI_ENDING=12,S_TEXT=13,S_ENTITY=14,S_OPEN_WAKA=15,S_OPEN_WAKA_BANG=16,S_COMMENT=17,S_COMMENT_ENDING=18,S_COMMENT_ENDED=19,S_CDATA=20,S_CDATA_ENDING=21,S_CDATA_ENDING_2=22,S_PI_FIRST_CHAR=23,S_PI_REST=24,S_PI_BODY=25,S_PI_ENDING=26,S_XML_DECL_NAME_START=27,S_XML_DECL_NAME=28,S_XML_DECL_EQ=29,S_XML_DECL_VALUE_START=30,S_XML_DECL_VALUE=31,S_XML_DECL_SEPARATOR=32,S_XML_DECL_ENDING=33,S_OPEN_TAG=34,S_OPEN_TAG_SLASH=35,S_ATTRIB=36,S_ATTRIB_NAME=37,S_ATTRIB_NAME_SAW_WHITE=38,S_ATTRIB_VALUE=39,S_ATTRIB_VALUE_QUOTED=40,S_ATTRIB_VALUE_CLOSED=41,S_ATTRIB_VALUE_UNQUOTED=42,S_CLOSE_TAG=43,S_CLOSE_TAG_SAW_WHITE=44,TAB=9,NL=10,CR=13,SPACE=32,BANG=33,DQUOTE=34,AMP=38,SQUOTE=39,MINUS=45,FORWARD_SLASH=47,SEMICOLON=59,LESS=60,EQUAL=61,GREATER=62,QUESTION=63,OPEN_BRACKET=91,CLOSE_BRACKET=93,NEL=133,LS=8232,isQuote=t=>34===t||39===t,QUOTES=[34,39],DOCTYPE_TERMINATOR=[...QUOTES,OPEN_BRACKET,GREATER],DTD_TERMINATOR=[...QUOTES,LESS,CLOSE_BRACKET],XML_DECL_NAME_TERMINATOR=[EQUAL,QUESTION,...S_LIST],ATTRIB_VALUE_UNQUOTED_TERMINATOR=[...S_LIST,GREATER,AMP,LESS];function nsPairCheck(t,s,e){switch(s){case"xml":e!==XML_NAMESPACE&&t.fail(`xml prefix must be bound to ${XML_NAMESPACE}.`);break;case"xmlns":e!==XMLNS_NAMESPACE&&t.fail(`xmlns prefix must be bound to ${XMLNS_NAMESPACE}.`)}switch(e){case XMLNS_NAMESPACE:t.fail(""===s?`the default namespace may not be set to ${e}.`:`may not assign a prefix (even "xmlns") to the URI ${XMLNS_NAMESPACE}.`);break;case XML_NAMESPACE:switch(s){case"xml":break;case"":t.fail(`the default namespace may not be set to ${e}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}function nsMappingCheck(t,s){for(const e of Object.keys(s))nsPairCheck(t,e,s[e])}const isNCName=t=>NC_NAME_RE.test(t),isName=t=>NAME_RE.test(t),FORBIDDEN_START=0,FORBIDDEN_BRACKET=1,FORBIDDEN_BRACKET_BRACKET=2;exports.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const EVENT_NAME_TO_HANDLER_NAME={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class SaxesParser{constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const s=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,s){this.nameStartCheck=isNCNameStartChar,this.nameCheck=isNCNameChar,this.isName=isNCName,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},rootNS);const t=this.opt.additionalNamespaces;null!=t&&(nsMappingCheck(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=isNameStartChar,this.nameCheck=isNameChar,this.isName=isName,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=FORBIDDEN_START,this.attribList=[];const{fragmentOpt:s}=this;this.state=s?S_TEXT:S_BEGIN,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=s,this.xmlDeclPossible=!s,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:e}=this.opt;if(void 0===e){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");e="1.0"}this.setXMLVersion(e),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(XML_ENTITIES),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,s){this[EVENT_NAME_TO_HANDLER_NAME[t]]=s}off(t){this[EVENT_NAME_TO_HANDLER_NAME[t]]=void 0}makeError(t){var s;let e=null!==(s=this.fileName)&&void 0!==s?s:"";return this.trackPosition&&(e.length>0&&(e+=":"),e+=`${this.line}:${this.column}`),e.length>0&&(e+=": "),new Error(e+t)}fail(t){const s=this.makeError(t),e=this.errorHandler;if(void 0===e)throw s;return e(s),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let s=!1;null===t?(s=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let e=t.length;const i=t.charCodeAt(e-1);!s&&(i===CR||i>=55296&&i<=56319)&&(this.carriedFromPrevious=t[e-1],e--,t=t.slice(0,e));const{stateTable:a}=this;for(this.chunk=t,this.i=0;this.i<e;)a[this.state].call(this);return this.chunkPosition+=e,s?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return EOC;const e=t.charCodeAt(s);if(this.column++,e<55296){if(e>=SPACE||e===TAB)return e;switch(e){case NL:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL;case CR:return t.charCodeAt(s+1)===NL&&(this.i=s+2),this.line++,this.column=0,this.positionAtNewLine=this.position,NL_LIKE;default:return this.fail("disallowed character."),e}}if(e>56319)return e>=57344&&e<=65533||this.fail("disallowed character."),e;const i=65536+1024*(e-55296)+(t.charCodeAt(s+1)-56320);return this.i=s+2,i>1114111&&this.fail("disallowed character."),i}getCode11(){const{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return EOC;const e=t.charCodeAt(s);if(this.column++,e<55296){if(e>31&&e<127||e>159&&e!==LS||e===TAB)return e;switch(e){case NL:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL;case CR:{const e=t.charCodeAt(s+1);e!==NL&&e!==NEL||(this.i=s+2)}case NEL:case LS:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL_LIKE;default:return this.fail("disallowed character."),e}}if(e>56319)return e>=57344&&e<=65533||this.fail("disallowed character."),e;const i=65536+1024*(e-55296)+(t.charCodeAt(s+1)-56320);return this.i=s+2,i>1114111&&this.fail("disallowed character."),i}getCodeNorm(){const t=this.getCode();return t===NL_LIKE?NL:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:s}=this;const{chunk:e}=this;for(;;){const i=this.getCode(),a=i===NL_LIKE,h=a?NL:i;if(h===EOC||t.includes(h))return this.text+=e.slice(s,this.prevI),h;a&&(this.text+=`${e.slice(s,this.prevI)}\n`,s=this.i)}}captureToChar(t){let{i:s}=this;const{chunk:e}=this;for(;;){let i=this.getCode();switch(i){case NL_LIKE:this.text+=`${e.slice(s,this.prevI)}\n`,s=this.i,i=NL;break;case EOC:return this.text+=e.slice(s),!1}if(i===t)return this.text+=e.slice(s,this.prevI),!0}}captureNameChars(){const{chunk:t,i:s}=this;for(;;){const e=this.getCode();if(e===EOC)return this.name+=t.slice(s),EOC;if(!isNameChar(e))return this.name+=t.slice(s,this.prevI),e===NL_LIKE?NL:e}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===EOC||!isS(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=isChar10,this.getCode=this.getCode10):(this.isChar=isChar11,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=S_BEGIN_WHITESPACE}sBeginWhitespace(){const t=this.i,s=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),s){case LESS:if(this.state=S_OPEN_WAKA,0!==this.text.length)throw new Error("no-empty text at start");break;case EOC:break;default:this.unget(),this.state=S_TEXT,this.xmlDeclPossible=!1}}sDoctype(){var t;const s=this.captureTo(DOCTYPE_TERMINATOR);switch(s){case GREATER:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=S_TEXT,this.doctype=!0;break;case EOC:break;default:this.text+=String.fromCodePoint(s),s===OPEN_BRACKET?this.state=S_DTD:isQuote(s)&&(this.state=S_DOCTYPE_QUOTE,this.q=s)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=S_DOCTYPE)}sDTD(){const t=this.captureTo(DTD_TERMINATOR);t!==EOC&&(this.text+=String.fromCodePoint(t),t===CLOSE_BRACKET?this.state=S_DOCTYPE:t===LESS?this.state=S_DTD_OPEN_WAKA:isQuote(t)&&(this.state=S_DTD_QUOTED,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=S_DTD,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case BANG:this.state=S_DTD_OPEN_WAKA_BANG,this.openWakaBang="";break;case QUESTION:this.state=S_DTD_PI;break;default:this.state=S_DTD}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),s=this.openWakaBang+=t;this.text+=t,"-"!==s&&(this.state="--"===s?S_DTD_COMMENT:S_DTD,this.openWakaBang="")}sDTDComment(){this.captureToChar(MINUS)&&(this.text+="-",this.state=S_DTD_COMMENT_ENDING)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=t===MINUS?S_DTD_COMMENT_ENDED:S_DTD_COMMENT}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===GREATER?this.state=S_DTD:(this.fail("malformed comment."),this.state=S_DTD_COMMENT)}sDTDPI(){this.captureToChar(QUESTION)&&(this.text+="?",this.state=S_DTD_PI_ENDING)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===GREATER&&(this.state=S_DTD)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:s}=this;t:for(;;)switch(this.getCode()){case NL_LIKE:this.entity+=`${s.slice(t,this.prevI)}\n`,t=this.i;break;case SEMICOLON:{const{entityReturnState:e}=this,i=this.entity+s.slice(t,this.prevI);let a;this.state=e,""===i?(this.fail("empty entity name."),a="&;"):(a=this.parseEntity(i),this.entity=""),e===S_TEXT&&void 0===this.textHandler||(this.text+=a);break t}case EOC:this.entity+=s.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(isNameStartChar(t))this.state=S_OPEN_TAG,this.unget(),this.xmlDeclPossible=!1;else switch(t){case FORWARD_SLASH:this.state=S_CLOSE_TAG,this.xmlDeclPossible=!1;break;case BANG:this.state=S_OPEN_WAKA_BANG,this.openWakaBang="",this.xmlDeclPossible=!1;break;case QUESTION:this.state=S_PI_FIRST_CHAR;break;default:this.fail("disallowed character in tag name"),this.state=S_TEXT,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=S_CDATA,this.openWakaBang="";break;case"--":this.state=S_COMMENT,this.openWakaBang="";break;case"DOCTYPE":this.state=S_DOCTYPE,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(MINUS)&&(this.state=S_COMMENT_ENDING)}sCommentEnding(){var t;const s=this.getCodeNorm();s===MINUS?(this.state=S_COMMENT_ENDED,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(s)}`,this.state=S_COMMENT)}sCommentEnded(){const t=this.getCodeNorm();t!==GREATER?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=S_COMMENT):this.state=S_TEXT}sCData(){this.captureToChar(CLOSE_BRACKET)&&(this.state=S_CDATA_ENDING)}sCDataEnding(){const t=this.getCodeNorm();t===CLOSE_BRACKET?this.state=S_CDATA_ENDING_2:(this.text+=`]${String.fromCodePoint(t)}`,this.state=S_CDATA)}sCDataEnding2(){var t;const s=this.getCodeNorm();switch(s){case GREATER:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=S_TEXT;break;case CLOSE_BRACKET:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(s)}`,this.state=S_CDATA}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=S_PI_REST):t===QUESTION||isS(t)?(this.fail("processing instruction without a target."),this.state=t===QUESTION?S_PI_ENDING:S_PI_BODY):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=S_PI_REST)}sPIRest(){const{chunk:t,i:s}=this;for(;;){const e=this.getCodeNorm();if(e===EOC)return void(this.piTarget+=t.slice(s));if(!this.nameCheck(e)){this.piTarget+=t.slice(s,this.prevI);const i=e===QUESTION;i||isS(e)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=i?S_XML_DECL_ENDING:S_XML_DECL_NAME_START):this.state=i?S_PI_ENDING:S_PI_BODY:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(e));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===QUESTION?this.state=S_PI_ENDING:isS(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(QUESTION)&&(this.state=S_PI_ENDING)}sPIEnding(){var t;const s=this.getCodeNorm();if(s===GREATER){const{piTarget:s}=this;"xml"===s.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:s,body:this.text}),this.piTarget=this.text="",this.state=S_TEXT}else s===QUESTION?this.text+="?":(this.text+=`?${String.fromCodePoint(s)}`,this.state=S_PI_BODY);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==QUESTION?t!==EOC&&(this.state=S_XML_DECL_NAME,this.name=String.fromCodePoint(t)):this.state=S_XML_DECL_ENDING}sXMLDeclName(){const t=this.captureTo(XML_DECL_NAME_TERMINATOR);if(t===QUESTION)return this.state=S_XML_DECL_ENDING,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(isS(t)||t===EQUAL){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===EQUAL?S_XML_DECL_VALUE_START:S_XML_DECL_EQ}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===QUESTION)return this.state=S_XML_DECL_ENDING,void this.fail("XML declaration is incomplete.");isS(t)||(t!==EQUAL&&this.fail("value required."),this.state=S_XML_DECL_VALUE_START)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===QUESTION)return this.state=S_XML_DECL_ENDING,void this.fail("XML declaration is incomplete.");isS(t)||(isQuote(t)?this.q=t:(this.fail("value must be quoted."),this.q=SPACE),this.state=S_XML_DECL_VALUE)}sXMLDeclValue(){const t=this.captureTo([this.q,QUESTION]);if(t===QUESTION)return this.state=S_XML_DECL_ENDING,this.text="",void this.fail("XML declaration is incomplete.");if(t===EOC)return;const s=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=s;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(s)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=s;break;case"standalone":"yes"!==s&&"no"!==s&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=s}this.name="",this.state=S_XML_DECL_SEPARATOR}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==QUESTION?(isS(t)||(this.fail("whitespace required."),this.unget()),this.state=S_XML_DECL_NAME_START):this.state=S_XML_DECL_ENDING}sXMLDeclEnding(){var t;this.getCodeNorm()===GREATER?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=S_TEXT):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const s=this.captureNameChars();if(s===EOC)return;const e=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=e.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,e),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),s){case GREATER:this.openTag();break;case FORWARD_SLASH:this.state=S_OPEN_TAG_SLASH;break;default:isS(s)||this.fail("disallowed character in tag name."),this.state=S_ATTRIB}}sOpenTagSlash(){this.getCode()===GREATER?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=S_ATTRIB)}sAttrib(){const t=this.skipSpaces();t!==EOC&&(isNameStartChar(t)?(this.unget(),this.state=S_ATTRIB_NAME):t===GREATER?this.openTag():t===FORWARD_SLASH?this.state=S_OPEN_TAG_SLASH:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===EQUAL?this.state=S_ATTRIB_VALUE:isS(t)?this.state=S_ATTRIB_NAME_SAW_WHITE:t===GREATER?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==EOC&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case EOC:return;case EQUAL:this.state=S_ATTRIB_VALUE;break;default:this.fail("attribute without value."),this.text="",this.name="",t===GREATER?this.openTag():isNameStartChar(t)?(this.unget(),this.state=S_ATTRIB_NAME):(this.fail("disallowed character in attribute name."),this.state=S_ATTRIB)}}sAttribValue(){const t=this.getCodeNorm();isQuote(t)?(this.q=t,this.state=S_ATTRIB_VALUE_QUOTED):isS(t)||(this.fail("unquoted attribute value."),this.state=S_ATTRIB_VALUE_UNQUOTED,this.unget())}sAttribValueQuoted(){const{q:t,chunk:s}=this;let{i:e}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+s.slice(e,this.prevI)),this.name=this.text="",this.q=null,void(this.state=S_ATTRIB_VALUE_CLOSED);case AMP:return this.text+=s.slice(e,this.prevI),this.state=S_ENTITY,void(this.entityReturnState=S_ATTRIB_VALUE_QUOTED);case NL:case NL_LIKE:case TAB:this.text+=`${s.slice(e,this.prevI)} `,e=this.i;break;case LESS:return this.text+=s.slice(e,this.prevI),void this.fail("disallowed character.");case EOC:return void(this.text+=s.slice(e))}}sAttribValueClosed(){const t=this.getCodeNorm();isS(t)?this.state=S_ATTRIB:t===GREATER?this.openTag():t===FORWARD_SLASH?this.state=S_OPEN_TAG_SLASH:isNameStartChar(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=S_ATTRIB_NAME):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(ATTRIB_VALUE_UNQUOTED_TERMINATOR);switch(t){case AMP:this.state=S_ENTITY,this.entityReturnState=S_ATTRIB_VALUE_UNQUOTED;break;case LESS:this.fail("disallowed character.");break;case EOC:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===GREATER?this.openTag():this.state=S_ATTRIB}}sCloseTag(){const t=this.captureNameChars();t===GREATER?this.closeTag():isS(t)?this.state=S_CLOSE_TAG_SAW_WHITE:t!==EOC&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case GREATER:this.closeTag();break;case EOC:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:s}=this;const{chunk:e,textHandler:i}=this;t:for(;;)switch(this.getCode()){case LESS:if(this.state=S_OPEN_WAKA,void 0!==i){const{text:s}=this,a=e.slice(t,this.prevI);0!==s.length?(i(s+a),this.text=""):0!==a.length&&i(a)}s=FORBIDDEN_START;break t;case AMP:this.state=S_ENTITY,this.entityReturnState=S_TEXT,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=FORBIDDEN_START;break t;case CLOSE_BRACKET:switch(s){case FORBIDDEN_START:s=FORBIDDEN_BRACKET;break;case FORBIDDEN_BRACKET:s=FORBIDDEN_BRACKET_BRACKET;break;case FORBIDDEN_BRACKET_BRACKET:break;default:throw new Error("impossible state")}break;case GREATER:s===FORBIDDEN_BRACKET_BRACKET&&this.fail('the string "]]>" is disallowed in char data.'),s=FORBIDDEN_START;break;case NL_LIKE:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i,s=FORBIDDEN_START;break;case EOC:void 0!==i&&(this.text+=e.slice(t));break t;default:s=FORBIDDEN_START}this.forbiddenState=s}handleTextOutsideRoot(){let{i:t}=this;const{chunk:s,textHandler:e}=this;let i=!1;t:for(;;){const a=this.getCode();switch(a){case LESS:if(this.state=S_OPEN_WAKA,void 0!==e){const{text:i}=this,a=s.slice(t,this.prevI);0!==i.length?(e(i+a),this.text=""):0!==a.length&&e(a)}break t;case AMP:this.state=S_ENTITY,this.entityReturnState=S_TEXT,void 0!==e&&(this.text+=s.slice(t,this.prevI)),i=!0;break t;case NL_LIKE:void 0!==e&&(this.text+=`${s.slice(t,this.prevI)}\n`),t=this.i;break;case EOC:void 0!==e&&(this.text+=s.slice(t));break t;default:isS(a)||(i=!0)}}i&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,s){var e;const{prefix:i,local:a}=this.qname(t),h={name:t,prefix:i,local:a,value:s};if(this.attribList.push(h),null===(e=this.attributeHandler)||void 0===e||e.call(this,h),"xmlns"===i){const t=s.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[a]=t,nsPairCheck(this,a,t)}else if("xmlns"===t){const t=s.trim();this.topNS[""]=t,nsPairCheck(this,"",t)}}pushAttribPlain(t,s){var e;const i={name:t,value:s};this.attribList.push(i),null===(e=this.attributeHandler)||void 0===e||e.call(this,i)}end(){var t,s;this.sawRoot||this.fail("document must contain a root element.");const{tags:e}=this;for(;e.length>0;){const t=e.pop();this.fail(`unclosed tag: ${t.name}`)}this.state!==S_BEGIN&&this.state!==S_TEXT&&this.fail("unexpected end.");const{text:i}=this;return 0!==i.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,i),this.text=""),this._closed=!0,null===(s=this.endHandler)||void 0===s||s.call(this),this._init(),this}resolve(t){var s,e;let i=this.topNS[t];if(void 0!==i)return i;const{tags:a}=this;for(let s=a.length-1;s>=0;s--)if(void 0!==(i=a[s].ns[t]))return i;return void 0!==(i=this.ns[t])?i:null===(e=(s=this.opt).resolvePrefix)||void 0===e?void 0:e.call(s,t)}qname(t){const s=t.indexOf(":");if(-1===s)return{prefix:"",local:t};const e=t.slice(s+1),i=t.slice(0,s);return(""===i||""===e||e.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:i,local:e}}processAttribsNS(){var t;const{attribList:s}=this,e=this.tag;{const{prefix:s,local:i}=this.qname(e.name);e.prefix=s,e.local=i;const a=e.uri=null!==(t=this.resolve(s))&&void 0!==t?t:"";""!==s&&("xmlns"===s&&this.fail('tags may not have "xmlns" as prefix.'),""===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(s)}.`),e.uri=s))}if(0===s.length)return;const{attributes:i}=e,a=new Set;for(const t of s){const{name:s,prefix:e,local:h}=t;let o,n;""===e?(o="xmlns"===s?XMLNS_NAMESPACE:"",n=s):(void 0===(o=this.resolve(e))&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),o=e),n=`{${o}}${h}`),a.has(n)&&this.fail(`duplicate attribute: ${n}.`),a.add(n),t.uri=o,i[s]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,s=this.tag.attributes;for(const{name:e,value:i}of t)void 0!==s[e]&&this.fail(`duplicate attribute: ${e}.`),s[e]=i;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:s}=this,e=this.tag;e.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,e),s.push(e),this.state=S_TEXT,this.name=""}openSelfClosingTag(){var t,s,e;this.processAttribs();const{tags:i}=this,a=this.tag;a.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,a),null===(s=this.closeTagHandler)||void 0===s||s.call(this,a),null===(this.tag=null!==(e=i[i.length-1])&&void 0!==e?e:null)&&(this.closedRoot=!0),this.state=S_TEXT,this.name=""}closeTag(){const{tags:t,name:s}=this;if(this.state=S_TEXT,this.name="",""===s)return this.fail("weird empty close tag."),void(this.text+="</>");const e=this.closeTagHandler;let i=t.length;for(;i-- >0;){const i=this.tag=t.pop();if(this.topNS=i.ns,null==e||e(i),i.name===s)break;this.fail("unexpected close tag.")}0===i?this.closedRoot=!0:i<0&&(this.fail(`unmatched closing tag: ${s}.`),this.text+=`</${s}>`)}parseEntity(t){if("#"!==t[0]){const s=this.ENTITIES[t];return void 0!==s?s:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let s=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?s=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(s=parseInt(t.slice(1),10)),this.isChar(s)?String.fromCodePoint(s):(this.fail("malformed character entity."),`&${t};`)}}exports.SaxesParser=SaxesParser;
|
|
284
191
|
|
|
285
|
-
},{"
|
|
192
|
+
},{"xmlchars/xml/1.0/ed5":41,"xmlchars/xml/1.1/ed2":42,"xmlchars/xmlns/1.0/ed3":43}],45:[function(require,module,exports){
|
|
286
193
|
module.exports={
|
|
287
194
|
"name": "@jscad/amf-deserializer",
|
|
288
|
-
"version": "2.
|
|
195
|
+
"version": "2.2.1",
|
|
289
196
|
"description": "AMF Deserializer for JSCAD",
|
|
290
197
|
"repository": "https://github.com/jscad/OpenJSCAD.org/",
|
|
291
|
-
"main": "index.js",
|
|
198
|
+
"main": "src/index.js",
|
|
292
199
|
"scripts": {
|
|
293
200
|
"coverage": "nyc --all --reporter=html --reporter=text npm test",
|
|
294
201
|
"test": "ava --verbose --timeout 2m 'tests/**/*.test.js'"
|
|
@@ -316,8 +223,8 @@ module.exports={
|
|
|
316
223
|
],
|
|
317
224
|
"license": "MIT",
|
|
318
225
|
"dependencies": {
|
|
319
|
-
"@jscad/modeling": "2.
|
|
320
|
-
"
|
|
226
|
+
"@jscad/modeling": "2.5.3",
|
|
227
|
+
"saxes": "5.0.1"
|
|
321
228
|
},
|
|
322
229
|
"devDependencies": {
|
|
323
230
|
"ava": "3.15.0",
|
|
@@ -325,40 +232,55 @@ module.exports={
|
|
|
325
232
|
}
|
|
326
233
|
}
|
|
327
234
|
|
|
328
|
-
},{}],
|
|
329
|
-
const
|
|
235
|
+
},{}],46:[function(require,module,exports){
|
|
236
|
+
const inchMM=1/.03937;module.exports={inchMM:inchMM};
|
|
237
|
+
|
|
238
|
+
},{}],47:[function(require,module,exports){
|
|
239
|
+
const createObject=require("./objectBuilder"),parse=require("./parse"),instantiate=(e,t)=>{const a={pxPmm:require("./constants").pxPmm};e=Object.assign({},a,e);const{pxPmm:r}=e,{amfObj:s,amfMaterials:i,amfTextures:n,amfConstels:m}=parse(t,r);if(!s)throw new Error("AMF parsing failed, no valid AMF data retrieved");return objectify(s,{amfMaterials:i,amfTextures:n,amfConstels:m})},objectify=(e,t)=>{return e.objects.filter(e=>"object"===e.type).map((a,r)=>createObject(a,r,t,{amf:e,instantiate:!0}))};module.exports=instantiate;
|
|
240
|
+
|
|
241
|
+
},{"./constants":46,"./objectBuilder":50,"./parse":51}],48:[function(require,module,exports){
|
|
242
|
+
const amfMesh=a=>{const e={type:"mesh",objects:[]};return e},amfVertices=a=>{const e={type:"vertices",objects:[]};return e},amfCoordinates=a=>{const e={type:"coordinates",objects:[]};return e},amfNormal=a=>{const e={type:"normal",objects:[]};return e},amfX=a=>({type:"x",value:"0"}),amfY=a=>({type:"y",value:"0"}),amfZ=a=>({type:"z",value:"0"}),amfVolume=a=>{const e={type:"volume"};return a.materialid&&(e.materialid=a.materialid),e.objects=[],e},amfTriangle=a=>{const e={type:"triangle",objects:[]};return e},amfV1=a=>({type:"v1",value:"0"}),amfV2=a=>({type:"v2",value:"0"}),amfV3=a=>({type:"v3",value:"0"}),amfVertex=a=>{const e={type:"vertex",objects:[]};return e},amfEdge=a=>{const e={type:"edge",objects:[]};return e},amfMetadata=a=>{const e={type:"metadata"};return a.type&&(e.mtype=a.type),a.id&&(e.id=a.id),e},amfMaterial=a=>{const e={type:"material"};return a.id&&(e.id=a.id),e.objects=[],e},amfColor=a=>{const e={type:"color",objects:[]};return e},amfR=a=>({type:"r",value:"1"}),amfG=a=>({type:"g",value:"1"}),amfB=a=>({type:"b",value:"1"}),amfA=a=>({type:"a",value:"1"}),amfMap=a=>{const e={type:"map"};return a.gtexid&&(e.gtexid=a.gtexid),a.btexid&&(e.btexid=a.btexid),a.rtexid&&(e.rtexid=a.rtexid),e.objects=[],e},amfU1=a=>({type:"u1",value:"0"}),amfU2=a=>({type:"u2",value:"0"}),amfU3=a=>({type:"u3",value:"0"});module.exports={amfMesh:amfMesh,amfVertices:amfVertices,amfCoordinates:amfCoordinates,amfX:amfX,amfY:amfY,amfZ:amfZ,amfNormal:amfNormal,amfVolume:amfVolume,amfTriangle:amfTriangle,amfV1:amfV1,amfV2:amfV2,amfV3:amfV3,amfVertex:amfVertex,amfEdge:amfEdge,amfMetadata:amfMetadata,amfMaterial:amfMaterial,amfColor:amfColor,amfR:amfR,amfG:amfG,amfB:amfB,amfA:amfA,amfMap:amfMap,amfU1:amfU1,amfU2:amfU2,amfU3:amfU3};
|
|
330
243
|
|
|
331
|
-
},{
|
|
332
|
-
const
|
|
244
|
+
},{}],49:[function(require,module,exports){
|
|
245
|
+
const version=require("../package.json").version,translate=require("./translate"),instantiate=require("./deserialize"),deserialize=(e,t)=>{const a={filename:"amf",output:"script",version:version,addMetaData:!0};return"script"===(e=Object.assign({},a,e)).output?translate(e,t):instantiate(e,t)},extension="amf";module.exports={deserialize:deserialize,extension:"amf"};
|
|
333
246
|
|
|
334
|
-
},{"
|
|
247
|
+
},{"../package.json":45,"./deserialize":47,"./translate":52}],50:[function(require,module,exports){
|
|
248
|
+
const{maths:maths,geometries:geometries}=require("@jscad/modeling");let lastmaterial;const findMaterial=(e,t)=>{if(lastmaterial&&lastmaterial.id===t)return lastmaterial;for(let o=0;o<e.length;o++)if(e[o].id&&e[o].id===t)return lastmaterial=e[o];return null},getValue=(e,t)=>{for(let o=0;o<e.length;o++)if(e[o].type===t)return e[o].value;return null},getColor=e=>{for(let t=0;t<e.length;t++){const o=e[t];if("color"===o.type){let e=parseFloat(getValue(o.objects,"r")),t=parseFloat(getValue(o.objects,"g")),s=parseFloat(getValue(o.objects,"b")),l=parseFloat(getValue(o.objects,"a"));return Number.isNaN(e)&&(e=1),Number.isNaN(t)&&(t=1),Number.isNaN(s)&&(s=1),Number.isNaN(l)&&(l=1),[e,t,s,l]}}return null},findColorByMaterial=(e,t)=>{const o=findMaterial(e,t);return o?getColor(o.objects):null},createObject=(e,t,o,s)=>{const l=[],a=[],r=[],n=o.amfMaterials,c=(e,t)=>{if("coordinates"===e.type){const t=parseFloat(getValue(e.objects,"x")),o=parseFloat(getValue(e.objects,"y")),s=parseFloat(getValue(e.objects,"z"));l.push([t,o,s])}},i=(e,t)=>{"vertex"===e.type&&e.objects.forEach(c)},g=(e,t)=>{if("triangle"===e.type){const t=parseInt(getValue(e.objects,"v1")),o=parseInt(getValue(e.objects,"v2")),s=parseInt(getValue(e.objects,"v3"));a.push([t,o,s]);const l=getColor(e.objects);l?r.push(l):r.push(u)}};let u=null;const p=(e,t)=>{switch(e.type){case"vertices":e.objects.forEach(i);break;case"volume":u=getColor(e.objects),e.materialid&&(u=findColorByMaterial(n,e.materialid)),e.objects.forEach(g)}},h=(e,t)=>{"mesh"===e.type&&e.objects.forEach(p)};if(!0===s.instantiate){const t=s.amf.scale,o=1!==t?([e,o,s])=>maths.vec3.fromValues(e*t,o*t,s*t):e=>maths.vec3.clone(e);e.objects.forEach(h);const n=getColor(e.objects),c=a.length,i=l.length,g=[];for(let e=0;e<c;e++){const t=[];for(let s=0;s<a[e].length;s++)a[e][s]<0||a[e][s]>=i||t.push(o(l[a[e][s]]));const s=geometries.poly3.fromPoints(t),n=r[e]?r[e]:void 0;n&&(s.color=n),g.push(s)}let u=geometries.geom3.create(g);return n&&(u=u.color=n),u}let m="";if(e.objects.length>0){e.objects.forEach(h);const t=getColor(e.objects),o=a.length,n=l.length;m+=`\n// Object ${e.id}\n// faces : ${o}\n// vertices: ${n}\nconst createObject${e.id} = () => {\n let polygons = []\n let polygon\n`;for(let e=0;e<o;e++){m+=" polygon = geometries.poly3.fromPoints([\n";for(let t=0;t<a[e].length;t++)a[e][t]<0||a[e][t]>=n||(m+=` [${l[a[e][t]]}],\n`);m+=" ])\n";const t=r[e];t&&(m+=` polygon.color = [${t}]\n`),m+=" polygons.push(polygon)\n"}m+=" let shape = geometries.geom3.create(polygons)\n";const c=s.scale?s.scale:1;1!==c&&(m+=` shape = transforms.scale([${c},${c},${c}], shape)\n`),t&&(m+=` shape = colors.colorize([${t}], shape)\n`),m+=" return shape\n}\n"}return m};module.exports=createObject;
|
|
249
|
+
|
|
250
|
+
},{"@jscad/modeling":185}],51:[function(require,module,exports){
|
|
251
|
+
const saxes=require("saxes"),{amfMesh:amfMesh,amfVertices:amfVertices,amfCoordinates:amfCoordinates,amfX:amfX,amfY:amfY,amfZ:amfZ,amfNormal:amfNormal,amfVolume:amfVolume,amfTriangle:amfTriangle,amfV1:amfV1,amfV2:amfV2,amfV3:amfV3,amfVertex:amfVertex,amfEdge:amfEdge,amfMetadata:amfMetadata,amfMaterial:amfMaterial,amfColor:amfColor,amfR:amfR,amfG:amfG,amfB:amfB,amfA:amfA,amfMap:amfMap,amfU1:amfU1,amfU2:amfU2,amfU3:amfU3}=require("./helpers"),{inchMM:inchMM}=require("./constants");let amfLast=null,amfDefinition=0;const amfObjects=[],amfMaterials=[],amfTextures=[],amfConstels=[];let amfObj=null;const amfAmf=a=>{const e={type:"amf",unit:"mm",scale:1};switch(a.unit&&(e.unit=a.unit.toLowerCase()),e.unit.toLowerCase()){case"inch":e.scale=inchMM;break;case"foot":e.scale=12*inchMM;break;case"meter":e.scale=1e3;break;case"micron":e.scale=.001}return e.objects=[],e},amfObject=a=>{const e={type:"object",id:`JSCAD${amfObjects.length}`};return a.id&&(e.id=a.id),e.objects=[],e},createAmfParser=(a,e)=>{const f=new saxes.SaxesParser;f.on("error",a=>{console.log(`ERROR: AMF file line ${a.line}, column ${a.column}, bad character [${a.c}]`)}),f.on("opentag",a=>{const e={AMF:amfAmf,OBJECT:a=>{const e=amfObject(a);return 0===amfDefinition&&(amfDefinition=1),e},MESH:amfMesh,VERTICES:amfVertices,VERTEX:amfVertex,EDGE:amfEdge,VOLUME:amfVolume,MATERIAL:a=>{const e=amfMaterial(a);return 0===amfDefinition&&(amfDefinition=2),e},TEXTURE:a=>{0===amfDefinition&&(amfDefinition=3)},CONSTELLATION:a=>{0===amfDefinition&&(amfDefinition=4)},METADATA:a=>{const e=amfMetadata(a);return 0===amfDefinition&&(amfDefinition=5),e},COORDINATES:amfCoordinates,NORMAL:amfNormal,NX:amfX,X:amfX,NY:amfY,Y:amfY,NZ:amfZ,Z:amfZ,TRIANGLE:amfTriangle,V1:amfV1,VTEX1:amfV1,V2:amfV2,VTEX2:amfV2,V3:amfV3,VTEX3:amfV3,COLOR:amfColor,R:amfR,G:amfG,B:amfB,A:amfA,MAP:amfMap,TEXMAP:amfMap,U1:amfU1,UTEX1:amfU1,WTEX1:amfU1,U2:amfU2,UTEX2:amfU2,WTEX2:amfU2,U3:amfU3,UTEX3:amfU3,WTEX3:amfU3,COMPOSITE:()=>void 0,undefined:()=>console.log(`WARNING: unsupported AMF element: ${a.name}`)},f=a.name.toUpperCase(),m=e[f]?e[f](a.attributes,{amfObjects:amfObjects}):null;if(m){switch(amfDefinition){case 0:"objects"in m&&amfObjects.push(m);break;case 1:if(amfObjects.length>0){const a=amfObjects.pop();"objects"in a&&a.objects.push(m),amfObjects.push(a),"objects"in m&&amfObjects.push(m)}break;case 2:if("material"===m.type)amfMaterials.push(m);else if(amfMaterials.length>0){const a=amfMaterials.pop();"objects"in a&&a.objects.push(m),amfMaterials.push(a),"objects"in m&&amfMaterials.push(m)}break;case 3:case 4:case 5:break;default:console.log("WARNING: invalid AMF definition")}amfLast=m}}),f.on("closetag",a=>{switch(a.name.toUpperCase()){case"AMF":case"OBJECT":case"MESH":case"VERTICES":case"VERTEX":case"EDGE":case"COORDINATES":case"NORMAL":case"VOLUME":case"TRIANGLE":case"MATERIAL":case"COLOR":case"MAP":case"TEXMAP":break;case"TEXTURE":return void(3===amfDefinition&&(amfDefinition=0));case"CONSTELLATION":return void(4===amfDefinition&&(amfDefinition=0));case"METADATA":return void(5===amfDefinition&&(amfDefinition=0));default:return}let e=null;switch(amfDefinition){case 0:case 1:amfObjects.length>0&&"object"===(e=amfObjects.pop()).type&&(amfDefinition=0),0===amfObjects.length&&(amfObj=e);break;case 2:amfMaterials.length>0&&"material"===(e=amfMaterials.pop()).type&&(amfMaterials.push(e),amfDefinition=0);break;case 3:case 4:case 5:amfDefinition=0}}),f.on("text",a=>{null!==a&&(a=a.trim()).length>0&&amfLast&&0!==amfDefinition&&(amfLast.value=a,amfLast=null)}),f.on("end",()=>{}),f.write(a).close()},parse=(a,e)=>(createAmfParser(a),{amfObj:amfObj,amfMaterials:amfMaterials,amfTextures:amfTextures,amfConstels:amfConstels});module.exports=parse;
|
|
252
|
+
|
|
253
|
+
},{"./constants":46,"./helpers":48,"saxes":44}],52:[function(require,module,exports){
|
|
254
|
+
const createObject=require("./objectBuilder"),parse=require("./parse"),translate=(e,t)=>{const a={pxPmm:require("./constants").pxPmm};e=Object.assign({},a,e);const{version:s,pxPmm:r,addMetaData:n,filename:o}=e;e&&e.statusCallback&&e.statusCallback({progress:0});const{amfObj:c,amfMaterials:l,amfTextures:i,amfConstels:m}=parse(t,r);let b=n?`//\n// Produced by JSCAD IO Library : AMF Deserializer (${s})\n// date: ${new Date}\n// source: ${o}\n//\n`:"";if(!c)throw new Error("AMF parsing failed, no valid AMF data retrieved");return e&&e.statusCallback&&e.statusCallback({progress:50}),b+=codify(c,{amfMaterials:l,amfTextures:i,amfConstels:m}),e&&e.statusCallback&&e.statusCallback({progress:100}),b},codify=(e,t)=>{if("amf"!==e.type||!e.objects)throw new Error("AMF parsing failed, malformed");let a="";const s=e.objects,r=t.amfMaterials;a=`// Objects : ${s.length}\n// Materials: ${r.length}\n// Scale : ${e.scale} from Units (${e.unit})\n\nconst {colors, geometries, transforms} = require('@jscad/modeling')\n\nconst main = () => {\n let objects = []\n`;for(let e=0;e<s.length;e++){const t=s[e];"object"===t.type&&(a+=` objects.push(createObject${t.id}())\n`)}return a+=" return objects\n}\n",s.forEach((s,r)=>{switch(s.type){case"object":a+=createObject(s,r,t,{instantiate:!1,scale:e.scale});break;case"metadata":case"material":break;default:console.log("WARNING: unknown object type: "+s.type)}}),a+="module.exports = {main}\n"};module.exports=translate;
|
|
255
|
+
|
|
256
|
+
},{"./constants":46,"./objectBuilder":50,"./parse":51}],53:[function(require,module,exports){
|
|
335
257
|
const stringify=require("onml/lib/stringify"),{geometries:geometries,modifiers:modifiers}=require("@jscad/modeling"),{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),mimeType="application/amf+xml",serialize=(e,...t)=>{e=Object.assign({},{statusCallback:null,unit:"millimeter"},e);let o=(t=flatten(t)).filter(e=>geometries.geom3.isA(e));if(0===o.length)throw new Error("only 3D geometries can be serialized to AMF");t.length!==o.length&&console.warn("some objects could not be serialized to AMF"),o=toArray(modifiers.generalize({snap:!0,triangulate:!0},o)),e.statusCallback&&e.statusCallback({progress:0});let r=["amf",{unit:e.unit,version:"1.1"},["metadata",{type:"author"},"Created by JSCAD"]];r=r.concat(translateObjects(o,e));const n=`<?xml version="1.0" encoding="UTF-8"?>\n${stringify(r,2)}`;return e&&e.statusCallback&&e.statusCallback({progress:100}),[n]},translateObjects=(e,t)=>{const o=[];return e.forEach((e,r)=>{geometries.geom3.toPolygons(e).length>0&&(t.id=r,o.push(convertToObject(e,t)))}),o},convertToObject=(e,t)=>{return["object",{id:t.id},convertToMesh(e,t)]},convertToMesh=(e,t)=>{let o=["mesh",{},convertToVertices(e,t)];return o=o.concat(convertToVolumes(e,t))},convertToVertices=(e,t)=>{const o=[];return geometries.geom3.toPolygons(e).forEach(e=>{for(let r=0;r<e.vertices.length;r++)o.push(convertToVertex(e.vertices[r],t))}),["vertices",{}].concat(o)},convertToVertex=(e,t)=>{return["vertex",{},convertToCoordinates(e,t)]},convertToCoordinates=(e,t)=>{return["coordinates",{},["x",{},e[0]],["y",{},e[1]],["z",{},e[2]]]},convertToVolumes=(e,t)=>{const o=convertColor(e.color),r=geometries.geom3.toPolygons(e),n=[];let s=["volume",{}];o&&s.push(o);let l=0;return r.forEach(e=>{if(e.vertices.length<3)return;const o=convertToTriangles(e,l,t);s=s.concat(o),l+=e.vertices.length}),n.push(s),n},convertColor=e=>e?(e.length<4&&e.push(1),["color",{},["r",{},e[0]],["g",{},e[1]],["b",{},e[2]],["a",{},e[3]]]):null,convertToColor=(e,t)=>{const o=e.color;return convertColor(o)},convertToTriangles=(e,t,o)=>{const r=convertToColor(e),n=[];for(let o=0;o<e.vertices.length-2;o++)r?n.push(["triangle",{},r,["v1",{},t],["v2",{},t+o+1],["v3",{},t+o+2]]):n.push(["triangle",{},["v1",{},t],["v2",{},t+o+1],["v3",{},t+o+2]]);return n};module.exports={serialize:serialize,mimeType:mimeType};
|
|
336
258
|
|
|
337
|
-
},{"@jscad/array-utils":
|
|
259
|
+
},{"@jscad/array-utils":483,"@jscad/modeling":185,"onml/lib/stringify":54}],54:[function(require,module,exports){
|
|
338
260
|
"use strict";function isObject(n){return n&&"[object Object]"===Object.prototype.toString.call(n)}function indenter(n){var t=" ".repeat(n);return function(n){var e,r=[];return"string"!=typeof n?n:1===(e=n.split("\n")).length?t+n:(e.forEach(function(n){""!==n.trim()?r.push(t+n):r.push(n)}),r.join("\n"))}}function clean(n){var t=n.split("\n"),e=[];return t.forEach(function(n){""!==n.trim()&&e.push(n)}),e.join("\n")}function stringify(n,t){var e="",r=function(n){return n};return t>0&&(e="\n",r=indenter(t)),function n(t){var i,o,c;return o="",c=!0,t.some(function(t,r,u){if(0===r)return i="<"+t,1===u.length||void 0;if(1===r){if(isObject(t))return Object.keys(t).forEach(function(n){i+=" "+n+'="'+t[n]+'"'}),2===u.length||void(i+=">");i+=">"}switch(typeof t){case"string":case"number":case"boolean":case"undefined":return void(o+=t+e)}c=!1,o+=n(t)})?i+"/>"+e:c?i+clean(o)+"</"+t[0]+">"+e:i+e+r(o)+"</"+t[0]+">"+e}(n)}module.exports=stringify;
|
|
339
261
|
|
|
340
|
-
},{}],
|
|
262
|
+
},{}],55:[function(require,module,exports){
|
|
341
263
|
!function(n){function r(n){const r=this;r.options=n||{},r.trackPosition=!1!==r.options.track,r.trackPosition&&(r.line=r.column=r.c=0)}n.reader=function(n){return new r(n)},n.STATES=["start","end","error"],r.prototype={on:function(n,r){this["on"+n]=r},absorb:function(n,r){void 0===this.absorbers&&(this.absorbers=new Map),this.absorbers.set(n,r)},write:function(n){return i(this,n),this},close:function(){return this.isclosed=!0,this}};const o=(n,r)=>(n.trackPosition&&(r+=`\nLine: ${n.line}\nColumn: ${n.column}\nChar: ${n.c}`),r=new Error(r),n.error=r,e(n,"onerror",r)),t=n=>e(n,"onend",n.data),e=(n,r,o)=>{const t=r.toString();return n[t]&&n[t](n,o),n},i=(n,r)=>{if(n.error)throw n.error;if(n.isclosed)return o(n,"Cannot write after close");if((n=>e(n,"onstart",n.data))(n),null===r)return t(n);n.group=null,n.value=null,n.error=null,n.position=0,n.line=0,n.column=0;let i=0,l="",u="";for(;null===n.error&&(l=a(r,i++));)n.trackPosition&&(n.position++,"\n"===l?(n.line++,n.column=0):n.column++),"\n"===l?(s(n,u),u=""):u+=l;return t(n),n},s=(n,r)=>{r=r.trim(),null===n.group?(l(n,r),n.value=null):u(n,r),null!==n.group&&null!==n.value&&(((n,r,o)=>{if(void 0!==n.absorbers){const t=n.absorbers.get(r);void 0!==t&&t(n,r,o)}})(n,n.group,n.value),n.group=null,n.value=null)},l=(n,r)=>{const t=parseInt(r);isNaN(t)?(o(n,"Invalid group (int)"),n.group=null):n.group=t},u=(n,r)=>{n.options.strict,n.value=r},a=(n,r)=>n&&n.length>r?n.charAt(r):""}("undefined"==typeof exports?this.dxf={}:exports);
|
|
342
264
|
|
|
343
|
-
},{}],
|
|
265
|
+
},{}],56:[function(require,module,exports){
|
|
344
266
|
const dxfTLA=[[0,"etyp"],[1,"text"],[2,"name"],[3,"nam1"],[5,"hdle"],[6,"ltyp"],[7,"lsty"],[8,"lnam"],[9,"vari"],[10,"pptx"],[11,"sptx"],[12,"tptx"],[13,"fptx"],[20,"ppty"],[21,"spty"],[22,"tpty"],[23,"fpty"],[30,"pptz"],[31,"sptz"],[32,"tptz"],[33,"fptz"],[38,"elev"],[39,"lthk"],[40,"swid"],[41,"ewid"],[42,"bulg"],[43,"cwid"],[48,"lscl"],[50,"ang0"],[51,"ang1"],[60,"visb"],[62,"cnmb"],[67,"spac"],[70,"lflg"],[71,"fvia"],[72,"fvib"],[73,"fvic"],[74,"fvid"],[75,"cflg"],[90,"vlen"],[91,"slen"],[92,"plen"],[93,"flen"],[94,"elen"],[95,"clen"],[100,"sbnm"],[210,"etrx"],[220,"etry"],[230,"etrz"]],dxfMap=new Map(dxfTLA),getTLA=e=>dxfMap.get(e),drawingUnits=[[0,"none"],[1,"inches"],[2,"feet"],[3,"miles"],[4,"millimeters"],[5,"centimeters"],[6,"meters"],[7,"kilometers"],[8,"microinches"],[9,"mils"],[10,"yards"],[11,"angstroms"],[12,"nanometers"],[13,"microns"],[14,"decimeters"],[15,"dekameters"],[16,"hectometers"],[17,"gigameters"],[18,"astrounits"],[19,"lightyears"],[20,"parsecs"]],BYBLOCK=0,BYLAYER=256;module.exports={drawingUnits:drawingUnits,BYBLOCK:0,BYLAYER:256,getTLA:getTLA};
|
|
345
267
|
|
|
346
|
-
},{}],
|
|
268
|
+
},{}],57:[function(require,module,exports){
|
|
347
269
|
const colorIndex=[[0,0,0,255],[255,0,0,255],[255,255,0,255],[0,255,0,255],[0,255,255,255],[0,0,255,255],[255,0,255,255],[255,255,255,255],[128,128,128,255],[192,192,192,255],[255,0,0,255],[255,127,127,255],[165,0,0,255],[165,82,82,255],[127,0,0,255],[127,63,63,255],[76,0,0,255],[76,38,38,255],[38,0,0,255],[38,19,19,255],[255,63,0,255],[255,159,127,255],[165,41,0,255],[165,103,82,255],[127,31,0,255],[127,79,63,255],[76,19,0,255],[76,47,38,255],[38,9,0,255],[38,28,19,255],[255,127,0,255],[255,191,127,255],[165,82,0,255],[165,124,82,255],[127,63,0,255],[127,95,63,255],[76,38,0,255],[76,57,38,255],[38,19,0,255],[38,28,19,255],[255,191,0,255],[255,223,127,255],[165,124,0,255],[165,145,82,255],[127,95,0,255],[127,111,63,255],[76,57,0,255],[76,66,38,255],[38,28,0,255],[38,33,19,255],[255,255,0,255],[255,255,127,255],[165,165,0,255],[165,165,82,255],[127,127,0,255],[127,127,63,255],[76,76,0,255],[76,76,38,255],[38,38,0,255],[38,38,19,255],[191,255,0,255],[223,255,127,255],[124,165,0,255],[145,165,82,255],[95,127,0,255],[111,127,63,255],[57,76,0,255],[66,76,38,255],[28,38,0,255],[33,38,19,255],[127,255,0,255],[191,255,127,255],[82,165,0,255],[124,165,82,255],[63,127,0,255],[95,127,63,255],[38,76,0,255],[57,76,38,255],[19,38,0,255],[28,38,19,255],[63,255,0,255],[159,255,127,255],[41,165,0,255],[103,165,82,255],[31,127,0,255],[79,127,63,255],[19,76,0,255],[47,76,38,255],[9,38,0,255],[23,38,19,255],[0,255,0,255],[125,255,127,255],[0,165,0,255],[82,165,82,255],[0,127,0,255],[63,127,63,255],[0,76,0,255],[38,76,38,255],[0,38,0,255],[19,38,19,255],[0,255,63,255],[127,255,159,255],[0,165,41,255],[82,165,103,255],[0,127,31,255],[63,127,79,255],[0,76,19,255],[38,76,47,255],[0,38,9,255],[19,88,23,255],[0,255,127,255],[127,255,191,255],[0,165,82,255],[82,165,124,255],[0,127,63,255],[63,127,95,255],[0,76,38,255],[38,76,57,255],[0,38,19,255],[19,88,28,255],[0,255,191,255],[127,255,223,255],[0,165,124,255],[82,165,145,255],[0,127,95,255],[63,127,111,255],[0,76,57,255],[38,76,66,255],[0,38,28,255],[19,88,88,255],[0,255,255,255],[127,255,255,255],[0,165,165,255],[82,165,165,255],[0,127,127,255],[63,127,127,255],[0,76,76,255],[38,76,76,255],[0,38,38,255],[19,88,88,255],[0,191,255,255],[127,223,255,255],[0,124,165,255],[82,145,165,255],[0,95,127,255],[63,111,217,255],[0,57,76,255],[38,66,126,255],[0,28,38,255],[19,88,88,255],[0,127,255,255],[127,191,255,255],[0,82,165,255],[82,124,165,255],[0,63,127,255],[63,95,127,255],[0,38,76,255],[38,57,126,255],[0,19,38,255],[19,28,88,255],[0,63,255,255],[127,159,255,255],[0,41,165,255],[82,103,165,255],[0,31,127,255],[63,79,127,255],[0,19,76,255],[38,47,126,255],[0,9,38,255],[19,23,88,255],[0,0,255,255],[127,127,255,255],[0,0,165,255],[82,82,165,255],[0,0,127,255],[63,63,127,255],[0,0,76,255],[38,38,126,255],[0,0,38,255],[19,19,88,255],[63,0,255,255],[159,127,255,255],[41,0,165,255],[103,82,165,255],[31,0,127,255],[79,63,127,255],[19,0,76,255],[47,38,126,255],[9,0,38,255],[23,19,88,255],[127,0,255,255],[191,127,255,255],[165,0,82,255],[124,82,165,255],[63,0,127,255],[95,63,127,255],[38,0,76,255],[57,38,126,255],[19,0,38,255],[28,19,88,255],[191,0,255,255],[223,127,255,255],[124,0,165,255],[142,82,165,255],[95,0,127,255],[111,63,127,255],[57,0,76,255],[66,38,76,255],[28,0,38,255],[88,19,88,255],[255,0,255,255],[255,127,255,255],[165,0,165,255],[165,82,165,255],[127,0,127,255],[127,63,127,255],[76,0,76,255],[76,38,76,255],[38,0,38,255],[88,19,88,255],[255,0,191,255],[255,127,223,255],[165,0,124,255],[165,82,145,255],[127,0,95,255],[127,63,111,255],[76,0,57,255],[76,38,66,255],[38,0,28,255],[88,19,88,255],[255,0,127,255],[255,127,191,255],[165,0,82,255],[165,82,124,255],[127,0,63,255],[127,63,95,255],[76,0,38,255],[76,38,57,255],[38,0,19,255],[88,19,28,255],[255,0,63,255],[255,127,159,255],[165,0,41,255],[165,82,103,255],[127,0,31,255],[127,63,79,255],[76,0,19,255],[76,38,47,255],[38,0,9,255],[88,19,23,255],[0,0,0,255],[101,101,101,255],[102,102,102,255],[153,153,153,255],[204,204,204,255],[255,255,255,255]];module.exports=colorIndex;
|
|
348
270
|
|
|
349
|
-
},{}],
|
|
271
|
+
},{}],58:[function(require,module,exports){
|
|
350
272
|
const{BYBLOCK:BYBLOCK,BYLAYER:BYLAYER}=require("./autocad"),findLayer=(r,o)=>{const e=r.lnam||"0";for(const r of o)if(r.name===e)return r;return null},getColorNumber=(r,o)=>{let e=r.cnmb||-1;if(e===BYLAYER){e=-1;const n=findLayer(r,o);null!==n&&(e=n.cnmb||-1)}return e},mod=(r,o)=>{const e=r%o;return Math.floor(e>=0?e:e+o)},getColor=(r,o)=>{if(r<1)return null;const e=o[r=mod(r,o.length)];return[e[0]/255,e[1]/255,e[2]/255,e[3]/255]};module.exports={findLayer:findLayer,getColor:getColor,getColorNumber:getColorNumber};
|
|
351
273
|
|
|
352
|
-
},{"./autocad":
|
|
274
|
+
},{"./autocad":56}],59:[function(require,module,exports){
|
|
353
275
|
const version=require("./package.json").version,{BYLAYER:BYLAYER,getTLA:getTLA}=require("./autocad"),colorIndex=require("./colorindex2017"),dxf=require("./DxfReader"),{instantiateAsciiDxf:instantiateAsciiDxf}=require("./instantiate"),translateAsciiDxf=require("./translate"),handleError=(e,t)=>{if(!0===e.options.strict)throw t;console.log(`error: line ${t.line}, column ${t.column}, bad character [${t.c}]`)},handleStart=(e,t)=>{},handleEnd=(e,t)=>{},handleEntity=(e,t,a)=>{let s=null;switch(a){case"LAYER":(s={type:"layer"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(67)]=0,e.objstack.push(s);break;case"LINE":(s={type:"line"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=0,e.objstack.push(s);break;case"LWPOLYLINE":(s={type:"lwpolyline"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(38)]=0,s[getTLA(39)]=0,s[getTLA(43)]=0,s[getTLA(70)]=0,s[getTLA(90)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=1,e.objstack.push(s);break;case"MESH":(s={type:"mesh"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(91)]=0,s[getTLA(92)]=0,s[getTLA(93)]=0,s[getTLA(94)]=0,s[getTLA(95)]=0,s.state=0,e.objstack.push(s);break;case"POLYLINE":(s={type:"polyline"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(10)]=0,s[getTLA(20)]=0,s[getTLA(30)]=0,s[getTLA(39)]=0,s[getTLA(40)]=0,s[getTLA(41)]=0,s[getTLA(70)]=0,s[getTLA(71)]=0,s[getTLA(72)]=0,s[getTLA(73)]=0,s[getTLA(74)]=0,s[getTLA(75)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=1,e.objstack.push(s);break;case"ARC":(s={type:"arc"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(39)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=1,e.objstack.push(s);break;case"CIRCLE":(s={type:"circle"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(39)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=1,e.objstack.push(s);break;case"ELLIPSE":(s={type:"ellipse"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(210)]=0,s[getTLA(220)]=0,s[getTLA(230)]=1,e.objstack.push(s);break;case"VERTEX":(s={type:"vertex"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(10)]=0,s[getTLA(20)]=0,s[getTLA(30)]=0,s[getTLA(40)]=0,s[getTLA(41)]=0,s[getTLA(42)]=0,s[getTLA(70)]=0,s[getTLA(71)]=0,s[getTLA(72)]=0,s[getTLA(73)]=0,s[getTLA(74)]=0,e.objstack.push(s);break;case"3DFACE":(s={type:"3dface"})[getTLA(48)]=1,s[getTLA(60)]=0,s[getTLA(62)]=BYLAYER,s[getTLA(67)]=0,s[getTLA(70)]=0,e.objstack.push(s);break;case"SEQEND":s={type:"seqend"},e.objstack.push(s);break;default:s={},e.objstack.push(s)}},handleVariable=(e,t,a)=>{const s={type:"variable",name:a};e.objstack.push(s)},handleInt=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&(s[getTLA(t)]=parseFloat(a)),e.objstack.push(s)},handleDouble=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&(s[getTLA(t)]=parseFloat(a)),e.objstack.push(s)},handleXcoord=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&("lwpolyline"===s.type?(void 0===s.pptxs&&(s.pptxs=[],s.bulgs=[]),s.pptxs.push(parseFloat(a)),s.bulgs.push(0)):"mesh"===s.type?(void 0===s.pptxs&&(s.pptxs=[]),s.pptxs.push(parseFloat(a))):s[getTLA(t)]=parseFloat(a)),e.objstack.push(s)},handleYcoord=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&("lwpolyline"===s.type||"mesh"===s.type?(void 0===s.pptys&&(s.pptys=[]),s.pptys.push(parseFloat(a))):s[getTLA(t)]=parseFloat(a)),e.objstack.push(s)},handleZcoord=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&("mesh"===s.type?(void 0===s.pptzs&&(s.pptzs=[]),s.pptzs.push(parseFloat(a))):s[getTLA(t)]=parseFloat(a)),e.objstack.push(s)},handleBulge=(e,t,a)=>{const s=e.objstack.pop();if("type"in s)if("lwpolyline"===s.type){const e=s.bulgs;if(void 0!==e){s.pptxs.length===e.length&&(e[e.length-1]=parseFloat(a))}}else s[getTLA(t)]=parseFloat(a);e.objstack.push(s)},handleLen=(e,t,a)=>{const s=e.objstack.pop();if("type"in s)if("mesh"===s.type){const e=s.state;switch(t){case 91:s[getTLA(t)]=parseFloat(a),s.state=1;break;case 92:1===e?(s.vlen=parseFloat(a),s.state=2):(s.plen=parseFloat(a),s.state=6);break;case 93:s[getTLA(t)]=parseFloat(a),s.state=3;break;case 94:s[getTLA(t)]=parseFloat(a),s.state=4;break;case 95:s[getTLA(t)]=parseFloat(a),s.state=5;break;default:s.state=7}}else s[getTLA(t)]=parseFloat(a);e.objstack.push(s)},handleValue=(e,t,a)=>{const s=e.objstack.pop();if("type"in s)if("mesh"===s.type){switch(s.state){case 3:void 0===s.fvals&&(s.fvals=[]),s.fvals.push(parseFloat(a));break;case 4:void 0===s.evals&&(s.evals=[]),s.evals.push(parseFloat(a))}}else s[getTLA(t)]=parseFloat(a);e.objstack.push(s)},handleString=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&(s[getTLA(t)]=a),e.objstack.push(s)},handleName=(e,t,a)=>{const s=e.objstack.pop();"type"in s&&void 0===s[getTLA(t)]&&(s[getTLA(t)]=a),e.objstack.push(s)},createReader=(e,t)=>{const a=dxf.reader(t);return a.on("error",handleError),a.on("start",handleStart),a.on("end",handleEnd),a.absorb(0,handleEntity),a.absorb(1,handleString),a.absorb(2,handleName),a.absorb(3,handleName),a.absorb(6,handleString),a.absorb(7,handleString),a.absorb(8,handleString),a.absorb(9,handleVariable),a.absorb(10,handleXcoord),a.absorb(11,handleDouble),a.absorb(12,handleDouble),a.absorb(13,handleDouble),a.absorb(20,handleYcoord),a.absorb(21,handleDouble),a.absorb(22,handleDouble),a.absorb(23,handleDouble),a.absorb(30,handleZcoord),a.absorb(31,handleDouble),a.absorb(32,handleDouble),a.absorb(33,handleDouble),a.absorb(39,handleDouble),a.absorb(40,handleDouble),a.absorb(41,handleDouble),a.absorb(42,handleBulge),a.absorb(50,handleDouble),a.absorb(51,handleDouble),a.absorb(62,handleInt),a.absorb(70,handleInt),a.absorb(71,handleInt),a.absorb(72,handleInt),a.absorb(73,handleInt),a.absorb(74,handleInt),a.absorb(75,handleInt),a.absorb(90,handleValue),a.absorb(91,handleLen),a.absorb(92,handleLen),a.absorb(93,handleLen),a.absorb(94,handleLen),a.absorb(95,handleLen),a.absorb(210,handleInt),a.absorb(220,handleInt),a.absorb(230,handleInt),a.objstack=[],a.objstack.push({type:"dxf"}),a.write(e).close(),a},instantiate=(e,t)=>{const a=createReader(e,t);return instantiateAsciiDxf(a,t)},translate=(e,t)=>{const a=createReader(e,t);let s=`// Produced by JSCAD IO Library : DXF Deserializer (${t.version})\n\n`;return s+=translateAsciiDxf(a,t)},deserialize=(e,t)=>{const a={filename:"dxf",version:version,output:"script",strict:!0,colorindex:colorIndex,dxf:{angdir:0,insunits:4,pfacevmax:4}};return"script"===(e=Object.assign({},a,e)).output?translate(t,e):instantiate(t,e)},extension="dxf";module.exports={deserialize:deserialize,extension:"dxf"};
|
|
354
276
|
|
|
355
|
-
},{"./DxfReader":
|
|
277
|
+
},{"./DxfReader":55,"./autocad":56,"./colorindex2017":57,"./instantiate":60,"./package.json":61,"./translate":62}],60:[function(require,module,exports){
|
|
356
278
|
const{geometries:geometries,maths:maths,primitives:primitives}=require("@jscad/modeling"),EPS=1e-5,{getColor:getColor,getColorNumber:getColorNumber}=require("./helpers"),instantiatePolygon=(e,t,s)=>{const n=[];if(n.push(maths.vec3.fromValues(e.pptx,e.ppty,e.pptz)),n.push(maths.vec3.fromValues(e.sptx,e.spty,e.sptz)),n.push(maths.vec3.fromValues(e.tptx,e.tpty,e.tptz)),e.fptx){let t=!1;e.tptx!==e.fptx&&(t=!0),e.tpty!==e.fpty&&(t=!0),e.tptz!==e.fptz&&(t=!0),t&&n.push(maths.vec3.fromValues(e.fptx,e.fpty,e.fptz))}const r=getColorNumber(e,t),a=getColor(r,s.colorindex),o=geometries.poly3.create(n);return a&&(o.color=a),o},instantiateLine=(e,t,s)=>{if(e.pptz===e.sptz&&0===e.pptz){const t=maths.vec2.fromValues(e.pptx,e.ppty),s=maths.vec2.fromValues(e.sptx,e.spty);return primitives.line([t,s])}const n=maths.vec3.fromValues(e.pptx,e.ppty,e.pptz),r=maths.vec3.fromValues(e.sptx,e.spty,e.sptz);return primitives.line([n,r])},instantiateVector=e=>{const t=parseInt("00000000000100000",2),s=parseInt("00000000001000000",2),n=parseInt("00000000010000000",2),r=e.lflg,a={};return(r&t)===t?a.vec=maths.vec3.fromValues(e.pptx,e.ppty,e.pptz):(r&s)===s?a.vec=maths.vec3.fromValues(e.pptx,e.ppty,e.pptz):(r&n)===n?(a.vec=maths.vec3.fromValues(e.pptx,e.ppty,e.pptz),a.fvia=e.fvia,a.fvib=e.fvib,a.fvic=e.fvic,a.fvid=e.fvid):(a.vec=maths.vec2.fromValues(e.pptx,e.ppty),a.bulg=e.bulg),a},addSection=(e,t,s,n)=>{if(0===n)e=geometries.path2.appendPoints([[t,s]],e);else{const r=geometries.path2.toPoints(e),a=r[r.length-1],o=maths.vec2.fromValues(t,s),i=maths.vec2.distance(a,o)*((1+Math.pow(n,2))/(4*n)),p=n<0,l=!1,c=4*Math.atan(n),m=16;e=geometries.path2.appendArc({endpoint:[t,s],radius:[i,i],xaxisrotation:c,clockwise:p,large:l,segments:m},e)}return e},instantiatePath2D=(e,t,s)=>{const n=parseInt("00000000000000001",2),r=e.vlen,a=e.pptxs,o=e.pptys,i=e.bulgs,p=e.lflg;let l=geometries.path2.create();const c=(p&n)===n;return r!==a.length||r!==o.length||r!==i.length?l:(a.forEach((e,t,s)=>{let n=0;t>0&&(n=i[t-1]),l=addSection(l,a[t],o[t],n)}),c&&!l.isClosed&&(l=addSection(l,a[0],o[0],i[r-1]),l=geometries.path2.close(l)),l)},instantiateArc=(e,t,s)=>{e.lthk;const n=e.pptx,r=e.ppty,a=e.swid;let o=e.ang0;o*=.017453292519943295;let i=e.ang1;i*=.017453292519943295;return primitives.arc({center:[n,r],radius:a,startAngle:o,endAngle:i,segments:16})},instantiateCircle=(e,t,s)=>{const n=e.lthk,r=e.pptx,a=e.ppty,o=e.swid,i=getColorNumber(e,t),p=getColor(i,s.colorindex);if(0===n){const e=primitives.circle({center:[r,a],radius:o,segments:16});return p&&(e.color=p),e}const l=primitives.circle({center:[r,a],radius:o,segments:16}).extrude({offset:[0,0,n]});return p&&(l.color=p),l},instantiateEllipse=(e,t,s)=>{const n=e.pptx,r=e.ppty,a=e.pptz,o=e.sptx,i=e.spty,p=e.sptz,l=e.swid;if(0===a&&0===p){const e=maths.vec2.fromValues(0,0),t=maths.vec2.fromValues(o,i),s=maths.vec2.distance(e,t),a=s*l;let p=180*Math.atan2(i,o)/Math.PI;p<EPS&&(p=0),p*=.017453292519943295;const c=primitives.ellipse({center:[0,0],radius:[s,a],segments:16}),m=maths.mat4.fromZRotation(maths.mat4.create(),p);return maths.mat4.multiply(m,m,maths.mat4.fromTranslation(maths.mat4.create(),[n,r,0])),geometries.geom2.transform(m,c)}},instantiateFaces=e=>{const t=[];let s=0;for(;s<e.length;){let n=e[s++];const r=[];for(;n>0;)r.push(e[s++]),n--;t.push(r)}return t},instantiatePoints=(e,t,s)=>{const n=[];let r=0;for(;r<e.length;){const a=e[r],o=t[r],i=s[r];n.push([a,o,i]),r++}return n},instantiateMesh=(e,t,s)=>{const n=e.vlen,r=e.pptxs,a=e.pptys,o=e.pptzs,i=e.flen,p=e.fvals,l=getColorNumber(e,t),c=getColor(l,s.colorindex),m=[];if(n===r.length&&n===a.length&&n===o.length&&i===p.length){const e=instantiateFaces(p),t=instantiatePoints(r,a,o);let n=0;for(;n<e.length;){const r=e[n];let a=[],o=0;for(;o<r.length;){const e=r[o],s=maths.vec3.clone(t[e]);a.push(s),o++}1===s.dxf.angdir&&(a=a.reverse());const i=geometries.poly3.create(a);c&&(i.color=c),m.push(i),n++}}return geometries.geom3.create(m)},getPolyType=e=>{const t=parseInt("00000000000000001",2),s=parseInt("00000000000001000",2),n=parseInt("00000000000010000",2),r=parseInt("00000000000100000",2),a=parseInt("00000000001000000",2),o=e.lflg;let i=null;return(o&s)===s?i=null:(o&n)===n?((i=geometries.geom3.create()).closedM=(o&t)===t,i.closedN=(o&r)===r):(o&a)===a?((i=geometries.geom3.create()).closedM=(o&t)===t,i.closedN=(o&r)===r):(i=geometries.path2.create()).closedM=(o&t)===t,"cnmb"in e&&(i.cnmb=e.cnmb),i},completeCurrent=(e,t,s,n,r)=>{if(geometries.path2.isA(t)){const s=n.map(e=>e.vec);e.push(geometries.path2.fromPoints({closed:t.closed},s))}return geometries.geom3.isA(t)&&e.push(geometries.geom3.create(s)),null},instantiateAsciiDxf=(e,t)=>{const s=[];let n=null;const r=[],a=[],o=[];let i=null;for(const p of e.objstack)if(i=null,"type"in p){switch(p.type){case"dxf":break;case"layer":n=completeCurrent(a,n,r,o),s.push(p);break;case"variable":n=completeCurrent(a,n,r,o);break;case"3dface":i=instantiatePolygon(p,s,t),null===n&&(n=geometries.geom3.create());break;case"mesh":n=completeCurrent(a,n,r,o),a.push(instantiateMesh(p,s,t));break;case"arc":n=completeCurrent(a,n,r,o),a.push(instantiateArc(p));break;case"circle":n=completeCurrent(a,n,r,o),a.push(instantiateCircle(p,s,t));break;case"ellipse":n=completeCurrent(a,n,r,o),a.push(instantiateEllipse(p));break;case"line":n=completeCurrent(a,n,r,o),a.push(instantiateLine(p));break;case"polyline":null===(n=completeCurrent(a,n,r,o))&&(n=getPolyType(p));break;case"vertex":i=instantiateVector(p);break;case"seqend":n=completeCurrent(a,n,r,o);break;case"lwpolyline":n=completeCurrent(a,n,r,o),a.push(instantiatePath2D(p))}geometries.poly3.isA(i)&&r.push(i),i&&"vec"in i&&3===i.vec.length&&o.push(i),i&&"vec"in i&&2===i.vec.length&&o.push(i)}return n=completeCurrent(a,n,r,o),a};module.exports={instantiatePolygon:instantiatePolygon,instantiateVector:instantiateVector,instantiateAsciiDxf:instantiateAsciiDxf};
|
|
357
279
|
|
|
358
|
-
},{"./helpers":
|
|
280
|
+
},{"./helpers":58,"@jscad/modeling":185}],61:[function(require,module,exports){
|
|
359
281
|
module.exports={
|
|
360
282
|
"name": "@jscad/dxf-deserializer",
|
|
361
|
-
"version": "2.3.
|
|
283
|
+
"version": "2.3.5",
|
|
362
284
|
"description": "DXF Deserializer for JSCAD",
|
|
363
285
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
364
286
|
"main": "index.js",
|
|
@@ -385,7 +307,7 @@ module.exports={
|
|
|
385
307
|
],
|
|
386
308
|
"license": "MIT",
|
|
387
309
|
"dependencies": {
|
|
388
|
-
"@jscad/modeling": "2.
|
|
310
|
+
"@jscad/modeling": "2.5.3"
|
|
389
311
|
},
|
|
390
312
|
"devDependencies": {
|
|
391
313
|
"ava": "3.15.0",
|
|
@@ -393,54 +315,54 @@ module.exports={
|
|
|
393
315
|
}
|
|
394
316
|
}
|
|
395
317
|
|
|
396
|
-
},{}],
|
|
318
|
+
},{}],62:[function(require,module,exports){
|
|
397
319
|
const{maths:maths,geometries:geometries}=require("@jscad/modeling"),{instantiatePolygon:instantiatePolygon,instantiateVector:instantiateVector}=require("./instantiate"),{findLayer:findLayer,getColor:getColor,getColorNumber:getColorNumber}=require("./helpers"),translateVector2D=e=>{return`${e[0]},${e[1]}`},translateVector3D=e=>{return`${e[0]},${e[1]},${e[2]}`},translatePolygon=e=>{const t=geometries.poly3.toPoints(e);let n="createPolygon([";return t.forEach(e=>{n+=`[${translateVector3D(e)}],`}),n+=`],${translateColor(e)})`},translateColor=e=>{let t="null";if("color"in e){const n=e.color;t=`[${n[0]},${n[1]},${n[2]},${n[3]}]`}return t},translateLine=(e,t,n)=>{const r=e.name,s=getColorNumber(e,t),a=getColor(s,n.colorindex);let l="";if(!e.pptz||e.pptz===e.sptz&&0===e.pptz){const t=maths.vec2.fromValues(e.pptx,e.ppty),n=maths.vec2.fromValues(e.sptx,e.spty);l=` let ${r} = primitives.line([[${translateVector2D(t)}],[${translateVector2D(n)}]])\n`}else{const t=maths.vec3.fromValues(e.pptx,e.ppty,e.pptz),n=maths.vec3.fromValues(e.sptx,e.spty,e.sptz);l=` let ${r} = primitives.line([[${translateVector3D(t)}],[${translateVector3D(n)}]])\n`}a&&(l+=` ${r} = colors.colorize([${a[0]}, ${a[1]}, ${a[2]}, 1], ${r})\n`),e.script=l,addToLayer(e,t)},translateSection=(e,t,n,r,s,a)=>{if(0===r)return`geometries.path2.appendPoints([[${t},${n}]], ${e})\n`;const l=maths.vec2.fromValues(s,a),o=maths.vec2.fromValues(t,n),i=maths.vec2.distance(l,o)*((1+Math.pow(r,2))/(4*r)),c=r<0;return`geometries.path2.appendArc({endpoint: [${t},${n}],radius: [${i},${i}],xaxisrotation: ${4*Math.atan(r)},clockwise: ${c},large: false,segments: 16}, ${e})\n`},translatePath2D=(e,t,n)=>{const r=parseInt("00000000000000001",2),s=e.vlen,a=e.pptxs,l=e.pptys,o=e.bulgs,i=e.lflg,c=e.name,p=getColorNumber(e,t),m=getColor(p,n.colorindex);let $=` let ${c} = geometries.path2.create()\n`;const u=(i&r)===r;if(s===a.length&&s===l.length&&s===o.length){$+=` ${c} = geometries.path2.appendPoints([[${a[0]}, ${l[0]}]], ${c})\n`;for(let e=0;e<a.length;e++){const t=(e+1)%a.length,n=a[t],r=l[t],s=a[e],i=l[e],p=o[e];0!==t?$+=` ${c} = ${translateSection(c,n,r,p,s,i)}`:0!==p&&($+=` ${c} = ${translateSection(c,n,r,p,s,i)}`)}$+=u?` ${c} = geometries.path2.close(${c})\n`:"\n",m&&($+=` ${c} = colors.colorize([${m[0]}, ${m[1]}, ${m[2]}, 1], ${c})\n`),e.script=$,addToLayer(e,t)}},translateArc=(e,t,n)=>{const r=e.lthk,s=e.pptx,a=e.ppty,l=e.swid;let o=e.ang0,i=e.ang1;const c=e.name,p=getColorNumber(e,t),m=getColor(p,n.colorindex);o*=.017453292519943295,i*=.017453292519943295;if(0===r){let n=` let ${c} = primitives.arc({center: [${s}, ${a}], radius: ${l}, startAngle: ${o}, endAngle: ${i}, segements: 16})\n`;return m&&(n+=` ${c} = colors.colorize([${m[0]}, ${m[1]}, ${m[2]}, 1], ${c})\n`),e.script=n,void addToLayer(e,t)}let $=` let ${c} = primitives.arc({center: [${s}, ${a}], radius: ${l}, startAngle: ${o}, endAngle: ${i}, segements: 16})\n`;m&&($+=` ${c} = colors.colorize([${m[0]}, ${m[1]}, ${m[2]}, 1], ${c})\n`),e.script=$,addToLayer(e,t)},translateCircle=(e,t,n)=>{const r=e.lthk,s=e.pptx,a=e.ppty,l=e.swid,o=e.name,i=getColorNumber(e,t),c=getColor(i,n.colorindex);if(0===r){let n=` let ${o} = primitives.circle({center: [${s}, ${a}], radius: ${l}, segments: 16})\n`;return c&&(n+=` ${o} = colors.colorize([${c[0]}, ${c[1]}, ${c[2]}, 1], ${o})\n`),e.script=n,void addToLayer(e,t)}let p=` let ${o} = primitives.circle({center: [${s}, ${a}], radius: ${l}, segments: 16}).extrude({offset: [0,0,${r}]}))\n`;c&&(p+=` ${o} = colors.colorize([${c[0]}, ${c[1]}, ${c[2]}, 1], ${o})\n`),e.script=p,addToLayer(e,t)},translateEllipse=(e,t,n)=>{const r=e.pptx,s=e.ppty,a=e.pptz,l=e.sptx,o=e.spty,i=e.sptz,c=e.swid,p=e.name,m=getColorNumber(e,t),$=getColor(m,n.colorindex);if(0===a&&0===i){const n=maths.vec2.fromValues(0,0),a=maths.vec2.fromValues(l,o),i=maths.vec2.distance(n,a);let m=` let ${p} = primitives.ellipse({center: [0, 0, 0], radius: [${i}, ${i*c}], segments: 16})\n let ${p}matrix = maths.mat4.multiply(maths.mat4.create(), maths.mat4.fromTranslation(maths.mat4.create(), [${r}, ${s}, 0]), maths.mat4.fromZRotation(maths.mat4.create(), ${Math.atan2(o,l)}))\n ${p} = geometries.geom2.transform(${p}matrix, ${p})\n`;$&&(m+=` ${p} = colors.colorize([${$[0]}, ${$[1]}, ${$[2]}, 1], ${p})\n`),e.script=m,addToLayer(e,t)}},instantiateFaces=e=>{const t=[];let n=0;for(;n<e.length;){let r=e[n++];const s=[];for(;r>0;)s.push(e[n++]),r--;t.push(s)}return t},instantiatePoints=(e,t,n)=>{const r=[];let s=0;for(;s<e.length;){const a=e[s],l=t[s],o=n[s];r.push([a,l,o]),s++}return r},translateMesh=(e,t,n)=>{const r=e.vlen,s=e.pptxs,a=e.pptys,l=e.pptzs,o=e.flen,i=e.fvals,c=getColorNumber(e,t),p=getColor(c,n.colorindex),m=[];if(r===s.length&&r===a.length&&r===l.length)if(o===i.length){const e=instantiateFaces(i),t=instantiatePoints(s,a,l);let r=0;for(;r<e.length;){const s=e[r];let a=[],l=0;for(;l<s.length;){const e=s[l],n=maths.vec3.clone(t[e]);a.push(n),l++}1===n.dxf.angdir&&(a=a.reverse());const o=geometries.poly3.create(a);p&&(o.color=p),m.push(o),r++}}else console.warn("invalid mesh: faces");else console.warn("invalid mesh: vertices");const $=e.name;let u=` const ${$}_polygons = [\n`;for(const e of m)u+=" "+translatePolygon(e)+",\n";return u+=` ]\n let ${$} = geometries.geom3.create(${$}_polygons)\n`,e.script=u,addToLayer(e,t),null},findLayer0=e=>{for(const t of e)if("0"===t.name)return t;const t={type:"layer",lnam:"layer0",name:"0",lscl:1,visb:0,spac:0,objects:[]};return e.push(t),t},addToLayer=(e,t)=>{let n=findLayer(e,t);null===n&&(n=findLayer0(t)),"objects"in n||(n.objects=[]),n.objects.push(e)},getPolyType=e=>{const t=parseInt("00000000000000001",2),n=parseInt("00000000000001000",2),r=parseInt("00000000000010000",2),s=parseInt("00000000000100000",2),a=parseInt("00000000001000000",2),l=e.lflg;let o=null;if((l&n)===n){o={type:"3dline",isclosed:(l&t)===t}}else if((l&r)===r)(o={type:"3dpolymesh"}).fvia=e.fvia,o.fvib=e.fvib,o.closedM=(l&t)===t,o.closedN=(l&s)===s;else if((l&a)===a)(o={type:"3dpolyfaces"}).fvia=e.fvia,o.fvib=e.fvib;else{o={type:"2dline",isclosed:(l&t)===t}}return"cnmb"in e&&(o.cnmb=e.cnmb),"lnam"in e&&(o.lnam=e.lnam),o},instantiateFacets=(e,t,n,r,s)=>{const a=(e,r)=>{return n[(e-1)*t+(r-1)].vec},l=[];if(e*t!==n.length)return l;if(e<2|t<2)return l;let o=1;for(;o<e;){let e=1;for(;e<t;){let t=[a(o,e),a(o+1,e),a(o+1,e+1),a(o,e+1)];1===s.dxf.angdir&&(t=t.reverse());const n=geometries.poly3.create(t),i=geometries.poly3.plane(n);Number.isFinite(i[3])&&(r&&(n.color=r),l.push(n)),e++}o++}return l},instantiatePolyFaces=(e,t,n,r,s)=>{const a=[];if(e+t!==n.length)return a;let l=e;for(;l<n.length;){let e=n[l];const t=[Math.abs(e.fvia),Math.abs(e.fvib),Math.abs(e.fvic),Math.abs(e.fvid)];let r=[];if(t[0]>0&&(e=n[t[0]-1],r.push(e.vec),t[1]>0&&(e=n[t[1]-1],r.push(e.vec),t[2]>0&&(e=n[t[2]-1],r.push(e.vec),t[3]>0&&(e=n[t[3]-1],r.push(e.vec))))),r.length>2){1===s.dxf.angdir&&(r=r.reverse());const e=geometries.poly3.create(r);a.push(e)}l++}return a},translateAs2Dline=(e,t,n,r)=>{e.vlen=n.length,e.pptxs=[],e.pptys=[],e.bulgs=[];for(const t of n)e.pptxs.push(t.vec[0]),e.pptys.push(t.vec[1]),e.bulgs.push(t.bulg);return e.isclosed?e.lflg=parseInt("00000000000000001",2):e.lflg=0,translatePath2D(e,t,r),null},translateCurrent=(e,t,n,r)=>{if(null===e)return null;const s=e.type,a=getColorNumber(e,t),l=getColor(a,r.colorindex);if("2dline"===s)return translateAs2Dline(e,t,n,r);if("3dline"===s)return null;if("3dpolymesh"===s){const t=e.fvia,s=e.fvib;n=instantiateFacets(t,s,n,l,r)}if("3dpolyfaces"===s&&"fvia"in e){const t=e.fvia,s=e.fvib;n=instantiatePolyFaces(t,s,n,0,r)}const o=e.name;let i=` const ${o}_polygons = [\n`;for(const e of n)i+=" "+translatePolygon(e)+",\n";return i+=` ]\n let ${o} = geometries.geom3.create(${o}_polygons)\n`,l&&(i+=` ${o}.color = [${l}]\n`),e.script=i,addToLayer(e,t),null},translateLayer=e=>{let t=`function ${e.lnam||"Unknown"}() {\n`;for(const n of e.objects)t+=n.script;t+=" return [";for(const n of e.objects)t+=n.name+",";return t+="]\n}\n"},saveVariable=(e,t)=>{switch(e.name||"Unknown"){case"$ANGDIR":"lflg"in e&&(t.dxf.angdir=e.lflg)}},translateAsciiDxf=(e,t)=>{const n=[];let r=null,s=[],a=0,l=null;for(const o of e.objstack)if(l=null,"type"in o){if("name"in o){let e=o.name;e=(e=(e=e.replace(/ /g,"_")).replace(/-/g,"_")).replace(/\./g,"_"),o.name=e}else o.name="jscad"+a,a+=1;switch(o.type){case"dxf":break;case"layer":r=translateCurrent(r,n,s,t),s=[],o.objects=[],o.lnam="layer"+n.length,n.push(o);break;case"variable":r=translateCurrent(r,n,s,t),s=[],saveVariable(o,t);break;case"3dface":l=instantiatePolygon(o,n,t),null===r&&((r={type:"3dfaces"}).name="jscad"+a,a+=1);break;case"mesh":r=translateCurrent(r,n,s,t),s=[],translateMesh(o,n,t);break;case"arc":r=translateCurrent(r,n,s,t),s=[],translateArc(o,n,t);break;case"circle":r=translateCurrent(r,n,s,t),s=[],translateCircle(o,n,t);break;case"ellipse":r=translateCurrent(r,n,s,t),s=[],translateEllipse(o,n,t);break;case"line":r=translateCurrent(r,n,s,t),s=[],translateLine(o,n,t);break;case"polyline":r=translateCurrent(r,n,s,t),s=[],null===r&&((r=getPolyType(o)).name="jscad"+a,a+=1);break;case"vertex":l=instantiateVector(o);break;case"seqend":r=translateCurrent(r,n,s,t),s=[];break;case"lwpolyline":r=translateCurrent(r,n,s,t),s=[],translatePath2D(o,n,t)}geometries.poly3.isA(l)&&s.push(l),l&&"vec"in l&&3===l.vec.length&&s.push(l),l&&"vec"in l&&2===l.vec.length&&s.push(l)}r=translateCurrent(r,n,s,t);let o="const {colors, geometries, maths, primitives, transforms} = require('@jscad/modeling')\n\nconst main = () => {\n let layers = []\n return layers.concat(";return n.forEach(e=>{const t=e.lnam||"Unknown";o+=`${t}(),`}),o+="[])\n}\n",o+="\nfunction createPolygon(listofpoints, color) {\n let polygon = geometries.poly3.fromPoints(listofpoints)\n if (color) polygon.color = color\n return polygon\n}\n",n.forEach(e=>{o+=translateLayer(e)}),o+="module.exports = {main}\n"};module.exports=translateAsciiDxf;
|
|
398
320
|
|
|
399
|
-
},{"./helpers":
|
|
321
|
+
},{"./helpers":58,"./instantiate":60,"@jscad/modeling":185}],63:[function(require,module,exports){
|
|
400
322
|
const dxfHeaders=function(){return" 0\nSECTION\n 2\nHEADER\n 9\n$ACADVER\n 1\nAC1027\n 9\n$ACADMAINTVER\n 70\n8\n 9\n$DWGCODEPAGE\n 3\nANSI_1252\n 9\n$LASTSAVEDBY\n 1\nunknown\n 9\n$REQUIREDVERSIONS\n160\n0\n 9\n$INSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$EXTMIN\n 10\n1e+20\n 20\n1e+20\n 30\n1e+20\n 9\n$EXTMAX\n 10\n-1e+20\n 20\n-1e+20\n 30\n-1e+20\n 9\n$LIMMIN\n 10\n0.0\n 20\n0.0\n 9\n$LIMMAX\n 10\n12.0\n 20\n9.0\n 9\n$ORTHOMODE\n 70\n0\n 9\n$REGENMODE\n 70\n1\n 9\n$FILLMODE\n 70\n1\n 9\n$QTEXTMODE\n 70\n0\n 9\n$MIRRTEXT\n 70\n0\n 9\n$LTSCALE\n 40\n1.0\n 9\n$ATTMODE\n 70\n1\n 9\n$TEXTSIZE\n 40\n0.2\n 9\n$TRACEWID\n 40\n0.05\n 9\n$TEXTSTYLE\n 7\nNotes\n 9\n$CLAYER\n 8\n0\n 9\n$CELTYPE\n 6\nByLayer\n 9\n$CECOLOR\n 62\n256\n 9\n$CELTSCALE\n 40\n1.0\n 9\n$DISPSILH\n 70\n0\n 9\n$DIMSCALE\n 40\n1.0\n 9\n$DIMASZ\n 40\n3.0\n 9\n$DIMEXO\n 40\n1.5\n 9\n$DIMDLI\n 40\n6.0\n 9\n$DIMRND\n 40\n0.0\n 9\n$DIMDLE\n 40\n0.0\n 9\n$DIMEXE\n 40\n3.0\n 9\n$DIMTP\n 40\n0.0\n 9\n$DIMTM\n 40\n0.0\n 9\n$DIMTXT\n 40\n3.0\n 9\n$DIMCEN\n 40\n3.0\n 9\n$DIMTSZ\n 40\n0.0\n 9\n$DIMTOL\n 70\n0\n 9\n$DIMLIM\n 70\n0\n 9\n$DIMTIH\n 70\n0\n 9\n$DIMTOH\n 70\n0\n 9\n$DIMSE1\n 70\n0\n 9\n$DIMSE2\n 70\n0\n 9\n$DIMTAD\n 70\n1\n 9\n$DIMZIN\n 70\n3\n 9\n$DIMBLK\n 1\n\n 9\n$DIMASO\n 70\n1\n 9\n$DIMSHO\n 70\n1\n 9\n$DIMPOST\n 1\n\n 9\n$DIMAPOST\n 1\n\n 9\n$DIMALT\n 70\n0\n 9\n$DIMALTD\n 70\n2\n 9\n$DIMALTF\n 40\n25.4\n 9\n$DIMLFAC\n 40\n1.0\n 9\n$DIMTOFL\n 70\n0\n 9\n$DIMTVP\n 40\n0.0\n 9\n$DIMTIX\n 70\n0\n 9\n$DIMSOXD\n 70\n0\n 9\n$DIMSAH\n 70\n0\n 9\n$DIMBLK1\n 1\n\n 9\n$DIMBLK2\n 1\n\n 9\n$DIMSTYLE\n 2\nCivil-Metric\n 9\n$DIMCLRD\n 70\n0\n 9\n$DIMCLRE\n 70\n0\n 9\n$DIMCLRT\n 70\n0\n 9\n$DIMTFAC\n 40\n1.0\n 9\n$DIMGAP\n 40\n2.0\n 9\n$DIMJUST\n 70\n0\n 9\n$DIMSD1\n 70\n0\n 9\n$DIMSD2\n 70\n0\n 9\n$DIMTOLJ\n 70\n1\n 9\n$DIMTZIN\n 70\n0\n 9\n$DIMALTZ\n 70\n0\n 9\n$DIMALTTZ\n 70\n0\n 9\n$DIMUPT\n 70\n0\n 9\n$DIMDEC\n 70\n2\n 9\n$DIMTDEC\n 70\n2\n 9\n$DIMALTU\n 70\n2\n 9\n$DIMALTTD\n 70\n2\n 9\n$DIMTXSTY\n 7\nStandard\n 9\n$DIMAUNIT\n 70\n0\n 9\n$DIMADEC\n 70\n2\n 9\n$DIMALTRND\n 40\n0.0\n 9\n$DIMAZIN\n 70\n2\n 9\n$DIMDSEP\n 70\n46\n 9\n$DIMATFIT\n 70\n3\n 9\n$DIMFRAC\n 70\n1\n 9\n$DIMLDRBLK\n 1\n\n 9\n$DIMLUNIT\n 70\n2\n 9\n$DIMLWD\n 70\n-2\n 9\n$DIMLWE\n 70\n-2\n 9\n$DIMTMOVE\n 70\n0\n 9\n$DIMFXL\n 40\n1.0\n 9\n$DIMFXLON\n 70\n0\n 9\n$DIMJOGANG\n 40\n0.785398163397\n 9\n$DIMTFILL\n 70\n0\n 9\n$DIMTFILLCLR\n 70\n0\n 9\n$DIMARCSYM\n 70\n0\n 9\n$DIMLTYPE\n 6\n\n 9\n$DIMLTEX1\n 6\n\n 9\n$DIMLTEX2\n 6\n\n 9\n$DIMTXTDIRECTION\n 70\n0\n 9\n$LUNITS\n 70\n2\n 9\n$LUPREC\n 70\n4\n 9\n$SKETCHINC\n 40\n0.1\n 9\n$FILLETRAD\n 40\n0.0\n 9\n$AUNITS\n 70\n4\n 9\n$AUPREC\n 70\n5\n 9\n$MENU\n 1\n.\n 9\n$ELEVATION\n 40\n0.0\n 9\n$PELEVATION\n 40\n0.0\n 9\n$THICKNESS\n 40\n0.0\n 9\n$LIMCHECK\n 70\n0\n 9\n$CHAMFERA\n 40\n0.0\n 9\n$CHAMFERB\n 40\n0.0\n 9\n$CHAMFERC\n 40\n0.0\n 9\n$CHAMFERD\n 40\n0.0\n 9\n$SKPOLY\n 70\n0\n 9\n$TDCREATE\n 40\n2457986.69756\n 9\n$TDUCREATE\n 40\n2455631.2632\n 9\n$TDUPDATE\n 40\n2457986.69756\n 9\n$TDUUPDATE\n 40\n2456436.43179\n 9\n$TDINDWG\n 40\n0.0003490741\n 9\n$TDUSRTIMER\n 40\n0.0003487153\n 9\n$USRTIMER\n 70\n1\n 9\n$ANGBASE\n 50\n0.0\n 9\n$ANGDIR\n 70\n0\n 9\n$PDMODE\n 70\n0\n 9\n$PDSIZE\n 40\n0.0\n 9\n$PLINEWID\n 40\n0.0\n 9\n$SPLFRAME\n 70\n0\n 9\n$SPLINETYPE\n 70\n6\n 9\n$SPLINESEGS\n 70\n8\n 9\n$HANDSEED\n 5\n5C7\n 9\n$SURFTAB1\n 70\n6\n 9\n$SURFTAB2\n 70\n6\n 9\n$SURFTYPE\n 70\n6\n 9\n$SURFU\n 70\n6\n 9\n$SURFV\n 70\n6\n 9\n$UCSBASE\n 2\n\n 9\n$UCSNAME\n 2\n\n 9\n$UCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n 9\n$UCSORTHOREF\n 2\n\n 9\n$UCSORTHOVIEW\n 70\n0\n 9\n$UCSORGTOP\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSORGBOTTOM\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSORGLEFT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSORGRIGHT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSORGFRONT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$UCSORGBACK\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSBASE\n 2\n\n 9\n$PUCSNAME\n 2\n\n 9\n$PUCSORG\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSXDIR\n 10\n1.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSYDIR\n 10\n0.0\n 20\n1.0\n 30\n0.0\n 9\n$PUCSORTHOREF\n 2\n\n 9\n$PUCSORTHOVIEW\n 70\n0\n 9\n$PUCSORGTOP\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSORGBOTTOM\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSORGLEFT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSORGRIGHT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSORGFRONT\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PUCSORGBACK\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$USERI1\n 70\n0\n 9\n$USERI2\n 70\n0\n 9\n$USERI3\n 70\n0\n 9\n$USERI4\n 70\n0\n 9\n$USERI5\n 70\n0\n 9\n$USERR1\n 40\n0.0\n 9\n$USERR2\n 40\n0.0\n 9\n$USERR3\n 40\n0.0\n 9\n$USERR4\n 40\n0.0\n 9\n$USERR5\n 40\n0.0\n 9\n$WORLDVIEW\n 70\n1\n 9\n$SHADEDGE\n 70\n3\n 9\n$SHADEDIF\n 70\n70\n 9\n$TILEMODE\n 70\n1\n 9\n$MAXACTVP\n 70\n64\n 9\n$PINSBASE\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 9\n$PLIMCHECK\n 70\n0\n 9\n$PEXTMIN\n 10\n0.628866766397\n 20\n0.799999952316\n 30\n0.0\n 9\n$PEXTMAX\n 10\n9.02886638493\n 20\n7.19999957085\n 30\n0.0\n 9\n$PLIMMIN\n 10\n-0.700541819174\n 20\n-0.228100386192\n 9\n$PLIMMAX\n 10\n10.2994579405\n 20\n8.27189937351\n 9\n$UNITMODE\n 70\n0\n 9\n$VISRETAIN\n 70\n1\n 9\n$PLINEGEN\n 70\n0\n 9\n$PSLTSCALE\n 70\n1\n 9\n$TREEDEPTH\n 70\n3020\n 9\n$CMLSTYLE\n 2\nStandard\n 9\n$CMLJUST\n 70\n0\n 9\n$CMLSCALE\n 40\n1.0\n 9\n$PROXYGRAPHICS\n 70\n1\n 9\n$MEASUREMENT\n 70\n1\n 9\n$CELWEIGHT\n370\n-1\n 9\n$ENDCAPS\n280\n0\n 9\n$JOINSTYLE\n280\n0\n 9\n$LWDISPLAY\n290\n0\n 9\n$INSUNITS\n 70\n4\n 9\n$HYPERLINKBASE\n 1\n\n 9\n$STYLESHEET\n 1\n\n 9\n$XEDIT\n290\n1\n 9\n$CEPSNTYPE\n380\n0\n 9\n$PSTYLEMODE\n290\n1\n 9\n$FINGERPRINTGUID\n 2\n{39DB1BDD-BC6C-46D3-A333-DFCC0DC4782D}\n 9\n$VERSIONGUID\n 2\n{69EEBB2D-7039-498F-9366-3F994E4A07E7}\n 9\n$EXTNAMES\n290\n1\n 9\n$PSVPSCALE\n 40\n0.0\n 9\n$OLESTARTUP\n290\n0\n 9\n$SORTENTS\n280\n127\n 9\n$INDEXCTL\n280\n0\n 9\n$HIDETEXT\n280\n1\n 9\n$XCLIPFRAME\n280\n0\n 9\n$HALOGAP\n280\n0\n 9\n$OBSCOLOR\n 70\n257\n 9\n$OBSLTYPE\n280\n0\n 9\n$INTERSECTIONDISPLAY\n280\n0\n 9\n$INTERSECTIONCOLOR\n 70\n257\n 9\n$DIMASSOC\n280\n2\n 9\n$PROJECTNAME\n 1\n\n 9\n$CAMERADISPLAY\n290\n0\n 9\n$LENSLENGTH\n 40\n50.0\n 9\n$CAMERAHEIGHT\n 40\n0.0\n 9\n$STEPSPERSEC\n 40\n2.0\n 9\n$STEPSIZE\n 40\n6.0\n 9\n$3DDWFPREC\n 40\n2.0\n 9\n$PSOLWIDTH\n 40\n0.25\n 9\n$PSOLHEIGHT\n 40\n4.0\n 9\n$LOFTANG1\n 40\n1.57079632679\n 9\n$LOFTANG2\n 40\n1.57079632679\n 9\n$LOFTMAG1\n 40\n0.0\n 9\n$LOFTMAG2\n 40\n0.0\n 9\n$LOFTPARAM\n 70\n7\n 9\n$LOFTNORMALS\n280\n1\n 9\n$LATITUDE\n 40\n37.795\n 9\n$LONGITUDE\n 40\n-122.394\n 9\n$NORTHDIRECTION\n 40\n0.0\n 9\n$TIMEZONE\n 70\n-8000\n 9\n$LIGHTGLYPHDISPLAY\n280\n1\n 9\n$TILEMODELIGHTSYNCH\n280\n1\n 9\n$CMATERIAL\n347\n96\n 9\n$SOLIDHIST\n280\n1\n 9\n$SHOWHIST\n280\n1\n 9\n$DWFFRAME\n280\n2\n 9\n$DGNFRAME\n280\n0\n 9\n$REALWORLDSCALE\n290\n1\n 9\n$INTERFERECOLOR\n 62\n1\n 9\n$INTERFEREOBJVS\n345\nA3\n 9\n$INTERFEREVPVS\n346\nA0\n 9\n$CSHADOW\n280\n0\n 9\n$SHADOWPLANELOCATION\n 40\n0.0\n 0\nENDSEC"},dxfClasses=function(){return' 0\nSECTION\n 2\nCLASSES\n 0\nCLASS\n 1\nACDBDICTIONARYWDFLT\n 2\nAcDbDictionaryWithDefault\n 3\nObjectDBX Classes\n 90\n0\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nDICTIONARYVAR\n 2\nAcDbDictionaryVar\n 3\nObjectDBX Classes\n 90\n0\n 91\n15\n280\n0\n281\n0\n 0\nCLASS\n 1\nTABLESTYLE\n 2\nAcDbTableStyle\n 3\nObjectDBX Classes\n 90\n4095\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nMATERIAL\n 2\nAcDbMaterial\n 3\nObjectDBX Classes\n 90\n1153\n 91\n3\n280\n0\n281\n0\n 0\nCLASS\n 1\nVISUALSTYLE\n 2\nAcDbVisualStyle\n 3\nObjectDBX Classes\n 90\n4095\n 91\n26\n280\n0\n281\n0\n 0\nCLASS\n 1\nSCALE\n 2\nAcDbScale\n 3\nObjectDBX Classes\n 90\n1153\n 91\n17\n280\n0\n281\n0\n 0\nCLASS\n 1\nMLEADERSTYLE\n 2\nAcDbMLeaderStyle\n 3\nACDB_MLEADERSTYLE_CLASS\n 90\n4095\n 91\n3\n280\n0\n281\n0\n 0\nCLASS\n 1\nCELLSTYLEMAP\n 2\nAcDbCellStyleMap\n 3\nObjectDBX Classes\n 90\n1152\n 91\n2\n280\n0\n281\n0\n 0\nCLASS\n 1\nEXACXREFPANELOBJECT\n 2\nExAcXREFPanelObject\n 3\nEXAC_ESW\n 90\n1025\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nNPOCOLLECTION\n 2\nAcDbImpNonPersistentObjectsCollection\n 3\nObjectDBX Classes\n 90\n1153\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nLAYER_INDEX\n 2\nAcDbLayerIndex\n 3\nObjectDBX Classes\n 90\n0\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nSPATIAL_INDEX\n 2\nAcDbSpatialIndex\n 3\nObjectDBX Classes\n 90\n0\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nIDBUFFER\n 2\nAcDbIdBuffer\n 3\nObjectDBX Classes\n 90\n0\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nDIMASSOC\n 2\nAcDbDimAssoc\n 3\n"AcDbDimAssoc|Product Desc: AcDim ARX App For Dimension|Company: Autodesk, Inc.|WEB Address: www.autodesk.com"\n 90\n0\n 91\n0\n280\n0\n281\n0\n 0\nCLASS\n 1\nACDBSECTIONVIEWSTYLE\n 2\nAcDbSectionViewStyle\n 3\nObjectDBX Classes\n 90\n1025\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nACDBDETAILVIEWSTYLE\n 2\nAcDbDetailViewStyle\n 3\nObjectDBX Classes\n 90\n1025\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nIMAGEDEF\n 2\nAcDbRasterImageDef\n 3\nISM\n 90\n0\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nRASTERVARIABLES\n 2\nAcDbRasterVariables\n 3\nISM\n 90\n0\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nIMAGEDEF_REACTOR\n 2\nAcDbRasterImageDefReactor\n 3\nISM\n 90\n1\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nIMAGE\n 2\nAcDbRasterImage\n 3\nISM\n 90\n2175\n 91\n1\n280\n0\n281\n1\n 0\nCLASS\n 1\nPDFDEFINITION\n 2\nAcDbPdfDefinition\n 3\nObjectDBX Classes\n 90\n1153\n 91\n1\n280\n0\n281\n0\n 0\nCLASS\n 1\nPDFUNDERLAY\n 2\nAcDbPdfReference\n 3\nObjectDBX Classes\n 90\n4095\n 91\n1\n280\n0\n281\n1\n 0\nCLASS\n 1\nDWFDEFINITION\n 2\nAcDbDwfDefinition\n 3\nObjectDBX Classes\n 90\n1153\n 91\n2\n280\n0\n281\n0\n 0\nCLASS\n 1\nDWFUNDERLAY\n 2\nAcDbDwfReference\n 3\nObjectDBX Classes\n 90\n1153\n 91\n1\n280\n0\n281\n1\n 0\nCLASS\n 1\nDGNDEFINITION\n 2\nAcDbDgnDefinition\n 3\nObjectDBX Classes\n 90\n1153\n 91\n2\n280\n0\n281\n0\n 0\nCLASS\n 1\nDGNUNDERLAY\n 2\nAcDbDgnReference\n 3\nObjectDBX Classes\n 90\n1153\n 91\n1\n280\n0\n281\n1\n 0\nENDSEC'},dxfTables=function(){return" 0\nSECTION\n 2\nTABLES\n 0\nTABLE\n 2\nVPORT\n 5\n8\n330\n0\n100\nAcDbSymbolTable\n 70\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nLTYPE\n 5\n5F\n330\n0\n100\nAcDbSymbolTable\n 70\n7\n 0\nLTYPE\n 5\n14\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nByBlock\n 70\n0\n 3\n\n 72\n65\n 73\n0\n 40\n0.0\n 0\nLTYPE\n 5\n15\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nByLayer\n 70\n0\n 3\n\n 72\n65\n 73\n0\n 40\n0.0\n 0\nLTYPE\n 5\n16\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nContinuous\n 70\n0\n 3\nSolid line\n 72\n65\n 73\n0\n 40\n0.0\n 0\nLTYPE\n 5\n1B1\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nCENTER\n 70\n0\n 3\nCenter ____ _ ____ _ ____ _ ____ _ ____ _ ____\n 72\n65\n 73\n4\n 40\n2.0\n 49\n1.25\n 74\n0\n 49\n-0.25\n 74\n0\n 49\n0.25\n 74\n0\n 49\n-0.25\n 74\n0\n 0\nLTYPE\n 5\n1B2\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nDASHED\n 70\n0\n 3\nDashed __ __ __ __ __ __ __ __ __ __ __ __ __ _\n 72\n65\n 73\n2\n 40\n0.75\n 49\n0.5\n 74\n0\n 49\n-0.25\n 74\n0\n 0\nLTYPE\n 5\n1B3\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nPHANTOM\n 70\n0\n 3\nPhantom ______ __ __ ______ __ __ ______\n 72\n65\n 73\n6\n 40\n2.5\n 49\n1.25\n 74\n0\n 49\n-0.25\n 74\n0\n 49\n0.25\n 74\n0\n 49\n-0.25\n 74\n0\n 49\n0.25\n 74\n0\n 49\n-0.25\n 74\n0\n 0\nLTYPE\n 5\n39E\n330\n5F\n100\nAcDbSymbolTableRecord\n100\nAcDbLinetypeTableRecord\n 2\nHIDDEN\n 70\n0\n 3\nHidden __ __ __ __ __ __ __ __ __ __ __ __ __ __\n 72\n65\n 73\n2\n 40\n9.525\n 49\n6.35\n 74\n0\n 49\n-3.175\n 74\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nLAYER\n 5\n2\n330\n0\n100\nAcDbSymbolTable\n 70\n3\n 0\nLAYER\n 5\n10\n330\n2\n100\nAcDbSymbolTableRecord\n100\nAcDbLayerTableRecord\n 2\n0\n 70\n0\n 6\nContinuous\n370\n-3\n390\nF\n347\n98\n348\n0\n 0\nLAYER\n 5\n1B4\n330\n2\n100\nAcDbSymbolTableRecord\n100\nAcDbLayerTableRecord\n 2\nView Port\n 70\n0\n 6\nContinuous\n290\n0\n370\n-3\n390\nF\n347\n98\n348\n0\n 0\nLAYER\n 5\n21D\n330\n2\n100\nAcDbSymbolTableRecord\n100\nAcDbLayerTableRecord\n 2\nDefpoints\n 70\n0\n 6\nContinuous\n290\n0\n370\n-3\n390\nF\n347\n98\n348\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nSTYLE\n 5\n3\n330\n0\n100\nAcDbSymbolTable\n 70\n3\n 0\nSTYLE\n 5\n11\n330\n3\n100\nAcDbSymbolTableRecord\n100\nAcDbTextStyleTableRecord\n 2\nStandard\n 70\n0\n 40\n0.0\n 41\n1.0\n 50\n0.0\n 71\n0\n 42\n0.2\n 3\narial.ttf\n 4\n\n 0\nSTYLE\n 5\nDC\n330\n3\n100\nAcDbSymbolTableRecord\n100\nAcDbTextStyleTableRecord\n 2\nAnnotative\n 70\n0\n 40\n0.0\n 41\n1.0\n 50\n0.0\n 71\n0\n 42\n0.2\n 3\narial.ttf\n 4\n\n 0\nSTYLE\n 5\n178\n330\n3\n100\nAcDbSymbolTableRecord\n100\nAcDbTextStyleTableRecord\n 2\nNotes\n 70\n0\n 40\n3.0\n 41\n1.0\n 50\n0.0\n 71\n0\n 42\n0.2\n 3\narial.ttf\n 4\n\n 0\nENDTAB\n 0\nTABLE\n 2\nVIEW\n 5\n6\n330\n0\n100\nAcDbSymbolTable\n 70\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nUCS\n 5\n7\n330\n0\n100\nAcDbSymbolTable\n 70\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nAPPID\n 5\n9\n330\n0\n100\nAcDbSymbolTable\n 70\n12\n 0\nAPPID\n 5\n12\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD\n 70\n0\n 0\nAPPID\n 5\nDD\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nAcadAnnoPO\n 70\n0\n 0\nAPPID\n 5\nDE\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nAcadAnnotative\n 70\n0\n 0\nAPPID\n 5\nDF\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_DSTYLE_DIMJAG\n 70\n0\n 0\nAPPID\n 5\nE0\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_DSTYLE_DIMTALN\n 70\n0\n 0\nAPPID\n 5\n107\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_MLEADERVER\n 70\n0\n 0\nAPPID\n 5\n1B5\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nAcAecLayerStandard\n 70\n0\n 0\nAPPID\n 5\n1BA\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_EXEMPT_FROM_CAD_STANDARDS\n 70\n0\n 0\nAPPID\n 5\n237\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_DSTYLE_DIMBREAK\n 70\n0\n 0\nAPPID\n 5\n28E\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_PSEXT\n 70\n0\n 0\nAPPID\n 5\n4B0\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nACAD_NAV_VCDISPLAY\n 70\n0\n 0\nAPPID\n 5\n4E3\n330\n9\n100\nAcDbSymbolTableRecord\n100\nAcDbRegAppTableRecord\n 2\nHATCHBACKGROUNDCOLOR\n 70\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nDIMSTYLE\n 5\nA\n330\n0\n100\nAcDbSymbolTable\n 70\n3\n100\nAcDbDimStyleTable\n 71\n3\n340\n242\n340\n27\n340\nE1\n 0\nDIMSTYLE\n105\n27\n330\nA\n100\nAcDbSymbolTableRecord\n100\nAcDbDimStyleTableRecord\n 2\nStandard\n 70\n0\n 41\n3.0\n 42\n2.0\n 43\n9.0\n 44\n5.0\n140\n3.0\n141\n2.0\n147\n2.0\n340\n11\n1001\nACAD_DSTYLE_DIMJAG\n1070\n388\n1040\n38.0\n1001\nACAD_DSTYLE_DIMBREAK\n1070\n391\n1040\n90.0\n1001\nACAD_DSTYLE_DIMTALN\n1070\n392\n1070\n0\n 0\nDIMSTYLE\n105\nE1\n330\nA\n100\nAcDbSymbolTableRecord\n100\nAcDbDimStyleTableRecord\n 2\nAnnotative\n 70\n0\n 40\n0.0\n 41\n3.0\n 42\n2.5\n 43\n10.0\n 44\n5.0\n140\n3.0\n141\n2.0\n147\n2.0\n340\n11\n1001\nAcadAnnotative\n1000\nAnnotativeData\n1002\n{\n1070\n1\n1070\n1\n1002\n}\n1001\nACAD_DSTYLE_DIMJAG\n1070\n388\n1040\n38.0\n1001\nACAD_DSTYLE_DIMBREAK\n1070\n391\n1040\n90.0\n1001\nACAD_DSTYLE_DIMTALN\n1070\n392\n1070\n0\n 0\nDIMSTYLE\n105\n242\n330\nA\n100\nAcDbSymbolTableRecord\n100\nAcDbDimStyleTableRecord\n 2\nCivil-Metric\n 70\n0\n 41\n3.0\n 42\n1.5\n 43\n6.0\n 44\n3.0\n 73\n0\n 74\n0\n 77\n1\n 78\n3\n 79\n2\n140\n3.0\n141\n3.0\n147\n2.0\n179\n2\n271\n2\n272\n2\n276\n1\n340\n11\n1001\nACAD_DSTYLE_DIMBREAK\n1070\n391\n1040\n3.0\n1001\nACAD_DSTYLE_DIMJAG\n1070\n388\n1040\n38.0\n1001\nACAD_DSTYLE_DIMTALN\n1070\n392\n1070\n0\n 0\nENDTAB\n 0\nTABLE\n 2\nBLOCK_RECORD\n 5\n1\n330\n0\n100\nAcDbSymbolTable\n 70\n4\n 0\nBLOCK_RECORD\n 5\n1F\n330\n1\n100\nAcDbSymbolTableRecord\n100\nAcDbBlockTableRecord\n 2\n*Model_Space\n340\n530\n 70\n0\n280\n1\n281\n0\n 0\nBLOCK_RECORD\n 5\n58\n330\n1\n100\nAcDbSymbolTableRecord\n100\nAcDbBlockTableRecord\n 2\n*Paper_Space\n340\n531\n 70\n0\n280\n1\n281\n0\n 0\nBLOCK_RECORD\n 5\n238\n330\n1\n100\nAcDbSymbolTableRecord\n100\nAcDbBlockTableRecord\n 2\n_ArchTick\n340\n0\n 70\n0\n280\n1\n281\n0\n 0\nBLOCK_RECORD\n 5\n23C\n330\n1\n100\nAcDbSymbolTableRecord\n100\nAcDbBlockTableRecord\n 2\n_Open30\n340\n0\n 70\n0\n280\n1\n281\n0\n 0\nENDTAB\n 0\nENDSEC"},dxfBlocks=function(){return" 0\nSECTION\n 2\nBLOCKS\n 0\nBLOCK\n 5\n23A\n330\n238\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockBegin\n 2\n_ArchTick\n 70\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 3\n_ArchTick\n 1\n\n 0\nENDBLK\n 5\n23B\n330\n238\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockEnd\n 0\nBLOCK\n 5\n20\n330\n1F\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockBegin\n 2\n*Model_Space\n 70\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 3\n*Model_Space\n 1\n\n 0\nENDBLK\n 5\n21\n330\n1F\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockEnd\n 0\nBLOCK\n 5\n5A\n330\n58\n100\nAcDbEntity\n 67\n1\n 8\n0\n100\nAcDbBlockBegin\n 2\n*Paper_Space\n 70\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 3\n*Paper_Space\n 1\n\n 0\nENDBLK\n 5\n5B\n330\n58\n100\nAcDbEntity\n 67\n1\n 8\n0\n100\nAcDbBlockEnd\n 0\nBLOCK\n 5\n240\n330\n23C\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockBegin\n 2\n_Open30\n 70\n0\n 10\n0.0\n 20\n0.0\n 30\n0.0\n 3\n_Open30\n 1\n\n 0\nENDBLK\n 5\n241\n330\n23C\n100\nAcDbEntity\n 8\n0\n100\nAcDbBlockEnd\n 0\nENDSEC"},dxfObjects=function(){return" 0\nSECTION\n 2\nOBJECTS\n 0\nDICTIONARY\n 5\nC\n330\n0\n100\nAcDbDictionary\n281\n1\n 3\nACAD_COLOR\n350\n524\n 3\nACAD_GROUP\n350\n525\n 3\nACAD_LAYOUT\n350\n526\n 3\nACAD_MATERIAL\n350\n527\n 3\nACAD_MLEADERSTYLE\n350\n528\n 3\nACAD_MLINESTYLE\n350\n529\n 3\nACAD_PLOTSETTINGS\n350\n52A\n 3\nACAD_PLOTSTYLENAME\n350\n52C\n 3\nACAD_SCALELIST\n350\n52D\n 3\nACAD_TABLESTYLE\n350\n52E\n 3\nACAD_VISUALSTYLE\n350\n52F\n 0\nDICTIONARY\n 5\n524\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n525\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n526\n330\nC\n100\nAcDbDictionary\n281\n1\n 3\nModel\n350\n530\n 3\nLayout1\n350\n531\n 0\nDICTIONARY\n 5\n527\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n528\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n529\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n52A\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nACDBPLACEHOLDER\n 5\n52B\n330\n52C\n 0\nACDBDICTIONARYWDFLT\n 5\n52C\n330\nC\n100\nAcDbDictionary\n281\n1\n 3\nNormal\n350\n52B\n100\nAcDbDictionaryWithDefault\n340\n52B\n 0\nDICTIONARY\n 5\n52D\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n52E\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nDICTIONARY\n 5\n52F\n330\nC\n100\nAcDbDictionary\n281\n1\n 0\nLAYOUT\n 5\n530\n330\n526\n100\nAcDbPlotSettings\n 1\n\n 2\nDWFx ePlot (XPS Compatible).pc3\n 4\nANSI_A_(8.50_x_11.00_Inches)\n 6\n\n 40\n5.8\n 41\n17.8\n 42\n5.8\n 43\n17.8\n 44\n215.9\n 45\n279.4\n 46\n0.0\n 47\n0.0\n 48\n0.0\n 49\n0.0\n140\n0.0\n141\n0.0\n142\n1.0\n143\n14.53\n 70\n11952\n 72\n0\n 73\n1\n 74\n0\n 7\n\n 75\n0\n147\n0.069\n148\n114.98\n149\n300.29\n100\nAcDbLayout\n 1\nModel\n 70\n1\n 71\n0\n 10\n0.0\n 20\n0.0\n 11\n12.0\n 21\n9.0\n 12\n0.0\n 22\n0.0\n 32\n0.0\n 14\n0.0\n 24\n0.0\n 34\n0.0\n 15\n0.0\n 25\n0.0\n 35\n0.0\n146\n0.0\n 13\n0.0\n 23\n0.0\n 33\n0.0\n 16\n1.0\n 26\n0.0\n 36\n0.0\n 17\n0.0\n 27\n1.0\n 37\n0.0\n 76\n0\n330\n1F\n 0\nLAYOUT\n 5\n531\n330\n526\n100\nAcDbPlotSettings\n 1\n\n 2\nDWFx ePlot (XPS Compatible).pc3\n 4\nANSI_A_(8.50_x_11.00_Inches)\n 6\n\n 40\n5.8\n 41\n17.8\n 42\n5.8\n 43\n17.8\n 44\n215.9\n 45\n279.4\n 46\n0.0\n 47\n0.0\n 48\n0.0\n 49\n0.0\n140\n0.0\n141\n0.0\n142\n1.0\n143\n1.0\n 70\n688\n 72\n0\n 73\n1\n 74\n5\n 7\nacad.ctb\n 75\n16\n147\n1.0\n148\n0.0\n149\n0.0\n100\nAcDbLayout\n 1\nLayout1\n 70\n1\n 71\n1\n 10\n-0.7\n 20\n-0.23\n 11\n10.3\n 21\n8.27\n 12\n0.0\n 22\n0.0\n 32\n0.0\n 14\n0.63\n 24\n0.8\n 34\n0.0\n 15\n9.0\n 25\n7.2\n 35\n0.0\n146\n0.0\n 13\n0.0\n 23\n0.0\n 33\n0.0\n 16\n1.0\n 26\n0.0\n 36\n0.0\n 17\n0.0\n 27\n1.0\n 37\n0.0\n 76\n0\n330\n58\n 0\nENDSEC"};module.exports={dxfHeaders:dxfHeaders,dxfClasses:dxfClasses,dxfTables:dxfTables,dxfBlocks:dxfBlocks,dxfObjects:dxfObjects};
|
|
401
323
|
|
|
402
|
-
},{}],
|
|
324
|
+
},{}],64:[function(require,module,exports){
|
|
403
325
|
const colorIndex=[[0,0,0,255],[255,0,0,255],[255,255,0,255],[0,255,0,255],[0,255,255,255],[0,0,255,255],[255,0,255,255],[255,255,255,255],[128,128,128,255],[192,192,192,255],[255,0,0,255],[255,127,127,255],[165,0,0,255],[165,82,82,255],[127,0,0,255],[127,63,63,255],[76,0,0,255],[76,38,38,255],[38,0,0,255],[38,19,19,255],[255,63,0,255],[255,159,127,255],[165,41,0,255],[165,103,82,255],[127,31,0,255],[127,79,63,255],[76,19,0,255],[76,47,38,255],[38,9,0,255],[38,28,19,255],[255,127,0,255],[255,191,127,255],[165,82,0,255],[165,124,82,255],[127,63,0,255],[127,95,63,255],[76,38,0,255],[76,57,38,255],[38,19,0,255],[38,28,19,255],[255,191,0,255],[255,223,127,255],[165,124,0,255],[165,145,82,255],[127,95,0,255],[127,111,63,255],[76,57,0,255],[76,66,38,255],[38,28,0,255],[38,33,19,255],[255,255,0,255],[255,255,127,255],[165,165,0,255],[165,165,82,255],[127,127,0,255],[127,127,63,255],[76,76,0,255],[76,76,38,255],[38,38,0,255],[38,38,19,255],[191,255,0,255],[223,255,127,255],[124,165,0,255],[145,165,82,255],[95,127,0,255],[111,127,63,255],[57,76,0,255],[66,76,38,255],[28,38,0,255],[33,38,19,255],[127,255,0,255],[191,255,127,255],[82,165,0,255],[124,165,82,255],[63,127,0,255],[95,127,63,255],[38,76,0,255],[57,76,38,255],[19,38,0,255],[28,38,19,255],[63,255,0,255],[159,255,127,255],[41,165,0,255],[103,165,82,255],[31,127,0,255],[79,127,63,255],[19,76,0,255],[47,76,38,255],[9,38,0,255],[23,38,19,255],[0,255,0,255],[125,255,127,255],[0,165,0,255],[82,165,82,255],[0,127,0,255],[63,127,63,255],[0,76,0,255],[38,76,38,255],[0,38,0,255],[19,38,19,255],[0,255,63,255],[127,255,159,255],[0,165,41,255],[82,165,103,255],[0,127,31,255],[63,127,79,255],[0,76,19,255],[38,76,47,255],[0,38,9,255],[19,88,23,255],[0,255,127,255],[127,255,191,255],[0,165,82,255],[82,165,124,255],[0,127,63,255],[63,127,95,255],[0,76,38,255],[38,76,57,255],[0,38,19,255],[19,88,28,255],[0,255,191,255],[127,255,223,255],[0,165,124,255],[82,165,145,255],[0,127,95,255],[63,127,111,255],[0,76,57,255],[38,76,66,255],[0,38,28,255],[19,88,88,255],[0,255,255,255],[127,255,255,255],[0,165,165,255],[82,165,165,255],[0,127,127,255],[63,127,127,255],[0,76,76,255],[38,76,76,255],[0,38,38,255],[19,88,88,255],[0,191,255,255],[127,223,255,255],[0,124,165,255],[82,145,165,255],[0,95,127,255],[63,111,217,255],[0,57,76,255],[38,66,126,255],[0,28,38,255],[19,88,88,255],[0,127,255,255],[127,191,255,255],[0,82,165,255],[82,124,165,255],[0,63,127,255],[63,95,127,255],[0,38,76,255],[38,57,126,255],[0,19,38,255],[19,28,88,255],[0,63,255,255],[127,159,255,255],[0,41,165,255],[82,103,165,255],[0,31,127,255],[63,79,127,255],[0,19,76,255],[38,47,126,255],[0,9,38,255],[19,23,88,255],[0,0,255,255],[127,127,255,255],[0,0,165,255],[82,82,165,255],[0,0,127,255],[63,63,127,255],[0,0,76,255],[38,38,126,255],[0,0,38,255],[19,19,88,255],[63,0,255,255],[159,127,255,255],[41,0,165,255],[103,82,165,255],[31,0,127,255],[79,63,127,255],[19,0,76,255],[47,38,126,255],[9,0,38,255],[23,19,88,255],[127,0,255,255],[191,127,255,255],[165,0,82,255],[124,82,165,255],[63,0,127,255],[95,63,127,255],[38,0,76,255],[57,38,126,255],[19,0,38,255],[28,19,88,255],[191,0,255,255],[223,127,255,255],[124,0,165,255],[142,82,165,255],[95,0,127,255],[111,63,127,255],[57,0,76,255],[66,38,76,255],[28,0,38,255],[88,19,88,255],[255,0,255,255],[255,127,255,255],[165,0,165,255],[165,82,165,255],[127,0,127,255],[127,63,127,255],[76,0,76,255],[76,38,76,255],[38,0,38,255],[88,19,88,255],[255,0,191,255],[255,127,223,255],[165,0,124,255],[165,82,145,255],[127,0,95,255],[127,63,111,255],[76,0,57,255],[76,38,66,255],[38,0,28,255],[88,19,88,255],[255,0,127,255],[255,127,191,255],[165,0,82,255],[165,82,124,255],[127,0,63,255],[127,63,95,255],[76,0,38,255],[76,38,57,255],[38,0,19,255],[88,19,28,255],[255,0,63,255],[255,127,159,255],[165,0,41,255],[165,82,103,255],[127,0,31,255],[127,63,79,255],[76,0,19,255],[76,38,47,255],[38,0,9,255],[88,19,23,255],[0,0,0,255],[101,101,101,255],[102,102,102,255],[153,153,153,255],[204,204,204,255],[255,255,255,255]];module.exports=colorIndex;
|
|
404
326
|
|
|
405
|
-
},{}],
|
|
406
|
-
const{geometries:geometries,modifiers:modifiers}=require("@jscad/modeling"),{geom3:geom3,geom2:geom2,path2:path2}=geometries,{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),{dxfHeaders:dxfHeaders,dxfClasses:dxfClasses,dxfTables:dxfTables,dxfBlocks:dxfBlocks,dxfObjects:dxfObjects}=require("./autocad_AC2017"),colorindex2017=require("./colorindex2017"),mimeType="application/dxf",serialize=(n,...e)=>{const t={geom2To:"lwpolyline",geom3To:"3dface",pathTo:"lwpolyline",statusCallback:null,colorIndex:colorindex2017};if((n=Object.assign({},t,n)).entityId=0,0===(e=(e=flatten(e)).filter(n=>geom3.isA(n)||geom2.isA(n)||path2.isA(n))).length)throw new Error("only JSCAD geometries can be serialized to DXF");return e=toArray(modifiers.generalize({snap:!0,triangulate:!0},e)),[`999\nCreated by JSCAD\n${dxfHeaders(n)}\n${dxfClasses(n)}\n${dxfTables(n)}\n${dxfBlocks(n)}\n${dxfEntities(e,n)}\n${dxfObjects(n)}\n 0\nEOF\n`]},dxfEntities=(n,e)=>{const t=n.map((n,t)=>{if(geom2.isA(n)){const t=n.color,o=n.name,s=geom2.toOutlines(n).map(n=>({closed:!0,points:n,color:t,name:o}));return"polyline"===e.geom2To?PathsToPolyine(s,e):PathsToLwpolyline(s,e)}if(geom3.isA(n))return"polyline"===e.geom3To?PolygonsToPolyline(n,e):PolygonsTo3DFaces(n,e);if(path2.isA(n)){const t=n.color,o=n.name,s={closed:n.isClosed,points:path2.toPoints(n),color:t,name:o};return PathsToLwpolyline([s],e)}return""});let o=" 0\nSECTION\n 2\nENTITIES\n";return t.forEach(n=>{n&&(o+=n)}),o+=" 0\nENDSEC"},PathsToLwpolyline=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";return n.forEach((o,s)=>{if(o.points.length<1)return;const l=o.points.length+(o.closed?1:0);t+=` 0\nLWPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(o,e)}\n 8\n0\n 67\n0\n 62\n${getColorNumber(o,e)}\n 100\nAcDbPolyline\n 90\n${l}\n 70\n${o.closed?1:0}\n`;for(let n=0;n<l;n++){let e=n;e>=o.points.length&&(e-=o.points.length);const s=o.points[e];t+=` 10\n${s[0]}\n 20\n${s[1]}\n`}e.statusCallback&&e.statusCallback({progress:100*s/n.length})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},PathsToPolyine=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";return n.forEach((o,s)=>{const l=o.points.length+(o.closed?1:0);t+=` 0\nPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(o,e)}\n 8\n0\n 62\n${getColorNumber(o,e)}\n 100\nAcDb2dPolyline\n`;for(let n=0;n<l;n++){let s=n;s>=o.points.length&&(s-=o.points.length);const l=o.points[s];t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb2dVertex\n 10\n${l[0]}\n 20\n${l[1]}\n`}t+=` 0\nSEQEND\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n`,e.statusCallback&&e.statusCallback({progress:100*s/n.length})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},PolygonsTo3DFaces=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";const o=geom3.toPolygons(n),s=getColorNumber(n,e);return o.forEach((n,o)=>{const l=n.color?getColorNumber(n,e):s;polygonToTriangles(n).forEach((n,o)=>{t+=triangleTo3DFaces(n,e,l)})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},polygonToTriangles=n=>{const e=n.vertices.length-2;if(e<1)return[];const t=n.vertices[0],o=[];for(let s=0;s<e;s++)o.push([t,n.vertices[s+1],n.vertices[s+2]]);return o},triangleTo3DFaces=(n,e,t)=>{const o=n[0],s=n[1],l=n[2],r=n[2];return` 0\n3DFACE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 62\n${t}\n 100\nAcDbFace\n 70\n0\n 10\n${o[0]}\n 20\n${o[1]}\n 30\n${o[2]}\n 11\n${s[0]}\n 21\n${s[1]}\n 31\n${s[2]}\n 12\n${l[0]}\n 22\n${l[1]}\n 32\n${l[2]}\n 13\n${r[0]}\n 23\n${r[1]}\n 33\n${r[2]}\n`},PolygonsToPolyline=(n,e)=>{let t="";const o=polygons2polyfaces(geom3.toPolygons(n));return o.faces.length>0&&(t+=` 0\nPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(n,e)}\n 8\n0\n 62\n${getColorNumber(n,e)}\n 100\nAcDb3dPolyline\n 70\n64\n 71\n${o.vertices.length}\n 72\n${o.faces.length}\n`,o.vertices.forEach(n=>{t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb3dPolylineVertex\n 10\n${n[0]}\n 20\n${n[1]}\n 30\n${n[2]}\n 70\n192\n`}),o.faces.forEach(n=>{t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb3dPolylineVertex\n 10\n0\n 20\n0\n 30\n0\n 70\n128\n 71\n${n[0]}\n 72\n${n[1]}\n 73\n${n[2]}\n 74\n${n[3]}\n`})),[t]},polygons2polyfaces=n=>{const e=[],t=[];for(let o=0;o<n.length;++o){const s=n[o],l=[];for(let n=0;n<s.vertices.length;++n){const e=s.vertices[n];t.push([e[0],e[1],e[2]]),l.push(t.length)}for(;l.length<4;)l.push(0);e.push(l)}return{faces:e,vertices:t}},getEntityId=n=>{n.entityId++;const e="00000"+n.entityId.toString(16).toUpperCase();return"CAD"+e.substr(e.length-5)},getName=(n,e)=>{if(n.name)return n.name;const t="00000"+e.entityId.toString(16).toUpperCase();return"CAD"+t.substr(t.length-5)},getColorNumber=(n,e)=>{let t=256;if(n.color){const o=Math.floor(255*n.color[0]),s=Math.floor(255*n.color[1]),l=Math.floor(255*n.color[2]),r=e.colorIndex;let a=765;for(let n=
|
|
327
|
+
},{}],65:[function(require,module,exports){
|
|
328
|
+
const{geometries:geometries,modifiers:modifiers}=require("@jscad/modeling"),{geom3:geom3,geom2:geom2,path2:path2}=geometries,{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),{dxfHeaders:dxfHeaders,dxfClasses:dxfClasses,dxfTables:dxfTables,dxfBlocks:dxfBlocks,dxfObjects:dxfObjects}=require("./autocad_AC2017"),colorindex2017=require("./colorindex2017"),mimeType="application/dxf",serialize=(n,...e)=>{const t={geom2To:"lwpolyline",geom3To:"3dface",pathTo:"lwpolyline",statusCallback:null,colorIndex:colorindex2017};if((n=Object.assign({},t,n)).entityId=0,0===(e=(e=flatten(e)).filter(n=>geom3.isA(n)||geom2.isA(n)||path2.isA(n))).length)throw new Error("only JSCAD geometries can be serialized to DXF");return e=toArray(modifiers.generalize({snap:!0,triangulate:!0},e)),[`999\nCreated by JSCAD\n${dxfHeaders(n)}\n${dxfClasses(n)}\n${dxfTables(n)}\n${dxfBlocks(n)}\n${dxfEntities(e,n)}\n${dxfObjects(n)}\n 0\nEOF\n`]},dxfEntities=(n,e)=>{const t=n.map((n,t)=>{if(geom2.isA(n)){const t=n.color,o=n.name,s=geom2.toOutlines(n).map(n=>({closed:!0,points:n,color:t,name:o}));return"polyline"===e.geom2To?PathsToPolyine(s,e):PathsToLwpolyline(s,e)}if(geom3.isA(n))return"polyline"===e.geom3To?PolygonsToPolyline(n,e):PolygonsTo3DFaces(n,e);if(path2.isA(n)){const t=n.color,o=n.name,s={closed:n.isClosed,points:path2.toPoints(n),color:t,name:o};return PathsToLwpolyline([s],e)}return""});let o=" 0\nSECTION\n 2\nENTITIES\n";return t.forEach(n=>{n&&(o+=n)}),o+=" 0\nENDSEC"},PathsToLwpolyline=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";return n.forEach((o,s)=>{if(o.points.length<1)return;const l=o.points.length+(o.closed?1:0);t+=` 0\nLWPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(o,e)}\n 8\n0\n 67\n0\n 62\n${getColorNumber(o,e)}\n 100\nAcDbPolyline\n 90\n${l}\n 70\n${o.closed?1:0}\n`;for(let n=0;n<l;n++){let e=n;e>=o.points.length&&(e-=o.points.length);const s=o.points[e];t+=` 10\n${s[0]}\n 20\n${s[1]}\n`}e.statusCallback&&e.statusCallback({progress:100*s/n.length})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},PathsToPolyine=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";return n.forEach((o,s)=>{const l=o.points.length+(o.closed?1:0);t+=` 0\nPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(o,e)}\n 8\n0\n 62\n${getColorNumber(o,e)}\n 100\nAcDb2dPolyline\n`;for(let n=0;n<l;n++){let s=n;s>=o.points.length&&(s-=o.points.length);const l=o.points[s];t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb2dVertex\n 10\n${l[0]}\n 20\n${l[1]}\n`}t+=` 0\nSEQEND\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n`,e.statusCallback&&e.statusCallback({progress:100*s/n.length})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},PolygonsTo3DFaces=(n,e)=>{e.statusCallback&&e.statusCallback({progress:0});let t="";const o=geom3.toPolygons(n),s=getColorNumber(n,e);return o.forEach((n,o)=>{const l=n.color?getColorNumber(n,e):s;polygonToTriangles(n).forEach((n,o)=>{t+=triangleTo3DFaces(n,e,l)})}),e.statusCallback&&e.statusCallback({progress:100}),[t]},polygonToTriangles=n=>{const e=n.vertices.length-2;if(e<1)return[];const t=n.vertices[0],o=[];for(let s=0;s<e;s++)o.push([t,n.vertices[s+1],n.vertices[s+2]]);return o},triangleTo3DFaces=(n,e,t)=>{const o=n[0],s=n[1],l=n[2],r=n[2];return` 0\n3DFACE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 62\n${t}\n 100\nAcDbFace\n 70\n0\n 10\n${o[0]}\n 20\n${o[1]}\n 30\n${o[2]}\n 11\n${s[0]}\n 21\n${s[1]}\n 31\n${s[2]}\n 12\n${l[0]}\n 22\n${l[1]}\n 32\n${l[2]}\n 13\n${r[0]}\n 23\n${r[1]}\n 33\n${r[2]}\n`},PolygonsToPolyline=(n,e)=>{let t="";const o=polygons2polyfaces(geom3.toPolygons(n));return o.faces.length>0&&(t+=` 0\nPOLYLINE\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 3\n${getName(n,e)}\n 8\n0\n 62\n${getColorNumber(n,e)}\n 100\nAcDb3dPolyline\n 70\n64\n 71\n${o.vertices.length}\n 72\n${o.faces.length}\n`,o.vertices.forEach(n=>{t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb3dPolylineVertex\n 10\n${n[0]}\n 20\n${n[1]}\n 30\n${n[2]}\n 70\n192\n`}),o.faces.forEach(n=>{t+=` 0\nVERTEX\n 5\n${getEntityId(e)}\n 100\nAcDbEntity\n 8\n0\n 100\nAcDbVertex\n 100\nAcDb3dPolylineVertex\n 10\n0\n 20\n0\n 30\n0\n 70\n128\n 71\n${n[0]}\n 72\n${n[1]}\n 73\n${n[2]}\n 74\n${n[3]}\n`})),[t]},polygons2polyfaces=n=>{const e=[],t=[];for(let o=0;o<n.length;++o){const s=n[o],l=[];for(let n=0;n<s.vertices.length;++n){const e=s.vertices[n];t.push([e[0],e[1],e[2]]),l.push(t.length)}for(;l.length<4;)l.push(0);e.push(l)}return{faces:e,vertices:t}},getEntityId=n=>{n.entityId++;const e="00000"+n.entityId.toString(16).toUpperCase();return"CAD"+e.substr(e.length-5)},getName=(n,e)=>{if(n.name)return n.name;const t="00000"+e.entityId.toString(16).toUpperCase();return"CAD"+t.substr(t.length-5)},getColorNumber=(n,e)=>{let t=256;if(n.color){const o=Math.floor(255*n.color[0]),s=Math.floor(255*n.color[1]),l=Math.floor(255*n.color[2]),r=e.colorIndex;let a=765;for(let n=1;n<r.length;n++){const e=r[n],i=Math.abs(o-e[0])+Math.abs(s-e[1])+Math.abs(l-e[2]);if(i<a){if(t=n,0===i)break;a=i}}}return t};module.exports={serialize:serialize,mimeType:mimeType};
|
|
407
329
|
|
|
408
|
-
},{"./autocad_AC2017":
|
|
330
|
+
},{"./autocad_AC2017":63,"./colorindex2017":64,"@jscad/array-utils":483,"@jscad/modeling":185}],66:[function(require,module,exports){
|
|
409
331
|
class BinaryReader{constructor(t){this._buffer=t,this._pos=0}readInt8(){return this._decodeInt(8,!0)}readUInt8(){return this._decodeInt(8,!1)}readInt16(){return this._decodeInt(16,!0)}readUInt16(){return this._decodeInt(16,!1)}readInt32(){return this._decodeInt(32,!0)}readUInt32(){return this._decodeInt(32,!1)}readFloat(){return this._decodeFloat(23,8)}readDouble(){return this._decodeFloat(52,11)}readChar(){return this.readString(1)}readString(t){this._checkSize(8*t);const e=this._buffer.substr(this._pos,t);return this._pos+=t,e}seek(t){this._pos=t,this._checkSize(0)}getPosition(){return this._pos}getSize(){return this._buffer.length}_decodeFloat(t,e){const r=t+e+1,s=r>>3;this._checkSize(r);const i=Math.pow(2,e-1)-1,h=this._readBits(t+e,1,s),d=this._readBits(t,e,s);let o=0,n=2,_=0,a=0;do{const e=this._readByte(++_,s);let r=1<<(a=t%8||8);for(;r>>=1;)e&r&&(o+=1/n),n*=2}while(t-=a);return this._pos+=s,d===1+(i<<1)?o?NaN:h?-1/0:1/0:(1+-2*h)*(d||o?d?Math.pow(2,d-i)*(1+o):Math.pow(2,1-i)*o:0)}_decodeInt(t,e){const r=this._readBits(0,t,t/8),s=Math.pow(2,t),i=e&&r>=s/2?r-s:r;return this._pos+=t/8,i}_shl(t,e){for(++e;--e;t=1073741824==(1073741824&(t%=2147483648))?2*t:2*(t-1073741824)+2147483647+1);return t}_readByte(t,e){return 255&this._buffer.charCodeAt(this._pos+e-t-1)}_readBits(t,e,r){const s=(t+e)%8,i=t%8,h=r-(t>>3)-1;let d=r+(-(t+e)>>3),o=h-d,n=this._readByte(h,r)>>i&(1<<(o?8-i:e))-1;for(o&&s&&(n+=(this._readByte(d++,r)&(1<<s)-1)<<(o--<<3)-i);o;)n+=this._shl(this._readByte(d++,r),(o--<<3)-i);return n}_checkSize(t){this._pos,Math.ceil(t/8),this._buffer.length}}module.exports=BinaryReader;
|
|
410
332
|
|
|
411
|
-
},{}],
|
|
333
|
+
},{}],67:[function(require,module,exports){
|
|
412
334
|
(function (Buffer){(function (){
|
|
413
335
|
class Blob{constructor(e,t){if(t=t||{},this.size=0,this.type="",this.isClosed=!1,this.encoding="utf8",this.buffer=null,this.length=32e6,!e)return;if(!Array.isArray(e))return;let s,i;t.type&&(this.type=t.type.toLowerCase()),t.endings,t.encoding&&(this.encoding=t.encoding.toLowerCase()),t.length&&(this.length=t.length),this.buffer=Buffer.allocUnsafe(this.length);for(let t=0;t<e.length;t++)switch(typeof e[t]){case"string":s=this.buffer.write(e[t],this.size,this.encoding),this.size=this.size+s;break;case"object":if(i=e[t],Buffer.isBuffer(i),i instanceof ArrayBuffer){const e=new DataView(i);for(let t=0;t<i.byteLength;t++){const i=e.getUint8(t);s=this.buffer.writeUInt8(i,this.size,!1),this.size++}}}}asBuffer(){return this.buffer.slice(0,this.size)}arrayBuffer(){return this.buffer.slice(0,this.size)}slice(e,t,s){return e=e||0,t=t||this.size,s=s||"",new Blob}stream(){return null}text(){return""}close(){this.isClosed||(this.isClosed=!0)}toString(){return""}}module.exports=Blob;
|
|
414
336
|
|
|
415
337
|
}).call(this)}).call(this,require("buffer").Buffer)
|
|
416
|
-
},{"buffer":
|
|
338
|
+
},{"buffer":2}],68:[function(require,module,exports){
|
|
417
339
|
const makeBlob=require("./makeBlob"),Blob=makeBlob(),convertToBlob=o=>{const{data:e,mimeType:l}=o;return new Blob(e,{type:l})};module.exports=convertToBlob;
|
|
418
340
|
|
|
419
|
-
},{"./makeBlob":
|
|
341
|
+
},{"./makeBlob":70}],69:[function(require,module,exports){
|
|
420
342
|
module.exports={convertToBlob:require("./convertToBlob"),makeBlob:require("./makeBlob"),BinaryReader:require("./BinaryReader"),Blob:require("./Blob")};
|
|
421
343
|
|
|
422
|
-
},{"./BinaryReader":
|
|
344
|
+
},{"./BinaryReader":66,"./Blob":67,"./convertToBlob":68,"./makeBlob":70}],70:[function(require,module,exports){
|
|
423
345
|
const nodeBlob=require("./Blob.js"),makeBlob=()=>{return"undefined"!=typeof window?window.Blob:nodeBlob};module.exports=makeBlob;
|
|
424
346
|
|
|
425
|
-
},{"./Blob.js":
|
|
347
|
+
},{"./Blob.js":67}],71:[function(require,module,exports){
|
|
426
348
|
const amfDeSerializer=require("@jscad/amf-deserializer"),dxfDeSerializer=require("@jscad/dxf-deserializer"),jsonDeSerializer=require("@jscad/json-deserializer"),objDeSerializer=require("@jscad/obj-deserializer"),stlDeSerializer=require("@jscad/stl-deserializer"),svgDeSerializer=require("@jscad/svg-deserializer"),deserializers={};deserializers[amfDeSerializer.extension]=amfDeSerializer.deserialize,deserializers[dxfDeSerializer.extension]=dxfDeSerializer.deserialize,deserializers[jsonDeSerializer.extension]=jsonDeSerializer.deserialize,deserializers[objDeSerializer.extension]=objDeSerializer.deserialize,deserializers[stlDeSerializer.extension]=stlDeSerializer.deserialize,deserializers[svgDeSerializer.extension]=svgDeSerializer.deserialize,module.exports=deserializers;
|
|
427
349
|
|
|
428
|
-
},{"@jscad/amf-deserializer":
|
|
350
|
+
},{"@jscad/amf-deserializer":49,"@jscad/dxf-deserializer":59,"@jscad/json-deserializer":75,"@jscad/obj-deserializer":78,"@jscad/stl-deserializer":80,"@jscad/svg-deserializer":92}],72:[function(require,module,exports){
|
|
429
351
|
const{geometries:geometries}=require("@jscad/modeling"),formats={stl:{displayName:"STL (Binary)",description:"STereoLithography, Binary",extension:"stl",mimetype:"application/sla",deserializable:!0,convertGeom3:!1,convertGeom2:!1},stla:{displayName:"STL (ASCII)",description:"STereoLithography, ASCII",extension:"stl",mimetype:"application/sla",deserializable:!1,convertGeom3:!0,convertGeom2:!1},stlb:{displayName:"STL (Binary)",description:"STereoLithography, Binary",extension:"stl",mimetype:"application/sla",deserializable:!1,convertGeom3:!0,convertGeom2:!1},amf:{displayName:"AMF (experimental)",description:"Additive Manufacturing File Format",extension:"amf",mimetype:"application/amf+xml",deserializable:!0,convertGeom3:!0,convertGeom2:!1},dxf:{displayName:"DXF (ASCII)",description:"AutoCAD Drawing Exchange Format",extension:"dxf",mimetype:"application/dxf",deserializable:!0,convertGeom3:!0,convertGeom2:!0},jscad:{displayName:"JSCAD",description:"JSCAD Design Source",extension:"jscad",mimetype:"application/javascript",deserializable:!0,convertGeom3:!0,convertGeom2:!0},json:{displayName:"json",description:"JavaScript Object Notation Format",extension:"json",mimetype:"application/json",deserializable:!0,convertGeom3:!0,convertGeom2:!0},js:{displayName:"js",description:"JavaScript Source",extension:"js",mimetype:"application/javascript",deserializable:!0,convertGeom3:!0,convertGeom2:!0},obj:{displayName:"OBJ",description:"Wavefromt OBJ File Format",extension:"obj",mimetype:"text/plain",deserializable:!0,convertGeom3:!1,convertGeom2:!1},svg:{displayName:"SVG",description:"Scalable Vector Graphics Format",extension:"svg",mimetype:"image/svg+xml",deserializable:!0,convertGeom3:!1,convertGeom2:!0},x3d:{displayName:"X3D",description:"X3D File Format",extension:"x3d",mimetype:"model/x3d+xml",deserializable:!1,convertGeom3:!0,convertGeom2:!1}},conversionFormats=["amf","js","jscad","obj","scad","stl","dxf","svg","ttf","woff"],supportedFormatsForObjects=e=>{const o=[];let t=!1,s=!1;for(let o=0;o<e.length;o++)geometries.geom3.isA(e[o])&&(t=!0),(geometries.geom2.isA(e[o])||geometries.path2.isA(e[o]))&&(s=!0);for(const e in formats)t&&!0===formats[e].convertGeom3?o[o.length]=e:s&&!0===formats[e].convertGeom2&&(o[o.length]=e);return o},supportedOutputExtensions=()=>{const e=[];for(const o in formats)!0!==formats[o].convertGeom3&&!0!==formats[o].convertGeom2||e.indexOf(formats[o].extension)<0&&e.push(formats[o].extension);return e},supportedOutputFormats=()=>{const e=[];for(const o in formats)!0!==formats[o].convertGeom3&&!0!==formats[o].convertGeom2||e.push(o);return e},supportedInputExtensions=()=>{const e=[];for(const o in formats)!0===formats[o].deserializable&&e.push(formats[o].extension);return e};module.exports={formats:formats,conversionFormats:conversionFormats,supportedInputExtensions:supportedInputExtensions,supportedOutputExtensions:supportedOutputExtensions,supportedOutputFormats:supportedOutputFormats,supportedFormatsForObjects:supportedFormatsForObjects};
|
|
430
352
|
|
|
431
|
-
},{"@jscad/modeling":
|
|
353
|
+
},{"@jscad/modeling":185}],73:[function(require,module,exports){
|
|
432
354
|
const{makeBlob:makeBlob,convertToBlob:convertToBlob}=require("@jscad/io-utils"),amfSerializer=require("@jscad/amf-serializer"),dxfSerializer=require("@jscad/dxf-serializer"),jsonSerializer=require("@jscad/json-serializer"),stlSerializer=require("@jscad/stl-serializer"),svgSerializer=require("@jscad/svg-serializer"),x3dSerializer=require("@jscad/x3d-serializer"),prepareOutput=require("./prepareOutput"),deserializers=require("./deserializers"),solidsAsBlob=(e,r)=>convertToBlob(prepareOutput(e,r));module.exports={makeBlob:makeBlob,solidsAsBlob:solidsAsBlob,amfSerializer:amfSerializer,dxfSerializer:dxfSerializer,jsonSerializer:jsonSerializer,stlSerializer:stlSerializer,svgSerializer:svgSerializer,x3dSerializer:x3dSerializer,deserializers:deserializers};
|
|
433
355
|
|
|
434
|
-
},{"./deserializers":
|
|
356
|
+
},{"./deserializers":71,"./prepareOutput":74,"@jscad/amf-serializer":53,"@jscad/dxf-serializer":65,"@jscad/io-utils":69,"@jscad/json-serializer":77,"@jscad/stl-serializer":84,"@jscad/svg-serializer":96,"@jscad/x3d-serializer":99}],74:[function(require,module,exports){
|
|
435
357
|
const{toArray:toArray}=require("@jscad/array-utils"),{formats:formats}=require("./formats"),amfSerializer=require("@jscad/amf-serializer"),dxfSerializer=require("@jscad/dxf-serializer"),jsonSerializer=require("@jscad/json-serializer"),stlSerializer=require("@jscad/stl-serializer"),svgSerializer=require("@jscad/svg-serializer"),x3dSerializer=require("@jscad/x3d-serializer"),prepareOutput=(e,r)=>{const i={format:void 0,version:"0.0.0"},{format:a,version:s}=Object.assign({},i,r),t={producer:"JSCAD "+s,date:new Date,version:s},l={amf:amfSerializer,stl:stlSerializer,stla:{mimeType:stlSerializer.mimeType,serialize:(e,r)=>stlSerializer.serialize(Object.assign({},{binary:!1},e),r)},stlb:stlSerializer,dxf:dxfSerializer,svg:svgSerializer,x3d:x3dSerializer,json:jsonSerializer,js:{mimeType:formats.js.mimetype,serialize:(e,r)=>toArray(r)},jscad:{mimeType:formats.jscad.mimetype,serialize:(e,r)=>toArray(r)},undefined:()=>{throw new Error("Not supported : only jscad, stl, amf, dxf, svg or json as output format")}},o=Object.assign({},t,r);return{data:l[a].serialize(o,e),mimeType:l[a].mimeType}};module.exports=prepareOutput;
|
|
436
358
|
|
|
437
|
-
},{"./formats":
|
|
359
|
+
},{"./formats":72,"@jscad/amf-serializer":53,"@jscad/array-utils":483,"@jscad/dxf-serializer":65,"@jscad/json-serializer":77,"@jscad/stl-serializer":84,"@jscad/svg-serializer":96,"@jscad/x3d-serializer":99}],75:[function(require,module,exports){
|
|
438
360
|
const{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),version=require("./package.json").version,deserialize=(e,t)=>{const n={filename:"json",output:"script",version:version,addMetaData:!0};e=Object.assign({},n,e);let r=JSON.parse(t);return r=flatten(toArray(r)),"script"===e.output?translate(e,r):r},translate=(e,t)=>{const{addMetaData:n,filename:r,version:s}=e;let a=n?`//\n// Produced by JSCAD IO Library : JSON Deserializer (${s})\n// date: ${new Date}\n// source: ${r}\n//\n`:"";return a+=`\nconst { geometries } = require('@jscad/modeling')\n\nconst main = () => {\n const objects = [${translateToList(t)} ]\n return objects\n}\n\n${translateToObjects(t)}\n\nmodule.exports = { main }\n`},translateToList=e=>e.reduce((e,t,n)=>e+` json${n},`,""),translateToObjects=e=>e.reduce((e,t,n)=>e+translateToObject(t,n),""),translateToObject=(e,t)=>`const json${t} = ${JSON.stringify(e)}\n`,extension="json";module.exports={deserialize:deserialize,extension:"json"};
|
|
439
361
|
|
|
440
|
-
},{"./package.json":
|
|
362
|
+
},{"./package.json":76,"@jscad/array-utils":483}],76:[function(require,module,exports){
|
|
441
363
|
module.exports={
|
|
442
364
|
"name": "@jscad/json-deserializer",
|
|
443
|
-
"version": "2.0.
|
|
365
|
+
"version": "2.0.9",
|
|
444
366
|
"description": "JSON Deserializer for JSCAD",
|
|
445
367
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
446
368
|
"main": "index.js",
|
|
@@ -470,22 +392,22 @@ module.exports={
|
|
|
470
392
|
"@jscad/array-utils": "2.1.0"
|
|
471
393
|
},
|
|
472
394
|
"devDependencies": {
|
|
473
|
-
"@jscad/modeling": "2.
|
|
395
|
+
"@jscad/modeling": "2.5.3",
|
|
474
396
|
"ava": "3.15.0",
|
|
475
397
|
"nyc": "15.1.0"
|
|
476
398
|
}
|
|
477
399
|
}
|
|
478
400
|
|
|
479
|
-
},{}],
|
|
401
|
+
},{}],77:[function(require,module,exports){
|
|
480
402
|
const{utils:utils}=require("@jscad/modeling"),replacer=(r,s)=>{switch(r){case"transforms":case"plane":return Array.from(s);case"points":case"vertices":return s.map(r=>Array.from(r));case"sides":return s.map(r=>[Array.from(r[0]),Array.from(r[1])])}return s},serialize=(r,...s)=>{r=Object.assign({},{statusCallback:null},r),s=utils.flatten(s),r.statusCallback&&r.statusCallback({progress:0});const e=JSON.stringify(s,replacer);return r.statusCallback&&r.statusCallback({progress:100}),[e]},mimeType="application/json";module.exports={serialize:serialize,mimeType:mimeType};
|
|
481
403
|
|
|
482
|
-
},{"@jscad/modeling":
|
|
404
|
+
},{"@jscad/modeling":185}],78:[function(require,module,exports){
|
|
483
405
|
const{colors:colors,primitives:primitives}=require("@jscad/modeling"),version=require("./package.json").version,deserialize=(e,t)=>{const n={filename:"obj",output:"script",orientation:"outward",version:version,addMetaData:!0};e=Object.assign({},n,e);const{output:s}=e;e&&e.statusCallback&&e.statusCallback({progress:0});const{positions:o,groups:r}=getGroups(t,e),a="script"===s?stringify(o,r,e):objectify(o,r,e);return e&&e.statusCallback&&e.statusCallback({progress:100}),a},getGroups=(e,t)=>{let n=[];const s=[];let o=null;n.push({faces:[],colors:[],name:"default",line:0});const r=(e,t)=>{const s={faces:[],colors:[],name:""};t&&t.length>0&&(s.name=t.join(" ")),n.push(s)},a=(e,t)=>{const n=parseFloat(t[0]),o=parseFloat(t[1]),r=parseFloat(t[2]);s.push([n,o,r])},l=(e,t)=>{const r=t.map(e=>{const t=e.match(/[0-9+\-eE]+/g);let n=parseInt(t[0]);return n<0?n=s.length+n:n--,n}),a=n.pop();a.faces.push(r),a.colors.push(o),n.push(a)},i=(e,t)=>{if(o=null,t&&t.length>0){const e=colors.colorNameToRgb(t[0]);e&&(o=[e[0],e[1],e[2],1])}},c=e.split(/\n/);for(let e=0;e<c.length;e++){const t=c[e].trim();if(t&&t.length>0){let e=t.match(/\S+/g);if(e){const t=e[0];switch(e=e.slice(1),t){case"g":r(0,e);break;case"v":a(0,e);break;case"f":l(0,e);break;case"usemtl":i(0,e)}}}}return n=n.filter(e=>e.faces.length>0),{positions:s,groups:n}},objectify=(e,t,n)=>{return t.map(t=>primitives.polyhedron({orientation:n.orientation,points:e,faces:t.faces,colors:t.colors}))},translatePoints=e=>{let t=" let points = [\n";return e.forEach(e=>t+=` [${e}],\n`),t+=" ]"},translateFaces=e=>{let t=" let faces = [\n";return e.forEach(e=>t+=` [${e}],\n`),t+=" ]"},translateColors=e=>{let t=" let colors = [\n";return e.forEach(e=>{t+=e?` [${e}],\n`:" null,\n"}),t+=" ]"},translateGroupsToCalls=e=>{let t="";return e.forEach((e,n)=>t+=` group${n}(points), // ${e.name}\n`),t},translateGroupsToFunctions=(e,t)=>{let n="";return e.forEach((e,s)=>{const o=e.faces,r=e.colors;n+=`\n// group : ${e.name}\n// faces: ${o.length}\n`,n+=`const group${s} = (points) => {\n${translateFaces(o)}\n${translateColors(r)}\n return primitives.polyhedron({ orientation: '${t.orientation}', points, faces, colors })\n}\n`}),n},stringify=(e,t,n)=>{const{filename:s,addMetaData:o,version:r}=n;let a=o?`//\n// Produced by JSCAD IO Library : OBJ Deserializer (${r})\n// date: ${new Date}\n// source: ${s}\n//\n `:"";return a+=`const {primitives} = require('@jscad/modeling')\n\n// groups: ${t.length}\n// points: ${e.length}\nconst main = () => {\n // points are common to all geometries\n${translatePoints(e)}\n\n let geometries = [\n${translateGroupsToCalls(t)} ]\n return geometries\n}\n\n${translateGroupsToFunctions(t,n)}\nmodule.exports = {main}\n`},extension="obj";module.exports={deserialize:deserialize,extension:"obj"};
|
|
484
406
|
|
|
485
|
-
},{"./package.json":
|
|
407
|
+
},{"./package.json":79,"@jscad/modeling":185}],79:[function(require,module,exports){
|
|
486
408
|
module.exports={
|
|
487
409
|
"name": "@jscad/obj-deserializer",
|
|
488
|
-
"version": "2.0.
|
|
410
|
+
"version": "2.0.8",
|
|
489
411
|
"description": "OBJ Deserializer for JSCAD",
|
|
490
412
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
491
413
|
"main": "index.js",
|
|
@@ -516,7 +438,7 @@ module.exports={
|
|
|
516
438
|
],
|
|
517
439
|
"license": "MIT",
|
|
518
440
|
"dependencies": {
|
|
519
|
-
"@jscad/modeling": "2.
|
|
441
|
+
"@jscad/modeling": "2.5.3"
|
|
520
442
|
},
|
|
521
443
|
"devDependencies": {
|
|
522
444
|
"ava": "3.15.0",
|
|
@@ -524,13 +446,13 @@ module.exports={
|
|
|
524
446
|
}
|
|
525
447
|
}
|
|
526
448
|
|
|
527
|
-
},{}],
|
|
449
|
+
},{}],80:[function(require,module,exports){
|
|
528
450
|
const{maths:maths,primitives:primitives}=require("@jscad/modeling"),{BinaryReader:BinaryReader}=require("@jscad/io-utils"),packageVersion=require("./package.json").version,deserialize=(e,s)=>{const t={filename:"stl",version:packageVersion,addMetaData:!0,output:"script"};(e=Object.assign({},t,e))&&e.statusCallback&&e.statusCallback({progress:0});const{filename:r,version:a,output:n,addMetaData:o}=e;s=isBuffer(s)?bufferToBinaryString(s):s;const l=isDataBinaryRobust(s);e&&e.statusCallback&&e.statusCallback({progress:33});e&&e.statusCallback&&e.statusCallback({progress:66});const i=("script"===n?formatAsJscad:formatAsCsg)((l?deserializeBinarySTL:deserializeAsciiSTL)(s,r,a,"script"===n?({vertices:e,triangles:s,normals:t,colors:r,index:a})=>toScript(e,s,null,r,a):({vertices:e,triangles:s,normals:t,colors:r})=>toPolyhedron(e,s,null,r)),o,a,r);return e&&e.statusCallback&&e.statusCallback({progress:100}),i},bufferToBinaryString=e=>{let s="";const t=new Uint8Array(e),r=t.byteLength;for(let e=0;e<r;e++)s+=String.fromCharCode(t[e]);return s},isBuffer=e=>void 0!==e.byteLength&&"function"==typeof e.slice,ensureString=e=>{if("string"!=typeof e){const s=new Uint8Array(e);let t="";for(let r=0;r<e.byteLength;r++)t+=String.fromCharCode(s[r]);return t}return e},isDataBinaryRobust=e=>{const s=ensureString(e);return null===/vertex[\s]+([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+[\s]+([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)+/g.exec(s)},formatAsJscad=(e,s,t,r)=>{let a="";return s&&(a=`\n //\n // producer: JSCAD STL Deserializer ${t}\n // date: ${new Date}\n // source: ${r}\n // objects: ${e.length}\n //\n `),a+="const {primitives} = require('@jscad/modeling')\n",a+=e.join("\n"),a+=`\nconst main = () => {\n return [${e.map((e,s)=>`solid${s+1}()`)}]\n}\n\nmodule.exports = {main}\n`},formatAsCsg=e=>e,deserializeBinarySTL=(e,s,t,r)=>{const a=[],n=[],o=[],l=[];let i=0,c=0,u=null;const p=parseInt("01000000000000000",2),h=parseInt("00000000000011111",2),d=parseInt("00000001111100000",2),g=parseInt("00111110000000000",2),m=new BinaryReader(e);let f=0,v=0,b=0,S=0,F=0,y=0;for(let e=0;e<80;e++)switch(f){case 6:b=m.readUInt8(),f+=1;continue;case 7:S=m.readUInt8(),f+=1;continue;case 8:F=m.readUInt8(),f+=1;continue;case 9:y=m.readUInt8(),f+=1;continue;default:switch(v=m.readChar()){case"C":case"O":case"L":case"R":case"=":f+=1}}10===f&&(u=[b/255,S/255,F/255,y/255]);const C=m.readUInt32();for(let e=0;e<C;e++){const e=[];e.push(m.readFloat()),e.push(m.readFloat()),e.push(m.readFloat());let s=[];s.push(m.readFloat()),s.push(m.readFloat()),s.push(m.readFloat());const t=[];t.push(m.readFloat()),t.push(m.readFloat()),t.push(m.readFloat());let r=[];r.push(m.readFloat()),r.push(m.readFloat()),r.push(m.readFloat());let v=0;for(let a=0;a<3;a++)isNaN(s[a])&&v++,isNaN(t[a])&&v++,isNaN(r[a])&&v++,isNaN(e[a])&&v++;v>0&&console.log("bad triangle vertice coords/normal: ",v),c+=v;const b=[];b.push(i++),b.push(i++),b.push(i++);const S=m.readUInt16();let F=null;if(10===f){const e=(S&h)/31,s=((S&d)>>>5)/31,t=((S&g)>>>10)/31,r=255;F=0===(S&p)?[e,s,t,r]:u,l.push(F)}if(0===v){const a=maths.vec3.subtract(maths.vec3.create(),t,s),n=maths.vec3.subtract(maths.vec3.create(),r,s),o=maths.vec3.cross(maths.vec3.create(),a,n);if(maths.vec3.dot(e,o)>0){const e=r;r=s,s=e}}a.push(s),a.push(t),a.push(r),n.push(b),o.push(e)}return c&&console.warn(`WARNING: import errors: ${c} (some triangles might be misaligned or missing)`),[r({vertices:a,triangles:n,normals:o,colors:l,index:1})]},deserializeAsciiSTL=(e,s,t,r)=>{let a=0;const n=e.split("endsolid"),o=[];for(let s=1;s<n.length;s++){const t=/\bfacet[\s\S]*?endloop/gim,n=[],l=[],i=[],c=[];let u=0,p=0;const h=e.match(t);if(null!=h){for(let e=0;e<h.length;e++){const s=/\bfacet\s+normal\s+(\S+)\s+(\S+)\s+(\S+)\s+outer\s+loop\s+vertex\s+(\S+)\s+(\S+)\s+(\S+)\s+vertex\s+(\S+)\s+(\S+)\s+(\S+)\s+vertex\s+(\S+)\s+(\S+)\s+(\S+)\s*/gim.exec(h[e]);if(null==s)continue;if(13!==s.length){console.log("Failed to parse "+h[e]);break}let t=0;for(let e=0;e<s.length;e++)"NaN"===s[e]&&(console.log("bad normal or triangle vertice #"+a+" "+e+": '"+s[e]+"', skipped"),t++);if(p+=t,t)continue;let r=1;const o=[];o.push(parseFloat(s[r++])),o.push(parseFloat(s[r++])),o.push(parseFloat(s[r++]));let c=[];c.push(parseFloat(s[r++])),c.push(parseFloat(s[r++])),c.push(parseFloat(s[r++]));const d=[];d.push(parseFloat(s[r++])),d.push(parseFloat(s[r++])),d.push(parseFloat(s[r++]));let g=[];g.push(parseFloat(s[r++])),g.push(parseFloat(s[r++])),g.push(parseFloat(s[r++]));const m=[];if(m.push(u++),m.push(u++),m.push(u++),0===t){const e=maths.vec3.subtract(maths.vec3.create(),d,c),s=maths.vec3.subtract(maths.vec3.create(),g,c),t=maths.vec3.cross(maths.vec3.create(),e,s);if(maths.vec3.dot(o,t)>0){const e=g;g=c,c=e}}n.push(c),n.push(d),n.push(g),i.push(o),l.push(m),a++}p&&console.warn(`WARNING: import errors: ${p} (some triangles might be misaligned or missing)`),o.push(r({vertices:n,triangles:l,colors:c,index:s}))}}return o},toPolyhedron=(e,s,t,r)=>{r&&s.length!==r.length&&(r=void 0);const a={orientation:"inward",points:e,faces:s,colors:r};return primitives.polyhedron(a)},toScript=(e,s,t,r,a)=>{let n=`\n//\n// solid ${a} : ${e.length} points, ${s.length} faces, ${r.length} colors\n//\nconst solid${a} = () => {\n`;n+=" const points = [\n";for(let s=0;s<e.length;s++)n+=` [${e[s]}],\n`;n+=" ]\n",n+=" const faces = [\n";for(let e=0;e<s.length;e++)n+=` [${s[e]}],\n`;if(n+=" ]\n",r&&s.length===r.length){n+=" const colors = [\n";for(let e=0;e<r.length;e++)n+=` [${r[e]}],\n`;n+=" ]\n"}else n+=" const colors = null\n";return n+=" return primitives.polyhedron({points, faces, colors, orientation: 'inside'})\n}\n"},extension="stl";module.exports={deserialize:deserialize,extension:"stl"};
|
|
529
451
|
|
|
530
|
-
},{"./package.json":
|
|
452
|
+
},{"./package.json":81,"@jscad/io-utils":69,"@jscad/modeling":185}],81:[function(require,module,exports){
|
|
531
453
|
module.exports={
|
|
532
454
|
"name": "@jscad/stl-deserializer",
|
|
533
|
-
"version": "2.1.
|
|
455
|
+
"version": "2.1.5",
|
|
534
456
|
"description": "STL Deserializer for JSCAD",
|
|
535
457
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
536
458
|
"main": "index.js",
|
|
@@ -561,8 +483,8 @@ module.exports={
|
|
|
561
483
|
],
|
|
562
484
|
"license": "MIT",
|
|
563
485
|
"dependencies": {
|
|
564
|
-
"@jscad/io-utils": "2.0.
|
|
565
|
-
"@jscad/modeling": "2.
|
|
486
|
+
"@jscad/io-utils": "2.0.8",
|
|
487
|
+
"@jscad/modeling": "2.5.3"
|
|
566
488
|
},
|
|
567
489
|
"devDependencies": {
|
|
568
490
|
"ava": "3.15.0",
|
|
@@ -570,36 +492,34 @@ module.exports={
|
|
|
570
492
|
}
|
|
571
493
|
}
|
|
572
494
|
|
|
573
|
-
},{}],
|
|
495
|
+
},{}],82:[function(require,module,exports){
|
|
574
496
|
const{geometries:geometries}=require("@jscad/modeling"),serializeText=(t,e)=>{e.statusCallback&&e.statusCallback({progress:0});const o=`solid JSCAD\n${convertToStl(t,e)}\nendsolid JSCAD\n`;return e.statusCallback&&e.statusCallback({progress:100}),[o]},convertToStl=(t,e)=>{const o=[];return t.forEach((r,n)=>{o.push(convertToFacets(r,e)),e.statusCallback&&e.statusCallback({progress:100*n/t.length})}),o.join("\n")},convertToFacets=(t,e)=>{const o=[];return geometries.geom3.toPolygons(t).forEach((t,e)=>{o.push(convertToFacet(t))}),o.join("\n")},vector3DtoStlString=t=>`${t[0]} ${t[1]} ${t[2]}`,vertextoStlString=t=>`vertex ${vector3DtoStlString(t)}`,convertToFacet=t=>{const e=[];if(t.vertices.length>=3){const o=vertextoStlString(t.vertices[0]);for(let r=0;r<t.vertices.length-2;r++){const n=`facet normal ${vector3DtoStlString(geometries.poly3.plane(t))}\nouter loop\n${o}\n${vertextoStlString(t.vertices[r+1])}\n${vertextoStlString(t.vertices[r+2])}\nendloop\nendfacet`;e.push(n)}}return e.join("\n")};module.exports={serializeText:serializeText};
|
|
575
497
|
|
|
576
|
-
},{"@jscad/modeling":
|
|
498
|
+
},{"@jscad/modeling":185}],83:[function(require,module,exports){
|
|
577
499
|
const{geometries:geometries}=require("@jscad/modeling"),serializeBinary=(e,r)=>{r.statusCallback&&r.statusCallback({progress:0});const t=new ArrayBuffer(4),s=new Int32Array(t,0,1),a=new Int8Array(t,0,4);if(s[0]=287454020,68!==a[0])throw new Error("Binary STL output is currently only supported on little-endian (Intel) processors");let n=0,o=0;e.forEach((e,r)=>{geometries.geom3.toPolygons(e).forEach(e=>{const r=e.vertices.length;n+=r>=3?r-2:0,o+=1})});const l=new Uint8Array(80);for(let e=0;e<80;e++)l[e]=65;const i=new Uint32Array(1);i[0]=n;const c=new ArrayBuffer(50*n),y=new Int8Array(c),f=new ArrayBuffer(50),u=new Int8Array(f),g=new Float32Array(f,0,12),w=new Uint16Array(f,48,1);let A=0;return e.forEach(e=>{geometries.geom3.toPolygons(e).forEach((e,t)=>{const s=e.vertices,a=s.length,n=geometries.poly3.plane(e);for(let e=0;e<a-2;e++){g[0]=n[0],g[1]=n[1],g[2]=n[2];let r=3;for(let t=0;t<3;t++){const a=s[t+(t>0?e:0)];g[r++]=a[0],g[r++]=a[1],g[r++]=a[2]}w[0]=0,y.set(u,A),A+=50}r.statusCallback&&r.statusCallback({progress:100*t/o})})}),r.statusCallback&&r.statusCallback({progress:100}),[l.buffer,i.buffer,c]};module.exports={serializeBinary:serializeBinary};
|
|
578
500
|
|
|
579
|
-
},{"@jscad/modeling":
|
|
501
|
+
},{"@jscad/modeling":185}],84:[function(require,module,exports){
|
|
580
502
|
const{geometries:geometries,modifiers:modifiers}=require("@jscad/modeling"),{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),{serializeBinary:serializeBinary}=require("./CSGToStlb"),{serializeText:serializeText}=require("./CSGToStla"),mimeType="application/sla",serialize=(e,...i)=>{e=Object.assign({},{binary:!0,statusCallback:null},e);let r=(i=flatten(i)).filter(e=>geometries.geom3.isA(e));if(0===r.length)throw new Error("only 3D geometries can be serialized to STL");return i.length!==r.length&&console.warn("some objects could not be serialized to STL"),r=toArray(modifiers.generalize({snap:!0,triangulate:!0},r)),e.binary?serializeBinary(r,e):serializeText(r,e)};module.exports={mimeType:mimeType,serialize:serialize};
|
|
581
503
|
|
|
582
|
-
},{"./CSGToStla":
|
|
583
|
-
|
|
504
|
+
},{"./CSGToStla":82,"./CSGToStlb":83,"@jscad/array-utils":483,"@jscad/modeling":185}],85:[function(require,module,exports){
|
|
505
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHAR="\t\n\r --�𐀀-",exports.S=" \t\r\n",exports.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NAME_CHAR="-"+exports.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.CHAR_RE=new RegExp("^["+exports.CHAR+"]$","u"),exports.S_RE=new RegExp("^["+exports.S+"]+$","u"),exports.NAME_START_CHAR_RE=new RegExp("^["+exports.NAME_START_CHAR+"]$","u"),exports.NAME_CHAR_RE=new RegExp("^["+exports.NAME_CHAR+"]$","u"),exports.NAME_RE=new RegExp("^["+exports.NAME_START_CHAR+"]["+exports.NAME_CHAR+"]*$","u"),exports.NMTOKEN_RE=new RegExp("^["+exports.NAME_CHAR+"]+$","u");var TAB=9,NL=10,CR=13,SPACE=32;function isChar(e){return e>=SPACE&&e<=55295||e===NL||e===CR||e===TAB||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isS(e){return e===SPACE||e===NL||e===CR||e===TAB}function isNameStartChar(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNameChar(e){return isNameStartChar(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}exports.S_LIST=[SPACE,NL,CR,TAB],exports.isChar=isChar,exports.isS=isS,exports.isNameStartChar=isNameStartChar,exports.isNameChar=isNameChar;
|
|
584
506
|
|
|
585
|
-
},{}],
|
|
586
|
-
|
|
507
|
+
},{}],86:[function(require,module,exports){
|
|
508
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHAR="--�𐀀-",exports.RESTRICTED_CHAR="-\b\v\f---",exports.S=" \t\r\n",exports.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NAME_CHAR="-"+exports.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.CHAR_RE=new RegExp("^["+exports.CHAR+"]$","u"),exports.RESTRICTED_CHAR_RE=new RegExp("^["+exports.RESTRICTED_CHAR+"]$","u"),exports.S_RE=new RegExp("^["+exports.S+"]+$","u"),exports.NAME_START_CHAR_RE=new RegExp("^["+exports.NAME_START_CHAR+"]$","u"),exports.NAME_CHAR_RE=new RegExp("^["+exports.NAME_CHAR+"]$","u"),exports.NAME_RE=new RegExp("^["+exports.NAME_START_CHAR+"]["+exports.NAME_CHAR+"]*$","u"),exports.NMTOKEN_RE=new RegExp("^["+exports.NAME_CHAR+"]+$","u");var TAB=9,NL=10,CR=13,SPACE=32;function isChar(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isRestrictedChar(e){return e>=1&&e<=8||11===e||12===e||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}function isCharAndNotRestricted(e){return 9===e||10===e||13===e||e>31&&e<127||133===e||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function isS(e){return e===SPACE||e===NL||e===CR||e===TAB}function isNameStartChar(e){return e>=65&&e<=90||e>=97&&e<=122||58===e||95===e||8204===e||8205===e||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNameChar(e){return isNameStartChar(e)||e>=48&&e<=57||45===e||46===e||183===e||e>=768&&e<=879||e>=8255&&e<=8256}exports.S_LIST=[SPACE,NL,CR,TAB],exports.isChar=isChar,exports.isRestrictedChar=isRestrictedChar,exports.isCharAndNotRestricted=isCharAndNotRestricted,exports.isS=isS,exports.isNameStartChar=isNameStartChar,exports.isNameChar=isNameChar;
|
|
587
509
|
|
|
588
|
-
},{
|
|
589
|
-
|
|
510
|
+
},{}],87:[function(require,module,exports){
|
|
511
|
+
"use strict";function isNCNameStartChar(e){return e>=65&&e<=90||95===e||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function isNCNameChar(e){return isNCNameStartChar(e)||45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}Object.defineProperty(exports,"__esModule",{value:!0}),exports.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-",exports.NC_NAME_CHAR="-"+exports.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",exports.NC_NAME_START_CHAR_RE=new RegExp("^["+exports.NC_NAME_START_CHAR+"]$","u"),exports.NC_NAME_CHAR_RE=new RegExp("^["+exports.NC_NAME_CHAR+"]$","u"),exports.NC_NAME_RE=new RegExp("^["+exports.NC_NAME_START_CHAR+"]["+exports.NC_NAME_CHAR+"]*$","u"),exports.isNCNameStartChar=isNCNameStartChar,exports.isNCNameChar=isNCNameChar;
|
|
590
512
|
|
|
591
|
-
},{
|
|
592
|
-
(function (Buffer){(function (){
|
|
593
|
-
!function(t){t.parser=function(t,e){return new s(t,e)},t.SAXParser=s,t.SAXStream=n,t.createStream=function(t,e){return new n(t,e)},t.MAX_BUFFER_LENGTH=65536;var e,i=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(e,a){if(!(this instanceof s))return new s(e,a);!function(t){for(var e=0,s=i.length;e<s;e++)t[i[e]]=""}(this),this.q=this.c="",this.bufferCheckPosition=t.MAX_BUFFER_LENGTH,this.opt=a||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!e,this.noscript=!(!e&&!this.opt.noscript),this.state=D.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(h)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),C(this,"onready")}t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(t){function e(){}return e.prototype=t,new e}),Object.keys||(Object.keys=function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(i);return e}),s.prototype={end:function(){v(this)},write:function(e){if(this.error)throw this.error;if(this.closed)return R(this,"Cannot write after close. Assign an onready handler.");if(null===e)return v(this);"object"==typeof e&&(e=e.toString());var s=0,a="";for(;a=M(e,s++),this.c=a,a;)switch(this.trackPosition&&(this.position++,"\n"===a?(this.line++,this.column=0):this.column++),this.state){case D.BEGIN:if(this.state=D.BEGIN_WHITESPACE,"\ufeff"===a)continue;G(this,a);continue;case D.BEGIN_WHITESPACE:G(this,a);continue;case D.TEXT:if(this.sawRoot&&!this.closedRoot){for(var n=s-1;a&&"<"!==a&&"&"!==a;)(a=M(e,s++))&&this.trackPosition&&(this.position++,"\n"===a?(this.line++,this.column=0):this.column++);this.textNode+=e.substring(n,s-1)}"<"!==a||this.sawRoot&&this.closedRoot&&!this.strict?(m(a)||this.sawRoot&&!this.closedRoot||P(this,"Text data outside of root node."),"&"===a?this.state=D.TEXT_ENTITY:this.textNode+=a):(this.state=D.OPEN_WAKA,this.startTagPosition=this.position);continue;case D.SCRIPT:"<"===a?this.state=D.SCRIPT_ENDING:this.script+=a;continue;case D.SCRIPT_ENDING:"/"===a?this.state=D.CLOSE_TAG:(this.script+="<"+a,this.state=D.SCRIPT);continue;case D.OPEN_WAKA:if("!"===a)this.state=D.SGML_DECL,this.sgmlDecl="";else if(m(a));else if(_(l,a))this.state=D.OPEN_TAG,this.tagName=a;else if("/"===a)this.state=D.CLOSE_TAG,this.tagName="";else if("?"===a)this.state=D.PROC_INST,this.procInstName=this.procInstBody="";else{if(P(this,"Unencoded <"),this.startTagPosition+1<this.position){var c=this.position-this.startTagPosition;a=new Array(c).join(" ")+a}this.textNode+="<"+a,this.state=D.TEXT}continue;case D.SGML_DECL:(this.sgmlDecl+a).toUpperCase()===r?(O(this,"onopencdata"),this.state=D.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+a==="--"?(this.state=D.COMMENT,this.comment="",this.sgmlDecl=""):(this.sgmlDecl+a).toUpperCase()===o?(this.state=D.DOCTYPE,(this.doctype||this.sawRoot)&&P(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===a?(O(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=D.TEXT):N(a)?(this.state=D.SGML_DECL_QUOTED,this.sgmlDecl+=a):this.sgmlDecl+=a;continue;case D.SGML_DECL_QUOTED:a===this.q&&(this.state=D.SGML_DECL,this.q=""),this.sgmlDecl+=a;continue;case D.DOCTYPE:">"===a?(this.state=D.TEXT,O(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=a,"["===a?this.state=D.DOCTYPE_DTD:N(a)&&(this.state=D.DOCTYPE_QUOTED,this.q=a));continue;case D.DOCTYPE_QUOTED:this.doctype+=a,a===this.q&&(this.q="",this.state=D.DOCTYPE);continue;case D.DOCTYPE_DTD:this.doctype+=a,"]"===a?this.state=D.DOCTYPE:N(a)&&(this.state=D.DOCTYPE_DTD_QUOTED,this.q=a);continue;case D.DOCTYPE_DTD_QUOTED:this.doctype+=a,a===this.q&&(this.state=D.DOCTYPE_DTD,this.q="");continue;case D.COMMENT:"-"===a?this.state=D.COMMENT_ENDING:this.comment+=a;continue;case D.COMMENT_ENDING:"-"===a?(this.state=D.COMMENT_ENDED,this.comment=S(this.opt,this.comment),this.comment&&O(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+a,this.state=D.COMMENT);continue;case D.COMMENT_ENDED:">"!==a?(P(this,"Malformed comment"),this.comment+="--"+a,this.state=D.COMMENT):this.state=D.TEXT;continue;case D.CDATA:"]"===a?this.state=D.CDATA_ENDING:this.cdata+=a;continue;case D.CDATA_ENDING:"]"===a?this.state=D.CDATA_ENDING_2:(this.cdata+="]"+a,this.state=D.CDATA);continue;case D.CDATA_ENDING_2:">"===a?(this.cdata&&O(this,"oncdata",this.cdata),O(this,"onclosecdata"),this.cdata="",this.state=D.TEXT):"]"===a?this.cdata+="]":(this.cdata+="]]"+a,this.state=D.CDATA);continue;case D.PROC_INST:"?"===a?this.state=D.PROC_INST_ENDING:m(a)?this.state=D.PROC_INST_BODY:this.procInstName+=a;continue;case D.PROC_INST_BODY:if(!this.procInstBody&&m(a))continue;"?"===a?this.state=D.PROC_INST_ENDING:this.procInstBody+=a;continue;case D.PROC_INST_ENDING:">"===a?(O(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=D.TEXT):(this.procInstBody+="?"+a,this.state=D.PROC_INST_BODY);continue;case D.OPEN_TAG:_(T,a)?this.tagName+=a:(y(this),">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:(m(a)||P(this,"Invalid character in tag name"),this.state=D.ATTRIB));continue;case D.OPEN_TAG_SLASH:">"===a?(U(this,!0),x(this)):(P(this,"Forward-slash in opening tag not followed by >"),this.state=D.ATTRIB);continue;case D.ATTRIB:if(m(a))continue;">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:_(l,a)?(this.attribName=a,this.attribValue="",this.state=D.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case D.ATTRIB_NAME:"="===a?this.state=D.ATTRIB_VALUE:">"===a?(P(this,"Attribute without value"),this.attribValue=this.attribName,B(this),U(this)):m(a)?this.state=D.ATTRIB_NAME_SAW_WHITE:_(T,a)?this.attribName+=a:P(this,"Invalid attribute name");continue;case D.ATTRIB_NAME_SAW_WHITE:if("="===a)this.state=D.ATTRIB_VALUE;else{if(m(a))continue;P(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",O(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===a?U(this):_(l,a)?(this.attribName=a,this.state=D.ATTRIB_NAME):(P(this,"Invalid attribute name"),this.state=D.ATTRIB)}continue;case D.ATTRIB_VALUE:if(m(a))continue;N(a)?(this.q=a,this.state=D.ATTRIB_VALUE_QUOTED):(P(this,"Unquoted attribute value"),this.state=D.ATTRIB_VALUE_UNQUOTED,this.attribValue=a);continue;case D.ATTRIB_VALUE_QUOTED:if(a!==this.q){"&"===a?this.state=D.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=a;continue}B(this),this.q="",this.state=D.ATTRIB_VALUE_CLOSED;continue;case D.ATTRIB_VALUE_CLOSED:m(a)?this.state=D.ATTRIB:">"===a?U(this):"/"===a?this.state=D.OPEN_TAG_SLASH:_(l,a)?(P(this,"No whitespace between attributes"),this.attribName=a,this.attribValue="",this.state=D.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case D.ATTRIB_VALUE_UNQUOTED:if(!f(a)){"&"===a?this.state=D.ATTRIB_VALUE_ENTITY_U:this.attribValue+=a;continue}B(this),">"===a?U(this):this.state=D.ATTRIB;continue;case D.CLOSE_TAG:if(this.tagName)">"===a?x(this):_(T,a)?this.tagName+=a:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=D.SCRIPT):(m(a)||P(this,"Invalid tagname in closing tag"),this.state=D.CLOSE_TAG_SAW_WHITE);else{if(m(a))continue;d(l,a)?this.script?(this.script+="</"+a,this.state=D.SCRIPT):P(this,"Invalid tagname in closing tag."):this.tagName=a}continue;case D.CLOSE_TAG_SAW_WHITE:if(m(a))continue;">"===a?x(this):P(this,"Invalid characters in closing tag");continue;case D.TEXT_ENTITY:case D.ATTRIB_VALUE_ENTITY_Q:case D.ATTRIB_VALUE_ENTITY_U:var u,h;switch(this.state){case D.TEXT_ENTITY:u=D.TEXT,h="textNode";break;case D.ATTRIB_VALUE_ENTITY_Q:u=D.ATTRIB_VALUE_QUOTED,h="attribValue";break;case D.ATTRIB_VALUE_ENTITY_U:u=D.ATTRIB_VALUE_UNQUOTED,h="attribValue"}";"===a?(this[h]+=w(this),this.entity="",this.state=u):_(this.entity.length?p:E,a)?this.entity+=a:(P(this,"Invalid character in entity name"),this[h]+="&"+this.entity+a,this.entity="",this.state=u);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(e){for(var s=Math.max(t.MAX_BUFFER_LENGTH,10),a=0,n=0,r=i.length;n<r;n++){var o=e[i[n]].length;if(o>s)switch(i[n]){case"textNode":F(e);break;case"cdata":O(e,"oncdata",e.cdata),e.cdata="";break;case"script":O(e,"onscript",e.script),e.script="";break;default:R(e,"Max buffer length exceeded: "+i[n])}a=Math.max(a,o)}var c=t.MAX_BUFFER_LENGTH-a;e.bufferCheckPosition=c+e.position}(this);return this},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;F(t=this),""!==t.cdata&&(O(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(O(t,"onscript",t.script),t.script="")}};try{e=require("stream").Stream}catch(t){e=function(){}}var a=t.EVENTS.filter(function(t){return"error"!==t&&"end"!==t});function n(t,i){if(!(this instanceof n))return new n(t,i);e.apply(this),this._parser=new s(t,i),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(t){r.emit("error",t),r._parser.error=null},this._decoder=null,a.forEach(function(t){Object.defineProperty(r,"on"+t,{get:function(){return r._parser["on"+t]},set:function(e){if(!e)return r.removeAllListeners(t),r._parser["on"+t]=e,e;r.on(t,e)},enumerable:!0,configurable:!1})})}n.prototype=Object.create(e.prototype,{constructor:{value:n}}),n.prototype.write=function(t){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(t)){if(!this._decoder){var e=require("string_decoder").StringDecoder;this._decoder=new e("utf8")}t=this._decoder.write(t)}return this._parser.write(t.toString()),this.emit("data",t),!0},n.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},n.prototype.on=function(t,i){var s=this;return s._parser["on"+t]||-1===a.indexOf(t)||(s._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),s.emit.apply(s,e)}),e.prototype.on.call(s,t,i)};var r="[CDATA[",o="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",u="http://www.w3.org/2000/xmlns/",h={xml:c,xmlns:u},l=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function m(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function N(t){return'"'===t||"'"===t}function f(t){return">"===t||m(t)}function _(t,e){return t.test(e)}function d(t,e){return!_(t,e)}var g,A,I,D=0;for(var b in t.STATE={BEGIN:D++,BEGIN_WHITESPACE:D++,TEXT:D++,TEXT_ENTITY:D++,OPEN_WAKA:D++,SGML_DECL:D++,SGML_DECL_QUOTED:D++,DOCTYPE:D++,DOCTYPE_QUOTED:D++,DOCTYPE_DTD:D++,DOCTYPE_DTD_QUOTED:D++,COMMENT_STARTING:D++,COMMENT:D++,COMMENT_ENDING:D++,COMMENT_ENDED:D++,CDATA:D++,CDATA_ENDING:D++,CDATA_ENDING_2:D++,PROC_INST:D++,PROC_INST_BODY:D++,PROC_INST_ENDING:D++,OPEN_TAG:D++,OPEN_TAG_SLASH:D++,ATTRIB:D++,ATTRIB_NAME:D++,ATTRIB_NAME_SAW_WHITE:D++,ATTRIB_VALUE:D++,ATTRIB_VALUE_QUOTED:D++,ATTRIB_VALUE_CLOSED:D++,ATTRIB_VALUE_UNQUOTED:D++,ATTRIB_VALUE_ENTITY_Q:D++,ATTRIB_VALUE_ENTITY_U:D++,CLOSE_TAG:D++,CLOSE_TAG_SAW_WHITE:D++,SCRIPT:D++,SCRIPT_ENDING:D++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(e){var i=t.ENTITIES[e],s="number"==typeof i?String.fromCharCode(i):i;t.ENTITIES[e]=s}),t.STATE)t.STATE[t.STATE[b]]=b;function C(t,e,i){t[e]&&t[e](i)}function O(t,e,i){t.textNode&&F(t),C(t,e,i)}function F(t){t.textNode=S(t.opt,t.textNode),t.textNode&&C(t,"ontext",t.textNode),t.textNode=""}function S(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function R(t,e){return F(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,C(t,"onerror",e),t}function v(t){return t.sawRoot&&!t.closedRoot&&P(t,"Unclosed root tag"),t.state!==D.BEGIN&&t.state!==D.BEGIN_WHITESPACE&&t.state!==D.TEXT&&R(t,"Unexpected end"),F(t),t.c="",t.closed=!0,C(t,"onend"),s.call(t,t.strict,t.opt),t}function P(t,e){if("object"!=typeof t||!(t instanceof s))throw new Error("bad call to strictFail");t.strict&&R(t,e)}function y(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,i=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(i.ns=e.ns),t.attribList.length=0,O(t,"onopentagstart",i)}function L(t,e){var i=t.indexOf(":")<0?["",t]:t.split(":"),s=i[0],a=i[1];return e&&"xmlns"===t&&(s="xmlns",a=""),{prefix:s,local:a}}function B(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=L(t.attribName,!0),i=e.prefix,s=e.local;if("xmlns"===i)if("xml"===s&&t.attribValue!==c)P(t,"xml: prefix must be bound to "+c+"\nActual: "+t.attribValue);else if("xmlns"===s&&t.attribValue!==u)P(t,"xmlns: prefix must be bound to "+u+"\nActual: "+t.attribValue);else{var a=t.tag,n=t.tags[t.tags.length-1]||t;a.ns===n.ns&&(a.ns=Object.create(n.ns)),a.ns[s]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,O(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function U(t,e){if(t.opt.xmlns){var i=t.tag,s=L(t.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(P(t,"Unbound namespace prefix: "+JSON.stringify(t.tagName)),i.uri=s.prefix);var a=t.tags[t.tags.length-1]||t;i.ns&&a.ns!==i.ns&&Object.keys(i.ns).forEach(function(e){O(t,"onopennamespace",{prefix:e,uri:i.ns[e]})});for(var n=0,r=t.attribList.length;n<r;n++){var o=t.attribList[n],c=o[0],u=o[1],h=L(c,!0),l=h.prefix,T=h.local,E=""===l?"":i.ns[l]||"",p={name:c,value:u,prefix:l,local:T,uri:E};l&&"xmlns"!==l&&!E&&(P(t,"Unbound namespace prefix: "+JSON.stringify(l)),p.uri=l),t.tag.attributes[c]=p,O(t,"onattribute",p)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),O(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=D.TEXT:t.state=D.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function x(t){if(!t.tagName)return P(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=D.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=D.SCRIPT);O(t,"onscript",t.script),t.script=""}var e=t.tags.length,i=t.tagName;t.strict||(i=i[t.looseCase]());for(var s=i;e--;){if(t.tags[e].name===s)break;P(t,"Unexpected close tag")}if(e<0)return P(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=D.TEXT);t.tagName=i;for(var a=t.tags.length;a-- >e;){var n=t.tag=t.tags.pop();t.tagName=t.tag.name,O(t,"onclosetag",t.tagName);var r={};for(var o in n.ns)r[o]=n.ns[o];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&n.ns!==c.ns&&Object.keys(n.ns).forEach(function(e){var i=n.ns[e];O(t,"onclosenamespace",{prefix:e,uri:i})})}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=D.TEXT}function w(t){var e,i=t.entity,s=i.toLowerCase(),a="";return t.ENTITIES[i]?t.ENTITIES[i]:t.ENTITIES[s]?t.ENTITIES[s]:("#"===(i=s).charAt(0)&&("x"===i.charAt(1)?(i=i.slice(2),a=(e=parseInt(i,16)).toString(16)):(i=i.slice(1),a=(e=parseInt(i,10)).toString(10))),i=i.replace(/^0+/,""),isNaN(e)||a.toLowerCase()!==i?(P(t,"Invalid character entity"),"&"+t.entity+";"):String.fromCodePoint(e))}function G(t,e){"<"===e?(t.state=D.OPEN_WAKA,t.startTagPosition=t.position):m(e)||(P(t,"Non-whitespace before first tag."),t.textNode=e,t.state=D.TEXT)}function M(t,e){var i="";return e<t.length&&(i=t.charAt(e)),i}D=t.STATE,String.fromCodePoint||(g=String.fromCharCode,A=Math.floor,I=function(){var t,e,i=[],s=-1,a=arguments.length;if(!a)return"";for(var n="";++s<a;){var r=Number(arguments[s]);if(!isFinite(r)||r<0||r>1114111||A(r)!==r)throw RangeError("Invalid code point: "+r);r<=65535?i.push(r):(t=55296+((r-=65536)>>10),e=r%1024+56320,i.push(t,e)),(s+1===a||i.length>16384)&&(n+=g.apply(null,i),i.length=0)}return n},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:I,configurable:!0,writable:!0}):String.fromCodePoint=I)}("undefined"==typeof exports?this.sax={}:exports);
|
|
513
|
+
},{}],88:[function(require,module,exports){
|
|
514
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const ed5=require("xmlchars/xml/1.0/ed5"),ed2=require("xmlchars/xml/1.1/ed2"),NSed3=require("xmlchars/xmlns/1.0/ed3");var isS=ed5.isS,isChar10=ed5.isChar,isNameStartChar=ed5.isNameStartChar,isNameChar=ed5.isNameChar,S_LIST=ed5.S_LIST,NAME_RE=ed5.NAME_RE,isChar11=ed2.isChar,isNCNameStartChar=NSed3.isNCNameStartChar,isNCNameChar=NSed3.isNCNameChar,NC_NAME_RE=NSed3.NC_NAME_RE;const XML_NAMESPACE="http://www.w3.org/XML/1998/namespace",XMLNS_NAMESPACE="http://www.w3.org/2000/xmlns/",rootNS={__proto__:null,xml:XML_NAMESPACE,xmlns:XMLNS_NAMESPACE},XML_ENTITIES={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},EOC=-1,NL_LIKE=-2,S_BEGIN=0,S_BEGIN_WHITESPACE=1,S_DOCTYPE=2,S_DOCTYPE_QUOTE=3,S_DTD=4,S_DTD_QUOTED=5,S_DTD_OPEN_WAKA=6,S_DTD_OPEN_WAKA_BANG=7,S_DTD_COMMENT=8,S_DTD_COMMENT_ENDING=9,S_DTD_COMMENT_ENDED=10,S_DTD_PI=11,S_DTD_PI_ENDING=12,S_TEXT=13,S_ENTITY=14,S_OPEN_WAKA=15,S_OPEN_WAKA_BANG=16,S_COMMENT=17,S_COMMENT_ENDING=18,S_COMMENT_ENDED=19,S_CDATA=20,S_CDATA_ENDING=21,S_CDATA_ENDING_2=22,S_PI_FIRST_CHAR=23,S_PI_REST=24,S_PI_BODY=25,S_PI_ENDING=26,S_XML_DECL_NAME_START=27,S_XML_DECL_NAME=28,S_XML_DECL_EQ=29,S_XML_DECL_VALUE_START=30,S_XML_DECL_VALUE=31,S_XML_DECL_SEPARATOR=32,S_XML_DECL_ENDING=33,S_OPEN_TAG=34,S_OPEN_TAG_SLASH=35,S_ATTRIB=36,S_ATTRIB_NAME=37,S_ATTRIB_NAME_SAW_WHITE=38,S_ATTRIB_VALUE=39,S_ATTRIB_VALUE_QUOTED=40,S_ATTRIB_VALUE_CLOSED=41,S_ATTRIB_VALUE_UNQUOTED=42,S_CLOSE_TAG=43,S_CLOSE_TAG_SAW_WHITE=44,TAB=9,NL=10,CR=13,SPACE=32,BANG=33,DQUOTE=34,AMP=38,SQUOTE=39,MINUS=45,FORWARD_SLASH=47,SEMICOLON=59,LESS=60,EQUAL=61,GREATER=62,QUESTION=63,OPEN_BRACKET=91,CLOSE_BRACKET=93,NEL=133,LS=8232,isQuote=t=>34===t||39===t,QUOTES=[34,39],DOCTYPE_TERMINATOR=[...QUOTES,OPEN_BRACKET,GREATER],DTD_TERMINATOR=[...QUOTES,LESS,CLOSE_BRACKET],XML_DECL_NAME_TERMINATOR=[EQUAL,QUESTION,...S_LIST],ATTRIB_VALUE_UNQUOTED_TERMINATOR=[...S_LIST,GREATER,AMP,LESS];function nsPairCheck(t,s,e){switch(s){case"xml":e!==XML_NAMESPACE&&t.fail(`xml prefix must be bound to ${XML_NAMESPACE}.`);break;case"xmlns":e!==XMLNS_NAMESPACE&&t.fail(`xmlns prefix must be bound to ${XMLNS_NAMESPACE}.`)}switch(e){case XMLNS_NAMESPACE:t.fail(""===s?`the default namespace may not be set to ${e}.`:`may not assign a prefix (even "xmlns") to the URI ${XMLNS_NAMESPACE}.`);break;case XML_NAMESPACE:switch(s){case"xml":break;case"":t.fail(`the default namespace may not be set to ${e}.`);break;default:t.fail("may not assign the xml namespace to another prefix.")}}}function nsMappingCheck(t,s){for(const e of Object.keys(s))nsPairCheck(t,e,s[e])}const isNCName=t=>NC_NAME_RE.test(t),isName=t=>NAME_RE.test(t),FORBIDDEN_START=0,FORBIDDEN_BRACKET=1,FORBIDDEN_BRACKET_BRACKET=2;exports.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const EVENT_NAME_TO_HANDLER_NAME={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class SaxesParser{constructor(t){this.opt=null!=t?t:{},this.fragmentOpt=!!this.opt.fragment;const s=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,s){this.nameStartCheck=isNCNameStartChar,this.nameCheck=isNCNameChar,this.isName=isNCName,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},rootNS);const t=this.opt.additionalNamespaces;null!=t&&(nsMappingCheck(this,t),Object.assign(this.ns,t))}else this.nameStartCheck=isNameStartChar,this.nameCheck=isNameChar,this.isName=isName,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=FORBIDDEN_START,this.attribList=[];const{fragmentOpt:s}=this;this.state=s?S_TEXT:S_BEGIN,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=s,this.xmlDeclPossible=!s,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:e}=this.opt;if(void 0===e){if(!0===this.opt.forceXMLVersion)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");e="1.0"}this.setXMLVersion(e),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(XML_ENTITIES),null===(t=this.readyHandler)||void 0===t||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,s){this[EVENT_NAME_TO_HANDLER_NAME[t]]=s}off(t){this[EVENT_NAME_TO_HANDLER_NAME[t]]=void 0}makeError(t){var s;let e=null!==(s=this.fileName)&&void 0!==s?s:"";return this.trackPosition&&(e.length>0&&(e+=":"),e+=`${this.line}:${this.column}`),e.length>0&&(e+=": "),new Error(e+t)}fail(t){const s=this.makeError(t),e=this.errorHandler;if(void 0===e)throw s;return e(s),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let s=!1;null===t?(s=!0,t=""):"object"==typeof t&&(t=t.toString()),void 0!==this.carriedFromPrevious&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let e=t.length;const i=t.charCodeAt(e-1);!s&&(i===CR||i>=55296&&i<=56319)&&(this.carriedFromPrevious=t[e-1],e--,t=t.slice(0,e));const{stateTable:a}=this;for(this.chunk=t,this.i=0;this.i<e;)a[this.state].call(this);return this.chunkPosition+=e,s?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return EOC;const e=t.charCodeAt(s);if(this.column++,e<55296){if(e>=SPACE||e===TAB)return e;switch(e){case NL:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL;case CR:return t.charCodeAt(s+1)===NL&&(this.i=s+2),this.line++,this.column=0,this.positionAtNewLine=this.position,NL_LIKE;default:return this.fail("disallowed character."),e}}if(e>56319)return e>=57344&&e<=65533||this.fail("disallowed character."),e;const i=65536+1024*(e-55296)+(t.charCodeAt(s+1)-56320);return this.i=s+2,i>1114111&&this.fail("disallowed character."),i}getCode11(){const{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return EOC;const e=t.charCodeAt(s);if(this.column++,e<55296){if(e>31&&e<127||e>159&&e!==LS||e===TAB)return e;switch(e){case NL:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL;case CR:{const e=t.charCodeAt(s+1);e!==NL&&e!==NEL||(this.i=s+2)}case NEL:case LS:return this.line++,this.column=0,this.positionAtNewLine=this.position,NL_LIKE;default:return this.fail("disallowed character."),e}}if(e>56319)return e>=57344&&e<=65533||this.fail("disallowed character."),e;const i=65536+1024*(e-55296)+(t.charCodeAt(s+1)-56320);return this.i=s+2,i>1114111&&this.fail("disallowed character."),i}getCodeNorm(){const t=this.getCode();return t===NL_LIKE?NL:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:s}=this;const{chunk:e}=this;for(;;){const i=this.getCode(),a=i===NL_LIKE,h=a?NL:i;if(h===EOC||t.includes(h))return this.text+=e.slice(s,this.prevI),h;a&&(this.text+=`${e.slice(s,this.prevI)}\n`,s=this.i)}}captureToChar(t){let{i:s}=this;const{chunk:e}=this;for(;;){let i=this.getCode();switch(i){case NL_LIKE:this.text+=`${e.slice(s,this.prevI)}\n`,s=this.i,i=NL;break;case EOC:return this.text+=e.slice(s),!1}if(i===t)return this.text+=e.slice(s,this.prevI),!0}}captureNameChars(){const{chunk:t,i:s}=this;for(;;){const e=this.getCode();if(e===EOC)return this.name+=t.slice(s),EOC;if(!isNameChar(e))return this.name+=t.slice(s,this.prevI),e===NL_LIKE?NL:e}}skipSpaces(){for(;;){const t=this.getCodeNorm();if(t===EOC||!isS(t))return t}}setXMLVersion(t){this.currentXMLVersion=t,"1.0"===t?(this.isChar=isChar10,this.getCode=this.getCode10):(this.isChar=isChar11,this.getCode=this.getCode11)}sBegin(){65279===this.chunk.charCodeAt(0)&&(this.i++,this.column++),this.state=S_BEGIN_WHITESPACE}sBeginWhitespace(){const t=this.i,s=this.skipSpaces();switch(this.prevI!==t&&(this.xmlDeclPossible=!1),s){case LESS:if(this.state=S_OPEN_WAKA,0!==this.text.length)throw new Error("no-empty text at start");break;case EOC:break;default:this.unget(),this.state=S_TEXT,this.xmlDeclPossible=!1}}sDoctype(){var t;const s=this.captureTo(DOCTYPE_TERMINATOR);switch(s){case GREATER:null===(t=this.doctypeHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=S_TEXT,this.doctype=!0;break;case EOC:break;default:this.text+=String.fromCodePoint(s),s===OPEN_BRACKET?this.state=S_DTD:isQuote(s)&&(this.state=S_DOCTYPE_QUOTE,this.q=s)}}sDoctypeQuote(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.q=null,this.state=S_DOCTYPE)}sDTD(){const t=this.captureTo(DTD_TERMINATOR);t!==EOC&&(this.text+=String.fromCodePoint(t),t===CLOSE_BRACKET?this.state=S_DOCTYPE:t===LESS?this.state=S_DTD_OPEN_WAKA:isQuote(t)&&(this.state=S_DTD_QUOTED,this.q=t))}sDTDQuoted(){const t=this.q;this.captureToChar(t)&&(this.text+=String.fromCodePoint(t),this.state=S_DTD,this.q=null)}sDTDOpenWaka(){const t=this.getCodeNorm();switch(this.text+=String.fromCodePoint(t),t){case BANG:this.state=S_DTD_OPEN_WAKA_BANG,this.openWakaBang="";break;case QUESTION:this.state=S_DTD_PI;break;default:this.state=S_DTD}}sDTDOpenWakaBang(){const t=String.fromCodePoint(this.getCodeNorm()),s=this.openWakaBang+=t;this.text+=t,"-"!==s&&(this.state="--"===s?S_DTD_COMMENT:S_DTD,this.openWakaBang="")}sDTDComment(){this.captureToChar(MINUS)&&(this.text+="-",this.state=S_DTD_COMMENT_ENDING)}sDTDCommentEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),this.state=t===MINUS?S_DTD_COMMENT_ENDED:S_DTD_COMMENT}sDTDCommentEnded(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===GREATER?this.state=S_DTD:(this.fail("malformed comment."),this.state=S_DTD_COMMENT)}sDTDPI(){this.captureToChar(QUESTION)&&(this.text+="?",this.state=S_DTD_PI_ENDING)}sDTDPIEnding(){const t=this.getCodeNorm();this.text+=String.fromCodePoint(t),t===GREATER&&(this.state=S_DTD)}sText(){0!==this.tags.length?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:t}=this;const{chunk:s}=this;t:for(;;)switch(this.getCode()){case NL_LIKE:this.entity+=`${s.slice(t,this.prevI)}\n`,t=this.i;break;case SEMICOLON:{const{entityReturnState:e}=this,i=this.entity+s.slice(t,this.prevI);let a;this.state=e,""===i?(this.fail("empty entity name."),a="&;"):(a=this.parseEntity(i),this.entity=""),e===S_TEXT&&void 0===this.textHandler||(this.text+=a);break t}case EOC:this.entity+=s.slice(t);break t}}sOpenWaka(){const t=this.getCode();if(isNameStartChar(t))this.state=S_OPEN_TAG,this.unget(),this.xmlDeclPossible=!1;else switch(t){case FORWARD_SLASH:this.state=S_CLOSE_TAG,this.xmlDeclPossible=!1;break;case BANG:this.state=S_OPEN_WAKA_BANG,this.openWakaBang="",this.xmlDeclPossible=!1;break;case QUESTION:this.state=S_PI_FIRST_CHAR;break;default:this.fail("disallowed character in tag name"),this.state=S_TEXT,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=S_CDATA,this.openWakaBang="";break;case"--":this.state=S_COMMENT,this.openWakaBang="";break;case"DOCTYPE":this.state=S_DOCTYPE,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(MINUS)&&(this.state=S_COMMENT_ENDING)}sCommentEnding(){var t;const s=this.getCodeNorm();s===MINUS?(this.state=S_COMMENT_ENDED,null===(t=this.commentHandler)||void 0===t||t.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(s)}`,this.state=S_COMMENT)}sCommentEnded(){const t=this.getCodeNorm();t!==GREATER?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(t)}`,this.state=S_COMMENT):this.state=S_TEXT}sCData(){this.captureToChar(CLOSE_BRACKET)&&(this.state=S_CDATA_ENDING)}sCDataEnding(){const t=this.getCodeNorm();t===CLOSE_BRACKET?this.state=S_CDATA_ENDING_2:(this.text+=`]${String.fromCodePoint(t)}`,this.state=S_CDATA)}sCDataEnding2(){var t;const s=this.getCodeNorm();switch(s){case GREATER:null===(t=this.cdataHandler)||void 0===t||t.call(this,this.text),this.text="",this.state=S_TEXT;break;case CLOSE_BRACKET:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(s)}`,this.state=S_CDATA}}sPIFirstChar(){const t=this.getCodeNorm();this.nameStartCheck(t)?(this.piTarget+=String.fromCodePoint(t),this.state=S_PI_REST):t===QUESTION||isS(t)?(this.fail("processing instruction without a target."),this.state=t===QUESTION?S_PI_ENDING:S_PI_BODY):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(t),this.state=S_PI_REST)}sPIRest(){const{chunk:t,i:s}=this;for(;;){const e=this.getCodeNorm();if(e===EOC)return void(this.piTarget+=t.slice(s));if(!this.nameCheck(e)){this.piTarget+=t.slice(s,this.prevI);const i=e===QUESTION;i||isS(e)?"xml"===this.piTarget?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=i?S_XML_DECL_ENDING:S_XML_DECL_NAME_START):this.state=i?S_PI_ENDING:S_PI_BODY:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(e));break}}}sPIBody(){if(0===this.text.length){const t=this.getCodeNorm();t===QUESTION?this.state=S_PI_ENDING:isS(t)||(this.text=String.fromCodePoint(t))}else this.captureToChar(QUESTION)&&(this.state=S_PI_ENDING)}sPIEnding(){var t;const s=this.getCodeNorm();if(s===GREATER){const{piTarget:s}=this;"xml"===s.toLowerCase()&&this.fail("the XML declaration must appear at the start of the document."),null===(t=this.piHandler)||void 0===t||t.call(this,{target:s,body:this.text}),this.piTarget=this.text="",this.state=S_TEXT}else s===QUESTION?this.text+="?":(this.text+=`?${String.fromCodePoint(s)}`,this.state=S_PI_BODY);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const t=this.skipSpaces();t!==QUESTION?t!==EOC&&(this.state=S_XML_DECL_NAME,this.name=String.fromCodePoint(t)):this.state=S_XML_DECL_ENDING}sXMLDeclName(){const t=this.captureTo(XML_DECL_NAME_TERMINATOR);if(t===QUESTION)return this.state=S_XML_DECL_ENDING,this.name+=this.text,this.text="",void this.fail("XML declaration is incomplete.");if(isS(t)||t===EQUAL){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=t===EQUAL?S_XML_DECL_VALUE_START:S_XML_DECL_EQ}}sXMLDeclEq(){const t=this.getCodeNorm();if(t===QUESTION)return this.state=S_XML_DECL_ENDING,void this.fail("XML declaration is incomplete.");isS(t)||(t!==EQUAL&&this.fail("value required."),this.state=S_XML_DECL_VALUE_START)}sXMLDeclValueStart(){const t=this.getCodeNorm();if(t===QUESTION)return this.state=S_XML_DECL_ENDING,void this.fail("XML declaration is incomplete.");isS(t)||(isQuote(t)?this.q=t:(this.fail("value must be quoted."),this.q=SPACE),this.state=S_XML_DECL_VALUE)}sXMLDeclValue(){const t=this.captureTo([this.q,QUESTION]);if(t===QUESTION)return this.state=S_XML_DECL_ENDING,this.text="",void this.fail("XML declaration is incomplete.");if(t===EOC)return;const s=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const t=s;this.xmlDecl.version=t,/^1\.[0-9]+$/.test(t)?this.opt.forceXMLVersion||this.setXMLVersion(t):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(s)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=s;break;case"standalone":"yes"!==s&&"no"!==s&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=s}this.name="",this.state=S_XML_DECL_SEPARATOR}sXMLDeclSeparator(){const t=this.getCodeNorm();t!==QUESTION?(isS(t)||(this.fail("whitespace required."),this.unget()),this.state=S_XML_DECL_NAME_START):this.state=S_XML_DECL_ENDING}sXMLDeclEnding(){var t;this.getCodeNorm()===GREATER?("xml"!==this.piTarget?this.fail("processing instructions are not allowed before root."):"version"!==this.name&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),null===(t=this.xmldeclHandler)||void 0===t||t.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=S_TEXT):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var t;const s=this.captureNameChars();if(s===EOC)return;const e=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=e.ns=Object.create(null)),null===(t=this.openTagStartHandler)||void 0===t||t.call(this,e),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),s){case GREATER:this.openTag();break;case FORWARD_SLASH:this.state=S_OPEN_TAG_SLASH;break;default:isS(s)||this.fail("disallowed character in tag name."),this.state=S_ATTRIB}}sOpenTagSlash(){this.getCode()===GREATER?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=S_ATTRIB)}sAttrib(){const t=this.skipSpaces();t!==EOC&&(isNameStartChar(t)?(this.unget(),this.state=S_ATTRIB_NAME):t===GREATER?this.openTag():t===FORWARD_SLASH?this.state=S_OPEN_TAG_SLASH:this.fail("disallowed character in attribute name."))}sAttribName(){const t=this.captureNameChars();t===EQUAL?this.state=S_ATTRIB_VALUE:isS(t)?this.state=S_ATTRIB_NAME_SAW_WHITE:t===GREATER?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):t!==EOC&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const t=this.skipSpaces();switch(t){case EOC:return;case EQUAL:this.state=S_ATTRIB_VALUE;break;default:this.fail("attribute without value."),this.text="",this.name="",t===GREATER?this.openTag():isNameStartChar(t)?(this.unget(),this.state=S_ATTRIB_NAME):(this.fail("disallowed character in attribute name."),this.state=S_ATTRIB)}}sAttribValue(){const t=this.getCodeNorm();isQuote(t)?(this.q=t,this.state=S_ATTRIB_VALUE_QUOTED):isS(t)||(this.fail("unquoted attribute value."),this.state=S_ATTRIB_VALUE_UNQUOTED,this.unget())}sAttribValueQuoted(){const{q:t,chunk:s}=this;let{i:e}=this;for(;;)switch(this.getCode()){case t:return this.pushAttrib(this.name,this.text+s.slice(e,this.prevI)),this.name=this.text="",this.q=null,void(this.state=S_ATTRIB_VALUE_CLOSED);case AMP:return this.text+=s.slice(e,this.prevI),this.state=S_ENTITY,void(this.entityReturnState=S_ATTRIB_VALUE_QUOTED);case NL:case NL_LIKE:case TAB:this.text+=`${s.slice(e,this.prevI)} `,e=this.i;break;case LESS:return this.text+=s.slice(e,this.prevI),void this.fail("disallowed character.");case EOC:return void(this.text+=s.slice(e))}}sAttribValueClosed(){const t=this.getCodeNorm();isS(t)?this.state=S_ATTRIB:t===GREATER?this.openTag():t===FORWARD_SLASH?this.state=S_OPEN_TAG_SLASH:isNameStartChar(t)?(this.fail("no whitespace between attributes."),this.unget(),this.state=S_ATTRIB_NAME):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const t=this.captureTo(ATTRIB_VALUE_UNQUOTED_TERMINATOR);switch(t){case AMP:this.state=S_ENTITY,this.entityReturnState=S_ATTRIB_VALUE_UNQUOTED;break;case LESS:this.fail("disallowed character.");break;case EOC:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",t===GREATER?this.openTag():this.state=S_ATTRIB}}sCloseTag(){const t=this.captureNameChars();t===GREATER?this.closeTag():isS(t)?this.state=S_CLOSE_TAG_SAW_WHITE:t!==EOC&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case GREATER:this.closeTag();break;case EOC:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:t,forbiddenState:s}=this;const{chunk:e,textHandler:i}=this;t:for(;;)switch(this.getCode()){case LESS:if(this.state=S_OPEN_WAKA,void 0!==i){const{text:s}=this,a=e.slice(t,this.prevI);0!==s.length?(i(s+a),this.text=""):0!==a.length&&i(a)}s=FORBIDDEN_START;break t;case AMP:this.state=S_ENTITY,this.entityReturnState=S_TEXT,void 0!==i&&(this.text+=e.slice(t,this.prevI)),s=FORBIDDEN_START;break t;case CLOSE_BRACKET:switch(s){case FORBIDDEN_START:s=FORBIDDEN_BRACKET;break;case FORBIDDEN_BRACKET:s=FORBIDDEN_BRACKET_BRACKET;break;case FORBIDDEN_BRACKET_BRACKET:break;default:throw new Error("impossible state")}break;case GREATER:s===FORBIDDEN_BRACKET_BRACKET&&this.fail('the string "]]>" is disallowed in char data.'),s=FORBIDDEN_START;break;case NL_LIKE:void 0!==i&&(this.text+=`${e.slice(t,this.prevI)}\n`),t=this.i,s=FORBIDDEN_START;break;case EOC:void 0!==i&&(this.text+=e.slice(t));break t;default:s=FORBIDDEN_START}this.forbiddenState=s}handleTextOutsideRoot(){let{i:t}=this;const{chunk:s,textHandler:e}=this;let i=!1;t:for(;;){const a=this.getCode();switch(a){case LESS:if(this.state=S_OPEN_WAKA,void 0!==e){const{text:i}=this,a=s.slice(t,this.prevI);0!==i.length?(e(i+a),this.text=""):0!==a.length&&e(a)}break t;case AMP:this.state=S_ENTITY,this.entityReturnState=S_TEXT,void 0!==e&&(this.text+=s.slice(t,this.prevI)),i=!0;break t;case NL_LIKE:void 0!==e&&(this.text+=`${s.slice(t,this.prevI)}\n`),t=this.i;break;case EOC:void 0!==e&&(this.text+=s.slice(t));break t;default:isS(a)||(i=!0)}}i&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(t,s){var e;const{prefix:i,local:a}=this.qname(t),h={name:t,prefix:i,local:a,value:s};if(this.attribList.push(h),null===(e=this.attributeHandler)||void 0===e||e.call(this,h),"xmlns"===i){const t=s.trim();"1.0"===this.currentXMLVersion&&""===t&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[a]=t,nsPairCheck(this,a,t)}else if("xmlns"===t){const t=s.trim();this.topNS[""]=t,nsPairCheck(this,"",t)}}pushAttribPlain(t,s){var e;const i={name:t,value:s};this.attribList.push(i),null===(e=this.attributeHandler)||void 0===e||e.call(this,i)}end(){var t,s;this.sawRoot||this.fail("document must contain a root element.");const{tags:e}=this;for(;e.length>0;){const t=e.pop();this.fail(`unclosed tag: ${t.name}`)}this.state!==S_BEGIN&&this.state!==S_TEXT&&this.fail("unexpected end.");const{text:i}=this;return 0!==i.length&&(null===(t=this.textHandler)||void 0===t||t.call(this,i),this.text=""),this._closed=!0,null===(s=this.endHandler)||void 0===s||s.call(this),this._init(),this}resolve(t){var s,e;let i=this.topNS[t];if(void 0!==i)return i;const{tags:a}=this;for(let s=a.length-1;s>=0;s--)if(void 0!==(i=a[s].ns[t]))return i;return void 0!==(i=this.ns[t])?i:null===(e=(s=this.opt).resolvePrefix)||void 0===e?void 0:e.call(s,t)}qname(t){const s=t.indexOf(":");if(-1===s)return{prefix:"",local:t};const e=t.slice(s+1),i=t.slice(0,s);return(""===i||""===e||e.includes(":"))&&this.fail(`malformed name: ${t}.`),{prefix:i,local:e}}processAttribsNS(){var t;const{attribList:s}=this,e=this.tag;{const{prefix:s,local:i}=this.qname(e.name);e.prefix=s,e.local=i;const a=e.uri=null!==(t=this.resolve(s))&&void 0!==t?t:"";""!==s&&("xmlns"===s&&this.fail('tags may not have "xmlns" as prefix.'),""===a&&(this.fail(`unbound namespace prefix: ${JSON.stringify(s)}.`),e.uri=s))}if(0===s.length)return;const{attributes:i}=e,a=new Set;for(const t of s){const{name:s,prefix:e,local:h}=t;let o,n;""===e?(o="xmlns"===s?XMLNS_NAMESPACE:"",n=s):(void 0===(o=this.resolve(e))&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),o=e),n=`{${o}}${h}`),a.has(n)&&this.fail(`duplicate attribute: ${n}.`),a.add(n),t.uri=o,i[s]=t}this.attribList=[]}processAttribsPlain(){const{attribList:t}=this,s=this.tag.attributes;for(const{name:e,value:i}of t)void 0!==s[e]&&this.fail(`duplicate attribute: ${e}.`),s[e]=i;this.attribList=[]}openTag(){var t;this.processAttribs();const{tags:s}=this,e=this.tag;e.isSelfClosing=!1,null===(t=this.openTagHandler)||void 0===t||t.call(this,e),s.push(e),this.state=S_TEXT,this.name=""}openSelfClosingTag(){var t,s,e;this.processAttribs();const{tags:i}=this,a=this.tag;a.isSelfClosing=!0,null===(t=this.openTagHandler)||void 0===t||t.call(this,a),null===(s=this.closeTagHandler)||void 0===s||s.call(this,a),null===(this.tag=null!==(e=i[i.length-1])&&void 0!==e?e:null)&&(this.closedRoot=!0),this.state=S_TEXT,this.name=""}closeTag(){const{tags:t,name:s}=this;if(this.state=S_TEXT,this.name="",""===s)return this.fail("weird empty close tag."),void(this.text+="</>");const e=this.closeTagHandler;let i=t.length;for(;i-- >0;){const i=this.tag=t.pop();if(this.topNS=i.ns,null==e||e(i),i.name===s)break;this.fail("unexpected close tag.")}0===i?this.closedRoot=!0:i<0&&(this.fail(`unmatched closing tag: ${s}.`),this.text+=`</${s}>`)}parseEntity(t){if("#"!==t[0]){const s=this.ENTITIES[t];return void 0!==s?s:(this.fail(this.isName(t)?"undefined entity.":"disallowed character in entity name."),`&${t};`)}let s=NaN;return"x"===t[1]&&/^#x[0-9a-f]+$/i.test(t)?s=parseInt(t.slice(2),16):/^#[0-9]+$/.test(t)&&(s=parseInt(t.slice(1),10)),this.isChar(s)?String.fromCodePoint(s):(this.fail("malformed character entity."),`&${t};`)}}exports.SaxesParser=SaxesParser;
|
|
594
515
|
|
|
595
|
-
}
|
|
596
|
-
},{"buffer":3,"stream":29,"string_decoder":30}],111:[function(require,module,exports){
|
|
516
|
+
},{"xmlchars/xml/1.0/ed5":85,"xmlchars/xml/1.1/ed2":86,"xmlchars/xmlns/1.0/ed3":87}],89:[function(require,module,exports){
|
|
597
517
|
module.exports={
|
|
598
518
|
"name": "@jscad/svg-deserializer",
|
|
599
|
-
"version": "2.
|
|
519
|
+
"version": "2.4.1",
|
|
600
520
|
"description": "SVG Deserializer for JSCAD",
|
|
601
521
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
602
|
-
"main": "index.js",
|
|
522
|
+
"main": "src/index.js",
|
|
603
523
|
"scripts": {
|
|
604
524
|
"coverage": "nyc --all --reporter=html --reporter=text npm test",
|
|
605
525
|
"test": "ava --verbose --timeout 2m './tests/*.test.js'"
|
|
@@ -628,8 +548,8 @@ module.exports={
|
|
|
628
548
|
"license": "MIT",
|
|
629
549
|
"dependencies": {
|
|
630
550
|
"@jscad/array-utils": "2.1.0",
|
|
631
|
-
"@jscad/modeling": "2.
|
|
632
|
-
"
|
|
551
|
+
"@jscad/modeling": "2.5.3",
|
|
552
|
+
"saxes": "5.0.1"
|
|
633
553
|
},
|
|
634
554
|
"devDependencies": {
|
|
635
555
|
"ava": "3.15.0",
|
|
@@ -637,25 +557,34 @@ module.exports={
|
|
|
637
557
|
}
|
|
638
558
|
}
|
|
639
559
|
|
|
640
|
-
},{}],
|
|
641
|
-
const
|
|
560
|
+
},{}],90:[function(require,module,exports){
|
|
561
|
+
const pxPmm=1/.2822222,inchMM=.03937,ptMM=1/(1/.03937/72),pcMM=.23622,cssPxUnit=.2822222,svgColors={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};module.exports={pxPmm:pxPmm,inchMM:.03937,ptMM:ptMM,pcMM:pcMM,cssPxUnit:.2822222,svgColors:svgColors};
|
|
562
|
+
|
|
563
|
+
},{}],91:[function(require,module,exports){
|
|
564
|
+
const{inchMM:inchMM,ptMM:ptMM,pcMM:pcMM,svgColors:svgColors}=require("./constants"),svg2cagX=(e,s)=>e/s[0],svg2cagY=(e,s)=>0-e/s[1],cagLengthX=(e,s,r)=>{if(e.indexOf("%")<0)return css2cag(e,s[0]);let t=parseFloat(e);return isNaN(t)?0:0===t?t:(t=t/100*r,t/=s[0],Math.round(1e5*t)/1e5)},cagLengthY=(e,s,r)=>{if(e.indexOf("%")<0)return css2cag(e,s[1]);let t=parseFloat(e);return isNaN(t)?0:0===t?t:(t=t/100*r,t/=s[1],Math.round(1e5*t)/1e5)},cagLengthP=(e,s,r)=>{if(e.indexOf("%")<0)return css2cag(e,s[1]);let t=parseFloat(e);return isNaN(t)?0:0===t?t:(t=t/100*r,t/=s[0])},css2cag=(e,s)=>{let r=parseFloat(e);return isNaN(r)?0:0===r?r:(e.search(/EM/i)>0||e.search(/EX/i)>0||e.search(/MM/i)>0||(e.search(/CM/i)>0?r*=10:e.search(/IN/i)>0?r/=inchMM:e.search(/PT/i)>0?r/=ptMM:e.search(/PC/i)>0?r/=pcMM:r/=s),r)},cagColor=e=>{let s;if((e=e.toLowerCase())in svgColors)s=[(s=svgColors[e])[0]/255,s[1]/255,s[2]/255];else if("#"===e[0])4===e.length&&(e="#"+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]),7===e.length&&(s=[parseInt("0x"+e.slice(1,3))/255,parseInt("0x"+e.slice(3,5))/255,parseInt("0x"+e.slice(5,7))/255]);else{let r=/rgb\(.+,.+,.+\)/.exec(e);null!==r&&(s=(r=(r=r[0]).slice(r.indexOf("(")+1,r.indexOf(")"))).split(","),s=r.indexOf("%")>0?[(s=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2])])[0]/100,s[1]/100,s[2]/100]:[(s=[parseInt(s[0]),parseInt(s[1]),parseInt(s[2])])[0]/255,s[1]/255,s[2]/255])}return s},cssStyle=(e,s)=>{if("style"in e){const r=e.style+";";let t=new RegExp(s+"\\s*:\\s*(\\S+);","i").exec(r);if(null!==t){let e=(t=t[0]).indexOf(":")+1;for(;" "===t[e];)e++;return t=t.slice(e,t.indexOf(";"))}}},reflect=(e,s,r,t)=>{const l=e-r,a=s-t;return e===r&&s===r?[e,s]:e===r?[e,t+-a]:s===t?[r+-l,s]:[r+-l,t+-a]},groupValue=(e,s)=>{let r=e.length;for(;r>0;){const t=e[r-1];if(s in t)return t[s];r--}},svgColorForTarget=(e,s)=>{let r=null;return"path"===e?s.stroke?r=[s.stroke[0],s.stroke[1],s.stroke[2],1]:s.fill&&(r=[s.fill[0],s.fill[1],s.fill[2],1]):s.fill?r=[s.fill[0],s.fill[1],s.fill[2],1]:s.stroke&&(r=[s.stroke[0],s.stroke[1],s.stroke[2],1]),r};module.exports={svg2cagX:svg2cagX,svg2cagY:svg2cagY,cagLengthX:cagLengthX,cagLengthY:cagLengthY,cagLengthP:cagLengthP,css2cag:css2cag,cagColor:cagColor,cssStyle:cssStyle,reflect:reflect,groupValue:groupValue,svgColorForTarget:svgColorForTarget};
|
|
565
|
+
|
|
566
|
+
},{"./constants":90}],92:[function(require,module,exports){
|
|
567
|
+
const saxes=require("saxes"),{colors:colors,transforms:transforms}=require("@jscad/modeling"),{toArray:toArray}=require("@jscad/array-utils"),version=require("../package.json").version,{cagLengthX:cagLengthX,cagLengthY:cagLengthY,svgColorForTarget:svgColorForTarget}=require("./helpers"),{svgSvg:svgSvg,svgRect:svgRect,svgCircle:svgCircle,svgGroup:svgGroup,svgLine:svgLine,svgPath:svgPath,svgEllipse:svgEllipse,svgPolygon:svgPolygon,svgPolyline:svgPolyline,svgUse:svgUse}=require("./svgElementHelpers"),shapesMapGeometry=require("./shapesMapGeometry"),shapesMapJscad=require("./shapesMapJscad"),deserialize=(s,e)=>{const t={addMetaData:!0,filename:"svg",output:"script",pxPmm:require("./constants").pxPmm,segments:32,target:"path",pathSelfClosed:"error",version:version};return"script"===(s=Object.assign({},t,s)).output?translate(e,s):instantiate(e,s)},instantiate=(s,e)=>{const{pxPmm:t}=e;if(e&&e.statusCallback&&e.statusCallback({progress:0}),createSvgParser(s,t),!svgObj)throw new Error("SVG parsing failed, no valid SVG data retrieved");e&&e.statusCallback&&e.statusCallback({progress:50});const n=objectify(e,svgObj);return e&&e.statusCallback&&e.statusCallback({progress:100}),n},translate=(s,e)=>{const{filename:t,version:n,pxPmm:r,addMetaData:o}=e;if(e&&e.statusCallback&&e.statusCallback({progress:0}),createSvgParser(s,r),!svgObj)throw new Error("SVG parsing failed, no valid SVG data retrieved");let a=o?`//\n // producer: JSCAD SVG Deserializer ${n}\n // date: ${new Date}\n // source: ${t}\n //\n`:"";return a+="const { colors, geometries, primitives, transforms } = require('@jscad/modeling')\n\n",e&&e.statusCallback&&e.statusCallback({progress:50}),a+=codify(e,svgObj),a+="\nmodule.exports = { main }",e&&e.statusCallback&&e.statusCallback({progress:100}),a};let svgUnitsX,svgUnitsY,svgUnitsV;const svgObjects=[],svgGroups=[],svgDefs=[];let svgObj,svgInDefs=!1,svgUnitsPmm=[1,1];const objectify=(s,e)=>{const{target:t,segments:n,pathSelfClosed:r}=s,o=svgGroups.length;svgGroups.push(e);let a=o;for(;a>0;)a--;let g=[];const l={svgUnitsPmm:svgUnitsPmm,svgUnitsX:svgUnitsX,svgUnitsY:svgUnitsY,svgUnitsV:svgUnitsV,level:o,target:t,svgGroups:svgGroups,segments:n,pathSelfClosed:r};for(a=0;a<e.objects.length;a++){const s=e.objects[a];let n=toArray(shapesMapGeometry(s,objectify,l));n=n.map(e=>{if("transforms"in s){let t=null,n=null,r=null;for(let e=0;e<s.transforms.length;e++){const o=s.transforms[e];"rotate"in o&&(t=o),"scale"in o&&(n=o),"translate"in o&&(r=o)}if(null!==n){let s=Math.abs(n.scale[0]),t=Math.abs(n.scale[1]);e=transforms.scale([s,t,1],e),s=n.scale[0],t=n.scale[1],s<0&&(e=transforms.mirrorX(e)),t<0&&(e=transforms.mirrorY(e))}if(null!==t){const s=0-.017453292519943295*t.rotate;e=transforms.rotateZ(s,e)}if(null!==r){const s=cagLengthX(r.translate[0],svgUnitsPmm,svgUnitsX),t=0-cagLengthY(r.translate[1],svgUnitsPmm,svgUnitsY);e=transforms.translate([s,t,0],e)}}const n=svgColorForTarget(t,s);return n&&(e=colors.colorize(n,e)),e}),g=g.concat(n)}return svgGroups.pop(),g},codify=(s,e)=>{const{target:t,segments:n}=s,r=svgGroups.length;svgGroups.push(e);let o=" ",a=r;for(;a>0;)o+=" ",a--;let g="";0===r&&(g+="function main(params) {\n let levels = {}\n let paths = {}\n let parts\n");const l="levels.l"+r;for(g+=`${o}${l} = []\n`,a=0;a<e.objects.length;a++){const s=e.objects[a],i="paths.p"+a;if(g+=shapesMapJscad(s,codify,{level:r,indent:o,ln:l,on:i,svgUnitsPmm:svgUnitsPmm,svgUnitsX:svgUnitsX,svgUnitsY:svgUnitsY,svgUnitsV:svgUnitsV,svgGroups:svgGroups,target:t,segments:n}),"transforms"in s){let e=null,t=null,n=null;for(let r=0;r<s.transforms.length;r++){const o=s.transforms[r];"rotate"in o&&(e=o),"scale"in o&&(t=o),"translate"in o&&(n=o)}if(null!==t){let s=Math.abs(t.scale[0]),e=Math.abs(t.scale[1]);g+=`${o}${i} = transforms.scale([${s}, ${e}, 1], ${i})\n`,(s=t.scale[0])<0&&(g+=`${o}${i} = transforms.mirrorX(${i})\n`),(e=t.scale[1])<0&&(g+=`${o}${i} = transforms.mirrorY(${i})\n`)}if(null!==e){g+=`${o}${i} = transforms.rotateZ(${0-.017453292519943295*e.rotate}, ${i})\n`}if(null!==n){g+=`${o}${i} = transforms.translate([${cagLengthX(n.translate[0],svgUnitsPmm,svgUnitsX)}, ${0-cagLengthY(n.translate[1],svgUnitsPmm,svgUnitsY)}, 0], ${i})\n`}}const v=svgColorForTarget(t,s);v&&(g+=`${o}${i} = colors.colorize([${v}], ${i})\n`),g+=`${o}${l} = ${l}.concat(${i})\n\n`}return 0===r&&(g+=o+"return "+l+"\n",g+="}\n"),svgGroups.pop(),g},createSvgParser=(s,e)=>{const t=new saxes.SaxesParser;return void 0!==e&&e>t.pxPmm&&(t.pxPmm=e),t.on("error",s=>{console.log(`ERROR: SVG file, line ${t.line}, column ${t.column}`),console.log(s)}),t.on("opentag",s=>{const n={SVG:svgSvg,G:svgGroup,RECT:svgRect,CIRCLE:svgCircle,ELLIPSE:svgEllipse,LINE:svgLine,POLYLINE:svgPolyline,POLYGON:svgPolygon,PATH:svgPath,USE:svgUse,DEFS:()=>{svgInDefs=!0},DESC:()=>void 0,TITLE:()=>void 0,STYLE:()=>void 0,undefined:()=>console.log("WARNING: unsupported SVG element: "+s.name)};s.attributes.position=[t.line+1,t.column+1];const r=s.name.toUpperCase(),o=n[r]?n[r](s.attributes,{svgObjects:svgObjects,customPxPmm:e}):void 0;if(o)if("id"in o&&(svgObjects[o.id]=o),"svg"===o.type)svgGroups.push(o),svgUnitsPmm=o.unitsPmm,svgUnitsX=o.viewW,svgUnitsY=o.viewH,svgUnitsV=o.viewP;else if(!0===svgInDefs){if(svgDefs.length>0){const s=svgDefs.pop();"objects"in s&&s.objects.push(o),svgDefs.push(s)}"group"===o.type&&svgDefs.push(o)}else{if(svgGroups.length>0){const s=svgGroups.pop();"objects"in s&&s.objects.push(o),svgGroups.push(s)}"group"===o.type&&svgGroups.push(o)}}),t.on("closetag",s=>{const e=()=>!0===svgInDefs?svgDefs.pop():svgGroups.pop(),t={SVG:e,DEFS:()=>{svgInDefs=!1},USE:e,G:e,undefined:()=>{}},n=s.name.toUpperCase(),r=t[n]?t[n]():void 0;0===svgGroups.length&&(svgObj=r)}),t.on("end",()=>{}),t.write(s).close(),t},extension="svg";module.exports={deserialize:deserialize,extension:"svg"};
|
|
642
568
|
|
|
643
|
-
},{"./helpers":
|
|
644
|
-
const{svg2cagX:svg2cagX,svg2cagY:svg2cagY,cagLengthX:cagLengthX,cagLengthY:cagLengthY,cagLengthP:cagLengthP,reflect:reflect}=require("./helpers"),
|
|
569
|
+
},{"../package.json":89,"./constants":90,"./helpers":91,"./shapesMapGeometry":93,"./shapesMapJscad":94,"./svgElementHelpers":95,"@jscad/array-utils":483,"@jscad/modeling":185,"saxes":88}],93:[function(require,module,exports){
|
|
570
|
+
const{geometries:geometries,primitives:primitives}=require("@jscad/modeling"),{svg2cagX:svg2cagX,svg2cagY:svg2cagY,cagLengthX:cagLengthX,cagLengthY:cagLengthY,cagLengthP:cagLengthP,reflect:reflect}=require("./helpers"),shapesMapGeometry=(e,s,a)=>{const{svgUnitsPmm:t,svgUnitsX:g,svgUnitsY:o,svgUnitsV:r,svgGroups:n,target:c,segments:p,pathSelfClosed:i}=a;return{group:e=>s({target:c,segments:p},e),rect:(e,s,a,t,g,o,r)=>{let n=cagLengthX(e.x,s,a),p=0-cagLengthY(e.y,s,t);const i=cagLengthX(e.width,s,a),l=cagLengthY(e.height,s,t),v=cagLengthX(e.rx,s,a);let h;return i>0&&l>0&&(n+=i/2,p-=l/2,h=0===v?primitives.rectangle({center:[n,p],size:[i,l]}):primitives.roundedRectangle({center:[n,p],segments:r,size:[i,l],roundRadius:v}),"path"===c&&(h=geometries.path2.fromPoints({closed:!0},geometries.geom2.toPoints(h)))),h},circle:(e,s,a,t,g,o,r)=>{const n=cagLengthX(e.x,s,a),p=0-cagLengthY(e.y,s,t),i=cagLengthP(e.radius,s,g);let l;return i>0&&(l=primitives.circle({center:[n,p],segments:r,radius:i}),"path"===c&&(l=geometries.path2.fromPoints({closed:!0},geometries.geom2.toPoints(l)))),l},ellipse:(e,s,a,t,g,o,r)=>{const n=cagLengthX(e.rx,s,a),p=cagLengthY(e.ry,s,t),i=cagLengthX(e.cx,s,a),l=0-cagLengthY(e.cy,s,t);let v;return n>0&&p>0&&(v=primitives.ellipse({center:[i,l],segments:r,radius:[n,p]}),"path"===c&&(v=geometries.path2.fromPoints({closed:!0},geometries.geom2.toPoints(v)))),v},line:(e,s,a,t,g)=>{const o=cagLengthX(e.x1,s,a),r=0-cagLengthY(e.y1,s,t),n=cagLengthX(e.x2,s,a),c=0-cagLengthY(e.y2,s,t);return primitives.line([[o,r],[n,c]])},polygon:(e,s,a,t)=>{const g=[];for(let o=0;o<e.points.length;o++){const r=e.points[o];if("x"in r&&"y"in r){const e=cagLengthX(r.x,s,a),o=0-cagLengthY(r.y,s,t);g.push([e,o])}}return"geom2"===c?geometries.geom2.fromPoints(g):geometries.path2.fromPoints({},g)},polyline:(e,s,a,t,g)=>{const o=[];for(let g=0;g<e.points.length;g++){const r=e.points[g];if("x"in r&&"y"in r){const e=cagLengthX(r.x,s,a),g=0-cagLengthY(r.y,s,t);o.push([e,g])}}return primitives.line(o)},path:(e,s,a,t,g,o,r)=>{const n=expandPath(e,s,a,t,g,o,r,i);return Object.entries(n).sort((e,s)=>e[0].localeCompare(s[0])).map(e=>{const s=e[1];if("geom2"===c&&s.isClosed){const e=geometries.path2.toPoints(s).slice();return e.push(e[0]),geometries.geom2.fromPoints(e)}return s})}}[e.type](e,t,g,o,r,n,p)};module.exports=shapesMapGeometry;const appendPoints=(e,s)=>s?geometries.path2.appendPoints(e,s):geometries.path2.fromPoints({},e),expandPath=(e,s,a,t,g,o,r,n)=>{const c={};let p=0,i=0,l=0,v=0,h=0,m="path"+h,F=!1,d=0,X=0,f=0,Y=0;const P=()=>{m="path"+ ++h,F=!1},u=()=>{c[m]||(c[m]=geometries.path2.fromPoints({},[]))};for(let a=0;a<e.commands.length;a++){const t=e.commands[a],g=t.p;let o=0;switch(t.c){case"m":for(0===a&&(l=0,v=0),g.length>=o+2&&(l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),P(),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]]),p=l,i=v);g.length>=o+2;)l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"M":for(g.length>=o+2&&(l=parseFloat(g[o++]),v=parseFloat(g[o++]),P(),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]]),p=l,i=v);g.length>=o+2;)l=parseFloat(g[o++]),v=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"a":for(;g.length>=o+7;){const e=parseFloat(g[o++]),a=parseFloat(g[o++]),t=0-.017453292519943295*parseFloat(g[o++]),n="1"===g[o++],p="1"===g[o++];l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendArc({segments:r,endpoint:[svg2cagX(l,s),svg2cagY(v,s)],radius:[svg2cagX(e,s),svg2cagY(a,s)],xaxisrotation:t,clockwise:p,large:n},c[m])}break;case"A":for(;g.length>=o+7;){const e=parseFloat(g[o++]),a=parseFloat(g[o++]),t=0-.017453292519943295*parseFloat(g[o++]),n="1"===g[o++],p="1"===g[o++];l=parseFloat(g[o++]),v=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendArc({segments:r,endpoint:[svg2cagX(l,s),svg2cagY(v,s)],radius:[svg2cagX(e,s),svg2cagY(a,s)],xaxisrotation:t,clockwise:p,large:n},c[m])}break;case"c":for(;g.length>=o+6;){const e=l+parseFloat(g[o++]),a=v+parseFloat(g[o++]);d=l+parseFloat(g[o++]),X=v+parseFloat(g[o++]),l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(e,s),svg2cagY(a,s)],[svg2cagX(d,s),svg2cagY(X,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const t=reflect(d,X,l,v);d=t[0],X=t[1]}break;case"C":for(;g.length>=o+6;){const e=parseFloat(g[o++]),a=parseFloat(g[o++]);d=parseFloat(g[o++]),X=parseFloat(g[o++]),l=parseFloat(g[o++]),v=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(e,s),svg2cagY(a,s)],[svg2cagX(d,s),svg2cagY(X,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const t=reflect(d,X,l,v);d=t[0],X=t[1]}break;case"q":for(;g.length>=o+4;){f=l+parseFloat(g[o++]),Y=v+parseFloat(g[o++]),l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const e=reflect(f,Y,l,v);f=e[0],Y=e[1]}break;case"Q":for(;g.length>=o+4;){f=parseFloat(g[o++]),Y=parseFloat(g[o++]),l=parseFloat(g[o++]),v=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const e=reflect(f,Y,l,v);f=e[0],Y=e[1]}break;case"t":for(;g.length>=o+2;){l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(f,s),svg2cagY(Y,s)],[l,v]]},c[m]);const e=reflect(f,Y,l,v);f=e[0],Y=e[1]}break;case"T":for(;g.length>=o+2;){l=parseFloat(g[o++]),v=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(f,s),svg2cagY(Y,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const e=reflect(f,Y,l,v);f=e[0],Y=e[1]}break;case"s":for(;g.length>=o+4;){const e=d,a=X;d=l+parseFloat(g[o++]),X=v+parseFloat(g[o++]),l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(e,s),svg2cagY(a,s)],[svg2cagX(d,s),svg2cagY(X,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const t=reflect(d,X,l,v);d=t[0],X=t[1]}break;case"S":for(;g.length>=o+4;){const e=d,a=X;d=parseFloat(g[o++]),X=parseFloat(g[o++]),l=parseFloat(g[o++]),v=parseFloat(g[o++]),u(),c[m]=geometries.path2.appendBezier({segments:r,controlPoints:[[svg2cagX(e,s),svg2cagY(a,s)],[svg2cagX(d,s),svg2cagY(X,s)],[svg2cagX(l,s),svg2cagY(v,s)]]},c[m]);const t=reflect(d,X,l,v);d=t[0],X=t[1]}break;case"h":for(;g.length>=o+1;)l+=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"H":for(;g.length>=o+1;)l=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"l":for(;g.length>=o+2;)l+=parseFloat(g[o++]),v+=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"L":for(;g.length>=o+2;)l=parseFloat(g[o++]),v=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"v":for(;g.length>=o+1;)v+=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"V":for(;g.length>=o+1;)v=parseFloat(g[o++]),c[m]=appendPoints([[svg2cagX(l,s),svg2cagY(v,s)]],c[m]);break;case"z":case"Z":c[m]=geometries.path2.close(c[m]),l=p,v=i,F=!0;break;default:console.log("Warning: Unknow PATH command ["+t.c+"]")}const h=e=>"z"===e||"Z"===e;if(!0!==F&&c[m]&&c[m].isClosed){let s=e.commands[a+1];if(!s||!h(s.c))if("trim"===n)for(;s&&!h(s.c);)a++,s=e.commands[a+1];else{if("split"!==n)throw new Error(`Malformed svg path at ${e.position[0]}:${t.pos}. Path closed itself with command #${a} ${t.c}${g.join(" ")}`);P()}}}return c};
|
|
645
571
|
|
|
646
|
-
},{"./helpers":
|
|
647
|
-
const{
|
|
572
|
+
},{"./helpers":91,"@jscad/modeling":185}],94:[function(require,module,exports){
|
|
573
|
+
const{svg2cagX:svg2cagX,svg2cagY:svg2cagY,cagLengthX:cagLengthX,cagLengthY:cagLengthY,cagLengthP:cagLengthP,reflect:reflect}=require("./helpers"),shapesMap=(e,t,s)=>{const{level:a,indent:g,on:n,svgUnitsPmm:o,svgUnitsX:r,svgUnitsY:$,svgUnitsV:i,svgGroups:c,target:p,segments:h}=s;return{group:e=>{let s=t({target:p,segments:h},e);return s+=`${g}${n} = levels.l${a+1}\n`},rect:(e,t,s,a,o,r,$,i)=>{let c=cagLengthX(e.x,t,s),h=0-cagLengthY(e.y,t,a);const l=cagLengthX(e.width,t,s),f=cagLengthY(e.height,t,a),v=cagLengthX(e.rx,t,s);let m;return l>0&&f>0&&(c=(c+l/2).toFixed(4),h=(h-f/2).toFixed(4),m=0===v?`${g}${n} = primitives.rectangle({center: [${c}, ${h}], size: [${l}, ${f}]}) // line ${e.position}\n`:`${g}${n} = primitives.roundedRectangle({center: [${c}, ${h}], segments: ${i}, size: [${l}, ${f}], roundRadius: ${v}}) // line ${e.position}\n`,"path"===p&&(m+=`${g}${n} = geometries.path2.fromPoints({closed: true}, geometries.geom2.toPoints(${n}))\n`)),m},circle:(e,t,s,a,o,r,$,i)=>{const c=cagLengthX(e.x,t,s),h=0-cagLengthY(e.y,t,a),l=cagLengthP(e.radius,t,o);let f;return l>0&&(f=`${g}${n} = primitives.circle({center: [${c}, ${h}], segments: ${i}, radius: ${l}}) // line ${e.position}\n`,"path"===p&&(f+=`${g}${n} = geometries.path2.fromPoints({closed: true}, geometries.geom2.toPoints(${n}))\n`)),f},ellipse:(e,t,s,a,o,r,$,i)=>{const c=cagLengthX(e.rx,t,s),h=cagLengthY(e.ry,t,a),l=cagLengthX(e.cx,t,s),f=0-cagLengthY(e.cy,t,a);let v;return c>0&&h>0&&(v=`${g}${n} = primitives.ellipse({center: [${l}, ${f}], segments: ${i}, radius: [${c}, ${h}]}) // line ${e.position}\n`,"path"===p&&(v+=`${g}${n} = geometries.path2.fromPoints({closed: true}, geometries.geom2.toPoints(${n}))\n`)),v},line:(e,t,s,a,o)=>{const r=cagLengthX(e.x1,t,s),$=0-cagLengthY(e.y1,t,a),i=cagLengthX(e.x2,t,s),c=0-cagLengthY(e.y2,t,a);return`${g}${n} = primitives.line([[${r}, ${$}], [${i}, ${c}]]) // line ${e.position}\n`},polygon:(e,t,s,a)=>{let o=`${g}${n} = primitives.polygon({points: [\n`;for(let n=0;n<e.points.length;n++){const r=e.points[n];if("x"in r&&"y"in r){const e=cagLengthX(r.x,t,s),n=0-cagLengthY(r.y,t,a);o+=`${g} [${e}, ${n}],\n`}}return o+=`${g}]}) // line ${e.position}\n`,"path"===p&&(o+=`${g}${n} = geometries.path2.fromPoints({closed: true}, geometries.geom2.toPoints(${n}))\n`),o},polyline:(e,t,s,a,o)=>{let r=`${g}${n} = geometries.path2.fromPoints({}, [\n`;for(let n=0;n<e.points.length;n++){const o=e.points[n];if("x"in o&&"y"in o){const e=cagLengthX(o.x,t,s),n=0-cagLengthY(o.y,t,a);r+=`${g} [${e}, ${n}],\n`}}return r+=`${g}]) // line ${e.position}\n`},path:path}[e.type](e,o,r,$,i,s,c,h)};module.exports=shapesMap;const path=(e,t,s,a,g,n,o,r)=>{const{indent:$,on:i,target:c}=n;let p=`${$}parts = [] // line ${e.position}\n`,h=0,l=0,f=0,v=0,m=0,F=i+m,X=!1,Y=0,d=0,P=0,u=0;for(let s=0;s<e.commands.length;s++){const a=e.commands[s],g=a.p;switch(a.c){case"m":for(0===s&&(f=0,v=0),m>0&&!1===X&&(p+=`${$}parts.push(${F})\n`),g.length>=2&&(f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),X=!1,p+=`${$}${F=i+ ++m} = geometries.path2.fromPoints({}, [[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]])\n`,h=f,l=v);g.length>=2;)f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([${svg2cagX(f,t)}, ${svg2cagY(v,t)}], ${F})\n`;break;case"M":for(m>0&&!1===X&&(p+=`${$}parts.push(${F})\n`),g.length>=2&&(f=parseFloat(g.shift()),v=parseFloat(g.shift()),X=!1,p+=`${$}${F=i+ ++m} = geometries.path2.fromPoints({}, [[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]])\n`,h=f,l=v);g.length>=2;)f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([${svg2cagX(f,t)}, ${svg2cagY(v,t)}], ${F})\n`;break;case"a":for(;g.length>=7;){const e=parseFloat(g.shift()),s=parseFloat(g.shift()),a=0-.017453292519943295*parseFloat(g.shift()),n="1"===g.shift(),o="1"===g.shift();f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendArc({segments: ${r}, endpoint: [${svg2cagX(f,t)}, ${svg2cagY(v,t)}], radius: [${svg2cagX(e,t)}, ${svg2cagY(s,t)}], xaxisrotation: ${a}, clockwise: ${o}, large: ${n}}, ${F})\n`}break;case"A":for(;g.length>=7;){const e=parseFloat(g.shift()),s=parseFloat(g.shift()),a=0-.017453292519943295*parseFloat(g.shift()),n="1"===g.shift(),o="1"===g.shift();f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendArc({segments: ${r}, endpoint: [${svg2cagX(f,t)}, ${svg2cagY(v,t)}], radius: [${svg2cagX(e,t)}, ${svg2cagY(s,t)}], xaxisrotation: ${a}, clockwise: ${o}, large: ${n}}, ${F})\n`}break;case"c":for(;g.length>=6;){const e=f+parseFloat(g.shift()),s=v+parseFloat(g.shift());Y=f+parseFloat(g.shift()),d=v+parseFloat(g.shift()),f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(e,t)}, ${svg2cagY(s,t)}], [${svg2cagX(Y,t)}, ${svg2cagY(d,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const a=reflect(Y,d,f,v);Y=a[0],d=a[1]}break;case"C":for(;g.length>=6;){const e=parseFloat(g.shift()),s=parseFloat(g.shift());Y=parseFloat(g.shift()),d=parseFloat(g.shift()),f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(e,t)}, ${svg2cagY(s,t)}], [${svg2cagX(Y,t)}, ${svg2cagY(d,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const a=reflect(Y,d,f,v);Y=a[0],d=a[1]}break;case"q":for(;g.length>=4;){P=f+parseFloat(g.shift()),u=v+parseFloat(g.shift()),f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(P,t)}, ${svg2cagY(u,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const e=reflect(P,u,f,v);P=e[0],u=e[1]}break;case"Q":for(;g.length>=4;){P=parseFloat(g.shift()),u=parseFloat(g.shift()),f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(P,t)}, ${svg2cagY(u,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const e=reflect(P,u,f,v);P=e[0],u=e[1]}break;case"t":for(;g.length>=2;){f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(P,t)}, ${svg2cagY(u,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const e=reflect(P,u,f,v);P=e[0],u=e[1]}break;case"T":for(;g.length>=2;){f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(P,t)}, ${svg2cagY(u,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const e=reflect(P,u,f,v);P=e[0],u=e[1]}break;case"s":for(;g.length>=4;){const e=Y,s=d;Y=f+parseFloat(g.shift()),d=v+parseFloat(g.shift()),f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(e,t)}, ${svg2cagY(s,t)}], [${svg2cagX(Y,t)}, ${svg2cagY(d,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const a=reflect(Y,d,f,v);Y=a[0],d=a[1]}break;case"S":for(;g.length>=4;){const e=Y,s=d;Y=parseFloat(g.shift()),d=parseFloat(g.shift()),f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendBezier({segments: ${r}, controlPoints: [[${svg2cagX(e,t)}, ${svg2cagY(s,t)}], [${svg2cagX(Y,t)}, ${svg2cagY(d,t)}], [${svg2cagX(f,t)}, ${svg2cagY(v,t)}]]}, ${F})\n`;const a=reflect(Y,d,f,v);Y=a[0],d=a[1]}break;case"h":for(;g.length>=1;)f+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"H":for(;g.length>=1;)f=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"l":for(;g.length>=2;)f+=parseFloat(g.shift()),v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"L":for(;g.length>=2;)f=parseFloat(g.shift()),v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"v":for(;g.length>=1;)v+=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"V":for(;g.length>=1;)v=parseFloat(g.shift()),p+=`${$}${F} = geometries.path2.appendPoints([[${svg2cagX(f,t)}, ${svg2cagY(v,t)}]], ${F})\n`;break;case"z":case"Z":p+=`${$}${F} = geometries.path2.close(${F})\n`,"geom2"===c&&(p+=`${$}${F} = geometries.geom2.fromPoints(geometries.path2.toPoints(${F}))\n`),p+=`${$}parts.push(${F})\n`,f=h,v=l,X=!0;break;default:console.log("Warning: Unknow PATH command ["+a.c+"]")}}return m>0&&!1===X&&(p+=`${$}parts.push(${F})\n`),p+=`${$}${i} = parts\n`};
|
|
648
574
|
|
|
649
|
-
},{"./
|
|
575
|
+
},{"./helpers":91}],95:[function(require,module,exports){
|
|
576
|
+
const{cagColor:cagColor,cssStyle:cssStyle,css2cag:css2cag}=require("./helpers"),{pxPmm:pxPmm}=require("./constants"),svgCore=(s,e)=>{"id"in e&&(s.id=e.id),"position"in e&&(s.position=e.position)},svgPresentation=(s,e)=>{if("display"in e&&(s.visible=e.display),"color"in e&&(s.fill=cagColor(e.color),s.stroke=s.fill),"opacity"in e&&(s.opacity=e.opacity),"fill"in e)s.fill=cagColor(e.fill);else{const t=cssStyle(e,"fill");t&&(s.fill=cagColor(t))}if("fill-opacity"in e&&(s.opacity=e["fill-opacity"]),"stroke-width"in e)s.strokeWidth=e["stroke-width"];else{const t=cssStyle(e,"stroke-width");t&&(s.strokeWidth=t)}if("stroke"in e)s.stroke=cagColor(e.stroke);else{const t=cssStyle(e,"stroke");t&&(s.stroke=cagColor(t))}"stroke-opacity"in e&&(s.strokeOpacity=e["stroke-opacity"])},svgTransformsRegExp=/\w+\(.+\)/i,svgTransforms=(s,e)=>{let t=null;if("transform"in e)t=e.transform;else{const s=cssStyle(e,"transform");s&&(t=s)}if(null!==t){s.transforms=[];let e=svgTransformsRegExp.exec(t);for(;null!==e;){const i=svgTransformsRegExp.lastIndex,n=t.indexOf(")")+1;let r=t.slice(i,n);const o=(r=r.trim()).slice(0,r.indexOf("("));let a,c=r.slice(r.indexOf("(")+1,r.indexOf(")")).trim();switch(c=c.indexOf(",")>0?c.split(","):c.split(" "),o){case"translate":1===c.length&&c.push(0),a={translate:[c[0],c[1]]},s.transforms.push(a);break;case"scale":1===c.length&&c.push(c[0]),a={scale:[c[0],c[1]]},s.transforms.push(a);break;case"rotate":a={rotate:c},s.transforms.push(a)}t=t.slice(n,t.length),e=svgTransformsRegExp.exec(t)}}},viewBoxRegExp=/([\d.-]+)[\s,]+([\d.-]+)[\s,]+([\d.-]+)[\s,]+([\d.-]+)/i,svgSvg=(s,{customPxPmm:e})=>{const t={type:"svg",x:0,y:0,width:"100%",height:"100%",strokeWidth:"1"};if(t.unitsPmm=[pxPmm,pxPmm],"pxpmm"in s&&(t.pxPmm=s.pxpmm,t.unitsPmm=[t.pxPmm,t.pxPmm]),"width"in s&&(t.width=s.width),"height"in s&&(t.height=s.height),"viewBox"in s){const i=s.viewBox.trim(),n=viewBoxRegExp.exec(i);if(null!==n&&(t.viewX=parseFloat(n[1]),t.viewY=parseFloat(n[2]),t.viewW=parseFloat(n[3]),t.viewH=parseFloat(n[4])),t.width.indexOf("%")<0){let s=css2cag(t.width,e);s=t.viewW/s,t.unitsPmm[0]=s}else{const s=t.unitsPmm[0]*(parseFloat(t.width)/100);t.unitsPmm[0]=s}if(t.height.indexOf("%")<0){let s=css2cag(t.height,pxPmm);s=t.viewH/s,t.unitsPmm[1]=s}else{const s=t.unitsPmm[1]*(parseFloat(t.height)/100);t.unitsPmm[1]=s}}else t.viewX=0,t.viewY=0,t.viewW=1920/t.unitsPmm[0],t.viewH=1080/t.unitsPmm[1];return t.viewP=Math.sqrt(t.viewW*t.viewW+t.viewH*t.viewH)/Math.SQRT2,svgCore(t,s),svgPresentation(t,s),t.objects=[],t},svgEllipse=s=>{const e={type:"ellipse",cx:"0",cy:"0",rx:"0",ry:"0"};return"cx"in s&&(e.cx=s.cx),"cy"in s&&(e.cy=s.cy),"rx"in s&&(e.rx=s.rx),"ry"in s&&(e.ry=s.ry),svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),e},svgLine=s=>{const e={type:"line",x1:"0",y1:"0",x2:"0",y2:"0"};return"x1"in s&&(e.x1=s.x1),"y1"in s&&(e.y1=s.y1),"x2"in s&&(e.x2=s.x2),"y2"in s&&(e.y2=s.y2),svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),e},svgListOfPoints=s=>{const e=[],t=/([\d\-+.]+)[\s,]+([\d\-+.]+)[\s,]*/i;s=s.trim();let i=t.exec(s);for(;null!==i;){let n=i[0];const r=t.lastIndex+n.length;n={x:i[1],y:i[2]},e.push(n),s=s.slice(r,s.length),i=t.exec(s)}return e},svgPolyline=s=>{const e={type:"polyline"};return svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),"points"in s&&(e.points=svgListOfPoints(s.points)),e},svgPolygon=s=>{const e={type:"polygon"};return svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),"points"in s&&(e.points=svgListOfPoints(s.points)),e},svgRect=s=>{const e={type:"rect",x:"0",y:"0",rx:"0",ry:"0",width:"0",height:"0"};return"x"in s&&(e.x=s.x),"y"in s&&(e.y=s.y),"rx"in s&&(e.rx=s.rx,"ry"in s||(e.ry=e.rx)),"ry"in s&&(e.ry=s.ry,"rx"in s||(e.rx=e.ry)),e.rx!==e.ry&&console.log("Warning: Unsupported RECT with rx and ry radius"),"width"in s&&(e.width=s.width),"height"in s&&(e.height=s.height),svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),e},svgCircle=s=>{const e={type:"circle",x:"0",y:"0",radius:"0"};return"cx"in s&&(e.x=s.cx),"cy"in s&&(e.y=s.cy),"r"in s&&(e.radius=s.r),svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),e},svgGroup=s=>{const e={type:"group"};if(svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),"x"in s||"y"in s){let t="0",i="0";"x"in s&&(t=s.x),"y"in s&&(i=s.y),"transforms"in e||(e.transforms=[]);const n={translate:[t,i]};e.transforms.push(n)}return e.objects=[],e},svgPath=s=>{const e={type:"path"};if(svgTransforms(e,s),svgCore(e,s),svgPresentation(e,s),e.commands=[],"d"in s){let t=null,i="",n=0;const r=s.d.length,o=s.position[1]-r-2;for(;n<r;){const r=s.d[n];switch(r){case"-":i.length>0&&(t.p.push(i),i=""),i+=r;break;case".":i.length>0&&i.indexOf(".")>=0&&(t.p.push(i),i=""),i+=r;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":i+=r;break;case"a":case"A":case"c":case"C":case"h":case"H":case"l":case"L":case"v":case"V":case"m":case"M":case"q":case"Q":case"s":case"S":case"t":case"T":case"z":case"Z":null!==t&&(i.length>0&&(t.p.push(i),i=""),e.commands.push(t)),t={c:r,p:[],pos:n+o};break;case",":case" ":case"\n":null!==t&&i.length>0&&(t.p.push(i),i="")}n++}n===r&&null!==t&&(i.length>0&&t.p.push(i),e.commands.push(t))}return e},svgUse=(s,{svgObjects:e})=>{const t={type:"group"};if(svgTransforms(t,s),svgCore(t,s),svgPresentation(t,s),"x"in s||"y"in s){let e="0",i="0";"x"in s&&(e=s.x),"y"in s&&(i=s.y),"transforms"in t||(t.transforms=[]);const n={translate:[e,i]};t.transforms.push(n)}if(t.objects=[],"xlink:href"in s){let i=s["xlink:href"];"#"===i[0]&&(i=i.slice(1,i.length)),void 0!==e[i]&&(i=e[i],i=JSON.parse(JSON.stringify(i)),t.objects.push(i))}return t};module.exports={svgCore:svgCore,svgPresentation:svgPresentation,svgSvg:svgSvg,svgRect:svgRect,svgCircle:svgCircle,svgEllipse:svgEllipse,svgLine:svgLine,svgPolyline:svgPolyline,svgPolygon:svgPolygon,svgGroup:svgGroup,svgPath:svgPath,svgUse:svgUse};
|
|
577
|
+
|
|
578
|
+
},{"./constants":90,"./helpers":91}],96:[function(require,module,exports){
|
|
650
579
|
const{geometries:geometries,maths:maths,measurements:measurements,utils:utils}=require("@jscad/modeling"),stringify=require("onml/lib/stringify"),version=require("./package.json").version,mimeType="image/svg+xml",serialize=(e,...t)=>{const s={unit:"mm",decimals:1e4,version:version,statusCallback:null};e=Object.assign({},s,e);const o=(t=utils.flatten(t)).filter(e=>geometries.geom2.isA(e)||geometries.path2.isA(e));if(0===o.length)throw new Error("only 2D geometries can be serialized to SVG");t.length!==o.length&&console.warn("some objects could not be serialized to SVG"),e.statusCallback&&e.statusCallback({progress:0});const r=getBounds(o);let n=0,i=0;r&&(n=Math.round((r[1][0]-r[0][0])*e.decimals)/e.decimals,i=Math.round((r[1][1]-r[0][1])*e.decimals)/e.decimals);let l=["svg",{width:n+e.unit,height:i+e.unit,viewBox:"0 0 "+n+" "+i,version:"1.1",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}];r&&(l=l.concat(convertObjects(o,r,e)));const a=`<?xml version="1.0" encoding="UTF-8"?>\n\x3c!-- Created by JSCAD SVG Serializer --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">\n${stringify(l,2)}`;return e.statusCallback&&e.statusCallback({progress:100}),[a]},getBounds=e=>{const t=measurements.measureBoundingBox(e);return 1===e.length?t:t.reduce((e,t)=>(maths.vec3.min(e[0],e[0],t[0]),maths.vec3.max(e[1],e[1],t[1]),e),[[0,0,0],[0,0,0]])},convertObjects=(e,t,s)=>{const o=0-t[0][0],r=0-t[1][1],n=[];return e.forEach((t,i)=>{s.statusCallback&&s.statusCallback({progress:100*i/e.length}),geometries.geom2.isA(t)&&n.push(convertGeom2(t,[o,r],s)),geometries.path2.isA(t)&&n.push(convertPaths([t],[o,r],s))}),n},reflect=(e,t,s,o)=>{const r=e-s,n=t-o;return e===s&&t===s?[e,t]:e===s?[e,o-n]:t===o?[s- -r,t]:[s- -r,o-n]},convertGeom2=(e,t,s)=>{const o=geometries.geom2.toOutlines(e).map(e=>geometries.path2.fromPoints({closed:!0},e));return e.color&&o.forEach(t=>{t.fill=e.color}),convertToContinousPath(o,t,s)},convertToContinousPath=(e,t,s)=>{let o="";e.forEach(e=>o+=convertPath(e,t,s));let r=["path",{d:o}];if(e.length>0){const t=e[0];t.fill&&(r=["path",{"fill-rule":"evenodd",fill:convertColor(t.fill),d:o}])}return["g",r]},convertPaths=(e,t,s)=>e.reduce((e,o,r)=>o.color?e.concat([["path",{stroke:convertColor(o.color),"stroke-width":1,d:convertPath(o,t,s)}]]):e.concat([["path",{d:convertPath(o,t,s)}]]),["g"]),convertPath=(e,t,s)=>{let o="";const r=e.points.length+(e.isClosed?1:0);for(let n=0;n<r;n++){let r=n;r>=e.points.length&&(r-=e.points.length);const i=e.points[r],l=[i[0]+t[0],i[1]+t[1]],a=reflect(l[0],l[1],0,0),c=Math.round(a[0]*s.decimals)/s.decimals,m=Math.round(a[1]*s.decimals)/s.decimals;o+=n>0?`L${c} ${m}`:`M${c} ${m}`}return o},convertColor=e=>`rgb(${255*e[0]},${255*e[1]},${255*e[2]},${255*e[3]})`;module.exports={serialize:serialize,mimeType:mimeType};
|
|
651
580
|
|
|
652
|
-
},{"./package.json":
|
|
581
|
+
},{"./package.json":98,"@jscad/modeling":185,"onml/lib/stringify":97}],97:[function(require,module,exports){
|
|
653
582
|
"use strict";function isObject(n){return n&&"[object Object]"===Object.prototype.toString.call(n)}function indenter(n){var t=" ".repeat(n);return function(n){var e,r=[];return"string"!=typeof n?n:1===(e=n.split("\n")).length?t+n:(e.forEach(function(n){""!==n.trim()?r.push(t+n):r.push(n)}),r.join("\n"))}}function clean(n){var t=n.split("\n"),e=[];return t.forEach(function(n){""!==n.trim()&&e.push(n)}),e.join("\n")}function stringify(n,t){var e="",r=function(n){return n};return t>0&&(e="\n",r=indenter(t)),function n(t){var i,o,c;return o="",c=!0,t.some(function(t,r,u){if(0===r)return i="<"+t,1===u.length||void 0;if(1===r){if(isObject(t))return Object.keys(t).forEach(function(n){i+=" "+n+'="'+t[n]+'"'}),2===u.length||void(i+=">");i+=">"}switch(typeof t){case"string":case"number":case"boolean":case"undefined":return void(o+=t+e)}c=!1,o+=n(t)})?i+"/>"+e:c?i+clean(o)+"</"+t[0]+">"+e:i+e+r(o)+"</"+t[0]+">"+e}(n)}module.exports=stringify;
|
|
654
583
|
|
|
655
|
-
},{}],
|
|
584
|
+
},{}],98:[function(require,module,exports){
|
|
656
585
|
module.exports={
|
|
657
586
|
"name": "@jscad/svg-serializer",
|
|
658
|
-
"version": "2.2.
|
|
587
|
+
"version": "2.2.6",
|
|
659
588
|
"description": "SVG Serializer for JSCAD",
|
|
660
589
|
"repository": "https://github.com/jscad/OpenJSCAD.org",
|
|
661
590
|
"main": "index.js",
|
|
@@ -686,7 +615,7 @@ module.exports={
|
|
|
686
615
|
],
|
|
687
616
|
"license": "MIT",
|
|
688
617
|
"dependencies": {
|
|
689
|
-
"@jscad/modeling": "2.
|
|
618
|
+
"@jscad/modeling": "2.5.3",
|
|
690
619
|
"onml": "1.2.0"
|
|
691
620
|
},
|
|
692
621
|
"devDependencies": {
|
|
@@ -695,1324 +624,1321 @@ module.exports={
|
|
|
695
624
|
}
|
|
696
625
|
}
|
|
697
626
|
|
|
698
|
-
},{}],
|
|
627
|
+
},{}],99:[function(require,module,exports){
|
|
699
628
|
const{geometries:geometries,modifiers:modifiers}=require("@jscad/modeling"),{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),stringify=require("onml/lib/stringify"),mimeType="model/x3d+xml",serialize=(e,...o)=>{e=Object.assign({},{unit:"millimeter",color:[0,0,1,1],decimals:1e3,statusCallback:null},e);let t=(o=flatten(o)).filter(e=>geometries.geom3.isA(e));if(0===t.length)throw new Error("only 3D geometries can be serialized to X3D");o.length!==t.length&&console.warn("some objects could not be serialized to X3D"),t=toArray(modifiers.generalize({snap:!0,triangulate:!0},t)),e.statusCallback&&e.statusCallback({progress:0});let r=["X3D",{profile:"Interchange",version:"3.3","xmlns:xsd":"http://www.w3.org/2001/XMLSchema-instance","xsd:noNamespaceSchemaLocation":"http://www.web3d.org/specifications/x3d-3.3.xsd"},["head",{},["meta",{name:"creator",content:"Created by JSCAD"}]]];r=r.concat(convertObjects(t,e));const s=`<?xml version="1.0" encoding="UTF-8"?>\n${stringify(r,2)}`;return e&&e.statusCallback&&e.statusCallback({progress:100}),[s]},convertObjects=(e,o)=>{let t=["Scene",{}];const r=[];return e.forEach((t,s)=>{if(o.statusCallback&&o.statusCallback({progress:100*s/e.length}),geometries.geom3.isA(t)){geometries.geom3.toPolygons(t).length>0&&r.push(convertShape(t,o))}}),[t=t.concat(r)]},convertShape=(e,o)=>{return["Shape",{},convertMesh(e,o)]},convertMesh=(e,o)=>{const t=convertToTriangles(e,o),r=polygons2coordinates(t,o);return["IndexedTriangleSet",{ccw:"true",colorPerVertex:"false",solid:"false",index:r[0].join(" ")},["Coordinate",{point:r[1].join(" ")}],["Color",{color:r[2].join(" ")}]]},convertToTriangles=(e,o)=>{const t=[];return geometries.geom3.toPolygons(e).forEach(r=>{const s=r.vertices[0];for(let n=r.vertices.length-3;n>=0;n--){const l=geometries.poly3.fromPoints([s,r.vertices[n+1],r.vertices[n+2]]);let i=o.color;e.color&&(i=e.color),r.color&&(i=r.color),l.color=i,t.push(l)}}),t},convertToColor=(e,o)=>{let t=o.color;return e.color&&(t=e.color),`${t[0]} ${t[1]} ${t[2]}`},polygons2coordinates=(e,o)=>{const t=[],r=[],s=[],n=new Map;return e.forEach(e=>{const l=[],i=e.vertices.length;for(let t=0;t<i;t++){const s=e.vertices[t],i=`${s[0]},${s[1]},${s[2]}`;if(!n.has(i)){const e=Math.round(s[0]*o.decimals)/o.decimals,t=Math.round(s[1]*o.decimals)/o.decimals,l=Math.round(s[2]*o.decimals)/o.decimals;r.push(`${e} ${t} ${l}`),n.set(i,r.length-1)}l.push(n.get(i))}t.push(l.join(" ")),s.push(convertToColor(e,o))}),n.clear(),[t,r,s]};module.exports={serialize:serialize,mimeType:mimeType};
|
|
700
629
|
|
|
701
|
-
},{"@jscad/array-utils":
|
|
630
|
+
},{"@jscad/array-utils":483,"@jscad/modeling":185,"onml/lib/stringify":100}],100:[function(require,module,exports){
|
|
702
631
|
"use strict";function isObject(n){return n&&"[object Object]"===Object.prototype.toString.call(n)}function indenter(n){var t=" ".repeat(n);return function(n){var e,r=[];return"string"!=typeof n?n:1===(e=n.split("\n")).length?t+n:(e.forEach(function(n){""!==n.trim()?r.push(t+n):r.push(n)}),r.join("\n"))}}function clean(n){var t=n.split("\n"),e=[];return t.forEach(function(n){""!==n.trim()&&e.push(n)}),e.join("\n")}function stringify(n,t){var e="",r=function(n){return n};return t>0&&(e="\n",r=indenter(t)),function n(t){var i,o,c;return o="",c=!0,t.some(function(t,r,u){if(0===r)return i="<"+t,1===u.length||void 0;if(1===r){if(isObject(t))return Object.keys(t).forEach(function(n){i+=" "+n+'="'+t[n]+'"'}),2===u.length||void(i+=">");i+=">"}switch(typeof t){case"string":case"number":case"boolean":case"undefined":return void(o+=t+e)}c=!1,o+=n(t)})?i+"/>"+e:c?i+clean(o)+"</"+t[0]+">"+e:i+e+r(o)+"</"+t[0]+">"+e}(n)}module.exports=stringify;
|
|
703
632
|
|
|
704
|
-
},{}],
|
|
633
|
+
},{}],101:[function(require,module,exports){
|
|
705
634
|
const cssColors=require("./cssColors"),colorNameToRgb=o=>cssColors[o.toLowerCase()];module.exports=colorNameToRgb;
|
|
706
635
|
|
|
707
|
-
},{"./cssColors":
|
|
636
|
+
},{"./cssColors":103}],102:[function(require,module,exports){
|
|
708
637
|
const flatten=require("../utils/flatten"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),colorGeom2=(o,e)=>{const r=geom2.create(geom2.toSides(e));return r.color=o,r},colorGeom3=(o,e)=>{const r=geom3.create(geom3.toPolygons(e));return r.color=o,r},colorPath2=(o,e)=>{const r=path2.clone(e);return r.color=o,r},colorPoly3=(o,e)=>{const r=poly3.clone(e);return r.color=o,r},colorize=(o,...e)=>{if(!Array.isArray(o))throw new Error("color must be an array");if(o.length<3)throw new Error("color must contain R, G and B values");if(3===o.length&&(o=[o[0],o[1],o[2],1]),0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const r=e.map(e=>geom2.isA(e)?colorGeom2(o,e):geom3.isA(e)?colorGeom3(o,e):path2.isA(e)?colorPath2(o,e):poly3.isA(e)?colorPoly3(o,e):(e.color=o,e));return 1===r.length?r[0]:r};module.exports=colorize;
|
|
709
638
|
|
|
710
|
-
},{"../geometries/geom2":
|
|
639
|
+
},{"../geometries/geom2":122,"../geometries/geom3":136,"../geometries/path2":157,"../geometries/poly3":173,"../utils/flatten":473}],103:[function(require,module,exports){
|
|
711
640
|
const cssColors={black:[0,0,0],silver:[192/255,192/255,192/255],gray:[128/255,128/255,128/255],white:[1,1,1],maroon:[128/255,0,0],red:[1,0,0],purple:[128/255,0,128/255],fuchsia:[1,0,1],green:[0,128/255,0],lime:[0,1,0],olive:[128/255,128/255,0],yellow:[1,1,0],navy:[0,0,128/255],blue:[0,0,1],teal:[0,128/255,128/255],aqua:[0,1,1],aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],blanchedalmond:[1,235/255,205/255],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],oldlace:[253/255,245/255,230/255],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],rosybrown:[188/255,143/255,143/255],royalblue:[65/255,105/255,225/255],saddlebrown:[139/255,69/255,19/255],salmon:[250/255,128/255,114/255],sandybrown:[244/255,164/255,96/255],seagreen:[46/255,139/255,87/255],seashell:[1,245/255,238/255],sienna:[160/255,82/255,45/255],skyblue:[135/255,206/255,235/255],slateblue:[106/255,90/255,205/255],slategray:[112/255,128/255,144/255],slategrey:[112/255,128/255,144/255],snow:[1,250/255,250/255],springgreen:[0,1,127/255],steelblue:[70/255,130/255,180/255],tan:[210/255,180/255,140/255],thistle:[216/255,191/255,216/255],tomato:[1,99/255,71/255],turquoise:[64/255,224/255,208/255],violet:[238/255,130/255,238/255],wheat:[245/255,222/255,179/255],whitesmoke:[245/255,245/255,245/255],yellowgreen:[154/255,205/255,50/255]};module.exports=cssColors;
|
|
712
641
|
|
|
713
|
-
},{}],
|
|
642
|
+
},{}],104:[function(require,module,exports){
|
|
714
643
|
const hexToRgb=t=>{if((t=t.replace("#","")).length<6)throw new Error("the given notation must contain 3 or more hex values");const e=parseInt(t.substring(0,2),16)/255,n=parseInt(t.substring(2,4),16)/255,r=parseInt(t.substring(4,6),16)/255;if(t.length>=8){return[e,n,r,parseInt(t.substring(6,8),16)/255]}return[e,n,r]};module.exports=hexToRgb;
|
|
715
644
|
|
|
716
|
-
},{}],
|
|
645
|
+
},{}],105:[function(require,module,exports){
|
|
717
646
|
const flatten=require("../utils/flatten"),hueToColorComponent=require("./hueToColorComponent"),hslToRgb=(...o)=>{if((o=flatten(o)).length<3)throw new Error("values must contain H, S and L values");const e=o[0],n=o[1],t=o[2];let r=t,l=t,u=t;if(0!==n){const o=t<.5?t*(1+n):t+n-t*n,h=2*t-o;r=hueToColorComponent(h,o,e+1/3),l=hueToColorComponent(h,o,e),u=hueToColorComponent(h,o,e-1/3)}if(o.length>3){return[r,l,u,o[3]]}return[r,l,u]};module.exports=hslToRgb;
|
|
718
647
|
|
|
719
|
-
},{"../utils/flatten":
|
|
648
|
+
},{"../utils/flatten":473,"./hueToColorComponent":107}],106:[function(require,module,exports){
|
|
720
649
|
const flatten=require("../utils/flatten"),hsvToRgb=(...e)=>{if((e=flatten(e)).length<3)throw new Error("values must contain H, S and V values");const t=e[0],a=e[1],r=e[2];let s=0,n=0,o=0;const c=Math.floor(6*t),l=6*t-c,u=r*(1-a),b=r*(1-l*a),h=r*(1-(1-l)*a);switch(c%6){case 0:s=r,n=h,o=u;break;case 1:s=b,n=r,o=u;break;case 2:s=u,n=r,o=h;break;case 3:s=u,n=b,o=r;break;case 4:s=h,n=u,o=r;break;case 5:s=r,n=u,o=b}if(e.length>3){return[s,n,o,e[3]]}return[s,n,o]};module.exports=hsvToRgb;
|
|
721
650
|
|
|
722
|
-
},{"../utils/flatten":
|
|
651
|
+
},{"../utils/flatten":473}],107:[function(require,module,exports){
|
|
723
652
|
const hueToColorComponent=(o,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?o+6*(e-o)*n:n<.5?e:n<2/3?o+(e-o)*(2/3-n)*6:o);module.exports=hueToColorComponent;
|
|
724
653
|
|
|
725
|
-
},{}],
|
|
654
|
+
},{}],108:[function(require,module,exports){
|
|
726
655
|
module.exports={colorize:require("./colorize"),colorNameToRgb:require("./colorNameToRgb"),cssColors:require("./cssColors"),hexToRgb:require("./hexToRgb"),hslToRgb:require("./hslToRgb"),hsvToRgb:require("./hsvToRgb"),hueToColorComponent:require("./hueToColorComponent"),rgbToHex:require("./rgbToHex"),rgbToHsl:require("./rgbToHsl"),rgbToHsv:require("./rgbToHsv")};
|
|
727
656
|
|
|
728
|
-
},{"./colorNameToRgb":
|
|
657
|
+
},{"./colorNameToRgb":101,"./colorize":102,"./cssColors":103,"./hexToRgb":104,"./hslToRgb":105,"./hsvToRgb":106,"./hueToColorComponent":107,"./rgbToHex":109,"./rgbToHsl":110,"./rgbToHsv":111}],109:[function(require,module,exports){
|
|
729
658
|
const flatten=require("../utils/flatten"),rgbToHex=(...t)=>{if((t=flatten(t)).length<3)throw new Error("values must contain R, G and B values");const e=255*t[0],r=255*t[1],n=255*t[2];let o=`#${Number(16777216+65536*e+256*r+n).toString(16).substring(1,7)}`;return t.length>3&&(o+=Number(255*t[3]).toString(16)),o};module.exports=rgbToHex;
|
|
730
659
|
|
|
731
|
-
},{"../utils/flatten":
|
|
660
|
+
},{"../utils/flatten":473}],110:[function(require,module,exports){
|
|
732
661
|
const flatten=require("../utils/flatten"),rgbToHsl=(...t)=>{if((t=flatten(t)).length<3)throw new Error("values must contain R, G and B values");const e=t[0],n=t[1],s=t[2],a=Math.max(e,n,s),r=Math.min(e,n,s);let l,o;const c=(a+r)/2;if(a===r)l=o=0;else{const t=a-r;switch(o=c>.5?t/(2-a-r):t/(a+r),a){case e:l=(n-s)/t+(n<s?6:0);break;case n:l=(s-e)/t+2;break;case s:l=(e-n)/t+4}l/=6}if(t.length>3){return[l,o,c,t[3]]}return[l,o,c]};module.exports=rgbToHsl;
|
|
733
662
|
|
|
734
|
-
},{"../utils/flatten":
|
|
663
|
+
},{"../utils/flatten":473}],111:[function(require,module,exports){
|
|
735
664
|
const flatten=require("../utils/flatten"),rgbToHsv=(...e)=>{if((e=flatten(e)).length<3)throw new Error("values must contain R, G and B values");const t=e[0],a=e[1],n=e[2],r=Math.max(t,a,n),s=Math.min(t,a,n);let l;const o=r,c=r-s,i=0===r?0:c/r;if(r===s)l=0;else{switch(r){case t:l=(a-n)/c+(a<n?6:0);break;case a:l=(n-t)/c+2;break;case n:l=(t-a)/c+4}l/=6}if(e.length>3){return[l,i,o,e[3]]}return[l,i,o]};module.exports=rgbToHsv;
|
|
736
665
|
|
|
737
|
-
},{"../utils/flatten":
|
|
666
|
+
},{"../utils/flatten":473}],112:[function(require,module,exports){
|
|
738
667
|
const create=e=>{if(!Array.isArray(e))throw new Error("Bezier points must be a valid array/");if(e.length<2)throw new Error("Bezier points must contain at least 2 values.");const r=getPointType(e);return{points:e,pointType:r,dimensions:"float_single"===r?0:e[0].length,permutations:getPermutations(e.length-1),tangentPermutations:getPermutations(e.length-2)}},getPointType=function(e){let r=null;return e.forEach(e=>{let t="";if(Number.isFinite(e))t="float_single";else{if(!Array.isArray(e))throw new Error("Bezier points must all be numbers or arrays of number.");e.forEach(e=>{if(!Number.isFinite(e))throw new Error("Bezier point values must all be numbers.")}),t="float_"+e.length}if(null==r)r=t;else if(r!==t)throw new Error("Bezier points must be either all numbers or all arrays of numbers of the same size.")}),r},getPermutations=function(e){const r=[];for(let t=0;t<=e;t++)r.push(factorial(e)/(factorial(t)*factorial(e-t)));return r},factorial=function(e){let r=1;for(let t=2;t<=e;t++)r*=t;return r};module.exports=create;
|
|
739
668
|
|
|
740
|
-
},{}],
|
|
669
|
+
},{}],113:[function(require,module,exports){
|
|
741
670
|
module.exports={create:require("./create"),valueAt:require("./valueAt"),tangentAt:require("./tangentAt")};
|
|
742
671
|
|
|
743
|
-
},{"./create":
|
|
672
|
+
},{"./create":112,"./tangentAt":114,"./valueAt":115}],114:[function(require,module,exports){
|
|
744
673
|
const tangentAt=(t,n)=>{if(t<0||t>1)throw new Error("Bezier tangentAt() input must be between 0 and 1");if("float_single"===n.pointType)return bezierTangent(n,n.points,t);{const e=[];for(let o=0;o<n.dimensions;o++){const r=[];for(let t=0;t<n.points.length;t++)r.push(n.points[t][o]);e.push(bezierTangent(n,r,t))}return e}},bezierTangent=function(t,n,e){const o=n.length-1;let r=0;for(let i=0;i<o;i++){const s=o*(n[i+1]-n[i]);r+=t.tangentPermutations[i]*Math.pow(1-e,o-1-i)*Math.pow(e,i)*s}return r};module.exports=tangentAt;
|
|
745
674
|
|
|
746
|
-
},{}],
|
|
675
|
+
},{}],115:[function(require,module,exports){
|
|
747
676
|
const valueAt=(t,e)=>{if(t<0||t>1)throw new Error("Bezier valueAt() input must be between 0 and 1");if("float_single"===e.pointType)return bezierFunction(e,e.points,t);{const n=[];for(let o=0;o<e.dimensions;o++){const i=[];for(let t=0;t<e.points.length;t++)i.push(e.points[t][o]);n.push(bezierFunction(e,i,t))}return n}},bezierFunction=function(t,e,n){const o=e.length-1;let i=0;for(let r=0;r<=o;r++)i+=t.permutations[r]*Math.pow(1-n,o-r)*Math.pow(n,r)*e[r];return i};module.exports=valueAt;
|
|
748
677
|
|
|
749
|
-
},{}],
|
|
678
|
+
},{}],116:[function(require,module,exports){
|
|
750
679
|
module.exports={bezier:require("./bezier")};
|
|
751
680
|
|
|
752
|
-
},{"./bezier":
|
|
753
|
-
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),applyTransforms=r=>mat4.
|
|
681
|
+
},{"./bezier":113}],117:[function(require,module,exports){
|
|
682
|
+
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),applyTransforms=r=>mat4.isIdentity(r.transforms)?r:(r.sides=r.sides.map(s=>{return[vec2.transform(vec2.create(),s[0],r.transforms),vec2.transform(vec2.create(),s[1],r.transforms)]}),mat4.identity(r.transforms),r);module.exports=applyTransforms;
|
|
754
683
|
|
|
755
|
-
},{"../../maths/mat4":
|
|
684
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282}],118:[function(require,module,exports){
|
|
756
685
|
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),create=require("./create"),clone=e=>{const r=create();return r.sides=e.sides.map(e=>[vec2.clone(e[0]),vec2.clone(e[1])]),r.transforms=mat4.clone(e.transforms),r};module.exports=clone;
|
|
757
686
|
|
|
758
|
-
},{"../../maths/mat4":
|
|
687
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282,"./create":119}],119:[function(require,module,exports){
|
|
759
688
|
const mat4=require("../../maths/mat4"),create=e=>(void 0===e&&(e=[]),{sides:e,transforms:mat4.create()});module.exports=create;
|
|
760
689
|
|
|
761
|
-
},{"../../maths/mat4":
|
|
690
|
+
},{"../../maths/mat4":237}],120:[function(require,module,exports){
|
|
762
691
|
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),create=require("./create"),fromCompactBinary=e=>{if(0!==e[0])throw new Error("invalid compact binary data");const r=create();r.transforms=mat4.clone(e.slice(1,17));for(let t=21;t<e.length;t+=4){const a=vec2.fromValues(e[t+0],e[t+1]),o=vec2.fromValues(e[t+2],e[t+3]);r.sides.push([a,o])}return e[17]>=0&&(r.color=[e[17],e[18],e[19],e[20]]),r};module.exports=fromCompactBinary;
|
|
763
692
|
|
|
764
|
-
},{"../../maths/mat4":
|
|
693
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282,"./create":119}],121:[function(require,module,exports){
|
|
765
694
|
const vec2=require("../../maths/vec2"),create=require("./create"),fromPoints=e=>{if(!Array.isArray(e))throw new Error("the given points must be an array");let r=e.length;if(r<3)throw new Error("the given points must define a closed geometry with three or more points");vec2.equals(e[0],e[r-1])&&--r;const t=[];let o=e[r-1];for(let n=0;n<r;n++){const r=e[n];t.push([vec2.clone(o),vec2.clone(r)]),o=r}return create(t)};module.exports=fromPoints;
|
|
766
695
|
|
|
767
|
-
},{"../../maths/vec2":
|
|
696
|
+
},{"../../maths/vec2":282,"./create":119}],122:[function(require,module,exports){
|
|
768
697
|
module.exports={clone:require("./clone"),create:require("./create"),fromPoints:require("./fromPoints"),fromCompactBinary:require("./fromCompactBinary"),isA:require("./isA"),reverse:require("./reverse"),toOutlines:require("./toOutlines"),toPoints:require("./toPoints"),toSides:require("./toSides"),toString:require("./toString"),toCompactBinary:require("./toCompactBinary"),transform:require("./transform")};
|
|
769
698
|
|
|
770
|
-
},{"./clone":
|
|
699
|
+
},{"./clone":118,"./create":119,"./fromCompactBinary":120,"./fromPoints":121,"./isA":123,"./reverse":124,"./toCompactBinary":125,"./toOutlines":126,"./toPoints":127,"./toSides":128,"./toString":129,"./transform":130}],123:[function(require,module,exports){
|
|
771
700
|
const isA=s=>!!(s&&"object"==typeof s&&"sides"in s&&"transforms"in s&&Array.isArray(s.sides)&&"length"in s.transforms);module.exports=isA;
|
|
772
701
|
|
|
773
|
-
},{}],
|
|
702
|
+
},{}],124:[function(require,module,exports){
|
|
774
703
|
const create=require("./create"),toSides=require("./toSides"),reverse=e=>{const r=toSides(e).map(e=>[e[1],e[0]]);return r.reverse(),create(r)};module.exports=reverse;
|
|
775
704
|
|
|
776
|
-
},{"./create":
|
|
705
|
+
},{"./create":119,"./toSides":128}],125:[function(require,module,exports){
|
|
777
706
|
const toCompactBinary=o=>{const t=o.sides,r=o.transforms;let n=[-1,-1,-1,-1];o.color&&(n=o.color);const e=new Float32Array(21+4*t.length);e[0]=0,e[1]=r[0],e[2]=r[1],e[3]=r[2],e[4]=r[3],e[5]=r[4],e[6]=r[5],e[7]=r[6],e[8]=r[7],e[9]=r[8],e[10]=r[9],e[11]=r[10],e[12]=r[11],e[13]=r[12],e[14]=r[13],e[15]=r[14],e[16]=r[15],e[17]=n[0],e[18]=n[1],e[19]=n[2],e[20]=n[3];for(let o=0;o<t.length;o++){const r=4*o+21,n=t[o][0],s=t[o][1];e[r+0]=n[0],e[r+1]=n[1],e[r+2]=s[0],e[r+3]=s[1]}return e};module.exports=toCompactBinary;
|
|
778
707
|
|
|
779
|
-
},{}],
|
|
708
|
+
},{}],126:[function(require,module,exports){
|
|
780
709
|
const vec2=require("../../maths/vec2"),toSides=require("./toSides"),toEdges=e=>{const t=[],s=e=>{const s=t.findIndex(t=>vec2.equals(t,e));return s<0?(t.push(e),e):t[s]},o=[];return e.forEach(e=>{o.push([s(e[0]),s(e[1])])}),o},toOutlines=e=>{const t=new Map;toEdges(toSides(e)).forEach(e=>{t.has(e[0])||t.set(e[0],[]),t.get(e[0]).push(e)});const s=[];for(;;){let e;for(const[s,o]of t){if(e=o.shift())break;t.delete(s)}if(void 0===e)break;const o=[],r=e[0],n=vec2.create();for(;;){o.push(e[0]);const s=e[1];if(s===r)break;const c=t.get(s);if(!c)throw new Error("the given geometry is not closed. verify proper construction");let i=-1;if(1===c.length)i=0;else{let t;const s=vec2.angleDegrees(vec2.subtract(n,e[1],e[0]));for(let e=0;e<c.length;e++){const o=c[e];let r=vec2.angleDegrees(vec2.subtract(n,o[1],o[0]))-s;r<-180&&(r+=360),r>=180&&(r-=360),(i<0||r>t)&&(i=e,t=r)}}const l=c[i];c.splice(i,1),0===c.length&&t.delete(s),e=l}o.length>0&&o.push(o.shift()),s.push(o)}return t.clear(),s};module.exports=toOutlines;
|
|
781
710
|
|
|
782
|
-
},{"../../maths/vec2":
|
|
711
|
+
},{"../../maths/vec2":282,"./toSides":128}],127:[function(require,module,exports){
|
|
783
712
|
const toSides=require("./toSides"),toPoints=t=>{const o=toSides(t).map(t=>t[0]);return o.length>0&&o.push(o.shift()),o};module.exports=toPoints;
|
|
784
713
|
|
|
785
|
-
},{"./toSides":
|
|
714
|
+
},{"./toSides":128}],128:[function(require,module,exports){
|
|
786
715
|
const applyTransforms=require("./applyTransforms"),toSides=s=>applyTransforms(s).sides;module.exports=toSides;
|
|
787
716
|
|
|
788
|
-
},{"./applyTransforms":
|
|
717
|
+
},{"./applyTransforms":117}],129:[function(require,module,exports){
|
|
789
718
|
const vec2=require("../../maths/vec2"),toSides=require("./toSides"),toString=e=>{const t=toSides(e);let o="geom2 ("+t.length+" sides):\n[\n";return t.forEach(e=>{o+=" ["+vec2.toString(e[0])+", "+vec2.toString(e[1])+"]\n"}),o+="]\n"};module.exports=toString;
|
|
790
719
|
|
|
791
|
-
},{"../../maths/vec2":
|
|
720
|
+
},{"../../maths/vec2":282,"./toSides":128}],130:[function(require,module,exports){
|
|
792
721
|
const mat4=require("../../maths/mat4"),create=require("./create"),transform=(r,t)=>{const e=create(t.sides);return mat4.multiply(e.transforms,r,t.transforms),e};module.exports=transform;
|
|
793
722
|
|
|
794
|
-
},{"../../maths/mat4":
|
|
795
|
-
const mat4=require("../../maths/mat4"),poly3=require("../poly3"),applyTransforms=r=>mat4.
|
|
723
|
+
},{"../../maths/mat4":237,"./create":119}],131:[function(require,module,exports){
|
|
724
|
+
const mat4=require("../../maths/mat4"),poly3=require("../poly3"),applyTransforms=r=>mat4.isIdentity(r.transforms)?r:(r.polygons=r.polygons.map(s=>poly3.transform(r.transforms,s)),mat4.identity(r.transforms),r);module.exports=applyTransforms;
|
|
796
725
|
|
|
797
|
-
},{"../../maths/mat4":
|
|
726
|
+
},{"../../maths/mat4":237,"../poly3":173}],132:[function(require,module,exports){
|
|
798
727
|
const mat4=require("../../maths/mat4"),poly3=require("../poly3"),create=require("./create"),clone=e=>{const o=create();return o.polygons=e.polygons.map(e=>poly3.clone(e)),o.isRetesselated=e.isRetesselated,o.transforms=mat4.clone(e.transforms),o};module.exports=clone;
|
|
799
728
|
|
|
800
|
-
},{"../../maths/mat4":
|
|
729
|
+
},{"../../maths/mat4":237,"../poly3":173,"./create":133}],133:[function(require,module,exports){
|
|
801
730
|
const mat4=require("../../maths/mat4"),create=e=>(void 0===e&&(e=[]),{polygons:e,isRetesselated:!1,transforms:mat4.create()});module.exports=create;
|
|
802
731
|
|
|
803
|
-
},{"../../maths/mat4":
|
|
732
|
+
},{"../../maths/mat4":237}],134:[function(require,module,exports){
|
|
804
733
|
const vec3=require("../../maths/vec3"),mat4=require("../../maths/mat4"),poly3=require("../poly3"),create=require("./create"),fromCompactBinary=e=>{if(1!==e[0])throw new Error("invalid compact binary data");const r=create();r.transforms=mat4.clone(e.slice(1,17)),r.isRetesselated=!!e[17];const t=e[22];let o=23,a=e.length-3*t;for(;a<e.length;){const t=e[o];o++;const c=[];for(let r=0;r<t;r++)c.push(vec3.fromValues(e[a],e[a+1],e[a+2])),a+=3;r.polygons.push(poly3.create(c))}return e[18]>=0&&(r.color=[e[18],e[19],e[20],e[21]]),r};module.exports=fromCompactBinary;
|
|
805
734
|
|
|
806
|
-
},{"../../maths/mat4":
|
|
735
|
+
},{"../../maths/mat4":237,"../../maths/vec3":313,"../poly3":173,"./create":133}],135:[function(require,module,exports){
|
|
807
736
|
const poly3=require("../poly3"),create=require("./create"),fromPoints=r=>{if(!Array.isArray(r))throw new Error("the given points must be an array");const e=r.map((r,e)=>{return poly3.fromPoints(r)});return create(e)};module.exports=fromPoints;
|
|
808
737
|
|
|
809
|
-
},{"../poly3":
|
|
738
|
+
},{"../poly3":173,"./create":133}],136:[function(require,module,exports){
|
|
810
739
|
module.exports={clone:require("./clone"),create:require("./create"),fromPoints:require("./fromPoints"),fromCompactBinary:require("./fromCompactBinary"),invert:require("./invert"),isA:require("./isA"),toPoints:require("./toPoints"),toPolygons:require("./toPolygons"),toString:require("./toString"),toCompactBinary:require("./toCompactBinary"),transform:require("./transform")};
|
|
811
740
|
|
|
812
|
-
},{"./clone":
|
|
741
|
+
},{"./clone":132,"./create":133,"./fromCompactBinary":134,"./fromPoints":135,"./invert":137,"./isA":138,"./toCompactBinary":139,"./toPoints":140,"./toPolygons":141,"./toString":142,"./transform":143}],137:[function(require,module,exports){
|
|
813
742
|
const poly3=require("../poly3"),create=require("./create"),toPolygons=require("./toPolygons"),invert=e=>{const o=toPolygons(e).map(e=>poly3.invert(e));return create(o)};module.exports=invert;
|
|
814
743
|
|
|
815
|
-
},{"../poly3":
|
|
744
|
+
},{"../poly3":173,"./create":133,"./toPolygons":141}],138:[function(require,module,exports){
|
|
816
745
|
const isA=o=>!!(o&&"object"==typeof o&&"polygons"in o&&"transforms"in o&&Array.isArray(o.polygons)&&"length"in o.transforms);module.exports=isA;
|
|
817
746
|
|
|
818
|
-
},{}],
|
|
747
|
+
},{}],139:[function(require,module,exports){
|
|
819
748
|
const poly3=require("../poly3"),toCompactBinary=o=>{const t=o.polygons,e=o.transforms,r=t.length,l=t.reduce((o,t)=>o+t.vertices.length,0);let n=[-1,-1,-1,-1];o.color&&(n=o.color);const s=new Float32Array(23+r+3*l);s[0]=1,s[1]=e[0],s[2]=e[1],s[3]=e[2],s[4]=e[3],s[5]=e[4],s[6]=e[5],s[7]=e[6],s[8]=e[7],s[9]=e[8],s[10]=e[9],s[11]=e[10],s[12]=e[11],s[13]=e[12],s[14]=e[13],s[15]=e[14],s[16]=e[15],s[17]=o.isRetesselated?1:0,s[18]=n[0],s[19]=n[1],s[20]=n[2],s[21]=n[3],s[22]=l;let c=23,a=c+r;return t.forEach(o=>{const t=poly3.toPoints(o);s[c]=t.length,c++;for(let o=0;o<t.length;o++){const e=t[o];s[a+0]=e[0],s[a+1]=e[1],s[a+2]=e[2],a+=3}}),s};module.exports=toCompactBinary;
|
|
820
749
|
|
|
821
|
-
},{"../poly3":
|
|
750
|
+
},{"../poly3":173}],140:[function(require,module,exports){
|
|
822
751
|
const poly3=require("../poly3"),toPolygons=require("./toPolygons"),toPoints=o=>{return toPolygons(o).map(o=>poly3.toPoints(o))};module.exports=toPoints;
|
|
823
752
|
|
|
824
|
-
},{"../poly3":
|
|
753
|
+
},{"../poly3":173,"./toPolygons":141}],141:[function(require,module,exports){
|
|
825
754
|
const applyTransforms=require("./applyTransforms"),toPolygons=o=>applyTransforms(o).polygons;module.exports=toPolygons;
|
|
826
755
|
|
|
827
|
-
},{"./applyTransforms":
|
|
756
|
+
},{"./applyTransforms":131}],142:[function(require,module,exports){
|
|
828
757
|
const poly3=require("../poly3"),toPolygons=require("./toPolygons"),toString=o=>{const t=toPolygons(o);let n="geom3 ("+t.length+" polygons):\n";return t.forEach(o=>{n+=" "+poly3.toString(o)+"\n"}),n};module.exports=toString;
|
|
829
758
|
|
|
830
|
-
},{"../poly3":
|
|
759
|
+
},{"../poly3":173,"./toPolygons":141}],143:[function(require,module,exports){
|
|
831
760
|
const mat4=require("../../maths/mat4"),create=require("./create"),transform=(e,t)=>{const r=create(t.polygons);return r.isRetesselated=t.isRetesselated,mat4.multiply(r.transforms,e,t.transforms),r};module.exports=transform;
|
|
832
761
|
|
|
833
|
-
},{"../../maths/mat4":
|
|
762
|
+
},{"../../maths/mat4":237,"./create":133}],144:[function(require,module,exports){
|
|
834
763
|
module.exports={geom2:require("./geom2"),geom3:require("./geom3"),path2:require("./path2"),poly2:require("./poly2"),poly3:require("./poly3")};
|
|
835
764
|
|
|
836
|
-
},{"./geom2":
|
|
837
|
-
const vec2=require("../../maths/vec2"),fromPoints=require("./fromPoints"),toPoints=require("./toPoints"),appendArc=(e,t)=>{let{endpoint:r,radius:a,xaxisrotation:o,clockwise:n,large:s,segments:c}=Object.assign({},{radius:[0,0],xaxisrotation:0,clockwise:!1,large:!1,segments:16},e);if(!Array.isArray(r))throw new Error("endpoint must be an array of X and Y values");if(r.length<2)throw new Error("endpoint must contain X and Y values");if(r=vec2.clone(r),!Array.isArray(a))throw new Error("radius must be an array of X and Y values");if(a.length<2)throw new Error("radius must contain X and Y values");if(c<4)throw new Error("segments must be four or more");if(t.isClosed)throw new Error("the given path cannot be closed");const i=toPoints(t);if(i.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let h=a[0],
|
|
765
|
+
},{"./geom2":122,"./geom3":136,"./path2":157,"./poly2":167,"./poly3":173}],145:[function(require,module,exports){
|
|
766
|
+
const vec2=require("../../maths/vec2"),fromPoints=require("./fromPoints"),toPoints=require("./toPoints"),appendArc=(e,t)=>{let{endpoint:r,radius:a,xaxisrotation:o,clockwise:n,large:s,segments:c}=Object.assign({},{radius:[0,0],xaxisrotation:0,clockwise:!1,large:!1,segments:16},e);if(!Array.isArray(r))throw new Error("endpoint must be an array of X and Y values");if(r.length<2)throw new Error("endpoint must contain X and Y values");if(r=vec2.clone(r),!Array.isArray(a))throw new Error("radius must be an array of X and Y values");if(a.length<2)throw new Error("radius must contain X and Y values");if(c<4)throw new Error("segments must be four or more");if(t.isClosed)throw new Error("the given path cannot be closed");const i=toPoints(t);if(i.length<1)throw new Error("the given path must contain one or more points (as the starting point for the arc)");let h=a[0],u=a[1];const l=i[i.length-1];h=Math.round(1e5*h)/1e5,u=Math.round(1e5*u)/1e5,r=vec2.fromValues(Math.round(1e5*r[0])/1e5,Math.round(1e5*r[1])/1e5);const d=!n;let v=[];if(0===h||0===u)v.push(r);else{h=Math.abs(h),u=Math.abs(u);const t=o,a=Math.cos(t),n=Math.sin(t),i=vec2.subtract(vec2.create(),l,r);vec2.scale(i,i,.5);const f=Math.round(1e5*(a*i[0]+n*i[1]))/1e5,m=Math.round(1e5*(-n*i[0]+a*i[1]))/1e5,M=vec2.fromValues(f,m),p=M[0]*M[0]/(h*h)+M[1]*M[1]/(u*u);if(p>1){const e=Math.sqrt(p);h*=e,u*=e,h=Math.round(1e5*h)/1e5,u=Math.round(1e5*u)/1e5}let w=Math.sqrt((h*h*u*u-h*h*M[1]*M[1]-u*u*M[0]*M[0])/(h*h*M[1]*M[1]+u*u*M[0]*M[0]));d===s&&(w=-w);const g=vec2.fromValues(h*M[1]/u,-u*M[0]/h);vec2.scale(g,g,w);let P=vec2.fromValues(a*g[0]-n*g[1],n*g[0]+a*g[1]);P=vec2.add(P,P,vec2.scale(vec2.create(),vec2.add(vec2.create(),l,r),.5));const b=vec2.fromValues((M[0]-g[0])/h,(M[1]-g[1])/u),E=vec2.fromValues((-M[0]-g[0])/h,(-M[1]-g[1])/u),V=vec2.angleRadians(b);let y=vec2.angleRadians(E)-V;y%=2*Math.PI,!d&&y>0?y-=2*Math.PI:d&&y<0&&(y+=2*Math.PI);let A=Math.ceil(Math.abs(y)/(2*Math.PI)*c)+1;A<1&&(A=1);for(let e=1;e<A;e++){const t=V+e/A*y,r=Math.cos(t),o=Math.sin(t),s=vec2.fromValues(a*h*r-n*u*o,n*h*r+a*u*o);vec2.add(s,s,P),v.push(s)}A&&v.push(e.endpoint)}return v=i.concat(v),fromPoints({},v)};module.exports=appendArc;
|
|
838
767
|
|
|
839
|
-
},{"../../maths/vec2":
|
|
768
|
+
},{"../../maths/vec2":282,"./fromPoints":156,"./toPoints":161}],146:[function(require,module,exports){
|
|
840
769
|
const vec2=require("../../maths/vec2"),vec3=require("../../maths/vec2"),appendPoints=require("./appendPoints"),toPoints=require("./toPoints"),appendBezier=(e,t)=>{let{controlPoints:o,segments:r}=Object.assign({},{segments:16},e);if(!Array.isArray(o))throw new Error("controlPoints must be an array of one or more points");if(o.length<1)throw new Error("controlPoints must be an array of one or more points");if(r<4)throw new Error("segments must be four or more");if(t.isClosed)throw new Error("the given geometry cannot be closed");const n=toPoints(t);if(n.length<1)throw new Error("the given path must contain one or more points (as the starting point for the bezier curve)");if(null===(o=o.slice())[0]){if(o.length<2)throw new Error("a null control point must be passed with one more control points");let e=n[n.length-2];if("lastBezierControlPoint"in t&&(e=t.lastBezierControlPoint),!Array.isArray(e))throw new Error("the given path must contain TWO or more points if given a null control point");const r=vec2.scale(vec2.create(),n[n.length-1],2);vec2.subtract(r,r,e),o[0]=r}o.unshift(n[n.length-1]);const s=o.length-1,i=[];let c=1;for(let e=0;e<=s;++e)e>0&&(c*=e),i.push(c);const a=[];for(let e=0;e<=s;++e){const t=i[s]/(i[e]*i[s-e]);a.push(t)}const l=vec2.create(),h=vec2.create(),p=vec3.create(),u=e=>{let t=1,r=Math.pow(1-e,s);const n=1!==e?1/(1-e):1,i=vec2.create();for(let c=0;c<=s;++c){c===s&&(r=1);const h=a[c]*t*r,p=vec2.scale(l,o[c],h);vec2.add(i,i,p),t*=e,r*=n}return i},v=[],f=[],m=s+1;for(let e=0;e<m;++e){const t=e/(m-1),o=u(t);v.push(o),f.push(t)}let g=1;const w=2*Math.PI/r,P=Math.sin(w);for(;g<v.length-1;){const e=vec2.subtract(l,v[g],v[g-1]);vec2.normalize(e,e);const t=vec2.subtract(h,v[g+1],v[g]);vec2.normalize(t,t);const o=vec2.cross(p,e,t);if(Math.abs(o[2])>P){const e=f[g-1],t=f[g+1],o=e+1*(t-e)/3,r=e+2*(t-e)/3,n=u(o),s=u(r);v.splice(g,1,n,s),f.splice(g,1,o,r),--g<1&&(g=1)}else++g}v.shift();const b=appendPoints(v,t);return b.lastBezierControlPoint=o[o.length-2],b};module.exports=appendBezier;
|
|
841
770
|
|
|
842
|
-
},{"../../maths/vec2":
|
|
771
|
+
},{"../../maths/vec2":282,"./appendPoints":147,"./toPoints":161}],147:[function(require,module,exports){
|
|
843
772
|
const fromPoints=require("./fromPoints"),toPoints=require("./toPoints"),appendPoints=(o,t)=>{if(t.isClosed)throw new Error("cannot append points to a closed path");let n=toPoints(t);return n=n.concat(o),fromPoints({},n)};module.exports=appendPoints;
|
|
844
773
|
|
|
845
|
-
},{"./fromPoints":
|
|
846
|
-
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),applyTransforms=
|
|
774
|
+
},{"./fromPoints":156,"./toPoints":161}],148:[function(require,module,exports){
|
|
775
|
+
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),applyTransforms=t=>mat4.isIdentity(t.transforms)?t:(t.points=t.points.map(r=>vec2.transform(vec2.create(),r,t.transforms)),mat4.identity(t.transforms),t);module.exports=applyTransforms;
|
|
847
776
|
|
|
848
|
-
},{"../../maths/mat4":
|
|
777
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282}],149:[function(require,module,exports){
|
|
849
778
|
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),create=require("./create"),clone=e=>{const r=create();return r.points=e.points.map(e=>vec2.clone(e)),r.isClosed=e.isClosed,r.transforms=mat4.clone(e.transforms),r};module.exports=clone;
|
|
850
779
|
|
|
851
|
-
},{"../../maths/mat4":
|
|
780
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282,"./create":152}],150:[function(require,module,exports){
|
|
852
781
|
const{EPS:EPS}=require("../../maths/constants"),vec2=require("../../maths/vec2"),clone=require("./clone"),close=e=>{if(e.isClosed)return e;const t=clone(e);if(t.isClosed=!0,t.points.length>1){const e=t.points,n=e[0];let o=e[e.length-1];for(;vec2.distance(n,o)<EPS*EPS&&(e.pop(),1!==e.length);)o=e[e.length-1]}return t};module.exports=close;
|
|
853
782
|
|
|
854
|
-
},{"../../maths/constants":
|
|
855
|
-
const fromPoints=require("./fromPoints"),toPoints=require("./toPoints"),concat=(...o)=>{let t=!1;for(const
|
|
783
|
+
},{"../../maths/constants":187,"../../maths/vec2":282,"./clone":149}],151:[function(require,module,exports){
|
|
784
|
+
const fromPoints=require("./fromPoints"),toPoints=require("./toPoints"),{equals:equals}=require("../../maths/vec2"),concat=(...o)=>{let t=!1;for(const e of o){if(t)throw new Error("Cannot concatenate to a closed path");t=e.isClosed}let e=[];return o.forEach(o=>{const t=toPoints(o);e.length>0&&t.length>0&&equals(t[0],e[e.length-1])&&t.shift(),e=e.concat(t)}),fromPoints({closed:t},e)};module.exports=concat;
|
|
856
785
|
|
|
857
|
-
},{"./fromPoints":
|
|
786
|
+
},{"../../maths/vec2":282,"./fromPoints":156,"./toPoints":161}],152:[function(require,module,exports){
|
|
858
787
|
const mat4=require("../../maths/mat4"),create=e=>(void 0===e&&(e=[]),{points:e,isClosed:!1,transforms:mat4.create()});module.exports=create;
|
|
859
788
|
|
|
860
|
-
},{"../../maths/mat4":
|
|
789
|
+
},{"../../maths/mat4":237}],153:[function(require,module,exports){
|
|
861
790
|
const toPoints=require("./toPoints"),eachPoint=(o,t,e)=>{toPoints(e).forEach(t)};module.exports=eachPoint;
|
|
862
791
|
|
|
863
|
-
},{"./toPoints":
|
|
792
|
+
},{"./toPoints":161}],154:[function(require,module,exports){
|
|
864
793
|
const vec2=require("../../maths/vec2"),toPoints=require("./toPoints"),equals=(e,t)=>{if(e.isClosed!==t.isClosed)return!1;if(e.points.length!==t.points.length)return!1;const o=toPoints(e),s=toPoints(t),i=o.length;let r=0;do{let t=!1;for(let e=0;e<i;e++)if(!vec2.equals(o[e],s[(e+r)%i])){t=!0;break}if(!1===t)return!0;if(!e.isClosed)return!1}while(++r<i);return!1};module.exports=equals;
|
|
865
794
|
|
|
866
|
-
},{"../../maths/vec2":
|
|
795
|
+
},{"../../maths/vec2":282,"./toPoints":161}],155:[function(require,module,exports){
|
|
867
796
|
const mat4=require("../../maths/mat4"),vec2=require("../../maths/vec2"),create=require("./create"),fromCompactBinary=r=>{if(2!==r[0])throw new Error("invalid compact binary data");const e=create();e.transforms=mat4.clone(r.slice(1,17)),e.isClosed=!!r[17];for(let t=22;t<r.length;t+=2){const o=vec2.fromValues(r[t],r[t+1]);e.points.push(o)}return r[18]>=0&&(e.color=[r[18],r[19],r[20],r[21]]),e};module.exports=fromCompactBinary;
|
|
868
797
|
|
|
869
|
-
},{"../../maths/mat4":
|
|
798
|
+
},{"../../maths/mat4":237,"../../maths/vec2":282,"./create":152}],156:[function(require,module,exports){
|
|
870
799
|
const{EPS:EPS}=require("../../maths/constants"),vec2=require("../../maths/vec2"),close=require("./close"),create=require("./create"),fromPoints=(e,t)=>{let{closed:s}=Object.assign({},{closed:!1},e),o=create();if(o.points=t.map(e=>vec2.clone(e)),o.points.length>1){const e=o.points[0],t=o.points[o.points.length-1];vec2.distance(e,t)<EPS*EPS&&(s=!0)}return!0===s&&(o=close(o)),o};module.exports=fromPoints;
|
|
871
800
|
|
|
872
|
-
},{"../../maths/constants":
|
|
801
|
+
},{"../../maths/constants":187,"../../maths/vec2":282,"./close":150,"./create":152}],157:[function(require,module,exports){
|
|
873
802
|
module.exports={appendArc:require("./appendArc"),appendBezier:require("./appendBezier"),appendPoints:require("./appendPoints"),clone:require("./clone"),close:require("./close"),concat:require("./concat"),create:require("./create"),eachPoint:require("./eachPoint"),equals:require("./equals"),fromPoints:require("./fromPoints"),fromCompactBinary:require("./fromCompactBinary"),isA:require("./isA"),reverse:require("./reverse"),toPoints:require("./toPoints"),toString:require("./toString"),toCompactBinary:require("./toCompactBinary"),transform:require("./transform")};
|
|
874
803
|
|
|
875
|
-
},{"./appendArc":
|
|
804
|
+
},{"./appendArc":145,"./appendBezier":146,"./appendPoints":147,"./clone":149,"./close":150,"./concat":151,"./create":152,"./eachPoint":153,"./equals":154,"./fromCompactBinary":155,"./fromPoints":156,"./isA":158,"./reverse":159,"./toCompactBinary":160,"./toPoints":161,"./toString":162,"./transform":163}],158:[function(require,module,exports){
|
|
876
805
|
const isA=s=>!!(s&&"object"==typeof s&&"points"in s&&"transforms"in s&&"isClosed"in s&&Array.isArray(s.points)&&"length"in s.transforms);module.exports=isA;
|
|
877
806
|
|
|
878
|
-
},{}],
|
|
807
|
+
},{}],159:[function(require,module,exports){
|
|
879
808
|
const clone=require("./clone"),reverse=e=>{const r=clone(e);return r.points=e.points.slice().reverse(),r};module.exports=reverse;
|
|
880
809
|
|
|
881
|
-
},{"./clone":
|
|
810
|
+
},{"./clone":149}],160:[function(require,module,exports){
|
|
882
811
|
const toCompactBinary=o=>{const t=o.points,n=o.transforms;let r=[-1,-1,-1,-1];o.color&&(r=o.color);const s=new Float32Array(22+2*t.length);s[0]=2,s[1]=n[0],s[2]=n[1],s[3]=n[2],s[4]=n[3],s[5]=n[4],s[6]=n[5],s[7]=n[6],s[8]=n[7],s[9]=n[8],s[10]=n[9],s[11]=n[10],s[12]=n[11],s[13]=n[12],s[14]=n[13],s[15]=n[14],s[16]=n[15],s[17]=o.isClosed?1:0,s[18]=r[0],s[19]=r[1],s[20]=r[2],s[21]=r[3];for(let o=0;o<t.length;o++){const n=2*o+22,r=t[o];s[n]=r[0],s[n+1]=r[1]}return s};module.exports=toCompactBinary;
|
|
883
812
|
|
|
884
|
-
},{}],
|
|
813
|
+
},{}],161:[function(require,module,exports){
|
|
885
814
|
const applyTransforms=require("./applyTransforms"),toPoints=o=>applyTransforms(o).points;module.exports=toPoints;
|
|
886
815
|
|
|
887
|
-
},{"./applyTransforms":
|
|
816
|
+
},{"./applyTransforms":148}],162:[function(require,module,exports){
|
|
888
817
|
const vec2=require("../../maths/vec2"),toPoints=require("./toPoints"),toString=t=>{const o=toPoints(t);let n="path ("+o.length+" points, "+t.isClosed+"):\n[\n";return o.forEach(t=>{n+=" "+vec2.toString(t)+",\n"}),n+="]\n"};module.exports=toString;
|
|
889
818
|
|
|
890
|
-
},{"../../maths/vec2":
|
|
819
|
+
},{"../../maths/vec2":282,"./toPoints":161}],163:[function(require,module,exports){
|
|
891
820
|
const mat4=require("../../maths/mat4"),create=require("./create"),transform=(r,t)=>{const e=create(t.points);return e.isClosed=t.isClosed,mat4.multiply(e.transforms,r,t.transforms),e};module.exports=transform;
|
|
892
821
|
|
|
893
|
-
},{"../../maths/mat4":
|
|
822
|
+
},{"../../maths/mat4":237,"./create":152}],164:[function(require,module,exports){
|
|
894
823
|
const measureArea=require("./measureArea"),flip=require("./flip"),arePointsInside=(e,t)=>{if(0===e.length)return 0;const n=t.vertices;return n.length<3?0:(measureArea(t)<0&&(t=flip(t)),e.reduce((e,t)=>e+isPointInside(t,n),0)===e.length?1:0)},isPointInsideOld=(e,t)=>{let n=0;const r=t.length,s=e[0],i=e[1];for(let o=0;o<t.length;o++){const l=t[o],u=t[(o+1)%r];s!==l[0]&&i!==l[1]&&s!==u[0]&&i!==u[1]&&(l[1]<=i?u[1]>i&&isLeft(l,u,e)>0&&n++:u[1]<=i&&isLeft(l,u,e)<0&&n--)}return 0===n?1:0},isPointInside=(e,t)=>{const n=t.length,r=e[0],s=e[1];let i=t[n-1],o=t[0],l=i[1]>s,u=0,f=0;for(let e=n+1;--e;){const e=o[1]>s;if(l!==e){const e=i[0]>r,t=o[0]>r;e&&t?u=!u:o[0]-(o[1]-s)*(i[0]-o[0])/(i[1]-o[1])>=r&&(u=!u)}l=e,i=o,o=t[++f]}return u},isLeft=(e,t,n)=>(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1]);module.exports=arePointsInside;
|
|
895
824
|
|
|
896
|
-
},{"./flip":
|
|
825
|
+
},{"./flip":166,"./measureArea":168}],165:[function(require,module,exports){
|
|
897
826
|
const create=e=>((void 0===e||e.length<3)&&(e=[]),{vertices:e});module.exports=create;
|
|
898
827
|
|
|
899
|
-
},{}],
|
|
828
|
+
},{}],166:[function(require,module,exports){
|
|
900
829
|
const create=require("./create"),flip=e=>{const r=e.vertices.slice().reverse();return create(r)};module.exports=flip;
|
|
901
830
|
|
|
902
|
-
},{"./create":
|
|
831
|
+
},{"./create":165}],167:[function(require,module,exports){
|
|
903
832
|
module.exports={arePointsInside:require("./arePointsInside"),create:require("./create"),flip:require("./flip"),measureArea:require("./measureArea")};
|
|
904
833
|
|
|
905
|
-
},{"./arePointsInside":
|
|
834
|
+
},{"./arePointsInside":164,"./create":165,"./flip":166,"./measureArea":168}],168:[function(require,module,exports){
|
|
906
835
|
const area=require("../../maths/utils/area"),measureArea=e=>area(e.vertices);module.exports=measureArea;
|
|
907
836
|
|
|
908
|
-
},{"../../maths/utils/area":
|
|
837
|
+
},{"../../maths/utils/area":260}],169:[function(require,module,exports){
|
|
909
838
|
const create=require("./create"),vec3=require("../../maths/vec3"),clone=(...e)=>{let c,r;return 1===e.length?(c=create(),r=e[0]):(c=e[0],r=e[1]),c.vertices=r.vertices.map(e=>vec3.clone(e)),c};module.exports=clone;
|
|
910
839
|
|
|
911
|
-
},{"../../maths/vec3":
|
|
840
|
+
},{"../../maths/vec3":313,"./create":170}],170:[function(require,module,exports){
|
|
912
841
|
const create=e=>((void 0===e||e.length<3)&&(e=[]),{vertices:e});module.exports=create;
|
|
913
842
|
|
|
914
|
-
},{}],
|
|
843
|
+
},{}],171:[function(require,module,exports){
|
|
915
844
|
const vec3=require("../../maths/vec3"),create=require("./create"),fromPoints=e=>{const r=e.map(e=>vec3.clone(e));return create(r)};module.exports=fromPoints;
|
|
916
845
|
|
|
917
|
-
},{"../../maths/vec3":
|
|
846
|
+
},{"../../maths/vec3":313,"./create":170}],172:[function(require,module,exports){
|
|
918
847
|
const create=require("./create"),fromPointsAndPlane=(e,n)=>{const r=create(e);return r.plane=n,r};module.exports=fromPointsAndPlane;
|
|
919
848
|
|
|
920
|
-
},{"./create":
|
|
849
|
+
},{"./create":170}],173:[function(require,module,exports){
|
|
921
850
|
module.exports={clone:require("./clone"),create:require("./create"),fromPoints:require("./fromPoints"),fromPointsAndPlane:require("./fromPointsAndPlane"),invert:require("./invert"),isA:require("./isA"),isConvex:require("./isConvex"),measureArea:require("./measureArea"),measureBoundingBox:require("./measureBoundingBox"),measureBoundingSphere:require("./measureBoundingSphere"),measureSignedVolume:require("./measureSignedVolume"),plane:require("./plane"),toPoints:require("./toPoints"),toString:require("./toString"),transform:require("./transform")};
|
|
922
851
|
|
|
923
|
-
},{"./clone":
|
|
852
|
+
},{"./clone":169,"./create":170,"./fromPoints":171,"./fromPointsAndPlane":172,"./invert":174,"./isA":175,"./isConvex":176,"./measureArea":177,"./measureBoundingBox":178,"./measureBoundingSphere":179,"./measureSignedVolume":180,"./plane":181,"./toPoints":182,"./toString":183,"./transform":184}],174:[function(require,module,exports){
|
|
924
853
|
const create=require("./create"),invert=e=>{const r=e.vertices.slice().reverse();return create(r)};module.exports=invert;
|
|
925
854
|
|
|
926
|
-
},{"./create":
|
|
855
|
+
},{"./create":170}],175:[function(require,module,exports){
|
|
927
856
|
const isA=e=>!!(e&&"object"==typeof e&&"vertices"in e&&Array.isArray(e.vertices));module.exports=isA;
|
|
928
857
|
|
|
929
|
-
},{}],
|
|
858
|
+
},{}],176:[function(require,module,exports){
|
|
930
859
|
const plane=require("../../maths/plane"),vec3=require("../../maths/vec3"),isConvex=e=>areVerticesConvex(e.vertices),areVerticesConvex=e=>{const t=e.length;if(t>2){const r=plane.fromPoints(plane.create(),e[0],e[1],e[2]);let c=e[t-2],n=e[t-1];for(let o=0;o<t;o++){const t=e[o];if(!isConvexPoint(c,n,t,r))return!1;c=n,n=t}}return!0},isConvexPoint=(e,t,r,c)=>{const n=vec3.cross(vec3.create(),vec3.subtract(vec3.create(),t,e),vec3.subtract(vec3.create(),r,t));return vec3.dot(n,c)>=0};module.exports=isConvex;
|
|
931
860
|
|
|
932
|
-
},{"../../maths/plane":
|
|
861
|
+
},{"../../maths/plane":255,"../../maths/vec3":313}],177:[function(require,module,exports){
|
|
933
862
|
const vec3=require("../../maths/vec3"),measureArea=e=>{const t=e.vertices.length;if(t<3)return 0;const r=e.vertices,a=r[0],c=r[1],s=r[2],o=vec3.subtract(vec3.create(),c,a),u=vec3.subtract(vec3.create(),s,a),v=vec3.cross(o,o,u),b=Math.abs(v[0]),h=Math.abs(v[1]),n=Math.abs(v[2]),f=Math.sqrt(b*b+h*h+n*n);let i=3;b>h&&b>n?i=1:h>n&&(i=2);let l=0,m=0,M=1,d=2;switch(i){case 1:for(M=1;M<t;M++)m=M-1,d=(M+1)%t,l+=r[M][1]*(r[d][2]-r[m][2]);l+=r[0][1]*(r[1][2]-r[t-1][2]),l*=f/(2*v[0]);break;case 2:for(M=1;M<t;M++)m=M-1,d=(M+1)%t,l+=r[M][2]*(r[d][0]-r[m][0]);l+=r[0][2]*(r[1][0]-r[t-1][0]),l*=f/(2*v[1]);break;case 3:default:for(M=1;M<t;M++)m=M-1,d=(M+1)%t,l+=r[M][0]*(r[d][1]-r[m][1]);l+=r[0][0]*(r[1][1]-r[t-1][1]),l*=f/(2*v[2])}return l};module.exports=measureArea;
|
|
934
863
|
|
|
935
|
-
},{"../../maths/vec3":
|
|
864
|
+
},{"../../maths/vec3":313}],178:[function(require,module,exports){
|
|
936
865
|
const vec3=require("../../maths/vec3"),measureBoundingBox=e=>{const c=e.vertices,n=c.length,o=0===n?vec3.create():vec3.clone(c[0]),r=vec3.clone(o);for(let e=1;e<n;e++)vec3.min(o,o,c[e]),vec3.max(r,r,c[e]);return[o,r]};module.exports=measureBoundingBox;
|
|
937
866
|
|
|
938
|
-
},{"../../maths/vec3":
|
|
867
|
+
},{"../../maths/vec3":313}],179:[function(require,module,exports){
|
|
939
868
|
const vec3=require("../../maths/vec3"),measureBoundingBox=require("./measureBoundingBox"),measureBoundingSphere=e=>{const n=measureBoundingBox(e),r=n[0];return vec3.add(r,n[0],n[1]),vec3.scale(r,r,.5),[r,vec3.distance(r,n[1])]};module.exports=measureBoundingSphere;
|
|
940
869
|
|
|
941
|
-
},{"../../maths/vec3":
|
|
870
|
+
},{"../../maths/vec3":313,"./measureBoundingBox":178}],180:[function(require,module,exports){
|
|
942
871
|
const vec3=require("../../maths/vec3"),measureSignedVolume=e=>{let r=0;const t=e.vertices,c=vec3.create();for(let e=0;e<t.length-2;e++)vec3.cross(c,t[e+1],t[e+2]),r+=vec3.dot(t[0],c);return r/=6};module.exports=measureSignedVolume;
|
|
943
872
|
|
|
944
|
-
},{"../../maths/vec3":
|
|
873
|
+
},{"../../maths/vec3":313}],181:[function(require,module,exports){
|
|
945
874
|
const mplane=require("../../maths/plane/"),plane=e=>{if(!e.plane){const n=e.vertices;e.plane=mplane.fromPoints(mplane.create(),n[0],n[1],n[2])}return e.plane};module.exports=plane;
|
|
946
875
|
|
|
947
|
-
},{"../../maths/plane/":
|
|
876
|
+
},{"../../maths/plane/":255}],182:[function(require,module,exports){
|
|
948
877
|
const toPoints=o=>o.vertices;module.exports=toPoints;
|
|
949
878
|
|
|
950
|
-
},{}],
|
|
879
|
+
},{}],183:[function(require,module,exports){
|
|
951
880
|
const vec3=require("../../maths/vec3/"),toString=e=>{let t="poly3: vertices: [";return e.vertices.forEach(e=>{t+=`${vec3.toString(e)}, `}),t+="]"};module.exports=toString;
|
|
952
881
|
|
|
953
|
-
},{"../../maths/vec3/":
|
|
882
|
+
},{"../../maths/vec3/":313}],184:[function(require,module,exports){
|
|
954
883
|
const mat4=require("../../maths/mat4"),vec3=require("../../maths/vec3"),create=require("./create"),transform=(e,r)=>{const t=r.vertices.map(r=>vec3.transform(vec3.create(),r,e));return mat4.isMirroring(e)&&t.reverse(),create(t)};module.exports=transform;
|
|
955
884
|
|
|
956
|
-
},{"../../maths/mat4":
|
|
885
|
+
},{"../../maths/mat4":237,"../../maths/vec3":313,"./create":170}],185:[function(require,module,exports){
|
|
957
886
|
module.exports={colors:require("./colors"),curves:require("./curves"),geometries:require("./geometries"),maths:require("./maths"),measurements:require("./measurements"),primitives:require("./primitives"),text:require("./text"),utils:require("./utils"),booleans:require("./operations/booleans"),expansions:require("./operations/expansions"),extrusions:require("./operations/extrusions"),hulls:require("./operations/hulls"),modifiers:require("./operations/modifiers"),transforms:require("./operations/transforms")};
|
|
958
887
|
|
|
959
|
-
},{"./colors":
|
|
960
|
-
const mat4=require("./mat4"),vec2=require("./vec2"),vec3=require("./vec3"),OrthoNormalBasis=function(e,t){arguments.length<2&&(t=vec3.orthogonal(vec3.create(),e)),this.v=vec3.
|
|
888
|
+
},{"./colors":108,"./curves":116,"./geometries":144,"./maths":188,"./measurements":343,"./operations/booleans":353,"./operations/expansions":384,"./operations/extrusions":397,"./operations/hulls":418,"./operations/modifiers":429,"./operations/transforms":438,"./primitives":454,"./text":467,"./utils":475}],186:[function(require,module,exports){
|
|
889
|
+
const mat4=require("./mat4"),vec2=require("./vec2"),vec3=require("./vec3"),OrthoNormalBasis=function(e,t){arguments.length<2&&(t=vec3.orthogonal(vec3.create(),e)),this.v=vec3.normalize(vec3.create(),vec3.cross(vec3.create(),e,t)),this.u=vec3.cross(vec3.create(),this.v,e),this.plane=e,this.planeorigin=vec3.scale(vec3.create(),e,e[3])};OrthoNormalBasis.GetCartesian=function(e,t){const i=e+"/"+t;let s,n;if("X/Y"===i)s=[0,0,1],n=[1,0,0];else if("Y/-X"===i)s=[0,0,1],n=[0,1,0];else if("-X/-Y"===i)s=[0,0,1],n=[-1,0,0];else if("-Y/X"===i)s=[0,0,1],n=[0,-1,0];else if("-X/Y"===i)s=[0,0,-1],n=[-1,0,0];else if("-Y/-X"===i)s=[0,0,-1],n=[0,-1,0];else if("X/-Y"===i)s=[0,0,-1],n=[1,0,0];else if("Y/X"===i)s=[0,0,-1],n=[0,1,0];else if("X/Z"===i)s=[0,-1,0],n=[1,0,0];else if("Z/-X"===i)s=[0,-1,0],n=[0,0,1];else if("-X/-Z"===i)s=[0,-1,0],n=[-1,0,0];else if("-Z/X"===i)s=[0,-1,0],n=[0,0,-1];else if("-X/Z"===i)s=[0,1,0],n=[-1,0,0];else if("-Z/-X"===i)s=[0,1,0],n=[0,0,-1];else if("X/-Z"===i)s=[0,1,0],n=[1,0,0];else if("Z/X"===i)s=[0,1,0],n=[0,0,1];else if("Y/Z"===i)s=[1,0,0],n=[0,1,0];else if("Z/-Y"===i)s=[1,0,0],n=[0,0,1];else if("-Y/-Z"===i)s=[1,0,0],n=[0,-1,0];else if("-Z/Y"===i)s=[1,0,0],n=[0,0,-1];else if("-Y/Z"===i)s=[-1,0,0],n=[0,-1,0];else if("-Z/-Y"===i)s=[-1,0,0],n=[0,0,-1];else if("Y/-Z"===i)s=[-1,0,0],n=[0,1,0];else{if("Z/Y"!==i)throw new Error("OrthoNormalBasis.GetCartesian: invalid combination of axis identifiers. Should pass two string arguments from [X,Y,Z,-X,-Y,-Z], being two different axes.");s=[-1,0,0],n=[0,0,1]}return new OrthoNormalBasis(new Plane(new Vector3D(s),0),new Vector3D(n))},OrthoNormalBasis.Z0Plane=function(){const e=new Plane(new Vector3D([0,0,1]),0);return new OrthoNormalBasis(e,new Vector3D([1,0,0]))},OrthoNormalBasis.prototype={getProjectionMatrix:function(){return mat4.fromValues(this.u[0],this.v[0],this.plane[0],0,this.u[1],this.v[1],this.plane[1],0,this.u[2],this.v[2],this.plane[2],0,0,0,-this.plane[3],1)},getInverseProjectionMatrix:function(){const e=vec3.scale(vec3.create(),this.plane,this.plane[3]);return mat4.fromValues(this.u[0],this.u[1],this.u[2],0,this.v[0],this.v[1],this.v[2],0,this.plane[0],this.plane[1],this.plane[2],0,e[0],e[1],e[2],1)},to2D:function(e){return vec2.fromValues(vec3.dot(e,this.u),vec3.dot(e,this.v))},to3D:function(e){const t=vec3.scale(vec3.create(),this.u,e[0]),i=vec3.scale(vec3.create(),this.v,e[1]),s=vec3.add(t,t,this.planeorigin);return vec3.add(i,i,s)},line3Dto2D:function(e){const t=e.point,i=e.direction.plus(t),s=this.to2D(t),n=this.to2D(i);return Line2D.fromPoints(s,n)},line2Dto3D:function(e){const t=e.origin(),i=e.direction().plus(t),s=this.to3D(t),n=this.to3D(i);return Line3D.fromPoints(s,n)},transform:function(e){const t=this.plane.transform(e),i=this.u.transform(e),s=new Vector3D(0,0,0).transform(e),n=i.minus(s);return new OrthoNormalBasis(t,n)}},module.exports=OrthoNormalBasis;
|
|
961
890
|
|
|
962
|
-
},{"./mat4":
|
|
891
|
+
},{"./mat4":237,"./vec2":282,"./vec3":313}],187:[function(require,module,exports){
|
|
963
892
|
const spatialResolution=1e5,EPS=1e-5;module.exports={EPS:EPS,spatialResolution:1e5};
|
|
964
893
|
|
|
965
|
-
},{}],
|
|
894
|
+
},{}],188:[function(require,module,exports){
|
|
966
895
|
module.exports={constants:require("./constants"),line2:require("./line2"),line3:require("./line3"),mat4:require("./mat4"),plane:require("./plane"),utils:require("./utils"),vec2:require("./vec2"),vec3:require("./vec3"),vec4:require("./vec4")};
|
|
967
896
|
|
|
968
|
-
},{"./constants":
|
|
897
|
+
},{"./constants":187,"./line2":198,"./line3":215,"./mat4":237,"./plane":255,"./utils":261,"./vec2":282,"./vec3":313,"./vec4":339}],189:[function(require,module,exports){
|
|
969
898
|
const create=require("./create"),clone=e=>{const r=create();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r};module.exports=clone;
|
|
970
899
|
|
|
971
|
-
},{"./create":
|
|
900
|
+
},{"./create":192}],190:[function(require,module,exports){
|
|
972
901
|
const vec2=require("../vec2"),direction=require("./direction"),origin=require("./origin"),closestPoint=(e,i)=>{const r=origin(e),o=direction(e),n=(o[1]-r[1])/(o[0]-r[0]),t=r[1]-n*r[0],c=-1/n,s=(i[1]-c*i[0]-t)/(n-c),u=n*s+t;return vec2.fromValues(s,u)};module.exports=closestPoint;
|
|
973
902
|
|
|
974
|
-
},{"../vec2":
|
|
903
|
+
},{"../vec2":282,"./direction":193,"./origin":200}],191:[function(require,module,exports){
|
|
975
904
|
const copy=(o,c)=>(o[0]=c[0],o[1]=c[1],o[2]=c[2],o);module.exports=copy;
|
|
976
905
|
|
|
977
|
-
},{}],
|
|
906
|
+
},{}],192:[function(require,module,exports){
|
|
978
907
|
const create=()=>[0,1,0];module.exports=create;
|
|
979
908
|
|
|
980
|
-
},{}],
|
|
909
|
+
},{}],193:[function(require,module,exports){
|
|
981
910
|
const vec2=require("../vec2"),direction=e=>{const c=vec2.normal(vec2.create(),e);return vec2.negate(c,c),c};module.exports=direction;
|
|
982
911
|
|
|
983
|
-
},{"../vec2":
|
|
912
|
+
},{"../vec2":282}],194:[function(require,module,exports){
|
|
984
913
|
const vec2=require("../vec2"),distanceToPoint=(e,t)=>{let o=vec2.dot(t,e);return o=Math.abs(o-e[2])};module.exports=distanceToPoint;
|
|
985
914
|
|
|
986
|
-
},{"../vec2":
|
|
915
|
+
},{"../vec2":282}],195:[function(require,module,exports){
|
|
987
916
|
const equals=(e,s)=>e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2];module.exports=equals;
|
|
988
917
|
|
|
989
|
-
},{}],
|
|
918
|
+
},{}],196:[function(require,module,exports){
|
|
990
919
|
const vec2=require("../vec2"),fromPoints=(e,c,o)=>{const r=vec2.subtract(vec2.create(),o,c);vec2.normal(r,r),vec2.normalize(r,r);const t=vec2.dot(c,r);return e[0]=r[0],e[1]=r[1],e[2]=t,e};module.exports=fromPoints;
|
|
991
920
|
|
|
992
|
-
},{"../vec2":
|
|
921
|
+
},{"../vec2":282}],197:[function(require,module,exports){
|
|
993
922
|
const create=require("./create"),fromValues=(e,r,t)=>{const o=create();return o[0]=e,o[1]=r,o[2]=t,o};module.exports=fromValues;
|
|
994
923
|
|
|
995
|
-
},{"./create":
|
|
924
|
+
},{"./create":192}],198:[function(require,module,exports){
|
|
996
925
|
module.exports={clone:require("./clone"),closestPoint:require("./closestPoint"),copy:require("./copy"),create:require("./create"),direction:require("./direction"),distanceToPoint:require("./distanceToPoint"),equals:require("./equals"),fromPoints:require("./fromPoints"),fromValues:require("./fromValues"),intersectPointOfLines:require("./intersectPointOfLines"),origin:require("./origin"),reverse:require("./reverse"),toString:require("./toString"),transform:require("./transform"),xAtY:require("./xAtY")};
|
|
997
926
|
|
|
998
|
-
},{"./clone":
|
|
927
|
+
},{"./clone":189,"./closestPoint":190,"./copy":191,"./create":192,"./direction":193,"./distanceToPoint":194,"./equals":195,"./fromPoints":196,"./fromValues":197,"./intersectPointOfLines":199,"./origin":200,"./reverse":201,"./toString":202,"./transform":203,"./xAtY":204}],199:[function(require,module,exports){
|
|
999
928
|
const vec2=require("../vec2"),{solve2Linear:solve2Linear}=require("../utils"),intersectToLine=(e,r)=>{const n=solve2Linear(e[0],e[1],r[0],r[1],e[2],r[2]);return vec2.clone(n)};module.exports=intersectToLine;
|
|
1000
929
|
|
|
1001
|
-
},{"../utils":
|
|
930
|
+
},{"../utils":261,"../vec2":282}],200:[function(require,module,exports){
|
|
1002
931
|
const vec2=require("../vec2"),origin=e=>vec2.scale(vec2.create(),e,e[2]);module.exports=origin;
|
|
1003
932
|
|
|
1004
|
-
},{"../vec2":
|
|
933
|
+
},{"../vec2":282}],201:[function(require,module,exports){
|
|
1005
934
|
const vec2=require("../vec2"),copy=require("./copy"),fromValues=require("./fromValues"),reverse=(e,r)=>{const c=vec2.negate(vec2.create(),r),o=-r[2];return copy(e,fromValues(c[0],c[1],o))};module.exports=reverse;
|
|
1006
935
|
|
|
1007
|
-
},{"../vec2":
|
|
936
|
+
},{"../vec2":282,"./copy":191,"./fromValues":197}],202:[function(require,module,exports){
|
|
1008
937
|
const toString=t=>`line2: (${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)})`;module.exports=toString;
|
|
1009
938
|
|
|
1010
|
-
},{}],
|
|
939
|
+
},{}],203:[function(require,module,exports){
|
|
1011
940
|
const vec2=require("../vec2"),fromPoints=require("./fromPoints"),origin=require("./origin"),direction=require("./direction"),transform=(r,o,i)=>{const e=origin(o),n=direction(o);return vec2.transform(e,e,i),vec2.transform(n,n,i),fromPoints(r,e,n)};module.exports=transform;
|
|
1012
941
|
|
|
1013
|
-
},{"../vec2":
|
|
942
|
+
},{"../vec2":282,"./direction":193,"./fromPoints":196,"./origin":200}],204:[function(require,module,exports){
|
|
1014
943
|
const origin=require("./origin"),xAtY=(i,r)=>{let e=(i[2]-i[1]*r)/i[0];if(Number.isNaN(e)){e=origin(i)[0]}return e};module.exports=xAtY;
|
|
1015
944
|
|
|
1016
|
-
},{"./origin":
|
|
945
|
+
},{"./origin":200}],205:[function(require,module,exports){
|
|
1017
946
|
const vec3=require("../vec3"),create=require("./create"),clone=e=>{const c=create();return vec3.copy(c[0],e[0]),vec3.copy(c[1],e[1]),c};module.exports=clone;
|
|
1018
947
|
|
|
1019
|
-
},{"../vec3":
|
|
948
|
+
},{"../vec3":313,"./create":208}],206:[function(require,module,exports){
|
|
1020
949
|
const vec3=require("../vec3"),closestPoint=(e,c)=>{const t=e[0],o=e[1],s=vec3.dot(vec3.subtract(vec3.create(),c,t),o)/vec3.dot(o,o),v=vec3.scale(vec3.create(),o,s);return vec3.add(v,v,t),v};module.exports=closestPoint;
|
|
1021
950
|
|
|
1022
|
-
},{"../vec3":
|
|
951
|
+
},{"../vec3":313}],207:[function(require,module,exports){
|
|
1023
952
|
const vec3=require("../vec3"),copy=(c,e)=>(vec3.copy(c[0],e[0]),vec3.copy(c[1],e[1]),c);module.exports=copy;
|
|
1024
953
|
|
|
1025
|
-
},{"../vec3":
|
|
954
|
+
},{"../vec3":313}],208:[function(require,module,exports){
|
|
1026
955
|
const vec3=require("../vec3"),create=()=>[vec3.fromValues(0,0,0),vec3.fromValues(0,0,1)];module.exports=create;
|
|
1027
956
|
|
|
1028
|
-
},{"../vec3":
|
|
957
|
+
},{"../vec3":313}],209:[function(require,module,exports){
|
|
1029
958
|
const direction=o=>o[1];module.exports=direction;
|
|
1030
959
|
|
|
1031
|
-
},{}],
|
|
960
|
+
},{}],210:[function(require,module,exports){
|
|
1032
961
|
const vec3=require("../vec3"),closestPoint=require("./closestPoint"),distanceToPoint=(e,t)=>{const c=closestPoint(e,t),o=vec3.subtract(vec3.create(),t,c);return vec3.length(o)};module.exports=distanceToPoint;
|
|
1033
962
|
|
|
1034
|
-
},{"../vec3":
|
|
963
|
+
},{"../vec3":313,"./closestPoint":206}],211:[function(require,module,exports){
|
|
1035
964
|
const vec3=require("../vec3"),equals=(e,s)=>!!vec3.equals(e[1],s[1])&&!!vec3.equals(e[0],s[0]);module.exports=equals;
|
|
1036
965
|
|
|
1037
|
-
},{"../vec3":
|
|
966
|
+
},{"../vec3":313}],212:[function(require,module,exports){
|
|
1038
967
|
const vec3=require("../vec3"),{solve2Linear:solve2Linear}=require("../utils"),{EPS:EPS}=require("../constants"),fromPointAndDirection=require("./fromPointAndDirection"),fromPlanes=(e,r,o)=>{let n=vec3.cross(vec3.create(),r,o),s=vec3.length(n);if(s<EPS)throw new Error("parallel planes do not intersect");s=1/s,n=vec3.scale(n,n,s);const t=Math.abs(n[0]),a=Math.abs(n[1]),i=Math.abs(n[2]);let l,c;return t>=a&&t>=i?(c=solve2Linear(r[1],r[2],o[1],o[2],r[3],o[3]),l=vec3.fromValues(0,c[0],c[1])):a>=t&&a>=i?(c=solve2Linear(r[0],r[2],o[0],o[2],r[3],o[3]),l=vec3.fromValues(c[0],0,c[1])):(c=solve2Linear(r[0],r[1],o[0],o[1],r[3],o[3]),l=vec3.fromValues(c[0],c[1],0)),fromPointAndDirection(e,l,n)};module.exports=fromPlanes;
|
|
1039
968
|
|
|
1040
|
-
},{"../constants":
|
|
1041
|
-
const vec3=require("../vec3"),fromPointAndDirection=(e,c,o)=>{const
|
|
969
|
+
},{"../constants":187,"../utils":261,"../vec3":313,"./fromPointAndDirection":213}],213:[function(require,module,exports){
|
|
970
|
+
const vec3=require("../vec3"),fromPointAndDirection=(e,c,o)=>{const r=vec3.normalize(vec3.create(),o);return vec3.copy(e[0],c),vec3.copy(e[1],r),e};module.exports=fromPointAndDirection;
|
|
1042
971
|
|
|
1043
|
-
},{"../vec3":
|
|
972
|
+
},{"../vec3":313}],214:[function(require,module,exports){
|
|
1044
973
|
const vec3=require("../vec3"),fromPointAndDirection=require("./fromPointAndDirection"),fromPoints=(o,r,e)=>{const t=vec3.subtract(vec3.create(),e,r);return fromPointAndDirection(o,r,t)};module.exports=fromPoints;
|
|
1045
974
|
|
|
1046
|
-
},{"../vec3":
|
|
975
|
+
},{"../vec3":313,"./fromPointAndDirection":213}],215:[function(require,module,exports){
|
|
1047
976
|
module.exports={clone:require("./clone"),closestPoint:require("./closestPoint"),copy:require("./copy"),create:require("./create"),direction:require("./direction"),distanceToPoint:require("./distanceToPoint"),equals:require("./equals"),fromPlanes:require("./fromPlanes"),fromPointAndDirection:require("./fromPointAndDirection"),fromPoints:require("./fromPoints"),intersectPointOfLineAndPlane:require("./intersectPointOfLineAndPlane"),origin:require("./origin"),reverse:require("./reverse"),toString:require("./toString"),transform:require("./transform")};
|
|
1048
977
|
|
|
1049
|
-
},{"./clone":
|
|
978
|
+
},{"./clone":205,"./closestPoint":206,"./copy":207,"./create":208,"./direction":209,"./distanceToPoint":210,"./equals":211,"./fromPlanes":212,"./fromPointAndDirection":213,"./fromPoints":214,"./intersectPointOfLineAndPlane":216,"./origin":217,"./reverse":218,"./toString":219,"./transform":220}],216:[function(require,module,exports){
|
|
1050
979
|
const vec3=require("../vec3"),intersectToPlane=(e,c)=>{const t=c,r=c[3],o=e[0],v=e[1],n=(r-vec3.dot(t,o))/vec3.dot(t,v);return vec3.add(vec3.create(),o,vec3.scale(vec3.create(),v,n))};module.exports=intersectToPlane;
|
|
1051
980
|
|
|
1052
|
-
},{"../vec3":
|
|
981
|
+
},{"../vec3":313}],217:[function(require,module,exports){
|
|
1053
982
|
const origin=o=>o[0];module.exports=origin;
|
|
1054
983
|
|
|
1055
|
-
},{}],
|
|
984
|
+
},{}],218:[function(require,module,exports){
|
|
1056
985
|
const vec3=require("../vec3"),fromPointAndDirection=require("./fromPointAndDirection"),reverse=(e,r)=>{const n=vec3.clone(r[0]),o=vec3.negate(vec3.create(),r[1]);return fromPointAndDirection(e,n,o)};module.exports=reverse;
|
|
1057
986
|
|
|
1058
|
-
},{"../vec3":
|
|
1059
|
-
const toString=t=>{const o=t[0],i=t[1];return`line3: point: (${o[0].toFixed(7)}, ${o[1].toFixed(7)}, ${o[2].toFixed(7)})
|
|
987
|
+
},{"../vec3":313,"./fromPointAndDirection":213}],219:[function(require,module,exports){
|
|
988
|
+
const toString=t=>{const o=t[0],i=t[1];return`line3: point: (${o[0].toFixed(7)}, ${o[1].toFixed(7)}, ${o[2].toFixed(7)}) direction: (${i[0].toFixed(7)}, ${i[1].toFixed(7)}, ${i[2].toFixed(7)})`};module.exports=toString;
|
|
1060
989
|
|
|
1061
|
-
},{}],
|
|
990
|
+
},{}],220:[function(require,module,exports){
|
|
1062
991
|
const vec3=require("../vec3"),fromPointAndDirection=require("./fromPointAndDirection"),transform=(r,e,t)=>{const o=e[0],c=e[1],n=vec3.add(vec3.create(),o,c),i=vec3.transform(vec3.create(),o,t),a=vec3.transform(n,n,t),m=vec3.subtract(a,a,i);return fromPointAndDirection(r,i,m)};module.exports=transform;
|
|
1063
992
|
|
|
1064
|
-
},{"../vec3":
|
|
993
|
+
},{"../vec3":313,"./fromPointAndDirection":213}],221:[function(require,module,exports){
|
|
1065
994
|
const add=(d,o,a)=>(d[0]=o[0]+a[0],d[1]=o[1]+a[1],d[2]=o[2]+a[2],d[3]=o[3]+a[3],d[4]=o[4]+a[4],d[5]=o[5]+a[5],d[6]=o[6]+a[6],d[7]=o[7]+a[7],d[8]=o[8]+a[8],d[9]=o[9]+a[9],d[10]=o[10]+a[10],d[11]=o[11]+a[11],d[12]=o[12]+a[12],d[13]=o[13]+a[13],d[14]=o[14]+a[14],d[15]=o[15]+a[15],d);module.exports=add;
|
|
1066
995
|
|
|
1067
|
-
},{}],
|
|
996
|
+
},{}],222:[function(require,module,exports){
|
|
1068
997
|
const create=require("./create"),clone=e=>{const r=create();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r};module.exports=clone;
|
|
1069
998
|
|
|
1070
|
-
},{"./create":
|
|
999
|
+
},{"./create":225}],223:[function(require,module,exports){
|
|
1071
1000
|
const EPSILON=1e-6;module.exports={EPSILON:1e-6};
|
|
1072
1001
|
|
|
1073
|
-
},{}],
|
|
1002
|
+
},{}],224:[function(require,module,exports){
|
|
1074
1003
|
const copy=(o,c)=>(o[0]=c[0],o[1]=c[1],o[2]=c[2],o[3]=c[3],o[4]=c[4],o[5]=c[5],o[6]=c[6],o[7]=c[7],o[8]=c[8],o[9]=c[9],o[10]=c[10],o[11]=c[11],o[12]=c[12],o[13]=c[13],o[14]=c[14],o[15]=c[15],o);module.exports=copy;
|
|
1075
1004
|
|
|
1076
|
-
},{}],
|
|
1005
|
+
},{}],225:[function(require,module,exports){
|
|
1077
1006
|
const create=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];module.exports=create;
|
|
1078
1007
|
|
|
1079
|
-
},{}],
|
|
1008
|
+
},{}],226:[function(require,module,exports){
|
|
1080
1009
|
const equals=(e,s)=>e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]&&e[3]===s[3]&&e[4]===s[4]&&e[5]===s[5]&&e[6]===s[6]&&e[7]===s[7]&&e[8]===s[8]&&e[9]===s[9]&&e[10]===s[10]&&e[11]===s[11]&&e[12]===s[12]&&e[13]===s[13]&&e[14]===s[14]&&e[15]===s[15];module.exports=equals;
|
|
1081
1010
|
|
|
1082
|
-
},{}],
|
|
1011
|
+
},{}],227:[function(require,module,exports){
|
|
1083
1012
|
const identity=require("./identity"),{EPSILON:EPSILON}=require("./constants"),fromRotation=(t,e,i)=>{let[n,o,r]=i,s=Math.sqrt(n*n+o*o+r*r);if(Math.abs(s)<EPSILON)return identity(t);n*=s=1/s,o*=s,r*=s;const a=Math.sin(e),u=Math.cos(e),c=1-u;return t[0]=n*n*c+u,t[1]=o*n*c+r*a,t[2]=r*n*c-o*a,t[3]=0,t[4]=n*o*c-r*a,t[5]=o*o*c+u,t[6]=r*o*c+n*a,t[7]=0,t[8]=n*r*c+o*a,t[9]=o*r*c-n*a,t[10]=r*r*c+u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};module.exports=fromRotation;
|
|
1084
1013
|
|
|
1085
|
-
},{"./constants":
|
|
1014
|
+
},{"./constants":223,"./identity":236}],228:[function(require,module,exports){
|
|
1086
1015
|
const fromScaling=(o,c)=>(o[0]=c[0],o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=c[1],o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c[2],o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o);module.exports=fromScaling;
|
|
1087
1016
|
|
|
1088
|
-
},{}],
|
|
1017
|
+
},{}],229:[function(require,module,exports){
|
|
1089
1018
|
const fromTaitBryanRotation=(t,o,a,n)=>{const s=Math.sin(o),i=Math.cos(o),r=Math.sin(a),h=Math.cos(a),M=Math.sin(n),c=Math.cos(n);return t[0]=h*i,t[1]=h*s,t[2]=-r,t[3]=0,t[4]=M*r*i-c*s,t[5]=c*i+M*r*s,t[6]=M*h,t[7]=0,t[8]=M*s+c*r*i,t[9]=c*r*s-M*i,t[10]=c*h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t};module.exports=fromTaitBryanRotation;
|
|
1090
1019
|
|
|
1091
|
-
},{}],
|
|
1020
|
+
},{}],230:[function(require,module,exports){
|
|
1092
1021
|
const fromTranslation=(o,n)=>(o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=n[0],o[13]=n[1],o[14]=n[2],o[15]=1,o);module.exports=fromTranslation;
|
|
1093
1022
|
|
|
1094
|
-
},{}],
|
|
1023
|
+
},{}],231:[function(require,module,exports){
|
|
1095
1024
|
const create=require("./create"),fromValues=(e,r,t,o,a,c,s,u,l,m,n,f,V,d,i,p)=>{const q=create();return q[0]=e,q[1]=r,q[2]=t,q[3]=o,q[4]=a,q[5]=c,q[6]=s,q[7]=u,q[8]=l,q[9]=m,q[10]=n,q[11]=f,q[12]=V,q[13]=d,q[14]=i,q[15]=p,q};module.exports=fromValues;
|
|
1096
1025
|
|
|
1097
|
-
},{"./create":
|
|
1026
|
+
},{"./create":225}],232:[function(require,module,exports){
|
|
1098
1027
|
const vec3=require("../vec3"),fromRotation=require("./fromRotation"),fromVectorRotation=(o,e,t)=>{const r=vec3.normalize(vec3.create(),e),c=vec3.normalize(vec3.create(),t),n=vec3.cross(vec3.create(),c,r),a=vec3.dot(c,r);if(-1===a)return fromRotation(o,Math.PI,vec3.orthogonal(n,r));const i=1/(1+a);return o[0]=n[0]*n[0]*i+a,o[1]=n[1]*n[0]*i-n[2],o[2]=n[2]*n[0]*i+n[1],o[3]=0,o[4]=n[0]*n[1]*i+n[2],o[5]=n[1]*n[1]*i+a,o[6]=n[2]*n[1]*i-n[0],o[7]=0,o[8]=n[0]*n[2]*i-n[1],o[9]=n[1]*n[2]*i+n[0],o[10]=n[2]*n[2]*i+a,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o};module.exports=fromVectorRotation;
|
|
1099
1028
|
|
|
1100
|
-
},{"../vec3":
|
|
1029
|
+
},{"../vec3":313,"./fromRotation":227}],233:[function(require,module,exports){
|
|
1101
1030
|
const fromXRotation=(o,t)=>{const n=Math.sin(t),r=Math.cos(t);return o[0]=1,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=r,o[6]=n,o[7]=0,o[8]=0,o[9]=-n,o[10]=r,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o};module.exports=fromXRotation;
|
|
1102
1031
|
|
|
1103
|
-
},{}],
|
|
1032
|
+
},{}],234:[function(require,module,exports){
|
|
1104
1033
|
const fromYRotation=(o,t)=>{const n=Math.sin(t),r=Math.cos(t);return o[0]=r,o[1]=0,o[2]=-n,o[3]=0,o[4]=0,o[5]=1,o[6]=0,o[7]=0,o[8]=n,o[9]=0,o[10]=r,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o};module.exports=fromYRotation;
|
|
1105
1034
|
|
|
1106
|
-
},{}],
|
|
1035
|
+
},{}],235:[function(require,module,exports){
|
|
1107
1036
|
const fromZRotation=(o,t)=>{const n=Math.sin(t),r=Math.cos(t);return o[0]=r,o[1]=n,o[2]=0,o[3]=0,o[4]=-n,o[5]=r,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=1,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o};module.exports=fromZRotation;
|
|
1108
1037
|
|
|
1109
|
-
},{}],
|
|
1038
|
+
},{}],236:[function(require,module,exports){
|
|
1110
1039
|
const identity=t=>(t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t);module.exports=identity;
|
|
1111
1040
|
|
|
1112
|
-
},{}],
|
|
1113
|
-
module.exports={add:require("./add"),clone:require("./clone"),copy:require("./copy"),create:require("./create"),invert:require("./invert"),equals:require("./equals"),fromRotation:require("./fromRotation"),fromScaling:require("./fromScaling"),fromTaitBryanRotation:require("./fromTaitBryanRotation"),fromTranslation:require("./fromTranslation"),fromValues:require("./fromValues"),fromVectorRotation:require("./fromVectorRotation"),fromXRotation:require("./fromXRotation"),fromYRotation:require("./fromYRotation"),fromZRotation:require("./fromZRotation"),identity:require("./identity"),isMirroring:require("./isMirroring"),mirrorByPlane:require("./mirrorByPlane"),multiply:require("./multiply"),rotate:require("./rotate"),rotateX:require("./rotateX"),rotateY:require("./rotateY"),rotateZ:require("./rotateZ"),scale:require("./scale"),subtract:require("./subtract"),toString:require("./toString"),translate:require("./translate")};
|
|
1041
|
+
},{}],237:[function(require,module,exports){
|
|
1042
|
+
module.exports={add:require("./add"),clone:require("./clone"),copy:require("./copy"),create:require("./create"),invert:require("./invert"),equals:require("./equals"),fromRotation:require("./fromRotation"),fromScaling:require("./fromScaling"),fromTaitBryanRotation:require("./fromTaitBryanRotation"),fromTranslation:require("./fromTranslation"),fromValues:require("./fromValues"),fromVectorRotation:require("./fromVectorRotation"),fromXRotation:require("./fromXRotation"),fromYRotation:require("./fromYRotation"),fromZRotation:require("./fromZRotation"),identity:require("./identity"),isIdentity:require("./isIdentity"),isMirroring:require("./isMirroring"),mirrorByPlane:require("./mirrorByPlane"),multiply:require("./multiply"),rotate:require("./rotate"),rotateX:require("./rotateX"),rotateY:require("./rotateY"),rotateZ:require("./rotateZ"),scale:require("./scale"),subtract:require("./subtract"),toString:require("./toString"),translate:require("./translate")};
|
|
1114
1043
|
|
|
1115
|
-
},{"./add":
|
|
1044
|
+
},{"./add":221,"./clone":222,"./copy":224,"./create":225,"./equals":226,"./fromRotation":227,"./fromScaling":228,"./fromTaitBryanRotation":229,"./fromTranslation":230,"./fromValues":231,"./fromVectorRotation":232,"./fromXRotation":233,"./fromYRotation":234,"./fromZRotation":235,"./identity":236,"./invert":238,"./isIdentity":239,"./isMirroring":240,"./mirrorByPlane":241,"./multiply":242,"./rotate":243,"./rotateX":244,"./rotateY":245,"./rotateZ":246,"./scale":247,"./subtract":248,"./toString":249,"./translate":250}],238:[function(require,module,exports){
|
|
1116
1045
|
const invert=(t,e)=>{const n=e[0],r=e[1],l=e[2],o=e[3],s=e[4],u=e[5],c=e[6],i=e[7],v=e[8],d=e[9],m=e[10],p=e[11],x=e[12],a=e[13],b=e[14],f=e[15],g=n*u-r*s,h=n*c-l*s,j=n*i-o*s,k=r*c-l*u,q=r*i-o*u,w=l*i-o*c,y=v*a-d*x,z=v*b-m*x,A=v*f-p*x,B=d*b-m*a,C=d*f-p*a,D=m*f-p*b;let E=g*D-h*C+j*B+k*A-q*z+w*y;return E?(E=1/E,t[0]=(u*D-c*C+i*B)*E,t[1]=(l*C-r*D-o*B)*E,t[2]=(a*w-b*q+f*k)*E,t[3]=(m*q-d*w-p*k)*E,t[4]=(c*A-s*D-i*z)*E,t[5]=(n*D-l*A+o*z)*E,t[6]=(b*j-x*w-f*h)*E,t[7]=(v*w-m*j+p*h)*E,t[8]=(s*C-u*A+i*y)*E,t[9]=(r*A-n*C-o*y)*E,t[10]=(x*q-a*j+f*g)*E,t[11]=(d*j-v*q-p*g)*E,t[12]=(u*z-s*B-c*y)*E,t[13]=(n*B-r*z+l*y)*E,t[14]=(a*h-x*k-b*g)*E,t[15]=(v*k-d*h+m*g)*E,t):null};module.exports=invert;
|
|
1117
1046
|
|
|
1118
|
-
},{}],
|
|
1047
|
+
},{}],239:[function(require,module,exports){
|
|
1048
|
+
const isIdentity=t=>1===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&0===t[4]&&1===t[5]&&0===t[6]&&0===t[7]&&0===t[8]&&0===t[9]&&1===t[10]&&0===t[11]&&0===t[12]&&0===t[13]&&0===t[14]&&1===t[15];module.exports=isIdentity;
|
|
1049
|
+
|
|
1050
|
+
},{}],240:[function(require,module,exports){
|
|
1119
1051
|
const cross=require("../vec3/cross"),dot=require("../vec3/dot"),fromValues=require("../vec3/fromValues"),isMirroring=r=>{const e=fromValues(r[0],r[4],r[8]),o=fromValues(r[1],r[5],r[9]),s=fromValues(r[2],r[6],r[10]);return dot(cross(e,e,o),s)<0};module.exports=isMirroring;
|
|
1120
1052
|
|
|
1121
|
-
},{"../vec3/cross":
|
|
1053
|
+
},{"../vec3/cross":305,"../vec3/dot":308,"../vec3/fromValues":311}],241:[function(require,module,exports){
|
|
1122
1054
|
const mirrorByPlane=(r,o)=>{const[e,n,t,l]=o;return r[0]=1-2*e*e,r[1]=-2*n*e,r[2]=-2*t*e,r[3]=0,r[4]=-2*e*n,r[5]=1-2*n*n,r[6]=-2*t*n,r[7]=0,r[8]=-2*e*t,r[9]=-2*n*t,r[10]=1-2*t*t,r[11]=0,r[12]=2*e*l,r[13]=2*n*l,r[14]=2*t*l,r[15]=1,r};module.exports=mirrorByPlane;
|
|
1123
1055
|
|
|
1124
|
-
},{}],
|
|
1056
|
+
},{}],242:[function(require,module,exports){
|
|
1125
1057
|
const multiply=(t,l,e)=>{const o=l[0],u=l[1],m=l[2],n=l[3],p=l[4],r=l[5],s=l[6],c=l[7],i=l[8],y=l[9],d=l[10],x=l[11],a=l[12],b=l[13],f=l[14],g=l[15];let h=e[0],j=e[1],k=e[2],q=e[3];return t[0]=h*o+j*p+k*i+q*a,t[1]=h*u+j*r+k*y+q*b,t[2]=h*m+j*s+k*d+q*f,t[3]=h*n+j*c+k*x+q*g,h=e[4],j=e[5],k=e[6],q=e[7],t[4]=h*o+j*p+k*i+q*a,t[5]=h*u+j*r+k*y+q*b,t[6]=h*m+j*s+k*d+q*f,t[7]=h*n+j*c+k*x+q*g,h=e[8],j=e[9],k=e[10],q=e[11],t[8]=h*o+j*p+k*i+q*a,t[9]=h*u+j*r+k*y+q*b,t[10]=h*m+j*s+k*d+q*f,t[11]=h*n+j*c+k*x+q*g,h=e[12],j=e[13],k=e[14],q=e[15],t[12]=h*o+j*p+k*i+q*a,t[13]=h*u+j*r+k*y+q*b,t[14]=h*m+j*s+k*d+q*f,t[15]=h*n+j*c+k*x+q*g,t};module.exports=multiply;
|
|
1126
1058
|
|
|
1127
|
-
},{}],
|
|
1059
|
+
},{}],243:[function(require,module,exports){
|
|
1128
1060
|
const copy=require("./copy"),rotate=(t,e,o,r)=>{let[a,s,c]=r,n=Math.sqrt(a*a+s*s+c*c);if(Math.abs(n)<1e-6)return copy(t,e);a*=n=1/n,s*=n,c*=n;const h=Math.sin(o),p=Math.cos(o),u=1-p,M=e[0],i=e[1],y=e[2],l=e[3],q=e[4],b=e[5],d=e[6],f=e[7],m=e[8],x=e[9],g=e[10],j=e[11],k=a*a*u+p,v=s*a*u+c*h,w=c*a*u-s*h,z=a*s*u-c*h,A=s*s*u+p,B=c*s*u+a*h,C=a*c*u+s*h,D=s*c*u-a*h,E=c*c*u+p;return t[0]=M*k+q*v+m*w,t[1]=i*k+b*v+x*w,t[2]=y*k+d*v+g*w,t[3]=l*k+f*v+j*w,t[4]=M*z+q*A+m*B,t[5]=i*z+b*A+x*B,t[6]=y*z+d*A+g*B,t[7]=l*z+f*A+j*B,t[8]=M*C+q*D+m*E,t[9]=i*C+b*D+x*E,t[10]=y*C+d*D+g*E,t[11]=l*C+f*D+j*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t};module.exports=rotate;
|
|
1129
1061
|
|
|
1130
|
-
},{"./copy":
|
|
1062
|
+
},{"./copy":224}],244:[function(require,module,exports){
|
|
1131
1063
|
const rotateX=(t,o,e)=>{const r=Math.sin(e),s=Math.cos(e),a=o[4],n=o[5],c=o[6],h=o[7],u=o[8],M=o[9],X=o[10],d=o[11];return o!==t&&(t[0]=o[0],t[1]=o[1],t[2]=o[2],t[3]=o[3],t[12]=o[12],t[13]=o[13],t[14]=o[14],t[15]=o[15]),t[4]=a*s+u*r,t[5]=n*s+M*r,t[6]=c*s+X*r,t[7]=h*s+d*r,t[8]=u*s-a*r,t[9]=M*s-n*r,t[10]=X*s-c*r,t[11]=d*s-h*r,t};module.exports=rotateX;
|
|
1132
1064
|
|
|
1133
|
-
},{}],
|
|
1065
|
+
},{}],245:[function(require,module,exports){
|
|
1134
1066
|
const rotateY=(t,o,e)=>{const r=Math.sin(e),s=Math.cos(e),a=o[0],n=o[1],c=o[2],h=o[3],u=o[8],M=o[9],Y=o[10],d=o[11];return o!==t&&(t[4]=o[4],t[5]=o[5],t[6]=o[6],t[7]=o[7],t[12]=o[12],t[13]=o[13],t[14]=o[14],t[15]=o[15]),t[0]=a*s-u*r,t[1]=n*s-M*r,t[2]=c*s-Y*r,t[3]=h*s-d*r,t[8]=a*r+u*s,t[9]=n*r+M*s,t[10]=c*r+Y*s,t[11]=h*r+d*s,t};module.exports=rotateY;
|
|
1135
1067
|
|
|
1136
|
-
},{}],
|
|
1068
|
+
},{}],246:[function(require,module,exports){
|
|
1137
1069
|
const rotateZ=(t,o,e)=>{const r=Math.sin(e),s=Math.cos(e),a=o[0],n=o[1],c=o[2],h=o[3],u=o[4],M=o[5],Z=o[6],d=o[7];return o!==t&&(t[8]=o[8],t[9]=o[9],t[10]=o[10],t[11]=o[11],t[12]=o[12],t[13]=o[13],t[14]=o[14],t[15]=o[15]),t[0]=a*s+u*r,t[1]=n*s+M*r,t[2]=c*s+Z*r,t[3]=h*s+d*r,t[4]=u*s-a*r,t[5]=M*s-n*r,t[6]=Z*s-c*r,t[7]=d*s-h*r,t};module.exports=rotateZ;
|
|
1138
1070
|
|
|
1139
|
-
},{}],
|
|
1071
|
+
},{}],247:[function(require,module,exports){
|
|
1140
1072
|
const scale=(e,s,c)=>{const o=c[0],t=c[1],l=c[2];return e[0]=s[0]*o,e[1]=s[1]*o,e[2]=s[2]*o,e[3]=s[3]*o,e[4]=s[4]*t,e[5]=s[5]*t,e[6]=s[6]*t,e[7]=s[7]*t,e[8]=s[8]*l,e[9]=s[9]*l,e[10]=s[10]*l,e[11]=s[11]*l,e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],e};module.exports=scale;
|
|
1141
1073
|
|
|
1142
|
-
},{}],
|
|
1074
|
+
},{}],248:[function(require,module,exports){
|
|
1143
1075
|
const subtract=(t,s,c)=>(t[0]=s[0]-c[0],t[1]=s[1]-c[1],t[2]=s[2]-c[2],t[3]=s[3]-c[3],t[4]=s[4]-c[4],t[5]=s[5]-c[5],t[6]=s[6]-c[6],t[7]=s[7]-c[7],t[8]=s[8]-c[8],t[9]=s[9]-c[9],t[10]=s[10]-c[10],t[11]=s[11]-c[11],t[12]=s[12]-c[12],t[13]=s[13]-c[13],t[14]=s[14]-c[14],t[15]=s[15]-c[15],t);module.exports=subtract;
|
|
1144
1076
|
|
|
1145
|
-
},{}],
|
|
1077
|
+
},{}],249:[function(require,module,exports){
|
|
1146
1078
|
const toString=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}, ${t[3].toFixed(7)}, ${t[4].toFixed(7)}, ${t[5].toFixed(7)}, ${t[6].toFixed(7)}, ${t[7].toFixed(7)}, ${t[8].toFixed(7)}, ${t[9].toFixed(7)}, ${t[10].toFixed(7)}, ${t[11].toFixed(7)}, ${t[12].toFixed(7)}, ${t[13].toFixed(7)}, ${t[14].toFixed(7)}, ${t[15].toFixed(7)}]`;module.exports=toString;
|
|
1147
1079
|
|
|
1148
|
-
},{}],
|
|
1080
|
+
},{}],250:[function(require,module,exports){
|
|
1149
1081
|
const translate=(t,e,n)=>{const r=n[0],s=n[1],a=n[2];let l,o,c,u,d,m,p,x,b,f,g,h;return e===t?(t[12]=e[0]*r+e[4]*s+e[8]*a+e[12],t[13]=e[1]*r+e[5]*s+e[9]*a+e[13],t[14]=e[2]*r+e[6]*s+e[10]*a+e[14],t[15]=e[3]*r+e[7]*s+e[11]*a+e[15]):(l=e[0],o=e[1],c=e[2],u=e[3],d=e[4],m=e[5],p=e[6],x=e[7],b=e[8],f=e[9],g=e[10],h=e[11],t[0]=l,t[1]=o,t[2]=c,t[3]=u,t[4]=d,t[5]=m,t[6]=p,t[7]=x,t[8]=b,t[9]=f,t[10]=g,t[11]=h,t[12]=l*r+d*s+b*a+e[12],t[13]=o*r+m*s+f*a+e[13],t[14]=c*r+p*s+g*a+e[14],t[15]=u*r+x*s+h*a+e[15]),t};module.exports=translate;
|
|
1150
1082
|
|
|
1151
|
-
},{}],
|
|
1083
|
+
},{}],251:[function(require,module,exports){
|
|
1152
1084
|
const flip=(l,o)=>(l[0]=-o[0],l[1]=-o[1],l[2]=-o[2],l[3]=-o[3],l);module.exports=flip;
|
|
1153
1085
|
|
|
1154
|
-
},{}],
|
|
1155
|
-
const vec3=require("../vec3"),fromNormalAndPoint=(e,o,r)=>{const
|
|
1086
|
+
},{}],252:[function(require,module,exports){
|
|
1087
|
+
const vec3=require("../vec3"),fromNormalAndPoint=(e,o,r)=>{const c=vec3.normalize(vec3.create(),o),n=vec3.dot(r,c);return e[0]=c[0],e[1]=c[1],e[2]=c[2],e[3]=n,e};module.exports=fromNormalAndPoint;
|
|
1156
1088
|
|
|
1157
|
-
},{"../vec3":
|
|
1158
|
-
const vec3=require("../vec3"),fromPoints=(e,c,t,r)=>{const o=vec3.subtract(vec3.create(),t,c),s=vec3.subtract(vec3.create(),r,c);vec3.cross(o,o,s),vec3.
|
|
1089
|
+
},{"../vec3":313}],253:[function(require,module,exports){
|
|
1090
|
+
const vec3=require("../vec3"),fromPoints=(e,c,t,r)=>{const o=vec3.subtract(vec3.create(),t,c),s=vec3.subtract(vec3.create(),r,c);vec3.cross(o,o,s),vec3.normalize(o,o);const v=vec3.dot(o,c);return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=v,e};module.exports=fromPoints;
|
|
1159
1091
|
|
|
1160
|
-
},{"../vec3":
|
|
1161
|
-
const{EPS:EPS}=require("../constants"),vec3=require("../vec3"),fromPointsRandom=(e,c,t
|
|
1092
|
+
},{"../vec3":313}],254:[function(require,module,exports){
|
|
1093
|
+
const{EPS:EPS}=require("../constants"),vec3=require("../vec3"),fromPointsRandom=(e,c,o,t)=>{let r=vec3.subtract(vec3.create(),o,c),v=vec3.subtract(vec3.create(),t,c);vec3.length(r)<EPS&&(r=vec3.orthogonal(r,v)),vec3.length(v)<EPS&&(v=vec3.orthogonal(v,r));let n=vec3.cross(vec3.create(),r,v);vec3.length(n)<EPS&&(v=vec3.orthogonal(v,r),n=vec3.cross(n,r,v)),n=vec3.normalize(n,n);const s=vec3.dot(n,c);return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=s,e};module.exports=fromPointsRandom;
|
|
1162
1094
|
|
|
1163
|
-
},{"../constants":
|
|
1095
|
+
},{"../constants":187,"../vec3":313}],255:[function(require,module,exports){
|
|
1164
1096
|
module.exports={clone:require("../vec4/clone"),copy:require("../vec4/copy"),create:require("../vec4/create"),equals:require("../vec4/equals"),flip:require("./flip"),fromNormalAndPoint:require("./fromNormalAndPoint"),fromValues:require("../vec4/fromValues"),fromPoints:require("./fromPoints"),fromPointsRandom:require("./fromPointsRandom"),projectionOfPoint:require("./projectionOfPoint"),signedDistanceToPoint:require("./signedDistanceToPoint"),toString:require("../vec4/toString"),transform:require("./transform")};
|
|
1165
1097
|
|
|
1166
|
-
},{"../vec4/clone":
|
|
1098
|
+
},{"../vec4/clone":332,"../vec4/copy":333,"../vec4/create":334,"../vec4/equals":336,"../vec4/fromValues":338,"../vec4/toString":340,"./flip":251,"./fromNormalAndPoint":252,"./fromPoints":253,"./fromPointsRandom":254,"./projectionOfPoint":256,"./signedDistanceToPoint":257,"./transform":258}],256:[function(require,module,exports){
|
|
1167
1099
|
const vec3=require("../vec3"),projectionOfPoint=(e,o)=>{const r=o[0]*e[0]+o[1]*e[1]+o[2]*e[2]-e[3],t=o[0]-r*e[0],c=o[1]-r*e[1],n=o[2]-r*e[2];return vec3.fromValues(t,c,n)};module.exports=projectionOfPoint;
|
|
1168
1100
|
|
|
1169
|
-
},{"../vec3":
|
|
1101
|
+
},{"../vec3":313}],257:[function(require,module,exports){
|
|
1170
1102
|
const vec3=require("../vec3"),signedDistanceToPoint=(e,o)=>vec3.dot(e,o)-e[3];module.exports=signedDistanceToPoint;
|
|
1171
1103
|
|
|
1172
|
-
},{"../vec3":
|
|
1104
|
+
},{"../vec3":313}],258:[function(require,module,exports){
|
|
1173
1105
|
const mat4=require("../mat4"),vec3=require("../vec3"),fromPoints=require("./fromPoints"),flip=require("./flip"),transform=(e,r,c)=>{const t=mat4.isMirroring(c),o=vec3.orthogonal(vec3.create(),r),a=vec3.cross(o,r,o),v=vec3.cross(vec3.create(),r,a);let s=vec3.fromScalar(vec3.create(),r[3]);vec3.multiply(s,s,r);let i=vec3.add(vec3.create(),s,a),m=vec3.add(vec3.create(),s,v);return s=vec3.transform(s,s,c),i=vec3.transform(i,i,c),m=vec3.transform(m,m,c),fromPoints(e,s,i,m),t&&flip(e,e),e};module.exports=transform;
|
|
1174
1106
|
|
|
1175
|
-
},{"../mat4":
|
|
1107
|
+
},{"../mat4":237,"../vec3":313,"./flip":251,"./fromPoints":253}],259:[function(require,module,exports){
|
|
1176
1108
|
const NEPS=1e-13,aboutEqualNormals=(a,o)=>Math.abs(a[0]-o[0])<=NEPS&&Math.abs(a[1]-o[1])<=NEPS&&Math.abs(a[2]-o[2])<=NEPS;module.exports=aboutEqualNormals;
|
|
1177
1109
|
|
|
1178
|
-
},{}],
|
|
1110
|
+
},{}],260:[function(require,module,exports){
|
|
1179
1111
|
const area=e=>{let t=0;for(let r=0;r<e.length;r++){const l=(r+1)%e.length;t+=e[r][0]*e[l][1],t-=e[l][0]*e[r][1]}return t/2};module.exports=area;
|
|
1180
1112
|
|
|
1181
|
-
},{}],
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
},{}],280:[function(require,module,exports){
|
|
1185
|
-
module.exports={aboutEqualNormals:require("./aboutEqualNormals"),area:require("./area"),clamp:require("./clamp"),interpolateBetween2DPointsForY:require("./interpolateBetween2DPointsForY"),intersect:require("./intersect"),solve2Linear:require("./solve2Linear")};
|
|
1113
|
+
},{}],261:[function(require,module,exports){
|
|
1114
|
+
module.exports={aboutEqualNormals:require("./aboutEqualNormals"),area:require("./area"),interpolateBetween2DPointsForY:require("./interpolateBetween2DPointsForY"),intersect:require("./intersect"),solve2Linear:require("./solve2Linear")};
|
|
1186
1115
|
|
|
1187
|
-
},{"./aboutEqualNormals":
|
|
1116
|
+
},{"./aboutEqualNormals":259,"./area":260,"./interpolateBetween2DPointsForY":262,"./intersect":263,"./solve2Linear":264}],262:[function(require,module,exports){
|
|
1188
1117
|
const interpolateBetween2DPointsForY=(e,t,o)=>{let n,r=o-e[1],i=t[1]-e[1];return i<0&&(r=-r,i=-i),n=r<=0?0:r>=i?1:i<1e-10?.5:r/i,e[0]+n*(t[0]-e[0])};module.exports=interpolateBetween2DPointsForY;
|
|
1189
1118
|
|
|
1190
|
-
},{}],
|
|
1119
|
+
},{}],263:[function(require,module,exports){
|
|
1191
1120
|
const intersect=(t,e,r,n)=>{if(t[0]===e[0]&&t[1]===e[1]||r[0]===n[0]&&r[1]===n[1])return;const s=(n[1]-r[1])*(e[0]-t[0])-(n[0]-r[0])*(e[1]-t[1]);if(Math.abs(s)<Number.MIN_VALUE)return;const o=((n[0]-r[0])*(t[1]-r[1])-(n[1]-r[1])*(t[0]-r[0]))/s,c=((e[0]-t[0])*(t[1]-r[1])-(e[1]-t[1])*(t[0]-r[0]))/s;return o<0||o>1||c<0||c>1?void 0:[t[0]+o*(e[0]-t[0]),t[1]+o*(e[1]-t[1])]};module.exports=intersect;
|
|
1192
1121
|
|
|
1193
|
-
},{}],
|
|
1122
|
+
},{}],264:[function(require,module,exports){
|
|
1194
1123
|
const solve2Linear=(e,o,n,r,s,t)=>{const l=1/(e*r-o*n);let a=s*r-o*t,c=-s*n+e*t;return[a*=l,c*=l]};module.exports=solve2Linear;
|
|
1195
1124
|
|
|
1196
|
-
},{}],
|
|
1125
|
+
},{}],265:[function(require,module,exports){
|
|
1197
1126
|
const abs=(a,s)=>(a[0]=Math.abs(s[0]),a[1]=Math.abs(s[1]),a);module.exports=abs;
|
|
1198
1127
|
|
|
1199
|
-
},{}],
|
|
1128
|
+
},{}],266:[function(require,module,exports){
|
|
1200
1129
|
const add=(d,o,a)=>(d[0]=o[0]+a[0],d[1]=o[1]+a[1],d);module.exports=add;
|
|
1201
1130
|
|
|
1202
|
-
},{}],
|
|
1131
|
+
},{}],267:[function(require,module,exports){
|
|
1203
1132
|
module.exports=require("./angleRadians");
|
|
1204
1133
|
|
|
1205
|
-
},{"./angleRadians":
|
|
1134
|
+
},{"./angleRadians":269}],268:[function(require,module,exports){
|
|
1206
1135
|
const angleRadians=require("./angleRadians"),angleDegrees=e=>57.29577951308232*angleRadians(e);module.exports=angleDegrees;
|
|
1207
1136
|
|
|
1208
|
-
},{"./angleRadians":
|
|
1137
|
+
},{"./angleRadians":269}],269:[function(require,module,exports){
|
|
1209
1138
|
const angleRadians=a=>Math.atan2(a[1],a[0]);module.exports=angleRadians;
|
|
1210
1139
|
|
|
1211
|
-
},{}],
|
|
1140
|
+
},{}],270:[function(require,module,exports){
|
|
1212
1141
|
const create=require("./create"),clone=e=>{const r=create();return r[0]=e[0],r[1]=e[1],r};module.exports=clone;
|
|
1213
1142
|
|
|
1214
|
-
},{"./create":
|
|
1143
|
+
},{"./create":272}],271:[function(require,module,exports){
|
|
1215
1144
|
const copy=(o,c)=>(o[0]=c[0],o[1]=c[1],o);module.exports=copy;
|
|
1216
1145
|
|
|
1217
|
-
},{}],
|
|
1146
|
+
},{}],272:[function(require,module,exports){
|
|
1218
1147
|
const create=()=>[0,0];module.exports=create;
|
|
1219
1148
|
|
|
1220
|
-
},{}],
|
|
1149
|
+
},{}],273:[function(require,module,exports){
|
|
1221
1150
|
const cross=(s,o,c)=>(s[0]=0,s[1]=0,s[2]=o[0]*c[1]-o[1]*c[0],s);module.exports=cross;
|
|
1222
1151
|
|
|
1223
|
-
},{}],
|
|
1152
|
+
},{}],274:[function(require,module,exports){
|
|
1224
1153
|
const distance=(t,e)=>{const n=e[0]-t[0],o=e[1]-t[1];return Math.hypot(n,o)};module.exports=distance;
|
|
1225
1154
|
|
|
1226
|
-
},{}],
|
|
1155
|
+
},{}],275:[function(require,module,exports){
|
|
1227
1156
|
const divide=(d,e,i)=>(d[0]=e[0]/i[0],d[1]=e[1]/i[1],d);module.exports=divide;
|
|
1228
1157
|
|
|
1229
|
-
},{}],
|
|
1158
|
+
},{}],276:[function(require,module,exports){
|
|
1230
1159
|
const dot=(o,t)=>o[0]*t[0]+o[1]*t[1];module.exports=dot;
|
|
1231
1160
|
|
|
1232
|
-
},{}],
|
|
1161
|
+
},{}],277:[function(require,module,exports){
|
|
1233
1162
|
const equals=(e,s)=>e[0]===s[0]&&e[1]===s[1];module.exports=equals;
|
|
1234
1163
|
|
|
1235
|
-
},{}],
|
|
1164
|
+
},{}],278:[function(require,module,exports){
|
|
1236
1165
|
const fromAngleRadians=require("./fromAngleRadians"),fromAngleDegrees=(e,r)=>fromAngleRadians(e,Math.PI*r/180);module.exports=fromAngleDegrees;
|
|
1237
1166
|
|
|
1238
|
-
},{"./fromAngleRadians":
|
|
1167
|
+
},{"./fromAngleRadians":279}],279:[function(require,module,exports){
|
|
1239
1168
|
const fromAngleRadians=(a,n)=>(a[0]=Math.cos(n),a[1]=Math.sin(n),a);module.exports=fromAngleRadians;
|
|
1240
1169
|
|
|
1241
|
-
},{}],
|
|
1170
|
+
},{}],280:[function(require,module,exports){
|
|
1242
1171
|
const fromScalar=(o,r)=>(o[0]=r,o[1]=r,o);module.exports=fromScalar;
|
|
1243
1172
|
|
|
1244
|
-
},{}],
|
|
1173
|
+
},{}],281:[function(require,module,exports){
|
|
1245
1174
|
const create=require("./create"),fromValues=(e,r)=>{const t=create();return t[0]=e,t[1]=r,t};module.exports=fromValues;
|
|
1246
1175
|
|
|
1247
|
-
},{"./create":
|
|
1176
|
+
},{"./create":272}],282:[function(require,module,exports){
|
|
1248
1177
|
module.exports={abs:require("./abs"),add:require("./add"),angle:require("./angle"),angleDegrees:require("./angleDegrees"),angleRadians:require("./angleRadians"),clone:require("./clone"),copy:require("./copy"),create:require("./create"),cross:require("./cross"),distance:require("./distance"),divide:require("./divide"),dot:require("./dot"),equals:require("./equals"),fromAngleDegrees:require("./fromAngleDegrees"),fromAngleRadians:require("./fromAngleRadians"),fromScalar:require("./fromScalar"),fromValues:require("./fromValues"),length:require("./length"),lerp:require("./lerp"),max:require("./max"),min:require("./min"),multiply:require("./multiply"),negate:require("./negate"),normal:require("./normal"),normalize:require("./normalize"),rotate:require("./rotate"),scale:require("./scale"),snap:require("./snap"),squaredDistance:require("./squaredDistance"),squaredLength:require("./squaredLength"),subtract:require("./subtract"),toString:require("./toString"),transform:require("./transform")};
|
|
1249
1178
|
|
|
1250
|
-
},{"./abs":
|
|
1179
|
+
},{"./abs":265,"./add":266,"./angle":267,"./angleDegrees":268,"./angleRadians":269,"./clone":270,"./copy":271,"./create":272,"./cross":273,"./distance":274,"./divide":275,"./dot":276,"./equals":277,"./fromAngleDegrees":278,"./fromAngleRadians":279,"./fromScalar":280,"./fromValues":281,"./length":283,"./lerp":284,"./max":285,"./min":286,"./multiply":287,"./negate":288,"./normal":289,"./normalize":290,"./rotate":291,"./scale":292,"./snap":293,"./squaredDistance":294,"./squaredLength":295,"./subtract":296,"./toString":297,"./transform":298}],283:[function(require,module,exports){
|
|
1251
1180
|
const length=t=>Math.hypot(t[0],t[1]);module.exports=length;
|
|
1252
1181
|
|
|
1253
|
-
},{}],
|
|
1182
|
+
},{}],284:[function(require,module,exports){
|
|
1254
1183
|
const lerp=(e,r,o,t)=>{const l=r[0],n=r[1];return e[0]=l+t*(o[0]-l),e[1]=n+t*(o[1]-n),e};module.exports=lerp;
|
|
1255
1184
|
|
|
1256
|
-
},{}],
|
|
1185
|
+
},{}],285:[function(require,module,exports){
|
|
1257
1186
|
const max=(a,m,x)=>(a[0]=Math.max(m[0],x[0]),a[1]=Math.max(m[1],x[1]),a);module.exports=max;
|
|
1258
1187
|
|
|
1259
|
-
},{}],
|
|
1188
|
+
},{}],286:[function(require,module,exports){
|
|
1260
1189
|
const min=(m,n,i)=>(m[0]=Math.min(n[0],i[0]),m[1]=Math.min(n[1],i[1]),m);module.exports=min;
|
|
1261
1190
|
|
|
1262
|
-
},{}],
|
|
1191
|
+
},{}],287:[function(require,module,exports){
|
|
1263
1192
|
const multiply=(l,t,m)=>(l[0]=t[0]*m[0],l[1]=t[1]*m[1],l);module.exports=multiply;
|
|
1264
1193
|
|
|
1265
|
-
},{}],
|
|
1194
|
+
},{}],288:[function(require,module,exports){
|
|
1266
1195
|
const negate=(e,t)=>(e[0]=-t[0],e[1]=-t[1],e);module.exports=negate;
|
|
1267
1196
|
|
|
1268
|
-
},{}],
|
|
1197
|
+
},{}],289:[function(require,module,exports){
|
|
1269
1198
|
const create=require("./create"),rotate=require("./rotate"),normal=(e,r)=>rotate(e,r,create(),Math.PI/2);module.exports=normal;
|
|
1270
1199
|
|
|
1271
|
-
},{"./create":
|
|
1200
|
+
},{"./create":272,"./rotate":291}],290:[function(require,module,exports){
|
|
1272
1201
|
const normalize=(t,e)=>{const o=e[0],r=e[1];let n=o*o+r*r;return n>0&&(n=1/Math.sqrt(n)),t[0]=o*n,t[1]=r*n,t};module.exports=normalize;
|
|
1273
1202
|
|
|
1274
|
-
},{}],
|
|
1275
|
-
const rotate=(t,o,e,r)=>{const s=o[0]-e[0],a=o[1]-e[
|
|
1203
|
+
},{}],291:[function(require,module,exports){
|
|
1204
|
+
const rotate=(t,o,e,r)=>{const s=o[0]-e[0],a=o[1]-e[1],n=Math.cos(r),c=Math.sin(r);return t[0]=s*n-a*c+e[0],t[1]=s*c+a*n+e[1],t};module.exports=rotate;
|
|
1276
1205
|
|
|
1277
|
-
},{}],
|
|
1206
|
+
},{}],292:[function(require,module,exports){
|
|
1278
1207
|
const scale=(e,s,c)=>(e[0]=s[0]*c,e[1]=s[1]*c,e);module.exports=scale;
|
|
1279
1208
|
|
|
1280
|
-
},{}],
|
|
1209
|
+
},{}],293:[function(require,module,exports){
|
|
1281
1210
|
const snap=(n,o,a)=>(n[0]=Math.round(o[0]/a)*a+0,n[1]=Math.round(o[1]/a)*a+0,n);module.exports=snap;
|
|
1282
1211
|
|
|
1283
|
-
},{}],
|
|
1212
|
+
},{}],294:[function(require,module,exports){
|
|
1284
1213
|
const squaredDistance=(e,s)=>{const t=s[0]-e[0],n=s[1]-e[1];return t*t+n*n};module.exports=squaredDistance;
|
|
1285
1214
|
|
|
1286
|
-
},{}],
|
|
1215
|
+
},{}],295:[function(require,module,exports){
|
|
1287
1216
|
const squaredLength=e=>{const t=e[0],n=e[1];return t*t+n*n};module.exports=squaredLength;
|
|
1288
1217
|
|
|
1289
|
-
},{}],
|
|
1218
|
+
},{}],296:[function(require,module,exports){
|
|
1290
1219
|
const subtract=(t,s,c)=>(t[0]=s[0]-c[0],t[1]=s[1]-c[1],t);module.exports=subtract;
|
|
1291
1220
|
|
|
1292
|
-
},{}],
|
|
1221
|
+
},{}],297:[function(require,module,exports){
|
|
1293
1222
|
const toString=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}]`;module.exports=toString;
|
|
1294
1223
|
|
|
1295
|
-
},{}],
|
|
1224
|
+
},{}],298:[function(require,module,exports){
|
|
1296
1225
|
const transform=(r,o,t)=>{const n=o[0],s=o[1];return r[0]=t[0]*n+t[4]*s+t[12],r[1]=t[1]*n+t[5]*s+t[13],r};module.exports=transform;
|
|
1297
1226
|
|
|
1298
|
-
},{}],
|
|
1227
|
+
},{}],299:[function(require,module,exports){
|
|
1299
1228
|
const abs=(a,s)=>(a[0]=Math.abs(s[0]),a[1]=Math.abs(s[1]),a[2]=Math.abs(s[2]),a);module.exports=abs;
|
|
1300
1229
|
|
|
1301
|
-
},{}],
|
|
1230
|
+
},{}],300:[function(require,module,exports){
|
|
1302
1231
|
const add=(d,o,a)=>(d[0]=o[0]+a[0],d[1]=o[1]+a[1],d[2]=o[2]+a[2],d);module.exports=add;
|
|
1303
1232
|
|
|
1304
|
-
},{}],
|
|
1233
|
+
},{}],301:[function(require,module,exports){
|
|
1305
1234
|
const dot=require("./dot"),angle=(t,a)=>{const o=t[0],e=t[1],r=t[2],n=a[0],s=a[1],h=a[2],M=Math.sqrt(o*o+e*e+r*r)*Math.sqrt(n*n+s*s+h*h),d=M&&dot(t,a)/M;return Math.acos(Math.min(Math.max(d,-1),1))};module.exports=angle;
|
|
1306
1235
|
|
|
1307
|
-
},{"./dot":
|
|
1236
|
+
},{"./dot":308}],302:[function(require,module,exports){
|
|
1308
1237
|
const create=require("./create"),clone=e=>{const r=create();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r};module.exports=clone;
|
|
1309
1238
|
|
|
1310
|
-
},{"./create":
|
|
1239
|
+
},{"./create":304}],303:[function(require,module,exports){
|
|
1311
1240
|
const copy=(o,c)=>(o[0]=c[0],o[1]=c[1],o[2]=c[2],o);module.exports=copy;
|
|
1312
1241
|
|
|
1313
|
-
},{}],
|
|
1242
|
+
},{}],304:[function(require,module,exports){
|
|
1314
1243
|
const create=()=>[0,0,0];module.exports=create;
|
|
1315
1244
|
|
|
1316
|
-
},{}],
|
|
1245
|
+
},{}],305:[function(require,module,exports){
|
|
1317
1246
|
const cross=(s,o,r)=>{const c=o[0],t=o[1],e=o[2],n=r[0],u=r[1],d=r[2];return s[0]=t*d-e*u,s[1]=e*n-c*d,s[2]=c*u-t*n,s};module.exports=cross;
|
|
1318
1247
|
|
|
1319
|
-
},{}],
|
|
1248
|
+
},{}],306:[function(require,module,exports){
|
|
1320
1249
|
const distance=(t,e)=>{const n=e[0]-t[0],o=e[1]-t[1],s=e[2]-t[2];return Math.hypot(n,o,s)};module.exports=distance;
|
|
1321
1250
|
|
|
1322
|
-
},{}],
|
|
1251
|
+
},{}],307:[function(require,module,exports){
|
|
1323
1252
|
const divide=(d,e,i)=>(d[0]=e[0]/i[0],d[1]=e[1]/i[1],d[2]=e[2]/i[2],d);module.exports=divide;
|
|
1324
1253
|
|
|
1325
|
-
},{}],
|
|
1254
|
+
},{}],308:[function(require,module,exports){
|
|
1326
1255
|
const dot=(o,t)=>o[0]*t[0]+o[1]*t[1]+o[2]*t[2];module.exports=dot;
|
|
1327
1256
|
|
|
1328
|
-
},{}],
|
|
1257
|
+
},{}],309:[function(require,module,exports){
|
|
1329
1258
|
const equals=(e,s)=>e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2];module.exports=equals;
|
|
1330
1259
|
|
|
1331
|
-
},{}],
|
|
1260
|
+
},{}],310:[function(require,module,exports){
|
|
1332
1261
|
const fromScalar=(o,r)=>(o[0]=r,o[1]=r,o[2]=r,o);module.exports=fromScalar;
|
|
1333
1262
|
|
|
1334
|
-
},{}],
|
|
1263
|
+
},{}],311:[function(require,module,exports){
|
|
1335
1264
|
const create=require("./create"),fromValues=(e,r,t)=>{const o=create();return o[0]=e,o[1]=r,o[2]=t,o};module.exports=fromValues;
|
|
1336
1265
|
|
|
1337
|
-
},{"./create":
|
|
1266
|
+
},{"./create":304}],312:[function(require,module,exports){
|
|
1338
1267
|
const fromVector2=(o,r,e=0)=>(o[0]=r[0],o[1]=r[1],o[2]=e,o);module.exports=fromVector2;
|
|
1339
1268
|
|
|
1340
|
-
},{}],
|
|
1341
|
-
module.exports={abs:require("./abs"),add:require("./add"),angle:require("./angle"),clone:require("./clone"),copy:require("./copy"),create:require("./create"),cross:require("./cross"),distance:require("./distance"),divide:require("./divide"),dot:require("./dot"),equals:require("./equals"),fromScalar:require("./fromScalar"),fromValues:require("./fromValues"),fromVec2:require("./fromVec2"),length:require("./length"),lerp:require("./lerp"),max:require("./max"),min:require("./min"),multiply:require("./multiply"),negate:require("./negate"),normalize:require("./normalize"),orthogonal:require("./orthogonal"),rotateX:require("./rotateX"),rotateY:require("./rotateY"),rotateZ:require("./rotateZ"),scale:require("./scale"),snap:require("./snap"),squaredDistance:require("./squaredDistance"),squaredLength:require("./squaredLength"),subtract:require("./subtract"),toString:require("./toString"),transform:require("./transform")
|
|
1269
|
+
},{}],313:[function(require,module,exports){
|
|
1270
|
+
module.exports={abs:require("./abs"),add:require("./add"),angle:require("./angle"),clone:require("./clone"),copy:require("./copy"),create:require("./create"),cross:require("./cross"),distance:require("./distance"),divide:require("./divide"),dot:require("./dot"),equals:require("./equals"),fromScalar:require("./fromScalar"),fromValues:require("./fromValues"),fromVec2:require("./fromVec2"),length:require("./length"),lerp:require("./lerp"),max:require("./max"),min:require("./min"),multiply:require("./multiply"),negate:require("./negate"),normalize:require("./normalize"),orthogonal:require("./orthogonal"),rotateX:require("./rotateX"),rotateY:require("./rotateY"),rotateZ:require("./rotateZ"),scale:require("./scale"),snap:require("./snap"),squaredDistance:require("./squaredDistance"),squaredLength:require("./squaredLength"),subtract:require("./subtract"),toString:require("./toString"),transform:require("./transform")};
|
|
1342
1271
|
|
|
1343
|
-
},{"./abs":
|
|
1272
|
+
},{"./abs":299,"./add":300,"./angle":301,"./clone":302,"./copy":303,"./create":304,"./cross":305,"./distance":306,"./divide":307,"./dot":308,"./equals":309,"./fromScalar":310,"./fromValues":311,"./fromVec2":312,"./length":314,"./lerp":315,"./max":316,"./min":317,"./multiply":318,"./negate":319,"./normalize":320,"./orthogonal":321,"./rotateX":322,"./rotateY":323,"./rotateZ":324,"./scale":325,"./snap":326,"./squaredDistance":327,"./squaredLength":328,"./subtract":329,"./toString":330,"./transform":331}],314:[function(require,module,exports){
|
|
1344
1273
|
const length=t=>{const e=t[0],n=t[1],o=t[2];return Math.hypot(e,n,o)};module.exports=length;
|
|
1345
1274
|
|
|
1346
|
-
},{}],
|
|
1275
|
+
},{}],315:[function(require,module,exports){
|
|
1347
1276
|
const lerp=(e,l,o,p)=>(e[0]=l[0]+p*(o[0]-l[0]),e[1]=l[1]+p*(o[1]-l[1]),e[2]=l[2]+p*(o[2]-l[2]),e);module.exports=lerp;
|
|
1348
1277
|
|
|
1349
|
-
},{}],
|
|
1278
|
+
},{}],316:[function(require,module,exports){
|
|
1350
1279
|
const max=(a,m,x)=>(a[0]=Math.max(m[0],x[0]),a[1]=Math.max(m[1],x[1]),a[2]=Math.max(m[2],x[2]),a);module.exports=max;
|
|
1351
1280
|
|
|
1352
|
-
},{}],
|
|
1281
|
+
},{}],317:[function(require,module,exports){
|
|
1353
1282
|
const min=(m,n,i)=>(m[0]=Math.min(n[0],i[0]),m[1]=Math.min(n[1],i[1]),m[2]=Math.min(n[2],i[2]),m);module.exports=min;
|
|
1354
1283
|
|
|
1355
|
-
},{}],
|
|
1284
|
+
},{}],318:[function(require,module,exports){
|
|
1356
1285
|
const multiply=(l,t,m)=>(l[0]=t[0]*m[0],l[1]=t[1]*m[1],l[2]=t[2]*m[2],l);module.exports=multiply;
|
|
1357
1286
|
|
|
1358
|
-
},{}],
|
|
1287
|
+
},{}],319:[function(require,module,exports){
|
|
1359
1288
|
const negate=(e,t)=>(e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e);module.exports=negate;
|
|
1360
1289
|
|
|
1361
|
-
},{}],
|
|
1290
|
+
},{}],320:[function(require,module,exports){
|
|
1362
1291
|
const normalize=(t,e)=>{const o=e[0],r=e[1],n=e[2];let l=o*o+r*r+n*n;return l>0&&(l=1/Math.sqrt(l)),t[0]=o*l,t[1]=r*l,t[2]=n*l,t};module.exports=normalize;
|
|
1363
1292
|
|
|
1364
|
-
},{}],
|
|
1293
|
+
},{}],321:[function(require,module,exports){
|
|
1365
1294
|
const abs=require("./abs"),create=require("./create"),cross=require("./cross"),orthogonal=(r,e)=>{const o=abs(create(),e),s=0+(o[0]<o[1]&&o[0]<o[2]),t=0+(o[1]<=o[0]&&o[1]<o[2]),a=0+(o[2]<=o[0]&&o[2]<=o[1]);return cross(r,e,[s,t,a])};module.exports=orthogonal;
|
|
1366
1295
|
|
|
1367
|
-
},{"./abs":
|
|
1296
|
+
},{"./abs":299,"./create":304,"./cross":305}],322:[function(require,module,exports){
|
|
1368
1297
|
const rotateX=(t,o,s,a)=>{const e=[],n=[];return e[0]=o[0]-s[0],e[1]=o[1]-s[1],e[2]=o[2]-s[2],n[0]=e[0],n[1]=e[1]*Math.cos(a)-e[2]*Math.sin(a),n[2]=e[1]*Math.sin(a)+e[2]*Math.cos(a),t[0]=n[0]+s[0],t[1]=n[1]+s[1],t[2]=n[2]+s[2],t};module.exports=rotateX;
|
|
1369
1298
|
|
|
1370
|
-
},{}],
|
|
1299
|
+
},{}],323:[function(require,module,exports){
|
|
1371
1300
|
const rotateY=(t,o,s,a)=>{const e=[],n=[];return e[0]=o[0]-s[0],e[1]=o[1]-s[1],e[2]=o[2]-s[2],n[0]=e[2]*Math.sin(a)+e[0]*Math.cos(a),n[1]=e[1],n[2]=e[2]*Math.cos(a)-e[0]*Math.sin(a),t[0]=n[0]+s[0],t[1]=n[1]+s[1],t[2]=n[2]+s[2],t};module.exports=rotateY;
|
|
1372
1301
|
|
|
1373
|
-
},{}],
|
|
1302
|
+
},{}],324:[function(require,module,exports){
|
|
1374
1303
|
const rotateZ=(t,o,s,a)=>{const e=[],n=[];return e[0]=o[0]-s[0],e[1]=o[1]-s[1],n[0]=e[0]*Math.cos(a)-e[1]*Math.sin(a),n[1]=e[0]*Math.sin(a)+e[1]*Math.cos(a),t[0]=n[0]+s[0],t[1]=n[1]+s[1],t[2]=o[2],t};module.exports=rotateZ;
|
|
1375
1304
|
|
|
1376
|
-
},{}],
|
|
1305
|
+
},{}],325:[function(require,module,exports){
|
|
1377
1306
|
const scale=(e,s,c)=>(e[0]=s[0]*c,e[1]=s[1]*c,e[2]=s[2]*c,e);module.exports=scale;
|
|
1378
1307
|
|
|
1379
|
-
},{}],
|
|
1308
|
+
},{}],326:[function(require,module,exports){
|
|
1380
1309
|
const snap=(n,o,a)=>(n[0]=Math.round(o[0]/a)*a+0,n[1]=Math.round(o[1]/a)*a+0,n[2]=Math.round(o[2]/a)*a+0,n);module.exports=snap;
|
|
1381
1310
|
|
|
1382
|
-
},{}],
|
|
1311
|
+
},{}],327:[function(require,module,exports){
|
|
1383
1312
|
const squaredDistance=(e,s)=>{const t=s[0]-e[0],n=s[1]-e[1],r=s[2]-e[2];return t*t+n*n+r*r};module.exports=squaredDistance;
|
|
1384
1313
|
|
|
1385
|
-
},{}],
|
|
1314
|
+
},{}],328:[function(require,module,exports){
|
|
1386
1315
|
const squaredLength=e=>{const t=e[0],n=e[1],r=e[2];return t*t+n*n+r*r};module.exports=squaredLength;
|
|
1387
1316
|
|
|
1388
|
-
},{}],
|
|
1317
|
+
},{}],329:[function(require,module,exports){
|
|
1389
1318
|
const subtract=(t,s,c)=>(t[0]=s[0]-c[0],t[1]=s[1]-c[1],t[2]=s[2]-c[2],t);module.exports=subtract;
|
|
1390
1319
|
|
|
1391
|
-
},{}],
|
|
1320
|
+
},{}],330:[function(require,module,exports){
|
|
1392
1321
|
const toString=t=>`[${t[0].toFixed(7)}, ${t[1].toFixed(7)}, ${t[2].toFixed(7)}]`;module.exports=toString;
|
|
1393
1322
|
|
|
1394
|
-
},{}],
|
|
1323
|
+
},{}],331:[function(require,module,exports){
|
|
1395
1324
|
const transform=(r,t,o)=>{const n=t[0],s=t[1],e=t[2];let m=o[3]*n+o[7]*s+o[11]*e+o[15];return m=m||1,r[0]=(o[0]*n+o[4]*s+o[8]*e+o[12])/m,r[1]=(o[1]*n+o[5]*s+o[9]*e+o[13])/m,r[2]=(o[2]*n+o[6]*s+o[10]*e+o[14])/m,r};module.exports=transform;
|
|
1396
1325
|
|
|
1397
|
-
},{}],
|
|
1398
|
-
const length=require("./length"),unit=(t,e)=>{const n=length(e);return t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n,t};module.exports=unit;
|
|
1399
|
-
|
|
1400
|
-
},{"./length":333}],352:[function(require,module,exports){
|
|
1326
|
+
},{}],332:[function(require,module,exports){
|
|
1401
1327
|
const create=require("./create"),clone=e=>{const r=create();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r};module.exports=clone;
|
|
1402
1328
|
|
|
1403
|
-
},{"./create":
|
|
1329
|
+
},{"./create":334}],333:[function(require,module,exports){
|
|
1404
1330
|
const copy=(o,c)=>(o[0]=c[0],o[1]=c[1],o[2]=c[2],o[3]=c[3],o);module.exports=copy;
|
|
1405
1331
|
|
|
1406
|
-
},{}],
|
|
1332
|
+
},{}],334:[function(require,module,exports){
|
|
1407
1333
|
const create=()=>[0,0,0,0];module.exports=create;
|
|
1408
1334
|
|
|
1409
|
-
},{}],
|
|
1335
|
+
},{}],335:[function(require,module,exports){
|
|
1410
1336
|
const dot=(o,t)=>o[0]*t[0]+o[1]*t[1]+o[2]*t[2]+o[3]*t[3];module.exports=dot;
|
|
1411
1337
|
|
|
1412
|
-
},{}],
|
|
1338
|
+
},{}],336:[function(require,module,exports){
|
|
1413
1339
|
const equals=(e,s)=>e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]&&e[3]===s[3];module.exports=equals;
|
|
1414
1340
|
|
|
1415
|
-
},{}],
|
|
1341
|
+
},{}],337:[function(require,module,exports){
|
|
1416
1342
|
const fromScalar=(o,r)=>(o[0]=r,o[1]=r,o[2]=r,o[3]=r,o);module.exports=fromScalar;
|
|
1417
1343
|
|
|
1418
|
-
},{}],
|
|
1344
|
+
},{}],338:[function(require,module,exports){
|
|
1419
1345
|
const create=require("./create"),fromValues=(e,r,t,o)=>{const a=create();return a[0]=e,a[1]=r,a[2]=t,a[3]=o,a};module.exports=fromValues;
|
|
1420
1346
|
|
|
1421
|
-
},{"./create":
|
|
1347
|
+
},{"./create":334}],339:[function(require,module,exports){
|
|
1422
1348
|
module.exports={clone:require("./clone"),copy:require("./copy"),create:require("./create"),dot:require("./dot"),equals:require("./equals"),fromScalar:require("./fromScalar"),fromValues:require("./fromValues"),toString:require("./toString"),transform:require("./transform")};
|
|
1423
1349
|
|
|
1424
|
-
},{"./clone":
|
|
1350
|
+
},{"./clone":332,"./copy":333,"./create":334,"./dot":335,"./equals":336,"./fromScalar":337,"./fromValues":338,"./toString":340,"./transform":341}],340:[function(require,module,exports){
|
|
1425
1351
|
const toString=t=>`(${t[0].toFixed(9)}, ${t[1].toFixed(9)}, ${t[2].toFixed(9)}, ${t[3].toFixed(9)})`;module.exports=toString;
|
|
1426
1352
|
|
|
1427
|
-
},{}],
|
|
1353
|
+
},{}],341:[function(require,module,exports){
|
|
1428
1354
|
const transform=(r,o,t)=>{const[n,s,e,m]=o;return r[0]=t[0]*n+t[4]*s+t[8]*e+t[12]*m,r[1]=t[1]*n+t[5]*s+t[9]*e+t[13]*m,r[2]=t[2]*n+t[6]*s+t[10]*e+t[14]*m,r[3]=t[3]*n+t[7]*s+t[11]*e+t[15]*m,r};module.exports=transform;
|
|
1429
1355
|
|
|
1430
|
-
},{}],
|
|
1356
|
+
},{}],342:[function(require,module,exports){
|
|
1431
1357
|
const{EPS:EPS}=require("../maths/constants"),calculateEpsilonFromBounds=(o,t)=>{let e=0;for(let l=0;l<t;l++)e+=o[1][l]-o[0][l];return EPS*e/t};module.exports=calculateEpsilonFromBounds;
|
|
1432
1358
|
|
|
1433
|
-
},{"../maths/constants":
|
|
1359
|
+
},{"../maths/constants":187}],343:[function(require,module,exports){
|
|
1434
1360
|
module.exports={measureAggregateArea:require("./measureAggregateArea"),measureAggregateBoundingBox:require("./measureAggregateBoundingBox"),measureAggregateEpsilon:require("./measureAggregateEpsilon"),measureAggregateVolume:require("./measureAggregateVolume"),measureArea:require("./measureArea"),measureBoundingBox:require("./measureBoundingBox"),measureEpsilon:require("./measureEpsilon"),measureVolume:require("./measureVolume")};
|
|
1435
1361
|
|
|
1436
|
-
},{"./measureAggregateArea":
|
|
1362
|
+
},{"./measureAggregateArea":344,"./measureAggregateBoundingBox":345,"./measureAggregateEpsilon":346,"./measureAggregateVolume":347,"./measureArea":348,"./measureBoundingBox":349,"./measureEpsilon":350,"./measureVolume":351}],344:[function(require,module,exports){
|
|
1437
1363
|
const flatten=require("../utils/flatten"),measureArea=require("./measureArea"),measureAggregateArea=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("measureAggregateArea: no geometries supplied");const r=measureArea(e);if(1===e.length)return r;return r.reduce((e,r)=>e+r,0)};module.exports=measureAggregateArea;
|
|
1438
1364
|
|
|
1439
|
-
},{"../utils/flatten":
|
|
1365
|
+
},{"../utils/flatten":473,"./measureArea":348}],345:[function(require,module,exports){
|
|
1440
1366
|
const flatten=require("../utils/flatten"),vec3min=require("../maths/vec3/min"),vec3max=require("../maths/vec3/max"),measureBoundingBox=require("./measureBoundingBox"),measureAggregateBoundingBox=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("measureAggregateBoundingBox: no geometries supplied");const r=measureBoundingBox(e);if(1===e.length)return r;const u=[[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],[-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]];return r.reduce((e,r)=>e=[vec3min(e[0],e[0],r[0]),vec3max(e[1],e[1],r[1])],u)};module.exports=measureAggregateBoundingBox;
|
|
1441
1367
|
|
|
1442
|
-
},{"../maths/vec3/max":
|
|
1368
|
+
},{"../maths/vec3/max":316,"../maths/vec3/min":317,"../utils/flatten":473,"./measureBoundingBox":349}],346:[function(require,module,exports){
|
|
1443
1369
|
const flatten=require("../utils/flatten"),measureAggregateBoundingBox=require("./measureAggregateBoundingBox"),calculateEpsilonFromBounds=require("./calculateEpsilonFromBounds"),{geom2:geom2,geom3:geom3,path2:path2}=require("../geometries"),measureAggregateEpsilon=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("measureAggregateEpsilon: no geometries supplied");const o=measureAggregateBoundingBox(e);let r=0;return r=e.reduce((e,o)=>path2.isA(o)||geom2.isA(o)?Math.max(e,2):geom3.isA(o)?Math.max(e,3):0,r),calculateEpsilonFromBounds(o,r)};module.exports=measureAggregateEpsilon;
|
|
1444
1370
|
|
|
1445
|
-
},{"../geometries":
|
|
1371
|
+
},{"../geometries":144,"../utils/flatten":473,"./calculateEpsilonFromBounds":342,"./measureAggregateBoundingBox":345}],347:[function(require,module,exports){
|
|
1446
1372
|
const flatten=require("../utils/flatten"),measureVolume=require("./measureVolume"),measureAggregateVolume=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("measureAggregateVolume: no geometries supplied");const r=measureVolume(e);if(1===e.length)return r;return r.reduce((e,r)=>e+r,0)};module.exports=measureAggregateVolume;
|
|
1447
1373
|
|
|
1448
|
-
},{"../utils/flatten":
|
|
1449
|
-
const flatten=require("../utils/flatten"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),measureAreaOfPath2=()=>0,measureAreaOfGeom2=e=>{
|
|
1374
|
+
},{"../utils/flatten":473,"./measureVolume":351}],348:[function(require,module,exports){
|
|
1375
|
+
const flatten=require("../utils/flatten"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),cache=new WeakMap,measureAreaOfPath2=()=>0,measureAreaOfGeom2=e=>{let r=cache.get(e);if(r)return r;return r=geom2.toSides(e).reduce((e,r)=>e+(r[0][0]*r[1][1]-r[0][1]*r[1][0]),0),r*=.5,cache.set(e,r),r},measureAreaOfGeom3=e=>{let r=cache.get(e);if(r)return r;return r=geom3.toPolygons(e).reduce((e,r)=>e+poly3.measureArea(r),0),cache.set(e,r),r},measureArea=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const r=e.map(e=>path2.isA(e)?0:geom2.isA(e)?measureAreaOfGeom2(e):geom3.isA(e)?measureAreaOfGeom3(e):0);return 1===r.length?r[0]:r};module.exports=measureArea;
|
|
1450
1376
|
|
|
1451
|
-
},{"../geometries/geom2":
|
|
1452
|
-
const flatten=require("../utils/flatten"),vec2=require("../maths/vec2"),vec3=require("../maths/vec3"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),measureBoundingBoxOfPath2=e=>{
|
|
1377
|
+
},{"../geometries/geom2":122,"../geometries/geom3":136,"../geometries/path2":157,"../geometries/poly3":173,"../utils/flatten":473}],349:[function(require,module,exports){
|
|
1378
|
+
const flatten=require("../utils/flatten"),vec2=require("../maths/vec2"),vec3=require("../maths/vec3"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),cache=new WeakMap,measureBoundingBoxOfPath2=e=>{let o=cache.get(e);if(o)return o;const t=path2.toPoints(e);let n;n=0===t.length?vec2.create():vec2.clone(t[0]);let r=vec2.clone(n);return t.forEach(e=>{vec2.min(n,n,e),vec2.max(r,r,e)}),n=[n[0],n[1],0],r=[r[0],r[1],0],o=[n,r],cache.set(e,o),o},measureBoundingBoxOfGeom2=e=>{let o=cache.get(e);if(o)return o;const t=geom2.toPoints(e);let n;n=0===t.length?vec2.create():vec2.clone(t[0]);let r=vec2.clone(n);return t.forEach(e=>{vec2.min(n,n,e),vec2.max(r,r,e)}),n=[n[0],n[1],0],r=[r[0],r[1],0],o=[n,r],cache.set(e,o),o},measureBoundingBoxOfGeom3=e=>{let o=cache.get(e);if(o)return o;const t=geom3.toPolygons(e);let n=vec3.create();if(t.length>0){const e=poly3.toPoints(t[0]);vec3.copy(n,e[0])}let r=vec3.clone(n);return t.forEach(e=>{poly3.toPoints(e).forEach(e=>{vec3.min(n,n,e),vec3.max(r,r,e)})}),n=[n[0],n[1],n[2]],r=[r[0],r[1],r[2]],o=[n,r],cache.set(e,o),o},measureBoundingBox=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const o=e.map(e=>path2.isA(e)?measureBoundingBoxOfPath2(e):geom2.isA(e)?measureBoundingBoxOfGeom2(e):geom3.isA(e)?measureBoundingBoxOfGeom3(e):[[0,0,0],[0,0,0]]);return 1===o.length?o[0]:o};module.exports=measureBoundingBox;
|
|
1453
1379
|
|
|
1454
|
-
},{"../geometries/geom2":
|
|
1455
|
-
const flatten=require("../utils/flatten"),
|
|
1380
|
+
},{"../geometries/geom2":122,"../geometries/geom3":136,"../geometries/path2":157,"../geometries/poly3":173,"../maths/vec2":282,"../maths/vec3":313,"../utils/flatten":473}],350:[function(require,module,exports){
|
|
1381
|
+
const flatten=require("../utils/flatten"),{geom2:geom2,geom3:geom3,path2:path2}=require("../geometries"),calculateEpsilonFromBounds=require("./calculateEpsilonFromBounds"),measureBoundingBox=require("./measureBoundingBox"),measureEpsilonOfPath2=e=>calculateEpsilonFromBounds(measureBoundingBox(e),2),measureEpsilonOfGeom2=e=>calculateEpsilonFromBounds(measureBoundingBox(e),2),measureEpsilonOfGeom3=e=>calculateEpsilonFromBounds(measureBoundingBox(e),3),measureEpsilon=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const o=e.map(e=>path2.isA(e)?measureEpsilonOfPath2(e):geom2.isA(e)?measureEpsilonOfGeom2(e):geom3.isA(e)?measureEpsilonOfGeom3(e):0);return 1===o.length?o[0]:o};module.exports=measureEpsilon;
|
|
1456
1382
|
|
|
1457
|
-
},{"../geometries":
|
|
1458
|
-
const flatten=require("../utils/flatten"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),measureVolumeOfPath2=()=>0,measureVolumeOfGeom2=()=>0,measureVolumeOfGeom3=e=>{
|
|
1383
|
+
},{"../geometries":144,"../utils/flatten":473,"./calculateEpsilonFromBounds":342,"./measureBoundingBox":349}],351:[function(require,module,exports){
|
|
1384
|
+
const flatten=require("../utils/flatten"),geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),poly3=require("../geometries/poly3"),cache=new WeakMap,measureVolumeOfPath2=()=>0,measureVolumeOfGeom2=()=>0,measureVolumeOfGeom3=e=>{let r=cache.get(e);if(r)return r;return r=geom3.toPolygons(e).reduce((e,r)=>e+poly3.measureSignedVolume(r),0),cache.set(e,r),r},measureVolume=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const r=e.map(e=>path2.isA(e)?0:geom2.isA(e)?0:geom3.isA(e)?measureVolumeOfGeom3(e):0);return 1===r.length?r[0]:r};module.exports=measureVolume;
|
|
1459
1385
|
|
|
1460
|
-
},{"../geometries/geom2":
|
|
1386
|
+
},{"../geometries/geom2":122,"../geometries/geom3":136,"../geometries/path2":157,"../geometries/poly3":173,"../utils/flatten":473}],352:[function(require,module,exports){
|
|
1461
1387
|
const vec2=require("../../maths/vec2"),geom2=require("../../geometries/geom2"),fromFakePolygon=(e,o)=>{if(o.vertices.length<4)return null;const r=[],n=o.vertices.filter((e,o)=>e[2]>0&&(r.push(o),!0));if(2!==n.length)throw new Error("Assertion failed: fromFakePolygon: not enough points found");const t=n.map(o=>{const r=Math.round(o[0]/e)*e+0,n=Math.round(o[1]/e)*e+0;return vec2.fromValues(r,n)});if(vec2.equals(t[0],t[1]))return null;const s=r[1]-r[0];if(1!==s&&3!==s)throw new Error("Assertion failed: fromFakePolygon: unknown index ordering");return 1===s&&t.reverse(),t},fromFakePolygons=(e,o)=>{const r=o.map(o=>fromFakePolygon(e,o)).filter(e=>null!==e);return geom2.create(r)};module.exports=fromFakePolygons;
|
|
1462
1388
|
|
|
1463
|
-
},{"../../geometries/geom2":
|
|
1389
|
+
},{"../../geometries/geom2":122,"../../maths/vec2":282}],353:[function(require,module,exports){
|
|
1464
1390
|
module.exports={intersect:require("./intersect"),scission:require("./scission"),subtract:require("./subtract"),union:require("./union")};
|
|
1465
1391
|
|
|
1466
|
-
},{"./intersect":
|
|
1392
|
+
},{"./intersect":354,"./scission":361,"./subtract":363,"./union":374}],354:[function(require,module,exports){
|
|
1467
1393
|
const flatten=require("../../utils/flatten"),areAllShapesTheSameType=require("../../utils/areAllShapesTheSameType"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),intersectGeom2=require("./intersectGeom2"),intersectGeom3=require("./intersectGeom3"),intersect=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");if(!areAllShapesTheSameType(e))throw new Error("only intersect of the types are supported");const r=e[0];return geom2.isA(r)?intersectGeom2(e):geom3.isA(r)?intersectGeom3(e):r};module.exports=intersect;
|
|
1468
1394
|
|
|
1469
|
-
},{"../../geometries/geom2":
|
|
1395
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../utils/areAllShapesTheSameType":471,"../../utils/flatten":473,"./intersectGeom2":355,"./intersectGeom3":356}],355:[function(require,module,exports){
|
|
1470
1396
|
const flatten=require("../../utils/flatten"),geom3=require("../../geometries/geom3"),measureEpsilon=require("../../measurements/measureEpsilon"),fromFakePolygons=require("./fromFakePolygons"),to3DWalls=require("./to3DWalls"),intersectGeom3=require("./intersectGeom3"),intersect=(...e)=>{const o=(e=flatten(e)).map(e=>to3DWalls({z0:-1,z1:1},e)),r=intersectGeom3(o),t=measureEpsilon(r);return fromFakePolygons(t,geom3.toPolygons(r))};module.exports=intersect;
|
|
1471
1397
|
|
|
1472
|
-
},{"../../geometries/geom3":
|
|
1398
|
+
},{"../../geometries/geom3":136,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"./fromFakePolygons":352,"./intersectGeom3":356,"./to3DWalls":367}],356:[function(require,module,exports){
|
|
1473
1399
|
const flatten=require("../../utils/flatten"),retessellate=require("./retessellate"),intersectSub=require("./intersectGeom3Sub"),intersect=(...e)=>{let t=(e=flatten(e)).shift();return e.forEach(e=>{t=intersectSub(t,e)}),t=retessellate(t)};module.exports=intersect;
|
|
1474
1400
|
|
|
1475
|
-
},{"../../utils/flatten":
|
|
1401
|
+
},{"../../utils/flatten":473,"./intersectGeom3Sub":357,"./retessellate":360}],357:[function(require,module,exports){
|
|
1476
1402
|
const geom3=require("../../geometries/geom3"),mayOverlap=require("./mayOverlap"),{Tree:Tree}=require("./trees"),intersectGeom3Sub=(e,o)=>{if(!mayOverlap(e,o))return geom3.create();const r=new Tree(geom3.toPolygons(e)),t=new Tree(geom3.toPolygons(o));r.invert(),t.clipTo(r),t.invert(),r.clipTo(t),t.clipTo(r),r.addPolygons(t.allPolygons()),r.invert();const n=r.allPolygons();return geom3.create(n)};module.exports=intersectGeom3Sub;
|
|
1477
1403
|
|
|
1478
|
-
},{"../../geometries/geom3":
|
|
1404
|
+
},{"../../geometries/geom3":136,"./mayOverlap":358,"./trees":371}],358:[function(require,module,exports){
|
|
1479
1405
|
const{EPS:EPS}=require("../../maths/constants"),measureBoundingBox=require("../../measurements/measureBoundingBox"),mayOverlap=(e,n)=>{if(0===e.polygons.length||0===n.polygons.length)return!1;const o=measureBoundingBox(e),r=o[0],s=o[1],u=measureBoundingBox(n),a=u[0],t=u[1];return!(a[0]-s[0]>EPS)&&(!(r[0]-t[0]>EPS)&&(!(a[1]-s[1]>EPS)&&(!(r[1]-t[1]>EPS)&&(!(a[2]-s[2]>EPS)&&!(r[2]-t[2]>EPS)))))};module.exports=mayOverlap;
|
|
1480
1406
|
|
|
1481
|
-
},{"../../maths/constants":
|
|
1482
|
-
const{EPS:EPS}=require("../../maths/constants"),line2=require("../../maths/line2"),vec2=require("../../maths/vec2"),OrthoNormalBasis=require("../../maths/OrthoNormalBasis"),interpolateBetween2DPointsForY=require("../../maths/utils/interpolateBetween2DPointsForY"),{insertSorted:insertSorted,fnNumberSort:fnNumberSort}=require("../../utils"),poly3=require("../../geometries/poly3"),reTesselateCoplanarPolygons=t=>{if(t.length<2)return t;const e=[],o=t.length,n=poly3.plane(t[0]),l=new OrthoNormalBasis(n),i=[],r=[],s={},f={},p={},h=1/EPS*10;for(let e=0;e<o;e++){const o=t[e];let n=[],c=o.vertices.length,g=-1;if(c>0){let t,i;for(let r=0;r<c;r++){let s=l.to2D(o.vertices[r]);const c=Math.floor(s[1]*h);let a;c in p?a=p[c]:c+1 in p?a=p[c+1]:c-1 in p?a=p[c-1]:(a=s[1],p[c]=s[1]),s=vec2.fromValues(s[0],a),n.push(s);const u=s[1];(0===r||u<t)&&(t=u,g=r),(0===r||u>i)&&(i=u),u in f||(f[u]={}),f[u][e]=!0}t>=i?(n=[],c=0,g=-1):(t in s||(s[t]=[]),s[t].push(e))}n.reverse(),g=c-g-1,i.push(n),r.push(g)}const c=[];for(const t in f)c.push(t);c.sort(fnNumberSort);let g=[],a=[];for(let t=0;t<c.length;t++){const o=[],p=c[t],h=Number(p),u=f[p];for(let t=0;t<g.length;++t){const e=g[t],o=e.polygonindex;if(u[o]){const n=i[o],l=n.length;let r=e.leftvertexindex,s=e.rightvertexindex;for(;;){let t=r+1;if(t>=l&&(t=0),n[t][1]!==h)break;r=t}let f=s-1;if(f<0&&(f=l-1),n[f][1]===h&&(s=f),r!==e.leftvertexindex&&r===s)g.splice(t,1),--t;else{e.leftvertexindex=r,e.rightvertexindex=s,e.topleft=n[r],e.topright=n[s];let t=r+1;t>=l&&(t=0),e.bottomleft=n[t];let o=s-1;o<0&&(o=l-1),e.bottomright=n[o]}}}let m;if(t>=c.length-1)g=[],m=null;else{const e=.5*(h+(m=Number(c[t+1]))),o=s[p];for(const t in o){const n=o[t],l=i[n],s=l.length,f=r[n];let p=f;for(;;){let t=p+1;if(t>=s&&(t=0),l[t][1]!==h)break;if(t===f)break;p=t}let c=f;for(;;){let t=c-1;if(t<0&&(t=s-1),l[t][1]!==h)break;if(t===p)break;c=t}let a=p+1;a>=s&&(a=0);let u=c-1;u<0&&(u=s-1);const m={polygonindex:n,leftvertexindex:p,rightvertexindex:c,topleft:l[p],topright:l[c],bottomleft:l[a],bottomright:l[u]};insertSorted(g,m,(t,o)=>{const n=interpolateBetween2DPointsForY(t.topleft,t.bottomleft,e),l=interpolateBetween2DPointsForY(o.topleft,o.bottomleft,e);return n>l?1:n<l?-1:0})}}for(const t in g){const e=g[t];let n=interpolateBetween2DPointsForY(e.topleft,e.bottomleft,h);const l=vec2.fromValues(n,h);n=interpolateBetween2DPointsForY(e.topright,e.bottomright,h);const i=vec2.fromValues(n,h);n=interpolateBetween2DPointsForY(e.topleft,e.bottomleft,m);const r=vec2.fromValues(n,m);n=interpolateBetween2DPointsForY(e.topright,e.bottomright,m);const s=vec2.fromValues(n,m),f={topleft:l,topright:i,bottomleft:r,bottomright:s,leftline:line2.fromPoints(line2.create(),l,r),rightline:line2.fromPoints(line2.create(),s,i)};if(o.length>0){const t=o[o.length-1],e=vec2.distance(f.topleft,t.topright),n=vec2.distance(f.bottomleft,t.bottomright);e<EPS&&n<EPS&&(f.topleft=t.topleft,f.leftline=t.leftline,f.bottomleft=t.bottomleft,o.splice(o.length-1,1))}o.push(f)}if(t>0){const t={},i={};for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<a.length;e++)if(!i[e]){const o=a[e];if(vec2.distance(o.bottomleft,n.topleft)<EPS&&vec2.distance(o.bottomright,n.topright)<EPS){i[e]=!0;const l=line2.direction(n.leftline),r=line2.direction(o.leftline),s=l[0]-r[0],f=line2.direction(n.rightline),p=line2.direction(o.rightline),h=f[0]-p[0],c=Math.abs(s)<EPS,g=Math.abs(h)<EPS,a=g||h>=0;(c||s>=0)&&a&&(n.outpolygon=o.outpolygon,n.leftlinecontinues=c,n.rightlinecontinues=g,t[e]=!0);break}}}for(let o=0;o<a.length;o++)if(!t[o]){const t=a[o];t.outpolygon.rightpoints.push(t.bottomright),vec2.distance(t.bottomright,t.bottomleft)>EPS&&t.outpolygon.leftpoints.push(t.bottomleft),t.outpolygon.leftpoints.reverse();const i=t.outpolygon.rightpoints.concat(t.outpolygon.leftpoints).map(t=>l.to3D(t)),r=poly3.fromPointsAndPlane(i,n);e.push(r)}}for(let t=0;t<o.length;t++){const e=o[t];e.outpolygon?(e.leftlinecontinues||e.outpolygon.leftpoints.push(e.topleft),e.rightlinecontinues||e.outpolygon.rightpoints.push(e.topright)):(e.outpolygon={leftpoints:[],rightpoints:[]},e.outpolygon.leftpoints.push(e.topleft),vec2.distance(e.topleft,e.topright)>EPS&&e.outpolygon.rightpoints.push(e.topright))}a=o}return e};module.exports=reTesselateCoplanarPolygons;
|
|
1407
|
+
},{"../../maths/constants":187,"../../measurements/measureBoundingBox":349}],359:[function(require,module,exports){
|
|
1408
|
+
const{EPS:EPS}=require("../../maths/constants"),line2=require("../../maths/line2"),vec2=require("../../maths/vec2"),OrthoNormalBasis=require("../../maths/OrthoNormalBasis"),interpolateBetween2DPointsForY=require("../../maths/utils/interpolateBetween2DPointsForY"),{insertSorted:insertSorted,fnNumberSort:fnNumberSort}=require("../../utils"),poly3=require("../../geometries/poly3"),reTesselateCoplanarPolygons=t=>{if(t.length<2)return t;const e=[],o=t.length,n=poly3.plane(t[0]),l=new OrthoNormalBasis(n),i=[],r=[],s={},f={},p={},h=1/EPS*10;for(let e=0;e<o;e++){const o=t[e];let n=[],c=o.vertices.length,g=-1;if(c>0){let t,i;for(let r=0;r<c;r++){let s=l.to2D(o.vertices[r]);const c=Math.floor(s[1]*h);let a;c in p?a=p[c]:c+1 in p?a=p[c+1]:c-1 in p?a=p[c-1]:(a=s[1],p[c]=s[1]),s=vec2.fromValues(s[0],a),n.push(s);const u=s[1];(0===r||u<t)&&(t=u,g=r),(0===r||u>i)&&(i=u),u in f||(f[u]={}),f[u][e]=!0}t>=i?(n=[],c=0,g=-1):(t in s||(s[t]=[]),s[t].push(e))}n.reverse(),g=c-g-1,i.push(n),r.push(g)}const c=[];for(const t in f)c.push(t);c.sort(fnNumberSort);let g=[],a=[];for(let t=0;t<c.length;t++){const o=[],p=c[t],h=Number(p),u=f[p];for(let t=0;t<g.length;++t){const e=g[t],o=e.polygonindex;if(u[o]){const n=i[o],l=n.length;let r=e.leftvertexindex,s=e.rightvertexindex;for(;;){let t=r+1;if(t>=l&&(t=0),n[t][1]!==h)break;r=t}let f=s-1;if(f<0&&(f=l-1),n[f][1]===h&&(s=f),r!==e.leftvertexindex&&r===s)g.splice(t,1),--t;else{e.leftvertexindex=r,e.rightvertexindex=s,e.topleft=n[r],e.topright=n[s];let t=r+1;t>=l&&(t=0),e.bottomleft=n[t];let o=s-1;o<0&&(o=l-1),e.bottomright=n[o]}}}let m;if(t>=c.length-1)g=[],m=null;else{const e=.5*(h+(m=Number(c[t+1]))),o=s[p];for(const t in o){const n=o[t],l=i[n],s=l.length,f=r[n];let p=f;for(;;){let t=p+1;if(t>=s&&(t=0),l[t][1]!==h)break;if(t===f)break;p=t}let c=f;for(;;){let t=c-1;if(t<0&&(t=s-1),l[t][1]!==h)break;if(t===p)break;c=t}let a=p+1;a>=s&&(a=0);let u=c-1;u<0&&(u=s-1);const m={polygonindex:n,leftvertexindex:p,rightvertexindex:c,topleft:l[p],topright:l[c],bottomleft:l[a],bottomright:l[u]};insertSorted(g,m,(t,o)=>{const n=interpolateBetween2DPointsForY(t.topleft,t.bottomleft,e),l=interpolateBetween2DPointsForY(o.topleft,o.bottomleft,e);return n>l?1:n<l?-1:0})}}for(const t in g){const e=g[t];let n=interpolateBetween2DPointsForY(e.topleft,e.bottomleft,h);const l=vec2.fromValues(n,h);n=interpolateBetween2DPointsForY(e.topright,e.bottomright,h);const i=vec2.fromValues(n,h);n=interpolateBetween2DPointsForY(e.topleft,e.bottomleft,m);const r=vec2.fromValues(n,m);n=interpolateBetween2DPointsForY(e.topright,e.bottomright,m);const s=vec2.fromValues(n,m),f={topleft:l,topright:i,bottomleft:r,bottomright:s,leftline:line2.fromPoints(line2.create(),l,r),rightline:line2.fromPoints(line2.create(),s,i)};if(o.length>0){const t=o[o.length-1],e=vec2.distance(f.topleft,t.topright),n=vec2.distance(f.bottomleft,t.bottomright);e<EPS&&n<EPS&&(f.topleft=t.topleft,f.leftline=t.leftline,f.bottomleft=t.bottomleft,o.splice(o.length-1,1))}o.push(f)}if(t>0){const t={},i={};for(let e=0;e<o.length;e++){const n=o[e];for(let e=0;e<a.length;e++)if(!i[e]){const o=a[e];if(vec2.distance(o.bottomleft,n.topleft)<EPS&&vec2.distance(o.bottomright,n.topright)<EPS){i[e]=!0;const l=line2.direction(n.leftline),r=line2.direction(o.leftline),s=l[0]-r[0],f=line2.direction(n.rightline),p=line2.direction(o.rightline),h=f[0]-p[0],c=Math.abs(s)<EPS,g=Math.abs(h)<EPS,a=g||h>=0;(c||s>=0)&&a&&(n.outpolygon=o.outpolygon,n.leftlinecontinues=c,n.rightlinecontinues=g,t[e]=!0);break}}}for(let o=0;o<a.length;o++)if(!t[o]){const t=a[o];t.outpolygon.rightpoints.push(t.bottomright),vec2.distance(t.bottomright,t.bottomleft)>EPS&&t.outpolygon.leftpoints.push(t.bottomleft),t.outpolygon.leftpoints.reverse();const i=t.outpolygon.rightpoints.concat(t.outpolygon.leftpoints).map(t=>l.to3D(t)),r=poly3.fromPointsAndPlane(i,n);r.vertices.length&&e.push(r)}}for(let t=0;t<o.length;t++){const e=o[t];e.outpolygon?(e.leftlinecontinues||e.outpolygon.leftpoints.push(e.topleft),e.rightlinecontinues||e.outpolygon.rightpoints.push(e.topright)):(e.outpolygon={leftpoints:[],rightpoints:[]},e.outpolygon.leftpoints.push(e.topleft),vec2.distance(e.topleft,e.topright)>EPS&&e.outpolygon.rightpoints.push(e.topright))}a=o}return e};module.exports=reTesselateCoplanarPolygons;
|
|
1483
1409
|
|
|
1484
|
-
},{"../../geometries/poly3":
|
|
1410
|
+
},{"../../geometries/poly3":173,"../../maths/OrthoNormalBasis":186,"../../maths/constants":187,"../../maths/line2":198,"../../maths/utils/interpolateBetween2DPointsForY":262,"../../maths/vec2":282,"../../utils":475}],360:[function(require,module,exports){
|
|
1485
1411
|
const geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),reTesselateCoplanarPolygons=require("./reTesselateCoplanarPolygons"),NEPS=1e-13,aboutEqualNormals=(e,o)=>Math.abs(e[0]-o[0])<=NEPS&&Math.abs(e[1]-o[1])<=NEPS&&Math.abs(e[2]-o[2])<=NEPS,coplanar=(e,o)=>Math.abs(e[3]-o[3])<1.5e-7&&aboutEqualNormals(e,o),retessellate=e=>{if(e.isRetesselated)return e;const o=geom3.toPolygons(e),a=[];o.forEach(e=>{const o=a.find(o=>coplanar(o[0],poly3.plane(e)));if(o){o[1].push(e)}else a.push([poly3.plane(e),[e]])});let s=[];a.forEach(e=>{const o=e[1],a=reTesselateCoplanarPolygons(o);s=s.concat(a)});const l=geom3.create(s);return l.isRetesselated=!0,l};module.exports=retessellate;
|
|
1486
1412
|
|
|
1487
|
-
},{"../../geometries/geom3":
|
|
1413
|
+
},{"../../geometries/geom3":136,"../../geometries/poly3":173,"./reTesselateCoplanarPolygons":359}],361:[function(require,module,exports){
|
|
1488
1414
|
const flatten=require("../../utils/flatten"),geom3=require("../../geometries/geom3"),scissionGeom3=require("./scissionGeom3"),scission=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const s=e.map(e=>geom3.isA(e)?scissionGeom3(e):e);return 1===s.length?s[0]:s};module.exports=scission;
|
|
1489
1415
|
|
|
1490
|
-
},{"../../geometries/geom3":
|
|
1416
|
+
},{"../../geometries/geom3":136,"../../utils/flatten":473,"./scissionGeom3":362}],362:[function(require,module,exports){
|
|
1491
1417
|
const vec3=require("../../maths/vec3"),measureEpsilon=require("../../measurements/measureEpsilon"),geom3=require("../../geometries/geom3"),sortNb=e=>e.sort((e,s)=>e-s).filter((e,s,o)=>!s||e!==o[s-1]),insertMapping=(e,s,o)=>{const t=`${s}`,n=e.get(t);void 0===n?e.set(t,[o]):n.push(o)},findMapping=(e,s)=>{const o=`${s}`;return e.get(o)},scissionGeom3=e=>{const s=measureEpsilon(e),o=geom3.toPolygons(e),t=o.length,n=new Map,r=vec3.create();o.forEach((e,o)=>{e.vertices.forEach(e=>{insertMapping(n,vec3.snap(r,e,s),o)})});const c=o.map(e=>{let o=[];return e.vertices.forEach(e=>{o=o.concat(findMapping(n,vec3.snap(r,e,s)))}),{e:1,d:sortNb(o)}});n.clear();let i=0;const a=c.length;for(let e=0;e<a;e++){const s=c[e];if(s.e>0){const o=new Array(t);o[e]=!0;do{i=0,o.forEach((e,s)=>{const t=c[s];if(t.e>0){t.e=-1;for(let e=0;e<t.d.length;e++)o[t.d[e]]=!0;i++}})}while(i>0);s.indexes=o}}const p=[];for(let e=0;e<a;e++)if(c[e].indexes){const s=[];c[e].indexes.forEach((e,t)=>s.push(o[t])),p.push(geom3.create(s))}return p};module.exports=scissionGeom3;
|
|
1492
1418
|
|
|
1493
|
-
},{"../../geometries/geom3":
|
|
1419
|
+
},{"../../geometries/geom3":136,"../../maths/vec3":313,"../../measurements/measureEpsilon":350}],363:[function(require,module,exports){
|
|
1494
1420
|
const flatten=require("../../utils/flatten"),areAllShapesTheSameType=require("../../utils/areAllShapesTheSameType"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),subtractGeom2=require("./subtractGeom2"),subtractGeom3=require("./subtractGeom3"),subtract=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");if(!areAllShapesTheSameType(e))throw new Error("only subtract of the types are supported");const r=e[0];return geom2.isA(r)?subtractGeom2(e):geom3.isA(r)?subtractGeom3(e):r};module.exports=subtract;
|
|
1495
1421
|
|
|
1496
|
-
},{"../../geometries/geom2":
|
|
1422
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../utils/areAllShapesTheSameType":471,"../../utils/flatten":473,"./subtractGeom2":364,"./subtractGeom3":365}],364:[function(require,module,exports){
|
|
1497
1423
|
const flatten=require("../../utils/flatten"),geom3=require("../../geometries/geom3"),measureEpsilon=require("../../measurements/measureEpsilon"),fromFakePolygons=require("./fromFakePolygons"),to3DWalls=require("./to3DWalls"),subtractGeom3=require("./subtractGeom3"),subtract=(...e)=>{const o=(e=flatten(e)).map(e=>to3DWalls({z0:-1,z1:1},e)),r=subtractGeom3(o),t=measureEpsilon(r);return fromFakePolygons(t,geom3.toPolygons(r))};module.exports=subtract;
|
|
1498
1424
|
|
|
1499
|
-
},{"../../geometries/geom3":
|
|
1425
|
+
},{"../../geometries/geom3":136,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"./fromFakePolygons":352,"./subtractGeom3":365,"./to3DWalls":367}],365:[function(require,module,exports){
|
|
1500
1426
|
const flatten=require("../../utils/flatten"),retessellate=require("./retessellate"),subtractSub=require("./subtractGeom3Sub"),subtract=(...t)=>{let e=(t=flatten(t)).shift();return t.forEach(t=>{e=subtractSub(e,t)}),e=retessellate(e)};module.exports=subtract;
|
|
1501
1427
|
|
|
1502
|
-
},{"../../utils/flatten":
|
|
1428
|
+
},{"../../utils/flatten":473,"./retessellate":360,"./subtractGeom3Sub":366}],366:[function(require,module,exports){
|
|
1503
1429
|
const geom3=require("../../geometries/geom3"),mayOverlap=require("./mayOverlap"),{Tree:Tree}=require("./trees"),subtractGeom3Sub=(e,o)=>{if(!mayOverlap(e,o))return geom3.clone(e);const r=new Tree(geom3.toPolygons(e)),t=new Tree(geom3.toPolygons(o));r.invert(),r.clipTo(t),t.clipTo(r,!0),r.addPolygons(t.allPolygons()),r.invert();const l=r.allPolygons();return geom3.create(l)};module.exports=subtractGeom3Sub;
|
|
1504
1430
|
|
|
1505
|
-
},{"../../geometries/geom3":
|
|
1431
|
+
},{"../../geometries/geom3":136,"./mayOverlap":358,"./trees":371}],367:[function(require,module,exports){
|
|
1506
1432
|
const vec3=require("../../maths/vec3"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),to3DWall=(e,o,r)=>{const c=[vec3.fromVec2(vec3.create(),r[0],e),vec3.fromVec2(vec3.create(),r[1],e),vec3.fromVec2(vec3.create(),r[1],o),vec3.fromVec2(vec3.create(),r[0],o)];return poly3.fromPoints(c)},to3DWalls=(e,o)=>{const r=geom2.toSides(o).map(o=>to3DWall(e.z0,e.z1,o));return geom3.create(r)};module.exports=to3DWalls;
|
|
1507
1433
|
|
|
1508
|
-
},{"../../geometries/geom2":
|
|
1509
|
-
const plane=require("../../../maths/plane"),poly3=require("../../../geometries/poly3");class Node{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygontreenodes=[],this.parent=e}invert(){const e=[this];let o;for(let n=0;n<e.length;n++){(o=e[n]).plane&&(o.plane=plane.flip(plane.create(),o.plane)),o.front&&e.push(o.front),o.back&&e.push(o.back);const t=o.front;o.front=o.back,o.back=t}}clipPolygons(e,o){let n,t={node:this,polygontreenodes:e};const l=[];do{if(n=t.node,e=t.polygontreenodes,n.plane){const t=[],s=[],p=o?t:s,r=n.plane,a=e.length;for(let o=0;o<a;o++){const n=e[o];n.isRemoved()||n.splitByPlane(r,p,t,s,t)}n.front&&s.length>0&&l.push({node:n.front,polygontreenodes:s});const
|
|
1434
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/poly3":173,"../../maths/vec3":313}],368:[function(require,module,exports){
|
|
1435
|
+
const plane=require("../../../maths/plane"),poly3=require("../../../geometries/poly3");class Node{constructor(e){this.plane=null,this.front=null,this.back=null,this.polygontreenodes=[],this.parent=e}invert(){const e=[this];let o;for(let n=0;n<e.length;n++){(o=e[n]).plane&&(o.plane=plane.flip(plane.create(),o.plane)),o.front&&e.push(o.front),o.back&&e.push(o.back);const t=o.front;o.front=o.back,o.back=t}}clipPolygons(e,o){let n,t={node:this,polygontreenodes:e};const l=[];do{if(n=t.node,e=t.polygontreenodes,n.plane){const t=[],s=[],p=o?t:s,r=n.plane,a=e.length;for(let o=0;o<a;o++){const n=e[o];n.isRemoved()||n.splitByPlane(r,p,t,s,t)}n.front&&s.length>0&&l.push({node:n.front,polygontreenodes:s});const h=t.length;if(n.back&&h>0)l.push({node:n.back,polygontreenodes:t});else for(let e=0;e<h;e++)t[e].remove()}t=l.pop()}while(void 0!==t)}clipTo(e,o){let n=this;const t=[];do{n.polygontreenodes.length>0&&e.rootnode.clipPolygons(n.polygontreenodes,o),n.front&&t.push(n.front),n.back&&t.push(n.back),n=t.pop()}while(void 0!==n)}addPolygonTreeNodes(e){let o={node:this,polygontreenodes:e};const n=[];do{const e=o.node,t=o.polygontreenodes;if(0===t.length){o=n.pop();continue}if(!e.plane){let o=0;const n=t[o=Math.floor(t.length/2)].getPolygon();e.plane=poly3.plane(n)}const l=[],s=[],p=t.length;for(let o=0;o<p;++o)t[o].splitByPlane(e.plane,e.polygontreenodes,s,l,s);if(l.length>0){e.front||(e.front=new Node(e)),p===l.length&&0===s.length?e.front.polygontreenodes=l:n.push({node:e.front,polygontreenodes:l})}if(s.length>0){e.back||(e.back=new Node(e)),p===s.length&&0===l.length?e.back.polygontreenodes=s:n.push({node:e.back,polygontreenodes:s})}o=n.pop()}while(void 0!==o)}getParentPlaneNormals(e,o){o>0&&this.parent&&(e.push(this.parent.plane.normal),this.parent.getParentPlaneNormals(e,o-1))}}module.exports=Node;
|
|
1510
1436
|
|
|
1511
|
-
},{"../../../geometries/poly3":
|
|
1437
|
+
},{"../../../geometries/poly3":173,"../../../maths/plane":255}],369:[function(require,module,exports){
|
|
1512
1438
|
const{EPS:EPS}=require("../../../maths/constants"),vec3=require("../../../maths/vec3"),poly3=require("../../../geometries/poly3"),splitPolygonByPlane=require("./splitPolygonByPlane");class PolygonTreeNode{constructor(){this.parent=null,this.children=[],this.polygon=null,this.removed=!1}addPolygons(e){if(!this.isRootNode())throw new Error("Assertion failed");const t=this;e.forEach(e=>{t.addChild(e)})}remove(){if(!this.removed){this.removed=!0;const e=this.parent.children,t=e.indexOf(this);if(t<0)throw new Error("Assertion failed");e.splice(t,1),this.parent.recursivelyInvalidatePolygon()}}isRemoved(){return this.removed}isRootNode(){return!this.parent}invert(){if(!this.isRootNode())throw new Error("Assertion failed");this.invertSub()}getPolygon(){if(!this.polygon)throw new Error("Assertion failed");return this.polygon}getPolygons(e){let t=[this];const o=[t];let n,l,s,r;for(n=0;n<o.length;++n)for(l=0,s=(t=o[n]).length;l<s;l++)(r=t[l]).polygon?e.push(r.polygon):r.children.length>0&&o.push(r.children)}splitByPlane(e,t,o,n,l){if(this.children.length){const s=[this.children];let r,i,h,p,c;for(r=0;r<s.length;r++)for(c=s[r],i=0,h=c.length;i<h;i++)(p=c[i]).children.length>0?s.push(p.children):p._splitByPlane(e,t,o,n,l)}else this._splitByPlane(e,t,o,n,l)}_splitByPlane(e,t,o,n,l){const s=this.polygon;if(s){const r=poly3.measureBoundingSphere(s),i=r[1]+EPS,h=r[0],p=vec3.dot(e,h)-e[3];if(p>i)n.push(this);else if(p<-i)l.push(this);else{const r=splitPolygonByPlane(e,s);switch(r.type){case 0:t.push(this);break;case 1:o.push(this);break;case 2:n.push(this);break;case 3:l.push(this);break;case 4:if(r.front){const e=this.addChild(r.front);n.push(e)}if(r.back){const e=this.addChild(r.back);l.push(e)}}}}}addChild(e){const t=new PolygonTreeNode;return t.parent=this,t.polygon=e,this.children.push(t),t}invertSub(){let e=[this];const t=[e];let o,n,l,s;for(o=0;o<t.length;o++)for(n=0,l=(e=t[o]).length;n<l;n++)(s=e[n]).polygon&&(s.polygon=poly3.invert(s.polygon)),s.children.length>0&&t.push(s.children)}recursivelyInvalidatePolygon(){let e=this;for(;e.polygon;)e.polygon=null,e.parent&&(e=e.parent)}clear(){let e=[this];const t=[e];for(let o=0;o<t.length;++o){const n=(e=t[o]).length;for(let o=0;o<n;o++){const n=e[o];n.polygon&&(n.polygon=null),n.parent&&(n.parent=null),n.children.length>0&&t.push(n.children),n.children=[]}}}toString(){let e="",t=[this];const o=[t];let n,l,s,r;for(n=0;n<o.length;++n){t=o[n];const i=" ".repeat(n);for(l=0,s=t.length;l<s;l++)e+=`${i}PolygonTreeNode (${(r=t[l]).isRootNode()}): ${r.children.length}`,r.polygon?e+=`\n ${i}poly3\n`:e+="\n",r.children.length>0&&o.push(r.children)}return e}}module.exports=PolygonTreeNode;
|
|
1513
1439
|
|
|
1514
|
-
},{"../../../geometries/poly3":
|
|
1440
|
+
},{"../../../geometries/poly3":173,"../../../maths/constants":187,"../../../maths/vec3":313,"./splitPolygonByPlane":373}],370:[function(require,module,exports){
|
|
1515
1441
|
const Node=require("./Node"),PolygonTreeNode=require("./PolygonTreeNode");class Tree{constructor(o){this.polygonTree=new PolygonTreeNode,this.rootnode=new Node(null),o&&this.addPolygons(o)}invert(){this.polygonTree.invert(),this.rootnode.invert()}clipTo(o,e){e=!!e,this.rootnode.clipTo(o,e)}allPolygons(){const o=[];return this.polygonTree.getPolygons(o),o}addPolygons(o){const e=new Array(o.length);for(let r=0;r<o.length;r++)e[r]=this.polygonTree.addChild(o[r]);this.rootnode.addPolygonTreeNodes(e)}clear(){this.polygonTree.clear()}toString(){return"Tree: "+this.polygonTree.toString("")}}module.exports=Tree;
|
|
1516
1442
|
|
|
1517
|
-
},{"./Node":
|
|
1443
|
+
},{"./Node":368,"./PolygonTreeNode":369}],371:[function(require,module,exports){
|
|
1518
1444
|
module.exports={Tree:require("./Tree")};
|
|
1519
1445
|
|
|
1520
|
-
},{"./Tree":
|
|
1446
|
+
},{"./Tree":370}],372:[function(require,module,exports){
|
|
1521
1447
|
const vec3=require("../../../maths/vec3"),splitLineSegmentByPlane=(e,t,c)=>{const n=vec3.subtract(vec3.create(),c,t);let s=(e[3]-vec3.dot(e,t))/vec3.dot(e,n);return Number.isNaN(s)&&(s=0),s>1&&(s=1),s<0&&(s=0),vec3.scale(n,n,s),vec3.add(n,t,n),n};module.exports=splitLineSegmentByPlane;
|
|
1522
1448
|
|
|
1523
|
-
},{"../../../maths/vec3":
|
|
1449
|
+
},{"../../../maths/vec3":313}],373:[function(require,module,exports){
|
|
1524
1450
|
const{EPS:EPS}=require("../../../maths/constants"),plane=require("../../../maths/plane"),vec3=require("../../../maths/vec3"),poly3=require("../../../geometries/poly3"),splitLineSegmentByPlane=require("./splitLineSegmentByPlane"),splitPolygonByPlane=(e,t)=>{const l={type:null,front:null,back:null},n=t.vertices,s=n.length,o=poly3.plane(t);if(plane.equals(o,e))l.type=0;else{let t=!1,p=!1;const i=[],c=-EPS;for(let l=0;l<s;l++){const s=vec3.dot(e,n[l])-e[3],o=s<0;i.push(o),s>EPS&&(t=!0),s<c&&(p=!0)}if(t||p)if(p)if(t){l.type=4;const t=[],p=[];let c=i[0];for(let l=0;l<s;l++){const o=n[l];let r=l+1;r>=s&&(r=0);const a=i[r];if(c===a)c?p.push(o):t.push(o);else{const l=o,s=n[r],i=splitLineSegmentByPlane(e,l,s);c?(p.push(o),p.push(i),t.push(i)):(t.push(o),t.push(i),p.push(i))}c=a}const r=EPS*EPS;if(p.length>=3){let e=p[p.length-1];for(let t=0;t<p.length;t++){const l=p[t];vec3.squaredDistance(l,e)<r&&(p.splice(t,1),t--),e=l}}if(t.length>=3){let e=t[t.length-1];for(let l=0;l<t.length;l++){const n=t[l];vec3.squaredDistance(n,e)<r&&(t.splice(l,1),l--),e=n}}t.length>=3&&(l.front=poly3.fromPointsAndPlane(t,o)),p.length>=3&&(l.back=poly3.fromPointsAndPlane(p,o))}else l.type=3;else l.type=2;else{const t=vec3.dot(e,o);l.type=t>=0?0:1}}return l};module.exports=splitPolygonByPlane;
|
|
1525
1451
|
|
|
1526
|
-
},{"../../../geometries/poly3":
|
|
1452
|
+
},{"../../../geometries/poly3":173,"../../../maths/constants":187,"../../../maths/plane":255,"../../../maths/vec3":313,"./splitLineSegmentByPlane":372}],374:[function(require,module,exports){
|
|
1527
1453
|
const flatten=require("../../utils/flatten"),areAllShapesTheSameType=require("../../utils/areAllShapesTheSameType"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),unionGeom2=require("./unionGeom2"),unionGeom3=require("./unionGeom3"),union=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");if(!areAllShapesTheSameType(e))throw new Error("only unions of the same type are supported");const o=e[0];return geom2.isA(o)?unionGeom2(e):geom3.isA(o)?unionGeom3(e):o};module.exports=union;
|
|
1528
1454
|
|
|
1529
|
-
},{"../../geometries/geom2":
|
|
1455
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../utils/areAllShapesTheSameType":471,"../../utils/flatten":473,"./unionGeom2":375,"./unionGeom3":376}],375:[function(require,module,exports){
|
|
1530
1456
|
const flatten=require("../../utils/flatten"),geom3=require("../../geometries/geom3"),measureEpsilon=require("../../measurements/measureEpsilon"),fromFakePolygons=require("./fromFakePolygons"),to3DWalls=require("./to3DWalls"),unionGeom3=require("./unionGeom3"),union=(...e)=>{const o=(e=flatten(e)).map(e=>to3DWalls({z0:-1,z1:1},e)),n=unionGeom3(o),r=measureEpsilon(n);return fromFakePolygons(r,geom3.toPolygons(n))};module.exports=union;
|
|
1531
1457
|
|
|
1532
|
-
},{"../../geometries/geom3":
|
|
1458
|
+
},{"../../geometries/geom3":136,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"./fromFakePolygons":352,"./to3DWalls":367,"./unionGeom3":376}],376:[function(require,module,exports){
|
|
1533
1459
|
const flatten=require("../../utils/flatten"),retessellate=require("./retessellate"),unionSub=require("./unionGeom3Sub"),union=(...e)=>{let t;for(e=flatten(e),t=1;t<e.length;t+=2)e.push(unionSub(e[t-1],e[t]));let n=e[t-1];return n=retessellate(n)};module.exports=union;
|
|
1534
1460
|
|
|
1535
|
-
},{"../../utils/flatten":
|
|
1461
|
+
},{"../../utils/flatten":473,"./retessellate":360,"./unionGeom3Sub":377}],377:[function(require,module,exports){
|
|
1536
1462
|
const geom3=require("../../geometries/geom3"),mayOverlap=require("./mayOverlap"),{Tree:Tree}=require("./trees"),unionSub=(e,o)=>{if(!mayOverlap(e,o))return unionForNonIntersecting(e,o);const n=new Tree(geom3.toPolygons(e)),r=new Tree(geom3.toPolygons(o));n.clipTo(r,!1),r.clipTo(n),r.invert(),r.clipTo(n),r.invert();const t=n.allPolygons().concat(r.allPolygons());return geom3.create(t)},unionForNonIntersecting=(e,o)=>{let n=geom3.toPolygons(e);return n=n.concat(geom3.toPolygons(o)),geom3.create(n)};module.exports=unionSub;
|
|
1537
1463
|
|
|
1538
|
-
},{"../../geometries/geom3":
|
|
1464
|
+
},{"../../geometries/geom3":136,"./mayOverlap":358,"./trees":371}],378:[function(require,module,exports){
|
|
1539
1465
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),expandGeom2=require("./expandGeom2"),expandGeom3=require("./expandGeom3"),expandPath2=require("./expandPath2"),expand=(e,...r)=>{if(0===(r=flatten(r)).length)throw new Error("wrong number of arguments");const t=r.map(r=>path2.isA(r)?expandPath2(e,r):geom2.isA(r)?expandGeom2(e,r):geom3.isA(r)?expandGeom3(e,r):r);return 1===t.length?t[0]:t};module.exports=expand;
|
|
1540
1466
|
|
|
1541
|
-
},{"../../geometries/geom2":
|
|
1467
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../utils/flatten":473,"./expandGeom2":379,"./expandGeom3":380,"./expandPath2":381}],379:[function(require,module,exports){
|
|
1542
1468
|
const geom2=require("../../geometries/geom2"),offsetFromPoints=require("./offsetFromPoints"),expandGeom2=(e,o)=>{const{delta:r,corners:s,segments:t}=Object.assign({},{delta:1,corners:"edge",segments:16},e);if("edge"!==s&&"chamfer"!==s&&"round"!==s)throw new Error('corners must be "edge", "chamfer", or "round"');const n=geom2.toOutlines(o).map(o=>offsetFromPoints(e={delta:r,corners:s,closed:!0,segments:t},o)).reduce((e,o)=>e.concat(geom2.toSides(geom2.fromPoints(o))),[]);return geom2.create(n)};module.exports=expandGeom2;
|
|
1543
1469
|
|
|
1544
|
-
},{"../../geometries/geom2":
|
|
1470
|
+
},{"../../geometries/geom2":122,"./offsetFromPoints":386}],380:[function(require,module,exports){
|
|
1545
1471
|
const geom3=require("../../geometries/geom3"),union=require("../booleans/union"),expandShell=require("./expandShell"),expandGeom3=(e,n)=>{const{delta:o,corners:r,segments:t}=Object.assign({},{delta:1,corners:"round",segments:12},e);if("round"!==r)throw new Error('corners must be "round" for 3D geometries');if(0===geom3.toPolygons(n).length)throw new Error("the given geometry cannot be empty");const s=expandShell(e={delta:o,corners:r,segments:t},n);return union(n,s)};module.exports=expandGeom3;
|
|
1546
1472
|
|
|
1547
|
-
},{"../../geometries/geom3":
|
|
1473
|
+
},{"../../geometries/geom3":136,"../booleans/union":374,"./expandShell":382}],381:[function(require,module,exports){
|
|
1548
1474
|
const area=require("../../maths/utils/area"),vec2=require("../../maths/vec2"),geom2=require("../../geometries/geom2"),path2=require("../../geometries/path2"),offsetFromPoints=require("./offsetFromPoints"),createGeometryFromClosedOffsets=e=>{let{external:t,internal:r}=e;area(t)<0?t=t.reverse():r=r.reverse();const o=path2.fromPoints({closed:!0},t),s=path2.fromPoints({closed:!0},r),n=geom2.toSides(geom2.fromPoints(path2.toPoints(o))),a=geom2.toSides(geom2.fromPoints(path2.toPoints(s)));return n.push(...a),geom2.create(n)},createGeometryFromExpandedOpenPath=(e,t,r,o)=>{const{points:s,external:n,internal:a}=e,c=Math.floor(t/2),m=[],i=[];if("round"===r&&c>0){const e=Math.PI/c,t=s[s.length-1],r=vec2.angle(vec2.subtract(vec2.create(),n[n.length-1],t)),d=s[0],l=vec2.angle(vec2.subtract(vec2.create(),a[0],d));for(let s=1;s<c;s++){let n=r+e*s,a=vec2.fromAngleRadians(vec2.create(),n);vec2.scale(a,a,o),vec2.add(a,a,t),m.push(a),n=l+e*s,a=vec2.fromAngleRadians(vec2.create(),n),vec2.scale(a,a,o),vec2.add(a,a,d),i.push(a)}}const d=[];return d.push(...n,...m,...a.reverse(),...i),geom2.fromPoints(d)},expandPath2=(e,t)=>{e=Object.assign({},{delta:1,corners:"edge",segments:16},e);const{delta:r,corners:o,segments:s}=e;if(r<=0)throw new Error("the given delta must be positive for paths");if("edge"!==o&&"chamfer"!==o&&"round"!==o)throw new Error('corners must be "edge", "chamfer", or "round"');const n=t.isClosed,a=path2.toPoints(t);if(0===a.length)throw new Error("the given geometry cannot be empty");const c={points:a,external:offsetFromPoints({delta:r,corners:o,segments:s,closed:n},a),internal:offsetFromPoints({delta:-r,corners:o,segments:s,closed:n},a)};return t.isClosed?createGeometryFromClosedOffsets(c):createGeometryFromExpandedOpenPath(c,s,o,r)};module.exports=expandPath2;
|
|
1549
1475
|
|
|
1550
|
-
},{"../../geometries/geom2":
|
|
1551
|
-
const{EPS:EPS}=require("../../maths/constants"),mat4=require("../../maths/mat4"),vec3=require("../../maths/vec3"),fnNumberSort=require("../../utils/fnNumberSort"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),sphere=require("../../primitives/sphere"),retessellate=require("../booleans/retessellate"),unionGeom3Sub=require("../booleans/unionGeom3Sub"),extrudePolygon=require("./extrudePolygon"),mapPlaneToVertex=(e,t,
|
|
1476
|
+
},{"../../geometries/geom2":122,"../../geometries/path2":157,"../../maths/utils/area":260,"../../maths/vec2":282,"./offsetFromPoints":386}],382:[function(require,module,exports){
|
|
1477
|
+
const{EPS:EPS}=require("../../maths/constants"),mat4=require("../../maths/mat4"),vec3=require("../../maths/vec3"),fnNumberSort=require("../../utils/fnNumberSort"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),sphere=require("../../primitives/sphere"),retessellate=require("../booleans/retessellate"),unionGeom3Sub=require("../booleans/unionGeom3Sub"),extrudePolygon=require("./extrudePolygon"),mapPlaneToVertex=(e,t,o)=>{const n=e.findIndex(e=>vec3.equals(e[0],t));if(n<0){const n=[t,[o]];return e.push(n),e.length}return e[n][1].push(o),n},mapPlaneToEdge=(e,t,o)=>{const n=e.findIndex(e=>vec3.equals(e[0],t[0])&&vec3.equals(e[1],t[1])||vec3.equals(e[0],t[1])&&vec3.equals(e[1],t[0]));if(n<0){const n=[t,[o]];return e.push(n),e.length}return e[n][1].push(o),n},addUniqueAngle=(e,t)=>{const o=e.findIndex(e=>e===t);return o<0?(e.push(t),e.length):o},expandShell=(e,t)=>{const{delta:o,segments:n}=Object.assign({},{delta:1,segments:12},e);let s=geom3.create();const r=[],c=[],a=vec3.create(),l=vec3.create();return geom3.toPolygons(t).forEach((e,t)=>{const n=vec3.scale(vec3.create(),poly3.plane(e),2*o),a=poly3.transform(mat4.fromTranslation(mat4.create(),vec3.scale(vec3.create(),n,-.5)),e),l=extrudePolygon(n,a);s=unionGeom3Sub(s,l);const u=e.vertices;for(let t=0;t<u.length;t++){mapPlaneToVertex(r,u[t],poly3.plane(e));const o=(t+1)%u.length,n=[u[t],u[o]];mapPlaneToEdge(c,n,poly3.plane(e))}}),c.forEach(e=>{const t=e[0],r=e[1],c=t[0],u=t[1],i=vec3.subtract(vec3.create(),u,c);vec3.normalize(i,i);const h=r[0],m=vec3.cross(vec3.create(),h,i);let v=[];for(let e=0;e<n;e++)addUniqueAngle(v,e*Math.PI*2/n);for(let e=0,t=r.length;e<t;e++){const t=r[e],o=vec3.dot(m,t),n=vec3.dot(h,t);let s=Math.atan2(o,n);s<0&&(s+=2*Math.PI),addUniqueAngle(v,s),(s=Math.atan2(-o,-n))<0&&(s+=2*Math.PI),addUniqueAngle(v,s)}const d=(v=v.sort(fnNumberSort)).length;let p,g;const f=[],q=[],P=[];for(let e=-1;e<d;e++){const t=v[e<0?e+d:e],n=Math.sin(t),s=Math.cos(t);vec3.scale(a,h,s*o),vec3.scale(l,m,n*o),vec3.add(a,a,l);const r=vec3.add(vec3.create(),c,a),i=vec3.add(vec3.create(),u,a);let y=!1;if(e>=0&&vec3.distance(r,p)<EPS&&(y=!0),!y){if(e>=0){f.push(r),q.push(i);const e=[g,i,r,p],t=poly3.fromPoints(e);P.push(t)}p=r,g=i}}q.reverse(),P.push(poly3.fromPoints(f)),P.push(poly3.fromPoints(q));const y=geom3.create(P);s=unionGeom3Sub(s,y)}),r.forEach(e=>{const t=e[0],r=e[1],c=r[0];let u=null,i=0;for(let e=1;e<r.length;e++){const t=r[e],o=vec3.cross(a,c,t),n=vec3.length(o);n>.05&&n>i&&(i=n,u=t)}u||(u=vec3.orthogonal(a,c));const h=vec3.cross(a,c,u);vec3.normalize(h,h);const m=vec3.cross(l,h,c),v=sphere({center:[t[0],t[1],t[2]],radius:o,segments:n,axes:[c,h,m]});s=unionGeom3Sub(s,v)}),retessellate(s)};module.exports=expandShell;
|
|
1552
1478
|
|
|
1553
|
-
},{"../../geometries/geom3":
|
|
1479
|
+
},{"../../geometries/geom3":136,"../../geometries/poly3":173,"../../maths/constants":187,"../../maths/mat4":237,"../../maths/vec3":313,"../../primitives/sphere":462,"../../utils/fnNumberSort":474,"../booleans/retessellate":360,"../booleans/unionGeom3Sub":377,"./extrudePolygon":383}],383:[function(require,module,exports){
|
|
1554
1480
|
const mat4=require("../../maths/mat4"),vec3=require("../../maths/vec3"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),extrudePolygon=(e,t)=>{vec3.dot(poly3.plane(t),e)>0&&(t=poly3.invert(t));const r=[t],o=poly3.transform(mat4.fromTranslation(mat4.create(),e),t),s=t.vertices.length;for(let e=0;e<s;e++){const i=[],m=e<s-1?e+1:0;i.push(t.vertices[e]),i.push(o.vertices[e]),i.push(o.vertices[m]),i.push(t.vertices[m]);const n=poly3.fromPoints(i);r.push(n)}return r.push(poly3.invert(o)),geom3.create(r)};module.exports=extrudePolygon;
|
|
1555
1481
|
|
|
1556
|
-
},{"../../geometries/geom3":
|
|
1482
|
+
},{"../../geometries/geom3":136,"../../geometries/poly3":173,"../../maths/mat4":237,"../../maths/vec3":313}],384:[function(require,module,exports){
|
|
1557
1483
|
module.exports={expand:require("./expand"),offset:require("./offset")};
|
|
1558
1484
|
|
|
1559
|
-
},{"./expand":
|
|
1485
|
+
},{"./expand":378,"./offset":385}],385:[function(require,module,exports){
|
|
1560
1486
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),path2=require("../../geometries/path2"),offsetGeom2=require("./offsetGeom2"),offsetPath2=require("./offsetPath2"),offset=(e,...t)=>{if(0===(t=flatten(t)).length)throw new Error("wrong number of arguments");const o=t.map(t=>path2.isA(t)?offsetPath2(e,t):geom2.isA(t)?offsetGeom2(e,t):t);return 1===o.length?o[0]:o};module.exports=offset;
|
|
1561
1487
|
|
|
1562
|
-
},{"../../geometries/geom2":
|
|
1488
|
+
},{"../../geometries/geom2":122,"../../geometries/path2":157,"../../utils/flatten":473,"./offsetGeom2":387,"./offsetPath2":388}],386:[function(require,module,exports){
|
|
1563
1489
|
const{EPS:EPS}=require("../../maths/constants"),intersect=require("../../maths/utils/intersect"),line2=require("../../maths/line2"),vec2=require("../../maths/vec2"),area=require("../../maths/utils/area"),offsetFromPoints=(e,s)=>{let{delta:t,corners:c,closed:n,segments:a}=Object.assign({},{delta:1,corners:"edge",closed:!1,segments:16},e);if(Math.abs(t)<EPS)return s;let l=e.closed?area(s):1;0===l&&(l=1);const r=l>0&&t>=0||l<0&&t<0;t=Math.abs(t);let i=null;const o=[],u=[],f=vec2.create(),v=s.length;for(let e=0;e<v;e++){const c=(e+1)%v,a=s[e],l=s[c];r?vec2.subtract(f,a,l):vec2.subtract(f,l,a),vec2.normal(f,f),vec2.normalize(f,f),vec2.scale(f,f,t);const h=vec2.add(vec2.create(),a,f),d=vec2.add(vec2.create(),l,f),m=[h,d];if(null!=i&&(n||!n&&0!==c)){const e=intersect(i[0],i[1],m[0],m[1]);e?(o.pop(),m[0]=e):u.push({c:a,s0:i,s1:m})}i=[h,d],(0!==c||n)&&(o.push(m[0]),o.push(m[1]))}if(n&&null!=i){const e=o[0],t=o[1],c=intersect(i[0],i[1],e,t);if(c)o[0]=c,o.pop();else{const c=s[0],n=[e,t];u.push({c:c,s0:i,s1:n})}}if("edge"===c){const e=line2.create(),s=line2.create();u.forEach(t=>{line2.fromPoints(e,t.s0[0],t.s0[1]),line2.fromPoints(s,t.s1[0],t.s1[1]);const c=line2.intersectPointOfLines(e,s);if(Number.isFinite(c[0])&&Number.isFinite(c[1])){const e=t.s0[1];let s=o.findIndex(s=>vec2.equals(e,s));s=(s+1)%o.length,o.splice(s,0,c)}else{const e=t.s1[0],s=o.findIndex(s=>vec2.equals(e,s));o.splice(s,1)}})}if("round"===c){let e=Math.floor(a/4);const s=vec2.create();u.forEach(c=>{let n=vec2.angle(vec2.subtract(s,c.s1[0],c.c));if(n-=vec2.angle(vec2.subtract(s,c.s0[1],c.c)),r&&n<0&&(n+=Math.PI)<0&&(n+=Math.PI),!r&&n>0&&(n-=Math.PI)>0&&(n-=Math.PI),0!==n){const l=n/(e=Math.floor(a*(Math.abs(n)/(2*Math.PI)))),r=vec2.angle(vec2.subtract(s,c.s0[1],c.c)),i=[];for(let s=1;s<e;s++){const e=r+l*s,n=vec2.fromAngleRadians(vec2.create(),e);vec2.scale(n,n,t),vec2.add(n,n,c.c),i.push(n)}if(i.length>0){const e=c.s0[1];let s=o.findIndex(s=>vec2.equals(e,s));s=(s+1)%o.length,o.splice(s,0,...i)}}else{const e=c.s1[0],s=o.findIndex(s=>vec2.equals(e,s));o.splice(s,1)}})}return o};module.exports=offsetFromPoints;
|
|
1564
1490
|
|
|
1565
|
-
},{"../../maths/constants":
|
|
1491
|
+
},{"../../maths/constants":187,"../../maths/line2":198,"../../maths/utils/area":260,"../../maths/utils/intersect":263,"../../maths/vec2":282}],387:[function(require,module,exports){
|
|
1566
1492
|
const geom2=require("../../geometries/geom2"),poly2=require("../../geometries/poly2"),offsetFromPoints=require("./offsetFromPoints"),offsetGeom2=(e,o)=>{const{delta:r,corners:s,segments:t}=Object.assign({},{delta:1,corners:"edge",segments:0},e);if("edge"!==s&&"chamfer"!==s&&"round"!==s)throw new Error('corners must be "edge", "chamfer", or "round"');const n=geom2.toOutlines(o),m=n.map(o=>{const m=n.reduce((e,r)=>e+poly2.arePointsInside(o,poly2.create(r)),0);return offsetFromPoints(e={delta:m%2==0?r:-r,corners:s,closed:!0,segments:t},o)}).reduce((e,o)=>e.concat(geom2.toSides(geom2.fromPoints(o))),[]);return geom2.create(m)};module.exports=offsetGeom2;
|
|
1567
1493
|
|
|
1568
|
-
},{"../../geometries/geom2":
|
|
1494
|
+
},{"../../geometries/geom2":122,"../../geometries/poly2":167,"./offsetFromPoints":386}],388:[function(require,module,exports){
|
|
1569
1495
|
const path2=require("../../geometries/path2"),offsetFromPoints=require("./offsetFromPoints"),offsetPath2=(e,o)=>{const s={delta:1,corners:"edge",closed:o.isClosed,segments:16},{delta:t,corners:r,closed:n,segments:c}=Object.assign({},s,e);if("edge"!==r&&"chamfer"!==r&&"round"!==r)throw new Error('corners must be "edge", "chamfer", or "round"');const d=offsetFromPoints(e={delta:t,corners:r,closed:n,segments:c},path2.toPoints(o));return path2.fromPoints({closed:n},d)};module.exports=offsetPath2;
|
|
1570
1496
|
|
|
1571
|
-
},{"../../geometries/path2":
|
|
1497
|
+
},{"../../geometries/path2":157,"./offsetFromPoints":386}],389:[function(require,module,exports){
|
|
1572
1498
|
const mat4=require("../../maths/mat4"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),slice=require("./slice"),extrudeWalls=require("./extrudeWalls"),defaultCallback=(e,l,r)=>{let t=null;return geom2.isA(r)&&(t=slice.fromSides(geom2.toSides(r))),poly3.isA(r)&&(t=slice.fromPoints(poly3.toPoints(r))),0===e||1===e?slice.transform(mat4.fromTranslation(mat4.create(),[0,0,e]),t):null},extrudeFromSlices=(e,l)=>{const r={numberOfSlices:2,capStart:!0,capEnd:!0,close:!1,callback:defaultCallback},{numberOfSlices:t,capStart:o,capEnd:s,close:c,callback:i}=Object.assign({},r,e);if(t<2)throw new Error("numberOfSlices must be 2 or more");const n=t-1;let a=null,u=null,m=null,f=[];for(let e=0;e<t;e++){const r=i(e/n,e,l);if(r){if(!slice.isA(r))throw new Error("the callback function must return slice objects");if(0===slice.toEdges(r).length)throw new Error("the callback function must return slices with one or more edges");m&&(f=f.concat(extrudeWalls(m,r))),0===e&&(a=r),e===t-1&&(u=r),m=r}}if(s){const e=slice.toPolygons(u);f=f.concat(e)}if(o){slice.reverse(a,a);const e=slice.toPolygons(a);f=f.concat(e)}return o||s||c&&!slice.equals(u,a)&&(f=f.concat(extrudeWalls(u,a))),geom3.create(f)};module.exports=extrudeFromSlices;
|
|
1573
1499
|
|
|
1574
|
-
},{"../../geometries/geom2":
|
|
1500
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/poly3":173,"../../maths/mat4":237,"./extrudeWalls":396,"./slice":405}],390:[function(require,module,exports){
|
|
1575
1501
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),extrudeLinearGeom2=require("./extrudeLinearGeom2"),extrudeLinear=(e,...t)=>{const{height:r,twistAngle:n,twistSteps:i}=Object.assign({},{height:1,twistAngle:0,twistSteps:1},e);if(0===(t=flatten(t)).length)throw new Error("wrong number of arguments");e={offset:[0,0,r],twistAngle:n,twistSteps:i};const s=t.map(t=>geom2.isA(t)?extrudeLinearGeom2(e,t):t);return 1===s.length?s[0]:s};module.exports=extrudeLinear;
|
|
1576
1502
|
|
|
1577
|
-
},{"../../geometries/geom2":
|
|
1503
|
+
},{"../../geometries/geom2":122,"../../utils/flatten":473,"./extrudeLinearGeom2":391}],391:[function(require,module,exports){
|
|
1578
1504
|
const mat4=require("../../maths/mat4"),vec3=require("../../maths/vec3"),geom2=require("../../geometries/geom2"),slice=require("./slice"),extrudeFromSlices=require("./extrudeFromSlices"),extrudeGeom2=(e,t)=>{let{offset:r,twistAngle:s,twistSteps:o}=Object.assign({},{offset:[0,0,1],twistAngle:0,twistSteps:12},e);if(o<1)throw new Error("twistSteps must be 1 or more");0===s&&(o=1);const c=vec3.clone(r),i=geom2.toSides(t);if(0===i.length)throw new Error("the given geometry cannot be empty");const m=slice.fromSides(i);c[2]<0&&slice.reverse(m,m);const a=mat4.create();return extrudeFromSlices(e={numberOfSlices:o+1,capStart:!0,capEnd:!0,callback:(e,t,r)=>{const i=t/o*s,m=vec3.scale(vec3.create(),c,t/o);return mat4.multiply(a,mat4.fromZRotation(a,i),mat4.fromTranslation(mat4.create(),m)),slice.transform(a,r)}},m)};module.exports=extrudeGeom2;
|
|
1579
1505
|
|
|
1580
|
-
},{"../../geometries/geom2":
|
|
1506
|
+
},{"../../geometries/geom2":122,"../../maths/mat4":237,"../../maths/vec3":313,"./extrudeFromSlices":389,"./slice":405}],392:[function(require,module,exports){
|
|
1581
1507
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),path2=require("../../geometries/path2"),extrudeRectangularPath2=require("./extrudeRectangularPath2"),extrudeRectangularGeom2=require("./extrudeRectangularGeom2"),extrudeRectangular=(e,...t)=>{const{size:r,height:a}=Object.assign({},{size:1,height:1},e);if(0===(t=flatten(t)).length)throw new Error("wrong number of arguments");if(r<=0)throw new Error("size must be positive");if(a<=0)throw new Error("height must be positive");const u=t.map(t=>path2.isA(t)?extrudeRectangularPath2(e,t):geom2.isA(t)?extrudeRectangularGeom2(e,t):t);return 1===u.length?u[0]:u};module.exports=extrudeRectangular;
|
|
1582
1508
|
|
|
1583
|
-
},{"../../geometries/geom2":
|
|
1509
|
+
},{"../../geometries/geom2":122,"../../geometries/path2":157,"../../utils/flatten":473,"./extrudeRectangularGeom2":393,"./extrudeRectangularPath2":394}],393:[function(require,module,exports){
|
|
1584
1510
|
const{area:area}=require("../../maths/utils"),geom2=require("../../geometries/geom2"),path2=require("../../geometries/path2"),expand=require("../expansions/expand"),extrudeLinearGeom2=require("./extrudeLinearGeom2"),extrudeRectangularGeom2=(e,r)=>{const{size:t,height:o}=Object.assign({},{size:1,height:1},e);e.delta=t,e.offset=[0,0,o];const a=geom2.toOutlines(r);if(0===a.length)throw new Error("the given geometry cannot be empty");const n=a.map(r=>(area(r)<0&&r.reverse(),expand(e,path2.fromPoints({closed:!0},r)))).reduce((e,r)=>e.concat(geom2.toSides(r)),[]),i=geom2.create(n);return extrudeLinearGeom2(e,i)};module.exports=extrudeRectangularGeom2;
|
|
1585
1511
|
|
|
1586
|
-
},{"../../geometries/geom2":
|
|
1512
|
+
},{"../../geometries/geom2":122,"../../geometries/path2":157,"../../maths/utils":261,"../expansions/expand":378,"./extrudeLinearGeom2":391}],394:[function(require,module,exports){
|
|
1587
1513
|
const path2=require("../../geometries/path2"),expand=require("../expansions/expand"),extrudeLinearGeom2=require("./extrudeLinearGeom2"),extrudeRectangularPath2=(e,t)=>{const{size:r,height:n}=Object.assign({},{size:1,height:1},e);if(e.delta=r,e.offset=[0,0,n],0===path2.toPoints(t).length)throw new Error("the given geometry cannot be empty");const a=expand(e,t);return extrudeLinearGeom2(e,a)};module.exports=extrudeRectangularPath2;
|
|
1588
1514
|
|
|
1589
|
-
},{"../../geometries/path2":
|
|
1515
|
+
},{"../../geometries/path2":157,"../expansions/expand":378,"./extrudeLinearGeom2":391}],395:[function(require,module,exports){
|
|
1590
1516
|
const mat4=require("../../maths/mat4"),{mirrorX:mirrorX}=require("../transforms/mirror"),geom2=require("../../geometries/geom2"),slice=require("./slice"),extrudeFromSlices=require("./extrudeFromSlices"),extrudeRotate=(e,t)=>{const r={segments:12,startAngle:0,angle:2*Math.PI,overflow:"cap"};let{segments:a,startAngle:o,angle:s,overflow:m}=Object.assign({},r,e);if(a<3)throw new Error("segments must be greater then 3");o=Math.abs(o)>2*Math.PI?o%(2*Math.PI):o,s=Math.abs(s)>2*Math.PI?s%(2*Math.PI):s;let n=o+s;if((n=Math.abs(n)>2*Math.PI?n%(2*Math.PI):n)<o){const e=o;o=n,n=e}let l=n-o;if(l<=0&&(l=2*Math.PI),Math.abs(l)<2*Math.PI){const e=2*Math.PI/a;a=Math.floor(Math.abs(l)/e),Math.abs(l)>a*e&&a++}let h=geom2.toSides(t);if(0===h.length)throw new Error("the given geometry cannot be empty");const i=h.filter(e=>e[0][0]<0),c=h.filter(e=>e[0][0]>=0);i.length>0&&c.length>0&&"cap"===m&&(i.length>c.length?(h=h.map(e=>{let t=e[0],r=e[1];return[t=[Math.min(t[0],0),t[1]],r=[Math.min(r[0],0),r[1]]]}),t=geom2.reverse(geom2.create(h)),t=mirrorX(t)):c.length>=i.length&&(h=h.map(e=>{let t=e[0],r=e[1];return[t=[Math.max(t[0],0),t[1]],r=[Math.max(r[0],0),r[1]]]}),t=geom2.create(h)));const g=l/a,M=Math.abs(l)<2*Math.PI,u=slice.fromSides(geom2.toSides(t));slice.reverse(u,u);const f=mat4.create();return extrudeFromSlices(e={numberOfSlices:a+1,capStart:M,capEnd:M,close:!M,callback:(e,t,r)=>{const a=g*t+o;return mat4.multiply(f,mat4.fromZRotation(f,a),mat4.fromXRotation(mat4.create(),Math.PI/2)),slice.transform(f,r)}},u)};module.exports=extrudeRotate;
|
|
1591
1517
|
|
|
1592
|
-
},{"../../geometries/geom2":
|
|
1518
|
+
},{"../../geometries/geom2":122,"../../maths/mat4":237,"../transforms/mirror":439,"./extrudeFromSlices":389,"./slice":405}],396:[function(require,module,exports){
|
|
1593
1519
|
const{EPS:EPS}=require("../../maths/constants"),vec3=require("../../maths/vec3"),poly3=require("../../geometries/poly3"),slice=require("./slice"),gcd=(e,t)=>e===t?e:e<t?gcd(t,e):1===t?1:0===t?e:gcd(t,e%t),lcm=(e,t)=>e*t/gcd(e,t),repartitionEdges=(e,t)=>{const r=e/t.length;if(1===r)return t;const s=vec3.fromValues(r,r,r),c=[];return t.forEach(e=>{const t=vec3.subtract(vec3.create(),e[1],e[0]);vec3.divide(t,t,s);let o=e[0];for(let e=1;e<=r;++e){const e=vec3.add(vec3.create(),o,t);c.push([o,e]),o=e}}),c},EPSAREA=EPS*EPS/2*Math.sin(Math.PI/3),extrudeWalls=(e,t)=>{let r=slice.toEdges(e),s=slice.toEdges(t);if(r.length!==s.length){const e=lcm(r.length,s.length);e!==r.length&&(r=repartitionEdges(e,r)),e!==s.length&&(s=repartitionEdges(e,s))}const c=[];return r.forEach((e,t)=>{const r=s[t],o=poly3.fromPoints([e[0],e[1],r[1]]),n=poly3.measureArea(o);Number.isFinite(n)&&n>EPSAREA&&c.push(o);const i=poly3.fromPoints([e[0],r[1],r[0]]),l=poly3.measureArea(i);Number.isFinite(l)&&l>EPSAREA&&c.push(i)}),c};module.exports=extrudeWalls;
|
|
1594
1520
|
|
|
1595
|
-
},{"../../geometries/poly3":
|
|
1521
|
+
},{"../../geometries/poly3":173,"../../maths/constants":187,"../../maths/vec3":313,"./slice":405}],397:[function(require,module,exports){
|
|
1596
1522
|
module.exports={extrudeFromSlices:require("./extrudeFromSlices"),extrudeLinear:require("./extrudeLinear"),extrudeRectangular:require("./extrudeRectangular"),extrudeRotate:require("./extrudeRotate"),project:require("./project"),slice:require("./slice")};
|
|
1597
1523
|
|
|
1598
|
-
},{"./extrudeFromSlices":
|
|
1524
|
+
},{"./extrudeFromSlices":389,"./extrudeLinear":390,"./extrudeRectangular":392,"./extrudeRotate":395,"./project":398,"./slice":405}],398:[function(require,module,exports){
|
|
1599
1525
|
const flatten=require("../../utils/flatten"),aboutEqualNormals=require("../../maths/utils/aboutEqualNormals"),plane=require("../../maths/plane"),mat4=require("../../maths/mat4"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),measureEpsilon=require("../../measurements/measureEpsilon"),unionGeom2=require("../booleans/unionGeom2"),unionGeom3=require("../booleans/unionGeom3"),projectGeom3=(e,o)=>{const r=plane.fromNormalAndPoint(plane.create(),e.axis,e.origin);if(Number.isNaN(r[0])||Number.isNaN(r[1])||Number.isNaN(r[2])||Number.isNaN(r[3]))throw new Error("project: invalid axis or origin");const t=measureEpsilon(o),n=t*t*Math.sqrt(3)/4;if(0===t)return geom2.create();const a=geom3.toPolygons(o),i=[];for(let e=0;e<a.length;e++){const o=a[e].vertices.map(e=>plane.projectionOfPoint(r,e)),t=poly3.create(o);if(poly3.measureArea(t)<n)continue;const s=poly3.plane(t);aboutEqualNormals(r,s)&&i.push(t)}let s=geom3.create(i);if(s=unionGeom3(s,s),!aboutEqualNormals(r,[0,0,1])){const e=mat4.fromVectorRotation(mat4.create(),r,[0,0,1]);s=geom3.transform(e,s)}const m=geom3.toPolygons(s).map(e=>geom2.fromPoints(poly3.toPoints(e)));return s=unionGeom2(m)},project=(e,...o)=>{const{axis:r,origin:t}=Object.assign({},{axis:[0,0,1],origin:[0,0,0]},e);if(0===(o=flatten(o)).length)throw new Error("wrong number of arguments");e={axis:r,origin:t};const n=o.map(o=>geom3.isA(o)?projectGeom3(e,o):o);return 1===n.length?n[0]:n};module.exports=project;
|
|
1600
1526
|
|
|
1601
|
-
},{"../../geometries/geom2":
|
|
1527
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/poly3":173,"../../maths/mat4":237,"../../maths/plane":255,"../../maths/utils/aboutEqualNormals":259,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"../booleans/unionGeom2":375,"../booleans/unionGeom3":376}],399:[function(require,module,exports){
|
|
1602
1528
|
const plane=require("../../../maths/plane"),vec3=require("../../../maths/vec3"),calculatePlane=e=>{const c=e.edges;if(c.length<3)throw new Error("slices must have 3 or more edges to calculate a plane");const a=c.reduce((e,c)=>vec3.add(vec3.create(),e,c[0]),vec3.create());let t;vec3.scale(a,a,1/c.length);let l=0;c.forEach(e=>{const c=vec3.squaredDistance(a,e[0]);c>l&&(t=e,l=c)});const r=c.find(e=>vec3.equals(e[1],t[0]));return plane.fromPoints(plane.create(),r[0],t[0],t[1])};module.exports=calculatePlane;
|
|
1603
1529
|
|
|
1604
|
-
},{"../../../maths/plane":
|
|
1530
|
+
},{"../../../maths/plane":255,"../../../maths/vec3":313}],400:[function(require,module,exports){
|
|
1605
1531
|
const create=require("./create"),vec3=require("../../../maths/vec3"),clone=(...e)=>{let c,r;return 1===e.length?(c=create(),r=e[0]):(c=e[0],r=e[1]),c.edges=r.edges.map(e=>[vec3.clone(e[0]),vec3.clone(e[1])]),c};module.exports=clone;
|
|
1606
1532
|
|
|
1607
|
-
},{"../../../maths/vec3":
|
|
1533
|
+
},{"../../../maths/vec3":313,"./create":401}],401:[function(require,module,exports){
|
|
1608
1534
|
const create=e=>(e||(e=[]),{edges:e});module.exports=create;
|
|
1609
1535
|
|
|
1610
|
-
},{}],
|
|
1536
|
+
},{}],402:[function(require,module,exports){
|
|
1611
1537
|
const vec3=require("../../../maths/vec3"),equals=(e,s)=>{const r=e.edges,t=s.edges;return r.length===t.length&&r.reduce((e,s,r)=>{const u=t[r],c=vec3.squaredDistance(s[0],u[0]);return e&&c<Number.EPSILON},!0)};module.exports=equals;
|
|
1612
1538
|
|
|
1613
|
-
},{"../../../maths/vec3":
|
|
1539
|
+
},{"../../../maths/vec3":313}],403:[function(require,module,exports){
|
|
1614
1540
|
const vec3=require("../../../maths/vec3"),create=require("./create"),fromPoints=e=>{if(!Array.isArray(e))throw new Error("the given points must be an array");if(e.length<3)throw new Error("the given points must contain THREE or more points");const r=[];let t=e[e.length-1];return e.forEach(e=>{2===e.length&&r.push([vec3.fromVec2(vec3.create(),t),vec3.fromVec2(vec3.create(),e)]),3===e.length&&r.push([t,e]),t=e}),create(r)};module.exports=fromPoints;
|
|
1615
1541
|
|
|
1616
|
-
},{"../../../maths/vec3":
|
|
1542
|
+
},{"../../../maths/vec3":313,"./create":401}],404:[function(require,module,exports){
|
|
1617
1543
|
const vec3=require("../../../maths/vec3"),create=require("./create"),fromSides=e=>{if(!Array.isArray(e))throw new Error("the given sides must be an array");const r=[];return e.forEach(e=>{r.push([vec3.fromVec2(vec3.create(),e[0]),vec3.fromVec2(vec3.create(),e[1])])}),create(r)};module.exports=fromSides;
|
|
1618
1544
|
|
|
1619
|
-
},{"../../../maths/vec3":
|
|
1545
|
+
},{"../../../maths/vec3":313,"./create":401}],405:[function(require,module,exports){
|
|
1620
1546
|
module.exports={calculatePlane:require("./calculatePlane"),clone:require("./clone"),create:require("./create"),equals:require("./equals"),fromPoints:require("./fromPoints"),fromSides:require("./fromSides"),isA:require("./isA"),reverse:require("./reverse"),toEdges:require("./toEdges"),toPolygons:require("./toPolygons"),toString:require("./toString"),transform:require("./transform")};
|
|
1621
1547
|
|
|
1622
|
-
},{"./calculatePlane":
|
|
1548
|
+
},{"./calculatePlane":399,"./clone":400,"./create":401,"./equals":402,"./fromPoints":403,"./fromSides":404,"./isA":406,"./reverse":407,"./toEdges":408,"./toPolygons":409,"./toString":410,"./transform":411}],406:[function(require,module,exports){
|
|
1623
1549
|
const isA=e=>!!(e&&"object"==typeof e&&"edges"in e&&Array.isArray(e.edges));module.exports=isA;
|
|
1624
1550
|
|
|
1625
|
-
},{}],
|
|
1551
|
+
},{}],407:[function(require,module,exports){
|
|
1626
1552
|
const create=require("./create"),reverse=(...e)=>{let r,t;return 1===e.length?(r=create(),t=e[0]):(r=e[0],t=e[1]),r.edges=t.edges.map(e=>[e[1],e[0]]),r};module.exports=reverse;
|
|
1627
1553
|
|
|
1628
|
-
},{"./create":
|
|
1554
|
+
},{"./create":401}],408:[function(require,module,exports){
|
|
1629
1555
|
const toEdges=e=>e.edges;module.exports=toEdges;
|
|
1630
1556
|
|
|
1631
|
-
},{}],
|
|
1557
|
+
},{}],409:[function(require,module,exports){
|
|
1632
1558
|
const vec3=require("../../../maths/vec3"),geom3=require("../../../geometries/geom3"),poly3=require("../../../geometries/poly3"),intersectGeom3Sub=require("../../booleans/intersectGeom3Sub"),calculatePlane=require("./calculatePlane"),toPolygon3D=(e,c)=>{const t=[vec3.subtract(vec3.create(),c[0],e),vec3.subtract(vec3.create(),c[1],e),vec3.add(vec3.create(),c[1],e),vec3.add(vec3.create(),c[0],e)];return poly3.fromPoints(t)},toPolygons=e=>{const c=calculatePlane(e),t=e.edges,a=t.reduce((e,c)=>vec3.add(vec3.create(),e,c[0]),vec3.create());vec3.scale(a,a,1/t.length);let o=[[NaN,NaN,NaN],[NaN,NaN,NaN]],r=0;t.forEach(e=>{const c=vec3.squaredDistance(a,e[0]);c>r&&(o=e,r=c)});const s=vec3.subtract(vec3.create(),o[0],a),v=vec3.cross(vec3.create(),c,s),n=vec3.add(vec3.create(),a,s);vec3.add(n,n,s);const l=vec3.add(vec3.create(),a,v);vec3.add(l,l,v);const u=vec3.subtract(vec3.create(),a,s);vec3.subtract(u,u,s);const d=vec3.subtract(vec3.create(),a,v);vec3.subtract(d,d,v);const g=poly3.fromPoints([n,l,u,d]),m=geom3.create([g]),i=t.map(e=>toPolygon3D(c,e)),b=geom3.create(i),N=intersectGeom3Sub(m,b);let P=geom3.toPolygons(N);return P=P.filter(e=>{const t=vec3.angle(c,poly3.plane(e));return Math.abs(t)<Math.PI/90})};module.exports=toPolygons;
|
|
1633
1559
|
|
|
1634
|
-
},{"../../../geometries/geom3":
|
|
1560
|
+
},{"../../../geometries/geom3":136,"../../../geometries/poly3":173,"../../../maths/vec3":313,"../../booleans/intersectGeom3Sub":357,"./calculatePlane":399}],410:[function(require,module,exports){
|
|
1635
1561
|
const vec3=require("../../../maths/vec3"),edgesToString=e=>e.reduce((e,t)=>e+=`[${vec3.toString(t[0])}, ${vec3.toString(t[1])}], `,""),toString=e=>`[${edgesToString(e.edges)}]`;module.exports=toString;
|
|
1636
1562
|
|
|
1637
|
-
},{"../../../maths/vec3":
|
|
1563
|
+
},{"../../../maths/vec3":313}],411:[function(require,module,exports){
|
|
1638
1564
|
const vec3=require("../../../maths/vec3"),create=require("./create"),transform=(e,r)=>{const t=r.edges.map(r=>[vec3.transform(vec3.create(),r[0],e),vec3.transform(vec3.create(),r[1],e)]);return create(t)};module.exports=transform;
|
|
1639
1565
|
|
|
1640
|
-
},{"../../../maths/vec3":
|
|
1566
|
+
},{"../../../maths/vec3":313,"./create":401}],412:[function(require,module,exports){
|
|
1641
1567
|
const flatten=require("../../utils/flatten"),areAllShapesTheSameType=require("../../utils/areAllShapesTheSameType"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),hullPath2=require("./hullPath2"),hullGeom2=require("./hullGeom2"),hullGeom3=require("./hullGeom3"),hull=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");if(!areAllShapesTheSameType(e))throw new Error("only hulls of the same type are supported");const l=e[0];return path2.isA(l)?hullPath2(e):geom2.isA(l)?hullGeom2(e):geom3.isA(l)?hullGeom3(e):l};module.exports=hull;
|
|
1642
1568
|
|
|
1643
|
-
},{"../../geometries/geom2":
|
|
1569
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../utils/areAllShapesTheSameType":471,"../../utils/flatten":473,"./hullGeom2":414,"./hullGeom3":415,"./hullPath2":416}],413:[function(require,module,exports){
|
|
1644
1570
|
const flatten=require("../../utils/flatten"),union=require("../booleans/union"),hull=require("./hull"),hullChain=(...n)=>{if((n=flatten(n)).length<2)throw new Error("wrong number of arguments");const e=[];for(let l=1;l<n.length;l++)e.push(hull(n[l-1],n[l]));return union(e)};module.exports=hullChain;
|
|
1645
1571
|
|
|
1646
|
-
},{"../../utils/flatten":
|
|
1572
|
+
},{"../../utils/flatten":473,"../booleans/union":374,"./hull":412}],414:[function(require,module,exports){
|
|
1647
1573
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),hullPoints2=require("./hullPoints2"),hullGeom2=(...e)=>{e=flatten(e);const t=[],o=new Map;for(let l=0;l<e.length;l++){const n=geom2.toSides(e[l]);for(let e=0;e<n.length;e++){const l=n[e][0],s=`${l[0]},${l[1]}`;o.has(s)||(t.push(l),o.set(s,!0))}}o.clear();const l=hullPoints2(t);return l.length<3?geom2.create():geom2.fromPoints(l)};module.exports=hullGeom2;
|
|
1648
1574
|
|
|
1649
|
-
},{"../../geometries/geom2":
|
|
1575
|
+
},{"../../geometries/geom2":122,"../../utils/flatten":473,"./hullPoints2":417}],415:[function(require,module,exports){
|
|
1650
1576
|
const flatten=require("../../utils/flatten"),geom3=require("../../geometries/geom3"),poly3=require("../../geometries/poly3"),quickhull=require("./quickhull"),hullGeom3=(...e)=>{if(1===(e=flatten(e)).length)return e[0];const t=[],l=new Map;for(let o=0;o<e.length;++o){const r=geom3.toPolygons(e[o]);for(let e=0;e<r.length;++e){const o=r[e].vertices;for(let e=0;e<o.length;++e){const r=`${o[e]}`;l.has(r)||(t.push(o[e]),l.set(r,!0))}}}l.clear();const o=quickhull(t,{skipTriangulation:!0}).map(e=>{const l=e.map(e=>t[e]);return poly3.create(l)});return geom3.create(o)};module.exports=hullGeom3;
|
|
1651
1577
|
|
|
1652
|
-
},{"../../geometries/geom3":
|
|
1578
|
+
},{"../../geometries/geom3":136,"../../geometries/poly3":173,"../../utils/flatten":473,"./quickhull":425}],416:[function(require,module,exports){
|
|
1653
1579
|
const flatten=require("../../utils/flatten"),vec2=require("../../maths/vec2"),path2=require("../../geometries/path2"),hullPoints2=require("./hullPoints2"),hullPath2=(...t)=>{t=flatten(t);const e=[];t.forEach(t=>{path2.toPoints(t).forEach(t=>{e.findIndex(e=>vec2.equals(e,t))<0&&e.push(t)})});const l=hullPoints2(e);return path2.fromPoints({closed:!0},l)};module.exports=hullPath2;
|
|
1654
1580
|
|
|
1655
|
-
},{"../../geometries/path2":
|
|
1656
|
-
const vec2=require("../../maths/vec2"),angleBetweenPoints=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]),compareIndex=(e,t)=>e.angle<t.angle?-1:e.angle>t.angle?1:e.distance<t.distance?-1:e.distance>t.distance?1:0,compute=e=>{if(e.length<3)return e;let t=0;e.forEach((n,
|
|
1581
|
+
},{"../../geometries/path2":157,"../../maths/vec2":282,"../../utils/flatten":473,"./hullPoints2":417}],417:[function(require,module,exports){
|
|
1582
|
+
const vec2=require("../../maths/vec2"),angleBetweenPoints=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0]),compareIndex=(e,t)=>e.angle<t.angle?-1:e.angle>t.angle?1:e.distance<t.distance?-1:e.distance>t.distance?1:0,compute=e=>{if(e.length<3)return e;let t=0;e.forEach((n,r)=>{const a=e[t];n[1]===a[1]?n[0]<a[0]&&(t=r):n[1]<a[1]&&(t=r)});const n=[];let r=0,a=0;for(let l=0;l<e.length;l++)l!==t&&((r=angleBetweenPoints(e[t],e[l]))<0&&(r+=Math.PI),a=vec2.squaredDistance(e[t],e[l]),n.push({index:l,angle:r,distance:a}));n.sort((e,t)=>compareIndex(e,t));const l=new Array(e.length+1);let o=2;for(let r=0;r<e.length;r++)r!==t&&(l[o]=n[o-2].index,o++);l[0]=l[e.length],l[1]=t;const s=(t,n,r)=>(e[n][0]-e[t][0])*(e[r][1]-e[t][1])-(e[n][1]-e[t][1])*(e[r][0]-e[t][0]);let c,i=2;for(let t=3;t<=e.length;t++){for(;s(l[i-1],l[i],l[t])<Number.EPSILON;)i--;i++,c=l[t],l[t]=l[i],l[i]=c}const g=new Array(i);for(let e=0;e<i;e++)g[e]=l[e+1];return g},hullPoints2=e=>{const t=compute(e);let n=[];return Array.isArray(t)&&(n=t.map(t=>e[t])),n};module.exports=hullPoints2;
|
|
1657
1583
|
|
|
1658
|
-
},{"../../maths/vec2":
|
|
1584
|
+
},{"../../maths/vec2":282}],418:[function(require,module,exports){
|
|
1659
1585
|
module.exports={hull:require("./hull"),hullChain:require("./hullChain")};
|
|
1660
1586
|
|
|
1661
|
-
},{"./hull":
|
|
1587
|
+
},{"./hull":412,"./hullChain":413}],419:[function(require,module,exports){
|
|
1662
1588
|
const add=require("../../../maths/vec3/add"),copy=require("../../../maths/vec3/copy"),cross=require("../../../maths/vec3/cross"),dot=require("../../../maths/vec3/dot"),length=require("../../../maths/vec3/length"),normalize=require("../../../maths/vec3/normalize"),scale=require("../../../maths/vec3/scale"),subtract=require("../../../maths/vec3/subtract"),HalfEdge=require("./HalfEdge"),VISIBLE=0,NON_CONVEX=1,DELETED=2;class Face{constructor(){this.normal=[],this.centroid=[],this.offset=0,this.outside=null,this.mark=VISIBLE,this.edge=null,this.nVertices=0}getEdge(e){if("number"!=typeof e)throw Error("requires a number");let t=this.edge;for(;e>0;)t=t.next,e-=1;for(;e<0;)t=t.prev,e+=1;return t}computeNormal(){const e=this.edge,t=e.next;let r=t.next;const s=subtract([],t.head().point,e.head().point),o=[],i=[];for(this.nVertices=2,this.normal=[0,0,0];r!==e;)copy(i,s),subtract(s,r.head().point,e.head().point),add(this.normal,this.normal,cross(o,i,s)),r=r.next,this.nVertices+=1;this.area=length(this.normal),this.normal=scale(this.normal,this.normal,1/this.area)}computeNormalMinArea(e){if(this.computeNormal(),this.area<e){let e,t=0,r=this.edge;do{const s=r.lengthSquared();s>t&&(e=r,t=s),r=r.next}while(r!==this.edge);const s=e.tail().point,o=e.head().point,i=subtract([],o,s),n=Math.sqrt(t);scale(i,i,1/n);const a=dot(this.normal,i);scale(i,i,-a),add(this.normal,this.normal,i),normalize(this.normal,this.normal)}}computeCentroid(){this.centroid=[0,0,0];let e=this.edge;do{add(this.centroid,this.centroid,e.head().point),e=e.next}while(e!==this.edge);scale(this.centroid,this.centroid,1/this.nVertices)}computeNormalAndCentroid(e){void 0!==e?this.computeNormalMinArea(e):this.computeNormal(),this.computeCentroid(),this.offset=dot(this.normal,this.centroid)}distanceToPlane(e){return dot(this.normal,e)-this.offset}connectHalfEdges(e,t){let r;if(e.opposite.face===t.opposite.face){const s=t.opposite.face;let o;e===this.edge&&(this.edge=t),3===s.nVertices?(o=t.opposite.prev.opposite,s.mark=DELETED,r=s):(o=t.opposite.next,s.edge===o.prev&&(s.edge=o),o.prev=o.prev.prev,o.prev.next=o),t.prev=e.prev,t.prev.next=t,t.setOpposite(o),s.computeNormalAndCentroid()}else e.next=t,t.prev=e;return r}mergeAdjacentFaces(e,t){const r=e.opposite,s=r.face;t.push(s),s.mark=DELETED;let o,i,n=e.prev,a=e.next,c=r.prev,h=r.next;for(;n.opposite.face===s;)n=n.prev,h=h.next;for(;a.opposite.face===s;)a=a.next,c=c.prev;for(o=h;o!==c.next;o=o.next)o.face=this;return this.edge=a,(i=this.connectHalfEdges(c,a))&&t.push(i),(i=this.connectHalfEdges(n,h))&&t.push(i),this.computeNormalAndCentroid(),t}collectIndices(){const e=[];let t=this.edge;do{e.push(t.head().index),t=t.next}while(t!==this.edge);return e}static createTriangle(e,t,r,s=0){const o=new Face,i=new HalfEdge(e,o),n=new HalfEdge(t,o),a=new HalfEdge(r,o);return i.next=a.prev=n,n.next=i.prev=a,a.next=n.prev=i,o.edge=i,o.computeNormalAndCentroid(s),o}}module.exports={VISIBLE:VISIBLE,NON_CONVEX:1,DELETED:DELETED,Face:Face};
|
|
1663
1589
|
|
|
1664
|
-
},{"../../../maths/vec3/add":
|
|
1590
|
+
},{"../../../maths/vec3/add":300,"../../../maths/vec3/copy":303,"../../../maths/vec3/cross":305,"../../../maths/vec3/dot":308,"../../../maths/vec3/length":314,"../../../maths/vec3/normalize":320,"../../../maths/vec3/scale":325,"../../../maths/vec3/subtract":329,"./HalfEdge":420}],420:[function(require,module,exports){
|
|
1665
1591
|
const distance=require("../../../maths/vec3/distance"),squaredDistance=require("../../../maths/vec3/squaredDistance");class HalfEdge{constructor(t,e){this.vertex=t,this.face=e,this.next=null,this.prev=null,this.opposite=null}head(){return this.vertex}tail(){return this.prev?this.prev.vertex:null}length(){return this.tail()?distance(this.tail().point,this.head().point):-1}lengthSquared(){return this.tail()?squaredDistance(this.tail().point,this.head().point):-1}setOpposite(t){this.opposite=t,t.opposite=this}}module.exports=HalfEdge;
|
|
1666
1592
|
|
|
1667
|
-
},{"../../../maths/vec3/distance":
|
|
1593
|
+
},{"../../../maths/vec3/distance":306,"../../../maths/vec3/squaredDistance":327}],421:[function(require,module,exports){
|
|
1668
1594
|
const dot=require("../../../maths/vec3/dot"),pointLineDistance=require("./point-line-distance"),getPlaneNormal=require("./get-plane-normal"),VertexList=require("./VertexList"),Vertex=require("./Vertex"),{Face:Face,VISIBLE:VISIBLE,NON_CONVEX:NON_CONVEX,DELETED:DELETED}=require("./Face"),MERGE_NON_CONVEX_WRT_LARGER_FACE=1,MERGE_NON_CONVEX=2;class QuickHull{constructor(e){if(!Array.isArray(e))throw TypeError("input is not a valid array");if(e.length<4)throw Error("cannot build a simplex out of <4 points");this.tolerance=-1,this.nFaces=0,this.nPoints=e.length,this.faces=[],this.newFaces=[],this.claimed=new VertexList,this.unclaimed=new VertexList,this.vertices=[];for(let t=0;t<e.length;t+=1)this.vertices.push(new Vertex(e[t],t));this.discardedFaces=[],this.vertexPointIndices=[]}addVertexToFace(e,t){e.face=t,t.outside?this.claimed.insertBefore(t.outside,e):this.claimed.add(e),t.outside=e}removeVertexFromFace(e,t){e===t.outside&&(e.next&&e.next.face===t?t.outside=e.next:t.outside=null),this.claimed.remove(e)}removeAllVerticesFromFace(e){if(e.outside){let t=e.outside;for(;t.next&&t.next.face===e;)t=t.next;return this.claimed.removeChain(e.outside,t),t.next=null,e.outside}}deleteFaceVertices(e,t){const i=this.removeAllVerticesFromFace(e);if(i)if(t){let e;for(let s=i;s;s=e){e=s.next,t.distanceToPlane(s.point)>this.tolerance?this.addVertexToFace(s,t):this.unclaimed.add(s)}}else this.unclaimed.addAll(i)}resolveUnclaimedPoints(e){let t=this.unclaimed.first();for(let i=t;i;i=t){t=i.next;let s,o=this.tolerance;for(let t=0;t<e.length;t+=1){const a=e[t];if(a.mark===VISIBLE){const e=a.distanceToPlane(i.point);if(e>o&&(o=e,s=a),o>1e3*this.tolerance)break}}s&&this.addVertexToFace(i,s)}}computeExtremes(){const e=[],t=[],i=[],s=[];let o,a;for(o=0;o<3;o+=1)i[o]=s[o]=this.vertices[0];for(o=0;o<3;o+=1)e[o]=t[o]=this.vertices[0].point[o];for(o=1;o<this.vertices.length;o+=1){const c=this.vertices[o],n=c.point;for(a=0;a<3;a+=1)n[a]<e[a]&&(e[a]=n[a],i[a]=c);for(a=0;a<3;a+=1)n[a]>t[a]&&(t[a]=n[a],s[a]=c)}return this.tolerance=3*Number.EPSILON*(Math.max(Math.abs(e[0]),Math.abs(t[0]))+Math.max(Math.abs(e[1]),Math.abs(t[1]))+Math.max(Math.abs(e[2]),Math.abs(t[2]))),[i,s]}createInitialSimplex(){const e=this.vertices,[t,i]=this.computeExtremes();let s,o,a,c,n=0,r=0;for(a=0;a<3;a+=1){const e=i[a].point[a]-t[a].point[a];e>n&&(n=e,r=a)}const l=t[r],h=i[r];for(n=0,a=0;a<this.vertices.length;a+=1){const e=this.vertices[a];if(e!==l&&e!==h){const t=pointLineDistance(e.point,l.point,h.point);t>n&&(n=t,s=e)}}const d=getPlaneNormal([],l.point,h.point,s.point),p=dot(l.point,d);for(n=-1,a=0;a<this.vertices.length;a+=1){const e=this.vertices[a];if(e!==l&&e!==h&&e!==s){const t=Math.abs(dot(d,e.point)-p);t>n&&(n=t,o=e)}}const f=[];if(dot(o.point,d)-p<0)for(f.push(Face.createTriangle(l,h,s),Face.createTriangle(o,h,l),Face.createTriangle(o,s,h),Face.createTriangle(o,l,s)),a=0;a<3;a+=1){const e=(a+1)%3;f[a+1].getEdge(2).setOpposite(f[0].getEdge(e)),f[a+1].getEdge(1).setOpposite(f[e+1].getEdge(0))}else for(f.push(Face.createTriangle(l,s,h),Face.createTriangle(o,l,h),Face.createTriangle(o,h,s),Face.createTriangle(o,s,l)),a=0;a<3;a+=1){const e=(a+1)%3;f[a+1].getEdge(2).setOpposite(f[0].getEdge((3-a)%3)),f[a+1].getEdge(0).setOpposite(f[e+1].getEdge(1))}for(a=0;a<4;a+=1)this.faces.push(f[a]);for(a=0;a<e.length;a+=1){const t=e[a];if(t!==l&&t!==h&&t!==s&&t!==o){let e;for(n=this.tolerance,c=0;c<4;c+=1){const i=f[c].distanceToPlane(t.point);i>n&&(n=i,e=f[c])}e&&this.addVertexToFace(t,e)}}}reindexFaceAndVertices(){const e=[];for(let t=0;t<this.faces.length;t+=1){const i=this.faces[t];i.mark===VISIBLE&&e.push(i)}this.faces=e}collectFaces(e){const t=[];for(let i=0;i<this.faces.length;i+=1){if(this.faces[i].mark!==VISIBLE)throw Error("attempt to include a destroyed face in the hull");const s=this.faces[i].collectIndices();if(e)t.push(s);else for(let e=0;e<s.length-2;e+=1)t.push([s[0],s[e+1],s[e+2]])}return t}nextVertexToAdd(){if(!this.claimed.isEmpty()){let e,t,i=0;const s=this.claimed.first().face;for(t=s.outside;t&&t.face===s;t=t.next){const o=s.distanceToPlane(t.point);o>i&&(i=o,e=t)}return e}}computeHorizon(e,t,i,s){let o;this.deleteFaceVertices(i),i.mark=DELETED,o=t?t.next:t=i.getEdge(0);do{const t=o.opposite,i=t.face;i.mark===VISIBLE&&(i.distanceToPlane(e)>this.tolerance?this.computeHorizon(e,t,i,s):s.push(o)),o=o.next}while(o!==t)}addAdjoiningFace(e,t){const i=Face.createTriangle(e,t.tail(),t.head());return this.faces.push(i),i.getEdge(-1).setOpposite(t.opposite),i.getEdge(0)}addNewFaces(e,t){let i,s;this.newFaces=[];for(let o=0;o<t.length;o+=1){const a=t[o],c=this.addAdjoiningFace(e,a);i?c.next.setOpposite(s):i=c,this.newFaces.push(c.face),s=c}i.next.setOpposite(s)}oppositeFaceDistance(e){return e.face.distanceToPlane(e.opposite.face.centroid)}doAdjacentMerge(e,t){let i=e.edge,s=!0,o=0;do{if(o>=e.nVertices)throw Error("merge recursion limit exceeded");const a=i.opposite.face;let c=!1;if(t===MERGE_NON_CONVEX?(this.oppositeFaceDistance(i)>-this.tolerance||this.oppositeFaceDistance(i.opposite)>-this.tolerance)&&(c=!0):e.area>a.area?this.oppositeFaceDistance(i)>-this.tolerance?c=!0:this.oppositeFaceDistance(i.opposite)>-this.tolerance&&(s=!1):this.oppositeFaceDistance(i.opposite)>-this.tolerance?c=!0:this.oppositeFaceDistance(i)>-this.tolerance&&(s=!1),c){const t=e.mergeAdjacentFaces(i,[]);for(let i=0;i<t.length;i+=1)this.deleteFaceVertices(t[i],e);return!0}i=i.next,o+=1}while(i!==e.edge);return s||(e.mark=NON_CONVEX),!1}addVertexToHull(e){const t=[];this.unclaimed.clear(),this.removeVertexFromFace(e,e.face),this.computeHorizon(e.point,null,e.face,t),this.addNewFaces(e,t);for(let e=0;e<this.newFaces.length;e+=1){const t=this.newFaces[e];if(t.mark===VISIBLE)for(;this.doAdjacentMerge(t,MERGE_NON_CONVEX_WRT_LARGER_FACE););}for(let e=0;e<this.newFaces.length;e+=1){const t=this.newFaces[e];if(t.mark===NON_CONVEX)for(t.mark=VISIBLE;this.doAdjacentMerge(t,MERGE_NON_CONVEX););}this.resolveUnclaimedPoints(this.newFaces)}build(){let e;for(this.createInitialSimplex();e=this.nextVertexToAdd();)this.addVertexToHull(e);this.reindexFaceAndVertices()}}module.exports=QuickHull;
|
|
1669
1595
|
|
|
1670
|
-
},{"../../../maths/vec3/dot":
|
|
1596
|
+
},{"../../../maths/vec3/dot":308,"./Face":419,"./Vertex":422,"./VertexList":423,"./get-plane-normal":424,"./point-line-distance":426}],422:[function(require,module,exports){
|
|
1671
1597
|
class Vertex{constructor(t,e){this.point=t,this.index=e,this.next=null,this.prev=null,this.face=null}}module.exports=Vertex;
|
|
1672
1598
|
|
|
1673
|
-
},{}],
|
|
1599
|
+
},{}],423:[function(require,module,exports){
|
|
1674
1600
|
class VertexList{constructor(){this.head=null,this.tail=null}clear(){this.head=this.tail=null}insertBefore(e,t){t.prev=e.prev,t.next=e,t.prev?t.prev.next=t:this.head=t,e.prev=t}insertAfter(e,t){t.prev=e,t.next=e.next,t.next?t.next.prev=t:this.tail=t,e.next=t}add(e){this.head?this.tail.next=e:this.head=e,e.prev=this.tail,e.next=null,this.tail=e}addAll(e){for(this.head?this.tail.next=e:this.head=e,e.prev=this.tail;e.next;)e=e.next;this.tail=e}remove(e){e.prev?e.prev.next=e.next:this.head=e.next,e.next?e.next.prev=e.prev:this.tail=e.prev}removeChain(e,t){e.prev?e.prev.next=t.next:this.head=t.next,t.next?t.next.prev=e.prev:this.tail=e.prev}first(){return this.head}isEmpty(){return!this.head}}module.exports=VertexList;
|
|
1675
1601
|
|
|
1676
|
-
},{}],
|
|
1602
|
+
},{}],424:[function(require,module,exports){
|
|
1677
1603
|
const cross=require("../../../maths/vec3/cross"),normalize=require("../../../maths/vec3/normalize"),subtract=require("../../../maths/vec3/subtract"),planeNormal=(r,e,s,t)=>{const a=[0,0,0];return subtract(r,e,s),subtract(a,s,t),cross(r,r,a),normalize(r,r)};module.exports=planeNormal;
|
|
1678
1604
|
|
|
1679
|
-
},{"../../../maths/vec3/cross":
|
|
1605
|
+
},{"../../../maths/vec3/cross":305,"../../../maths/vec3/normalize":320,"../../../maths/vec3/subtract":329}],425:[function(require,module,exports){
|
|
1680
1606
|
const QuickHull=require("./QuickHull"),runner=(u,l={})=>{const e=new QuickHull(u);return e.build(),e.collectFaces(l.skipTriangulation)};module.exports=runner;
|
|
1681
1607
|
|
|
1682
|
-
},{"./QuickHull":
|
|
1608
|
+
},{"./QuickHull":421}],426:[function(require,module,exports){
|
|
1683
1609
|
const cross=require("../../../maths/vec3/cross"),subtract=require("../../../maths/vec3/subtract"),squaredLength=require("../../../maths/vec3/squaredLength"),distanceSquared=(e,t,r)=>{const s=[],a=[];subtract(s,r,t),subtract(a,e,t);const n=squaredLength(cross([],a,s)),c=squaredLength(s);if(0===c)throw Error("a and b are the same point");return n/c},pointLineDistance=(e,t,r)=>Math.sqrt(distanceSquared(e,t,r));module.exports=pointLineDistance;
|
|
1684
1610
|
|
|
1685
|
-
},{"../../../maths/vec3/cross":
|
|
1611
|
+
},{"../../../maths/vec3/cross":305,"../../../maths/vec3/squaredLength":328,"../../../maths/vec3/subtract":329}],427:[function(require,module,exports){
|
|
1686
1612
|
const vec3=require("../../maths/vec3"),line3=require("../../maths/line3"),poly3=require("../../geometries/poly3"),addEdge=(e,o,s)=>{const n=e.findIndex(e=>{if(e){if(vec3.equals(e[0],o[0])&&vec3.equals(e[1],o[1]))return!0;if(vec3.equals(e[0],o[1])&&vec3.equals(e[1],o[0]))return!0}return!1});n>=0?(o=e[n]).polygons.push(s):(o.polygons=[s],e.push(o))},removeEdge=(e,o)=>{const s=e.findIndex(e=>{if(e){if(vec3.equals(e[0],o[0])&&vec3.equals(e[1],o[1]))return!0;if(vec3.equals(e[0],o[1])&&vec3.equals(e[1],o[0]))return!0}return!1});s>=0&&(e[s].polygons=[],e[s]=null)},addPolygon=(e,o)=>{const s=o.vertices,n=s.length;let l=[s[n-1],s[0]];addEdge(e,l,o);for(let t=0;t<n-1;t++)l=[s[t],s[t+1]],addEdge(e,l,o)},removePolygons=(e,o)=>{o.polygons.forEach(o=>{const s=o.vertices,n=s.length;let l=[s[n-1],s[0]];removeEdge(e,l);for(let o=0;o<n-1;o++)l=[s[o],s[o+1]],removeEdge(e,l)})},splitPolygon=(e,o,s)=>{const n=o.vertices,l=n.findIndex(o=>almostEquals(s,o,e[0])),t=poly3.fromPoints([n[(l+0)%3],n[(l+1)%3],e[1]]),r=poly3.fromPoints([e[1],n[(l+1)%3],n[(l+2)%3]]);return o.color&&(t.color=o.color,r.color=o.color),[t,r]},almostEquals=(e,o,s)=>Math.abs(o[0]-s[0])<=e&&Math.abs(o[1]-s[1])<=e&&Math.abs(o[2]-s[2])<=e,enclosedEdge=(e,o,s)=>{if(e.distance<o.distance&&vec3.equals(e[0],o[1])){const n=vec3.squaredDistance(e[0],o[0]),l=vec3.squaredDistance(e[1],o[0]),t=vec3.squaredDistance(e[0],o[1]),r=vec3.squaredDistance(e[1],o[1]);if(n<=o.distance&&l<o.distance&&t<o.distance&&r<o.distance){const n=line3.fromPoints(o[0],o[1]),l=vec3.snap(vec3.create(),s,line3.closestPoint(e[0],n)),t=vec3.snap(vec3.create(),s,line3.closestPoint(e[1],n));if(almostEquals(s,l,e[0])&&almostEquals(s,t,e[1]))return!0}}return!1},splitEdge=(e,o,s)=>{for(let n=0;n<e.length;n++){const l=e[n];if(l&&enclosedEdge(l,o,s)){const e=o.polygons[0];return splitPolygon(l,e,s)}}return null},cullOpenEdges=e=>{const o=[];return e.forEach((e,s)=>{1===e.polygons.length&&(e.distance=vec3.squaredDistance(e[0],e[1]),o.push(e))}),o},edgesToPolygons=e=>{const o=[];return e.forEach(e=>{e&&e.polygons&&e.polygons.forEach(e=>{e.visited||(e.visited=!0,o.push(e))})}),o},polygonsToEdges=e=>{const o=[];return e.forEach(e=>{addPolygon(o,e)}),o};module.exports={polygonsToEdges:polygonsToEdges,edgesToPolygons:edgesToPolygons,cullOpenEdges:cullOpenEdges,splitEdge:splitEdge,removePolygons:removePolygons,addPolygon:addPolygon};
|
|
1687
1613
|
|
|
1688
|
-
},{"../../geometries/poly3":
|
|
1614
|
+
},{"../../geometries/poly3":173,"../../maths/line3":215,"../../maths/vec3":313}],428:[function(require,module,exports){
|
|
1689
1615
|
const flatten=require("../../utils/flatten"),measureEpsilon=require("../../measurements/measureEpsilon"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),snapPolygons=require("./snapPolygons"),mergePolygons=require("./mergePolygons"),insertTjunctions=require("./insertTjunctions"),triangulatePolygons=require("./triangulatePolygons"),repairTjunctions=require("./repairTjunctions"),generalizePath2=(e,r)=>r,generalizeGeom2=(e,r)=>r,generalizeGeom3=(e,r)=>{const{snap:n,simplify:i,triangulate:o,repair:t}=Object.assign({},{snap:!1,simplify:!1,triangulate:!1,repair:!1},e),s=measureEpsilon(r);let a=geom3.toPolygons(r);n&&(a=snapPolygons(s,a)),i&&(a=mergePolygons(s,a)),o&&(a=insertTjunctions(a),a=triangulatePolygons(s,a)),t&&(a=repairTjunctions(s,a));const g=Object.assign({},r);return g.polygons=a,g},generalize=(e,...r)=>{if(0===(r=flatten(r)).length)throw new Error("wrong number of arguments");const n=r.map((r,n)=>{if(path2.isA(r))return generalizePath2(0,r);if(geom2.isA(r))return generalizeGeom2(0,r);if(geom3.isA(r))return generalizeGeom3(e,r);throw new Error("invalid geometry")});return 1===n.length?n[0]:n};module.exports=generalize;
|
|
1690
1616
|
|
|
1691
|
-
},{"../../geometries/geom2":
|
|
1617
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"./insertTjunctions":430,"./mergePolygons":431,"./repairTjunctions":432,"./snapPolygons":434,"./triangulatePolygons":435}],429:[function(require,module,exports){
|
|
1692
1618
|
module.exports={generalize:require("./generalize"),snap:require("./snap")};
|
|
1693
1619
|
|
|
1694
|
-
},{"./generalize":
|
|
1620
|
+
},{"./generalize":428,"./snap":433}],430:[function(require,module,exports){
|
|
1695
1621
|
const constants=require("../../maths/constants"),vec3=require("../../maths/vec3"),poly3=require("../../geometries/poly3"),assert=!1,getTag=e=>`${e}`,addSide=(e,t,n,s,r,c)=>{const o=getTag(s),l=getTag(r);const i=`${o}/${l}`,g=`${l}/${o}`;if(e.has(g))return deleteSide(e,t,n,r,s,null),null;const a={vertex0:s,vertex1:r,polygonindex:c};return e.has(i)?e.get(i).push(a):e.set(i,[a]),o in t?t[o].push(i):t[o]=[i],l in n?n[l].push(i):n[l]=[i],i},deleteSide=(e,t,n,s,r,c)=>{const o=getTag(s),l=getTag(r),i=`${o}/${l}`;let g=-1;const a=e.get(i);for(let e=0;e<a.length;e++){const t=a[e];let n=getTag(t.vertex0);if(n===o&&((n=getTag(t.vertex1))===l&&(null===c||t.polygonindex===c))){g=e;break}}a.splice(g,1),0===a.length&&e.delete(i),g=t[o].indexOf(i),t[o].splice(g,1),0===t[o].length&&delete t[o],g=n[l].indexOf(i),n[l].splice(g,1),0===n[l].length&&delete n[l]},insertTjunctions=e=>{const t=new Map;for(let n=0;n<e.length;n++){const s=e[n],r=s.vertices.length;if(r>=3){let e=s.vertices[0],c=getTag(e);for(let o=0;o<r;o++){let l=o+1;l===r&&(l=0);const i=s.vertices[l],g=getTag(i),a=`${c}/${g}`,v=`${g}/${c}`;if(t.has(v)){const e=t.get(v);e.splice(-1,1),0===e.length&&t.delete(v)}else{const s={vertex0:e,vertex1:i,polygonindex:n};t.has(a)?t.get(a).push(s):t.set(a,[s])}e=i,c=g}}else console.warn("warning: invalid polygon found during insertTjunctions")}if(t.size>0){const n={},s={},r={};for(const[e,c]of t)r[e]=!0,c.forEach(t=>{const r=getTag(t.vertex0),c=getTag(t.vertex1);r in n?n[r].push(e):n[r]=[e],c in s?s[c].push(e):s[c]=[e]});const c=e.slice(0);for(;0!==t.size;){for(const e of t.keys())r[e]=!0;let e=!1;for(;;){const o=Object.keys(r);if(0===o.length)break;const l=o[0];let i=!0;if(t.has(l)){const o=t.get(l);0;const g=o[0];for(let o=0;o<2;o++){const l=0===o?g.vertex0:g.vertex1,a=0===o?g.vertex1:g.vertex0,v=getTag(l),d=getTag(a);let f=[];0===o?v in s&&(f=s[v]):v in n&&(f=n[v]);for(let g=0;g<f.length;g++){const v=f[g],u=t.get(v)[0],x=0===o?u.vertex0:u.vertex1,h=0===o?u.vertex1:u.vertex0,p=getTag(x);getTag(h);if(p===d){deleteSide(t,n,s,l,a,null),deleteSide(t,n,s,a,l,null),i=!1,o=2,e=!0;break}{const g=l,v=a,d=x,f=vec3.subtract(vec3.create(),d,g),h=vec3.dot(vec3.subtract(vec3.create(),v,g),f)/vec3.dot(f,f);if(h>0&&h<1){const l=vec3.scale(vec3.create(),f,h);if(vec3.add(l,l,g),vec3.squaredDistance(l,v)<constants.EPS*constants.EPS){const l=u.polygonindex,g=c[l],v=getTag(u.vertex1);let d=-1;for(let e=0;e<g.vertices.length;e++)if(getTag(g.vertices[e])===v){d=e;break}0;const f=g.vertices.slice(0);f.splice(d,0,a);const x=poly3.fromPoints(f);c[l]=x,deleteSide(t,n,s,u.vertex0,u.vertex1,l);const h=addSide(t,n,s,u.vertex0,a,l),p=addSide(t,n,s,a,u.vertex1,l);null!==h&&(r[h]=!0),null!==p&&(r[p]=!0),i=!1,o=2,e=!0;break}}}}}}i&&delete r[l]}if(!e)break}e=c}return t.clear(),e};module.exports=insertTjunctions;
|
|
1696
1622
|
|
|
1697
|
-
},{"../../geometries/poly3":
|
|
1623
|
+
},{"../../geometries/poly3":173,"../../maths/constants":187,"../../maths/vec3":313}],431:[function(require,module,exports){
|
|
1698
1624
|
const vec3=require("../../maths/vec3"),poly3=require("../../geometries/poly3"),createEdges=e=>{const n=poly3.toPoints(e),t=[];for(let e=0;e<n.length;e++){const l=(e+1)%n.length,r={v1:n[e],v2:n[l]};t.push(r)}for(let e=0;e<t.length;e++){const l=(e+1)%n.length;t[e].next=t[l],t[l].prev=t[e]}return t},insertEdge=(e,n)=>{const t=`${n.v1}:${n.v2}`;e.set(t,n)},deleteEdge=(e,n)=>{const t=`${n.v1}:${n.v2}`;e.delete(t)},findOppositeEdge=(e,n)=>{const t=`${n.v2}:${n.v1}`;return e.get(t)},calculateAnglesBetween=(e,n,t)=>{let l=e.prev.v1,r=e.prev.v2,o=n.next.v2;const s=calculateAngle(l,r,o,t);return l=n.prev.v1,r=n.prev.v2,o=e.next.v2,[s,calculateAngle(l,r,o,t)]},calculateAngle=(e,n,t,l)=>{const r=vec3.subtract(vec3.create(),n,e),o=vec3.subtract(vec3.create(),t,n);return vec3.cross(r,r,o),vec3.dot(r,l)},createPolygonAnd=e=>{let n;const t=[];for(;e.next;){const n=e.next;t.push(e.v1),e.v1=null,e.v2=null,e.next=null,e.prev=null,e=n}return t.length>0&&(n=poly3.fromPoints(t)),n},mergeCoplanarPolygons=(e,n)=>{if(n.length<2)return n;const t=n[0].plane,l=n.slice(),r=new Map;for(;l.length>0;){const e=l.shift(),n=createEdges(e);for(let e=0;e<n.length;e++){const l=n[e],o=findOppositeEdge(r,l);if(o){const e=calculateAnglesBetween(l,o,t);if(e[0]>=0&&e[1]>=0){const n=o.next,t=l.next;l.prev.next=o.next,l.next.prev=o.prev,o.prev.next=l.next,o.next.prev=l.prev,l.v1=null,l.v2=null,l.next=null,l.prev=null,deleteEdge(r,o),o.v1=null,o.v2=null,o.next=null,o.prev=null;const s=(e,n,t)=>{const l={v1:t.v1,v2:n.v2,next:n.next,prev:t.prev};t.prev.next=l,n.next.prev=l,deleteEdge(e,n),n.v1=null,n.v2=null,n.next=null,n.prev=null,deleteEdge(e,t),t.v1=null,t.v2=null,t.next=null,t.prev=null};0===e[0]&&s(r,n,n.prev),0===e[1]&&s(r,t,t.prev)}}else l.next&&insertEdge(r,l)}}const o=[];return r.forEach(e=>{const n=createPolygonAnd(e);n&&o.push(n)}),o},NEPS=1e-13,aboutEqualNormals=(e,n)=>Math.abs(e[0]-n[0])<=NEPS&&Math.abs(e[1]-n[1])<=NEPS&&Math.abs(e[2]-n[2])<=NEPS,coplanar=(e,n)=>Math.abs(e[3]-n[3])<1.5e-7&&aboutEqualNormals(e,n),mergePolygons=(e,n)=>{const t=[];n.forEach(e=>{const n=t.find(n=>coplanar(n[0],poly3.plane(e)));if(n){n[1].push(e)}else t.push([poly3.plane(e),[e]])});let l=[];return t.forEach(e=>{const n=e[1],t=mergeCoplanarPolygons(0,n);l=l.concat(t)}),l};module.exports=mergePolygons;
|
|
1699
1625
|
|
|
1700
|
-
},{"../../geometries/poly3":
|
|
1626
|
+
},{"../../geometries/poly3":173,"../../maths/vec3":313}],432:[function(require,module,exports){
|
|
1701
1627
|
const{polygonsToEdges:polygonsToEdges,edgesToPolygons:edgesToPolygons,cullOpenEdges:cullOpenEdges,splitEdge:splitEdge,removePolygons:removePolygons,addPolygon:addPolygon}=require("./edges"),repairTjunctions=(o,e)=>{const l=polygonsToEdges(e);let n=cullOpenEdges(l);if(0===n.length)return e;let g=!0;for(;g;){let e=0;for(let g=0;g<n.length;g++){const s=n[g];if(s&&s.polygons&&1===s.polygons.length){const d=splitEdge(n,s,o);if(d){n[g]=null,addPolygon(n,d[0]),addPolygon(n,d[1]),removePolygons(l,s),addPolygon(l,d[0]),addPolygon(l,d[1]),e++;break}}}g=e>0}return(n=n.filter(o=>o&&o.polygons&&1===o.polygons.length)).length>0&&console.warn("Repair of all T-junctions failed:",n.length),e=edgesToPolygons(l)};module.exports=repairTjunctions;
|
|
1702
1628
|
|
|
1703
|
-
},{"./edges":
|
|
1629
|
+
},{"./edges":427}],433:[function(require,module,exports){
|
|
1704
1630
|
const flatten=require("../../utils/flatten"),vec2=require("../../maths/vec2"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),measureEpsilon=require("../../measurements/measureEpsilon"),snapPolygons=require("./snapPolygons"),snapPath2=e=>{const s=measureEpsilon(e),r=path2.toPoints(e).map(e=>vec2.snap(vec2.create(),e,s));return path2.create(r)},snapGeom2=e=>{const s=measureEpsilon(e);let r=geom2.toSides(e).map(e=>[vec2.snap(vec2.create(),e[0],s),vec2.snap(vec2.create(),e[1],s)]);return r=r.filter(e=>!vec2.equals(e[0],e[1])),geom2.create(r)},snapGeom3=e=>{const s=measureEpsilon(e),r=geom3.toPolygons(e),o=snapPolygons(s,r);return geom3.create(o)},snap=(...e)=>{if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const s=e.map(e=>path2.isA(e)?snapPath2(e):geom2.isA(e)?snapGeom2(e):geom3.isA(e)?snapGeom3(e):e);return 1===s.length?s[0]:s};module.exports=snap;
|
|
1705
1631
|
|
|
1706
|
-
},{"../../geometries/geom2":
|
|
1632
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../maths/vec2":282,"../../measurements/measureEpsilon":350,"../../utils/flatten":473,"./snapPolygons":434}],434:[function(require,module,exports){
|
|
1707
1633
|
const vec3=require("../../maths/vec3"),poly3=require("../../geometries/poly3"),isValidPoly3=(e,o)=>{const r=poly3.measureArea(o);return Number.isFinite(r)&&r>e},snapPolygons=(e,o)=>{let r=o.map(o=>{const r=o.vertices.map(o=>vec3.snap(vec3.create(),o,e)),t=[];for(let e=0;e<r.length;e++){const o=(e+1)%r.length;vec3.equals(r[e],r[o])||t.push(r[e])}const s=poly3.create(t);return o.color&&(s.color=o.color),s});const t=e*e*Math.sqrt(3)/4;return r=r.filter(e=>isValidPoly3(t,e))};module.exports=snapPolygons;
|
|
1708
1634
|
|
|
1709
|
-
},{"../../geometries/poly3":
|
|
1635
|
+
},{"../../geometries/poly3":173,"../../maths/vec3":313}],435:[function(require,module,exports){
|
|
1710
1636
|
const vec3=require("../../maths/vec3"),poly3=require("../../geometries/poly3"),triangulatePolygon=(o,e,r)=>{const t=e.vertices.length;if(t>3){if(t>4){const c=[0,0,0];e.vertices.forEach(o=>vec3.add(c,c,o)),vec3.snap(c,vec3.divide(c,c,[t,t,t]),o);for(let o=0;o<t;o++){const s=poly3.fromPoints([c,e.vertices[o],e.vertices[(o+1)%t]]);e.color&&(s.color=e.color),r.push(s)}return}const c=poly3.fromPoints([e.vertices[0],e.vertices[1],e.vertices[2]]),s=poly3.fromPoints([e.vertices[0],e.vertices[2],e.vertices[3]]);return e.color&&(c.color=e.color,s.color=e.color),void r.push(c,s)}r.push(e)},triangulatePolygons=(o,e)=>{const r=[];return e.forEach(e=>{triangulatePolygon(o,e,r)}),r};module.exports=triangulatePolygons;
|
|
1711
1637
|
|
|
1712
|
-
},{"../../geometries/poly3":
|
|
1638
|
+
},{"../../geometries/poly3":173,"../../maths/vec3":313}],436:[function(require,module,exports){
|
|
1713
1639
|
const flatten=require("../../utils/flatten"),padArrayToLength=require("../../utils/padArrayToLength"),measureAggregateBoundingBox=require("../../measurements/measureAggregateBoundingBox"),{translate:translate}=require("./translate"),validateOptions=e=>{if(!Array.isArray(e.modes)||e.modes.length>3)throw new Error("align(): modes must be an array of length <= 3");if(e.modes=padArrayToLength(e.modes,"none",3),3!==e.modes.filter(e=>["center","max","min","none"].includes(e)).length)throw new Error('align(): all modes must be one of "center", "max" or "min"');if(!Array.isArray(e.relativeTo)||e.relativeTo.length>3)throw new Error("align(): relativeTo must be an array of length <= 3");if(e.relativeTo=padArrayToLength(e.relativeTo,0,3),3!==e.relativeTo.filter(e=>Number.isFinite(e)||null==e).length)throw new Error("align(): all relativeTo values must be a number, or null.");if("boolean"!=typeof e.grouped)throw new Error("align(): grouped must be a boolean value.");return e},populateRelativeToFromBounds=(e,r,t)=>{for(let n=0;n<3;n++)null==e[n]&&("center"===r[n]?e[n]=(t[0][n]+t[1][n])/2:"max"===r[n]?e[n]=t[1][n]:"min"===r[n]&&(e[n]=t[0][n]));return e},alignGeometries=(e,r,t)=>{const n=measureAggregateBoundingBox(e),o=[0,0,0];for(let e=0;e<3;e++)"center"===r[e]?o[e]=t[e]-(n[0][e]+n[1][e])/2:"max"===r[e]?o[e]=t[e]-n[1][e]:"min"===r[e]&&(o[e]=t[e]-n[0][e]);return translate(o,e)},align=(e,...r)=>{e=Object.assign({},{modes:["center","center","min"],relativeTo:[0,0,0],grouped:!1},e),e=validateOptions(e);let{modes:t,relativeTo:n,grouped:o}=e;if(0===(r=flatten(r)).length)throw new Error("align(): No geometries were provided to act upon");if(n.filter(e=>null==e).length){const e=measureAggregateBoundingBox(r);n=populateRelativeToFromBounds(n,t,e)}return 1===(r=o?alignGeometries(r,t,n):r.map(e=>alignGeometries(e,t,n))).length?r[0]:r};module.exports=align;
|
|
1714
1640
|
|
|
1715
|
-
},{"../../measurements/measureAggregateBoundingBox":
|
|
1641
|
+
},{"../../measurements/measureAggregateBoundingBox":345,"../../utils/flatten":473,"../../utils/padArrayToLength":477,"./translate":443}],437:[function(require,module,exports){
|
|
1716
1642
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),measureBoundingBox=require("../../measurements/measureBoundingBox"),{translate:translate}=require("./translate"),centerGeometry=(e,r)=>{const{axes:t,relativeTo:n}=Object.assign({},{axes:[!0,!0,!0],relativeTo:[0,0,0]},e),a=measureBoundingBox(r),o=[0,0,0];return t[0]&&(o[0]=n[0]-(a[0][0]+(a[1][0]-a[0][0])/2)),t[1]&&(o[1]=n[1]-(a[0][1]+(a[1][1]-a[0][1])/2)),t[2]&&(o[2]=n[2]-(a[0][2]+(a[1][2]-a[0][2])/2)),translate(o,r)},center=(e,...r)=>{const{axes:t,relativeTo:n}=Object.assign({},{axes:[!0,!0,!0],relativeTo:[0,0,0]},e);if(0===(r=flatten(r)).length)throw new Error("wrong number of arguments");if(3!==n.length)throw new Error("relativeTo must be an array of length 3");e={axes:t,relativeTo:n};const a=r.map(r=>path2.isA(r)?centerGeometry(e,r):geom2.isA(r)?centerGeometry(e,r):geom3.isA(r)?centerGeometry(e,r):r);return 1===a.length?a[0]:a},centerX=(...e)=>center({axes:[!0,!1,!1]},e),centerY=(...e)=>center({axes:[!1,!0,!1]},e),centerZ=(...e)=>center({axes:[!1,!1,!0]},e);module.exports={center:center,centerX:centerX,centerY:centerY,centerZ:centerZ};
|
|
1717
1643
|
|
|
1718
|
-
},{"../../geometries/geom2":
|
|
1644
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../measurements/measureBoundingBox":349,"../../utils/flatten":473,"./translate":443}],438:[function(require,module,exports){
|
|
1719
1645
|
module.exports={align:require("./align"),center:require("./center").center,centerX:require("./center").centerX,centerY:require("./center").centerY,centerZ:require("./center").centerZ,mirror:require("./mirror").mirror,mirrorX:require("./mirror").mirrorX,mirrorY:require("./mirror").mirrorY,mirrorZ:require("./mirror").mirrorZ,rotate:require("./rotate").rotate,rotateX:require("./rotate").rotateX,rotateY:require("./rotate").rotateY,rotateZ:require("./rotate").rotateZ,scale:require("./scale").scale,scaleX:require("./scale").scaleX,scaleY:require("./scale").scaleY,scaleZ:require("./scale").scaleZ,transform:require("./transform"),translate:require("./translate").translate,translateX:require("./translate").translateX,translateY:require("./translate").translateY,translateZ:require("./translate").translateZ};
|
|
1720
1646
|
|
|
1721
|
-
},{"./align":
|
|
1647
|
+
},{"./align":436,"./center":437,"./mirror":439,"./rotate":440,"./scale":441,"./transform":442,"./translate":443}],439:[function(require,module,exports){
|
|
1722
1648
|
const flatten=require("../../utils/flatten"),mat4=require("../../maths/mat4"),plane=require("../../maths/plane"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),mirror=(r,...e)=>{const{origin:o,normal:m}=Object.assign({},{origin:[0,0,0],normal:[0,0,1]},r);if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");const i=plane.fromNormalAndPoint(plane.create(),m,o);if(Number.isNaN(i[0]))throw new Error("the given origin and normal do not define a proper plane");const n=mat4.mirrorByPlane(mat4.create(),i),t=e.map(r=>path2.isA(r)?path2.transform(n,r):geom2.isA(r)?geom2.transform(n,r):geom3.isA(r)?geom3.transform(n,r):r);return 1===t.length?t[0]:t},mirrorX=(...r)=>mirror({normal:[1,0,0]},r),mirrorY=(...r)=>mirror({normal:[0,1,0]},r),mirrorZ=(...r)=>mirror({normal:[0,0,1]},r);module.exports={mirror:mirror,mirrorX:mirrorX,mirrorY:mirrorY,mirrorZ:mirrorZ};
|
|
1723
1649
|
|
|
1724
|
-
},{"../../geometries/geom2":
|
|
1650
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../maths/mat4":237,"../../maths/plane":255,"../../utils/flatten":473}],440:[function(require,module,exports){
|
|
1725
1651
|
const flatten=require("../../utils/flatten"),mat4=require("../../maths/mat4"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),rotate=(t,...e)=>{if(!Array.isArray(t))throw new Error("angles must be an array");if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const r=t[2],o=t[1],a=t[0],m=mat4.fromTaitBryanRotation(mat4.create(),r,o,a),n=e.map(t=>path2.isA(t)?path2.transform(m,t):geom2.isA(t)?geom2.transform(m,t):geom3.isA(t)?geom3.transform(m,t):t);return 1===n.length?n[0]:n},rotateX=(t,...e)=>rotate([t,0,0],e),rotateY=(t,...e)=>rotate([0,t,0],e),rotateZ=(t,...e)=>rotate([0,0,t],e);module.exports={rotate:rotate,rotateX:rotateX,rotateY:rotateY,rotateZ:rotateZ};
|
|
1726
1652
|
|
|
1727
|
-
},{"../../geometries/geom2":
|
|
1653
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../maths/mat4":237,"../../utils/flatten":473}],441:[function(require,module,exports){
|
|
1728
1654
|
const flatten=require("../../utils/flatten"),mat4=require("../../maths/mat4"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),scale=(e,...r)=>{if(!Array.isArray(e))throw new Error("factors must be an array");if(0===(r=flatten(r)).length)throw new Error("wrong number of arguments");for(e=e.slice();e.length<3;)e.push(1);if(e[0]<=0||e[1]<=0||e[2]<=0)throw new Error("factors must be positive");const a=mat4.fromScaling(mat4.create(),e),t=r.map(e=>path2.isA(e)?path2.transform(a,e):geom2.isA(e)?geom2.transform(a,e):geom3.isA(e)?geom3.transform(a,e):e);return 1===t.length?t[0]:t},scaleX=(e,...r)=>scale([e,1,1],r),scaleY=(e,...r)=>scale([1,e,1],r),scaleZ=(e,...r)=>scale([1,1,e],r);module.exports={scale:scale,scaleX:scaleX,scaleY:scaleY,scaleZ:scaleZ};
|
|
1729
1655
|
|
|
1730
|
-
},{"../../geometries/geom2":
|
|
1656
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../maths/mat4":237,"../../utils/flatten":473}],442:[function(require,module,exports){
|
|
1731
1657
|
const flatten=require("../../utils/flatten"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),transform=(e,...r)=>{if(0===(r=flatten(r)).length)throw new Error("wrong number of arguments");const t=r.map(r=>path2.isA(r)?path2.transform(e,r):geom2.isA(r)?geom2.transform(e,r):geom3.isA(r)?geom3.transform(e,r):r);return 1===t.length?t[0]:t};module.exports=transform;
|
|
1732
1658
|
|
|
1733
|
-
},{"../../geometries/geom2":
|
|
1659
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../utils/flatten":473}],443:[function(require,module,exports){
|
|
1734
1660
|
const flatten=require("../../utils/flatten"),mat4=require("../../maths/mat4"),geom2=require("../../geometries/geom2"),geom3=require("../../geometries/geom3"),path2=require("../../geometries/path2"),translate=(t,...e)=>{if(!Array.isArray(t))throw new Error("offset must be an array");if(0===(e=flatten(e)).length)throw new Error("wrong number of arguments");for(t=t.slice();t.length<3;)t.push(0);const r=mat4.fromTranslation(mat4.create(),t),a=e.map(t=>path2.isA(t)?path2.transform(r,t):geom2.isA(t)?geom2.transform(r,t):geom3.isA(t)?geom3.transform(r,t):t);return 1===a.length?a[0]:a},translateX=(t,...e)=>translate([t,0,0],e),translateY=(t,...e)=>translate([0,t,0],e),translateZ=(t,...e)=>translate([0,0,t],e);module.exports={translate:translate,translateX:translateX,translateY:translateY,translateZ:translateZ};
|
|
1735
1661
|
|
|
1736
|
-
},{"../../geometries/geom2":
|
|
1662
|
+
},{"../../geometries/geom2":122,"../../geometries/geom3":136,"../../geometries/path2":157,"../../maths/mat4":237,"../../utils/flatten":473}],444:[function(require,module,exports){
|
|
1737
1663
|
const{EPS:EPS}=require("../maths/constants"),vec2=require("../maths/vec2"),path2=require("../geometries/path2"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),arc=e=>{const r={center:[0,0],radius:1,startAngle:0,endAngle:2*Math.PI,makeTangent:!1,segments:32};let{center:t,radius:s,startAngle:a,endAngle:n,makeTangent:o,segments:c}=Object.assign({},r,e);if(!isNumberArray(t,2))throw new Error("center must be an array of X and Y values");if(!isGT(s,0))throw new Error("radius must be greater than zero");if(!isGTE(a,0))throw new Error("startAngle must be positive");if(!isGTE(n,0))throw new Error("endAngle must be positive");if(!isGTE(c,4))throw new Error("segments must be four or more");a%=2*Math.PI,n%=2*Math.PI;let i=2*Math.PI;a<n&&(i=n-a),a>n&&(i=n+(2*Math.PI-a));const m=Math.acos((s*s+s*s-EPS*EPS)/(2*s*s)),h=vec2.clone(t);let l;const u=[];if(i<m)l=vec2.fromAngleRadians(vec2.create(),a),vec2.scale(l,l,s),vec2.add(l,l,h),u.push(l);else{const e=Math.max(1,Math.floor(c*(i/(2*Math.PI))))+1;let r=.5*e/i;r>.25&&(r=.25);const t=o?e+2:e;for(let n=0;n<=t;n++){let t=n;o&&((t=(n-1)*(e-2*r)/e+r)<0&&(t=0),t>e&&(t=e));const c=a+t*(i/e);l=vec2.fromAngleRadians(vec2.create(),c),vec2.scale(l,l,s),vec2.add(l,l,h),u.push(l)}}return path2.fromPoints({close:!1},u)};module.exports=arc;
|
|
1738
1664
|
|
|
1739
|
-
},{"../geometries/path2":
|
|
1665
|
+
},{"../geometries/path2":157,"../maths/constants":187,"../maths/vec2":282,"./commonChecks":446}],445:[function(require,module,exports){
|
|
1740
1666
|
const ellipse=require("./ellipse"),{isGT:isGT}=require("./commonChecks"),circle=e=>{const r={center:[0,0],radius:1,startAngle:0,endAngle:2*Math.PI,segments:32};let{center:s,radius:t,startAngle:n,endAngle:i,segments:l}=Object.assign({},r,e);if(!isGT(t,0))throw new Error("radius must be greater than zero");return ellipse({center:s,radius:t=[t,t],startAngle:n,endAngle:i,segments:l})};module.exports=circle;
|
|
1741
1667
|
|
|
1742
|
-
},{"./commonChecks":
|
|
1668
|
+
},{"./commonChecks":446,"./ellipse":451}],446:[function(require,module,exports){
|
|
1743
1669
|
const isNumberArray=(i,r)=>!!(Array.isArray(i)&&i.length>=r)&&i.every(i=>Number.isFinite(i)),isGT=(i,r)=>Number.isFinite(i)&&i>r,isGTE=(i,r)=>Number.isFinite(i)&&i>=r;module.exports={isNumberArray:isNumberArray,isGT:isGT,isGTE:isGTE};
|
|
1744
1670
|
|
|
1745
|
-
},{}],
|
|
1671
|
+
},{}],447:[function(require,module,exports){
|
|
1746
1672
|
const cuboid=require("./cuboid"),{isGT:isGT}=require("./commonChecks"),cube=e=>{let{center:r,size:i}=Object.assign({},{center:[0,0,0],size:2},e);if(!isGT(i,0))throw new Error("size must be greater than zero");return cuboid({center:r,size:i=[i,i,i]})};module.exports=cube;
|
|
1747
1673
|
|
|
1748
|
-
},{"./commonChecks":
|
|
1674
|
+
},{"./commonChecks":446,"./cuboid":448}],448:[function(require,module,exports){
|
|
1749
1675
|
const geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isNumberArray:isNumberArray}=require("./commonChecks"),cuboid=e=>{const{center:r,size:o}=Object.assign({},{center:[0,0,0],size:[2,2,2]},e);if(!isNumberArray(r,3))throw new Error("center must be an array of X, Y and Z values");if(!isNumberArray(o,3))throw new Error("size must be an array of width, depth and height values");if(!o.every(e=>e>0))throw new Error("size values must be greater than zero");return geom3.create([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(e=>{const t=e[0].map(e=>{return[r[0]+o[0]/2*(2*!!(1&e)-1),r[1]+o[1]/2*(2*!!(2&e)-1),r[2]+o[2]/2*(2*!!(4&e)-1)]});return poly3.fromPoints(t)}))};module.exports=cuboid;
|
|
1750
1676
|
|
|
1751
|
-
},{"../geometries/geom3":
|
|
1677
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"./commonChecks":446}],449:[function(require,module,exports){
|
|
1752
1678
|
const cylinderElliptic=require("./cylinderElliptic"),{isGT:isGT}=require("./commonChecks"),cylinder=e=>{const{center:i,height:r,radius:t,segments:s}=Object.assign({},{center:[0,0,0],height:2,radius:1,segments:32},e);if(!isGT(t,0))throw new Error("radius must be greater than zero");return cylinderElliptic({center:i,height:r,startRadius:[t,t],endRadius:[t,t],segments:s})};module.exports=cylinder;
|
|
1753
1679
|
|
|
1754
|
-
},{"./commonChecks":
|
|
1680
|
+
},{"./commonChecks":446,"./cylinderElliptic":450}],450:[function(require,module,exports){
|
|
1755
1681
|
const{EPS:EPS}=require("../maths/constants"),vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),cylinderElliptic=e=>{const r={center:[0,0,0],height:2,startRadius:[1,1],startAngle:0,endRadius:[1,1],endAngle:2*Math.PI,segments:32};let{center:t,height:s,startRadius:a,startAngle:n,endRadius:o,endAngle:i,segments:u}=Object.assign({},r,e);if(!isNumberArray(t,3))throw new Error("center must be an array of X, Y and Z values");if(!isGT(s,0))throw new Error("height must be greater then zero");if(!isNumberArray(a,2))throw new Error("startRadius must be an array of X and Y values");if(!a.every(e=>e>0))throw new Error("startRadius values must be greater than zero");if(!isNumberArray(o,2))throw new Error("endRadius must be an array of X and Y values");if(!o.every(e=>e>0))throw new Error("endRadius values must be greater than zero");if(!isGTE(n,0))throw new Error("startAngle must be positive");if(!isGTE(i,0))throw new Error("endAngle must be positive");if(!isGTE(u,4))throw new Error("segments must be four or more");n%=2*Math.PI,i%=2*Math.PI;let c=2*Math.PI;n<i&&(c=i-n),n>i&&(c=i+(2*Math.PI-n));const h=Math.min(a[0],a[1],o[0],o[1]),m=Math.acos((h*h+h*h-EPS*EPS)/(2*h*h));if(c<m)throw new Error("startAngle and endAngle do not define a significant rotation");const l=Math.floor(u*(c/(2*Math.PI))),d=vec3.fromValues(0,0,-s/2),v=vec3.fromValues(0,0,s/2),g=vec3.subtract(vec3.create(),v,d),f=vec3.fromValues(1,0,0),E=vec3.fromValues(0,1,0),p=vec3.create(),w=vec3.create(),b=vec3.create(),y=(e,r,t)=>{const s=r*c+n;return vec3.scale(p,f,t[0]*Math.cos(s)),vec3.scale(w,E,t[1]*Math.sin(s)),vec3.add(p,p,w),vec3.scale(b,g,e),vec3.add(b,b,d),vec3.add(vec3.create(),p,b)},A=(...e)=>{const r=e.map(e=>vec3.add(vec3.create(),e,t));return poly3.fromPoints(r)},M=[];for(let e=0;e<l;e++){const r=e/l,t=(e+1)/l;o[0]===a[0]&&o[1]===a[1]?(M.push(A(d,y(0,t,o),y(0,r,o))),M.push(A(y(0,t,o),y(1,t,o),y(1,r,o),y(0,r,o))),M.push(A(v,y(1,r,o),y(1,t,o)))):(a[0]>0&&(M.push(A(d,y(0,t,a),y(0,r,a))),M.push(A(y(0,r,a),y(0,t,a),y(1,r,o)))),o[0]>0&&(M.push(A(v,y(1,r,o),y(1,t,o))),M.push(A(y(1,r,o),y(0,t,a),y(1,t,o)))))}return c<2*Math.PI&&(M.push(A(d,y(0,0,a),v)),M.push(A(y(0,0,a),y(1,0,o),v)),M.push(A(d,v,y(0,1,a))),M.push(A(y(0,1,a),v,y(1,1,o)))),geom3.create(M)};module.exports=cylinderElliptic;
|
|
1756
1682
|
|
|
1757
|
-
},{"../geometries/geom3":
|
|
1683
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"../maths/constants":187,"../maths/vec3":313,"./commonChecks":446}],451:[function(require,module,exports){
|
|
1758
1684
|
const{EPS:EPS}=require("../maths/constants"),vec2=require("../maths/vec2"),geom2=require("../geometries/geom2"),{isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),ellipse=e=>{const r={center:[0,0],radius:[1,1],startAngle:0,endAngle:2*Math.PI,segments:32};let{center:t,radius:s,startAngle:n,endAngle:a,segments:o}=Object.assign({},r,e);if(!isNumberArray(t,2))throw new Error("center must be an array of X and Y values");if(!isNumberArray(s,2))throw new Error("radius must be an array of X and Y values");if(!s.every(e=>e>0))throw new Error("radius values must be greater than zero");if(!isGTE(n,0))throw new Error("startAngle must be positive");if(!isGTE(a,0))throw new Error("endAngle must be positive");if(!isGTE(o,3))throw new Error("segments must be three or more");n%=2*Math.PI,a%=2*Math.PI;let i=2*Math.PI;n<a&&(i=a-n),n>a&&(i=a+(2*Math.PI-n));const h=Math.min(s[0],s[1]);if(i<Math.acos((h*h+h*h-EPS*EPS)/(2*h*h)))throw new Error("startAngle and endAngle do not define a significant rotation");o=Math.floor(o*(i/(2*Math.PI)));const m=vec2.clone(t),u=i/o,l=[];o=i<2*Math.PI?o+1:o;for(let e=0;e<o;e++){const r=u*e+n,t=vec2.fromValues(s[0]*Math.cos(r),s[1]*Math.sin(r));vec2.add(t,m,t),l.push(t)}return i<2*Math.PI&&l.push(m),geom2.fromPoints(l)};module.exports=ellipse;
|
|
1759
1685
|
|
|
1760
|
-
},{"../geometries/geom2":
|
|
1761
|
-
const vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),ellipsoid=e=>{const{center:c,radius:a,segments:r,axes:s}=Object.assign({},{center:[0,0,0],radius:[1,1,1],segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},e);if(!isNumberArray(c,3))throw new Error("center must be an array of X, Y and Z values");if(!isNumberArray(a,3))throw new Error("radius must be an array of X, Y and Z values");if(!a.every(e=>e>0))throw new Error("radius values must be greater than zero");if(!isGTE(r,4))throw new Error("segments must be four or more");const t=vec3.scale(vec3.create(),vec3.
|
|
1686
|
+
},{"../geometries/geom2":122,"../maths/constants":187,"../maths/vec2":282,"./commonChecks":446}],452:[function(require,module,exports){
|
|
1687
|
+
const vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),ellipsoid=e=>{const{center:c,radius:a,segments:r,axes:s}=Object.assign({},{center:[0,0,0],radius:[1,1,1],segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},e);if(!isNumberArray(c,3))throw new Error("center must be an array of X, Y and Z values");if(!isNumberArray(a,3))throw new Error("radius must be an array of X, Y and Z values");if(!a.every(e=>e>0))throw new Error("radius values must be greater than zero");if(!isGTE(r,4))throw new Error("segments must be four or more");const t=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),s[0]),a[0]),v=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),s[1]),a[1]),o=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),s[2]),a[2]),l=Math.round(r/4);let u;const d=[],i=vec3.create(),n=vec3.create();for(let e=0;e<=r;e++){const a=2*Math.PI*e/r,s=vec3.add(vec3.create(),vec3.scale(i,t,Math.cos(a)),vec3.scale(n,v,Math.sin(a)));if(e>0){let e,a;for(let r=0;r<=l;r++){const t=.5*Math.PI*r/l,v=Math.cos(t),m=Math.sin(t);if(r>0){let t,h=[];t=vec3.subtract(vec3.create(),vec3.scale(i,u,e),vec3.scale(n,o,a)),h.push(vec3.add(t,t,c)),t=vec3.subtract(vec3.create(),vec3.scale(i,s,e),vec3.scale(n,o,a)),h.push(vec3.add(t,t,c)),r<l&&(t=vec3.subtract(vec3.create(),vec3.scale(i,s,v),vec3.scale(n,o,m)),h.push(vec3.add(t,t,c))),t=vec3.subtract(vec3.create(),vec3.scale(i,u,v),vec3.scale(n,o,m)),h.push(vec3.add(t,t,c)),d.push(poly3.fromPoints(h)),h=[],t=vec3.add(vec3.create(),vec3.scale(i,u,e),vec3.scale(n,o,a)),h.push(vec3.add(vec3.create(),c,t)),t=vec3.add(t,vec3.scale(i,s,e),vec3.scale(n,o,a)),h.push(vec3.add(vec3.create(),c,t)),r<l&&(t=vec3.add(t,vec3.scale(i,s,v),vec3.scale(n,o,m)),h.push(vec3.add(vec3.create(),c,t))),t=vec3.add(t,vec3.scale(i,u,v),vec3.scale(n,o,m)),h.push(vec3.add(vec3.create(),c,t)),h.reverse(),d.push(poly3.fromPoints(h))}e=v,a=m}}u=s}return geom3.create(d)};module.exports=ellipsoid;
|
|
1762
1688
|
|
|
1763
|
-
},{"../geometries/geom3":
|
|
1689
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"../maths/vec3":313,"./commonChecks":446}],453:[function(require,module,exports){
|
|
1764
1690
|
const mat4=require("../maths/mat4"),geom3=require("../geometries/geom3"),polyhedron=require("./polyhedron"),{isGT:isGT,isGTE:isGTE}=require("./commonChecks"),geodesicSphere=e=>{let{radius:r,frequency:t}=Object.assign({},{radius:1,frequency:6},e);if(!isGT(r,0))throw new Error("radius must be greater than zero");if(!isGTE(t,6))throw new Error("frequency must be six or more");t=Math.floor(t/6);const o=[[.850651,0,-.525731],[.850651,-0,.525731],[-.850651,-0,.525731],[-.850651,0,-.525731],[0,-.525731,.850651],[0,.525731,.850651],[0,.525731,-.850651],[0,-.525731,-.850651],[-.525731,-.850651,-0],[.525731,-.850651,-0],[.525731,.850651,0],[-.525731,.850651,0]],s=[[0,9,1],[1,10,0],[6,7,0],[10,6,0],[7,9,0],[5,1,4],[4,1,9],[5,10,1],[2,8,3],[3,11,2],[2,5,4],[4,8,2],[2,11,5],[3,7,6],[6,11,3],[8,7,3],[9,8,4],[11,10,5],[10,11,6],[8,9,7]],n=(e,r,t)=>{const o=e[0],s=e[1],n=e[2];let c=t;const a=[],f=[];for(let e=0;e<r;e++)for(let t=0;t<r-e;t++){const l=e/r,u=(e+1)/r,h=t/(r-e),m=(t+1)/(r-e),p=r-e-1?t/(r-e-1):1,g=[];g[0]=i(i(o,s,h),n,l),g[1]=i(i(o,s,m),n,l),g[2]=i(i(o,s,p),n,u);for(let e=0;e<3;e++){const r=Math.sqrt(g[e][0]*g[e][0]+g[e][1]*g[e][1]+g[e][2]*g[e][2]);for(let t=0;t<3;t++)g[e][t]/=r}if(a.push(g[0],g[1],g[2]),f.push([c,c+1,c+2]),c+=3,t<r-e-1){const h=r-e-1?(t+1)/(r-e-1):1;g[0]=i(i(o,s,m),n,l),g[1]=i(i(o,s,h),n,u),g[2]=i(i(o,s,p),n,u);for(let e=0;e<3;e++){const r=Math.sqrt(g[e][0]*g[e][0]+g[e][1]*g[e][1]+g[e][2]*g[e][2]);for(let t=0;t<3;t++)g[e][t]/=r}a.push(g[0],g[1],g[2]),f.push([c,c+1,c+2]),c+=3}}return{points:a,triangles:f,offset:c}},i=(e,r,t)=>{const o=1-t,s=[];for(let n=0;n<3;n++)s[n]=e[n]*o+r[n]*t;return s};let c=[],a=[],f=0;for(let e=0;e<s.length;e++){const r=n([o[s[e][0]],o[s[e][1]],o[s[e][2]]],t,f);c=c.concat(r.points),a=a.concat(r.triangles),f=r.offset}let l=polyhedron({points:c,faces:a,orientation:"inward"});return 1!==r&&(l=geom3.transform(mat4.fromScaling(mat4.create(),[r,r,r]),l)),l};module.exports=geodesicSphere;
|
|
1765
1691
|
|
|
1766
|
-
},{"../geometries/geom3":
|
|
1692
|
+
},{"../geometries/geom3":136,"../maths/mat4":237,"./commonChecks":446,"./polyhedron":457}],454:[function(require,module,exports){
|
|
1767
1693
|
module.exports={arc:require("./arc"),circle:require("./circle"),cube:require("./cube"),cuboid:require("./cuboid"),cylinder:require("./cylinder"),cylinderElliptic:require("./cylinderElliptic"),ellipse:require("./ellipse"),ellipsoid:require("./ellipsoid"),geodesicSphere:require("./geodesicSphere"),line:require("./line"),polygon:require("./polygon"),polyhedron:require("./polyhedron"),rectangle:require("./rectangle"),roundedCuboid:require("./roundedCuboid"),roundedCylinder:require("./roundedCylinder"),roundedRectangle:require("./roundedRectangle"),sphere:require("./sphere"),square:require("./square"),star:require("./star"),torus:require("./torus")};
|
|
1768
1694
|
|
|
1769
|
-
},{"./arc":
|
|
1695
|
+
},{"./arc":444,"./circle":445,"./cube":447,"./cuboid":448,"./cylinder":449,"./cylinderElliptic":450,"./ellipse":451,"./ellipsoid":452,"./geodesicSphere":453,"./line":455,"./polygon":456,"./polyhedron":457,"./rectangle":458,"./roundedCuboid":459,"./roundedCylinder":460,"./roundedRectangle":461,"./sphere":462,"./square":463,"./star":464,"./torus":465}],455:[function(require,module,exports){
|
|
1770
1696
|
const path2=require("../geometries/path2"),line=r=>{if(!Array.isArray(r))throw new Error("points must be an array");return path2.fromPoints({},r)};module.exports=line;
|
|
1771
1697
|
|
|
1772
|
-
},{"../geometries/path2":
|
|
1698
|
+
},{"../geometries/path2":157}],456:[function(require,module,exports){
|
|
1773
1699
|
const geom2=require("../geometries/geom2"),polygon=r=>{const{points:o,paths:t}=Object.assign({},{points:[],paths:[]},r);if(!Array.isArray(o)||!Array.isArray(t))throw new Error("points and paths must be arrays");let a=o;Array.isArray(o[0])&&(Array.isArray(o[0][0])||(a=[o])),a.forEach((r,o)=>{if(!Array.isArray(r))throw new Error("list of points "+o+" must be an array");if(r.length<3)throw new Error("list of points "+o+" must contain three or more points");r.forEach((r,t)=>{if(!Array.isArray(r))throw new Error("list of points "+o+", point "+t+" must be an array");if(r.length<2)throw new Error("list of points "+o+", point "+t+" must contain by X and Y values")})});let s=t;if(0===t.length){let r=0;s=a.map(o=>o.map(o=>r++))}const e=[];a.forEach(r=>r.forEach(r=>e.push(r)));let n=[];return s.forEach(r=>{const o=r.map(r=>e[r]),t=geom2.fromPoints(o);n=n.concat(geom2.toSides(t))}),geom2.create(n)};module.exports=polygon;
|
|
1774
1700
|
|
|
1775
|
-
},{"../geometries/geom2":
|
|
1701
|
+
},{"../geometries/geom2":122}],457:[function(require,module,exports){
|
|
1776
1702
|
const geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isNumberArray:isNumberArray}=require("./commonChecks"),polyhedron=r=>{const e={points:[],faces:[],colors:void 0,orientation:"outward"},{points:o,faces:a,colors:t,orientation:n}=Object.assign({},e,r);if(!Array.isArray(o)||!Array.isArray(a))throw new Error("points and faces must be arrays");if(o.length<3)throw new Error("three or more points are required");if(a.length<1)throw new Error("one or more faces are required");if(t){if(!Array.isArray(t))throw new Error("colors must be an array");if(t.length!==a.length)throw new Error("faces and colors must have the same length")}o.forEach((r,e)=>{if(!isNumberArray(r,3))throw new Error(`point ${e} must be an array of X, Y, Z values`)}),a.forEach((r,e)=>{if(r.length<3)throw new Error(`face ${e} must contain 3 or more indexes`);if(!isNumberArray(r,r.length))throw new Error(`face ${e} must be an array of numbers`)}),"outward"!==n&&a.forEach(r=>r.reverse());const s=a.map((r,e)=>{const a=poly3.fromPoints(r.map(r=>o[r]));return t&&t[e]&&(a.color=t[e]),a});return geom3.create(s)};module.exports=polyhedron;
|
|
1777
1703
|
|
|
1778
|
-
},{"../geometries/geom3":
|
|
1704
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"./commonChecks":446}],458:[function(require,module,exports){
|
|
1779
1705
|
const vec2=require("../maths/vec2"),geom2=require("../geometries/geom2"),{isNumberArray:isNumberArray}=require("./commonChecks"),rectangle=e=>{const{center:r,size:t}=Object.assign({},{center:[0,0],size:[2,2]},e);if(!isNumberArray(r,2))throw new Error("center must be an array of X and Y values");if(!isNumberArray(t,2))throw new Error("size must be an array of X and Y values");if(!t.every(e=>e>0))throw new Error("size values must be greater than zero");const a=[t[0]/2,t[1]/2],c=[a[0],-a[1]],s=[vec2.subtract(vec2.create(),r,a),vec2.add(vec2.create(),r,c),vec2.add(vec2.create(),r,a),vec2.subtract(vec2.create(),r,c)];return geom2.fromPoints(s)};module.exports=rectangle;
|
|
1780
1706
|
|
|
1781
|
-
},{"../geometries/geom2":
|
|
1707
|
+
},{"../geometries/geom2":122,"../maths/vec2":282,"./commonChecks":446}],459:[function(require,module,exports){
|
|
1782
1708
|
const{EPS:EPS}=require("../maths/constants"),vec2=require("../maths/vec2"),vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),createCorners=(e,r,t,s,o,c)=>{const a=Math.PI/2*o/s,n=Math.cos(a),i=Math.sin(a),h=s-o;let u=t*n,l=r[2]-(t-t*i);c||(l=t-t*i-r[2]),u=u>EPS?u:0;const m=vec3.add(vec3.create(),e,[r[0]-t,r[1]-t,l]),d=vec3.add(vec3.create(),e,[t-r[0],r[1]-t,l]),v=vec3.add(vec3.create(),e,[t-r[0],t-r[1],l]),f=vec3.add(vec3.create(),e,[r[0]-t,t-r[1],l]),p=[],g=[],E=[],P=[];for(let e=0;e<=h;e++){const r=h>0?Math.PI/2*e/h:0,t=vec2.fromAngleRadians(vec2.create(),r);vec2.scale(t,t,u);const s=vec3.fromVec2(vec3.create(),t);p.push(vec3.add(vec3.create(),m,s)),vec3.rotateZ(s,s,[0,0,0],Math.PI/2),g.push(vec3.add(vec3.create(),d,s)),vec3.rotateZ(s,s,[0,0,0],Math.PI/2),E.push(vec3.add(vec3.create(),v,s)),vec3.rotateZ(s,s,[0,0,0],Math.PI/2),P.push(vec3.add(vec3.create(),f,s))}return c?[p,g,E,P]:(p.reverse(),g.reverse(),E.reverse(),P.reverse(),[P,E,g,p])},stitchCorners=(e,r)=>{const t=[];for(let s=0;s<e.length;s++){const o=e[s],c=r[s];for(let e=0;e<o.length-1;e++)t.push(poly3.fromPoints([o[e],o[e+1],c[e]])),e<c.length-1&&t.push(poly3.fromPoints([c[e],o[e+1],c[e+1]]))}return t},stitchWalls=(e,r)=>{const t=[];for(let s=0;s<e.length;s++){let o=e[s],c=r[s];const a=o[o.length-1],n=c[c.length-1],i=(s+1)%e.length;o=e[i],c=r[i];const h=o[0],u=c[0];t.push(poly3.fromPoints([a,h,u,n]))}return t},stitchSides=(e,r)=>{e=(e=[e[3],e[2],e[1],e[0]]).map(e=>e.slice().reverse());const t=[];e.forEach(e=>{e.forEach(e=>t.push(e))});const s=[];r.forEach(e=>{e.forEach(e=>s.push(e))});const o=[];for(let e=0;e<s.length;e++){const r=(e+1)%s.length;o.push(poly3.fromPoints([t[e],t[r],s[r],s[e]]))}return o},roundedCuboid=e=>{let{center:r,size:t,roundRadius:s,segments:o}=Object.assign({},{center:[0,0,0],size:[2,2,2],roundRadius:.2,segments:32},e);if(!isNumberArray(r,3))throw new Error("center must be an array of X, Y and Z values");if(!isNumberArray(t,3))throw new Error("size must be an array of X, Y and Z values");if(!t.every(e=>e>0))throw new Error("size values must be greater than zero");if(!isGT(s,0))throw new Error("roundRadius must be greater than zero");if(!isGTE(o,4))throw new Error("segments must be four or more");if(s>(t=t.map(e=>e/2))[0]-EPS||s>t[1]-EPS||s>t[2]-EPS)throw new Error("roundRadius must be smaller then the radius of all dimensions");o=Math.floor(o/4);let c=null,a=null,n=[];for(let e=0;e<=o;e++){const i=createCorners(r,t,s,o,e,!0),h=createCorners(r,t,s,o,e,!1);if(0===e&&(n=n.concat(stitchSides(h,i))),c&&(n=n.concat(stitchCorners(c,i),stitchWalls(c,i))),a&&(n=n.concat(stitchCorners(a,h),stitchWalls(a,h))),e===o){let e=i.map(e=>e[0]);n.push(poly3.fromPoints(e)),e=h.map(e=>e[0]),n.push(poly3.fromPoints(e))}c=i,a=h}return geom3.create(n)};module.exports=roundedCuboid;
|
|
1783
1709
|
|
|
1784
|
-
},{"../geometries/geom3":
|
|
1785
|
-
const{EPS:EPS}=require("../maths/constants"),vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),roundedCylinder=e=>{const{center:c,height:r,radius:a,roundRadius:s,segments:t}=Object.assign({},{center:[0,0,0],height:2,radius:1,roundRadius:.2,segments:32},e);if(!isNumberArray(c,3))throw new Error("center must be an array of X, Y and Z values");if(!isGT(r,0))throw new Error("height must be greater then zero");if(!isGT(a,0))throw new Error("radius must be greater then zero");if(!isGT(s,0))throw new Error("roundRadius must be greater then zero");if(s>a-EPS)throw new Error("roundRadius must be smaller then the radius");if(!isGTE(t,4))throw new Error("segments must be four or more");const v=[0,0,-r/2],
|
|
1710
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"../maths/constants":187,"../maths/vec2":282,"../maths/vec3":313,"./commonChecks":446}],460:[function(require,module,exports){
|
|
1711
|
+
const{EPS:EPS}=require("../maths/constants"),vec3=require("../maths/vec3"),geom3=require("../geometries/geom3"),poly3=require("../geometries/poly3"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),roundedCylinder=e=>{const{center:c,height:r,radius:a,roundRadius:s,segments:t}=Object.assign({},{center:[0,0,0],height:2,radius:1,roundRadius:.2,segments:32},e);if(!isNumberArray(c,3))throw new Error("center must be an array of X, Y and Z values");if(!isGT(r,0))throw new Error("height must be greater then zero");if(!isGT(a,0))throw new Error("radius must be greater then zero");if(!isGT(s,0))throw new Error("roundRadius must be greater then zero");if(s>a-EPS)throw new Error("roundRadius must be smaller then the radius");if(!isGTE(t,4))throw new Error("segments must be four or more");const v=[0,0,-r/2],o=[0,0,r/2],d=vec3.subtract(vec3.create(),o,v);if(2*s>vec3.length(d)-EPS)throw new Error("height must be larger than twice roundRadius");let u;u=Math.abs(d[0])>Math.abs(d[1])?vec3.fromValues(0,1,0):vec3.fromValues(1,0,0);const i=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),d),s),n=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),vec3.cross(vec3.create(),i,u)),a),h=vec3.scale(vec3.create(),vec3.normalize(vec3.create(),vec3.cross(vec3.create(),n,i)),a);vec3.add(v,v,i),vec3.subtract(o,o,i);const l=Math.floor(.25*t),m=e=>{const r=e.map(e=>vec3.add(e,e,c));return poly3.fromPoints(r)},p=[],b=vec3.create(),g=vec3.create();let f;for(let e=0;e<=t;e++){const c=2*Math.PI*e/t,r=vec3.add(vec3.create(),vec3.scale(b,n,Math.cos(c)),vec3.scale(g,h,Math.sin(c)));if(e>0){let e,c,a=[];a.push(vec3.add(vec3.create(),v,r)),a.push(vec3.add(vec3.create(),v,f)),a.push(vec3.add(vec3.create(),o,f)),a.push(vec3.add(vec3.create(),o,r)),p.push(m(a));for(let s=0;s<=l;s++){const t=.5*Math.PI*s/l,d=Math.cos(t),u=Math.sin(t);if(s>0){let t;a=[],t=vec3.add(vec3.create(),v,vec3.subtract(b,vec3.scale(b,f,e),vec3.scale(g,i,c))),a.push(t),t=vec3.add(vec3.create(),v,vec3.subtract(b,vec3.scale(b,r,e),vec3.scale(g,i,c))),a.push(t),s<l&&(t=vec3.add(vec3.create(),v,vec3.subtract(b,vec3.scale(b,r,d),vec3.scale(g,i,u))),a.push(t)),t=vec3.add(vec3.create(),v,vec3.subtract(b,vec3.scale(b,f,d),vec3.scale(g,i,u))),a.push(t),p.push(m(a)),a=[],t=vec3.add(vec3.create(),vec3.scale(b,f,e),vec3.scale(g,i,c)),vec3.add(t,t,o),a.push(t),t=vec3.add(vec3.create(),vec3.scale(b,r,e),vec3.scale(g,i,c)),vec3.add(t,t,o),a.push(t),s<l&&(t=vec3.add(vec3.create(),vec3.scale(b,r,d),vec3.scale(g,i,u)),vec3.add(t,t,o),a.push(t)),t=vec3.add(vec3.create(),vec3.scale(b,f,d),vec3.scale(g,i,u)),vec3.add(t,t,o),a.push(t),a.reverse(),p.push(m(a))}e=d,c=u}}f=r}return geom3.create(p)};module.exports=roundedCylinder;
|
|
1786
1712
|
|
|
1787
|
-
},{"../geometries/geom3":
|
|
1713
|
+
},{"../geometries/geom3":136,"../geometries/poly3":173,"../maths/constants":187,"../maths/vec3":313,"./commonChecks":446}],461:[function(require,module,exports){
|
|
1788
1714
|
const{EPS:EPS}=require("../maths/constants"),vec2=require("../maths/vec2"),geom2=require("../geometries/geom2"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),roundedRectangle=e=>{let{center:r,size:a,roundRadius:t,segments:s}=Object.assign({},{center:[0,0],size:[2,2],roundRadius:.2,segments:32},e);if(!isNumberArray(r,2))throw new Error("center must be an array of X and Y values");if(!isNumberArray(a,2))throw new Error("size must be an array of X and Y values");if(!a.every(e=>e>0))throw new Error("size values must be greater than zero");if(!isGT(t,0))throw new Error("roundRadius must be greater than zero");if(!isGTE(s,4))throw new Error("segments must be four or more");if(t>(a=a.map(e=>e/2))[0]-EPS||t>a[1]-EPS)throw new Error("roundRadius must be smaller then the radius of all dimensions");const c=Math.floor(s/4),o=vec2.add(vec2.create(),r,[a[0]-t,a[1]-t]),n=vec2.add(vec2.create(),r,[t-a[0],a[1]-t]),i=vec2.add(vec2.create(),r,[t-a[0],t-a[1]]),u=vec2.add(vec2.create(),r,[a[0]-t,t-a[1]]),d=[],v=[],m=[],h=[];for(let e=0;e<=c;e++){const r=Math.PI/2*e/c,a=vec2.fromAngleRadians(vec2.create(),r);vec2.scale(a,a,t),d.push(vec2.add(vec2.create(),o,a)),vec2.rotate(a,a,vec2.create(),Math.PI/2),v.push(vec2.add(vec2.create(),n,a)),vec2.rotate(a,a,vec2.create(),Math.PI/2),m.push(vec2.add(vec2.create(),i,a)),vec2.rotate(a,a,vec2.create(),Math.PI/2),h.push(vec2.add(vec2.create(),u,a))}return geom2.fromPoints(d.concat(v,m,h))};module.exports=roundedRectangle;
|
|
1789
1715
|
|
|
1790
|
-
},{"../geometries/geom2":
|
|
1716
|
+
},{"../geometries/geom2":122,"../maths/constants":187,"../maths/vec2":282,"./commonChecks":446}],462:[function(require,module,exports){
|
|
1791
1717
|
const ellipsoid=require("./ellipsoid"),{isGT:isGT}=require("./commonChecks"),sphere=e=>{let{center:s,radius:r,segments:i,axes:t}=Object.assign({},{center:[0,0,0],radius:1,segments:32,axes:[[1,0,0],[0,-1,0],[0,0,1]]},e);if(!isGT(r,0))throw new Error("radius must be greater than zero");return ellipsoid({center:s,radius:r=[r,r,r],segments:i,axes:t})};module.exports=sphere;
|
|
1792
1718
|
|
|
1793
|
-
},{"./commonChecks":
|
|
1719
|
+
},{"./commonChecks":446,"./ellipsoid":452}],463:[function(require,module,exports){
|
|
1794
1720
|
const rectangle=require("./rectangle"),{isGT:isGT}=require("./commonChecks"),square=e=>{let{center:r,size:s}=Object.assign({},{center:[0,0],size:2},e);if(!isGT(s,0))throw new Error("size must be greater than zero");return rectangle({center:r,size:s=[s,s]})};module.exports=square;
|
|
1795
1721
|
|
|
1796
|
-
},{"./commonChecks":
|
|
1722
|
+
},{"./commonChecks":446,"./rectangle":458}],464:[function(require,module,exports){
|
|
1797
1723
|
const vec2=require("../maths/vec2"),geom2=require("../geometries/geom2"),{isGT:isGT,isGTE:isGTE,isNumberArray:isNumberArray}=require("./commonChecks"),getRadiusRatio=(e,r)=>e>0&&r>1&&r<e/2?Math.cos(Math.PI*r/e)/Math.cos(Math.PI*(r-1)/e):0,getPoints=(e,r,t,s)=>{const o=2*Math.PI/e,i=[];for(let a=0;a<e;a++){const e=vec2.fromAngleRadians(vec2.create(),o*a+t);vec2.scale(e,e,r),vec2.add(e,s,e),i.push(e)}return i},star=e=>{let{center:r,vertices:t,outerRadius:s,innerRadius:o,density:i,startAngle:a}=Object.assign({},{center:[0,0],vertices:5,outerRadius:1,innerRadius:0,density:2,startAngle:0},e);if(!isNumberArray(r,2))throw new Error("center must be an array of X and Y values");if(!isGTE(t,2))throw new Error("vertices must be two or more");if(!isGT(s,0))throw new Error("outerRadius must be greater than zero");if(!isGTE(o,0))throw new Error("innerRadius must be greater than zero");if(!isGTE(a,0))throw new Error("startAngle must be greater than zero");if(t=Math.floor(t),i=Math.floor(i),a%=2*Math.PI,0===o){if(!isGTE(i,2))throw new Error("density must be two or more");o=s*getRadiusRatio(t,i)}const n=vec2.clone(r),u=getPoints(t,s,a,n),c=getPoints(t,o,a+Math.PI/t,n),h=[];for(let e=0;e<t;e++)h.push(u[e]),h.push(c[e]);return geom2.fromPoints(h)};module.exports=star;
|
|
1798
1724
|
|
|
1799
|
-
},{"../geometries/geom2":
|
|
1725
|
+
},{"../geometries/geom2":122,"../maths/vec2":282,"./commonChecks":446}],465:[function(require,module,exports){
|
|
1800
1726
|
const extrudeRotate=require("../operations/extrusions/extrudeRotate"),{rotate:rotate}=require("../operations/transforms/rotate"),{translate:translate}=require("../operations/transforms/translate"),circle=require("./circle"),{isGT:isGT,isGTE:isGTE}=require("./commonChecks"),torus=e=>{const r={innerRadius:1,innerSegments:32,outerRadius:4,outerSegments:32,innerRotation:0,startAngle:0,outerRotation:2*Math.PI},{innerRadius:t,innerSegments:o,outerRadius:n,outerSegments:s,innerRotation:i,startAngle:a,outerRotation:u}=Object.assign({},r,e);if(!isGT(t,0))throw new Error("innerRadius must be greater than zero");if(!isGTE(o,3))throw new Error("innerSegments must be three or more");if(!isGT(n,0))throw new Error("outerRadius must be greater than zero");if(!isGTE(s,3))throw new Error("outerSegments must be three or more");if(!isGTE(a,0))throw new Error("startAngle must be positive");if(!isGT(u,0))throw new Error("outerRotation must be greater than zero");if(t>=n)throw new Error("inner circle is two large to rotate about the outer circle");let m=circle({radius:t,segments:o});return 0!==i&&(m=rotate([0,0,i],m)),m=translate([n,0],m),extrudeRotate({startAngle:a,angle:u,segments:s},m)};module.exports=torus;
|
|
1801
1727
|
|
|
1802
|
-
},{"../operations/extrusions/extrudeRotate":
|
|
1728
|
+
},{"../operations/extrusions/extrudeRotate":395,"../operations/transforms/rotate":440,"../operations/transforms/translate":443,"./circle":445,"./commonChecks":446}],466:[function(require,module,exports){
|
|
1803
1729
|
module.exports={height:14,32:[16],33:[10,5,21,5,7,void 0,5,2,4,1,5,0,6,1,5,2],34:[16,4,21,4,14,void 0,12,21,12,14],35:[21,11,25,4,-7,void 0,17,25,10,-7,void 0,4,12,18,12,void 0,3,6,17,6],36:[20,8,25,8,-4,void 0,12,25,12,-4,void 0,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3],37:[24,21,21,3,0,void 0,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,void 0,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7],38:[26,23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2],39:[10,5,19,4,20,5,21,6,20,6,18,5,16,4,15],40:[14,11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7],41:[14,3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7],42:[16,8,21,8,9,void 0,3,18,13,12,void 0,13,18,3,12],43:[26,13,18,13,0,void 0,4,9,22,9],44:[10,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4],45:[26,4,9,22,9],46:[10,5,2,4,1,5,0,6,1,5,2],47:[22,20,25,2,-7],48:[20,9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21],49:[20,6,17,8,18,11,21,11,0],50:[20,4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0],51:[20,5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4],52:[20,13,21,3,7,18,7,void 0,13,21,13,0],53:[20,15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4],54:[20,16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7],55:[20,17,21,7,0,void 0,3,21,17,21],56:[20,8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21],57:[20,16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3],58:[10,5,14,4,13,5,12,6,13,5,14,void 0,5,2,4,1,5,0,6,1,5,2],59:[10,5,14,4,13,5,12,6,13,5,14,void 0,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4],60:[24,20,18,4,9,20,0],61:[26,4,12,22,12,void 0,4,6,22,6],62:[24,4,18,20,9,4,0],63:[18,3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,void 0,9,2,8,1,9,0,10,1,9,2],64:[27,18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,void 0,12,16,10,14,9,11,9,8,10,6,11,5,void 0,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,void 0,19,16,18,8,18,6,19,5],65:[18,9,21,1,0,void 0,9,21,17,0,void 0,4,7,14,7],66:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,void 0,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0],67:[21,18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5],68:[21,4,21,4,0,void 0,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0],69:[19,4,21,4,0,void 0,4,21,17,21,void 0,4,11,12,11,void 0,4,0,17,0],70:[18,4,21,4,0,void 0,4,21,17,21,void 0,4,11,12,11],71:[21,18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,void 0,13,8,18,8],72:[22,4,21,4,0,void 0,18,21,18,0,void 0,4,11,18,11],73:[8,4,21,4,0],74:[16,12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7],75:[21,4,21,4,0,void 0,18,21,4,7,void 0,9,12,18,0],76:[17,4,21,4,0,void 0,4,0,16,0],77:[24,4,21,4,0,void 0,4,21,12,0,void 0,20,21,12,0,void 0,20,21,20,0],78:[22,4,21,4,0,void 0,4,21,18,0,void 0,18,21,18,0],79:[22,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21],80:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10],81:[22,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,void 0,12,4,18,-2],82:[21,4,21,4,0,void 0,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,void 0,11,11,18,0],83:[20,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3],84:[16,8,21,8,0,void 0,1,21,15,21],85:[22,4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21],86:[18,1,21,9,0,void 0,17,21,9,0],87:[24,2,21,7,0,void 0,12,21,7,0,void 0,12,21,17,0,void 0,22,21,17,0],88:[20,3,21,17,0,void 0,17,21,3,0],89:[18,1,21,9,11,9,0,void 0,17,21,9,11],90:[20,17,21,3,0,void 0,3,21,17,21,void 0,3,0,17,0],91:[14,4,25,4,-7,void 0,5,25,5,-7,void 0,4,25,11,25,void 0,4,-7,11,-7],92:[14,0,21,14,-3],93:[14,9,25,9,-7,void 0,10,25,10,-7,void 0,3,25,10,25,void 0,3,-7,10,-7],94:[16,6,15,8,18,10,15,void 0,3,12,8,17,13,12,void 0,8,17,8,0],95:[16,0,-2,16,-2],96:[10,6,21,5,20,4,18,4,16,5,15,6,16,5,17],97:[19,15,14,15,0,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],98:[19,4,21,4,0,void 0,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3],99:[18,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],100:[19,15,21,15,0,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],101:[18,3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],102:[12,10,21,8,21,6,20,5,17,5,0,void 0,2,14,9,14],103:[19,15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],104:[19,4,21,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0],105:[8,3,21,4,20,5,21,4,22,3,21,void 0,4,14,4,0],106:[10,5,21,6,20,7,21,6,22,5,21,void 0,6,14,6,-3,5,-6,3,-7,1,-7],107:[17,4,21,4,0,void 0,14,14,4,4,void 0,8,8,15,0],108:[8,4,21,4,0],109:[30,4,14,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0,void 0,15,10,18,13,20,14,23,14,25,13,26,10,26,0],110:[19,4,14,4,0,void 0,4,10,7,13,9,14,12,14,14,13,15,10,15,0],111:[19,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14],112:[19,4,14,4,-7,void 0,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3],113:[19,15,14,15,-7,void 0,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3],114:[13,4,14,4,0,void 0,4,8,5,11,7,13,9,14,12,14],115:[17,14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3],116:[12,5,21,5,4,6,1,8,0,10,0,void 0,2,14,9,14],117:[19,4,14,4,4,5,1,7,0,10,0,12,1,15,4,void 0,15,14,15,0],118:[16,2,14,8,0,void 0,14,14,8,0],119:[22,3,14,7,0,void 0,11,14,7,0,void 0,11,14,15,0,void 0,19,14,15,0],120:[17,3,14,14,0,void 0,14,14,3,0],121:[16,2,14,8,0,void 0,14,14,8,0,6,-4,4,-6,2,-7,1,-7],122:[17,14,14,3,0,void 0,3,14,14,14,void 0,3,0,14,0],123:[14,9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,void 0,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,void 0,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7],124:[8,4,25,4,-7],125:[14,5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,void 0,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,void 0,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7],126:[24,3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,void 0,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]};
|
|
1804
1730
|
|
|
1805
|
-
},{}],
|
|
1731
|
+
},{}],467:[function(require,module,exports){
|
|
1806
1732
|
module.exports={vectorChar:require("./vectorChar"),vectorText:require("./vectorText")};
|
|
1807
1733
|
|
|
1808
|
-
},{"./vectorChar":
|
|
1734
|
+
},{"./vectorChar":468,"./vectorText":470}],468:[function(require,module,exports){
|
|
1809
1735
|
const vectorParams=require("./vectorParams"),vectorChar=(t,e)=>{const{xOffset:r,yOffset:s,input:h,font:o,height:c,extrudeOffset:n}=vectorParams(t,e);let a=h.charCodeAt(0);a&&o[a]||(a=63);const f=[].concat(o[a]),i=(c-n)/o.height,u=n/2,g=f.shift()*i,l=[];let v=[];for(let t=0,e=f.length;t<e;t+=2){const e=i*f[t]+r,h=i*f[t+1]+s+u;void 0===f[t]?(l.push(v),v=[],t--):v.push([e,h])}return v.length&&l.push(v),{width:g,height:c,segments:l}};module.exports=vectorChar;
|
|
1810
1736
|
|
|
1811
|
-
},{"./vectorParams":
|
|
1737
|
+
},{"./vectorParams":469}],469:[function(require,module,exports){
|
|
1812
1738
|
const defaultFont=require("./fonts/single-line/hershey/simplex.js"),defaultsVectorParams={xOffset:0,yOffset:0,input:"?",align:"left",font:defaultFont,height:14,lineSpacing:2.142857142857143,letterSpacing:1,extrudeOffset:0},vectorParams=(t,e)=>{e||"string"!=typeof t||(t={input:t}),t=t||{};const s=Object.assign({},defaultsVectorParams,t);return s.input=e||s.input,s};module.exports=vectorParams;
|
|
1813
1739
|
|
|
1814
|
-
},{"./fonts/single-line/hershey/simplex.js":
|
|
1740
|
+
},{"./fonts/single-line/hershey/simplex.js":466}],470:[function(require,module,exports){
|
|
1815
1741
|
const vectorChar=require("./vectorChar"),vectorParams=require("./vectorParams"),translateLine=(t,e)=>{const{x:n,y:s}=Object.assign({x:0,y:0},t||{}),r=e.segments;let h=null,a=null;for(let t=0,e=r.length;t<e;t++)for(let e=0,o=(h=r[t]).length;e<o;e++)a=h[e],h[e]=[a[0]+n,a[1]+s];return e},vectorText=(t,e)=>{const{xOffset:n,yOffset:s,input:r,font:h,height:a,align:o,extrudeOffset:i,lineSpacing:c,letterSpacing:g}=vectorParams(t,e);let[l,f]=[n,s],[m,x,u,d,v,w]=[],O={width:0,segments:[]};const p=[];let y=[],C=0;const L=l,P=()=>{p.push(O),C=Math.max(C,O.width),O={width:0,segments:[]}};for(m=0,x=r.length;m<x;m++)u=r[m],d=vectorChar({xOffset:l,yOffset:f,font:h,height:a,extrudeOffset:i},u),"\n"!==u?(v=d.width*g,O.width+=v,l+=v," "!==u&&(O.segments=O.segments.concat(d.segments))):(l=L,f-=d.height*c,P());for(O.segments.length&&P(),m=0,x=p.length;m<x;m++)O=p[m],C>O.width&&(w=C-O.width,"right"===o?O=translateLine({x:w},O):"center"===o&&(O=translateLine({x:w/2},O))),y=y.concat(O.segments);return y};module.exports=vectorText;
|
|
1816
1742
|
|
|
1817
|
-
},{"./vectorChar":
|
|
1743
|
+
},{"./vectorChar":468,"./vectorParams":469}],471:[function(require,module,exports){
|
|
1818
1744
|
const geom2=require("../geometries/geom2"),geom3=require("../geometries/geom3"),path2=require("../geometries/path2"),areAllShapesTheSameType=e=>{let r;return e.forEach(e=>{let o=0;if(geom2.isA(e)&&(o=1),geom3.isA(e)&&(o=2),path2.isA(e)&&(o=3),r&&o!==r)return!1;r=o}),!0};module.exports=areAllShapesTheSameType;
|
|
1819
1745
|
|
|
1820
|
-
},{"../geometries/geom2":
|
|
1746
|
+
},{"../geometries/geom2":122,"../geometries/geom3":136,"../geometries/path2":157}],472:[function(require,module,exports){
|
|
1821
1747
|
const degToRad=d=>.017453292519943295*d;module.exports=degToRad;
|
|
1822
1748
|
|
|
1823
|
-
},{}],
|
|
1749
|
+
},{}],473:[function(require,module,exports){
|
|
1824
1750
|
const flatten=t=>t.reduce((t,a)=>Array.isArray(a)?t.concat(flatten(a)):t.concat(a),[]);module.exports=flatten;
|
|
1825
1751
|
|
|
1826
|
-
},{}],
|
|
1752
|
+
},{}],474:[function(require,module,exports){
|
|
1827
1753
|
const fnNumberSort=(o,r)=>o-r;module.exports=fnNumberSort;
|
|
1828
1754
|
|
|
1829
|
-
},{}],
|
|
1755
|
+
},{}],475:[function(require,module,exports){
|
|
1830
1756
|
module.exports={areAllShapesTheSameType:require("./areAllShapesTheSameType"),degToRad:require("./degToRad"),flatten:require("./flatten"),fnNumberSort:require("./fnNumberSort"),insertSorted:require("./insertSorted"),radiusToSegments:require("./radiusToSegments"),radToDeg:require("./radToDeg")};
|
|
1831
1757
|
|
|
1832
|
-
},{"./areAllShapesTheSameType":
|
|
1758
|
+
},{"./areAllShapesTheSameType":471,"./degToRad":472,"./flatten":473,"./fnNumberSort":474,"./insertSorted":476,"./radToDeg":478,"./radiusToSegments":479}],476:[function(require,module,exports){
|
|
1833
1759
|
const insertSorted=(t,e,o)=>{let r=0,s=t.length;for(;s>r;){const l=Math.floor((r+s)/2);o(e,t[l])>0?r=l+1:s=l}t.splice(r,0,e)};module.exports=insertSorted;
|
|
1834
1760
|
|
|
1835
|
-
},{}],
|
|
1761
|
+
},{}],477:[function(require,module,exports){
|
|
1836
1762
|
const padArrayToLength=(r,e,o)=>{for(r=r.slice();r.length<o;)r.push(e);return r};module.exports=padArrayToLength;
|
|
1837
1763
|
|
|
1838
|
-
},{}],
|
|
1764
|
+
},{}],478:[function(require,module,exports){
|
|
1839
1765
|
const radToDeg=o=>57.29577951308232*o;module.exports=radToDeg;
|
|
1840
1766
|
|
|
1841
|
-
},{}],
|
|
1767
|
+
},{}],479:[function(require,module,exports){
|
|
1842
1768
|
const radiusToSegments=(t,e,a)=>{const s=e>0?2*t*Math.PI/e:0,o=a>0?2*Math.PI/a:0;return Math.ceil(Math.max(s,o,4))};module.exports=radiusToSegments;
|
|
1843
1769
|
|
|
1844
|
-
},{}],
|
|
1770
|
+
},{}],480:[function(require,module,exports){
|
|
1845
1771
|
const flatten=t=>t.reduce((t,a)=>Array.isArray(a)?t.concat(flatten(a)):t.concat(a),[]);module.exports=flatten;
|
|
1846
1772
|
|
|
1847
|
-
},{}],
|
|
1773
|
+
},{}],481:[function(require,module,exports){
|
|
1848
1774
|
const fnNumberSort=(o,r)=>o-r;module.exports=fnNumberSort;
|
|
1849
1775
|
|
|
1850
|
-
},{}],
|
|
1776
|
+
},{}],482:[function(require,module,exports){
|
|
1851
1777
|
const head=r=>{if(Array.isArray(r)&&0!==r.length)return r[0]};module.exports=head;
|
|
1852
1778
|
|
|
1853
|
-
},{}],
|
|
1779
|
+
},{}],483:[function(require,module,exports){
|
|
1854
1780
|
module.exports={flatten:require("./flatten"),fnNumberSort:require("./fnNumberSort"),head:require("./head"),insertSorted:require("./insertSorted"),nth:require("./nth"),padToLength:require("./padToLength"),toArray:require("./toArray")};
|
|
1855
1781
|
|
|
1856
|
-
},{"./flatten":
|
|
1782
|
+
},{"./flatten":480,"./fnNumberSort":481,"./head":482,"./insertSorted":484,"./nth":485,"./padToLength":486,"./toArray":487}],484:[function(require,module,exports){
|
|
1857
1783
|
const insertSorted=(t,e,o)=>{let r=0,n=t.length;for(;n>r;){const s=Math.floor((r+n)/2);o(e,t[s])>0?r=s+1:n=s}return t.splice(r,0,e),t};module.exports=insertSorted;
|
|
1858
1784
|
|
|
1859
|
-
},{}],
|
|
1785
|
+
},{}],485:[function(require,module,exports){
|
|
1860
1786
|
const nth=(r,t)=>{if(Array.isArray(r)&&!(r.length<t))return r[t]};module.exports=nth;
|
|
1861
1787
|
|
|
1862
|
-
},{}],
|
|
1788
|
+
},{}],486:[function(require,module,exports){
|
|
1863
1789
|
const padToLength=(e,o,t)=>{for(e=e.slice();e.length<t;)e.push(o);return e};module.exports=padToLength;
|
|
1864
1790
|
|
|
1865
|
-
},{}],
|
|
1791
|
+
},{}],487:[function(require,module,exports){
|
|
1866
1792
|
const toArray=r=>Array.isArray(r)?r:null==r?[]:[r];module.exports=toArray;
|
|
1867
1793
|
|
|
1868
|
-
},{}],
|
|
1794
|
+
},{}],488:[function(require,module,exports){
|
|
1869
1795
|
const generate=require("./generators/geometry-generator-cached-csg"),makeCacheWithInvalidation=require("./cacheWithInvalidation"),{flatten:flatten,toArray:toArray}=require("@jscad/array-utils"),makeBuildCachedGeometryFromTree=e=>{const{passesBeforeElimination:r,lookup:t,lookupCounts:a}=Object.assign({},{passesBeforeElimination:1,lookup:{},lookupCounts:{}},e),o=makeCacheWithInvalidation(r,t,a);return function(e,r){const t=((e,r)=>toArray(dfs(e,o)))(r);return o.update(),t}},dfs=(e,r)=>(e.children&&flatten(e.children).forEach(function(e){dfs(e,r)}),generate(e,r));module.exports=makeBuildCachedGeometryFromTree;
|
|
1870
1796
|
|
|
1871
|
-
},{"./cacheWithInvalidation":
|
|
1797
|
+
},{"./cacheWithInvalidation":489,"./generators/geometry-generator-cached-csg":490,"@jscad/array-utils":483}],489:[function(require,module,exports){
|
|
1872
1798
|
const hash=require("object-hash"),makeCacheWithInvalidation=(e=1,t={},a={})=>{let n=[];return{lookup:t,find:o=>{const h=hash(o),d=t[h];return d?(a[h]+=1,n.push(h)):a[h]=e,d?{foundData:d,nodeHash:h}:{foundData:void 0,nodeHash:h}},add:(e,n)=>{t[e]=n,a[e]+=1},update:()=>{const e=Object.keys(t),o=new Set(e),h=new Set(n);Array.from(new Set([...o].filter(e=>!h.has(e)))).forEach(function(e,n){a[e]-=1,a[e]<=0&&(delete t[e],delete a[e])}),n=[]}}};module.exports=makeCacheWithInvalidation;
|
|
1873
1799
|
|
|
1874
|
-
},{"object-hash":
|
|
1800
|
+
},{"object-hash":536}],490:[function(require,module,exports){
|
|
1875
1801
|
const{flatten:flatten}=require("@jscad/array-utils"),modeling=require("@jscad/modeling"),{cube:cube,cuboid:cuboid,sphere:sphere,cylinder:cylinder}=modeling.primitives,{circle:circle,ellipse:ellipse,rectangle:rectangle,square:square}=modeling.primitives,{union:union,difference:difference,intersection:intersection}=modeling.booleans,{translate:translate,rotate:rotate,scale:scale,mirror:mirror}=modeling.transforms,{hull:hull,hullChain:hullChain}=modeling.hulls,{expand:expand,offset:offset}=modeling.expansions,{extrudeLinear:extrudeLinear,extrudeRotate:extrudeRotate,extrudeFromSlices:extrudeFromSlices,extrudeRectangular:extrudeRectangular}=modeling.extrusions,{measureArea:measureArea,measureVolume:measureVolume,measureBounds:measureBounds}=modeling.measurements,{colorize:colorize}=modeling.colors,generate=(e,r)=>{if(Array.isArray(e))return flatten(e).map(e=>generate(e,r));const{foundData:a,nodeHash:t}=r.find(e);if(a)return a;const n=(e,a,t)=>t(flatten(e.children).map(e=>generate(e,r))),i=(e,a,t)=>(a=flatten(e.children).map(e=>generate(e,r)),t(e.params,a)),l={colorize:()=>i(e,void 0,colorize),cube:()=>cube(e),cuboid:()=>cuboid(e),sphere:()=>sphere(e),cylinder:()=>cylinder(e),circle:()=>circle(e),ellipse:()=>ellipse(e),rectangle:()=>rectangle(e),square:()=>square(e),union:()=>n(e,0,union),difference:()=>n(e,0,difference),intersection:()=>n(e,0,intersection),translate:()=>i(e,void 0,translate),rotate:()=>i(e,void 0,rotate),scale:()=>i(e,void 0,scale),mirror:()=>i(e,void 0,mirror),hull:()=>n(e,0,hull),hullChain:()=>n(e,0,hullChain),expand:()=>i(e,void 0,expand),offset:()=>i(e,void 0,offset),extrudeLinear:()=>i(e,void 0,extrudeLinear),extrudeRotate:()=>i(e,void 0,extrudeRotate),extrudeRectangular:()=>i(e,void 0,extrudeRectangular),extrudeFromSlices:()=>i(e,void 0,extrudeFromSlices),measureArea:()=>measureArea(flatten(e.children).map(e=>generate(e,r))),measureVolume:()=>measureVolume(flatten(e.children).map(e=>generate(e,r))),measureBounds:()=>measureBounds(flatten(e.children).map(e=>generate(e,r)))},o=l[e.type]?l[e.type]():e;return r.add(t,o),o};module.exports=generate;
|
|
1876
1802
|
|
|
1877
|
-
},{"@jscad/array-utils":
|
|
1803
|
+
},{"@jscad/array-utils":483,"@jscad/modeling":185}],491:[function(require,module,exports){
|
|
1878
1804
|
const{flatten:flatten}=require("@jscad/array-utils"),color=(r,...t)=>({children:t=flatten(t),type:"color",params:r});module.exports=color;
|
|
1879
1805
|
|
|
1880
|
-
},{"@jscad/array-utils":
|
|
1806
|
+
},{"@jscad/array-utils":483}],492:[function(require,module,exports){
|
|
1881
1807
|
const modeling=require("@jscad/modeling"),specials=[];require("./operations/measurements/measureArea")(specials),require("./operations/measurements/measureVolume")(specials),require("./operations/measurements/measureBounds")(specials),module.exports={colors:require("./color"),connectors:modeling.connectors,geometry:modeling.geometry,maths:modeling.maths,primitives:require("./primitives"),utils:modeling.utils,booleans:require("./operations/booleans"),expansions:require("./operations/expansions"),extrusions:require("./operations/extrusions"),hulls:require("./operations/hulls"),measurements:require("./operations/measurements"),transforms:require("./operations/transforms"),specials:specials};
|
|
1882
1808
|
|
|
1883
|
-
},{"./color":
|
|
1809
|
+
},{"./color":491,"./operations/booleans":493,"./operations/expansions":498,"./operations/extrusions":504,"./operations/hulls":507,"./operations/measurements":508,"./operations/measurements/measureArea":509,"./operations/measurements/measureBounds":510,"./operations/measurements/measureVolume":511,"./operations/transforms":513,"./primitives":525,"@jscad/modeling":185}],493:[function(require,module,exports){
|
|
1884
1810
|
module.exports={intersect:require("./intersect"),subtract:require("./subtract"),union:require("./union")};
|
|
1885
1811
|
|
|
1886
|
-
},{"./intersect":
|
|
1812
|
+
},{"./intersect":494,"./subtract":495,"./union":496}],494:[function(require,module,exports){
|
|
1887
1813
|
const{flatten:flatten}=require("@jscad/array-utils"),intersection=(...t)=>({children:t=flatten(t),type:"intersection",params:void 0});module.exports=intersection;
|
|
1888
1814
|
|
|
1889
|
-
},{"@jscad/array-utils":
|
|
1815
|
+
},{"@jscad/array-utils":483}],495:[function(require,module,exports){
|
|
1890
1816
|
const{flatten:flatten}=require("@jscad/array-utils"),difference=(...e)=>({children:e=flatten(e),type:"difference",params:void 0});module.exports=difference;
|
|
1891
1817
|
|
|
1892
|
-
},{"@jscad/array-utils":
|
|
1818
|
+
},{"@jscad/array-utils":483}],496:[function(require,module,exports){
|
|
1893
1819
|
const{flatten:flatten}=require("@jscad/array-utils"),union=(...n)=>({children:n=flatten(n),type:"union",params:void 0});module.exports=union;
|
|
1894
1820
|
|
|
1895
|
-
},{"@jscad/array-utils":
|
|
1821
|
+
},{"@jscad/array-utils":483}],497:[function(require,module,exports){
|
|
1896
1822
|
const{flatten:flatten}=require("@jscad/array-utils"),expand=(e,...a)=>({children:a=flatten(a),type:"expand",params:e});module.exports=expand;
|
|
1897
1823
|
|
|
1898
|
-
},{"@jscad/array-utils":
|
|
1824
|
+
},{"@jscad/array-utils":483}],498:[function(require,module,exports){
|
|
1899
1825
|
module.exports={expand:require("./expand"),offset:require("./offset")};
|
|
1900
1826
|
|
|
1901
|
-
},{"./expand":
|
|
1827
|
+
},{"./expand":497,"./offset":499}],499:[function(require,module,exports){
|
|
1902
1828
|
const{flatten:flatten}=require("@jscad/array-utils"),offset=(t,...e)=>({children:e=flatten(e),type:"offset",params:t});module.exports=offset;
|
|
1903
1829
|
|
|
1904
|
-
},{"@jscad/array-utils":
|
|
1830
|
+
},{"@jscad/array-utils":483}],500:[function(require,module,exports){
|
|
1905
1831
|
const{flatten:flatten}=require("@jscad/array-utils"),extrudeFromSlices=(e,...r)=>({children:r=flatten(r),type:"extrudeFromSlices",params:e});module.exports=extrudeFromSlices;
|
|
1906
1832
|
|
|
1907
|
-
},{"@jscad/array-utils":
|
|
1833
|
+
},{"@jscad/array-utils":483}],501:[function(require,module,exports){
|
|
1908
1834
|
const{flatten:flatten}=require("@jscad/array-utils"),extrudeLinear=(e,...r)=>({children:r=flatten(r),type:"extrudeLinear",params:e});module.exports=extrudeLinear;
|
|
1909
1835
|
|
|
1910
|
-
},{"@jscad/array-utils":
|
|
1836
|
+
},{"@jscad/array-utils":483}],502:[function(require,module,exports){
|
|
1911
1837
|
const{flatten:flatten}=require("@jscad/array-utils"),extrudeRectangular=(e,...t)=>({children:t=flatten(t),type:"extrudeRectangular",params:e});module.exports=extrudeRectangular;
|
|
1912
1838
|
|
|
1913
|
-
},{"@jscad/array-utils":
|
|
1839
|
+
},{"@jscad/array-utils":483}],503:[function(require,module,exports){
|
|
1914
1840
|
const{flatten:flatten}=require("@jscad/array-utils"),extrudeRotate=(t,...e)=>({children:e=flatten(e),type:"extrudeRotate",params:t});module.exports=extrudeRotate;
|
|
1915
1841
|
|
|
1916
|
-
},{"@jscad/array-utils":
|
|
1842
|
+
},{"@jscad/array-utils":483}],504:[function(require,module,exports){
|
|
1917
1843
|
module.exports={extrudeFromSlices:require("./extrudeFromSlices"),extrudeLinear:require("./extrudeLinear"),extrudeRectangular:require("./extrudeRectangular"),extrudeRotate:require("./extrudeRotate")};
|
|
1918
1844
|
|
|
1919
|
-
},{"./extrudeFromSlices":
|
|
1845
|
+
},{"./extrudeFromSlices":500,"./extrudeLinear":501,"./extrudeRectangular":502,"./extrudeRotate":503}],505:[function(require,module,exports){
|
|
1920
1846
|
const{flatten:flatten}=require("@jscad/array-utils"),hull=(...l)=>({children:l=flatten(l),type:"hull",params:void 0});module.exports=hull;
|
|
1921
1847
|
|
|
1922
|
-
},{"@jscad/array-utils":
|
|
1848
|
+
},{"@jscad/array-utils":483}],506:[function(require,module,exports){
|
|
1923
1849
|
const{flatten:flatten}=require("@jscad/array-utils"),hullChain=(...l)=>({children:l=flatten(l),type:"hullChain",params:void 0});module.exports=hullChain;
|
|
1924
1850
|
|
|
1925
|
-
},{"@jscad/array-utils":
|
|
1851
|
+
},{"@jscad/array-utils":483}],507:[function(require,module,exports){
|
|
1926
1852
|
module.exports={hull:require("./hull"),hullChain:require("./hullChain")};
|
|
1927
1853
|
|
|
1928
|
-
},{"./hull":
|
|
1854
|
+
},{"./hull":505,"./hullChain":506}],508:[function(require,module,exports){
|
|
1929
1855
|
module.exports={measureArea:require("./measureArea"),measureBounds:require("./measureBounds"),measureVolume:require("./measureVolume")};
|
|
1930
1856
|
|
|
1931
|
-
},{"./measureArea":
|
|
1857
|
+
},{"./measureArea":509,"./measureBounds":510,"./measureVolume":511}],509:[function(require,module,exports){
|
|
1932
1858
|
const{flatten:flatten}=require("@jscad/array-utils"),measureArea=require("@jscad/modeling").measurements.measureArea,cacheWithInvalidation=require("../../../cacheWithInvalidation"),cachedGenerator=require("../../../generators/geometry-generator-cached-csg"),makeMeasureArea=e=>{return(...a)=>{a=flatten(a);const r=cacheWithInvalidation(),t=cachedGenerator(a,r),c=measureArea(t);return e.push({cache:r,result:c}),c}};module.exports=makeMeasureArea;
|
|
1933
1859
|
|
|
1934
|
-
},{"../../../cacheWithInvalidation":
|
|
1860
|
+
},{"../../../cacheWithInvalidation":489,"../../../generators/geometry-generator-cached-csg":490,"@jscad/array-utils":483,"@jscad/modeling":185}],510:[function(require,module,exports){
|
|
1935
1861
|
const measureBounds=require("@jscad/modeling").measurements.measureBounds,cacheWithInvalidation=require("../../../cacheWithInvalidation"),cachedGenerator=require("../../../generators/geometry-generator-cached-csg"),makeMeasureBounds=e=>{return r=>{const a=cacheWithInvalidation(),n=cachedGenerator([r],a),s=measureBounds(n);return e.push({cache:a,result:s}),s}};module.exports=makeMeasureBounds;
|
|
1936
1862
|
|
|
1937
|
-
},{"../../../cacheWithInvalidation":
|
|
1863
|
+
},{"../../../cacheWithInvalidation":489,"../../../generators/geometry-generator-cached-csg":490,"@jscad/modeling":185}],511:[function(require,module,exports){
|
|
1938
1864
|
const{flatten:flatten}=require("@jscad/array-utils"),measureVolume=require("@jscad/modeling").measurements.measureVolume,cacheWithInvalidation=require("../../../cacheWithInvalidation"),cachedGenerator=require("../../../generators/geometry-generator-cached-csg"),makeMeasureVolume=e=>{return(...a)=>{a=flatten(a);const r=cacheWithInvalidation(),t=cachedGenerator(a,r),u=measureVolume(t);return e.push({cache:r,result:u}),u}};module.exports=makeMeasureVolume;
|
|
1939
1865
|
|
|
1940
|
-
},{"../../../cacheWithInvalidation":
|
|
1866
|
+
},{"../../../cacheWithInvalidation":489,"../../../generators/geometry-generator-cached-csg":490,"@jscad/array-utils":483,"@jscad/modeling":185}],512:[function(require,module,exports){
|
|
1941
1867
|
const{flatten:flatten}=require("@jscad/array-utils"),center=(e,...t)=>({children:t=flatten(t),type:"center",params:e});module.exports=center;
|
|
1942
1868
|
|
|
1943
|
-
},{"@jscad/array-utils":
|
|
1869
|
+
},{"@jscad/array-utils":483}],513:[function(require,module,exports){
|
|
1944
1870
|
module.exports={center:require("./center").center,centerX:require("./center").centerX,centerY:require("./center").centerY,centerZ:require("./center").centerZ,mirror:require("./mirror").mirror,mirrorX:require("./mirror").mirrorX,mirrorY:require("./mirror").mirrorY,mirrorZ:require("./mirror").mirrorZ,rotate:require("./rotate").rotate,rotateX:require("./rotate").rotateX,rotateY:require("./rotate").rotateY,rotateZ:require("./rotate").rotateZ,scale:require("./scale").scale,scaleX:require("./scale").scaleX,scaleY:require("./scale").scaleY,scaleZ:require("./scale").scaleZ,transform:require("./transform"),translate:require("./translate").translate,translateX:require("./translate").translateX,translateY:require("./translate").translateY,translateZ:require("./translate").translateZ};
|
|
1945
1871
|
|
|
1946
|
-
},{"./center":
|
|
1872
|
+
},{"./center":512,"./mirror":514,"./rotate":515,"./scale":516,"./transform":517,"./translate":518}],514:[function(require,module,exports){
|
|
1947
1873
|
const{flatten:flatten}=require("@jscad/array-utils"),mirror=(r,...t)=>({children:t=flatten(t),type:"mirror",params:r});module.exports=mirror;
|
|
1948
1874
|
|
|
1949
|
-
},{"@jscad/array-utils":
|
|
1875
|
+
},{"@jscad/array-utils":483}],515:[function(require,module,exports){
|
|
1950
1876
|
const{flatten:flatten}=require("@jscad/array-utils"),rotate=(t,...e)=>({children:e=flatten(e),type:"rotate",params:t});module.exports=rotate;
|
|
1951
1877
|
|
|
1952
|
-
},{"@jscad/array-utils":
|
|
1878
|
+
},{"@jscad/array-utils":483}],516:[function(require,module,exports){
|
|
1953
1879
|
const{flatten:flatten}=require("@jscad/array-utils"),scale=(e,...a)=>({children:a=flatten(a),type:"scale",params:e});module.exports=scale;
|
|
1954
1880
|
|
|
1955
|
-
},{"@jscad/array-utils":
|
|
1881
|
+
},{"@jscad/array-utils":483}],517:[function(require,module,exports){
|
|
1956
1882
|
const{flatten:flatten}=require("@jscad/array-utils"),transform=(r,...t)=>({children:t=flatten(t),type:"transform",params:r});module.exports=transform;
|
|
1957
1883
|
|
|
1958
|
-
},{"@jscad/array-utils":
|
|
1884
|
+
},{"@jscad/array-utils":483}],518:[function(require,module,exports){
|
|
1959
1885
|
const{flatten:flatten}=require("@jscad/array-utils"),translate=(t,...a)=>({children:a=flatten(a),type:"translate",params:t});module.exports=translate;
|
|
1960
1886
|
|
|
1961
|
-
},{"@jscad/array-utils":
|
|
1887
|
+
},{"@jscad/array-utils":483}],519:[function(require,module,exports){
|
|
1962
1888
|
const arc=c=>Object.assign({},c,{type:"arc"});module.exports=arc;
|
|
1963
1889
|
|
|
1964
|
-
},{}],
|
|
1890
|
+
},{}],520:[function(require,module,exports){
|
|
1965
1891
|
const cuboid=c=>Object.assign({},c,{type:"cuboid"}),cube=c=>Object.assign({},c,{type:"cube"});module.exports={cuboid:cuboid,cube:cube};
|
|
1966
1892
|
|
|
1967
|
-
},{}],
|
|
1893
|
+
},{}],521:[function(require,module,exports){
|
|
1968
1894
|
const cylinder=i=>Object.assign({},i,{type:"cylinder"}),cylinderElliptic=i=>Object.assign({},i,{type:"cylinderElliptic"});module.exports={cylinder:cylinder,cylinderElliptic:cylinderElliptic};
|
|
1969
1895
|
|
|
1970
|
-
},{}],
|
|
1896
|
+
},{}],522:[function(require,module,exports){
|
|
1971
1897
|
const circle=e=>Object.assign({},e,{type:"circle"}),ellipse=e=>Object.assign({},e,{type:"ellipse"});module.exports={circle:circle,ellipse:ellipse};
|
|
1972
1898
|
|
|
1973
|
-
},{}],
|
|
1899
|
+
},{}],523:[function(require,module,exports){
|
|
1974
1900
|
const ellipsoid=e=>Object.assign({},e,{type:"ellipsoid"}),sphere=e=>Object.assign({},e,{type:"sphere"});module.exports={ellipsoid:ellipsoid,sphere:sphere};
|
|
1975
1901
|
|
|
1976
|
-
},{}],
|
|
1902
|
+
},{}],524:[function(require,module,exports){
|
|
1977
1903
|
module.exports=(e=>Object.assign({},e,{type:"geodesicSphere"}));
|
|
1978
1904
|
|
|
1979
|
-
},{}],
|
|
1905
|
+
},{}],525:[function(require,module,exports){
|
|
1980
1906
|
module.exports={arc:require("./arc"),circle:require("./ellipse").circle,ellipse:require("./ellipse").ellipse,line:require("./line"),rectangle:require("./rectangle").rectangle,square:require("./rectangle").square,cube:require("./cuboid").cube,cuboid:require("./cuboid").cuboid,cylinder:require("./cylinderElliptic").cylinder,cylinderElliptic:require("./cylinderElliptic").cylinderElliptic,ellipsoid:require("./ellipsoid").ellipsoid,geodesicSphere:require("./geodesicSphere"),polygon:require("./polygon"),polyhedron:require("./polyhedron"),roundedCuboid:require("./roundedCuboid"),roundedCylinder:require("./roundedCylinder"),roundedRectangle:require("./roundedRectangle"),sphere:require("./ellipsoid").sphere,star:require("./star"),torus:require("./torus")};
|
|
1981
1907
|
|
|
1982
|
-
},{"./arc":
|
|
1908
|
+
},{"./arc":519,"./cuboid":520,"./cylinderElliptic":521,"./ellipse":522,"./ellipsoid":523,"./geodesicSphere":524,"./line":526,"./polygon":527,"./polyhedron":528,"./rectangle":529,"./roundedCuboid":530,"./roundedCylinder":531,"./roundedRectangle":532,"./star":533,"./torus":534}],526:[function(require,module,exports){
|
|
1983
1909
|
const line=e=>Object.assign({},e,{type:"line"});module.exports=line;
|
|
1984
1910
|
|
|
1985
|
-
},{}],
|
|
1911
|
+
},{}],527:[function(require,module,exports){
|
|
1986
1912
|
module.exports=(e=>Object.assign({},e,{type:"polygon"}));
|
|
1987
1913
|
|
|
1988
|
-
},{}],
|
|
1914
|
+
},{}],528:[function(require,module,exports){
|
|
1989
1915
|
module.exports=(e=>Object.assign({},e,{type:"polyhedron"}));
|
|
1990
1916
|
|
|
1991
|
-
},{}],
|
|
1917
|
+
},{}],529:[function(require,module,exports){
|
|
1992
1918
|
const rectangle=e=>Object.assign({},e,{type:"rectangle"}),square=e=>Object.assign({},e,{type:"square"});module.exports={rectangle:rectangle,square:square};
|
|
1993
1919
|
|
|
1994
|
-
},{}],
|
|
1920
|
+
},{}],530:[function(require,module,exports){
|
|
1995
1921
|
module.exports=(e=>Object.assign({},e,{type:"roundedCuboid"}));
|
|
1996
1922
|
|
|
1997
|
-
},{}],
|
|
1923
|
+
},{}],531:[function(require,module,exports){
|
|
1998
1924
|
module.exports=(e=>Object.assign({},e,{type:"roundedCylinder"}));
|
|
1999
1925
|
|
|
2000
|
-
},{}],
|
|
1926
|
+
},{}],532:[function(require,module,exports){
|
|
2001
1927
|
module.exports=(e=>Object.assign({},e,{type:"roundedRectangle"}));
|
|
2002
1928
|
|
|
2003
|
-
},{}],
|
|
1929
|
+
},{}],533:[function(require,module,exports){
|
|
2004
1930
|
module.exports=(e=>Object.assign({},e,{type:"star"}));
|
|
2005
1931
|
|
|
2006
|
-
},{}],
|
|
1932
|
+
},{}],534:[function(require,module,exports){
|
|
2007
1933
|
module.exports=(e=>Object.assign({},e,{type:"torus"}));
|
|
2008
1934
|
|
|
2009
|
-
},{}],
|
|
1935
|
+
},{}],535:[function(require,module,exports){
|
|
2010
1936
|
module.exports={api:require("./core/modeling"),buildCachedGeometry:require("./core/buildCachedGeometryFromTree")};
|
|
2011
1937
|
|
|
2012
|
-
},{"./core/buildCachedGeometryFromTree":
|
|
1938
|
+
},{"./core/buildCachedGeometryFromTree":488,"./core/modeling":492}],536:[function(require,module,exports){
|
|
2013
1939
|
(function (global){(function (){
|
|
2014
1940
|
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.objectHash=e()}}(function(){return function e(t,n,r){function o(u,a){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!a&&s)return s(u,!0);if(i)return i(u,!0);throw new Error("Cannot find module '"+u+"'")}var f=n[u]={exports:{}};t[u][0].call(f.exports,function(e){return o(t[u][1][e]||e)},f,f.exports,e,t,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(e,t,n){(function(r,o,i,u,a,s,f,c,l){"use strict";var d=e("crypto");function h(e,t){return function(e,t){var n;if(void 0===(n="passthrough"!==t.algorithm?d.createHash(t.algorithm):new m).write&&(n.write=n.update,n.end=n.update),b(t,n).dispatch(e),n.update||n.end(""),n.digest)return n.digest("buffer"===t.encoding?void 0:t.encoding);var r=n.read();return"buffer"!==t.encoding?r.toString(t.encoding):r}(e,t=y(e,t))}(n=t.exports=h).sha1=function(e){return h(e)},n.keys=function(e){return h(e,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(e){return h(e,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(e){return h(e,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=d.getHashes?d.getHashes().slice():["sha1","md5"];p.push("passthrough");var g=["buffer","hex","binary","base64"];function y(e,t){t=t||{};var n={};if(n.algorithm=t.algorithm||"sha1",n.encoding=t.encoding||"hex",n.excludeValues=!!t.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===t.ignoreUnknown,n.respectType=!1!==t.respectType,n.respectFunctionNames=!1!==t.respectFunctionNames,n.respectFunctionProperties=!1!==t.respectFunctionProperties,n.unorderedArrays=!0===t.unorderedArrays,n.unorderedSets=!1!==t.unorderedSets,n.unorderedObjects=!1!==t.unorderedObjects,n.replacer=t.replacer||void 0,n.excludeKeys=t.excludeKeys||void 0,void 0===e)throw new Error("Object argument required.");for(var r=0;r<p.length;++r)p[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=p[r]);if(-1===p.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+p.join(", "));if(-1===g.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+g.join(", "));return n}function w(e){if("function"==typeof e)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(e))}function b(e,t,n){function r(e){return t.update?t.update(e,"utf8"):t.write(e,"utf8")}return n=n||[],{dispatch:function(t){e.replacer&&(t=e.replacer(t));var n=typeof t;return null===t&&(n="null"),this["_"+n](t)},_object:function(t){var o,u=Object.prototype.toString.call(t),a=/\[object (.*)\]/i.exec(u);if(a=(a=a?a[1]:"unknown:["+u+"]").toLowerCase(),0<=(o=n.indexOf(t)))return this.dispatch("[CIRCULAR:"+o+"]");if(n.push(t),void 0!==i&&i.isBuffer&&i.isBuffer(t))return r("buffer:"),r(t);if("object"===a||"function"===a||"asyncfunction"===a){var s=Object.keys(t);e.unorderedObjects&&(s=s.sort()),!1===e.respectType||w(t)||s.splice(0,0,"prototype","__proto__","constructor"),e.excludeKeys&&(s=s.filter(function(t){return!e.excludeKeys(t)})),r("object:"+s.length+":");var f=this;return s.forEach(function(n){f.dispatch(n),r(":"),e.excludeValues||f.dispatch(t[n]),r(",")})}if(!this["_"+a]){if(e.ignoreUnknown)return r("["+a+"]");throw new Error('Unknown object type "'+a+'"')}this["_"+a](t)},_array:function(t,o){o=void 0!==o?o:!1!==e.unorderedArrays;var i=this;if(r("array:"+t.length+":"),!o||t.length<=1)return t.forEach(function(e){return i.dispatch(e)});var u=[],a=t.map(function(t){var r=new m,o=n.slice();return b(e,r,o).dispatch(t),u=u.concat(o.slice(n.length)),r.read().toString()});return n=n.concat(u),a.sort(),this._array(a,!1)},_date:function(e){return r("date:"+e.toJSON())},_symbol:function(e){return r("symbol:"+e.toString())},_error:function(e){return r("error:"+e.toString())},_boolean:function(e){return r("bool:"+e.toString())},_string:function(e){r("string:"+e.length+":"),r(e.toString())},_function:function(t){r("fn:"),w(t)?this.dispatch("[native]"):this.dispatch(t.toString()),!1!==e.respectFunctionNames&&this.dispatch("function-name:"+String(t.name)),e.respectFunctionProperties&&this._object(t)},_number:function(e){return r("number:"+e.toString())},_xml:function(e){return r("xml:"+e.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(e){return r("regex:"+e.toString())},_uint8array:function(e){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint8clampedarray:function(e){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(e))},_int8array:function(e){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(e))},_uint16array:function(e){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_int16array:function(e){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(e))},_uint32array:function(e){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_int32array:function(e){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(e))},_float32array:function(e){return r("float32array:"),this.dispatch(Array.prototype.slice.call(e))},_float64array:function(e){return r("float64array:"),this.dispatch(Array.prototype.slice.call(e))},_arraybuffer:function(e){return r("arraybuffer:"),this.dispatch(new Uint8Array(e))},_url:function(e){return r("url:"+e.toString())},_map:function(t){r("map:");var n=Array.from(t);return this._array(n,!1!==e.unorderedSets)},_set:function(t){r("set:");var n=Array.from(t);return this._array(n,!1!==e.unorderedSets)},_blob:function(){if(e.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function m(){return{buf:"",write:function(e){this.buf+=e},end:function(e){this.buf+=e},read:function(){return this.buf}}}n.writeToStream=function(e,t,n){return void 0===n&&(n=t,t={}),b(t=y(e,t),n).dispatch(e)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_794fcf4d.js","/")},{buffer:3,crypto:5,lYpoI2:10}],2:[function(e,t,n){(function(e,t,r,o,i,u,a,s,f){!function(e){"use strict";var t="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),o="0".charCodeAt(0),i="a".charCodeAt(0),u="A".charCodeAt(0),a="-".charCodeAt(0),s="_".charCodeAt(0);function f(e){var t=e.charCodeAt(0);return t===n||t===a?62:t===r||t===s?63:t<o?-1:t<o+10?t-o+26+26:t<u+26?t-u:t<i+26?t-i+26:void 0}e.toByteArray=function(e){var n,r,o,i,u;if(0<e.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.length;i="="===e.charAt(a-2)?2:"="===e.charAt(a-1)?1:0,u=new t(3*e.length/4-i),r=0<i?e.length-4:e.length;var s=0;function c(e){u[s++]=e}for(n=0;n<r;n+=4,0)c((16711680&(o=f(e.charAt(n))<<18|f(e.charAt(n+1))<<12|f(e.charAt(n+2))<<6|f(e.charAt(n+3))))>>16),c((65280&o)>>8),c(255&o);return 2==i?c(255&(o=f(e.charAt(n))<<2|f(e.charAt(n+1))>>4)):1==i&&(c((o=f(e.charAt(n))<<10|f(e.charAt(n+1))<<4|f(e.charAt(n+2))>>2)>>8&255),c(255&o)),u},e.fromByteArray=function(e){var t,n,r,o,i=e.length%3,u="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-i;t<r;t+=3)u+=a((o=n=(e[t]<<16)+(e[t+1]<<8)+e[t+2])>>18&63)+a(o>>12&63)+a(o>>6&63)+a(63&o);switch(i){case 1:u+=a((n=e[e.length-1])>>2),u+=a(n<<4&63),u+="==";break;case 2:u+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),u+=a(n>>4&63),u+=a(n<<2&63),u+="="}return u}}(void 0===n?this.base64js={}:n)}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(e,t,n){(function(t,r,o,i,u,a,s,f,c){var l=e("base64-js"),d=e("ieee754");function o(e,t,n){if(!(this instanceof o))return new o(e,t,n);var r,i,u,a,s,f=typeof e;if("base64"===t&&"string"==f)for(e=(r=e).trim?r.trim():r.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if("number"==f)i=S(e);else if("string"==f)i=o.byteLength(e,t);else{if("object"!=f)throw new Error("First argument needs to be a number, array or string.");i=S(e.length)}if(o._useTypedArrays?u=o._augment(new Uint8Array(i)):((u=this).length=i,u._isBuffer=!0),o._useTypedArrays&&"number"==typeof e.byteLength)u._set(e);else if(j(s=e)||o.isBuffer(s)||s&&"object"==typeof s&&"number"==typeof s.length)for(a=0;a<i;a++)o.isBuffer(e)?u[a]=e.readUInt8(a):u[a]=e[a];else if("string"==f)u.write(e,0,t);else if("number"==f&&!o._useTypedArrays&&!n)for(a=0;a<i;a++)u[a]=0;return u}function h(e,t,n,r){return o._charsWritten=M(function(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function p(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;o++)r+=String.fromCharCode(e[o]);return r}function g(e,t,n,r){r||(O("boolean"==typeof n,"missing or invalid endian"),O(null!=t,"missing offset"),O(t+1<e.length,"Trying to read beyond buffer length"));var o,i=e.length;if(!(i<=t))return n?(o=e[t],t+1<i&&(o|=e[t+1]<<8)):(o=e[t]<<8,t+1<i&&(o|=e[t+1])),o}function y(e,t,n,r){r||(O("boolean"==typeof n,"missing or invalid endian"),O(null!=t,"missing offset"),O(t+3<e.length,"Trying to read beyond buffer length"));var o,i=e.length;if(!(i<=t))return n?(t+2<i&&(o=e[t+2]<<16),t+1<i&&(o|=e[t+1]<<8),o|=e[t],t+3<i&&(o+=e[t+3]<<24>>>0)):(t+1<i&&(o=e[t+1]<<16),t+2<i&&(o|=e[t+2]<<8),t+3<i&&(o|=e[t+3]),o+=e[t]<<24>>>0),o}function w(e,t,n,r){if(r||(O("boolean"==typeof n,"missing or invalid endian"),O(null!=t,"missing offset"),O(t+1<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var o=g(e,t,n,!0);return 32768&o?-1*(65535-o+1):o}}function b(e,t,n,r){if(r||(O("boolean"==typeof n,"missing or invalid endian"),O(null!=t,"missing offset"),O(t+3<e.length,"Trying to read beyond buffer length")),!(e.length<=t)){var o=y(e,t,n,!0);return 2147483648&o?-1*(4294967295-o+1):o}}function m(e,t,n,r){return r||(O("boolean"==typeof n,"missing or invalid endian"),O(t+3<e.length,"Trying to read beyond buffer length")),d.read(e,t,n,23,4)}function v(e,t,n,r){return r||(O("boolean"==typeof n,"missing or invalid endian"),O(t+7<e.length,"Trying to read beyond buffer length")),d.read(e,t,n,52,8)}function _(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+1<e.length,"trying to write beyond buffer length"),Y(t,65535));var i=e.length;if(!(i<=n))for(var u=0,a=Math.min(i-n,2);u<a;u++)e[n+u]=(t&255<<8*(r?u:1-u))>>>8*(r?u:1-u)}function E(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+3<e.length,"trying to write beyond buffer length"),Y(t,4294967295));var i=e.length;if(!(i<=n))for(var u=0,a=Math.min(i-n,4);u<a;u++)e[n+u]=t>>>8*(r?u:3-u)&255}function I(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+1<e.length,"Trying to write beyond buffer length"),F(t,32767,-32768)),e.length<=n||_(e,0<=t?t:65535+t+1,n,r,o)}function A(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+3<e.length,"Trying to write beyond buffer length"),F(t,2147483647,-2147483648)),e.length<=n||E(e,0<=t?t:4294967295+t+1,n,r,o)}function B(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+3<e.length,"Trying to write beyond buffer length"),D(t,3.4028234663852886e38,-3.4028234663852886e38)),e.length<=n||d.write(e,t,n,r,23,4)}function L(e,t,n,r,o){o||(O(null!=t,"missing value"),O("boolean"==typeof r,"missing or invalid endian"),O(null!=n,"missing offset"),O(n+7<e.length,"Trying to write beyond buffer length"),D(t,1.7976931348623157e308,-1.7976931348623157e308)),e.length<=n||d.write(e,t,n,r,52,8)}n.Buffer=o,n.SlowBuffer=o,n.INSPECT_MAX_BYTES=50,o.poolSize=8192,o._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(e){return!1}}(),o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"hex":n=e.length/2;break;case"utf8":case"utf-8":n=k(e).length;break;case"ascii":case"binary":case"raw":n=e.length;break;case"base64":n=T(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;default:throw new Error("Unknown encoding")}return n},o.concat=function(e,t){if(O(j(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new o(0);if(1===e.length)return e[0];var n;if("number"!=typeof t)for(n=t=0;n<e.length;n++)t+=e[n].length;var r=new o(t),i=0;for(n=0;n<e.length;n++){var u=e[n];u.copy(r,i),i+=u.length}return r},o.prototype.write=function(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var i=r;r=t,t=n,n=i}t=Number(t)||0;var u,a,s,f,c,l=this.length-t;switch((!n||l<(n=Number(n)))&&(n=l),r=String(r||"utf8").toLowerCase()){case"hex":u=function(e,t,n,r){n=Number(n)||0;var i=e.length-n;(!r||i<(r=Number(r)))&&(r=i);var u=t.length;O(u%2==0,"Invalid hex string"),u/2<r&&(r=u/2);for(var a=0;a<r;a++){var s=parseInt(t.substr(2*a,2),16);O(!isNaN(s),"Invalid hex string"),e[n+a]=s}return o._charsWritten=2*a,a}(this,e,t,n);break;case"utf8":case"utf-8":this,f=t,c=n,u=o._charsWritten=M(k(e),this,f,c);break;case"ascii":case"binary":u=h(this,e,t,n);break;case"base64":this,a=t,s=n,u=o._charsWritten=M(T(e),this,a,s);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":u=function(e,t,n,r){return o._charsWritten=M(function(e){for(var t,n,r,o=[],i=0;i<e.length;i++)n=(t=e.charCodeAt(i))>>8,r=t%256,o.push(r),o.push(n);return o}(t),e,n,r)}(this,e,t,n);break;default:throw new Error("Unknown encoding")}return u},o.prototype.toString=function(e,t,n){var r,o,i,u,a=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,(n=void 0!==n?Number(n):n=a.length)===t)return"";switch(e){case"hex":r=function(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||r<n)&&(n=r);for(var o="",i=t;i<n;i++)o+=C(e[i]);return o}(a,t,n);break;case"utf8":case"utf-8":r=function(e,t,n){var r="",o="";n=Math.min(e.length,n);for(var i=t;i<n;i++)e[i]<=127?(r+=N(o)+String.fromCharCode(e[i]),o=""):o+="%"+e[i].toString(16);return r+N(o)}(a,t,n);break;case"ascii":case"binary":r=p(a,t,n);break;case"base64":o=a,u=n,r=0===(i=t)&&u===o.length?l.fromByteArray(o):l.fromByteArray(o.slice(i,u));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(e,t,n){for(var r=a.slice(t,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}(0,t,n);break;default:throw new Error("Unknown encoding")}return r},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.copy=function(e,t,n,r){if(n=n||0,r||0===r||(r=this.length),t=t||0,r!==n&&0!==e.length&&0!==this.length){O(n<=r,"sourceEnd < sourceStart"),O(0<=t&&t<e.length,"targetStart out of bounds"),O(0<=n&&n<this.length,"sourceStart out of bounds"),O(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;if(i<100||!o._useTypedArrays)for(var u=0;u<i;u++)e[u+t]=this[u+n];else e._set(this.subarray(n,n+i),t)}},o.prototype.slice=function(e,t){var n=this.length;if(e=x(e,n,0),t=x(t,n,n),o._useTypedArrays)return o._augment(this.subarray(e,t));for(var r=t-e,i=new o(r,void 0,!0),u=0;u<r;u++)i[u]=this[u+e];return i},o.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},o.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},o.prototype.readUInt8=function(e,t){if(t||(O(null!=e,"missing offset"),O(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},o.prototype.readUInt16LE=function(e,t){return g(this,e,!0,t)},o.prototype.readUInt16BE=function(e,t){return g(this,e,!1,t)},o.prototype.readUInt32LE=function(e,t){return y(this,e,!0,t)},o.prototype.readUInt32BE=function(e,t){return y(this,e,!1,t)},o.prototype.readInt8=function(e,t){if(t||(O(null!=e,"missing offset"),O(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){return w(this,e,!0,t)},o.prototype.readInt16BE=function(e,t){return w(this,e,!1,t)},o.prototype.readInt32LE=function(e,t){return b(this,e,!0,t)},o.prototype.readInt32BE=function(e,t){return b(this,e,!1,t)},o.prototype.readFloatLE=function(e,t){return m(this,e,!0,t)},o.prototype.readFloatBE=function(e,t){return m(this,e,!1,t)},o.prototype.readDoubleLE=function(e,t){return v(this,e,!0,t)},o.prototype.readDoubleBE=function(e,t){return v(this,e,!1,t)},o.prototype.writeUInt8=function(e,t,n){n||(O(null!=e,"missing value"),O(null!=t,"missing offset"),O(t<this.length,"trying to write beyond buffer length"),Y(e,255)),t>=this.length||(this[t]=e)},o.prototype.writeUInt16LE=function(e,t,n){_(this,e,t,!0,n)},o.prototype.writeUInt16BE=function(e,t,n){_(this,e,t,!1,n)},o.prototype.writeUInt32LE=function(e,t,n){E(this,e,t,!0,n)},o.prototype.writeUInt32BE=function(e,t,n){E(this,e,t,!1,n)},o.prototype.writeInt8=function(e,t,n){n||(O(null!=e,"missing value"),O(null!=t,"missing offset"),O(t<this.length,"Trying to write beyond buffer length"),F(e,127,-128)),t>=this.length||(0<=e?this.writeUInt8(e,t,n):this.writeUInt8(255+e+1,t,n))},o.prototype.writeInt16LE=function(e,t,n){I(this,e,t,!0,n)},o.prototype.writeInt16BE=function(e,t,n){I(this,e,t,!1,n)},o.prototype.writeInt32LE=function(e,t,n){A(this,e,t,!0,n)},o.prototype.writeInt32BE=function(e,t,n){A(this,e,t,!1,n)},o.prototype.writeFloatLE=function(e,t,n){B(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){B(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){L(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){L(this,e,t,!1,n)},o.prototype.fill=function(e,t,n){if(e=e||0,t=t||0,n=n||this.length,"string"==typeof e&&(e=e.charCodeAt(0)),O("number"==typeof e&&!isNaN(e),"value is not a number"),O(t<=n,"end < start"),n!==t&&0!==this.length){O(0<=t&&t<this.length,"start out of bounds"),O(0<=n&&n<=this.length,"end out of bounds");for(var r=t;r<n;r++)this[r]=e}},o.prototype.inspect=function(){for(var e=[],t=this.length,r=0;r<t;r++)if(e[r]=C(this[r]),r===n.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},o.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(o._useTypedArrays)return new o(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;t<n;t+=1)e[t]=this[t];return e.buffer};var U=o.prototype;function x(e,t,n){return"number"!=typeof e?n:t<=(e=~~e)?t:0<=e||0<=(e+=t)?e:0}function S(e){return(e=~~Math.ceil(+e))<0?0:e}function j(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function C(e){return e<16?"0"+e.toString(16):e.toString(16)}function k(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t.push(e.charCodeAt(n));else{var o=n;55296<=r&&r<=57343&&n++;for(var i=encodeURIComponent(e.slice(o,n+1)).substr(1).split("%"),u=0;u<i.length;u++)t.push(parseInt(i[u],16))}}return t}function T(e){return l.toByteArray(e)}function M(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);o++)t[o+n]=e[o];return o}function N(e){try{return decodeURIComponent(e)}catch(e){return String.fromCharCode(65533)}}function Y(e,t){O("number"==typeof e,"cannot write a non-number as a number"),O(0<=e,"specified a negative value for writing an unsigned value"),O(e<=t,"value is larger than maximum value for type"),O(Math.floor(e)===e,"value has a fractional component")}function F(e,t,n){O("number"==typeof e,"cannot write a non-number as a number"),O(e<=t,"value larger than maximum allowed value"),O(n<=e,"value smaller than minimum allowed value"),O(Math.floor(e)===e,"value has a fractional component")}function D(e,t,n){O("number"==typeof e,"cannot write a non-number as a number"),O(e<=t,"value larger than maximum allowed value"),O(n<=e,"value smaller than minimum allowed value")}function O(e,t){if(!e)throw new Error(t||"Failed assertion")}o._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=U.get,e.set=U.set,e.write=U.write,e.toString=U.toString,e.toLocaleString=U.toString,e.toJSON=U.toJSON,e.copy=U.copy,e.slice=U.slice,e.readUInt8=U.readUInt8,e.readUInt16LE=U.readUInt16LE,e.readUInt16BE=U.readUInt16BE,e.readUInt32LE=U.readUInt32LE,e.readUInt32BE=U.readUInt32BE,e.readInt8=U.readInt8,e.readInt16LE=U.readInt16LE,e.readInt16BE=U.readInt16BE,e.readInt32LE=U.readInt32LE,e.readInt32BE=U.readInt32BE,e.readFloatLE=U.readFloatLE,e.readFloatBE=U.readFloatBE,e.readDoubleLE=U.readDoubleLE,e.readDoubleBE=U.readDoubleBE,e.writeUInt8=U.writeUInt8,e.writeUInt16LE=U.writeUInt16LE,e.writeUInt16BE=U.writeUInt16BE,e.writeUInt32LE=U.writeUInt32LE,e.writeUInt32BE=U.writeUInt32BE,e.writeInt8=U.writeInt8,e.writeInt16LE=U.writeInt16LE,e.writeInt16BE=U.writeInt16BE,e.writeInt32LE=U.writeInt32LE,e.writeInt32BE=U.writeInt32BE,e.writeFloatLE=U.writeFloatLE,e.writeFloatBE=U.writeFloatBE,e.writeDoubleLE=U.writeDoubleLE,e.writeDoubleBE=U.writeDoubleBE,e.fill=U.fill,e.inspect=U.inspect,e.toArrayBuffer=U.toArrayBuffer,e}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){o=e("buffer").Buffer;var l=new o(4);l.fill(0),t.exports={hash:function(e,t,n,r){return o.isBuffer(e)||(e=new o(e)),function(e,t,n){for(var r=new o(t),i=n?r.writeInt32BE:r.writeInt32LE,u=0;u<e.length;u++)i.call(r,e[u],4*u,!0);return r}(t(function(e,t){if(e.length%4!=0){var n=e.length+(4-e.length%4);e=o.concat([e,l],n)}for(var r=[],i=t?e.readInt32BE:e.readInt32LE,u=0;u<e.length;u+=4)r.push(i.call(e,u));return r}(e,r),8*e.length),n,r)}}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],5:[function(e,t,n){(function(t,r,o,i,u,a,s,f,c){o=e("buffer").Buffer;var l=e("./sha"),d=e("./sha256"),h=e("./rng"),p={sha1:l,sha256:d,md5:e("./md5")},g=64,y=new o(g);function w(e,t){var n=p[e=e||"sha1"],r=[];return n||b("algorithm:",e,"is not yet supported"),{update:function(e){return o.isBuffer(e)||(e=new o(e)),r.push(e),e.length,this},digest:function(e){var i=o.concat(r),u=t?function(e,t,n){o.isBuffer(t)||(t=new o(t)),o.isBuffer(n)||(n=new o(n)),t.length>g?t=e(t):t.length<g&&(t=o.concat([t,y],g));for(var r=new o(g),i=new o(g),u=0;u<g;u++)r[u]=54^t[u],i[u]=92^t[u];var a=e(o.concat([r,n]));return e(o.concat([i,a]))}(n,t,i):n(i);return r=null,e?u.toString(e):u}}}function b(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}y.fill(0),n.createHash=function(e){return w(e)},n.createHmac=function(e,t){return w(e,t)},n.randomBytes=function(e,t){if(!t||!t.call)return new o(h(e));try{t.call(this,void 0,new o(h(e)))}catch(e){t(e)}},function(e,t){for(var n in e)t(e[n])}(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){n[e]=function(){b("sorry,",e,"is not implemented yet")}})}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:10}],6:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){var l=e("./helpers");function d(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,u=0;u<e.length;u+=16){var a=n,s=r,f=o,c=i;n=p(n,r,o,i,e[u+0],7,-680876936),i=p(i,n,r,o,e[u+1],12,-389564586),o=p(o,i,n,r,e[u+2],17,606105819),r=p(r,o,i,n,e[u+3],22,-1044525330),n=p(n,r,o,i,e[u+4],7,-176418897),i=p(i,n,r,o,e[u+5],12,1200080426),o=p(o,i,n,r,e[u+6],17,-1473231341),r=p(r,o,i,n,e[u+7],22,-45705983),n=p(n,r,o,i,e[u+8],7,1770035416),i=p(i,n,r,o,e[u+9],12,-1958414417),o=p(o,i,n,r,e[u+10],17,-42063),r=p(r,o,i,n,e[u+11],22,-1990404162),n=p(n,r,o,i,e[u+12],7,1804603682),i=p(i,n,r,o,e[u+13],12,-40341101),o=p(o,i,n,r,e[u+14],17,-1502002290),n=g(n,r=p(r,o,i,n,e[u+15],22,1236535329),o,i,e[u+1],5,-165796510),i=g(i,n,r,o,e[u+6],9,-1069501632),o=g(o,i,n,r,e[u+11],14,643717713),r=g(r,o,i,n,e[u+0],20,-373897302),n=g(n,r,o,i,e[u+5],5,-701558691),i=g(i,n,r,o,e[u+10],9,38016083),o=g(o,i,n,r,e[u+15],14,-660478335),r=g(r,o,i,n,e[u+4],20,-405537848),n=g(n,r,o,i,e[u+9],5,568446438),i=g(i,n,r,o,e[u+14],9,-1019803690),o=g(o,i,n,r,e[u+3],14,-187363961),r=g(r,o,i,n,e[u+8],20,1163531501),n=g(n,r,o,i,e[u+13],5,-1444681467),i=g(i,n,r,o,e[u+2],9,-51403784),o=g(o,i,n,r,e[u+7],14,1735328473),n=y(n,r=g(r,o,i,n,e[u+12],20,-1926607734),o,i,e[u+5],4,-378558),i=y(i,n,r,o,e[u+8],11,-2022574463),o=y(o,i,n,r,e[u+11],16,1839030562),r=y(r,o,i,n,e[u+14],23,-35309556),n=y(n,r,o,i,e[u+1],4,-1530992060),i=y(i,n,r,o,e[u+4],11,1272893353),o=y(o,i,n,r,e[u+7],16,-155497632),r=y(r,o,i,n,e[u+10],23,-1094730640),n=y(n,r,o,i,e[u+13],4,681279174),i=y(i,n,r,o,e[u+0],11,-358537222),o=y(o,i,n,r,e[u+3],16,-722521979),r=y(r,o,i,n,e[u+6],23,76029189),n=y(n,r,o,i,e[u+9],4,-640364487),i=y(i,n,r,o,e[u+12],11,-421815835),o=y(o,i,n,r,e[u+15],16,530742520),n=w(n,r=y(r,o,i,n,e[u+2],23,-995338651),o,i,e[u+0],6,-198630844),i=w(i,n,r,o,e[u+7],10,1126891415),o=w(o,i,n,r,e[u+14],15,-1416354905),r=w(r,o,i,n,e[u+5],21,-57434055),n=w(n,r,o,i,e[u+12],6,1700485571),i=w(i,n,r,o,e[u+3],10,-1894986606),o=w(o,i,n,r,e[u+10],15,-1051523),r=w(r,o,i,n,e[u+1],21,-2054922799),n=w(n,r,o,i,e[u+8],6,1873313359),i=w(i,n,r,o,e[u+15],10,-30611744),o=w(o,i,n,r,e[u+6],15,-1560198380),r=w(r,o,i,n,e[u+13],21,1309151649),n=w(n,r,o,i,e[u+4],6,-145523070),i=w(i,n,r,o,e[u+11],10,-1120210379),o=w(o,i,n,r,e[u+2],15,718787259),r=w(r,o,i,n,e[u+9],21,-343485551),n=b(n,a),r=b(r,s),o=b(o,f),i=b(i,c)}return Array(n,r,o,i)}function h(e,t,n,r,o,i){return b((u=b(b(t,e),b(r,i)))<<(a=o)|u>>>32-a,n);var u,a}function p(e,t,n,r,o,i,u){return h(t&n|~t&r,e,t,o,i,u)}function g(e,t,n,r,o,i,u){return h(t&r|n&~r,e,t,o,i,u)}function y(e,t,n,r,o,i,u){return h(t^n^r,e,t,o,i,u)}function w(e,t,n,r,o,i,u){return h(n^(t|~r),e,t,o,i,u)}function b(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.exports=function(e){return l.hash(e,d,16)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(e,t,n){(function(e,n,r,o,i,u,a,s,f){var c;c=function(e){for(var t,n=new Array(e),r=0;r<e;r++)0==(3&r)&&(t=4294967296*Math.random()),n[r]=t>>>((3&r)<<3)&255;return n},t.exports=c}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){var l=e("./helpers");function d(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var n,r=Array(80),o=1732584193,i=-271733879,u=-1732584194,a=271733878,s=-1009589776,f=0;f<e.length;f+=16){for(var c=o,l=i,d=u,y=a,w=s,b=0;b<80;b++){r[b]=b<16?e[f+b]:g(r[b-3]^r[b-8]^r[b-14]^r[b-16],1);var m=p(p(g(o,5),h(b,i,u,a)),p(p(s,r[b]),(n=b)<20?1518500249:n<40?1859775393:n<60?-1894007588:-899497514));s=a,a=u,u=g(i,30),i=o,o=m}o=p(o,c),i=p(i,l),u=p(u,d),a=p(a,y),s=p(s,w)}return Array(o,i,u,a,s)}function h(e,t,n,r){return e<20?t&n|~t&r:!(e<40)&&e<60?t&n|t&r|n&r:t^n^r}function p(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function g(e,t){return e<<t|e>>>32-t}t.exports=function(e){return l.hash(e,d,20,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(e,t,n){(function(n,r,o,i,u,a,s,f,c){function l(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function d(e,t){return e>>>t|e<<32-t}function h(e,t){return e>>>t}function p(e,t){var n,r,o,i,u,a,s,f,c,p,g,y,w,b,m,v,_,E,I=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),A=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),B=new Array(64);e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;for(var L=0;L<e.length;L+=16){n=A[0],r=A[1],o=A[2],i=A[3],u=A[4],a=A[5],s=A[6],f=A[7];for(var U=0;U<64;U++)B[U]=U<16?e[U+L]:l(l(l(d(E=B[U-2],17)^d(E,19)^h(E,10),B[U-7]),d(_=B[U-15],7)^d(_,18)^h(_,3)),B[U-16]),c=l(l(l(l(f,d(v=u,6)^d(v,11)^d(v,25)),(m=u)&a^~m&s),I[U]),B[U]),p=l(d(b=n,2)^d(b,13)^d(b,22),(g=n)&(y=r)^g&(w=o)^y&w),f=s,s=a,a=u,u=l(i,c),i=o,o=r,r=n,n=l(c,p);A[0]=l(n,A[0]),A[1]=l(r,A[1]),A[2]=l(o,A[2]),A[3]=l(i,A[3]),A[4]=l(u,A[4]),A[5]=l(a,A[5]),A[6]=l(s,A[6]),A[7]=l(f,A[7])}return A}var g=e("./helpers");t.exports=function(e){return g.hash(e,p,32,!0)}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],10:[function(e,t,n){(function(e,n,r,o,i,u,a,s,f){function c(){}(e=t.exports={}).nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,t="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener("message",function(e){var t=e.source;t!==window&&null!==t||"process-tick"!==e.data||(e.stopPropagation(),0<n.length&&n.shift()())},!0),function(e){n.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.on=c,e.addListener=c,e.once=c,e.off=c,e.removeListener=c,e.removeAllListeners=c,e.emit=c,e.binding=function(e){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(e){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:10}],11:[function(e,t,n){(function(e,t,r,o,i,u,a,s,f){n.read=function(e,t,n,r,o){var i,u,a=8*o-r-1,s=(1<<a)-1,f=s>>1,c=-7,l=n?o-1:0,d=n?-1:1,h=e[t+l];for(l+=d,i=h&(1<<-c)-1,h>>=-c,c+=a;0<c;i=256*i+e[t+l],l+=d,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=r;0<c;u=256*u+e[t+l],l+=d,c-=8);if(0===i)i=1-f;else{if(i===s)return u?NaN:1/0*(h?-1:1);u+=Math.pow(2,r),i-=f}return(h?-1:1)*u*Math.pow(2,i-r)},n.write=function(e,t,n,r,o,i){var u,a,s,f=8*i-o-1,c=(1<<f)-1,l=c>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:i-1,p=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,u=c):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),2<=(t+=1<=u+l?d/s:d*Math.pow(2,1-l))*s&&(u++,s/=2),c<=u+l?(a=0,u=c):1<=u+l?(a=(t*s-1)*Math.pow(2,o),u+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,o),u=0));8<=o;e[n+h]=255&a,h+=p,a/=256,o-=8);for(u=u<<o|a,f+=o;0<f;e[n+h]=255&u,h+=p,u/=256,f-=8);e[n+h-p]|=128*g}}).call(this,e("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ieee754/index.js","/node_modules/ieee754")},{buffer:3,lYpoI2:10}]},{},[1])(1)});
|
|
2015
1941
|
|
|
2016
1942
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
2017
|
-
},{}]},{},[
|
|
1943
|
+
},{}]},{},[27])(27)
|
|
2018
1944
|
});
|