@mlightcad/data-model 1.2.18 → 1.2.19
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/data-model.cjs +3 -3
- package/dist/data-model.js +4705 -4704
- package/lib/converter/AcDbDxfConverter.d.ts +6 -5
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
- package/lib/converter/AcDbDxfConverter.js +14 -7
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +11 -2
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +6 -5
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbDatabaseConverter.d.ts +20 -8
- package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -1
- package/lib/database/AcDbDatabaseConverter.js +1 -10
- package/lib/database/AcDbDatabaseConverter.js.map +1 -1
- package/package.json +3 -3
package/dist/data-model.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function jc(i,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in i)){const h=Object.getOwnPropertyDescriptor(s,o);h&&Object.defineProperty(i,o,h.get?h:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}const qs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Gi=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function ls(i,e,t){return Math.max(e,Math.min(t,i))}const Go=class Wo{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(ls(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=ls(e,0,256),this._colorIndex>0&&this._colorIndex<256?(this._color=Gi[e],this._colorName=this.getColorNameByValue(this._color)):(this._color=null,this._colorName=null))}get colorName(){return this._colorName}set colorName(e){if(e){const t=qs[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,s){const o=Math.round(ls(e,0,255)),h=Math.round(ls(t,0,255)),u=Math.round(ls(s,0,255));return this.color=(o<<16)+(h<<8)+u,this}setColorName(e){const t=qs[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new Wo;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,s]of Object.entries(qs))if(s===e)return t;return null}getColorIndexByValue(e){const t=Gi.length-1;for(let s=1;s<t;++s)if(Gi[s]===e)return s;return null}};Go.NAMES=qs;let fn=Go;const Ut={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};let Gc=class{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const o=s.indexOf(t);o!==-1&&s.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const s=t.slice(0);for(let o=0,h=s.length;o<h;o++)s[o].call(this,e)}}},it=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const s of this.listeners)s.call(null,e,...t)}};var Wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ho={exports:{}};(function(i){(function(e,t){i.exports?i.exports=t():e.log=t()})(Wc,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],h={},u=null;function g(D,U){var B=D[U];if(typeof B.bind=="function")return B.bind(D);try{return Function.prototype.bind.call(B,D)}catch{return function(){return Function.prototype.apply.apply(B,[D,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(D){return D==="debug"&&(D="log"),typeof console===t?!1:D==="trace"&&s?b:console[D]!==void 0?g(console,D):console.log!==void 0?g(console,"log"):e}function A(){for(var D=this.getLevel(),U=0;U<o.length;U++){var B=o[U];this[B]=U<D?e:this.methodFactory(B,D,this.name)}if(this.log=this.debug,typeof console===t&&D<this.levels.SILENT)return"No console available for logging"}function x(D){return function(){typeof console!==t&&(A.call(this),this[D].apply(this,arguments))}}function E(D,U,B){return f(D)||x.apply(this,arguments)}function M(D,U){var B=this,ge,be,oe,W="loglevel";typeof D=="string"?W+=":"+D:typeof D=="symbol"&&(W=void 0);function ce(xe){var Le=(o[xe]||"silent").toUpperCase();if(!(typeof window===t||!W)){try{window.localStorage[W]=Le;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Le+";"}catch{}}}function se(){var xe;if(!(typeof window===t||!W)){try{xe=window.localStorage[W]}catch{}if(typeof xe===t)try{var Le=window.document.cookie,dt=encodeURIComponent(W),mt=Le.indexOf(dt+"=");mt!==-1&&(xe=/^([^;]+)/.exec(Le.slice(mt+dt.length+1))[1])}catch{}return B.levels[xe]===void 0&&(xe=void 0),xe}}function Ve(){if(!(typeof window===t||!W)){try{window.localStorage.removeItem(W)}catch{}try{window.document.cookie=encodeURIComponent(W)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Ye(xe){var Le=xe;if(typeof Le=="string"&&B.levels[Le.toUpperCase()]!==void 0&&(Le=B.levels[Le.toUpperCase()]),typeof Le=="number"&&Le>=0&&Le<=B.levels.SILENT)return Le;throw new TypeError("log.setLevel() called with invalid level: "+xe)}B.name=D,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=U||E,B.getLevel=function(){return oe??be??ge},B.setLevel=function(xe,Le){return oe=Ye(xe),Le!==!1&&ce(oe),A.call(B)},B.setDefaultLevel=function(xe){be=Ye(xe),se()||B.setLevel(xe,!1)},B.resetLevel=function(){oe=null,Ve(),A.call(B)},B.enableAll=function(xe){B.setLevel(B.levels.TRACE,xe)},B.disableAll=function(xe){B.setLevel(B.levels.SILENT,xe)},B.rebuild=function(){if(u!==B&&(ge=Ye(u.getLevel())),A.call(B),u===B)for(var xe in h)h[xe].rebuild()},ge=Ye(u?u.getLevel():"WARN");var We=se();We!=null&&(oe=Ye(We)),A.call(B)}u=new M,u.getLogger=function(D){if(typeof D!="symbol"&&typeof D!="string"||D==="")throw new TypeError("You must supply a name when creating a logger.");var U=h[D];return U||(U=h[D]=new M(D,u.methodFactory)),U};var z=typeof window!==t?window.log:void 0;return u.noConflict=function(){return typeof window!==t&&window.log===u&&(window.log=z),u},u.getLoggers=function(){return h},u.default=u,u})})(Ho);var qo=Ho.exports;const qc=Hc(qo),Yc=jc({__proto__:null,default:qc},[qo]),Xc=!0,Es=Yc;Es.setLevel("debug");const Kc=i=>{try{Es.setLevel(i)}catch(e){Es.setLevel("error"),Es.error(e)}};function Ss(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function Bn(i,...e){for(const t of e)if(t)for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&i[s]===void 0&&(i[s]=t[s]);return i}function Yo(i,e){return i!=null&&Object.prototype.hasOwnProperty.call(i,e)}function Xo(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function zn(i,e){if(i===e)return!0;if(i==null||e==null)return i===e;if(typeof i!=typeof e)return!1;if(typeof i!="object")return i===e;if(Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)){if(i.length!==e.length)return!1;for(let o=0;o<i.length;o++)if(!zn(i[o],e[o]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const o of t)if(!Object.prototype.hasOwnProperty.call(e,o)||!zn(i[o],e[o]))return!1;return!0}let Ko=class $o{constructor(e,t){this.events={attrChanged:new it,modelChanged:new it},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=e||{};t&&Bn(s,t),this.attributes=s,this.changed={}}get(e){return this.attributes[e]}set(e,t,s){if(e==null)return this;let o;typeof e=="object"?(o=e,s=t):(o={},o[e]=t),s||(s={});const h=s.unset,u=s.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Ss(this.attributes),this.changed={});const f=this.attributes,A=this.changed,x=this._previousAttributes;for(const E in o)t=o[E],zn(f[E],t)||g.push(E),zn(x[E],t)?delete A[E]:A[E]=t,h?delete f[E]:f[E]=t;if(!u){g.length&&(this._pending=s);for(let E=0;E<g.length;E++)this.events.attrChanged.dispatch({object:this,attrName:g[E],attrValue:f[g[E]],options:s})}if(b)return this;if(!u)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!Xo(this.changed):Yo(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Ss(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,s={};for(const o in e){const h=e[o];zn(t[o],h)||(s[o]=h)}return s}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Ss(this._previousAttributes)}clone(){const e=Ss(this.attributes);return new $o(e)}},ca=class Is{constructor(){this.entries=new Map}static getInstance(){return Is.instance||(Is.instance=new Is),Is.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class $c{static formatBytes(e,t=2){if(e===0)return"0 B";const s=1024,o=Math.max(0,t),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(e)/Math.log(s)),g=e/Math.pow(s,u);return`${parseFloat(g.toFixed(o))} ${h[u]}`}}class Zo{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class Qo{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(e){return new Promise((t,s)=>{const o=()=>{Promise.resolve(e()).then(t).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let s=e;for(let o=0;o<t;o++){const h=this.tasks[o];try{s=await this.scheduleTask(async()=>{const u=await h.run(s);return this.onProgress((o+1)/t,h),u})}catch(u){this.onError({error:u,taskIndex:o,task:h});return}}this.onComplete(s)}}let Jo=class{constructor(e,t,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=s}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,s=this.handlers.length;t<s;t+=2){const o=this.handlers[t],h=this.handlers[t+1];if(o.global&&(o.lastIndex=0),o.test(e))return h}return null}};const el=new Jo;let Zc=class{constructor(e){this.manager=e!==void 0?e:el,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((s,o)=>{this.load(e,s,t,o)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};class tl{constructor(e,t,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,s)=>{const o=()=>{Promise.resolve(e()).then(t).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}async processChunk(e){let t=0;const s=async()=>{const o=t,h=Math.min(t+this._chunkSize,this._count);await e(o,h),t=h,t<this._count&&await this.scheduleTask(s)};await s()}}var ht,hs,Qe,st,cs,Jt,yt,pr,er,Jr,us,ds,en,tn,ms,ps,gs,Ct,gr,qe,rn,fs,_e,bt,_s,xt,vs,fr,_r,tr,ys,nn,Nt,vr,sn,Wi,Hi,yr,br,bs,xs,xr,ws,qi,Yi,ct,wr,ut,Lt,Xi,Ki,$i,Zi,Ar,Ot,an,As,on,zt,Pr,Dt,Sr;(ht={})[ht.None=0]="None",ht[ht.Anonymous=1]="Anonymous",ht[ht.NonConstant=2]="NonConstant",ht[ht.Xref=4]="Xref",ht[ht.XrefOverlay=8]="XrefOverlay",ht[ht.ExternallyDependent=16]="ExternallyDependent",ht[ht.ResolvedOrDependent=32]="ResolvedOrDependent",ht[ht.ReferencedXref=64]="ReferencedXref";(hs={})[hs.BYBLOCK=0]="BYBLOCK",hs[hs.BYLAYER=256]="BYLAYER";(Qe={})[Qe.Rotated=0]="Rotated",Qe[Qe.Aligned=1]="Aligned",Qe[Qe.Angular=2]="Angular",Qe[Qe.Diameter=3]="Diameter",Qe[Qe.Radius=4]="Radius",Qe[Qe.Angular3Point=5]="Angular3Point",Qe[Qe.Ordinate=6]="Ordinate",Qe[Qe.ReferenceIsExclusive=32]="ReferenceIsExclusive",Qe[Qe.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Qe[Qe.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(st={})[st.TopLeft=1]="TopLeft",st[st.TopCenter=2]="TopCenter",st[st.TopRight=3]="TopRight",st[st.MiddleLeft=4]="MiddleLeft",st[st.MiddleCenter=5]="MiddleCenter",st[st.MiddleRight=6]="MiddleRight",st[st.BottomLeft=7]="BottomLeft",st[st.BottomCenter=8]="BottomCenter",st[st.BottomRight=9]="BottomRight";(cs={})[cs.AtLeast=1]="AtLeast",cs[cs.Exact=2]="Exact";var Io=((Jt={})[Jt.Center=0]="Center",Jt[Jt.Above=1]="Above",Jt[Jt.Outside=2]="Outside",Jt[Jt.JIS=3]="JIS",Jt[Jt.Below=4]="Below",Jt),Nn=((yt={})[yt.Feet=0]="Feet",yt[yt.None=1]="None",yt[yt.Inch=2]="Inch",yt[yt.FeetAndInch=3]="FeetAndInch",yt[yt.Leading=4]="Leading",yt[yt.Trailing=8]="Trailing",yt[yt.LeadingAndTrailing=12]="LeadingAndTrailing",yt),Qc=((pr={})[pr.None=0]="None",pr[pr.Leading=1]="Leading",pr[pr.Trailing=2]="Trailing",pr[pr.LeadingAndTrailing=3]="LeadingAndTrailing",pr),Jc=((er={})[er.Center=0]="Center",er[er.Left=1]="Left",er[er.Right=2]="Right",er[er.OverFirst=3]="OverFirst",er[er.OverSecond=4]="OverSecond",er),eu=((Jr={})[Jr.Bottom=0]="Bottom",Jr[Jr.Center=1]="Center",Jr[Jr.Top=2]="Top",Jr);(us={})[us.PatternFill=0]="PatternFill",us[us.SolidFill=1]="SolidFill";(ds={})[ds.NonAssociative=0]="NonAssociative",ds[ds.Associative=1]="Associative";(en={})[en.Normal=0]="Normal",en[en.Outer=1]="Outer",en[en.Ignore=2]="Ignore";(tn={})[tn.UserDefined=0]="UserDefined",tn[tn.Predefined=1]="Predefined",tn[tn.Custom=2]="Custom";(ms={})[ms.NotAnnotated=0]="NotAnnotated",ms[ms.Annotated=1]="Annotated";(ps={})[ps.Solid=0]="Solid",ps[ps.Gradient=1]="Gradient";(gs={})[gs.TwoColor=0]="TwoColor",gs[gs.OneColor=1]="OneColor";var tu=((Ct={})[Ct.Default=0]="Default",Ct[Ct.External=1]="External",Ct[Ct.Polyline=2]="Polyline",Ct[Ct.Derived=4]="Derived",Ct[Ct.Textbox=8]="Textbox",Ct[Ct.Outermost=16]="Outermost",Ct),Vs=((gr={})[gr.Line=1]="Line",gr[gr.Circular=2]="Circular",gr[gr.Elliptic=3]="Elliptic",gr[gr.Spline=4]="Spline",gr),ru=((qe={})[qe.Off=0]="Off",qe[qe.Solid=1]="Solid",qe[qe.Dashed=2]="Dashed",qe[qe.Dotted=3]="Dotted",qe[qe.ShotDash=4]="ShotDash",qe[qe.MediumDash=5]="MediumDash",qe[qe.LongDash=6]="LongDash",qe[qe.DoubleShortDash=7]="DoubleShortDash",qe[qe.DoubleMediumDash=8]="DoubleMediumDash",qe[qe.DoubleLongDash=9]="DoubleLongDash",qe[qe.DoubleMediumLongDash=10]="DoubleMediumLongDash",qe[qe.SparseDot=11]="SparseDot",qe);ru.Off;(rn={})[rn.Standard=-3]="Standard",rn[rn.ByLayer=-2]="ByLayer",rn[rn.ByBlock=-1]="ByBlock";(fs={})[fs.English=0]="English",fs[fs.Metric=1]="Metric";(_e={})[_e.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",_e[_e.FRONT_CLIPPING=2]="FRONT_CLIPPING",_e[_e.BACK_CLIPPING=4]="BACK_CLIPPING",_e[_e.UCS_FOLLOW=8]="UCS_FOLLOW",_e[_e.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",_e[_e.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",_e[_e.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",_e[_e.FAST_ZOOM=128]="FAST_ZOOM",_e[_e.SNAP_MODE=256]="SNAP_MODE",_e[_e.GRID_MODE=512]="GRID_MODE",_e[_e.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",_e[_e.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",_e[_e.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",_e[_e.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",_e[_e.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",_e[_e.UNUSED=32768]="UNUSED",_e[_e.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",_e[_e.VIEWPORT_OFF=131072]="VIEWPORT_OFF",_e[_e.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",_e[_e.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",_e[_e.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",_e[_e.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(bt={})[bt.OPTIMIZED_2D=0]="OPTIMIZED_2D",bt[bt.WIREFRAME=1]="WIREFRAME",bt[bt.HIDDEN_LINE=2]="HIDDEN_LINE",bt[bt.FLAT_SHADED=3]="FLAT_SHADED",bt[bt.GOURAUD_SHADED=4]="GOURAUD_SHADED",bt[bt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",bt[bt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(_s={})[_s.UCS_UNCHANGED=0]="UCS_UNCHANGED",_s[_s.HAS_OWN_UCS=1]="HAS_OWN_UCS";(xt={})[xt.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",xt[xt.TOP=1]="TOP",xt[xt.BOTTOM=2]="BOTTOM",xt[xt.FRONT=3]="FRONT",xt[xt.BACK=4]="BACK",xt[xt.LEFT=5]="LEFT",xt[xt.RIGHT=6]="RIGHT";(vs={})[vs.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",vs[vs.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(fr={})[fr.ByLayer=0]="ByLayer",fr[fr.ByBlock=1]="ByBlock",fr[fr.ByDictionaryDefault=2]="ByDictionaryDefault",fr[fr.ByObject=3]="ByObject";function Ae(i,e,t){return i.code===e&&(t==null||i.value===t)}function ze(i){let e={};i.rewind();let t=i.next(),s=t.code;if(e.x=t.value,(t=i.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=i.next()).code!==s+20?i.rewind():e.z=t.value,e}let ua=Symbol();function ye(i,e){return(t,s,o)=>{let h=function(b,f=!1){return b.reduce((A,x)=>{x.pushContext&&A.push({});let E=A[A.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let z=E[M]??(E[M]=[]);x.isMultiple&&z.length&&f&&console.warn(`Snippet ${z[z.length-1].name} for code(${M}) is shadowed by ${x.name}`),z.push(x)}return A},[{}])}(i,s.debug),u=!1,g=h.length-1;for(;!Ae(t,0,"EOF");){let b=function(U,B,ge){return U.find((be,oe)=>{var W;return oe>=ge&&((W=be[B])==null?void 0:W.length)})}(h,t.code,g),f=b==null?void 0:b[t.code],A=f==null?void 0:f[f.length-1];if(!b||!A){s.rewind();break}A.isMultiple||b[t.code].pop();let{name:x,parser:E,isMultiple:M,isReducible:z}=A,D=E==null?void 0:E(t,s,o);if(D===ua){s.rewind();break}if(x){let[U,B]=function(ge,be){let oe=be.split(".");if(!oe.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let W=ge;for(let ce=0;ce<oe.length-1;++ce){let se=Qi(oe[ce]),Ve=Qi(oe[ce+1]);Object.prototype.hasOwnProperty.call(W,se)||(typeof Ve=="number"?W[se]=[]:W[se]={}),W=W[se]}return[W,Qi(oe[oe.length-1])]}(o,x);M&&!z?(Object.prototype.hasOwnProperty.call(U,B)||(U[B]=[]),U[B].push(D)):U[B]=D}A.pushContext&&(g-=1),u=!0,t=s.next()}return e&&Object.setPrototypeOf(o,e),u}}function Qi(i){let e=Number.parseInt(i);return Number.isNaN(e)?i:e}function y({value:i}){return i}function G(i,e){return ze(e)}function Be({value:i}){return!!i}let nu=[{code:1001,name:"xdata",parser:rl}];function rl(i,e){var o;if(!Ae(i,1001))throw Error("XData must starts with code 1001");let t={appName:i.value,value:[]};i=e.next();let s=[t.value];for(;!Ae(i,0,"EOF")&&i.code>=1e3;){let h=s[s.length-1];switch(i.code){case 1002:i.value==="{"?s.push([]):(s.pop(),(o=s[s.length-1])==null||o.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:Ir(i.code),value:i.value});break;case 1003:h.push({name:"layer",type:Ir(i.code),value:i.value});break;case 1005:h.push({name:"handle",type:Ir(i.code),value:i.value});break;case 1010:h.push({type:Ir(i.code),value:ze(e)});break;case 1011:h.push({name:"worldSpacePosition",type:Ir(i.code),value:ze(e)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:Ir(i.code),value:ze(e)});break;case 1013:h.push({name:"worldSpaceDirection",type:Ir(i.code),value:ze(e)});break;case 1041:h.push({name:"distance",type:Ir(i.code),value:i.value});break;case 1042:h.push({name:"scale",type:Ir(i.code),value:i.value})}i=e.next()}return e.rewind(),t}function Ir(i){switch(i){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function dn(i,e,t){for(;Ae(i,102);){var s;let o=i.value;if(i=e.next(),!o.startsWith("{")){e.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${o}`),function(u,g){for(;!Ae(u,102)&&!Ae(u,0,"EOF");)u=g.next()}(i,e),i=e.next();continue}let h=o.slice(1).trim();t.extensions??(t.extensions={}),(s=t.extensions)[h]??(s[h]=[]),function(u,g,b){for(;!Ae(u,102,"}")&&!Ae(u,0,"EOF");)b.push(u),u=g.next()}(i,e,t.extensions[h]),i=e.next()}e.rewind()}let su=0;function nl(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=su++)}var iu=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function sl(i){return iu[i]}(_r={})[_r.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",_r[_r.CAST=1]="CAST",_r[_r.RECEIVE=2]="RECEIVE",_r[_r.IGNORE=3]="IGNORE";let Ue=[...nu,{code:284,name:"shadowMode",parser:y},{code:390,name:"plotStyleHardId",parser:y},{code:380,name:"plotStyleType",parser:y},{code:440,name:"transparency",parser:y},{code:430,name:"colorName",parser:y},{code:420,name:"color",parser:y},{code:310,name:"proxyEntity",isMultiple:!0,parser:y},{code:92,name:"proxyByte",parser:y},{code:60,name:"isVisible",parser:Be},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(i,e,t){let s=i.value;return s>0&&s<256&&(t.color=sl(Math.abs(s))),s}},{code:347,name:"materialObjectHardId",parser:y},{code:6,name:"lineType",parser:y},{code:8,name:"layer",parser:y},{code:410,name:"layoutTabName",parser:y},{code:67,name:"isInPaperSpace",parser:Be},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:dn},{code:102,parser:dn},{code:102,parser:dn},{code:5,name:"handle",parser:y}];function Ii(i){return[{code:3,name:i,parser:(e,t,s)=>(s._code3text=(s._code3text??"")+e.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(e,t,s)=>(s._code1text=e.value,(s._code3text??"")+s._code1text)}]}function il(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let au={extrusionDirection:{x:0,y:0,z:1}},ou=[{code:210,name:"extrusionDirection",parser:G},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:100,name:"subclassMarker",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:y},{code:100},...Ue];class al{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){il(this,"parser",ye(ou,au))}}il(al,"ForEntityName","ARC");(tr={})[tr.NONE=0]="NONE",tr[tr.INVISIBLE=1]="INVISIBLE",tr[tr.CONSTANT=2]="CONSTANT",tr[tr.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",tr[tr.PRESET=8]="PRESET";(ys={})[ys.MULTILINE=2]="MULTILINE",ys[ys.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(nn={})[nn.NONE=0]="NONE",nn[nn.MIRRORED_X=2]="MIRRORED_X",nn[nn.MIRRORED_Y=4]="MIRRORED_Y";var lu=((Nt={})[Nt.LEFT=0]="LEFT",Nt[Nt.CENTER=1]="CENTER",Nt[Nt.RIGHT=2]="RIGHT",Nt[Nt.ALIGNED=3]="ALIGNED",Nt[Nt.MIDDLE=4]="MIDDLE",Nt[Nt.FIT=5]="FIT",Nt),hu=((vr={})[vr.BASELINE=0]="BASELINE",vr[vr.BOTTOM=1]="BOTTOM",vr[vr.MIDDLE=2]="MIDDLE",vr[vr.TOP=3]="TOP",vr);function ol(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let ll={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:lu.LEFT,valign:hu.BASELINE,extrusionDirection:{x:0,y:0,z:1}},hl=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:72,name:"valign",parser:y},{code:72,name:"halign",parser:y},{code:71,name:"generationFlag",parser:y},{code:7,name:"styleName",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"xScale",parser:y},{code:50,name:"rotation",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class cl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ol(this,"parser",ye(hl,ll))}}function ul(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ol(cl,"ForEntityName","TEXT");let cu={...ll},uu=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Be},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Be},{code:100},{code:280,name:"isLocked",parser:Be},{code:74,name:"valign",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:3,name:"prompt",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},...hl.slice(2)];class dl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ul(this,"parser",ye(uu,cu))}}ul(dl,"ForEntityName","ATTDEF");(sn={})[sn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",sn[sn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",sn[sn.BY_STYLE=5]="BY_STYLE";function du(i,e){let t={};for(let s of i){let o=e(s);o!=null&&(t[o]??(t[o]=[]),t[o].push(s))}return t}function*Js(i,e=1/0,t=1){for(let s=i;s!==e;s+=t)yield s}function Vr(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}function da(i,e,t){if(Ae(e,102))return dn(e,t,i),!0;switch(e.code){case 0:i.type=e.value;break;case 5:i.handle=e.value;break;case 330:i.ownerBlockRecordSoftId=e.value;break;case 67:i.isInPaperSpace=!!e.value;break;case 8:i.layer=e.value;break;case 6:i.lineType=e.value;break;case 347:i.materialObjectHardId=e.value;break;case 62:i.colorIndex=e.value,i.color=sl(Math.abs(e.value));break;case 370:i.lineweight=e.value;break;case 48:i.lineTypeScale=e.value;break;case 60:i.isVisible=!!e.value;break;case 92:i.proxyByte=e.value;break;case 310:i.proxyEntity=e.value;break;case 100:break;case 420:i.color=e.value;break;case 430:i.transparency=e.value;break;case 390:i.plotStyleHardId=e.value;break;case 284:i.shadowMode=e.value;break;case 1001:i.xdata=rl(e,t);break;default:return!1}return!0}function ml(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let mu={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Ys=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(i,e){(function(t){t.rewind();let s=t.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=t.next();while(s.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:y},{code:49,name:"columnGutter",parser:y},{code:48,name:"columnWidth",parser:y},{code:79,name:"columnAutoHeight",parser:y},{code:78,name:"columnFlowReversed",parser:y},{code:76,name:"columnCount",parser:y},{code:75,name:"columnType",parser:y},{code:441,name:"backgroundFillTransparency",parser:y},{code:63,name:"backgroundFillColor",parser:y},{code:45,name:"fillBoxScale",parser:y},{code:[...Js(430,440)],name:"backgroundColor",parser:y},{code:[...Js(420,430)],name:"backgroundColor",parser:y},{code:90,name:"backgroundFill",parser:y},{code:44,name:"lineSpacing",parser:y},{code:73,name:"lineSpacingStyle",parser:y},{code:50,name:"rotation",parser:y},{code:43},{code:42},{code:11,name:"direction",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:7,name:"styleName",parser:y},...Ii("text"),{code:72,name:"drawingDirection",parser:y},{code:71,name:"attachmentPoint",parser:y},{code:41,name:"width",parser:y},{code:40,name:"height",parser:y},{code:10,name:"insertionPoint",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class pl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ml(this,"parser",ye(Ys,mu))}}function gl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ml(pl,"ForEntityName","MTEXT");let pu={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},gu=[...Ys.slice(Ys.findIndex(({name:i})=>i==="columnType"),Ys.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!Ae(i,0,"MTEXT"))return ua}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Be},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Be},{code:100},{code:280,name:"lockPositionFlag",parser:Be},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"alignmentPoint",parser:G},{code:74,name:"verticalJustification",parser:y},{code:72,name:"horizontalJustification",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:7,name:"textStyle",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"scale",parser:y},{code:50,name:"rotation",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100},...Ue];class fl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){gl(this,"parser",ye(gu,pu))}}function _l(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}gl(fl,"ForEntityName","ATTRIB");let fu=[...Ii("data"),{code:70,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class vl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){_l(this,"parser",ye(fu))}}function yl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}_l(vl,"ForEntityName","BODY");let _u={thickness:0,extrusionDirection:{x:0,y:0,z:1}},vu=[{code:210,name:"extrusionDirection",parser:G},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class bl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){yl(this,"parser",ye(vu,_u))}}yl(bl,"ForEntityName","CIRCLE");class Xs{parseEntity(e,t){let s={};for(;!Ae(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(o,h,u){switch(h.code){case 100:o.subclassMarker=h.value;break;case 280:o.version=h.value;break;case 2:o.name=h.value;break;case 10:o.definitionPoint=ze(u);break;case 11:o.textPoint=ze(u);break;case 12:o.insertionPoint=ze(u);break;case 13:o.subDefinitionPoint1=ze(u);break;case 14:o.subDefinitionPoint2=ze(u);break;case 15:o.centerPoint=ze(u);break;case 16:o.arcPoint=ze(u);break;case 70:o.dimensionType=h.value;break;case 71:o.attachmentPoint=h.value;break;case 72:o.textLineSpacingStyle=h.value;break;case 40:o.leaderLength=h.value;break;case 41:o.textLineSpacingFactor=h.value;break;case 42:o.measurement=h.value;break;case 1:o.text=h.value;break;case 50:o.rotationAngle=h.value;break;case 52:o.obliqueAngle=h.value;break;case 53:o.textRotation=h.value;break;case 51:o.ocsRotation=h.value;break;case 210:o.extrusionDirection=ze(u);break;case 3:o.styleName=h.value;break;default:da(o,h,u)}})(s,t,e),t=e.next()}return s}}function xl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Hi="DIMENSION",(Wi="ForEntityName")in Xs?Object.defineProperty(Xs,Wi,{value:Hi,enumerable:!0,configurable:!0,writable:!0}):Xs[Wi]=Hi;let yu={extrusionDirection:{x:0,y:0,z:1}},bu=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"majorAxisEndPoint",parser:G},{code:10,name:"center",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class wl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){xl(this,"parser",ye(bu,yu))}}xl(wl,"ForEntityName","ELLIPSE");(yr={})[yr.First=1]="First",yr[yr.Second=2]="Second",yr[yr.Third=4]="Third",yr[yr.Fourth=8]="Fourth";function Al(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let xu=[{code:13,name:"vertices.3",parser:G},{code:12,name:"vertices.2",parser:G},{code:11,name:"vertices.1",parser:G},{code:10,name:"vertices.0",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Pl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Al(this,"parser",ye(xu))}}Al(Pl,"ForEntityName","3DFACE");let Sl=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],wu=[{code:11,name:"end",parser:G},{code:10,name:"start",parser:G}],Au=[{code:73,name:"isCCW",parser:Be},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G}],Pu=[{code:73,name:"isCCW",parser:Be},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:G},{code:10,name:"center",parser:G}],Su=[{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:11,name:"fitDatum",isMultiple:!0,parser:G},{code:97,name:"numberOfFitData",parser:y},{code:10,name:"controlPoints",isMultiple:!0,parser(i,e){let t={...ze(e),weight:1};return(i=e.next()).code===42?t.weight=i.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:y},{code:96,name:"numberOfControlPoints",parser:y},{code:95,name:"numberOfKnots",parser:y},{code:74,name:"isPeriodic",parser:Be},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],Iu={[Vs.Line]:wu,[Vs.Circular]:Au,[Vs.Elliptic]:Pu,[Vs.Spline]:Su},Eu=[...Sl,{code:72,name:"edges",parser(i,e){let t={type:i.value},s=ye(Iu[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(i=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],ku=[...Sl,{code:10,name:"vertices",parser(i,e){let t={...ze(e),bulge:0};return(i=e.next()).code===42?t.bulge=i.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:y},{code:73,name:"isClosed",parser:Be},{code:72,name:"hasBulge",parser:Be}],Mu=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:Eo},{code:43,name:"base",parser:Eo},{code:53,name:"angle",parser:y}];function Eo(i,e){let t=i.code+1,s={x:i.value,y:1};return(i=e.next()).code===t?s.y=i.value:e.rewind(),s}function Il(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Tu={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Cu=[{code:470},{code:463},{code:462,name:"colorTint",parser:y},{code:461,name:"gradientDefinition",parser:y},{code:460,name:"gradientRotation",parser:y},{code:453,name:"numberOfColors",parser:y},{code:452,name:"gradientColorFlag",parser:y},{code:451},{code:450,name:"gradientFlag",parser:y},{code:10,name:"seedPoints",parser:G,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:G},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(i,e){let t={};return ye(Mu)(i,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Be},{code:73,name:"isAnnotated",parser:Be},{code:41,name:"patternScale",parser:y},{code:52,name:"patternAngle",parser:y},{code:76,name:"patternType",parser:y},{code:75,name:"hatchStyle",parser:y},{code:92,name:"boundaryPaths",parser:function(i,e){let t={boundaryPathTypeFlag:i.value},s=t.boundaryPathTypeFlag&tu.Polyline;return i=e.next(),s?ye(ku)(i,e,t):ye(Eu)(i,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:y},{code:71,name:"associativity",parser:y},{code:63,name:"patternFillColor",parser:y},{code:70,name:"solidFill",parser:y},{code:2,name:"patternName",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:10,name:"elevationPoint",parser:G},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...Ue];class El{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Il(this,"parser",ye(Cu,Tu))}}Il(El,"ForEntityName","HATCH");(br={})[br.ShowImage=1]="ShowImage",br[br.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",br[br.UseClippingBoundary=4]="UseClippingBoundary",br[br.TransparencyIsOn=8]="TransparencyIsOn";(bs={})[bs.Rectangular=1]="Rectangular",bs[bs.Polygonal=2]="Polygonal";(xs={})[xs.Outside=0]="Outside",xs[xs.Inside=1]="Inside";function kl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Nu={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Lu=[{code:290,name:"clipMode",parser:y},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:G},{code:91,name:"countBoundaryPoints",parser:y},{code:71,name:"clippingBoundaryType",parser:y},{code:360,name:"imageDefReactorHandle",parser:y},{code:283,name:"fade",parser:y},{code:282,name:"contrast",parser:y},{code:281,name:"brightness",parser:y},{code:280,name:"isClipped",parser:Be},{code:70,name:"flags",parser:y},{code:340,name:"imageDefHandle",parser:y},{code:13,name:"imageSize",parser:G},{code:12,name:"vPixel",parser:G},{code:11,name:"uPixel",parser:G},{code:10,name:"position",parser:G},{code:90,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Ml{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){kl(this,"parser",ye(Lu,Nu))}}function Tl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}kl(Ml,"ForEntityName","IMAGE");let Ou={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},zu=[{code:210,name:"extrusionDirection",parser:G},{code:45,name:"rowSpacing",parser:y},{code:44,name:"columnSpacing",parser:y},{code:71,name:"rowCount",parser:y},{code:70,name:"columnCount",parser:y},{code:50,name:"rotation",parser:y},{code:43,name:"zScale",parser:y},{code:42,name:"yScale",parser:y},{code:41,name:"xScale",parser:y},{code:10,name:"insertionPoint",parser:G},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Be},{code:100,name:"subclassMarker",parser:y},...Ue];class Cl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Tl(this,"parser",ye(zu,Ou))}}function Nl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Tl(Cl,"ForEntityName","INSERT");let Du={isArrowheadEnabled:!0},Ru=[{code:213,name:"offsetFromAnnotation",parser:G},{code:212,name:"offsetFromBlock",parser:G},{code:211,name:"horizontalDirection",parser:G},{code:210,name:"normal",parser:G},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:76,name:"numberOfVertices",parser:y},{code:41,name:"textWidth",parser:y},{code:40,name:"textHeight",parser:y},{code:75,name:"isHooklineExists",parser:Be},{code:74,name:"isHooklineSameDirection",parser:Be},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Be},{code:71,name:"isArrowheadEnabled",parser:Be},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue],Ll=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Nl(this,"parser",ye(Ru,Du))}};Nl(Ll,"ForEntityName","LEADER");(xr={})[xr.TextAnnotation=0]="TextAnnotation",xr[xr.ToleranceAnnotation=1]="ToleranceAnnotation",xr[xr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",xr[xr.NoAnnotation=3]="NoAnnotation";function Ol(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Bu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Fu=[{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class zl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Ol(this,"parser",ye(Fu,Bu))}}Ol(zl,"ForEntityName","LINE");(ws={})[ws.IS_CLOSED=1]="IS_CLOSED",ws[ws.PLINE_GEN=128]="PLINE_GEN";let Uu={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Vu={bulge:0},ju=[{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:91,name:"id",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y}],Gu=[{code:210,name:"extrusionDirection",parser:G},{code:10,name:"vertices",isMultiple:!0,parser(i,e){let t={};return ye(ju,Vu)(i,e,t),t}},{code:39,name:"thickness",parser:y},{code:38,name:"elevation",parser:y},{code:43,name:"constantWidth",parser:y},{code:70,name:"flag",parser:y},{code:90,name:"numberOfVertices",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Ks{parseEntity(e,t){let s={};return ye(Gu,Uu)(t,e,s),s}}function Dl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Yi="LWPOLYLINE",(qi="ForEntityName")in Ks?Object.defineProperty(Ks,qi,{value:Yi,enumerable:!0,configurable:!0,writable:!0}):Ks[qi]=Yi;let Wu=[{code:90,name:"overridenSubEntityCount",parser:y},{code:140,name:"edgeCreaseWeights",parser:y,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:y},{code:94,parser(i,e,t){t.edgeCount=i.value,t.edgeIndices=[];for(let s=0;s<t.edgeCount;++s){let o=[];i=e.next(),o[0]=i.value,i=e.next(),o[1]=i.value,t.edgeIndices.push(o)}}},{code:93,parser(i,e,t){t.totalFaceIndices=i.value,t.faceIndices=[];let s=[];for(let h=0;h<t.totalFaceIndices&&!Ae(i,0);++h)i=e.next(),s.push(i.value);let o=0;for(;o<s.length;){let h=s[o++],u=[];for(let g=0;g<h;++g)u.push(s[o++]);t.faceIndices.push(u)}}},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:92,name:"verticesCount",parser:y},{code:91,name:"subdivisionLevel",parser:y},{code:40,name:"blendCrease",parser:y},{code:72,name:"isBlendCreased",parser:Be},{code:71,name:"version",parser:y},{code:100,name:"subclassMarker",parser:function({value:i}){return i.trim()},pushContext:!0},...Ue];class Rl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Dl(this,"parser",ye(Wu))}}function Bl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Dl(Rl,"ForEntityName","MESH");let Hu={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},qu=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Fl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Bl(this,"parser",ye(qu,Hu))}}Bl(Fl,"ForEntityName","POINT");(ct={})[ct.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ct[ct.CURVE_FIT=2]="CURVE_FIT",ct[ct.SPLINE_FIT=4]="SPLINE_FIT",ct[ct.POLYLINE_3D=8]="POLYLINE_3D",ct[ct.POLYGON_3D=16]="POLYGON_3D",ct[ct.CLOSED_POLYGON=32]="CLOSED_POLYGON",ct[ct.POLYFACE=64]="POLYFACE",ct[ct.CONTINUOUS=128]="CONTINUOUS";(wr={})[wr.NONE=0]="NONE",wr[wr.QUADRATIC=5]="QUADRATIC",wr[wr.CUBIC=6]="CUBIC",wr[wr.BEZIER=8]="BEZIER";(ut={})[ut.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ut[ut.TANGENT_DEFINED=2]="TANGENT_DEFINED",ut[ut.NOT_USED=4]="NOT_USED",ut[ut.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ut[ut.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ut[ut.FOR_POLYLINE=32]="FOR_POLYLINE",ut[ut.FOR_POLYGON=64]="FOR_POLYGON",ut[ut.POLYFACE=128]="POLYFACE";function Ul(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Yu={startWidth:0,endWidth:0,bulge:0},Xu=[{code:91,name:"id",parser:y},{code:[...Js(71,75)],name:"faces",isMultiple:!0,parser:y},{code:50,name:"tangentDirection",parser:y},{code:70,name:"flag",parser:y},{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:30,name:"z",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...Ue];class ma{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Ul(this,"parser",ye(Xu,Yu))}}function Vl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Ul(ma,"ForEntityName","VERTEX");let Ku={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},$u=[{code:0,name:"vertices",isMultiple:!0,parser:(i,e)=>Ae(i,0,"VERTEX")?(i=e.next(),new ma().parseEntity(e,i)):ua},{code:210,name:"extrusionDirection",parser:G},{code:75,name:"smoothType",parser:y},{code:74,name:"surfaceNDensity",parser:y},{code:73,name:"surfaceMDensity",parser:y},{code:72,name:"meshNVertexCount",parser:y},{code:71,name:"meshMVertexCount",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:70,name:"flag",parser:y},{code:39,name:"thickness",parser:y},{code:30,name:"elevation",parser:y},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:y},...Ue];class jl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Vl(this,"parser",ye($u,Ku))}}function Gl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Vl(jl,"ForEntityName","POLYLINE");let Zu=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Wl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Gl(this,"parser",ye(Zu))}}function Hl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Gl(Wl,"ForEntityName","RAY");let Qu=[...Ii("data"),{code:70,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class ql{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Hl(this,"parser",ye(Qu))}}function Yl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Hl(ql,"ForEntityName","REGION");let Ju={vertices:[],backLineVertices:[]},ed=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:G},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:G},{code:92,name:"verticesCount",parser:y},{code:[63,411],name:"indicatorColor",parser:y},{code:70,name:"indicatorTransparency",parser:y},{code:41,name:"bottomHeight",parser:y},{code:40,name:"topHeight",parser:y},{code:10,name:"verticalDirection",parser:G},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Xl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Yl(this,"parser",ye(ed,Ju))}}function Kl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Yl(Xl,"ForEntityName","SECTION");let td={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},rd=[{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:y},{code:[...Js(10,14)],name:"points",isMultiple:!0,parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class $l{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Kl(this,"parser",ye(rd,td))}}function Zl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Kl($l,"ForEntityName","SOLID");let nd=[{code:350,name:"historyObjectSoftId",parser:y},{code:100,name:"subclassMarker",parser:y},...Ii("data"),{code:70,name:"version",parser:y},{code:100},...Ue];class Ql{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zl(this,"parser",ye(nd))}}Zl(Ql,"ForEntityName","3DSOLID");(Lt={})[Lt.NONE=0]="NONE",Lt[Lt.CLOSED=1]="CLOSED",Lt[Lt.PERIODIC=2]="PERIODIC",Lt[Lt.RATIONAL=4]="RATIONAL",Lt[Lt.PLANAR=8]="PLANAR",Lt[Lt.LINEAR=16]="LINEAR";function Jl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let sd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},id=[{code:11,name:"fitPoints",isMultiple:!0,parser:G},{code:10,name:"controlPoints",isMultiple:!0,parser:G},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:44,name:"fitTolerance",parser:y},{code:43,name:"controlTolerance",parser:y},{code:42,name:"knotTolerance",parser:y},{code:74,name:"numberOfFitPoints",parser:y},{code:73,name:"numberOfControlPoints",parser:y},{code:72,name:"numberOfKnots",parser:y},{code:71,name:"degree",parser:y},{code:70,name:"flag",parser:y},{code:210,name:"normal",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class eh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jl(this,"parser",ye(id,sd))}}Jl(eh,"ForEntityName","SPLINE");class $s{parseEntity(e,t){let s={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:s.subclassMarker=t.value,t=e.next();break;case 2:s.name=t.value,t=e.next();break;case 5:s.handle=t.value,t=e.next();break;case 10:s.startPoint=Vr(ze(e)),t=e.lastReadGroup;break;case 11:s.directionVector=Vr(ze(e)),t=e.lastReadGroup;break;case 90:s.tableValue=t.value,t=e.next();break;case 91:s.rowCount=t.value,t=e.next();break;case 92:s.columnCount=t.value,t=e.next();break;case 93:s.overrideFlag=t.value,t=e.next();break;case 94:s.borderColorOverrideFlag=t.value,t=e.next();break;case 95:s.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:s.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(t.value),t=e.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(t.value),t=e.next();break;case 280:s.version=t.value,t=e.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=t.value,t=e.next();break;case 330:s.ownerDictionaryId=t.value,t=e.next();break;case 342:s.tableStyleId=t.value,t=e.next();break;case 343:s.blockRecordHandle=t.value,t=e.next();break;case 170:s.attachmentPoint=t.value,t=e.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(o,h){let u=!1,g=!1,b={};for(;!o.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(u){g=!0;continue}b.cellType=h.value,u=!0,h=o.next();break;case 172:b.flagValue=h.value,h=o.next();break;case 173:b.mergedValue=h.value,h=o.next();break;case 174:b.autoFit=h.value,h=o.next();break;case 175:b.borderWidth=h.value,h=o.next();break;case 176:b.borderHeight=h.value,h=o.next();break;case 91:b.overrideFlag=h.value,h=o.next();break;case 178:b.virtualEdgeFlag=h.value,h=o.next();break;case 145:b.rotation=h.value,h=o.next();break;case 345:b.fieldObjetId=h.value,h=o.next();break;case 340:b.blockTableRecordId=h.value,h=o.next();break;case 146:b.blockScale=h.value,h=o.next();break;case 177:b.blockAttrNum=h.value,h=o.next();break;case 7:b.textStyle=h.value,h=o.next();break;case 140:b.textHeight=h.value,h=o.next();break;case 170:b.attachmentPoint=h.value,h=o.next();break;case 92:b.extendedCellFlags=h.value,h=o.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=o.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=o.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=o.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=o.next();break;case 301:(function(f,A,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=A.next();break;case 1:f.text=x.value,x=A.next();break;case 300:f.attrText=x.value,x=A.next();break;case 302:f.text=x.value?x.value:f.text,x=A.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=A.next()}})(b,o,h),h=o.next();break;default:return b}return u=!1,g=!1,b}(e,t)),t=e.lastReadGroup;break;default:da(s,t,e),t=e.next()}}return s}}function th(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Ki="ACAD_TABLE",(Xi="ForEntityName")in $s?Object.defineProperty($s,Xi,{value:Ki,enumerable:!0,configurable:!0,writable:!0}):$s[Xi]=Ki;let ad=[{code:11,name:"xAxisDirection",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:1,name:"text",parser:y},{code:10,name:"position",parser:G},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class rh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){th(this,"parser",ye(ad))}}th(rh,"ForEntityName","TOLERANCE");let Zs=class{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(o,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:o.layer=u.value;break;case 100:o.subclassMarker=u.value;break;case 10:o.viewportCenter=Vr(ze(h));break;case 40:o.width=u.value;break;case 41:o.height=u.value;break;case 68:o.status=u.value;break;case 69:o.viewportId=u.value;break;case 12:o.displayCenter=ze(h);break;case 13:o.snapBase=ze(h);break;case 14:o.snapSpacing=ze(h);break;case 15:o.gridSpacing=ze(h);break;case 16:o.viewDirection=Vr(ze(h));break;case 17:o.targetPoint=Vr(ze(h));break;case 42:o.perspectiveLensLength=u.value;break;case 43:o.frontClipZ=u.value;break;case 44:o.backClipZ=u.value;break;case 45:o.viewHeight=u.value;break;case 50:o.snapAngle=u.value;break;case 51:o.viewTwistAngle=u.value;break;case 72:o.circleZoomPercent=u.value;break;case 331:o.frozenLayerIds??(o.frozenLayerIds=[]),o.frozenLayerIds.push(u.value);break;case 90:o.statusBitFlags=u.value;break;case 340:o.clippingBoundaryId=u.value;break;case 1:o.sheetName=u.value;break;case 281:o.renderMode=u.value;break;case 71:o.ucsPerViewport=u.value;break;case 110:o.ucsOrigin=Vr(ze(h));break;case 111:o.ucsXAxis=Vr(ze(h));break;case 112:o.ucsYAxis=Vr(ze(h));break;case 345:o.ucsId=u.value;break;case 346:o.ucsBaseId=u.value;break;case 79:o.orthographicType=u.value;break;case 146:o.elevation=u.value;break;case 170:o.shadePlotMode=u.value;break;case 61:o.majorGridFrequency=u.value;break;case 332:o.backgroundId=u.value;break;case 333:o.shadePlotId=u.value;break;case 348:o.visualStyleId=u.value;break;case 292:o.isDefaultLighting=!!u.value;break;case 282:o.defaultLightingType=u.value;break;case 141:o.brightness=u.value;break;case 142:o.contrast=u.value;break;case 63:case 421:case 431:o.ambientLightColor=u.value;break;case 361:o.sunId=u.value;break;case 335:case 343:case 344:case 91:o.softPointer=u.value}return!0}(s,e,t)&&da(s,t,e),t=e.next()}return s}};Zi="VIEWPORT",($i="ForEntityName")in Zs?Object.defineProperty(Zs,$i,{value:Zi,enumerable:!0,configurable:!0,writable:!0}):Zs[$i]=Zi;(Ar={})[Ar.ShowImage=1]="ShowImage",Ar[Ar.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Ar[Ar.UseClippingBoundary=4]="UseClippingBoundary",Ar[Ar.Transparency=8]="Transparency";function nh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let od={brightness:50,constrast:50,fade:0},ld=[{code:14,name:"boundary",isMultiple:!0,parser:G},{code:91,name:"numberOfVertices",parser:y},{code:71,name:"boundaryType",parser:y},{code:360,name:"imageDefReactorHardId",parser:y},{code:283,name:"fade",parser:y},{code:282,name:"contrast",parser:y},{code:281,name:"brightness",parser:y},{code:280,name:"isClipping",parser:Be},{code:70,name:"displayFlag",parser:y},{code:340,name:"imageDefHardId",parser:y},{code:13,name:"imageSize",parser:G},{code:12,name:"vDirection",parser:G},{code:11,name:"uDirection",parser:G},{code:10,name:"position",parser:G},{code:90,name:"classVersion",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class sh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nh(this,"parser",ye(ld,od))}}function ih(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}nh(sh,"ForEntityName","WIPEOUT");let hd=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue],ah=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ih(this,"parser",ye(hd))}};function oh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ih(ah,"ForEntityName","XLINE");let cd={},ud=[{code:170,name:"multileaderType",parser:y},{code:291,name:"doglegEnabled",parser:Be},{code:40,name:"doglegLength",parser:y},{code:172,name:"contentType",parser:y},{code:3,name:"textContent",parser:y},{code:12,name:"textAnchor",parser:G},{code:344,name:"blockHandle",parser:y},{code:15,name:"blockPosition",parser:G},{code:302,name:"leaderSections",parser:function(i,e,t){let s,o={leaderLines:[]};for(;e.hasNext()&&(s=e.next()).code!==303;)switch(s.code){case 10:o.landingPoint=(s.value,ze(e));break;case 11:o.doglegVector=(s.value,ze(e));break;case 40:o.doglegLength=s.value;break;case 304:o.leaderLines.push(function(h,u,g){let b,f={vertices:[]};for(;u.hasNext()&&(b=u.next()).code!==305;)b.code===10&&f.vertices.push((b.value,ze(u)));return f}(0,e))}return o},isMultiple:!0},...Ue];class lh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){oh(this,"parser",ye(ud,cd))}}oh(lh,"ForEntityName","MULTILEADER");let dd=Object.fromEntries([al,dl,fl,vl,bl,Xs,wl,Pl,Ml,Cl,Ll,zl,Ks,Rl,pl,lh,Fl,jl,Wl,ql,Xl,$l,Ql,eh,$s,cl,rh,El,ma,Zs,sh,ah].map(i=>[i.ForEntityName,new i]));function hh(i,e){let t=[];for(;!Ae(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){e.rewind();break}let s=dd[i.value];if(s){let o=i.value;i=e.next();let h=s.parseEntity(e,i);h.type=o,nl(h),t.push(h)}else e.debug&&console.warn(`Unsupported ENTITY type: ${i.value}`)}i=e.next()}return t}function md(i,e){let t={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");){if(Ae(i,0,"BLOCK")){let s=pd(i=e.next(),e);nl(s),s.name&&(t[s.name]=s)}i=e.next()}return t}function pd(i,e){let t={};for(;!Ae(i,0,"EOF");){if(Ae(i,0,"ENDBLK")){for(i=e.next();!Ae(i,0,"EOF");){if(Ae(i,100,"AcDbBlockEnd"))return t;i=e.next()}break}switch(i.code){case 1:t.xrefPath=i.value;break;case 2:t.name=i.value;break;case 3:t.name2=i.value;break;case 5:t.handle=i.value;break;case 8:t.layer=i.value;break;case 10:t.position=ze(e);break;case 67:t.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(t.type=i.value);break;case 100:break;case 330:t.ownerHandle=i.value;break;case 0:t.entities=hh(i,e)}i=e.next()}return t}function gd(i,e){let t=null,s={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");)i.code===9?t=i.value:i.code===10?s[t]=ze(e):s[t]=i.value,i=e.next();return s}(Ot={})[Ot.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ot[Ot.KEEP_EXISTING=1]="KEEP_EXISTING",Ot[Ot.USE_CLONE=2]="USE_CLONE",Ot[Ot.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ot[Ot.VALUE_NAME=4]="VALUE_NAME",Ot[Ot.UNMANGLE_NAME=5]="UNMANGLE_NAME";let pa=[{code:330,name:"ownerObjectId",parser:y},{code:102,parser:dn},{code:102,parser:dn},{code:102,parser:dn},{code:5,name:"handle",parser:y}],fd=[{code:3,name:"entries",parser:(i,e)=>{let t={name:i.value};return(i=e.next()).code===350?t.objectSoftId=i.value:i.code===360?t.objectHardId=i.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:y},{code:280,name:"isHardOwned",parser:Be},{code:100,name:"subclassMarker",parser:y},...pa],_d=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:y},{code:90,name:"version",parser:y},{code:1,name:"fileName",parser:y},{code:10,name:"size",parser:G},{code:11,name:"sizeOfOnePixel",parser:G},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}];(an={})[an.NOUNIT=0]="NOUNIT",an[an.CENTIMETERS=2]="CENTIMETERS",an[an.INCH=5]="INCH";(As={})[As.PSLTSCALE=1]="PSLTSCALE",As[As.LIMCHECK=2]="LIMCHECK";(on={})[on.INCHES=0]="INCHES",on[on.MILLIMETERS=1]="MILLIMETERS",on[on.PIXELS=2]="PIXELS";(zt={})[zt.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",zt[zt.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",zt[zt.DRAWING_LIMITS=2]="DRAWING_LIMITS",zt[zt.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",zt[zt.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",zt[zt.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Pr={})[Pr.AS_DISPLAYED=0]="AS_DISPLAYED",Pr[Pr.WIREFRAME=1]="WIREFRAME",Pr[Pr.HIDDEN=2]="HIDDEN",Pr[Pr.RENDERED=3]="RENDERED";(Dt={})[Dt.DRAFT=0]="DRAFT",Dt[Dt.PREVIEW=1]="PREVIEW",Dt[Dt.NORMAL=2]="NORMAL",Dt[Dt.PRESENTATION=3]="PRESENTATION",Dt[Dt.MAXIMUM=4]="MAXIMUM",Dt[Dt.CUSTOM=5]="CUSTOM";let ch=[{code:333,name:"shadePlotId",parser:y},{code:149,name:"imageOriginY",parser:y},{code:148,name:"imageOriginX",parser:y},{code:147,name:"scaleFactor",parser:y},{code:78,name:"shadePlotCustomDPI",parser:y},{code:77,name:"shadePlotResolution",parser:y},{code:76,name:"shadePlotMode",parser:y},{code:75,name:"standardScaleType",parser:y},{code:7,name:"currentStyleSheet",parser:y},{code:74,name:"plotType",parser:y},{code:73,name:"plotRotation",parser:y},{code:72,name:"plotPaperUnit",parser:y},{code:70,name:"layoutFlag",parser:y},{code:143,name:"printScaleDenominator",parser:y},{code:142,name:"printScaleNumerator",parser:y},{code:141,name:"windowAreaYMax",parser:y},{code:140,name:"windowAreaXMax",parser:y},{code:49,name:"windowAreaYMin",parser:y},{code:48,name:"windowAreaXMin",parser:y},{code:47,name:"plotOriginY",parser:y},{code:46,name:"plotOriginX",parser:y},{code:45,name:"paperHeight",parser:y},{code:44,name:"paperWidth",parser:y},{code:43,name:"marginTop",parser:y},{code:42,name:"marginRight",parser:y},{code:41,name:"marginBottom",parser:y},{code:40,name:"marginLeft",parser:y},{code:6,name:"plotViewName",parser:y},{code:4,name:"paperSize",parser:y},{code:2,name:"configName",parser:y},{code:1,name:"pageSetupName",parser:y},{code:100,name:"subclassMarker",parser:y},...pa],vd=[{code:346,name:"orthographicUcsId",parser:y},{code:345,name:"namedUcsId",parser:y},{code:331,name:"viewportId",parser:y},{code:330,name:"paperSpaceTableId",parser:y},{code:76,name:"orthographicType",parser:y},{code:17,name:"ucsYAxis",parser:G},{code:16,name:"ucsXAxis",parser:G},{code:13,name:"ucsOrigin",parser:G},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:G},{code:14,name:"minExtent",parser:G},{code:12,name:"insertionPoint",parser:G},{code:11,name:"maxLimit",parser:G},{code:10,name:"minLimit",parser:G},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...ch],yd=[{code:40,name:"wcsToOCSTransform",parser:ko},{code:40,name:"ocsToWCSTransform",parser:ko},{code:41,name:"backClippingDistance",parser:y},{code:73,name:"isBackClipping",parser:Be,pushContext:!0},{code:40,name:"frontClippingDistance",parser:y},{code:72,name:"isFrontClipping",parser:Be,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Be},{code:11,name:"position",parser:G},{code:210,name:"normal",parser:G},{code:10,name:"boundaryVertices",parser:G,isMultiple:!0},{code:70,name:"boundaryCount",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...pa];function ko(i,e){let t=[];for(let s=0;s<3&&Ae(i,40);++s){let o=[];for(let h=0;h<4&&Ae(i,40);++h)o.push(i.value),i=e.next();t.push(o)}return e.rewind(),t}let bd={LAYOUT:vd,PLOTSETTINGS:ch,DICTIONARY:fd,SPATIAL_FILTER:yd,IMAGEDEF:_d};function xd(i,e){let t=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let s=i.value,o=bd[s];if(i.code===0&&(o!=null&&o.length)){let h=ye(o),u={name:s};h(i=e.next(),e,u)?(t.push(u),i=e.peek()):i=e.next()}else i=e.next()}return{byName:du(t,({name:s})=>s)}}let Fn=[{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102,parser(i,e){for(;!Ae(i,0,"EOF")&&!Ae(i,102,"}");)i=e.next()}},{code:5,name:"handle",parser:y}],wd=ye([{code:310,name:"bmpPreview",parser:y},{code:281,name:"scalability",parser:y},{code:280,name:"explodability",parser:y},{code:70,name:"insertionUnits",parser:y},{code:340,name:"layoutObjects",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Ad=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:Io.Above,defaultValueImperial:Io.Center},{name:"DIMZIN",code:78,defaultValue:Nn.Trailing,defaultValueImperial:Nn.Feet},{name:"DIMAZIN",code:79,defaultValue:Qc.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:Jc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:eu.Center},{name:"DIMTZIN",code:284,defaultValue:Nn.Trailing,defaultValueImperial:Nn.Feet},{name:"DIMALTZ",code:285,defaultValue:Nn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Nn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}],Pd=ye([...Ad.map(i=>({...i,parser:y})),{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},{code:105,name:"handle",parser:y},...Fn.filter(i=>i.code!==5)]),Sd=ye([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Be},{code:6,name:"lineType",parser:y},{code:62,name:"colorIndex",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]);(Sr={})[Sr.NONE=0]="NONE",Sr[Sr.AbsoluteRotation=1]="AbsoluteRotation",Sr[Sr.TextEmbedded=2]="TextEmbedded",Sr[Sr.ShapeEmbedded=4]="ShapeEmbedded";let Id=ye([{code:9,name:"text",parser:y},{code:45,name:"offsetY",parser:y},{code:44,name:"offsetX",parser:y},{code:50,name:"rotation",parser:y},{code:46,name:"scale",parser:y},{code:340,name:"styleObjectId",parser:y},{code:75,name:"shapeNumber",parser:y},{code:74,name:"elementTypeFlag",parser:y},{code:49,name:"elementLength",parser:y}],{elementTypeFlag:0,elementLength:0}),Ed=ye([{code:49,name:"pattern",parser(i,e){let t={};return Id(i,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:y},{code:73,name:"numberOfLineTypes",parser:y},{code:72,parser:y},{code:3,name:"description",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),kd=ye([{code:1e3,name:"extendedFont",parser:y},{code:1001},{code:4,name:"bigFont",parser:y},{code:3,name:"font",parser:y},{code:42,name:"lastHeight",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:50,name:"obliqueAngle",parser:y},{code:41,name:"widthFactor",parser:y},{code:40,name:"fixedTextHeight",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Md=ye([{code:[63,421,431],name:"ambientColor",parser:y},{code:142,name:"contrast",parser:y},{code:141,name:"brightness",parser:y},{code:282,name:"defaultLightingType",parser:y},{code:292,name:"isDefaultLightingOn",parser:Be},{code:348,name:"visualStyleObjectId",parser:y},{code:333,name:"shadePlotObjectId",parser:y},{code:332,name:"backgroundObjectId",parser:y},{code:61,name:"majorGridLines",parser:y},{code:170,name:"shadePlotSetting",parser:y},{code:146,name:"elevation",parser:y},{code:79,name:"orthographicType",parser:y},{code:112,name:"ucsYAxis",parser:G},{code:111,name:"ucsXAxis",parser:G},{code:110,name:"ucsOrigin",parser:G},{code:74,name:"ucsIconSetting",parser:y},{code:71,name:"viewMode",parser:y},{code:281,name:"renderMode",parser:y},{code:1,name:"styleSheet",parser:y},{code:[331,441],name:"frozenLayers",parser:y,isMultiple:!0},{code:72,name:"circleSides",parser:y},{code:51,name:"viewTwistAngle",parser:y},{code:50,name:"snapRotationAngle",parser:y},{code:45,name:"viewHeight",parser:y},{code:44,name:"backClippingPlane",parser:y},{code:43,name:"frontClippingPlane",parser:y},{code:42,name:"lensLength",parser:y},{code:17,name:"viewTarget",parser:G},{code:16,name:"viewDirectionFromTarget",parser:G},{code:15,name:"gridSpacing",parser:G},{code:14,name:"snapSpacing",parser:G},{code:13,name:"snapBasePoint",parser:G},{code:12,name:"center",parser:G},{code:11,name:"upperRightCorner",parser:G},{code:10,name:"lowerLeftCorner",parser:G},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Td={BLOCK_RECORD:wd,DIMSTYLE:Pd,LAYER:Sd,LTYPE:Ed,STYLE:kd,VPORT:Md},Cd=ye([{code:70,name:"maxNumberOfEntries",parser:y},{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:y},{code:2,name:"name",parser:y}]);function Nd(i,e){var s;let t={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");){if(Ae(i,0,"TABLE")){i=e.next();let o={entries:[]};Cd(i,e,o),t[o.name]=o}if(Ae(i,0)&&!Ae(i,0,"ENDTAB")){let o=i.value;i=e.next();let h=Td[o];if(!h){e.debug&&console.warn(`parseTable: Invalid table name '${o}'`),i=e.next();continue}let u={};h(i,e,u),(s=t[o])==null||s.entries.push(u)}i=e.next()}return t}function Ps(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class Mo{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=To(e,this._data[this._pointer++],this.debug),s={code:e,value:t};return Ae(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=To(e.code,this._data[this._pointer+1],this.debug),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){Ps(this,"_data",void 0),Ps(this,"debug",void 0),Ps(this,"_pointer",void 0),Ps(this,"_eof",void 0),Ps(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function To(i,e,t=!1){return i<=9?e:i>=10&&i<=59?parseFloat(e.trim()):i>=60&&i<=99?parseInt(e.trim()):i>=100&&i<=109?e:i>=110&&i<=149?parseFloat(e.trim()):i>=160&&i<=179?parseInt(e.trim()):i>=210&&i<=239?parseFloat(e.trim()):i>=270&&i<=289?parseInt(e.trim()):i>=290&&i<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(e.trim()):i>=300&&i<=369?e:i>=370&&i<=389?parseInt(e.trim()):i>=390&&i<=399?e:i>=400&&i<=409?parseInt(e.trim()):i>=410&&i<=419?e:i>=420&&i<=429?parseInt(e.trim()):i>=430&&i<=439?e:i>=440&&i<=459?parseInt(e.trim()):i>=460&&i<=469?parseFloat(e.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?e:i>=1010&&i<=1059?parseFloat(e.trim()):i>=1060&&i<=1071?parseInt(e.trim()):(t&&console.warn("WARNING: Group code does not have a defined type: %j",{code:i,value:e}),e)}function sa(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class Ld{constructor(){sa(this,"encoding","utf-8"),sa(this,"encodingFailureFatal",!1)}}class Od extends EventTarget{parseSync(e,t=!1){let s=new Mo(e.split(/\r\n|\r|\n/g),t);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(e){let t="",s=this;return new Promise((o,h)=>{e.on("data",u=>{t+=u}),e.on("end",()=>{try{let u=t.split(/\r\n|\r|\n/g),g=new Mo(u);if(!g.hasNext())throw Error("Empty file");o(s.parseAll(g))}catch(u){h(u)}}),e.on("error",u=>{h(u)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let o=s.body.getReader(),h="";for(;;){let{done:u,value:g}=await o.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!Ae(s,0,"EOF");)Ae(s,0,"SECTION")&&(Ae(s=e.next(),2,"HEADER")?(s=e.next(),t.header=gd(s,e)):Ae(s,2,"BLOCKS")?(s=e.next(),t.blocks=md(s,e)):Ae(s,2,"ENTITIES")?(s=e.next(),t.entities=hh(s,e)):Ae(s,2,"TABLES")?(s=e.next(),t.tables=Nd(s,e)):Ae(s,2,"OBJECTS")&&(s=e.next(),t.objects=xd(s,e))),s=e.next();return t}constructor(e=new Ld){super(),sa(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var ga=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(ga||{});class Gr{static get instance(){return this._instance||(this._instance=new Gr),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,s,o=!0,h,u){const g=[];if(t!=null){const b=this.createKey(t.name,s);let f;if(this.has(b))f=this.get(b);else{const A=t.newIterator();for(const x of A)x.color.isByBlock&&s?(Co.copy(x.color),x.color.color=s,this.addEntity(x,g,e),x.color.copy(Co)):this.addEntity(x,g,e);f=e.group(g),f&&o&&this.set(b,f)}return f&&h&&(f.applyMatrix(h),u&&(u.x!=0||u.y!=0||u.z!=1)&&(h.setFromExtrusionDirection(u),f.applyMatrix(h))),f}else return e.group(g)}addEntity(e,t,s){const o=e.draw(s);o&&(this.attachEntityInfo(o,e),t.push(o))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const Co=new fn,ei="Continuous",Qs="ByLayer",uh="ByBlock";var cn=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(cn||{}),fa=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))(fa||{});function zd(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function Dd(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}var dh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(dh||{});class Ei{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}const mh="Load Database";class St extends Zo{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=ca.getInstance().getEntry(mh),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const o=await this.data.task(e);if(this.progress){const h=o.data;await this.progress(this.data.progress.value,this.data.stage,"END",h),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return t&&(t.data[this.name]=Date.now()-s),o}}class ph{constructor(e={}){this.config=e}async read(e,t,s,o){const h={name:mh,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(A=>{A!=="total"&&(f+=`- ${A}: ${this.data[A]} ms
|
|
2
|
-
`)}),f+=`- total: ${this.data.total} ms`,f}};ca.getInstance().collect(h),this.progress=o;const u={value:0},g=new Qo;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new St({stage:"START",step:1,progress:u,task:async f=>f},o)),g.addTask(new St({stage:"PARSE",step:5,progress:u,task:async f=>({model:await this.parse(f)})},o)),g.addTask(new St({stage:"FONT",step:5,progress:u,task:async f=>{const A=this.getFonts(f.model);return{model:f.model,data:A}}},o)),g.addTask(new St({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,t),f)},o)),g.addTask(new St({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,t),f)},o)),g.addTask(new St({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,t),f)},o)),g.addTask(new St({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,t),f)},o)),g.addTask(new St({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,t),f)},o)),g.addTask(new St({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,t),f)},o)),g.addTask(new St({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,t),f)},o)),g.addTask(new St({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,t),f)},o)),g.addTask(new St({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,t),f)},o)),g.addTask(new St({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,t,s,u,o),f)},o)),g.addTask(new St({stage:"END",step:0,progress:u,task:async f=>f},o));const b=Date.now();await g.run(e),h.data.total=Date.now()-b}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}console.error(`Error occurred in conversion stage '${e.task.name}': `,e.error),e.task.name!="ENTITY"&&this.onFinished()}onFinished(){this.progress&&(this.progress(100,"END","END"),Gr.instance.clear())}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,s,o,h){throw new Error("Not impelemented yet!")}}const ft=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let No=1234567;const _a=Math.PI/180,va=180/Math.PI;function gh(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(ft[i&255]+ft[i>>8&255]+ft[i>>16&255]+ft[i>>24&255]+"-"+ft[e&255]+ft[e>>8&255]+"-"+ft[e>>16&15|64]+ft[e>>24&255]+"-"+ft[t&63|128]+ft[t>>8&255]+"-"+ft[t>>16&255]+ft[t>>24&255]+ft[s&255]+ft[s>>8&255]+ft[s>>16&255]+ft[s>>24&255]).toLowerCase()}function kr(i,e,t){return Math.max(e,Math.min(t,i))}function ya(i,e){return(i%e+e)%e}function fh(i,e,t,s,o){return s+(i-e)*(o-s)/(t-e)}function _h(i,e,t){return i!==e?(t-i)/(e-i):0}function ba(i,e,t){return(1-t)*i+t*e}function vh(i,e,t,s){return ba(i,e,1-Math.exp(-t*s))}function yh(i,e=1){return e-Math.abs(ya(i,e*2)-e)}function bh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function xh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function wh(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Ah(i,e){return i+Math.random()*(e-i)}function Ph(i){return i*(.5-Math.random())}function Sh(i){i!==void 0&&(No=i);let e=No+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ih(i){return i*_a}function Eh(i){return i*va}function kh(i){return(i&i-1)===0&&i!==0}function Mh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Th(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ks(i){const e=Math.PI*2;return(i%e+e)%e}function Ch(i,e,t){return i>e&&i<t||i>t&&i<e}function Nh(i,e,t,s=!1){return i=ks(i),e=ks(e),t=ks(t),s?e>t?i<=e&&i>=t:i<=e||i>=t:e<t?i>=e&&i<=t:i>=e||i<=t}function xa(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function Lh(i,e=1e-7){const t=xa(i);return Math.max(Math.pow(10,t)*e,e)}const Ee={DEG2RAD:_a,RAD2DEG:va,generateUUID:gh,clamp:kr,euclideanModulo:ya,mapLinear:fh,inverseLerp:_h,lerp:ba,damp:vh,pingpong:yh,smoothstep:bh,smootherstep:xh,randInt:wh,randFloat:Ah,randFloatSpread:Ph,seededRandom:Sh,degToRad:Ih,radToDeg:Eh,isPowerOfTwo:kh,ceilPowerOfTwo:Mh,floorPowerOfTwo:Th,normalizeAngle:ks,isBetween:Ch,isBetweenAngle:Nh,intPartLength:xa,relativeEps:Lh},ia=class Oh{constructor(e,t){this.x=0,this.y=0;const s=+(e!==void 0)+ +(t!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(s===1){const{x:o,y:h}=e;this.x=o,this.y=h;return}if(s===2){this.x=e,this.y=t;return}throw Ut.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new Oh(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,s=this.y,o=e.elements;return this.x=o[0]*t+o[3]*s+o[6],this.y=o[1]*t+o[4]*s+o[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const s=Math.cos(t),o=Math.sin(t),h=this.x-e.x,u=this.y-e.y;return this.x=h*s-u*o+e.x,this.y=h*o+u*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(Ee.relativeEps(this.x,e),Ee.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};ia.EMPTY=Object.freeze(new ia(0,0));let $e=ia;const aa=class zh{constructor(e,t,s,o,h,u,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&this.set(e,t,s,o,h,u,g,b,f)}set(e,t,s,o,h,u,g,b,f){const A=this.elements;return A[0]=e,A[1]=o,A[2]=g,A[3]=t,A[4]=h,A[5]=b,A[6]=s,A[7]=u,A[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,o=t.elements,h=this.elements,u=s[0],g=s[3],b=s[6],f=s[1],A=s[4],x=s[7],E=s[2],M=s[5],z=s[8],D=o[0],U=o[3],B=o[6],ge=o[1],be=o[4],oe=o[7],W=o[2],ce=o[5],se=o[8];return h[0]=u*D+g*ge+b*W,h[3]=u*U+g*be+b*ce,h[6]=u*B+g*oe+b*se,h[1]=f*D+A*ge+x*W,h[4]=f*U+A*be+x*ce,h[7]=f*B+A*oe+x*se,h[2]=E*D+M*ge+z*W,h[5]=E*U+M*be+z*ce,h[8]=E*B+M*oe+z*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],A=e[8];return t*u*A-t*g*f-s*h*A+s*g*b+o*h*f-o*u*b}invert(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],A=e[8],x=A*u-g*f,E=g*b-A*h,M=f*h-u*b,z=t*x+s*E+o*M;if(z===0)return this.set(0,0,0,0,0,0,0,0,0);const D=1/z;return e[0]=x*D,e[1]=(o*f-A*s)*D,e[2]=(g*s-o*u)*D,e[3]=E*D,e[4]=(A*t-o*b)*D,e[5]=(o*h-g*t)*D,e[6]=M*D,e[7]=(s*b-f*t)*D,e[8]=(u*t-s*h)*D,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,s,o,h,u,g){const b=Math.cos(h),f=Math.sin(h);return this.set(s*b,s*f,-s*(b*u+f*g)+u+e,-o*f,o*b,-o*(-f*u+b*g)+g+t,0,0,1),this}scale(e,t){return this.premultiply(Ji.makeScale(e,t)),this}rotate(e){return this.premultiply(Ji.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ji.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof $e?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let o=0;o<9;o++)if(t[o]!==s[o])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new zh().fromArray(this.elements)}};aa.IDENTITY=Object.freeze(new aa);let ki=aa;const Ji=new ki,hn=1e-6,nt=2*Math.PI,Rd={x:0,y:0},wa={x:0,y:0,z:0};class Aa{constructor(){this.equalPointTol=hn,this.equalVectorTol=hn}equalPoint2d(e,t){return new $e(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new Z(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=hn){return e<t&&e>-t}static equal(e,t,s=hn){return Math.abs(e-t)<s}static great(e,t,s=hn){return e-t>s}static less(e,t,s=hn){return e-t<s}}const Pa=new Aa;function Sa(i,e,t=!1){const s=i.x,o=i.y;let h=!1;const u=e.length;for(let g=0,b=u-1;g<u;b=g++){const f=e[g].x,A=e[g].y,x=e[b].x,E=e[b].y;let M=A>o!=E>o;t&&(M=A>=o!=E>=o),M&&s<(x-f)*(o-A)/(E-A)+f&&(h=!h)}return h}function Dh(i,e){if(i.length===0||e.length===0)return!1;const t=new _t().setFromPoints(i),s=new _t().setFromPoints(e);if(!t.intersectsBox(s))return!1;for(let o=0;o<i.length;){if(Sa(i[o],e,!0))return!0;o<i.length-1&&Pa.equalPoint2d(i[o+1],i[o])&&++o,++o}return!1}const Rh={isPointInPolygon:Sa,isPolygonIntersect:Dh};function Bh(i,e){const t=[],s=e-1,o=i;for(let h=0;h<=o;h++)t.push(0);for(let h=1;h<=s-o;h++)t.push(h);for(let h=0;h<=o;h++)t.push(s-o+1);return t}function Fh(i,e){const t=e.length-1,s=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],A=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+A*A);h+=x,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=t-s;g++){const b=o[g]/h;u.push(b*(t-s+1))}for(let g=0;g<=s;g++)u.push(t-s+1);return u}function Uh(i,e){const t=e.length-1,s=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],A=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+A*A),E=Math.sqrt(x);h+=E,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=t-s;g++){const b=o[g]/h;u.push(b*(t-s+1))}for(let g=0;g<=s;g++)u.push(t-s+1);return u}function ti(i,e,t,s){if(e===0)return t>=s[i]&&t<s[i+1]?1:0;const o=s[i+e]-s[i],h=s[i+e+1]-s[i+1],u=o>1e-10?(t-s[i])/o:0,g=h>1e-10?(s[i+e+1]-t)/h:0;return u*ti(i,e-1,t,s)+g*ti(i+1,e-1,t,s)}function Ms(i,e,t,s,o){const h=s.length-1,u=e;if(i=Math.max(t[u],Math.min(t[h+1],i)),Math.abs(i-t[h+1])<1e-8)return[...s[h]];if(Math.abs(i-t[u])<1e-8)return[...s[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const A=ti(f,u,i,t),x=o[f]*A;g[0]+=s[f][0]*x,g[1]+=s[f][1]*x,g[2]+=s[f][2]*x,b+=x}if(b<1e-10){const f=t[t.length-u-1];if(Math.abs(i-f)<1e-8)return[...s[h]];if(Math.abs(i-t[u])<1e-8)return[...s[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function Vh(i,e,t,s){const o=i,h=e[o],u=e[e.length-o-1];let g=0;const b=1e3,f=(u-h)/b;let A=Ms(h,i,e,t,s);for(let D=1;D<=b;D++){const U=h+D*f,B=Ms(U,i,e,t,s),ge=B[0]-A[0],be=B[1]-A[1],oe=B[2]-A[2];g+=Math.sqrt(ge*ge+be*be+oe*oe),A=B}const x=Ms(u,i,e,t,s),E=x[0]-A[0],M=x[1]-A[1],z=x[2]-A[2];return g+=Math.sqrt(E*E+M*M+z*z),g}function Bd(i){return i.map(e=>[...e])}class Wr{constructor(e=0,t=0,s=0,o=1){this._x=e,this._y=t,this._z=s,this._w=o}static slerpFlat(e,t,s,o,h,u,g){let b=s[o+0],f=s[o+1],A=s[o+2],x=s[o+3];const E=h[u+0],M=h[u+1],z=h[u+2],D=h[u+3];if(g===0){e[t+0]=b,e[t+1]=f,e[t+2]=A,e[t+3]=x;return}if(g===1){e[t+0]=E,e[t+1]=M,e[t+2]=z,e[t+3]=D;return}if(x!==D||b!==E||f!==M||A!==z){let U=1-g;const B=b*E+f*M+A*z+x*D,ge=B>=0?1:-1,be=1-B*B;if(be>Number.EPSILON){const W=Math.sqrt(be),ce=Math.atan2(W,B*ge);U=Math.sin(U*ce)/W,g=Math.sin(g*ce)/W}const oe=g*ge;if(b=b*U+E*oe,f=f*U+M*oe,A=A*U+z*oe,x=x*U+D*oe,U===1-g){const W=1/Math.sqrt(b*b+f*f+A*A+x*x);b*=W,f*=W,A*=W,x*=W}}e[t]=b,e[t+1]=f,e[t+2]=A,e[t+3]=x}static multiplyQuaternionsFlat(e,t,s,o,h,u){const g=s[o],b=s[o+1],f=s[o+2],A=s[o+3],x=h[u],E=h[u+1],M=h[u+2],z=h[u+3];return e[t]=g*z+A*x+b*M-f*E,e[t+1]=b*z+A*E+f*x-g*M,e[t+2]=f*z+A*M+g*E-b*x,e[t+3]=A*z-g*x-b*E-f*M,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,s,o){return this._x=e,this._y=t,this._z=s,this._w=o,this._onChangeCallback(),this}clone(){return new Wr(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const s=e.x,o=e.y,h=e.z,u=e.order,g=Math.cos,b=Math.sin,f=g(s/2),A=g(o/2),x=g(h/2),E=b(s/2),M=b(o/2),z=b(h/2);switch(u){case"XYZ":this._x=E*A*x+f*M*z,this._y=f*M*x-E*A*z,this._z=f*A*z+E*M*x,this._w=f*A*x-E*M*z;break;case"YXZ":this._x=E*A*x+f*M*z,this._y=f*M*x-E*A*z,this._z=f*A*z-E*M*x,this._w=f*A*x+E*M*z;break;case"ZXY":this._x=E*A*x-f*M*z,this._y=f*M*x+E*A*z,this._z=f*A*z+E*M*x,this._w=f*A*x-E*M*z;break;case"ZYX":this._x=E*A*x-f*M*z,this._y=f*M*x+E*A*z,this._z=f*A*z-E*M*x,this._w=f*A*x+E*M*z;break;case"YZX":this._x=E*A*x+f*M*z,this._y=f*M*x+E*A*z,this._z=f*A*z-E*M*x,this._w=f*A*x-E*M*z;break;case"XZY":this._x=E*A*x-f*M*z,this._y=f*M*x-E*A*z,this._z=f*A*z+E*M*x,this._w=f*A*x+E*M*z;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,o=Math.sin(s);return this._x=e.x*o,this._y=e.y*o,this._z=e.z*o,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],o=t[4],h=t[8],u=t[1],g=t[5],b=t[9],f=t[2],A=t[6],x=t[10],E=s+g+x;if(E>0){const M=.5/Math.sqrt(E+1);this._w=.25/M,this._x=(A-b)*M,this._y=(h-f)*M,this._z=(u-o)*M}else if(s>g&&s>x){const M=2*Math.sqrt(1+s-g-x);this._w=(A-b)/M,this._x=.25*M,this._y=(o+u)/M,this._z=(h+f)/M}else if(g>x){const M=2*Math.sqrt(1+g-s-x);this._w=(h-f)/M,this._x=(o+u)/M,this._y=.25*M,this._z=(b+A)/M}else{const M=2*Math.sqrt(1+x-s-g);this._w=(u-o)/M,this._x=(h+f)/M,this._y=(b+A)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<Number.EPSILON?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(kr(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const o=Math.min(1,t/s);return this.slerp(e,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const s=e._x,o=e._y,h=e._z,u=e._w,g=t._x,b=t._y,f=t._z,A=t._w;return this._x=s*A+u*g+o*f-h*b,this._y=o*A+u*b+h*g-s*f,this._z=h*A+u*f+s*b-o*g,this._w=u*A-s*g-o*b-h*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,o=this._y,h=this._z,u=this._w;let g=u*e._w+s*e._x+o*e._y+h*e._z;if(g<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,g=-g):this.copy(e),g>=1)return this._w=u,this._x=s,this._y=o,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const M=1-t;return this._w=M*u+t*this._w,this._x=M*s+t*this._x,this._y=M*o+t*this._y,this._z=M*h+t*this._z,this.normalize(),this}const f=Math.sqrt(b),A=Math.atan2(f,g),x=Math.sin((1-t)*A)/f,E=Math.sin(t*A)/f;return this._w=u*x+this._w*E,this._x=s*x+this._x*E,this._y=o*x+this._y*E,this._z=h*x+this._z*E,this._onChangeCallback(),this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),o=Math.sqrt(1-s),h=Math.sqrt(s);return this.set(o*Math.sin(e),o*Math.cos(e),h*Math.sin(t),h*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Bt=class jh{constructor(e,t,s){this.x=0,this.y=0,this.z=0;const o=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(o!==0){if(o===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(o===1){const{x:h,y:u,z:g}=e;this.x=h,this.y=u,this.z=g||0;return}if(o===3){this.x=e,this.y=t,this.z=s;return}throw Ut.ILLEGAL_PARAMETERS}}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new jh(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Lo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Lo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[3]*s+h[6]*o,this.y=h[1]*t+h[4]*s+h[7]*o,this.z=h[2]*t+h[5]*s+h[8]*o,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix3d(e){const t=this.x,s=this.y,o=this.z,h=e.elements,u=1/(h[3]*t+h[7]*s+h[11]*o+h[15]);return this.x=(h[0]*t+h[4]*s+h[8]*o+h[12])*u,this.y=(h[1]*t+h[5]*s+h[9]*o+h[13])*u,this.z=(h[2]*t+h[6]*s+h[10]*o+h[14])*u,this}applyQuaternion(e){const t=this.x,s=this.y,o=this.z,h=e.x,u=e.y,g=e.z,b=e.w,f=2*(u*o-g*s),A=2*(g*t-h*o),x=2*(h*s-u*t);return this.x=t+b*f+u*x-g*A,this.y=s+b*A+g*f-h*x,this.z=o+b*x+h*A-u*f,this}transformDirection(e){const t=this.x,s=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[4]*s+h[8]*o,this.y=h[1]*t+h[5]*s+h[9]*o,this.z=h[2]*t+h[6]*s+h[10]*o,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),s=this.length(),o=e.length();return Math.abs(t)===s*o}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,o=e.y,h=e.z,u=t.x,g=t.y,b=t.z;return this.x=o*b-h*g,this.y=h*u-s*b,this.z=s*g-o*u,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return ea.copy(this).projectOnVector(e),this.sub(ea)}reflect(e){return this.sub(ea.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,o=this.z-e.z;return t*t+s*s+o*o}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),o=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=o,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Bt.X_AXIS=Object.freeze(new Bt(1,0,0)),Bt.NEGATIVE_X_AXIS=Object.freeze(new Bt(-1,0,0)),Bt.Y_AXIS=Object.freeze(new Bt(0,1,0)),Bt.NEGATIVE_Y_AXIS=Object.freeze(new Bt(0,-1,0)),Bt.Z_AXIS=Object.freeze(new Bt(0,0,1)),Bt.NEGATIVE_Z_AXIS=Object.freeze(new Bt(0,0,-1));let Z=Bt;const ea=new Z,Lo=new Wr,oa=class Gh{constructor(e,t,s,o,h,u,g,b,f,A,x,E,M,z,D,U){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&A!=null&&x!=null&&E!=null&&M!=null&&z!=null&&D!=null&&U!=null&&this.set(e,t,s,o,h,u,g,b,f,A,x,E,M,z,D,U)}set(e,t,s,o,h,u,g,b,f,A,x,E,M,z,D,U){const B=this.elements;return B[0]=e,B[4]=t,B[8]=s,B[12]=o,B[1]=h,B[5]=u,B[9]=g,B[13]=b,B[2]=f,B[6]=A,B[10]=x,B[14]=E,B[3]=M,B[7]=z,B[11]=D,B[15]=U,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Gh().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(Pa.equalPoint3d(e,Z.Z_AXIS))this.identity();else{const t=new Z(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(Z.Y_AXIS,e).normalize():t.crossVectors(Z.Z_AXIS,e).normalize();const s=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,s.x,s.y,s.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,s){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,s=e.elements,o=1/Ln.setFromMatrixColumn(e,0).length(),h=1/Ln.setFromMatrixColumn(e,1).length(),u=1/Ln.setFromMatrixColumn(e,2).length();return t[0]=s[0]*o,t[1]=s[1]*o,t[2]=s[2]*o,t[3]=0,t[4]=s[4]*h,t[5]=s[5]*h,t[6]=s[6]*h,t[7]=0,t[8]=s[8]*u,t[9]=s[9]*u,t[10]=s[10]*u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Fd,e,Ud)}lookAt(e,t,s){const o=this.elements;return Rt.subVectors(e,t),Rt.lengthSq()===0&&(Rt.z=1),Rt.normalize(),Ur.crossVectors(s,Rt),Ur.lengthSq()===0&&(Math.abs(s.z)===1?Rt.x+=1e-4:Rt.z+=1e-4,Rt.normalize(),Ur.crossVectors(s,Rt)),Ur.normalize(),js.crossVectors(Rt,Ur),o[0]=Ur.x,o[4]=js.x,o[8]=Rt.x,o[1]=Ur.y,o[5]=js.y,o[9]=Rt.y,o[2]=Ur.z,o[6]=js.z,o[10]=Rt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,o=t.elements,h=this.elements,u=s[0],g=s[4],b=s[8],f=s[12],A=s[1],x=s[5],E=s[9],M=s[13],z=s[2],D=s[6],U=s[10],B=s[14],ge=s[3],be=s[7],oe=s[11],W=s[15],ce=o[0],se=o[4],Ve=o[8],Ye=o[12],We=o[1],xe=o[5],Le=o[9],dt=o[13],mt=o[2],It=o[6],Je=o[10],at=o[14],Q=o[3],Te=o[7],ot=o[11],hr=o[15];return h[0]=u*ce+g*We+b*mt+f*Q,h[4]=u*se+g*xe+b*It+f*Te,h[8]=u*Ve+g*Le+b*Je+f*ot,h[12]=u*Ye+g*dt+b*at+f*hr,h[1]=A*ce+x*We+E*mt+M*Q,h[5]=A*se+x*xe+E*It+M*Te,h[9]=A*Ve+x*Le+E*Je+M*ot,h[13]=A*Ye+x*dt+E*at+M*hr,h[2]=z*ce+D*We+U*mt+B*Q,h[6]=z*se+D*xe+U*It+B*Te,h[10]=z*Ve+D*Le+U*Je+B*ot,h[14]=z*Ye+D*dt+U*at+B*hr,h[3]=ge*ce+be*We+oe*mt+W*Q,h[7]=ge*se+be*xe+oe*It+W*Te,h[11]=ge*Ve+be*Le+oe*Je+W*ot,h[15]=ge*Ye+be*dt+oe*at+W*hr,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[4],o=e[8],h=e[12],u=e[1],g=e[5],b=e[9],f=e[13],A=e[2],x=e[6],E=e[10],M=e[14],z=e[3],D=e[7],U=e[11],B=e[15];return z*(+h*b*x-o*f*x-h*g*E+s*f*E+o*g*M-s*b*M)+D*(+t*b*M-t*f*E+h*u*E-o*u*M+o*f*A-h*b*A)+U*(+t*f*x-t*g*M-h*u*x+s*u*M+h*g*A-s*f*A)+B*(-o*g*A-t*b*x+t*g*E+o*u*x-s*u*E+s*b*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const o=this.elements;return e instanceof Z?(o[12]=e.x,o[13]=e.y,o[14]=e.z):(o[12]=e,o[13]=t,o[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],A=e[8],x=e[9],E=e[10],M=e[11],z=e[12],D=e[13],U=e[14],B=e[15],ge=x*U*f-D*E*f+D*b*M-g*U*M-x*b*B+g*E*B,be=z*E*f-A*U*f-z*b*M+u*U*M+A*b*B-u*E*B,oe=A*D*f-z*x*f+z*g*M-u*D*M-A*g*B+u*x*B,W=z*x*b-A*D*b-z*g*E+u*D*E+A*g*U-u*x*U,ce=t*ge+s*be+o*oe+h*W;if(ce===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const se=1/ce;return e[0]=ge*se,e[1]=(D*E*h-x*U*h-D*o*M+s*U*M+x*o*B-s*E*B)*se,e[2]=(g*U*h-D*b*h+D*o*f-s*U*f-g*o*B+s*b*B)*se,e[3]=(x*b*h-g*E*h-x*o*f+s*E*f+g*o*M-s*b*M)*se,e[4]=be*se,e[5]=(A*U*h-z*E*h+z*o*M-t*U*M-A*o*B+t*E*B)*se,e[6]=(z*b*h-u*U*h-z*o*f+t*U*f+u*o*B-t*b*B)*se,e[7]=(u*E*h-A*b*h+A*o*f-t*E*f-u*o*M+t*b*M)*se,e[8]=oe*se,e[9]=(z*x*h-A*D*h-z*s*M+t*D*M+A*s*B-t*x*B)*se,e[10]=(u*D*h-z*g*h+z*s*f-t*D*f-u*s*B+t*g*B)*se,e[11]=(A*g*h-u*x*h-A*s*f+t*x*f+u*s*M-t*g*M)*se,e[12]=W*se,e[13]=(A*D*o-z*x*o+z*s*E-t*D*E-A*s*U+t*x*U)*se,e[14]=(z*g*o-u*D*o-z*s*b+t*D*b+u*s*U-t*g*U)*se,e[15]=(u*x*o-A*g*o+A*s*b-t*x*b-u*s*E+t*g*E)*se,this}scale(e){const t=this.elements,s=e.x,o=e.y,h=e.z;return t[0]*=s,t[4]*=o,t[8]*=h,t[1]*=s,t[5]*=o,t[9]*=h,t[2]*=s,t[6]*=o,t[10]*=h,t[3]*=s,t[7]*=o,t[11]*=h,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],o=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,o))}makeTranslation(e,t,s){return e instanceof Z?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),o=Math.sin(t),h=1-s,u=e.x,g=e.y,b=e.z,f=h*u,A=h*g;return this.set(f*u+s,f*g-o*b,f*b+o*g,0,f*g+o*b,A*g+s,A*b-o*u,0,f*b-o*g,A*b+o*u,h*b*b+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,o,h,u){return this.set(1,s,h,0,e,1,u,0,t,o,1,0,0,0,0,1),this}compose(e,t,s){const o=this.elements,h=t.x,u=t.y,g=t.z,b=t.w,f=h+h,A=u+u,x=g+g,E=h*f,M=h*A,z=h*x,D=u*A,U=u*x,B=g*x,ge=b*f,be=b*A,oe=b*x,W=s.x,ce=s.y,se=s.z;return o[0]=(1-(D+B))*W,o[1]=(M+oe)*W,o[2]=(z-be)*W,o[3]=0,o[4]=(M-oe)*ce,o[5]=(1-(E+B))*ce,o[6]=(U+ge)*ce,o[7]=0,o[8]=(z+be)*se,o[9]=(U-ge)*se,o[10]=(1-(E+D))*se,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,this}decompose(e,t,s){const o=this.elements;let h=Ln.set(o[0],o[1],o[2]).length();const u=Ln.set(o[4],o[5],o[6]).length(),g=Ln.set(o[8],o[9],o[10]).length();this.determinant()<0&&(h=-h),e.x=o[12],e.y=o[13],e.z=o[14],rr.copy(this);const b=1/h,f=1/u,A=1/g;return rr.elements[0]*=b,rr.elements[1]*=b,rr.elements[2]*=b,rr.elements[4]*=f,rr.elements[5]*=f,rr.elements[6]*=f,rr.elements[8]*=A,rr.elements[9]*=A,rr.elements[10]*=A,t.setFromRotationMatrix(rr),s.x=h,s.y=u,s.z=g,this}equals(e){const t=this.elements,s=e.elements;for(let o=0;o<16;o++)if(t[o]!==s[o])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};oa.IDENTITY=Object.freeze(new oa);let gn=oa;const Ln=new Z,rr=new gn,Fd=new Z(0,0,0),Ud=new Z(1,1,1),Ur=new Z,js=new Z,Rt=new Z;class Re{constructor(e=void 0,t=void 0){this.min=e==null?new Z(1/0,1/0,1/0):new Z(e.x,e.y,e.z),this.max=t==null?new Z(-1/0,-1/0,-1/0):new Z(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(ta.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=ta.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new Re().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ta).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Er[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(e),Er[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(e),Er[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(e),Er[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(e),Er[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(e),Er[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(e),Er[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(e),Er[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(e),this.setFromPoints(Er),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Er=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],ta=new Z,Oo=new $e;class _t{constructor(e=void 0,t=void 0){this.min=e==null?new $e(1/0,1/0):new $e(e.x,e.y),this.max=t==null?new $e(-1/0,-1/0):new $e(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Oo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new _t().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new $e(0,0):new $e(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new $e(0,0):new $e(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Oo).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const zo=new Z,Vd=new Z,jd=new ki;class zs{constructor(e=new Z(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,o){return this.normal.set(e,t,s),this.constant=o,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const o=zo.subVectors(s,t).cross(Vd.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(o,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const s=t||jd.getNormalMatrix(e),o=this.coplanarPoint(zo).applyMatrix3d(e),h=this.normal.applyMatrix3(s).normalize();return this.constant=-o.dot(h),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new zs().copy(this)}}class Me extends $e{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((s,o)=>{s.toArray(t,o*2)}),t}}class $ extends Z{static pointArrayToNumberArray(e,t=!0){const s=t?3:2,o=new Array(e.length*s);return e.forEach((h,u)=>{h.toArray(o,u*s)}),o}}const Do=new gn,Ro=new Wr,Wh=class la{constructor(e=0,t=0,s=0,o=la.DEFAULT_ORDER){this._x=e,this._y=t,this._z=s,this._order=o}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,s,o=this._order){return this._x=e,this._y=t,this._z=s,this._order=o,this._onChangeCallback(),this}clone(){return new la(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,s=!0){const o=e.elements,h=o[0],u=o[4],g=o[8],b=o[1],f=o[5],A=o[9],x=o[2],E=o[6],M=o[10];switch(t){case"XYZ":this._y=Math.asin(kr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-A,M),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(E,f),this._z=0);break;case"YXZ":this._x=Math.asin(-kr(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(g,M),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(kr(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-kr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(E,M),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(kr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-A,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,M));break;case"XZY":this._z=Math.asin(-kr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(E,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-A,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s=!0){return Do.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Do,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ro.setFromEuler(this),this.setFromQuaternion(Ro,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Wh.DEFAULT_ORDER="XYZ";let Hh=Wh;class qh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ia extends qh{translate(e){return this.transform(new ki().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Mi extends Ia{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new _t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let s=0;s<this.loops.length;++s){const o=this.loops[s].getPoints(e);t.push(o)}return t}buildHierarchy(){var e;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),o=this.sortBoundaryBoxesByAreas(s),h=new Map,u=o.length;for(let b=0;b<u;b++)h.set(o[b],{index:o[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<u;b++){const f=o[b],A=t[f],x=s[f];let E=b+1;for(;E<u;E++){const M=o[E],z=t[M];if(s[M].containsBox(x)&&Rh.isPointInPolygon(A[Ee.randInt(0,A.length-1)],z)){(e=h.get(M))==null||e.children.push(h.get(f));break}}E===u&&g.children.push(h.get(f))}return g}calculateBoundaryBoxes(e){const t=[];return e.forEach(s=>{t.push(new _t().setFromPoints(s))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((o,h)=>{const u=o.size,g=u.width*u.height;t.push({area:g,index:h})}),t.sort((o,h)=>o.area-h.area);const s=[];return t.forEach(o=>{s.push(o.index)}),s}}class Un extends Ia{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}getSpacedPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPointAt(s/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let s,o=this.getPoint(0),h=0;t.push(0);for(let u=1;u<=e;u++)s=this.getPoint(u/e),h+=s.distanceTo(o),t.push(h),o=s;return t}getUtoTmapping(e,t){const s=this.getLengths();let o=0;const h=s.length;let u;t?u=t:u=e*s[h-1];let g=0,b=h-1,f;for(;g<=b;)if(o=Math.floor(g+(b-g)/2),f=s[o]-u,f<0)g=o+1;else if(f>0)b=o-1;else{b=o;break}if(o=b,s[o]===u)return o/(h-1);const A=s[o],x=s[o+1]-A,E=(u-A)/x;return(o+E)/(h-1)}getTangent(e){let t=e-1e-4,s=e+1e-4;t<0&&(t=0),s>1&&(s=1);const o=this.getPoint(t),h=this.getPoint(s),u=new Me;return u.copy(h).sub(o).normalize(),u}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class Dn extends Un{constructor(e,t,s,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u==3)typeof e=="object"&&typeof t=="object"&&typeof s=="object"?this.createByThreePoints(e,t,s):this.createByStartEndPointsAndBulge(e,t,s);else if(u==5){const g=e;this.center=new Me(g.x,g.y),this.radius=t,this._clockwise=h,this._startAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(s)):Ee.normalizeAngle(s),this._endAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(o)):Ee.normalizeAngle(o)}else throw Ut.ILLEGAL_PARAMETERS}createByThreePoints(e,t,s){const o=(se,Ve)=>({x:(se.x+Ve.x)/2,y:(se.y+Ve.y)/2}),h=(se,Ve)=>(Ve.y-se.y)/(Ve.x-se.x),u=se=>-1/se,g=o(e,t),b=o(t,s),f=h(e,t),A=h(t,s),x=u(f),E=u(A),M=(se,Ve,Ye,We)=>{const xe=(We-Ve)/(se-Ye),Le=se*xe+Ve;return{x:xe,y:Le}},z=g.y-x*g.x,D=b.y-E*b.x,U=M(x,z,E,D),B=Math.sqrt(Math.pow(e.x-U.x,2)+Math.pow(e.y-U.y,2)),ge=(se,Ve)=>Math.atan2(se.y-Ve.y,se.x-Ve.x),be=ge(e,U),oe=ge(t,U),W=ge(s,U),ce=W>be&&W<oe||be>W&&be<oe||oe>W&&oe<be;this.center=U,this.radius=B,this._clockwise=!ce,this._startAngle=be,this._endAngle=W}createByStartEndPointsAndBulge(e,t,s){let o,h,u;s<0?(o=Math.atan(-s)*4,h=new $e(e),u=new $e(t)):(o=Math.atan(s)*4,h=new $e(t),u=new $e(e));const g=new $e().subVectors(u,h),b=g.length(),f=new $e().addVectors(h,g.multiplyScalar(.5)),A=Math.abs(b/2/Math.tan(o/2)),x=g.normalize();let E;if(o<Math.PI){const M=new $e(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(-A))}else{const M=new $e(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(A))}s<0?(this._startAngle=Math.atan2(h.y-E.y,h.x-E.x),this._endAngle=Math.atan2(u.y-E.y,u.x-E.x)):(this._startAngle=Math.atan2(u.y-E.y,u.x-E.x),this._endAngle=Math.atan2(h.y-E.y,h.x-E.x)),this._clockwise=s<0,this.center=E,this.radius=u.sub(E).length()}get center(){return this._center}set center(e){this._center=new Me(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(e)):Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const t=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(t):t,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return this.clockwise?Ee.normalizeAngle(e-t):Ee.normalizeAngle(t-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle),s=Ee.normalizeAngle((e+t)/2),o=this._clockwise?this._mirrorAngle(s):s;return this.getPointAtAngle(o)}get closed(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return Math.abs(t-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of t){const u=this._getInternalAngle(h);Ee.isBetweenAngle(u,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(h))}const s=e.map(h=>h.x),o=e.map(h=>h.y);return new _t(new Me(Math.min(...s),Math.min(...o)),new Me(Math.max(...s),Math.max(...o)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new Dn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(e){const t=this._getInternalAngle(e),s=this.center.x+this.radius*Math.cos(t),o=this.center.y+this.radius*Math.sin(t);return new Me(s,o)}getPoints(e=100){const t=[];let s=this.deltaAngle,o=this._getInternalAngle(this.startAngle);if(this.closed&&(s=nt,o=0),this.clockwise)for(let h=0;h<=e;h++){const u=o-s*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Me(b.x,b.y))}else for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Me(b.x,b.y))}return t}}class Gd extends qh{translate(e){return this.transform(new gn().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ds extends Gd{}class Hr extends Ds{constructor(e,t){super(),this._start=new $(e),this._end=new $(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new Z().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new $((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const s=this.delta(ln).normalize();return new $(this._start).addScaledVector(s,e)}else{const s=this.delta(ln).normalize();return new $(this._end).addScaledVector(s,e)}}extend(e,t=!1){if(t){const s=ln.subVectors(this._start,this._end).normalize();this._start=new $(this._start).addScaledVector(s,e)}else{const s=this.delta(ln).normalize();this._end=new $(this._end).addScaledVector(s,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){Bo.subVectors(e,this._start),Gs.subVectors(this.endPoint,this.startPoint);const s=Gs.dot(Gs);let o=Gs.dot(Bo)/s;return t&&(o=Ee.clamp(o,0,1)),o}closestPointToPoint(e,t,s){const o=this.closestPointToPointParameter(e,t);return this.delta(s).multiplyScalar(o).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,s=ln.subVectors(e,this.startPoint).dot(t);return new $().copy(t).multiplyScalar(s).add(this.startPoint)}perpPoint(e){const t=this.direction,s=this.startPoint,o=ln.subVectors(e,s).dot(t),h=ln.copy(t).multiplyScalar(o);return new $().addVectors(s,h)}calculateBoundingBox(){const e=new $(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),t=new $(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Re(e,t)}transform(e){return this._start.applyMatrix3d(e),this._end.applyMatrix3d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Hr(this._start.clone(),this._end.clone())}}const ln=new Z,Bo=new Z,Gs=new Z;class mn extends Ds{static computeCenterPoint(e,t,s){const o=new Z().addVectors(e,t).multiplyScalar(.5),h=new Z().addVectors(e,s).multiplyScalar(.5),u=new Z().subVectors(t,e),g=new Z().subVectors(s,e),b=new Z().crossVectors(u,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new Z().crossVectors(u,b).normalize(),A=new Z().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=A.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),M=new Hr(o,o.clone().add(x)),z=new Hr(h,h.clone().add(E)),D=new Z;return M.closestPointToPoint(z.startPoint,!0,D)?D:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,s){const o=mn.computeCenterPoint(e,t,s);if(o){const h=o.distanceTo(e),u=new Z().subVectors(e,o),g=new Z().subVectors(t,o),b=Math.atan2(u.y,u.x),f=Math.atan2(g.y,g.x);return new mn(o,h,b,f,Z.Z_AXIS)}}constructor(e,t,s,o,h,u=Z.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=s,this.endAngle=o,this.normal=h,this.refVec=u,(o-s)%nt==0?(this.startAngle=0,this.endAngle=nt):(this.startAngle=s,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Ee.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new Z(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Ee.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Re({x:t,y:s,z:o},{x:h,y:u,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=nt,o=0);for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}transform(e){const t=ra.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=ra.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(e),t.applyMatrix3d(e),s.applyMatrix3d(e),this.normal.applyMatrix3d(e).normalize(),this.refVec.applyMatrix3d(e).normalize(),this.startAngle=this.getAngle(t),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new mn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(ra.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,s=this.refVec,o={x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x},h=this.center,u=this.radius;return new $(h.x+u*(s.x*Math.cos(e)+o.x*Math.sin(e)),h.y+u*(s.y*Math.cos(e)+o.y*Math.sin(e)),h.z+u*(s.z*Math.cos(e)+o.z*Math.sin(e)))}get plane(){const e=new Z(this.center).distanceTo(wa);return new zs(this.normal,e)}}const ra=new Z;class Ti extends Un{constructor(e,t,s,o=0,h=nt,u=!1,g=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=s,(h-o)%nt==0?(this.startAngle=0,this.endAngle=nt):(this.startAngle=o,this.endAngle=h),this.clockwise=u,this.rotation=g}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Ee.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,s=-1/0,o=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);e=Math.min(e,u.x),t=Math.min(t,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y)}return new _t({x:e,y:t},{x:s,y:o})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let s=this.endAngle-this.startAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=t;for(;s>t;)s-=t;s<Number.EPSILON&&(o?s=0:s=t),this.clockwise===!0&&!o&&(s===t?s=-t:s=s-t);const h=this.startAngle+e*s;let u=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),A=u-this.center.x,x=g-this.center.y;u=A*b-x*f+this.center.x,g=A*f+x*b+this.center.y}return new Me(u,g)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new Ti(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Ci extends Ds{constructor(e,t,s,o,h,u=0,g=nt){super(),this.center=e,this.normal=t,this.majorAxis=s,this.majorAxisRadius=o,this.minorAxisRadius=h;const b=Math.abs(g-u);Math.abs(b-nt)<1e-10||Math.abs(b-2*nt)<1e-10?(this.startAngle=0,this.endAngle=nt):(this.startAngle=u,this.endAngle=g)}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-nt)<1e-10?nt:Ee.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new Z(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new Z().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return Aa.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const e=1e3,t=this.deltaAngle/e;let s=0,o=this.getPointAtAngle(this.startAngle);for(let h=1;h<=e;h++){const u=this.startAngle+h*t,g=this.getPointAtAngle(u),b=g.x-o.x,f=g.y-o.y,A=g.z-o.z;s+=Math.sqrt(b*b+f*f+A*A),o=g}return s}calculateBoundingBox(){if(this.majorAxis.equals(Z.X_AXIS)||this.majorAxis.equals(Z.Y_AXIS)||this.majorAxis.isParallelTo(Z.X_AXIS)||this.majorAxis.isParallelTo(Z.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Ee.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Re({x:t,y:s,z:o},{x:h,y:u,z:g})}else{let e=1/0,t=1/0,s=1/0,o=-1/0,h=-1/0,u=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);e=Math.min(e,f.x),t=Math.min(t,f.y),s=Math.min(s,f.z),o=Math.max(o,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Re({x:e,y:t,z:s},{x:o,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=nt,o=0);for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}getPointAtAngle(e){const t=Math.cos(e),s=Math.sin(e),o=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),h=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(o);return new $(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(e){const t=new Z(e).sub(this.center),s=t.dot(this.majorAxis),o=t.dot(this.minorAxis),h=s/this.majorAxisRadius,u=o/this.minorAxisRadius;return h*h+u*u<=1}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ci(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new Z(this.center).distanceTo(wa);return new zs(this.normal,e)}}class Rs extends Un{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new Me(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new Me(t.x,t.y)}else{const t=this._vertices[e-1];return new Me(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let s=0;s<t;++s){const o=this._vertices[s];let h=null;if(s<t-1?h=this._vertices[s+1]:s==t-1&&this.closed&&(h=this._vertices[0]),h)if(o.bulge){const u=new Dn(o,h,o.bulge);e+=u.length}else e+=new Me(o.x,o.y).distanceTo(h)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}getPointAt(e){const t=this._vertices[e];return new Me(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new _t().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const s=[];return this.getPoints(e).forEach(o=>s.push(new $().set(o.x,o.y,t))),s}getPoints(e){const t=[],s=this._vertices.length;for(let o=0;o<s;++o){const h=this._vertices[o];if(h.bulge){let u=null;if(o<s-1?u=this._vertices[o+1]:o==s-1&&this.closed&&(u=this._vertices[0]),u){const g=new Dn(h,u,h.bulge).getPoints(e),b=g.length;for(let f=0;f<b;++f){const A=g[f];t.push(new Me(A.x,A.y))}}}else t.push(new Me(h.x,h.y)),o==s-1&&this.closed&&t.push(t[0])}return t}}class Ni extends Un{constructor(e,t){super(),this._start=new Me(e),this._end=new Me(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new Me(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new Me(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new _t(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ni(this._start.clone(),this._end.clone())}}class Yh extends Un{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new Me(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new _t;return t.setFromPoints(e),t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(s=>{s.getPoints(e).forEach(o=>{t.push(new Me(o.x,o.y))})}),t}}function Wd(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Xh={exports:{}};(function(i,e){(function(t){i.exports=t()})(function(){var t={},s=this;new Function("try {return this===window;}catch(e){ return false;}");var o=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(o()&&h(),o()||h()){var u=s;if(h()){var g=function(b,f){var A=s;return b.split(".").forEach(function(x){A&&(A=A[x])}),A?A[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,A){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},E=function(){return Te.__string_rec(this,"")};function M(r,n){function a(){}a.prototype=r;var l=new a;for(var c in n)l[c]=n[c];return n.toString!==Object.prototype.toString&&(l.toString=n.toString),l}var z=function(){};x.HxOverrides=z,z.__name__=["HxOverrides"],z.strDate=function(r){var n=r.length;switch(n){case 8:var a=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(a[0]),l.setUTCMinutes(a[1]),l.setUTCSeconds(a[2]),l;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),p=d[0].split("-"),_=d[1].split(":");return new Date(p[0],p[1]-1,p[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},z.cca=function(r,n){var a=r.charCodeAt(n);if(a==a)return a},z.substr=function(r,n,a){return n!=null&&n!=0&&a!=null&&a<0?"":(a==null&&(a=r.length),n<0?(n=r.length+n,n<0&&(n=0)):a<0&&(a=r.length+a-n),r.substr(n,a))},z.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var D=function(){};x.Lambda=D,D.__name__=["Lambda"],D.fold=function(r,n,a){for(var l=Xt(r)();l.hasNext();){var c=l.next();a=n(c,a)}return a};var U=function(){this.length=0};x.List=U,U.__name__=["List"],U.prototype={add:function(r){var n=[r];this.h==null?this.h=n:this.q[1]=n,this.q=n,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:U},Math.__name__=["Math"];var B=function(){};x.Reflect=B,B.__name__=["Reflect"],B.field=function(r,n){try{return r[n]}catch(a){return a instanceof Q&&(a=a.val),null}},B.callMethod=function(r,n,a){return n.apply(r,a)},B.fields=function(r){var n=[];if(r!=null){var a=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&a.call(r,l)&&n.push(l)}return n},B.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},B.deleteField=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)?(delete r[n],!0):!1};var ge=function(){};x.Std=ge,ge.__name__=["Std"],ge.string=function(r){return Te.__string_rec(r,"")},ge.parseFloat=function(r){return parseFloat(r)};var be=function(){this.b=""};x.StringBuf=be,be.__name__=["StringBuf"],be.prototype={add:function(r){this.b+=ge.string(r)},__class__:be};var oe=function(){};x.StringTools=oe,oe.__name__=["StringTools"],oe.fastCodeAt=function(r,n){return r.charCodeAt(n)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=E,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=E,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=E,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=E,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=E,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=E,W.TFunction.__enum__=W,W.TClass=function(r){var n=["TClass",6,r];return n.__enum__=W,n.toString=E,n},W.TEnum=function(r){var n=["TEnum",7,r];return n.__enum__=W,n.toString=E,n},W.TUnknown=["TUnknown",8],W.TUnknown.toString=E,W.TUnknown.__enum__=W;var ce=function(){};x.Type=ce,ce.__name__=["Type"],ce.getClassName=function(r){var n=r.__name__;return n==null?null:n.join(".")},ce.getEnumName=function(r){var n=r.__ename__;return n.join(".")},ce.resolveClass=function(r){var n=x[r];return n==null||!n.__name__?null:n},ce.resolveEnum=function(r){var n=x[r];return n==null||!n.__ename__?null:n},ce.createEmptyInstance=function(r){function n(){}return n.prototype=r.prototype,new n},ce.createEnum=function(r,n,a){var l=B.field(r,n);if(l==null)throw new Q("No such constructor "+n);if(B.isFunction(l)){if(a==null)throw new Q("Constructor "+n+" need parameters");return B.callMethod(r,l,a)}if(a!=null&&a.length!=0)throw new Q("Constructor "+n+" does not need parameters");return l},ce.getEnumConstructs=function(r){var n=r.__constructs__;return n.slice()},ce.typeof=function(r){var n=typeof r;switch(n){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(r)==r%2147483648?W.TInt:W.TFloat;case"object":if(r==null)return W.TNull;var a=r.__enum__;if(a!=null)return W.TEnum(a);var l=Te.getClass(r);return l!=null?W.TClass(l):W.TObject;case"function":return r.__name__||r.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var se=function(){};x["haxe.IMap"]=se,se.__name__=["haxe","IMap"];var Ve=function(r,n){this.high=r,this.low=n};x["haxe._Int64.___Int64"]=Ve,Ve.__name__=["haxe","_Int64","___Int64"],Ve.prototype={__class__:Ve};var Ye=function(){this.buf=new be,this.cache=[],this.useCache=Ye.USE_CACHE,this.useEnumIndex=Ye.USE_ENUM_INDEX,this.shash=new mt,this.scount=0};x["haxe.Serializer"]=Ye,Ye.__name__=["haxe","Serializer"],Ye.prototype={toString:function(){return this.buf.b},serializeString:function(r){var n=this.shash.get(r);if(n!=null){this.buf.b+="R",n==null?this.buf.b+="null":this.buf.b+=""+n;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var n=typeof r,a=0,l=this.cache.length;a<l;){var c=a++,d=this.cache[c];if(typeof d==n&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var n=0,a=B.fields(r);n<a.length;){var l=a[n];++n,this.serializeString(l),this.serialize(B.field(r,l))}this.buf.b+="g"},serialize:function(r){{var n=ce.typeof(r);switch(n[1]){case 0:this.buf.b+="n";break;case 1:var a=r;if(a==0){this.buf.b+="z";return}this.buf.b+="i",a==null?this.buf.b+="null":this.buf.b+=""+a;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=n[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var p=r.length,_=0;_<p;){var v=_++;r[v]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[v]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case U:this.buf.b+="l";for(var w=r,S=w.h,P=null;S!=null;){var I;P=S[0],S=S[1],I=P,this.serialize(I)}this.buf.b+="h";break;case Date:var k=r;this.buf.b+="v",this.buf.add(k.getTime());break;case mt:this.buf.b+="b";for(var T=r,L=T.keys();L.hasNext();){var N=L.next();this.serializeString(N),this.serialize(Ri[N]!=null?T.getReserved(N):T.h[N])}this.buf.b+="h";break;case xe:this.buf.b+="q";for(var R=r,O=R.keys();O.hasNext();){var F=O.next();this.buf.b+=":",F==null?this.buf.b+="null":this.buf.b+=""+F,this.serialize(R.h[F])}this.buf.b+="h";break;case Le:this.buf.b+="M";for(var V=r,q=V.keys();q.hasNext();){var J=q.next(),H=B.field(J,"__id__");B.deleteField(J,"__id__"),this.serialize(J),J.__id__=H,this.serialize(V.h[J.__id__])}this.buf.b+="h";break;case It:for(var j=r,X=0,ee=j.length-2,te=new be,ie=Ye.BASE64;X<ee;){var he=j.get(X++),ae=j.get(X++),ue=j.get(X++);te.add(ie.charAt(he>>2)),te.add(ie.charAt((he<<4|ae>>4)&63)),te.add(ie.charAt((ae<<2|ue>>6)&63)),te.add(ie.charAt(ue&63))}if(X==ee){var ne=j.get(X++),de=j.get(X++);te.add(ie.charAt(ne>>2)),te.add(ie.charAt((ne<<4|de>>4)&63)),te.add(ie.charAt(de<<2&63))}else if(X==ee+1){var Y=j.get(X++);te.add(ie.charAt(Y>>2)),te.add(ie.charAt(Y<<4&63))}var pe=te.b;this.buf.b+="s",pe.length==null?this.buf.b+="null":this.buf.b+=""+pe.length,this.buf.b+=":",pe==null?this.buf.b+="null":this.buf.b+=""+pe;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(Te.__instanceof(r,uo)){var Se=ce.getClassName(r);this.buf.b+="A",this.serializeString(Se)}else if(Te.__instanceof(r,mo))this.buf.b+="B",this.serializeString(ce.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Ge=n[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(ce.getEnumName(Ge)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=ge.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var Xe=r.length;this.buf.b+=ge.string(Xe-2);for(var Fe=2;Fe<Xe;){var Ke=Fe++;this.serialize(r[Ke])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+ge.string(r))}}},__class__:Ye};var We=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var n=We.DEFAULT_RESOLVER;n==null&&(n=ce,We.DEFAULT_RESOLVER=n),this.setResolver(n)};x["haxe.Unserializer"]=We,We.__name__=["haxe","Unserializer"],We.initCodes=function(){for(var r=[],n=0,a=We.BASE64.length;n<a;){var l=n++;r[We.BASE64.charCodeAt(l)]=l}return r},We.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(n){return null},resolveEnum:function(n){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,n=!1,a=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=a)break;n=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return n&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var n=this.buf.charCodeAt(this.pos);if(n>=43&&n<58||n==101||n==69)this.pos++;else break}return ge.parseFloat(z.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var n=this.unserialize();if(typeof n!="string")throw new Q("Invalid object key");var a=this.unserialize();r[n]=a}this.pos++},unserializeEnum:function(r,n){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var a=this.readDigits();if(a==0)return ce.createEnum(r,n);for(var l=[];a-- >0;)l.push(this.unserialize());return ce.createEnum(r,n,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var n=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<n)throw new Q("Invalid string length");var a=z.substr(this.buf,this.pos,n);return this.pos+=n,a=decodeURIComponent(a.split("+").join(" ")),this.scache.push(a),a;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var p={};return this.cache.push(p),this.unserializeObject(p),p;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new Q("Invalid string reference");return this.scache[v];case 120:throw new Q(this.unserialize());case 99:var w=this.unserialize(),S=this.resolver.resolveClass(w);if(S==null)throw new Q("Class not found "+w);var P=ce.createEmptyInstance(S);return this.cache.push(P),this.unserializeObject(P),P;case 119:var I=this.unserialize(),k=this.resolver.resolveEnum(I);if(k==null)throw new Q("Enum not found "+I);var T=this.unserializeEnum(k,this.unserialize());return this.cache.push(T),T;case 106:var L=this.unserialize(),N=this.resolver.resolveEnum(L);if(N==null)throw new Q("Enum not found "+L);this.pos++;var R=this.readDigits(),O=ce.getEnumConstructs(N)[R];if(O==null)throw new Q("Unknown enum index "+L+"@"+R);var F=this.unserializeEnum(N,O);return this.cache.push(F),F;case 108:var V=new U;for(this.cache.push(V),this.buf;this.buf.charCodeAt(this.pos)!=104;)V.add(this.unserialize());return this.pos++,V;case 98:var q=new mt;for(this.cache.push(q),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();q.set(J,this.unserialize())}return this.pos++,q;case 113:var H=new xe;this.cache.push(H),this.buf;for(var j=this.get(this.pos++);j==58;){var X=this.readDigits();H.set(X,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new Q("Invalid IntMap format");return H;case 77:var ee=new Le;for(this.cache.push(ee),this.buf;this.buf.charCodeAt(this.pos)!=104;){var te=this.unserialize();ee.set(te,this.unserialize())}return this.pos++,ee;case 118:var ie;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var he=z.substr(this.buf,this.pos,19);ie=z.strDate(he),this.pos+=19}else{var ae=this.readFloat(),ue=new Date;ue.setTime(ae),ie=ue}return this.cache.push(ie),ie;case 115:var ne=this.readDigits(),de=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<ne)throw new Q("Invalid bytes length");var Y=We.CODES;Y==null&&(Y=We.initCodes(),We.CODES=Y);var pe=this.pos,Se=ne&3,Ge;Ge=(ne>>2)*3+(Se>=2?Se-1:0);for(var Xe=pe+(ne-Se),Fe=It.alloc(Ge),Ke=0;pe<Xe;){var At=Y[oe.fastCodeAt(de,pe++)],Wt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,At<<2|Wt>>4);var vt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,Wt<<4|vt>>2);var gt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,vt<<6|gt)}if(Se>=2){var Pt=Y[oe.fastCodeAt(de,pe++)],Tt=Y[oe.fastCodeAt(de,pe++)];if(Fe.set(Ke++,Pt<<2|Tt>>4),Se==3){var Kt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,Tt<<4|Kt>>2)}}return this.pos+=ne,this.cache.push(Fe),Fe;case 67:var or=this.unserialize(),$t=this.resolver.resolveClass(or);if($t==null)throw new Q("Class not found "+or);var Zt=ce.createEmptyInstance($t);if(this.cache.push(Zt),Zt.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return Zt;case 65:var Qt=this.unserialize(),dr=this.resolver.resolveClass(Qt);if(dr==null)throw new Q("Class not found "+Qt);return dr;case 66:var Tn=this.unserialize(),$r=this.resolver.resolveEnum(Tn);if($r==null)throw new Q("Enum not found "+Tn);return $r}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:We};var xe=function(){this.h={}};x["haxe.ds.IntMap"]=xe,xe.__name__=["haxe","ds","IntMap"],xe.__interfaces__=[se],xe.prototype={set:function(r,n){this.h[r]=n},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n|0);return z.iter(r)},__class__:xe};var Le=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Le,Le.__name__=["haxe","ds","ObjectMap"],Le.__interfaces__=[se],Le.prototype={set:function(r,n){var a=r.__id__||(r.__id__=++Le.count);this.h[a]=n,this.h.__keys__[a]=r},keys:function(){var r=[];for(var n in this.h.__keys__)this.h.hasOwnProperty(n)&&r.push(this.h.__keys__[n]);return z.iter(r)},__class__:Le};var dt=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};dt.Some=function(r){var n=["Some",0,r];return n.__enum__=dt,n.toString=E,n},dt.None=["None",1],dt.None.toString=E,dt.None.__enum__=dt;var mt=function(){this.h={}};x["haxe.ds.StringMap"]=mt,mt.__name__=["haxe","ds","StringMap"],mt.__interfaces__=[se],mt.prototype={set:function(r,n){Ri[r]!=null?this.setReserved(r,n):this.h[r]=n},get:function(r){return Ri[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,n){this.rh==null&&(this.rh={}),this.rh["$"+r]=n},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return z.iter(r)},arrayKeys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n);if(this.rh!=null)for(var n in this.rh)n.charCodeAt(0)==36&&r.push(n.substr(1));return r},__class__:mt};var It=function(r){this.length=r.byteLength,this.b=new Bi(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=It,It.__name__=["haxe","io","Bytes"],It.alloc=function(r){return new It(new Us(r))},It.prototype={get:function(r){return this.b[r]},set:function(r,n){this.b[r]=n&255},__class__:It};var Je=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};Je.Blocked=["Blocked",0],Je.Blocked.toString=E,Je.Blocked.__enum__=Je,Je.Overflow=["Overflow",1],Je.Overflow.toString=E,Je.Overflow.__enum__=Je,Je.OutsideBounds=["OutsideBounds",2],Je.OutsideBounds.toString=E,Je.OutsideBounds.__enum__=Je,Je.Custom=function(r){var n=["Custom",3,r];return n.__enum__=Je,n.toString=E,n};var at=function(){};x["haxe.io.FPHelper"]=at,at.__name__=["haxe","io","FPHelper"],at.i32ToFloat=function(r){var n=1-(r>>>31<<1),a=r>>>23&255,l=r&8388607;return l==0&&a==0?0:n*(1+Math.pow(2,-23)*l)*Math.pow(2,a-127)},at.floatToI32=function(r){if(r==0)return 0;var n;r<0?n=-r:n=r;var a=Math.floor(Math.log(n)/.6931471805599453);a<-127?a=-127:a>128&&(a=128);var l=Math.round((n/Math.pow(2,a)-1)*8388608)&8388607;return(r<0?-2147483648:0)|a+127<<23|l},at.i64ToDouble=function(r,n){var a=1-(n>>>31<<1),l=(n>>20&2047)-1023,c=(n&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&l==-1023?0:a*(1+Math.pow(2,-52)*c)*Math.pow(2,l)},at.doubleToI64=function(r){var n=at.i64tmp;if(r==0)n.low=0,n.high=0;else{var a;r<0?a=-r:a=r;var l=Math.floor(Math.log(a)/.6931471805599453),c,d=(a/Math.pow(2,l)-1)*4503599627370496;c=Math.round(d);var p=c|0,_=c/4294967296|0;n.low=p,n.high=(r<0?-2147483648:0)|l+1023<<20|_}return n};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=M(Error.prototype,{__class__:Q});var Te=function(){};x["js.Boot"]=Te,Te.__name__=["js","Boot"],Te.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var n=r.__class__;if(n!=null)return n;var a=Te.__nativeClassName(r);return a!=null?Te.__resolveNativeClass(a):null},Te.__string_rec=function(r,n){if(r==null)return"null";if(n.length>=5)return"<...>";var a=typeof r;switch(a=="function"&&(r.__name__||r.__ename__)&&(a="object"),a){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";n+=" ";for(var c=2,d=r.length;c<d;){var p=c++;p!=2?l+=","+Te.__string_rec(r[p],n):l+=Te.__string_rec(r[p],n)}return l+")"}var _=r.length,v="[";n+=" ";for(var w=0;w<_;){var S=w++;v+=(S>0?",":"")+Te.__string_rec(r[S],n)}return v+="]",v}var P;try{P=r.toString}catch(N){return N instanceof Q&&(N=N.val),"???"}if(P!=null&&P!=Object.toString&&typeof P=="function"){var I=r.toString();if(I!="[object Object]")return I}var k=null,T=`{
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function jc(i,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in i)){const h=Object.getOwnPropertyDescriptor(s,o);h&&Object.defineProperty(i,o,h.get?h:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}const qs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Gi=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function ls(i,e,t){return Math.max(e,Math.min(t,i))}const Go=class Wo{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(ls(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=ls(e,0,256),this._colorIndex>0&&this._colorIndex<256?(this._color=Gi[e],this._colorName=this.getColorNameByValue(this._color)):(this._color=null,this._colorName=null))}get colorName(){return this._colorName}set colorName(e){if(e){const t=qs[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,s){const o=Math.round(ls(e,0,255)),h=Math.round(ls(t,0,255)),u=Math.round(ls(s,0,255));return this.color=(o<<16)+(h<<8)+u,this}setColorName(e){const t=qs[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new Wo;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,s]of Object.entries(qs))if(s===e)return t;return null}getColorIndexByValue(e){const t=Gi.length-1;for(let s=1;s<t;++s)if(Gi[s]===e)return s;return null}};Go.NAMES=qs;let fn=Go;const Ut={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};let Gc=class{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const o=s.indexOf(t);o!==-1&&s.splice(o,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const s=t.slice(0);for(let o=0,h=s.length;o<h;o++)s[o].call(this,e)}}},it=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const s of this.listeners)s.call(null,e,...t)}};var Wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hc(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Ho={exports:{}};(function(i){(function(e,t){i.exports?i.exports=t():e.log=t()})(Wc,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),o=["trace","debug","info","warn","error"],h={},u=null;function g(D,U){var B=D[U];if(typeof B.bind=="function")return B.bind(D);try{return Function.prototype.bind.call(B,D)}catch{return function(){return Function.prototype.apply.apply(B,[D,arguments])}}}function b(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(D){return D==="debug"&&(D="log"),typeof console===t?!1:D==="trace"&&s?b:console[D]!==void 0?g(console,D):console.log!==void 0?g(console,"log"):e}function S(){for(var D=this.getLevel(),U=0;U<o.length;U++){var B=o[U];this[B]=U<D?e:this.methodFactory(B,D,this.name)}if(this.log=this.debug,typeof console===t&&D<this.levels.SILENT)return"No console available for logging"}function x(D){return function(){typeof console!==t&&(S.call(this),this[D].apply(this,arguments))}}function E(D,U,B){return f(D)||x.apply(this,arguments)}function M(D,U){var B=this,ge,be,oe,W="loglevel";typeof D=="string"?W+=":"+D:typeof D=="symbol"&&(W=void 0);function ce(xe){var Le=(o[xe]||"silent").toUpperCase();if(!(typeof window===t||!W)){try{window.localStorage[W]=Le;return}catch{}try{window.document.cookie=encodeURIComponent(W)+"="+Le+";"}catch{}}}function se(){var xe;if(!(typeof window===t||!W)){try{xe=window.localStorage[W]}catch{}if(typeof xe===t)try{var Le=window.document.cookie,dt=encodeURIComponent(W),mt=Le.indexOf(dt+"=");mt!==-1&&(xe=/^([^;]+)/.exec(Le.slice(mt+dt.length+1))[1])}catch{}return B.levels[xe]===void 0&&(xe=void 0),xe}}function Ve(){if(!(typeof window===t||!W)){try{window.localStorage.removeItem(W)}catch{}try{window.document.cookie=encodeURIComponent(W)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Ye(xe){var Le=xe;if(typeof Le=="string"&&B.levels[Le.toUpperCase()]!==void 0&&(Le=B.levels[Le.toUpperCase()]),typeof Le=="number"&&Le>=0&&Le<=B.levels.SILENT)return Le;throw new TypeError("log.setLevel() called with invalid level: "+xe)}B.name=D,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=U||E,B.getLevel=function(){return oe??be??ge},B.setLevel=function(xe,Le){return oe=Ye(xe),Le!==!1&&ce(oe),S.call(B)},B.setDefaultLevel=function(xe){be=Ye(xe),se()||B.setLevel(xe,!1)},B.resetLevel=function(){oe=null,Ve(),S.call(B)},B.enableAll=function(xe){B.setLevel(B.levels.TRACE,xe)},B.disableAll=function(xe){B.setLevel(B.levels.SILENT,xe)},B.rebuild=function(){if(u!==B&&(ge=Ye(u.getLevel())),S.call(B),u===B)for(var xe in h)h[xe].rebuild()},ge=Ye(u?u.getLevel():"WARN");var We=se();We!=null&&(oe=Ye(We)),S.call(B)}u=new M,u.getLogger=function(D){if(typeof D!="symbol"&&typeof D!="string"||D==="")throw new TypeError("You must supply a name when creating a logger.");var U=h[D];return U||(U=h[D]=new M(D,u.methodFactory)),U};var z=typeof window!==t?window.log:void 0;return u.noConflict=function(){return typeof window!==t&&window.log===u&&(window.log=z),u},u.getLoggers=function(){return h},u.default=u,u})})(Ho);var qo=Ho.exports;const qc=Hc(qo),Yc=jc({__proto__:null,default:qc},[qo]),Xc=!0,Es=Yc;Es.setLevel("debug");const Kc=i=>{try{Es.setLevel(i)}catch(e){Es.setLevel("error"),Es.error(e)}};function Ps(i){return i===null||typeof i!="object"?i:Array.isArray(i)?[...i]:{...i}}function Bn(i,...e){for(const t of e)if(t)for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&i[s]===void 0&&(i[s]=t[s]);return i}function Yo(i,e){return i!=null&&Object.prototype.hasOwnProperty.call(i,e)}function Xo(i){return i==null?!0:Array.isArray(i)||typeof i=="string"?i.length===0:i instanceof Map||i instanceof Set?i.size===0:typeof i=="object"?Object.keys(i).length===0:!1}function zn(i,e){if(i===e)return!0;if(i==null||e==null)return i===e;if(typeof i!=typeof e)return!1;if(typeof i!="object")return i===e;if(Array.isArray(i)!==Array.isArray(e))return!1;if(Array.isArray(i)){if(i.length!==e.length)return!1;for(let o=0;o<i.length;o++)if(!zn(i[o],e[o]))return!1;return!0}const t=Object.keys(i),s=Object.keys(e);if(t.length!==s.length)return!1;for(const o of t)if(!Object.prototype.hasOwnProperty.call(e,o)||!zn(i[o],e[o]))return!1;return!0}let Ko=class $o{constructor(e,t){this.events={attrChanged:new it,modelChanged:new it},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=e||{};t&&Bn(s,t),this.attributes=s,this.changed={}}get(e){return this.attributes[e]}set(e,t,s){if(e==null)return this;let o;typeof e=="object"?(o=e,s=t):(o={},o[e]=t),s||(s={});const h=s.unset,u=s.silent,g=[],b=this._changing;this._changing=!0,b||(this._previousAttributes=Ps(this.attributes),this.changed={});const f=this.attributes,S=this.changed,x=this._previousAttributes;for(const E in o)t=o[E],zn(f[E],t)||g.push(E),zn(x[E],t)?delete S[E]:S[E]=t,h?delete f[E]:f[E]=t;if(!u){g.length&&(this._pending=s);for(let E=0;E<g.length;E++)this.events.attrChanged.dispatch({object:this,attrName:g[E],attrValue:f[g[E]],options:s})}if(b)return this;if(!u)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!Xo(this.changed):Yo(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?Ps(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,s={};for(const o in e){const h=e[o];zn(t[o],h)||(s[o]=h)}return s}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return Ps(this._previousAttributes)}clone(){const e=Ps(this.attributes);return new $o(e)}},ca=class Is{constructor(){this.entries=new Map}static getInstance(){return Is.instance||(Is.instance=new Is),Is.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class $c{static formatBytes(e,t=2){if(e===0)return"0 B";const s=1024,o=Math.max(0,t),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(e)/Math.log(s)),g=e/Math.pow(s,u);return`${parseFloat(g.toFixed(o))} ${h[u]}`}}class Zo{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class Qo{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}scheduleTask(e){return new Promise((t,s)=>{const o=()=>{Promise.resolve(e()).then(t).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let s=e;for(let o=0;o<t;o++){const h=this.tasks[o];try{s=await this.scheduleTask(async()=>{const u=await h.run(s);return this.onProgress((o+1)/t,h),u})}catch(u){this.onError({error:u,taskIndex:o,task:h});return}}this.onComplete(s)}}let Jo=class{constructor(e,t,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=s}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,s=this.handlers.length;t<s;t+=2){const o=this.handlers[t],h=this.handlers[t+1];if(o.global&&(o.lastIndex=0),o.test(e))return h}return null}};const el=new Jo;let Zc=class{constructor(e){this.manager=e!==void 0?e:el,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((s,o)=>{this.load(e,s,t,o)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};class tl{constructor(e,t,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){return new Promise((t,s)=>{const o=()=>{Promise.resolve(e()).then(t).catch(s)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(o):setTimeout(o,0)})}async processChunk(e){let t=0;const s=async()=>{const o=t,h=Math.min(t+this._chunkSize,this._count);await e(o,h),t=h,t<this._count&&await this.scheduleTask(s)};await s()}}var ht,hs,Qe,st,cs,Jt,yt,pr,er,Jr,us,ds,en,tn,ms,ps,gs,Ct,gr,qe,rn,fs,_e,bt,_s,xt,vs,fr,_r,tr,ys,nn,Nt,vr,sn,Wi,Hi,yr,br,bs,xs,xr,ws,qi,Yi,ct,wr,ut,Lt,Xi,Ki,$i,Zi,Ar,Ot,an,As,on,zt,Sr,Dt,Pr;(ht={})[ht.None=0]="None",ht[ht.Anonymous=1]="Anonymous",ht[ht.NonConstant=2]="NonConstant",ht[ht.Xref=4]="Xref",ht[ht.XrefOverlay=8]="XrefOverlay",ht[ht.ExternallyDependent=16]="ExternallyDependent",ht[ht.ResolvedOrDependent=32]="ResolvedOrDependent",ht[ht.ReferencedXref=64]="ReferencedXref";(hs={})[hs.BYBLOCK=0]="BYBLOCK",hs[hs.BYLAYER=256]="BYLAYER";(Qe={})[Qe.Rotated=0]="Rotated",Qe[Qe.Aligned=1]="Aligned",Qe[Qe.Angular=2]="Angular",Qe[Qe.Diameter=3]="Diameter",Qe[Qe.Radius=4]="Radius",Qe[Qe.Angular3Point=5]="Angular3Point",Qe[Qe.Ordinate=6]="Ordinate",Qe[Qe.ReferenceIsExclusive=32]="ReferenceIsExclusive",Qe[Qe.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",Qe[Qe.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(st={})[st.TopLeft=1]="TopLeft",st[st.TopCenter=2]="TopCenter",st[st.TopRight=3]="TopRight",st[st.MiddleLeft=4]="MiddleLeft",st[st.MiddleCenter=5]="MiddleCenter",st[st.MiddleRight=6]="MiddleRight",st[st.BottomLeft=7]="BottomLeft",st[st.BottomCenter=8]="BottomCenter",st[st.BottomRight=9]="BottomRight";(cs={})[cs.AtLeast=1]="AtLeast",cs[cs.Exact=2]="Exact";var Io=((Jt={})[Jt.Center=0]="Center",Jt[Jt.Above=1]="Above",Jt[Jt.Outside=2]="Outside",Jt[Jt.JIS=3]="JIS",Jt[Jt.Below=4]="Below",Jt),Nn=((yt={})[yt.Feet=0]="Feet",yt[yt.None=1]="None",yt[yt.Inch=2]="Inch",yt[yt.FeetAndInch=3]="FeetAndInch",yt[yt.Leading=4]="Leading",yt[yt.Trailing=8]="Trailing",yt[yt.LeadingAndTrailing=12]="LeadingAndTrailing",yt),Qc=((pr={})[pr.None=0]="None",pr[pr.Leading=1]="Leading",pr[pr.Trailing=2]="Trailing",pr[pr.LeadingAndTrailing=3]="LeadingAndTrailing",pr),Jc=((er={})[er.Center=0]="Center",er[er.Left=1]="Left",er[er.Right=2]="Right",er[er.OverFirst=3]="OverFirst",er[er.OverSecond=4]="OverSecond",er),eu=((Jr={})[Jr.Bottom=0]="Bottom",Jr[Jr.Center=1]="Center",Jr[Jr.Top=2]="Top",Jr);(us={})[us.PatternFill=0]="PatternFill",us[us.SolidFill=1]="SolidFill";(ds={})[ds.NonAssociative=0]="NonAssociative",ds[ds.Associative=1]="Associative";(en={})[en.Normal=0]="Normal",en[en.Outer=1]="Outer",en[en.Ignore=2]="Ignore";(tn={})[tn.UserDefined=0]="UserDefined",tn[tn.Predefined=1]="Predefined",tn[tn.Custom=2]="Custom";(ms={})[ms.NotAnnotated=0]="NotAnnotated",ms[ms.Annotated=1]="Annotated";(ps={})[ps.Solid=0]="Solid",ps[ps.Gradient=1]="Gradient";(gs={})[gs.TwoColor=0]="TwoColor",gs[gs.OneColor=1]="OneColor";var tu=((Ct={})[Ct.Default=0]="Default",Ct[Ct.External=1]="External",Ct[Ct.Polyline=2]="Polyline",Ct[Ct.Derived=4]="Derived",Ct[Ct.Textbox=8]="Textbox",Ct[Ct.Outermost=16]="Outermost",Ct),Vs=((gr={})[gr.Line=1]="Line",gr[gr.Circular=2]="Circular",gr[gr.Elliptic=3]="Elliptic",gr[gr.Spline=4]="Spline",gr),ru=((qe={})[qe.Off=0]="Off",qe[qe.Solid=1]="Solid",qe[qe.Dashed=2]="Dashed",qe[qe.Dotted=3]="Dotted",qe[qe.ShotDash=4]="ShotDash",qe[qe.MediumDash=5]="MediumDash",qe[qe.LongDash=6]="LongDash",qe[qe.DoubleShortDash=7]="DoubleShortDash",qe[qe.DoubleMediumDash=8]="DoubleMediumDash",qe[qe.DoubleLongDash=9]="DoubleLongDash",qe[qe.DoubleMediumLongDash=10]="DoubleMediumLongDash",qe[qe.SparseDot=11]="SparseDot",qe);ru.Off;(rn={})[rn.Standard=-3]="Standard",rn[rn.ByLayer=-2]="ByLayer",rn[rn.ByBlock=-1]="ByBlock";(fs={})[fs.English=0]="English",fs[fs.Metric=1]="Metric";(_e={})[_e.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",_e[_e.FRONT_CLIPPING=2]="FRONT_CLIPPING",_e[_e.BACK_CLIPPING=4]="BACK_CLIPPING",_e[_e.UCS_FOLLOW=8]="UCS_FOLLOW",_e[_e.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",_e[_e.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",_e[_e.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",_e[_e.FAST_ZOOM=128]="FAST_ZOOM",_e[_e.SNAP_MODE=256]="SNAP_MODE",_e[_e.GRID_MODE=512]="GRID_MODE",_e[_e.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",_e[_e.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",_e[_e.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",_e[_e.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",_e[_e.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",_e[_e.UNUSED=32768]="UNUSED",_e[_e.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",_e[_e.VIEWPORT_OFF=131072]="VIEWPORT_OFF",_e[_e.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",_e[_e.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",_e[_e.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",_e[_e.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(bt={})[bt.OPTIMIZED_2D=0]="OPTIMIZED_2D",bt[bt.WIREFRAME=1]="WIREFRAME",bt[bt.HIDDEN_LINE=2]="HIDDEN_LINE",bt[bt.FLAT_SHADED=3]="FLAT_SHADED",bt[bt.GOURAUD_SHADED=4]="GOURAUD_SHADED",bt[bt.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",bt[bt.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(_s={})[_s.UCS_UNCHANGED=0]="UCS_UNCHANGED",_s[_s.HAS_OWN_UCS=1]="HAS_OWN_UCS";(xt={})[xt.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",xt[xt.TOP=1]="TOP",xt[xt.BOTTOM=2]="BOTTOM",xt[xt.FRONT=3]="FRONT",xt[xt.BACK=4]="BACK",xt[xt.LEFT=5]="LEFT",xt[xt.RIGHT=6]="RIGHT";(vs={})[vs.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",vs[vs.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(fr={})[fr.ByLayer=0]="ByLayer",fr[fr.ByBlock=1]="ByBlock",fr[fr.ByDictionaryDefault=2]="ByDictionaryDefault",fr[fr.ByObject=3]="ByObject";function Ae(i,e,t){return i.code===e&&(t==null||i.value===t)}function ze(i){let e={};i.rewind();let t=i.next(),s=t.code;if(e.x=t.value,(t=i.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=i.next()).code!==s+20?i.rewind():e.z=t.value,e}let ua=Symbol();function ye(i,e){return(t,s,o)=>{let h=function(b,f=!1){return b.reduce((S,x)=>{x.pushContext&&S.push({});let E=S[S.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let z=E[M]??(E[M]=[]);x.isMultiple&&z.length&&f&&console.warn(`Snippet ${z[z.length-1].name} for code(${M}) is shadowed by ${x.name}`),z.push(x)}return S},[{}])}(i,s.debug),u=!1,g=h.length-1;for(;!Ae(t,0,"EOF");){let b=function(U,B,ge){return U.find((be,oe)=>{var W;return oe>=ge&&((W=be[B])==null?void 0:W.length)})}(h,t.code,g),f=b==null?void 0:b[t.code],S=f==null?void 0:f[f.length-1];if(!b||!S){s.rewind();break}S.isMultiple||b[t.code].pop();let{name:x,parser:E,isMultiple:M,isReducible:z}=S,D=E==null?void 0:E(t,s,o);if(D===ua){s.rewind();break}if(x){let[U,B]=function(ge,be){let oe=be.split(".");if(!oe.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let W=ge;for(let ce=0;ce<oe.length-1;++ce){let se=Qi(oe[ce]),Ve=Qi(oe[ce+1]);Object.prototype.hasOwnProperty.call(W,se)||(typeof Ve=="number"?W[se]=[]:W[se]={}),W=W[se]}return[W,Qi(oe[oe.length-1])]}(o,x);M&&!z?(Object.prototype.hasOwnProperty.call(U,B)||(U[B]=[]),U[B].push(D)):U[B]=D}S.pushContext&&(g-=1),u=!0,t=s.next()}return e&&Object.setPrototypeOf(o,e),u}}function Qi(i){let e=Number.parseInt(i);return Number.isNaN(e)?i:e}function y({value:i}){return i}function G(i,e){return ze(e)}function Be({value:i}){return!!i}let nu=[{code:1001,name:"xdata",parser:rl}];function rl(i,e){var o;if(!Ae(i,1001))throw Error("XData must starts with code 1001");let t={appName:i.value,value:[]};i=e.next();let s=[t.value];for(;!Ae(i,0,"EOF")&&i.code>=1e3;){let h=s[s.length-1];switch(i.code){case 1002:i.value==="{"?s.push([]):(s.pop(),(o=s[s.length-1])==null||o.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:Ir(i.code),value:i.value});break;case 1003:h.push({name:"layer",type:Ir(i.code),value:i.value});break;case 1005:h.push({name:"handle",type:Ir(i.code),value:i.value});break;case 1010:h.push({type:Ir(i.code),value:ze(e)});break;case 1011:h.push({name:"worldSpacePosition",type:Ir(i.code),value:ze(e)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:Ir(i.code),value:ze(e)});break;case 1013:h.push({name:"worldSpaceDirection",type:Ir(i.code),value:ze(e)});break;case 1041:h.push({name:"distance",type:Ir(i.code),value:i.value});break;case 1042:h.push({name:"scale",type:Ir(i.code),value:i.value})}i=e.next()}return e.rewind(),t}function Ir(i){switch(i){case 1e3:case 1003:case 1005:return"string";case 1004:return"hex";case 1040:case 1041:case 1042:return"real";case 1070:return"integer";case 1071:return"long";case 1010:case 1011:case 1012:case 1013:return"point";default:return""}}function dn(i,e,t){for(;Ae(i,102);){var s;let o=i.value;if(i=e.next(),!o.startsWith("{")){e.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${o}`),function(u,g){for(;!Ae(u,102)&&!Ae(u,0,"EOF");)u=g.next()}(i,e),i=e.next();continue}let h=o.slice(1).trim();t.extensions??(t.extensions={}),(s=t.extensions)[h]??(s[h]=[]),function(u,g,b){for(;!Ae(u,102,"}")&&!Ae(u,0,"EOF");)b.push(u),u=g.next()}(i,e,t.extensions[h]),i=e.next()}e.rewind()}let su=0;function nl(i){if(!i)throw TypeError("entity cannot be undefined or null");i.handle||(i.handle=su++)}var iu=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function sl(i){return iu[i]}(_r={})[_r.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",_r[_r.CAST=1]="CAST",_r[_r.RECEIVE=2]="RECEIVE",_r[_r.IGNORE=3]="IGNORE";let Ue=[...nu,{code:284,name:"shadowMode",parser:y},{code:390,name:"plotStyleHardId",parser:y},{code:380,name:"plotStyleType",parser:y},{code:440,name:"transparency",parser:y},{code:430,name:"colorName",parser:y},{code:420,name:"color",parser:y},{code:310,name:"proxyEntity",isMultiple:!0,parser:y},{code:92,name:"proxyByte",parser:y},{code:60,name:"isVisible",parser:Be},{code:48,name:"lineTypeScale",parser:y},{code:370,name:"lineweight",parser:y},{code:62,name:"colorIndex",parser(i,e,t){let s=i.value;return s>0&&s<256&&(t.color=sl(Math.abs(s))),s}},{code:347,name:"materialObjectHardId",parser:y},{code:6,name:"lineType",parser:y},{code:8,name:"layer",parser:y},{code:410,name:"layoutTabName",parser:y},{code:67,name:"isInPaperSpace",parser:Be},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:y},{code:102,parser:dn},{code:102,parser:dn},{code:102,parser:dn},{code:5,name:"handle",parser:y}];function Ii(i){return[{code:3,name:i,parser:(e,t,s)=>(s._code3text=(s._code3text??"")+e.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:i,parser:(e,t,s)=>(s._code1text=e.value,(s._code3text??"")+s._code1text)}]}function il(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let au={extrusionDirection:{x:0,y:0,z:1}},ou=[{code:210,name:"extrusionDirection",parser:G},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:100,name:"subclassMarker",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:y},{code:100},...Ue];class al{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){il(this,"parser",ye(ou,au))}}il(al,"ForEntityName","ARC");(tr={})[tr.NONE=0]="NONE",tr[tr.INVISIBLE=1]="INVISIBLE",tr[tr.CONSTANT=2]="CONSTANT",tr[tr.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",tr[tr.PRESET=8]="PRESET";(ys={})[ys.MULTILINE=2]="MULTILINE",ys[ys.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(nn={})[nn.NONE=0]="NONE",nn[nn.MIRRORED_X=2]="MIRRORED_X",nn[nn.MIRRORED_Y=4]="MIRRORED_Y";var lu=((Nt={})[Nt.LEFT=0]="LEFT",Nt[Nt.CENTER=1]="CENTER",Nt[Nt.RIGHT=2]="RIGHT",Nt[Nt.ALIGNED=3]="ALIGNED",Nt[Nt.MIDDLE=4]="MIDDLE",Nt[Nt.FIT=5]="FIT",Nt),hu=((vr={})[vr.BASELINE=0]="BASELINE",vr[vr.BOTTOM=1]="BOTTOM",vr[vr.MIDDLE=2]="MIDDLE",vr[vr.TOP=3]="TOP",vr);function ol(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let ll={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:lu.LEFT,valign:hu.BASELINE,extrusionDirection:{x:0,y:0,z:1}},hl=[{code:73,name:"valign",parser:y},{code:100},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:72,name:"valign",parser:y},{code:72,name:"halign",parser:y},{code:71,name:"generationFlag",parser:y},{code:7,name:"styleName",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"xScale",parser:y},{code:50,name:"rotation",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class cl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ol(this,"parser",ye(hl,ll))}}function ul(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ol(cl,"ForEntityName","TEXT");let cu={...ll},uu=[{code:2},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Be},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedRecord",parser:Be},{code:100},{code:280,name:"isLocked",parser:Be},{code:74,name:"valign",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:3,name:"prompt",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},...hl.slice(2)];class dl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ul(this,"parser",ye(uu,cu))}}ul(dl,"ForEntityName","ATTDEF");(sn={})[sn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",sn[sn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",sn[sn.BY_STYLE=5]="BY_STYLE";function du(i,e){let t={};for(let s of i){let o=e(s);o!=null&&(t[o]??(t[o]=[]),t[o].push(s))}return t}function*Js(i,e=1/0,t=1){for(let s=i;s!==e;s+=t)yield s}function Vr(i){return{x:i.x??0,y:i.y??0,z:i.z??0}}function da(i,e,t){if(Ae(e,102))return dn(e,t,i),!0;switch(e.code){case 0:i.type=e.value;break;case 5:i.handle=e.value;break;case 330:i.ownerBlockRecordSoftId=e.value;break;case 67:i.isInPaperSpace=!!e.value;break;case 8:i.layer=e.value;break;case 6:i.lineType=e.value;break;case 347:i.materialObjectHardId=e.value;break;case 62:i.colorIndex=e.value,i.color=sl(Math.abs(e.value));break;case 370:i.lineweight=e.value;break;case 48:i.lineTypeScale=e.value;break;case 60:i.isVisible=!!e.value;break;case 92:i.proxyByte=e.value;break;case 310:i.proxyEntity=e.value;break;case 100:break;case 420:i.color=e.value;break;case 430:i.transparency=e.value;break;case 390:i.plotStyleHardId=e.value;break;case 284:i.shadowMode=e.value;break;case 1001:i.xdata=rl(e,t);break;default:return!1}return!0}function ml(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let mu={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Ys=[{code:46,name:"annotationHeight",parser:y},{code:101,parser(i,e){(function(t){t.rewind();let s=t.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=t.next();while(s.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:y},{code:49,name:"columnGutter",parser:y},{code:48,name:"columnWidth",parser:y},{code:79,name:"columnAutoHeight",parser:y},{code:78,name:"columnFlowReversed",parser:y},{code:76,name:"columnCount",parser:y},{code:75,name:"columnType",parser:y},{code:441,name:"backgroundFillTransparency",parser:y},{code:63,name:"backgroundFillColor",parser:y},{code:45,name:"fillBoxScale",parser:y},{code:[...Js(430,440)],name:"backgroundColor",parser:y},{code:[...Js(420,430)],name:"backgroundColor",parser:y},{code:90,name:"backgroundFill",parser:y},{code:44,name:"lineSpacing",parser:y},{code:73,name:"lineSpacingStyle",parser:y},{code:50,name:"rotation",parser:y},{code:43},{code:42},{code:11,name:"direction",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:7,name:"styleName",parser:y},...Ii("text"),{code:72,name:"drawingDirection",parser:y},{code:71,name:"attachmentPoint",parser:y},{code:41,name:"width",parser:y},{code:40,name:"height",parser:y},{code:10,name:"insertionPoint",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class pl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ml(this,"parser",ye(Ys,mu))}}function gl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ml(pl,"ForEntityName","MTEXT");let pu={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},gu=[...Ys.slice(Ys.findIndex(({name:i})=>i==="columnType"),Ys.findIndex(({name:i})=>i==="subclassMarker")+1),{code:100},{code:0,parser(i){if(!Ae(i,0,"MTEXT"))return ua}},{code:2,name:"definitionTag",parser:y},{code:40,name:"annotationScale",parser:y},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardId",parser:y},{code:70,name:"numberOfSecondaryAttributes",parser:y},{code:70,name:"isReallyLocked",parser:Be},{code:70,name:"mtextFlag",parser:y},{code:280,name:"isDuplicatedEntriesKeep",parser:Be},{code:100},{code:280,name:"lockPositionFlag",parser:Be},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"alignmentPoint",parser:G},{code:74,name:"verticalJustification",parser:y},{code:72,name:"horizontalJustification",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:7,name:"textStyle",parser:y},{code:51,name:"obliqueAngle",parser:y},{code:41,name:"scale",parser:y},{code:50,name:"rotation",parser:y},{code:73},{code:70,name:"attributeFlag",parser:y},{code:2,name:"tag",parser:y},{code:280},{code:100,name:"subclassMarker",parser:y},{code:1,name:"text",parser:y},{code:40,name:"textHeight",parser:y},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100},...Ue];class fl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){gl(this,"parser",ye(gu,pu))}}function _l(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}gl(fl,"ForEntityName","ATTRIB");let fu=[...Ii("data"),{code:70,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class vl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){_l(this,"parser",ye(fu))}}function yl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}_l(vl,"ForEntityName","BODY");let _u={thickness:0,extrusionDirection:{x:0,y:0,z:1}},vu=[{code:210,name:"extrusionDirection",parser:G},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class bl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){yl(this,"parser",ye(vu,_u))}}yl(bl,"ForEntityName","CIRCLE");class Xs{parseEntity(e,t){let s={};for(;!Ae(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(o,h,u){switch(h.code){case 100:o.subclassMarker=h.value;break;case 280:o.version=h.value;break;case 2:o.name=h.value;break;case 10:o.definitionPoint=ze(u);break;case 11:o.textPoint=ze(u);break;case 12:o.insertionPoint=ze(u);break;case 13:o.subDefinitionPoint1=ze(u);break;case 14:o.subDefinitionPoint2=ze(u);break;case 15:o.centerPoint=ze(u);break;case 16:o.arcPoint=ze(u);break;case 70:o.dimensionType=h.value;break;case 71:o.attachmentPoint=h.value;break;case 72:o.textLineSpacingStyle=h.value;break;case 40:o.leaderLength=h.value;break;case 41:o.textLineSpacingFactor=h.value;break;case 42:o.measurement=h.value;break;case 1:o.text=h.value;break;case 50:o.rotationAngle=h.value;break;case 52:o.obliqueAngle=h.value;break;case 53:o.textRotation=h.value;break;case 51:o.ocsRotation=h.value;break;case 210:o.extrusionDirection=ze(u);break;case 3:o.styleName=h.value;break;default:da(o,h,u)}})(s,t,e),t=e.next()}return s}}function xl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Hi="DIMENSION",(Wi="ForEntityName")in Xs?Object.defineProperty(Xs,Wi,{value:Hi,enumerable:!0,configurable:!0,writable:!0}):Xs[Wi]=Hi;let yu={extrusionDirection:{x:0,y:0,z:1}},bu=[{code:42,name:"endAngle",parser:y},{code:41,name:"startAngle",parser:y},{code:40,name:"axisRatio",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"majorAxisEndPoint",parser:G},{code:10,name:"center",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class wl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){xl(this,"parser",ye(bu,yu))}}xl(wl,"ForEntityName","ELLIPSE");(yr={})[yr.First=1]="First",yr[yr.Second=2]="Second",yr[yr.Third=4]="Third",yr[yr.Fourth=8]="Fourth";function Al(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let xu=[{code:13,name:"vertices.3",parser:G},{code:12,name:"vertices.2",parser:G},{code:11,name:"vertices.1",parser:G},{code:10,name:"vertices.0",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Sl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Al(this,"parser",ye(xu))}}Al(Sl,"ForEntityName","3DFACE");let Pl=[{code:330,name:"sourceBoundaryObjects",parser:y,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:y}],wu=[{code:11,name:"end",parser:G},{code:10,name:"start",parser:G}],Au=[{code:73,name:"isCCW",parser:Be},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"radius",parser:y},{code:10,name:"center",parser:G}],Su=[{code:73,name:"isCCW",parser:Be},{code:51,name:"endAngle",parser:y},{code:50,name:"startAngle",parser:y},{code:40,name:"lengthOfMinorAxis",parser:y},{code:11,name:"end",parser:G},{code:10,name:"center",parser:G}],Pu=[{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:11,name:"fitDatum",isMultiple:!0,parser:G},{code:97,name:"numberOfFitData",parser:y},{code:10,name:"controlPoints",isMultiple:!0,parser(i,e){let t={...ze(e),weight:1};return(i=e.next()).code===42?t.weight=i.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:y},{code:96,name:"numberOfControlPoints",parser:y},{code:95,name:"numberOfKnots",parser:y},{code:74,name:"isPeriodic",parser:Be},{code:73,name:"splineFlag",parser:y},{code:94,name:"degree",parser:y}],Iu={[Vs.Line]:wu,[Vs.Circular]:Au,[Vs.Elliptic]:Su,[Vs.Spline]:Pu},Eu=[...Pl,{code:72,name:"edges",parser(i,e){let t={type:i.value},s=ye(Iu[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(i=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:y}],ku=[...Pl,{code:10,name:"vertices",parser(i,e){let t={...ze(e),bulge:0};return(i=e.next()).code===42?t.bulge=i.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:y},{code:73,name:"isClosed",parser:Be},{code:72,name:"hasBulge",parser:Be}],Mu=[{code:49,name:"dashLengths",parser:y,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:y},{code:45,name:"offset",parser:Eo},{code:43,name:"base",parser:Eo},{code:53,name:"angle",parser:y}];function Eo(i,e){let t=i.code+1,s={x:i.value,y:1};return(i=e.next()).code===t?s.y=i.value:e.rewind(),s}function Il(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Tu={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Cu=[{code:470},{code:463},{code:462,name:"colorTint",parser:y},{code:461,name:"gradientDefinition",parser:y},{code:460,name:"gradientRotation",parser:y},{code:453,name:"numberOfColors",parser:y},{code:452,name:"gradientColorFlag",parser:y},{code:451},{code:450,name:"gradientFlag",parser:y},{code:10,name:"seedPoints",parser:G,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:G},{code:98,name:"numberOfSeedPoints",parser:y},{code:47,name:"pixelSize",parser:y},{code:53,name:"definitionLines",parser:function(i,e){let t={};return ye(Mu)(i,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:y},{code:77,name:"isDouble",parser:Be},{code:73,name:"isAnnotated",parser:Be},{code:41,name:"patternScale",parser:y},{code:52,name:"patternAngle",parser:y},{code:76,name:"patternType",parser:y},{code:75,name:"hatchStyle",parser:y},{code:92,name:"boundaryPaths",parser:function(i,e){let t={boundaryPathTypeFlag:i.value},s=t.boundaryPathTypeFlag&tu.Polyline;return i=e.next(),s?ye(ku)(i,e,t):ye(Eu)(i,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:y},{code:71,name:"associativity",parser:y},{code:63,name:"patternFillColor",parser:y},{code:70,name:"solidFill",parser:y},{code:2,name:"patternName",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:10,name:"elevationPoint",parser:G},{code:100,name:"subclassMarker",parser:y,pushContext:!0},...Ue];class El{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Il(this,"parser",ye(Cu,Tu))}}Il(El,"ForEntityName","HATCH");(br={})[br.ShowImage=1]="ShowImage",br[br.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",br[br.UseClippingBoundary=4]="UseClippingBoundary",br[br.TransparencyIsOn=8]="TransparencyIsOn";(bs={})[bs.Rectangular=1]="Rectangular",bs[bs.Polygonal=2]="Polygonal";(xs={})[xs.Outside=0]="Outside",xs[xs.Inside=1]="Inside";function kl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Nu={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Lu=[{code:290,name:"clipMode",parser:y},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:G},{code:91,name:"countBoundaryPoints",parser:y},{code:71,name:"clippingBoundaryType",parser:y},{code:360,name:"imageDefReactorHandle",parser:y},{code:283,name:"fade",parser:y},{code:282,name:"contrast",parser:y},{code:281,name:"brightness",parser:y},{code:280,name:"isClipped",parser:Be},{code:70,name:"flags",parser:y},{code:340,name:"imageDefHandle",parser:y},{code:13,name:"imageSize",parser:G},{code:12,name:"vPixel",parser:G},{code:11,name:"uPixel",parser:G},{code:10,name:"position",parser:G},{code:90,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Ml{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){kl(this,"parser",ye(Lu,Nu))}}function Tl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}kl(Ml,"ForEntityName","IMAGE");let Ou={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},zu=[{code:210,name:"extrusionDirection",parser:G},{code:45,name:"rowSpacing",parser:y},{code:44,name:"columnSpacing",parser:y},{code:71,name:"rowCount",parser:y},{code:70,name:"columnCount",parser:y},{code:50,name:"rotation",parser:y},{code:43,name:"zScale",parser:y},{code:42,name:"yScale",parser:y},{code:41,name:"xScale",parser:y},{code:10,name:"insertionPoint",parser:G},{code:2,name:"name",parser:y},{code:66,name:"isVariableAttributes",parser:Be},{code:100,name:"subclassMarker",parser:y},...Ue];class Cl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Tl(this,"parser",ye(zu,Ou))}}function Nl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Tl(Cl,"ForEntityName","INSERT");let Du={isArrowheadEnabled:!0},Ru=[{code:213,name:"offsetFromAnnotation",parser:G},{code:212,name:"offsetFromBlock",parser:G},{code:211,name:"horizontalDirection",parser:G},{code:210,name:"normal",parser:G},{code:340,name:"associatedAnnotation",parser:y},{code:77,name:"byBlockColor",parser:y},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:76,name:"numberOfVertices",parser:y},{code:41,name:"textWidth",parser:y},{code:40,name:"textHeight",parser:y},{code:75,name:"isHooklineExists",parser:Be},{code:74,name:"isHooklineSameDirection",parser:Be},{code:73,name:"leaderCreationFlag",parser:y},{code:72,name:"isSpline",parser:Be},{code:71,name:"isArrowheadEnabled",parser:Be},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue],Ll=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Nl(this,"parser",ye(Ru,Du))}};Nl(Ll,"ForEntityName","LEADER");(xr={})[xr.TextAnnotation=0]="TextAnnotation",xr[xr.ToleranceAnnotation=1]="ToleranceAnnotation",xr[xr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",xr[xr.NoAnnotation=3]="NoAnnotation";function Ol(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Bu={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Fu=[{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class zl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Ol(this,"parser",ye(Fu,Bu))}}Ol(zl,"ForEntityName","LINE");(ws={})[ws.IS_CLOSED=1]="IS_CLOSED",ws[ws.PLINE_GEN=128]="PLINE_GEN";let Uu={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Vu={bulge:0},ju=[{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:91,name:"id",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y}],Gu=[{code:210,name:"extrusionDirection",parser:G},{code:10,name:"vertices",isMultiple:!0,parser(i,e){let t={};return ye(ju,Vu)(i,e,t),t}},{code:39,name:"thickness",parser:y},{code:38,name:"elevation",parser:y},{code:43,name:"constantWidth",parser:y},{code:70,name:"flag",parser:y},{code:90,name:"numberOfVertices",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Ks{parseEntity(e,t){let s={};return ye(Gu,Uu)(t,e,s),s}}function Dl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Yi="LWPOLYLINE",(qi="ForEntityName")in Ks?Object.defineProperty(Ks,qi,{value:Yi,enumerable:!0,configurable:!0,writable:!0}):Ks[qi]=Yi;let Wu=[{code:90,name:"overridenSubEntityCount",parser:y},{code:140,name:"edgeCreaseWeights",parser:y,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:y},{code:94,parser(i,e,t){t.edgeCount=i.value,t.edgeIndices=[];for(let s=0;s<t.edgeCount;++s){let o=[];i=e.next(),o[0]=i.value,i=e.next(),o[1]=i.value,t.edgeIndices.push(o)}}},{code:93,parser(i,e,t){t.totalFaceIndices=i.value,t.faceIndices=[];let s=[];for(let h=0;h<t.totalFaceIndices&&!Ae(i,0);++h)i=e.next(),s.push(i.value);let o=0;for(;o<s.length;){let h=s[o++],u=[];for(let g=0;g<h;++g)u.push(s[o++]);t.faceIndices.push(u)}}},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:92,name:"verticesCount",parser:y},{code:91,name:"subdivisionLevel",parser:y},{code:40,name:"blendCrease",parser:y},{code:72,name:"isBlendCreased",parser:Be},{code:71,name:"version",parser:y},{code:100,name:"subclassMarker",parser:function({value:i}){return i.trim()},pushContext:!0},...Ue];class Rl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Dl(this,"parser",ye(Wu))}}function Bl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Dl(Rl,"ForEntityName","MESH");let Hu={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},qu=[{code:50,name:"angle",parser:y},{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:y},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Fl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Bl(this,"parser",ye(qu,Hu))}}Bl(Fl,"ForEntityName","POINT");(ct={})[ct.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",ct[ct.CURVE_FIT=2]="CURVE_FIT",ct[ct.SPLINE_FIT=4]="SPLINE_FIT",ct[ct.POLYLINE_3D=8]="POLYLINE_3D",ct[ct.POLYGON_3D=16]="POLYGON_3D",ct[ct.CLOSED_POLYGON=32]="CLOSED_POLYGON",ct[ct.POLYFACE=64]="POLYFACE",ct[ct.CONTINUOUS=128]="CONTINUOUS";(wr={})[wr.NONE=0]="NONE",wr[wr.QUADRATIC=5]="QUADRATIC",wr[wr.CUBIC=6]="CUBIC",wr[wr.BEZIER=8]="BEZIER";(ut={})[ut.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ut[ut.TANGENT_DEFINED=2]="TANGENT_DEFINED",ut[ut.NOT_USED=4]="NOT_USED",ut[ut.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ut[ut.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ut[ut.FOR_POLYLINE=32]="FOR_POLYLINE",ut[ut.FOR_POLYGON=64]="FOR_POLYGON",ut[ut.POLYFACE=128]="POLYFACE";function Ul(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let Yu={startWidth:0,endWidth:0,bulge:0},Xu=[{code:91,name:"id",parser:y},{code:[...Js(71,75)],name:"faces",isMultiple:!0,parser:y},{code:50,name:"tangentDirection",parser:y},{code:70,name:"flag",parser:y},{code:42,name:"bulge",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:30,name:"z",parser:y},{code:20,name:"y",parser:y},{code:10,name:"x",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...Ue];class ma{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Ul(this,"parser",ye(Xu,Yu))}}function Vl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Ul(ma,"ForEntityName","VERTEX");let Ku={thickness:0,flag:0,startWidth:0,endWidth:0,meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0,smoothType:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},$u=[{code:0,name:"vertices",isMultiple:!0,parser:(i,e)=>Ae(i,0,"VERTEX")?(i=e.next(),new ma().parseEntity(e,i)):ua},{code:210,name:"extrusionDirection",parser:G},{code:75,name:"smoothType",parser:y},{code:74,name:"surfaceNDensity",parser:y},{code:73,name:"surfaceMDensity",parser:y},{code:72,name:"meshNVertexCount",parser:y},{code:71,name:"meshMVertexCount",parser:y},{code:41,name:"endWidth",parser:y},{code:40,name:"startWidth",parser:y},{code:70,name:"flag",parser:y},{code:39,name:"thickness",parser:y},{code:30,name:"elevation",parser:y},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:y},...Ue];class jl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Vl(this,"parser",ye($u,Ku))}}function Gl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Vl(jl,"ForEntityName","POLYLINE");let Zu=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class Wl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Gl(this,"parser",ye(Zu))}}function Hl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Gl(Wl,"ForEntityName","RAY");let Qu=[...Ii("data"),{code:70,name:"version",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class ql{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Hl(this,"parser",ye(Qu))}}function Yl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Hl(ql,"ForEntityName","REGION");let Ju={vertices:[],backLineVertices:[]},ed=[{code:360,name:"geometrySettingHardId",parser:y},{code:12,name:"backLineVertices",isMultiple:!0,parser:G},{code:93,name:"numberOfBackLineVertices",parser:y},{code:11,name:"vertices",isMultiple:!0,parser:G},{code:92,name:"verticesCount",parser:y},{code:[63,411],name:"indicatorColor",parser:y},{code:70,name:"indicatorTransparency",parser:y},{code:41,name:"bottomHeight",parser:y},{code:40,name:"topHeight",parser:y},{code:10,name:"verticalDirection",parser:G},{code:1,name:"name",parser:y},{code:91,name:"flag",parser:y},{code:90,name:"state",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class Xl{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Yl(this,"parser",ye(ed,Ju))}}function Kl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Yl(Xl,"ForEntityName","SECTION");let td={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},rd=[{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:y},{code:[...Js(10,14)],name:"points",isMultiple:!0,parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class $l{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Kl(this,"parser",ye(rd,td))}}function Zl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Kl($l,"ForEntityName","SOLID");let nd=[{code:350,name:"historyObjectSoftId",parser:y},{code:100,name:"subclassMarker",parser:y},...Ii("data"),{code:70,name:"version",parser:y},{code:100},...Ue];class Ql{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zl(this,"parser",ye(nd))}}Zl(Ql,"ForEntityName","3DSOLID");(Lt={})[Lt.NONE=0]="NONE",Lt[Lt.CLOSED=1]="CLOSED",Lt[Lt.PERIODIC=2]="PERIODIC",Lt[Lt.RATIONAL=4]="RATIONAL",Lt[Lt.PLANAR=8]="PLANAR",Lt[Lt.LINEAR=16]="LINEAR";function Jl(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let sd={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},id=[{code:11,name:"fitPoints",isMultiple:!0,parser:G},{code:10,name:"controlPoints",isMultiple:!0,parser:G},{code:41,name:"weights",isMultiple:!0,parser:y},{code:40,name:"knots",isMultiple:!0,parser:y},{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:44,name:"fitTolerance",parser:y},{code:43,name:"controlTolerance",parser:y},{code:42,name:"knotTolerance",parser:y},{code:74,name:"numberOfFitPoints",parser:y},{code:73,name:"numberOfControlPoints",parser:y},{code:72,name:"numberOfKnots",parser:y},{code:71,name:"degree",parser:y},{code:70,name:"flag",parser:y},{code:210,name:"normal",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue];class eh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jl(this,"parser",ye(id,sd))}}Jl(eh,"ForEntityName","SPLINE");class $s{parseEntity(e,t){let s={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:s.subclassMarker=t.value,t=e.next();break;case 2:s.name=t.value,t=e.next();break;case 5:s.handle=t.value,t=e.next();break;case 10:s.startPoint=Vr(ze(e)),t=e.lastReadGroup;break;case 11:s.directionVector=Vr(ze(e)),t=e.lastReadGroup;break;case 90:s.tableValue=t.value,t=e.next();break;case 91:s.rowCount=t.value,t=e.next();break;case 92:s.columnCount=t.value,t=e.next();break;case 93:s.overrideFlag=t.value,t=e.next();break;case 94:s.borderColorOverrideFlag=t.value,t=e.next();break;case 95:s.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:s.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(t.value),t=e.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(t.value),t=e.next();break;case 280:s.version=t.value,t=e.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=t.value,t=e.next();break;case 330:s.ownerDictionaryId=t.value,t=e.next();break;case 342:s.tableStyleId=t.value,t=e.next();break;case 343:s.blockRecordHandle=t.value,t=e.next();break;case 170:s.attachmentPoint=t.value,t=e.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(o,h){let u=!1,g=!1,b={};for(;!o.isEOF()&&h.code!==0&&!g;)switch(h.code){case 171:if(u){g=!0;continue}b.cellType=h.value,u=!0,h=o.next();break;case 172:b.flagValue=h.value,h=o.next();break;case 173:b.mergedValue=h.value,h=o.next();break;case 174:b.autoFit=h.value,h=o.next();break;case 175:b.borderWidth=h.value,h=o.next();break;case 176:b.borderHeight=h.value,h=o.next();break;case 91:b.overrideFlag=h.value,h=o.next();break;case 178:b.virtualEdgeFlag=h.value,h=o.next();break;case 145:b.rotation=h.value,h=o.next();break;case 345:b.fieldObjetId=h.value,h=o.next();break;case 340:b.blockTableRecordId=h.value,h=o.next();break;case 146:b.blockScale=h.value,h=o.next();break;case 177:b.blockAttrNum=h.value,h=o.next();break;case 7:b.textStyle=h.value,h=o.next();break;case 140:b.textHeight=h.value,h=o.next();break;case 170:b.attachmentPoint=h.value,h=o.next();break;case 92:b.extendedCellFlags=h.value,h=o.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=o.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=o.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=o.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=o.next();break;case 301:(function(f,S,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=S.next();break;case 1:f.text=x.value,x=S.next();break;case 300:f.attrText=x.value,x=S.next();break;case 302:f.text=x.value?x.value:f.text,x=S.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=S.next()}})(b,o,h),h=o.next();break;default:return b}return u=!1,g=!1,b}(e,t)),t=e.lastReadGroup;break;default:da(s,t,e),t=e.next()}}return s}}function th(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}Ki="ACAD_TABLE",(Xi="ForEntityName")in $s?Object.defineProperty($s,Xi,{value:Ki,enumerable:!0,configurable:!0,writable:!0}):$s[Xi]=Ki;let ad=[{code:11,name:"xAxisDirection",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:1,name:"text",parser:y},{code:10,name:"position",parser:G},{code:3,name:"styleName",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class rh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){th(this,"parser",ye(ad))}}th(rh,"ForEntityName","TOLERANCE");let Zs=class{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(o,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:o.layer=u.value;break;case 100:o.subclassMarker=u.value;break;case 10:o.viewportCenter=Vr(ze(h));break;case 40:o.width=u.value;break;case 41:o.height=u.value;break;case 68:o.status=u.value;break;case 69:o.viewportId=u.value;break;case 12:o.displayCenter=ze(h);break;case 13:o.snapBase=ze(h);break;case 14:o.snapSpacing=ze(h);break;case 15:o.gridSpacing=ze(h);break;case 16:o.viewDirection=Vr(ze(h));break;case 17:o.targetPoint=Vr(ze(h));break;case 42:o.perspectiveLensLength=u.value;break;case 43:o.frontClipZ=u.value;break;case 44:o.backClipZ=u.value;break;case 45:o.viewHeight=u.value;break;case 50:o.snapAngle=u.value;break;case 51:o.viewTwistAngle=u.value;break;case 72:o.circleZoomPercent=u.value;break;case 331:o.frozenLayerIds??(o.frozenLayerIds=[]),o.frozenLayerIds.push(u.value);break;case 90:o.statusBitFlags=u.value;break;case 340:o.clippingBoundaryId=u.value;break;case 1:o.sheetName=u.value;break;case 281:o.renderMode=u.value;break;case 71:o.ucsPerViewport=u.value;break;case 110:o.ucsOrigin=Vr(ze(h));break;case 111:o.ucsXAxis=Vr(ze(h));break;case 112:o.ucsYAxis=Vr(ze(h));break;case 345:o.ucsId=u.value;break;case 346:o.ucsBaseId=u.value;break;case 79:o.orthographicType=u.value;break;case 146:o.elevation=u.value;break;case 170:o.shadePlotMode=u.value;break;case 61:o.majorGridFrequency=u.value;break;case 332:o.backgroundId=u.value;break;case 333:o.shadePlotId=u.value;break;case 348:o.visualStyleId=u.value;break;case 292:o.isDefaultLighting=!!u.value;break;case 282:o.defaultLightingType=u.value;break;case 141:o.brightness=u.value;break;case 142:o.contrast=u.value;break;case 63:case 421:case 431:o.ambientLightColor=u.value;break;case 361:o.sunId=u.value;break;case 335:case 343:case 344:case 91:o.softPointer=u.value}return!0}(s,e,t)&&da(s,t,e),t=e.next()}return s}};Zi="VIEWPORT",($i="ForEntityName")in Zs?Object.defineProperty(Zs,$i,{value:Zi,enumerable:!0,configurable:!0,writable:!0}):Zs[$i]=Zi;(Ar={})[Ar.ShowImage=1]="ShowImage",Ar[Ar.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Ar[Ar.UseClippingBoundary=4]="UseClippingBoundary",Ar[Ar.Transparency=8]="Transparency";function nh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}let od={brightness:50,constrast:50,fade:0},ld=[{code:14,name:"boundary",isMultiple:!0,parser:G},{code:91,name:"numberOfVertices",parser:y},{code:71,name:"boundaryType",parser:y},{code:360,name:"imageDefReactorHardId",parser:y},{code:283,name:"fade",parser:y},{code:282,name:"contrast",parser:y},{code:281,name:"brightness",parser:y},{code:280,name:"isClipping",parser:Be},{code:70,name:"displayFlag",parser:y},{code:340,name:"imageDefHardId",parser:y},{code:13,name:"imageSize",parser:G},{code:12,name:"vDirection",parser:G},{code:11,name:"uDirection",parser:G},{code:10,name:"position",parser:G},{code:90,name:"classVersion",parser:y},{code:100,name:"subclassMarker",parser:y},...Ue];class sh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nh(this,"parser",ye(ld,od))}}function ih(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}nh(sh,"ForEntityName","WIPEOUT");let hd=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:y},...Ue],ah=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ih(this,"parser",ye(hd))}};function oh(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}ih(ah,"ForEntityName","XLINE");let cd={},ud=[{code:170,name:"multileaderType",parser:y},{code:291,name:"doglegEnabled",parser:Be},{code:40,name:"doglegLength",parser:y},{code:172,name:"contentType",parser:y},{code:3,name:"textContent",parser:y},{code:12,name:"textAnchor",parser:G},{code:344,name:"blockHandle",parser:y},{code:15,name:"blockPosition",parser:G},{code:302,name:"leaderSections",parser:function(i,e,t){let s,o={leaderLines:[]};for(;e.hasNext()&&(s=e.next()).code!==303;)switch(s.code){case 10:o.landingPoint=(s.value,ze(e));break;case 11:o.doglegVector=(s.value,ze(e));break;case 40:o.doglegLength=s.value;break;case 304:o.leaderLines.push(function(h,u,g){let b,f={vertices:[]};for(;u.hasNext()&&(b=u.next()).code!==305;)b.code===10&&f.vertices.push((b.value,ze(u)));return f}(0,e))}return o},isMultiple:!0},...Ue];class lh{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){oh(this,"parser",ye(ud,cd))}}oh(lh,"ForEntityName","MULTILEADER");let dd=Object.fromEntries([al,dl,fl,vl,bl,Xs,wl,Sl,Ml,Cl,Ll,zl,Ks,Rl,pl,lh,Fl,jl,Wl,ql,Xl,$l,Ql,eh,$s,cl,rh,El,ma,Zs,sh,ah].map(i=>[i.ForEntityName,new i]));function hh(i,e){let t=[];for(;!Ae(i,0,"EOF");){if(i.code===0){if(i.value==="ENDBLK"||i.value==="ENDSEC"){e.rewind();break}let s=dd[i.value];if(s){let o=i.value;i=e.next();let h=s.parseEntity(e,i);h.type=o,nl(h),t.push(h)}else e.debug&&console.warn(`Unsupported ENTITY type: ${i.value}`)}i=e.next()}return t}function md(i,e){let t={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");){if(Ae(i,0,"BLOCK")){let s=pd(i=e.next(),e);nl(s),s.name&&(t[s.name]=s)}i=e.next()}return t}function pd(i,e){let t={};for(;!Ae(i,0,"EOF");){if(Ae(i,0,"ENDBLK")){for(i=e.next();!Ae(i,0,"EOF");){if(Ae(i,100,"AcDbBlockEnd"))return t;i=e.next()}break}switch(i.code){case 1:t.xrefPath=i.value;break;case 2:t.name=i.value;break;case 3:t.name2=i.value;break;case 5:t.handle=i.value;break;case 8:t.layer=i.value;break;case 10:t.position=ze(e);break;case 67:t.paperSpace=!!i.value&&i.value==1;break;case 70:i.value!==0&&(t.type=i.value);break;case 100:break;case 330:t.ownerHandle=i.value;break;case 0:t.entities=hh(i,e)}i=e.next()}return t}function gd(i,e){let t=null,s={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");)i.code===9?t=i.value:i.code===10?s[t]=ze(e):s[t]=i.value,i=e.next();return s}(Ot={})[Ot.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ot[Ot.KEEP_EXISTING=1]="KEEP_EXISTING",Ot[Ot.USE_CLONE=2]="USE_CLONE",Ot[Ot.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ot[Ot.VALUE_NAME=4]="VALUE_NAME",Ot[Ot.UNMANGLE_NAME=5]="UNMANGLE_NAME";let pa=[{code:330,name:"ownerObjectId",parser:y},{code:102,parser:dn},{code:102,parser:dn},{code:102,parser:dn},{code:5,name:"handle",parser:y}],fd=[{code:3,name:"entries",parser:(i,e)=>{let t={name:i.value};return(i=e.next()).code===350?t.objectSoftId=i.value:i.code===360?t.objectHardId=i.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:y},{code:280,name:"isHardOwned",parser:Be},{code:100,name:"subclassMarker",parser:y},...pa],_d=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:y},{code:90,name:"version",parser:y},{code:1,name:"fileName",parser:y},{code:10,name:"size",parser:G},{code:11,name:"sizeOfOnePixel",parser:G},{code:280,name:"isLoaded",parser:y},{code:281,name:"resolutionUnits",parser:y},{code:100,name:"subclassMarker",parser:y}];(an={})[an.NOUNIT=0]="NOUNIT",an[an.CENTIMETERS=2]="CENTIMETERS",an[an.INCH=5]="INCH";(As={})[As.PSLTSCALE=1]="PSLTSCALE",As[As.LIMCHECK=2]="LIMCHECK";(on={})[on.INCHES=0]="INCHES",on[on.MILLIMETERS=1]="MILLIMETERS",on[on.PIXELS=2]="PIXELS";(zt={})[zt.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",zt[zt.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",zt[zt.DRAWING_LIMITS=2]="DRAWING_LIMITS",zt[zt.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",zt[zt.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",zt[zt.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Sr={})[Sr.AS_DISPLAYED=0]="AS_DISPLAYED",Sr[Sr.WIREFRAME=1]="WIREFRAME",Sr[Sr.HIDDEN=2]="HIDDEN",Sr[Sr.RENDERED=3]="RENDERED";(Dt={})[Dt.DRAFT=0]="DRAFT",Dt[Dt.PREVIEW=1]="PREVIEW",Dt[Dt.NORMAL=2]="NORMAL",Dt[Dt.PRESENTATION=3]="PRESENTATION",Dt[Dt.MAXIMUM=4]="MAXIMUM",Dt[Dt.CUSTOM=5]="CUSTOM";let ch=[{code:333,name:"shadePlotId",parser:y},{code:149,name:"imageOriginY",parser:y},{code:148,name:"imageOriginX",parser:y},{code:147,name:"scaleFactor",parser:y},{code:78,name:"shadePlotCustomDPI",parser:y},{code:77,name:"shadePlotResolution",parser:y},{code:76,name:"shadePlotMode",parser:y},{code:75,name:"standardScaleType",parser:y},{code:7,name:"currentStyleSheet",parser:y},{code:74,name:"plotType",parser:y},{code:73,name:"plotRotation",parser:y},{code:72,name:"plotPaperUnit",parser:y},{code:70,name:"layoutFlag",parser:y},{code:143,name:"printScaleDenominator",parser:y},{code:142,name:"printScaleNumerator",parser:y},{code:141,name:"windowAreaYMax",parser:y},{code:140,name:"windowAreaXMax",parser:y},{code:49,name:"windowAreaYMin",parser:y},{code:48,name:"windowAreaXMin",parser:y},{code:47,name:"plotOriginY",parser:y},{code:46,name:"plotOriginX",parser:y},{code:45,name:"paperHeight",parser:y},{code:44,name:"paperWidth",parser:y},{code:43,name:"marginTop",parser:y},{code:42,name:"marginRight",parser:y},{code:41,name:"marginBottom",parser:y},{code:40,name:"marginLeft",parser:y},{code:6,name:"plotViewName",parser:y},{code:4,name:"paperSize",parser:y},{code:2,name:"configName",parser:y},{code:1,name:"pageSetupName",parser:y},{code:100,name:"subclassMarker",parser:y},...pa],vd=[{code:346,name:"orthographicUcsId",parser:y},{code:345,name:"namedUcsId",parser:y},{code:331,name:"viewportId",parser:y},{code:330,name:"paperSpaceTableId",parser:y},{code:76,name:"orthographicType",parser:y},{code:17,name:"ucsYAxis",parser:G},{code:16,name:"ucsXAxis",parser:G},{code:13,name:"ucsOrigin",parser:G},{code:146,name:"elevation",parser:y},{code:15,name:"maxExtent",parser:G},{code:14,name:"minExtent",parser:G},{code:12,name:"insertionPoint",parser:G},{code:11,name:"maxLimit",parser:G},{code:10,name:"minLimit",parser:G},{code:71,name:"tabOrder",parser:y},{code:70,name:"controlFlag",parser:y},{code:1,name:"layoutName",parser:y},{code:100,name:"subclassMarker",parser:y},...ch],yd=[{code:40,name:"wcsToOCSTransform",parser:ko},{code:40,name:"ocsToWCSTransform",parser:ko},{code:41,name:"backClippingDistance",parser:y},{code:73,name:"isBackClipping",parser:Be,pushContext:!0},{code:40,name:"frontClippingDistance",parser:y},{code:72,name:"isFrontClipping",parser:Be,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Be},{code:11,name:"position",parser:G},{code:210,name:"normal",parser:G},{code:10,name:"boundaryVertices",parser:G,isMultiple:!0},{code:70,name:"boundaryCount",parser:y},{code:100,name:"subclassMarker",parser:y},{code:100},...pa];function ko(i,e){let t=[];for(let s=0;s<3&&Ae(i,40);++s){let o=[];for(let h=0;h<4&&Ae(i,40);++h)o.push(i.value),i=e.next();t.push(o)}return e.rewind(),t}let bd={LAYOUT:vd,PLOTSETTINGS:ch,DICTIONARY:fd,SPATIAL_FILTER:yd,IMAGEDEF:_d};function xd(i,e){let t=[];for(;i.code!==0||!["EOF","ENDSEC"].includes(i.value);){let s=i.value,o=bd[s];if(i.code===0&&(o!=null&&o.length)){let h=ye(o),u={name:s};h(i=e.next(),e,u)?(t.push(u),i=e.peek()):i=e.next()}else i=e.next()}return{byName:du(t,({name:s})=>s)}}let Fn=[{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102,parser(i,e){for(;!Ae(i,0,"EOF")&&!Ae(i,102,"}");)i=e.next()}},{code:5,name:"handle",parser:y}],wd=ye([{code:310,name:"bmpPreview",parser:y},{code:281,name:"scalability",parser:y},{code:280,name:"explodability",parser:y},{code:70,name:"insertionUnits",parser:y},{code:340,name:"layoutObjects",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Ad=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4},{name:"DIMBLK_OBSOLETE",code:5},{name:"DIMBLK1_OBSOLETE",code:6},{name:"DIMBLK2_OBSOLETE",code:7},{name:"DIMSCALE",code:40,defaultValue:1},{name:"DIMASZ",code:41,defaultValue:.25},{name:"DIMEXO",code:42,defaultValue:.625,defaultValueImperial:.0625},{name:"DIMDLI",code:43,defaultValue:3.75,defaultValueImperial:.38},{name:"DIMEXE",code:44,defaultValue:2.25,defaultValueImperial:.28},{name:"DIMRND",code:45,defaultValue:0},{name:"DIMDLE",code:46,defaultValue:0},{name:"DIMTP",code:47,defaultValue:0},{name:"DIMTM",code:48,defaultValue:0},{name:"DIMTXT",code:140,defaultValue:2.5,defaultValueImperial:.28},{name:"DIMCEN",code:141,defaultValue:2.5,defaultValueImperial:.09},{name:"DIMTSZ",code:142,defaultValue:0},{name:"DIMALTF",code:143,defaultValue:25.4},{name:"DIMLFAC",code:144,defaultValue:1},{name:"DIMTVP",code:145,defaultValue:0},{name:"DIMTFAC",code:146,defaultValue:1},{name:"DIMGAP",code:147,defaultValue:.625,defaultValueImperial:.09},{name:"DIMALTRND",code:148,defaultValue:0},{name:"DIMTOL",code:71,defaultValue:0,defaultValueImperial:1},{name:"DIMLIM",code:72,defaultValue:0},{name:"DIMTIH",code:73,defaultValue:0,defaultValueImperial:1},{name:"DIMTOH",code:74,defaultValue:0,defaultValueImperial:1},{name:"DIMSE1",code:75,defaultValue:0},{name:"DIMSE2",code:76,defaultValue:0},{name:"DIMTAD",code:77,defaultValue:Io.Above,defaultValueImperial:Io.Center},{name:"DIMZIN",code:78,defaultValue:Nn.Trailing,defaultValueImperial:Nn.Feet},{name:"DIMAZIN",code:79,defaultValue:Qc.None},{name:"DIMALT",code:170,defaultValue:0},{name:"DIMALTD",code:171,defaultValue:3,defaultValueImperial:2},{name:"DIMTOFL",code:172,defaultValue:1,defaultValueImperial:0},{name:"DIMSAH",code:173,defaultValue:0},{name:"DIMTIX",code:174,defaultValue:0},{name:"DIMSOXD",code:175,defaultValue:0},{name:"DIMCLRD",code:176,defaultValue:0},{name:"DIMCLRE",code:177,defaultValue:0},{name:"DIMCLRT",code:178,defaultValue:0},{name:"DIMADEC",code:179},{name:"DIMUNIT",code:270},{name:"DIMDEC",code:271,defaultValue:2,defaultValueImperial:4},{name:"DIMTDEC",code:272,defaultValue:2,defaultValueImperial:4},{name:"DIMALTU",code:273,defaultValue:2},{name:"DIMALTTD",code:274,defaultValue:2,defaultValueImperial:4},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:",",defaultValueImperial:"."},{name:"DIMJUST",code:280,defaultValue:Jc.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:eu.Center},{name:"DIMTZIN",code:284,defaultValue:Nn.Trailing,defaultValueImperial:Nn.Feet},{name:"DIMALTZ",code:285,defaultValue:Nn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Nn.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMTXSTY",code:340},{name:"DIMLDRBLK",code:341},{name:"DIMBLK",code:342},{name:"DIMBLK1",code:343},{name:"DIMBLK2",code:344},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWD",code:372,defaultValue:-2}],Sd=ye([...Ad.map(i=>({...i,parser:y})),{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},{code:105,name:"handle",parser:y},...Fn.filter(i=>i.code!==5)]),Pd=ye([{code:347,name:"materialObjectId",parser:y},{code:390,name:"plotStyleNameObjectId",parser:y},{code:370,name:"lineweight",parser:y},{code:290,name:"isPlotting",parser:Be},{code:6,name:"lineType",parser:y},{code:62,name:"colorIndex",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]);(Pr={})[Pr.NONE=0]="NONE",Pr[Pr.AbsoluteRotation=1]="AbsoluteRotation",Pr[Pr.TextEmbedded=2]="TextEmbedded",Pr[Pr.ShapeEmbedded=4]="ShapeEmbedded";let Id=ye([{code:9,name:"text",parser:y},{code:45,name:"offsetY",parser:y},{code:44,name:"offsetX",parser:y},{code:50,name:"rotation",parser:y},{code:46,name:"scale",parser:y},{code:340,name:"styleObjectId",parser:y},{code:75,name:"shapeNumber",parser:y},{code:74,name:"elementTypeFlag",parser:y},{code:49,name:"elementLength",parser:y}],{elementTypeFlag:0,elementLength:0}),Ed=ye([{code:49,name:"pattern",parser(i,e){let t={};return Id(i,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:y},{code:73,name:"numberOfLineTypes",parser:y},{code:72,parser:y},{code:3,name:"description",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),kd=ye([{code:1e3,name:"extendedFont",parser:y},{code:1001},{code:4,name:"bigFont",parser:y},{code:3,name:"font",parser:y},{code:42,name:"lastHeight",parser:y},{code:71,name:"textGenerationFlag",parser:y},{code:50,name:"obliqueAngle",parser:y},{code:41,name:"widthFactor",parser:y},{code:40,name:"fixedTextHeight",parser:y},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Md=ye([{code:[63,421,431],name:"ambientColor",parser:y},{code:142,name:"contrast",parser:y},{code:141,name:"brightness",parser:y},{code:282,name:"defaultLightingType",parser:y},{code:292,name:"isDefaultLightingOn",parser:Be},{code:348,name:"visualStyleObjectId",parser:y},{code:333,name:"shadePlotObjectId",parser:y},{code:332,name:"backgroundObjectId",parser:y},{code:61,name:"majorGridLines",parser:y},{code:170,name:"shadePlotSetting",parser:y},{code:146,name:"elevation",parser:y},{code:79,name:"orthographicType",parser:y},{code:112,name:"ucsYAxis",parser:G},{code:111,name:"ucsXAxis",parser:G},{code:110,name:"ucsOrigin",parser:G},{code:74,name:"ucsIconSetting",parser:y},{code:71,name:"viewMode",parser:y},{code:281,name:"renderMode",parser:y},{code:1,name:"styleSheet",parser:y},{code:[331,441],name:"frozenLayers",parser:y,isMultiple:!0},{code:72,name:"circleSides",parser:y},{code:51,name:"viewTwistAngle",parser:y},{code:50,name:"snapRotationAngle",parser:y},{code:45,name:"viewHeight",parser:y},{code:44,name:"backClippingPlane",parser:y},{code:43,name:"frontClippingPlane",parser:y},{code:42,name:"lensLength",parser:y},{code:17,name:"viewTarget",parser:G},{code:16,name:"viewDirectionFromTarget",parser:G},{code:15,name:"gridSpacing",parser:G},{code:14,name:"snapSpacing",parser:G},{code:13,name:"snapBasePoint",parser:G},{code:12,name:"center",parser:G},{code:11,name:"upperRightCorner",parser:G},{code:10,name:"lowerLeftCorner",parser:G},{code:70,name:"standardFlag",parser:y},{code:2,name:"name",parser:y},{code:100,name:"subclassMarker",parser:y},...Fn]),Td={BLOCK_RECORD:wd,DIMSTYLE:Sd,LAYER:Pd,LTYPE:Ed,STYLE:kd,VPORT:Md},Cd=ye([{code:70,name:"maxNumberOfEntries",parser:y},{code:100,name:"subclassMarker",parser:y},{code:330,name:"ownerObjectId",parser:y},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:y},{code:2,name:"name",parser:y}]);function Nd(i,e){var s;let t={};for(;!Ae(i,0,"EOF")&&!Ae(i,0,"ENDSEC");){if(Ae(i,0,"TABLE")){i=e.next();let o={entries:[]};Cd(i,e,o),t[o.name]=o}if(Ae(i,0)&&!Ae(i,0,"ENDTAB")){let o=i.value;i=e.next();let h=Td[o];if(!h){e.debug&&console.warn(`parseTable: Invalid table name '${o}'`),i=e.next();continue}let u={};h(i,e,u),(s=t[o])==null||s.entries.push(u)}i=e.next()}return t}function Ss(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class Mo{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=To(e,this._data[this._pointer++],this.debug),s={code:e,value:t};return Ae(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=To(e.code,this._data[this._pointer+1],this.debug),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e,t=!1){Ss(this,"_data",void 0),Ss(this,"debug",void 0),Ss(this,"_pointer",void 0),Ss(this,"_eof",void 0),Ss(this,"lastReadGroup",void 0),this._data=e,this.debug=t,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function To(i,e,t=!1){return i<=9?e:i>=10&&i<=59?parseFloat(e.trim()):i>=60&&i<=99?parseInt(e.trim()):i>=100&&i<=109?e:i>=110&&i<=149?parseFloat(e.trim()):i>=160&&i<=179?parseInt(e.trim()):i>=210&&i<=239?parseFloat(e.trim()):i>=270&&i<=289?parseInt(e.trim()):i>=290&&i<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(e.trim()):i>=300&&i<=369?e:i>=370&&i<=389?parseInt(e.trim()):i>=390&&i<=399?e:i>=400&&i<=409?parseInt(e.trim()):i>=410&&i<=419?e:i>=420&&i<=429?parseInt(e.trim()):i>=430&&i<=439?e:i>=440&&i<=459?parseInt(e.trim()):i>=460&&i<=469?parseFloat(e.trim()):i>=470&&i<=481||i===999||i>=1e3&&i<=1009?e:i>=1010&&i<=1059?parseFloat(e.trim()):i>=1060&&i<=1071?parseInt(e.trim()):(t&&console.warn("WARNING: Group code does not have a defined type: %j",{code:i,value:e}),e)}function sa(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}class Ld{constructor(){sa(this,"encoding","utf-8"),sa(this,"encodingFailureFatal",!1)}}class Od extends EventTarget{parseSync(e,t=!1){let s=new Mo(e.split(/\r\n|\r|\n/g),t);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(e){let t="",s=this;return new Promise((o,h)=>{e.on("data",u=>{t+=u}),e.on("end",()=>{try{let u=t.split(/\r\n|\r|\n/g),g=new Mo(u);if(!g.hasNext())throw Error("Empty file");o(s.parseAll(g))}catch(u){h(u)}}),e.on("error",u=>{h(u)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let o=s.body.getReader(),h="";for(;;){let{done:u,value:g}=await o.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(g,{stream:!0})}return this.parseSync(h)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!Ae(s,0,"EOF");)Ae(s,0,"SECTION")&&(Ae(s=e.next(),2,"HEADER")?(s=e.next(),t.header=gd(s,e)):Ae(s,2,"BLOCKS")?(s=e.next(),t.blocks=md(s,e)):Ae(s,2,"ENTITIES")?(s=e.next(),t.entities=hh(s,e)):Ae(s,2,"TABLES")?(s=e.next(),t.tables=Nd(s,e)):Ae(s,2,"OBJECTS")&&(s=e.next(),t.objects=xd(s,e))),s=e.next();return t}constructor(e=new Ld){super(),sa(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var ga=(i=>(i[i.DecimalDegrees=0]="DecimalDegrees",i[i.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",i[i.Gradians=2]="Gradians",i[i.Radians=3]="Radians",i[i.SurveyorsUnits=4]="SurveyorsUnits",i))(ga||{});class Gr{static get instance(){return this._instance||(this._instance=new Gr),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,s,o=!0,h,u){const g=[];if(t!=null){const b=this.createKey(t.name,s);let f;if(this.has(b))f=this.get(b);else{const S=t.newIterator();for(const x of S)x.color.isByBlock&&s?(Co.copy(x.color),x.color.color=s,this.addEntity(x,g,e),x.color.copy(Co)):this.addEntity(x,g,e);f=e.group(g),f&&o&&this.set(b,f)}return f&&h&&(f.applyMatrix(h),u&&(u.x!=0||u.y!=0||u.z!=1)&&(h.setFromExtrusionDirection(u),f.applyMatrix(h))),f}else return e.group(g)}addEntity(e,t,s){const o=e.draw(s);o&&(this.attachEntityInfo(o,e),t.push(o))}attachEntityInfo(e,t){e.objectId=t.objectId,e.ownerId=t.ownerId,e.layerName=t.layer,e.visible=t.visibility}}const Co=new fn,ei="Continuous",Qs="ByLayer",uh="ByBlock";var cn=(i=>(i[i.EndPoint=1]="EndPoint",i[i.MidPoint=2]="MidPoint",i[i.Center=3]="Center",i[i.Node=4]="Node",i[i.Quadrant=5]="Quadrant",i[i.Insertion=7]="Insertion",i[i.Perpendicular=8]="Perpendicular",i[i.Tangent=9]="Tangent",i[i.Nearest=10]="Nearest",i[i.Centroid=11]="Centroid",i))(cn||{}),fa=(i=>(i[i.Undefined=0]="Undefined",i[i.Inches=1]="Inches",i[i.Feet=2]="Feet",i[i.Miles=3]="Miles",i[i.Millimeters=4]="Millimeters",i[i.Centimeters=5]="Centimeters",i[i.Meters=6]="Meters",i[i.Kilometers=7]="Kilometers",i[i.Microinches=8]="Microinches",i[i.Mils=9]="Mils",i[i.Yards=10]="Yards",i[i.Angstroms=11]="Angstroms",i[i.Nanometers=12]="Nanometers",i[i.Microns=13]="Microns",i[i.Decimeters=14]="Decimeters",i[i.Dekameters=15]="Dekameters",i[i.Hectometers=16]="Hectometers",i[i.Gigameters=17]="Gigameters",i[i.Astronomical=18]="Astronomical",i[i.LightYears=19]="LightYears",i[i.Parsecs=20]="Parsecs",i[i.USSurveyFeet=21]="USSurveyFeet",i[i.USSurveyInch=22]="USSurveyInch",i[i.USSurveyYard=23]="USSurveyYard",i[i.USSurveyMile=24]="USSurveyMile",i[i.Max=24]="Max",i))(fa||{});function zd(i){return i==4||i==5||i==6||i==7||i==12||i==13||i==14||i==15||i==16||i==17}function Dd(i){return i==1||i==2||i==3||i==8||i==9||i==10||i==21}var dh=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(dh||{});class Ei{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}const mh="Load Database";class Pt extends Zo{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=ca.getInstance().getEntry(mh),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const o=await this.data.task(e);if(this.progress){const h=o.data;await this.progress(this.data.progress.value,this.data.stage,"END",h),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return t&&(t.data[this.name]=Date.now()-s),o}}class ph{constructor(e={}){this.config=e}async read(e,t,s,o){const h={name:mh,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(S=>{S!=="total"&&(f+=`- ${S}: ${this.data[S]} ms
|
|
2
|
+
`)}),f+=`- total: ${this.data.total} ms`,f}};ca.getInstance().collect(h),this.progress=o;const u={value:0},g=new Qo;g.setCompleteCallback(()=>this.onFinished()),g.setErrorCallback(f=>this.onError(f)),g.addTask(new Pt({stage:"START",step:1,progress:u,task:async f=>f},o)),g.addTask(new Pt({stage:"PARSE",step:5,progress:u,task:async f=>await this.parse(f)},o)),g.addTask(new Pt({stage:"FONT",step:5,progress:u,task:async f=>{const S=this.getFonts(f.model);return{model:f.model,data:S}}},o)),g.addTask(new Pt({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,t),f)},o)),g.addTask(new Pt({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,t),f)},o)),g.addTask(new Pt({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,t),f)},o)),g.addTask(new Pt({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,t),f)},o)),g.addTask(new Pt({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,t),f)},o)),g.addTask(new Pt({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,t),f)},o)),g.addTask(new Pt({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,t),f)},o)),g.addTask(new Pt({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,t),f)},o)),g.addTask(new Pt({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,t),f)},o)),g.addTask(new Pt({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,t,s,u,o),f)},o)),g.addTask(new Pt({stage:"END",step:0,progress:u,task:async f=>f},o));const b=Date.now();await g.run(e),h.data.total=Date.now()-b}onError(e){if(this.progress){const t=e.task;this.progress(t.data.progress.value,t.data.stage,"ERROR",void 0,e)}console.error(`Error occurred in conversion stage '${e.task.name}': `,e.error),e.task.name!="ENTITY"&&this.onFinished()}onFinished(){this.progress&&(this.progress(100,"END","END"),Gr.instance.clear())}async parse(e,t){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,s,o,h){throw new Error("Not impelemented yet!")}}const ft=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let No=1234567;const _a=Math.PI/180,va=180/Math.PI;function gh(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return(ft[i&255]+ft[i>>8&255]+ft[i>>16&255]+ft[i>>24&255]+"-"+ft[e&255]+ft[e>>8&255]+"-"+ft[e>>16&15|64]+ft[e>>24&255]+"-"+ft[t&63|128]+ft[t>>8&255]+"-"+ft[t>>16&255]+ft[t>>24&255]+ft[s&255]+ft[s>>8&255]+ft[s>>16&255]+ft[s>>24&255]).toLowerCase()}function kr(i,e,t){return Math.max(e,Math.min(t,i))}function ya(i,e){return(i%e+e)%e}function fh(i,e,t,s,o){return s+(i-e)*(o-s)/(t-e)}function _h(i,e,t){return i!==e?(t-i)/(e-i):0}function ba(i,e,t){return(1-t)*i+t*e}function vh(i,e,t,s){return ba(i,e,1-Math.exp(-t*s))}function yh(i,e=1){return e-Math.abs(ya(i,e*2)-e)}function bh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function xh(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function wh(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Ah(i,e){return i+Math.random()*(e-i)}function Sh(i){return i*(.5-Math.random())}function Ph(i){i!==void 0&&(No=i);let e=No+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ih(i){return i*_a}function Eh(i){return i*va}function kh(i){return(i&i-1)===0&&i!==0}function Mh(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Th(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function ks(i){const e=Math.PI*2;return(i%e+e)%e}function Ch(i,e,t){return i>e&&i<t||i>t&&i<e}function Nh(i,e,t,s=!1){return i=ks(i),e=ks(e),t=ks(t),s?e>t?i<=e&&i>=t:i<=e||i>=t:e<t?i>=e&&i<=t:i>=e||i<=t}function xa(i){return i=Math.abs(i),i<1?0:Math.ceil(Math.log10(Math.abs(i)+1))}function Lh(i,e=1e-7){const t=xa(i);return Math.max(Math.pow(10,t)*e,e)}const Ee={DEG2RAD:_a,RAD2DEG:va,generateUUID:gh,clamp:kr,euclideanModulo:ya,mapLinear:fh,inverseLerp:_h,lerp:ba,damp:vh,pingpong:yh,smoothstep:bh,smootherstep:xh,randInt:wh,randFloat:Ah,randFloatSpread:Sh,seededRandom:Ph,degToRad:Ih,radToDeg:Eh,isPowerOfTwo:kh,ceilPowerOfTwo:Mh,floorPowerOfTwo:Th,normalizeAngle:ks,isBetween:Ch,isBetweenAngle:Nh,intPartLength:xa,relativeEps:Lh},ia=class Oh{constructor(e,t){this.x=0,this.y=0;const s=+(e!==void 0)+ +(t!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(s===1){const{x:o,y:h}=e;this.x=o,this.y=h;return}if(s===2){this.x=e,this.y=t;return}throw Ut.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new Oh(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,s=this.y,o=e.elements;return this.x=o[0]*t+o[3]*s+o[6],this.y=o[1]*t+o[4]*s+o[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const s=Math.cos(t),o=Math.sin(t),h=this.x-e.x,u=this.y-e.y;return this.x=h*s-u*o+e.x,this.y=h*o+u*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(Ee.relativeEps(this.x,e),Ee.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};ia.EMPTY=Object.freeze(new ia(0,0));let $e=ia;const aa=class zh{constructor(e,t,s,o,h,u,g,b,f){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&this.set(e,t,s,o,h,u,g,b,f)}set(e,t,s,o,h,u,g,b,f){const S=this.elements;return S[0]=e,S[1]=o,S[2]=g,S[3]=t,S[4]=h,S[5]=b,S[6]=s,S[7]=u,S[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,o=t.elements,h=this.elements,u=s[0],g=s[3],b=s[6],f=s[1],S=s[4],x=s[7],E=s[2],M=s[5],z=s[8],D=o[0],U=o[3],B=o[6],ge=o[1],be=o[4],oe=o[7],W=o[2],ce=o[5],se=o[8];return h[0]=u*D+g*ge+b*W,h[3]=u*U+g*be+b*ce,h[6]=u*B+g*oe+b*se,h[1]=f*D+S*ge+x*W,h[4]=f*U+S*be+x*ce,h[7]=f*B+S*oe+x*se,h[2]=E*D+M*ge+z*W,h[5]=E*U+M*be+z*ce,h[8]=E*B+M*oe+z*se,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],S=e[8];return t*u*S-t*g*f-s*h*S+s*g*b+o*h*f-o*u*b}invert(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],S=e[8],x=S*u-g*f,E=g*b-S*h,M=f*h-u*b,z=t*x+s*E+o*M;if(z===0)return this.set(0,0,0,0,0,0,0,0,0);const D=1/z;return e[0]=x*D,e[1]=(o*f-S*s)*D,e[2]=(g*s-o*u)*D,e[3]=E*D,e[4]=(S*t-o*b)*D,e[5]=(o*h-g*t)*D,e[6]=M*D,e[7]=(s*b-f*t)*D,e[8]=(u*t-s*h)*D,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,s,o,h,u,g){const b=Math.cos(h),f=Math.sin(h);return this.set(s*b,s*f,-s*(b*u+f*g)+u+e,-o*f,o*b,-o*(-f*u+b*g)+g+t,0,0,1),this}scale(e,t){return this.premultiply(Ji.makeScale(e,t)),this}rotate(e){return this.premultiply(Ji.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ji.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof $e?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let o=0;o<9;o++)if(t[o]!==s[o])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new zh().fromArray(this.elements)}};aa.IDENTITY=Object.freeze(new aa);let ki=aa;const Ji=new ki,hn=1e-6,nt=2*Math.PI,Rd={x:0,y:0},wa={x:0,y:0,z:0};class Aa{constructor(){this.equalPointTol=hn,this.equalVectorTol=hn}equalPoint2d(e,t){return new $e(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new Z(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=hn){return e<t&&e>-t}static equal(e,t,s=hn){return Math.abs(e-t)<s}static great(e,t,s=hn){return e-t>s}static less(e,t,s=hn){return e-t<s}}const Sa=new Aa;function Pa(i,e,t=!1){const s=i.x,o=i.y;let h=!1;const u=e.length;for(let g=0,b=u-1;g<u;b=g++){const f=e[g].x,S=e[g].y,x=e[b].x,E=e[b].y;let M=S>o!=E>o;t&&(M=S>=o!=E>=o),M&&s<(x-f)*(o-S)/(E-S)+f&&(h=!h)}return h}function Dh(i,e){if(i.length===0||e.length===0)return!1;const t=new _t().setFromPoints(i),s=new _t().setFromPoints(e);if(!t.intersectsBox(s))return!1;for(let o=0;o<i.length;){if(Pa(i[o],e,!0))return!0;o<i.length-1&&Sa.equalPoint2d(i[o+1],i[o])&&++o,++o}return!1}const Rh={isPointInPolygon:Pa,isPolygonIntersect:Dh};function Bh(i,e){const t=[],s=e-1,o=i;for(let h=0;h<=o;h++)t.push(0);for(let h=1;h<=s-o;h++)t.push(h);for(let h=0;h<=o;h++)t.push(s-o+1);return t}function Fh(i,e){const t=e.length-1,s=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],S=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+S*S);h+=x,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=t-s;g++){const b=o[g]/h;u.push(b*(t-s+1))}for(let g=0;g<=s;g++)u.push(t-s+1);return u}function Uh(i,e){const t=e.length-1,s=i,o=[0];let h=0;for(let g=1;g<=t;g++){const b=e[g][0]-e[g-1][0],f=e[g][1]-e[g-1][1],S=e[g][2]-e[g-1][2],x=Math.sqrt(b*b+f*f+S*S),E=Math.sqrt(x);h+=E,o.push(h)}const u=[];for(let g=0;g<=s;g++)u.push(0);for(let g=1;g<=t-s;g++){const b=o[g]/h;u.push(b*(t-s+1))}for(let g=0;g<=s;g++)u.push(t-s+1);return u}function ti(i,e,t,s){if(e===0)return t>=s[i]&&t<s[i+1]?1:0;const o=s[i+e]-s[i],h=s[i+e+1]-s[i+1],u=o>1e-10?(t-s[i])/o:0,g=h>1e-10?(s[i+e+1]-t)/h:0;return u*ti(i,e-1,t,s)+g*ti(i+1,e-1,t,s)}function Ms(i,e,t,s,o){const h=s.length-1,u=e;if(i=Math.max(t[u],Math.min(t[h+1],i)),Math.abs(i-t[h+1])<1e-8)return[...s[h]];if(Math.abs(i-t[u])<1e-8)return[...s[0]];const g=[0,0,0];let b=0;for(let f=0;f<=h;f++){const S=ti(f,u,i,t),x=o[f]*S;g[0]+=s[f][0]*x,g[1]+=s[f][1]*x,g[2]+=s[f][2]*x,b+=x}if(b<1e-10){const f=t[t.length-u-1];if(Math.abs(i-f)<1e-8)return[...s[h]];if(Math.abs(i-t[u])<1e-8)return[...s[0]]}return b>1e-10&&(g[0]/=b,g[1]/=b,g[2]/=b),g}function Vh(i,e,t,s){const o=i,h=e[o],u=e[e.length-o-1];let g=0;const b=1e3,f=(u-h)/b;let S=Ms(h,i,e,t,s);for(let D=1;D<=b;D++){const U=h+D*f,B=Ms(U,i,e,t,s),ge=B[0]-S[0],be=B[1]-S[1],oe=B[2]-S[2];g+=Math.sqrt(ge*ge+be*be+oe*oe),S=B}const x=Ms(u,i,e,t,s),E=x[0]-S[0],M=x[1]-S[1],z=x[2]-S[2];return g+=Math.sqrt(E*E+M*M+z*z),g}function Bd(i){return i.map(e=>[...e])}class Wr{constructor(e=0,t=0,s=0,o=1){this._x=e,this._y=t,this._z=s,this._w=o}static slerpFlat(e,t,s,o,h,u,g){let b=s[o+0],f=s[o+1],S=s[o+2],x=s[o+3];const E=h[u+0],M=h[u+1],z=h[u+2],D=h[u+3];if(g===0){e[t+0]=b,e[t+1]=f,e[t+2]=S,e[t+3]=x;return}if(g===1){e[t+0]=E,e[t+1]=M,e[t+2]=z,e[t+3]=D;return}if(x!==D||b!==E||f!==M||S!==z){let U=1-g;const B=b*E+f*M+S*z+x*D,ge=B>=0?1:-1,be=1-B*B;if(be>Number.EPSILON){const W=Math.sqrt(be),ce=Math.atan2(W,B*ge);U=Math.sin(U*ce)/W,g=Math.sin(g*ce)/W}const oe=g*ge;if(b=b*U+E*oe,f=f*U+M*oe,S=S*U+z*oe,x=x*U+D*oe,U===1-g){const W=1/Math.sqrt(b*b+f*f+S*S+x*x);b*=W,f*=W,S*=W,x*=W}}e[t]=b,e[t+1]=f,e[t+2]=S,e[t+3]=x}static multiplyQuaternionsFlat(e,t,s,o,h,u){const g=s[o],b=s[o+1],f=s[o+2],S=s[o+3],x=h[u],E=h[u+1],M=h[u+2],z=h[u+3];return e[t]=g*z+S*x+b*M-f*E,e[t+1]=b*z+S*E+f*x-g*M,e[t+2]=f*z+S*M+g*E-b*x,e[t+3]=S*z-g*x-b*E-f*M,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,s,o){return this._x=e,this._y=t,this._z=s,this._w=o,this._onChangeCallback(),this}clone(){return new Wr(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const s=e.x,o=e.y,h=e.z,u=e.order,g=Math.cos,b=Math.sin,f=g(s/2),S=g(o/2),x=g(h/2),E=b(s/2),M=b(o/2),z=b(h/2);switch(u){case"XYZ":this._x=E*S*x+f*M*z,this._y=f*M*x-E*S*z,this._z=f*S*z+E*M*x,this._w=f*S*x-E*M*z;break;case"YXZ":this._x=E*S*x+f*M*z,this._y=f*M*x-E*S*z,this._z=f*S*z-E*M*x,this._w=f*S*x+E*M*z;break;case"ZXY":this._x=E*S*x-f*M*z,this._y=f*M*x+E*S*z,this._z=f*S*z+E*M*x,this._w=f*S*x-E*M*z;break;case"ZYX":this._x=E*S*x-f*M*z,this._y=f*M*x+E*S*z,this._z=f*S*z-E*M*x,this._w=f*S*x+E*M*z;break;case"YZX":this._x=E*S*x+f*M*z,this._y=f*M*x+E*S*z,this._z=f*S*z-E*M*x,this._w=f*S*x-E*M*z;break;case"XZY":this._x=E*S*x-f*M*z,this._y=f*M*x-E*S*z,this._z=f*S*z+E*M*x,this._w=f*S*x+E*M*z;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,o=Math.sin(s);return this._x=e.x*o,this._y=e.y*o,this._z=e.z*o,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],o=t[4],h=t[8],u=t[1],g=t[5],b=t[9],f=t[2],S=t[6],x=t[10],E=s+g+x;if(E>0){const M=.5/Math.sqrt(E+1);this._w=.25/M,this._x=(S-b)*M,this._y=(h-f)*M,this._z=(u-o)*M}else if(s>g&&s>x){const M=2*Math.sqrt(1+s-g-x);this._w=(S-b)/M,this._x=.25*M,this._y=(o+u)/M,this._z=(h+f)/M}else if(g>x){const M=2*Math.sqrt(1+g-s-x);this._w=(h-f)/M,this._x=(o+u)/M,this._y=.25*M,this._z=(b+S)/M}else{const M=2*Math.sqrt(1+x-s-g);this._w=(u-o)/M,this._x=(h+f)/M,this._y=(b+S)/M,this._z=.25*M}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<Number.EPSILON?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(kr(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const o=Math.min(1,t/s);return this.slerp(e,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const s=e._x,o=e._y,h=e._z,u=e._w,g=t._x,b=t._y,f=t._z,S=t._w;return this._x=s*S+u*g+o*f-h*b,this._y=o*S+u*b+h*g-s*f,this._z=h*S+u*f+s*b-o*g,this._w=u*S-s*g-o*b-h*f,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,o=this._y,h=this._z,u=this._w;let g=u*e._w+s*e._x+o*e._y+h*e._z;if(g<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,g=-g):this.copy(e),g>=1)return this._w=u,this._x=s,this._y=o,this._z=h,this;const b=1-g*g;if(b<=Number.EPSILON){const M=1-t;return this._w=M*u+t*this._w,this._x=M*s+t*this._x,this._y=M*o+t*this._y,this._z=M*h+t*this._z,this.normalize(),this}const f=Math.sqrt(b),S=Math.atan2(f,g),x=Math.sin((1-t)*S)/f,E=Math.sin(t*S)/f;return this._w=u*x+this._w*E,this._x=s*x+this._x*E,this._y=o*x+this._y*E,this._z=h*x+this._z*E,this._onChangeCallback(),this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),o=Math.sqrt(1-s),h=Math.sqrt(s);return this.set(o*Math.sin(e),o*Math.cos(e),h*Math.sin(t),h*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Bt=class jh{constructor(e,t,s){this.x=0,this.y=0,this.z=0;const o=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(o!==0){if(o===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(o===1){const{x:h,y:u,z:g}=e;this.x=h,this.y=u,this.z=g||0;return}if(o===3){this.x=e,this.y=t,this.z=s;return}throw Ut.ILLEGAL_PARAMETERS}}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new jh(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Lo.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Lo.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[3]*s+h[6]*o,this.y=h[1]*t+h[4]*s+h[7]*o,this.z=h[2]*t+h[5]*s+h[8]*o,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix3d(e){const t=this.x,s=this.y,o=this.z,h=e.elements,u=1/(h[3]*t+h[7]*s+h[11]*o+h[15]);return this.x=(h[0]*t+h[4]*s+h[8]*o+h[12])*u,this.y=(h[1]*t+h[5]*s+h[9]*o+h[13])*u,this.z=(h[2]*t+h[6]*s+h[10]*o+h[14])*u,this}applyQuaternion(e){const t=this.x,s=this.y,o=this.z,h=e.x,u=e.y,g=e.z,b=e.w,f=2*(u*o-g*s),S=2*(g*t-h*o),x=2*(h*s-u*t);return this.x=t+b*f+u*x-g*S,this.y=s+b*S+g*f-h*x,this.z=o+b*x+h*S-u*f,this}transformDirection(e){const t=this.x,s=this.y,o=this.z,h=e.elements;return this.x=h[0]*t+h[4]*s+h[8]*o,this.y=h[1]*t+h[5]*s+h[9]*o,this.z=h[2]*t+h[6]*s+h[10]*o,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),s=this.length(),o=e.length();return Math.abs(t)===s*o}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,o=e.y,h=e.z,u=t.x,g=t.y,b=t.z;return this.x=o*b-h*g,this.y=h*u-s*b,this.z=s*g-o*u,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return ea.copy(this).projectOnVector(e),this.sub(ea)}reflect(e){return this.sub(ea.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,o=this.z-e.z;return t*t+s*s+o*o}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),o=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=o,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Bt.X_AXIS=Object.freeze(new Bt(1,0,0)),Bt.NEGATIVE_X_AXIS=Object.freeze(new Bt(-1,0,0)),Bt.Y_AXIS=Object.freeze(new Bt(0,1,0)),Bt.NEGATIVE_Y_AXIS=Object.freeze(new Bt(0,-1,0)),Bt.Z_AXIS=Object.freeze(new Bt(0,0,1)),Bt.NEGATIVE_Z_AXIS=Object.freeze(new Bt(0,0,-1));let Z=Bt;const ea=new Z,Lo=new Wr,oa=class Gh{constructor(e,t,s,o,h,u,g,b,f,S,x,E,M,z,D,U){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&s!=null&&o!=null&&h!=null&&u!=null&&g!=null&&b!=null&&f!=null&&S!=null&&x!=null&&E!=null&&M!=null&&z!=null&&D!=null&&U!=null&&this.set(e,t,s,o,h,u,g,b,f,S,x,E,M,z,D,U)}set(e,t,s,o,h,u,g,b,f,S,x,E,M,z,D,U){const B=this.elements;return B[0]=e,B[4]=t,B[8]=s,B[12]=o,B[1]=h,B[5]=u,B[9]=g,B[13]=b,B[2]=f,B[6]=S,B[10]=x,B[14]=E,B[3]=M,B[7]=z,B[11]=D,B[15]=U,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Gh().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(Sa.equalPoint3d(e,Z.Z_AXIS))this.identity();else{const t=new Z(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(Z.Y_AXIS,e).normalize():t.crossVectors(Z.Z_AXIS,e).normalize();const s=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,s.x,s.y,s.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,s){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,s=e.elements,o=1/Ln.setFromMatrixColumn(e,0).length(),h=1/Ln.setFromMatrixColumn(e,1).length(),u=1/Ln.setFromMatrixColumn(e,2).length();return t[0]=s[0]*o,t[1]=s[1]*o,t[2]=s[2]*o,t[3]=0,t[4]=s[4]*h,t[5]=s[5]*h,t[6]=s[6]*h,t[7]=0,t[8]=s[8]*u,t[9]=s[9]*u,t[10]=s[10]*u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Fd,e,Ud)}lookAt(e,t,s){const o=this.elements;return Rt.subVectors(e,t),Rt.lengthSq()===0&&(Rt.z=1),Rt.normalize(),Ur.crossVectors(s,Rt),Ur.lengthSq()===0&&(Math.abs(s.z)===1?Rt.x+=1e-4:Rt.z+=1e-4,Rt.normalize(),Ur.crossVectors(s,Rt)),Ur.normalize(),js.crossVectors(Rt,Ur),o[0]=Ur.x,o[4]=js.x,o[8]=Rt.x,o[1]=Ur.y,o[5]=js.y,o[9]=Rt.y,o[2]=Ur.z,o[6]=js.z,o[10]=Rt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,o=t.elements,h=this.elements,u=s[0],g=s[4],b=s[8],f=s[12],S=s[1],x=s[5],E=s[9],M=s[13],z=s[2],D=s[6],U=s[10],B=s[14],ge=s[3],be=s[7],oe=s[11],W=s[15],ce=o[0],se=o[4],Ve=o[8],Ye=o[12],We=o[1],xe=o[5],Le=o[9],dt=o[13],mt=o[2],It=o[6],Je=o[10],at=o[14],Q=o[3],Te=o[7],ot=o[11],hr=o[15];return h[0]=u*ce+g*We+b*mt+f*Q,h[4]=u*se+g*xe+b*It+f*Te,h[8]=u*Ve+g*Le+b*Je+f*ot,h[12]=u*Ye+g*dt+b*at+f*hr,h[1]=S*ce+x*We+E*mt+M*Q,h[5]=S*se+x*xe+E*It+M*Te,h[9]=S*Ve+x*Le+E*Je+M*ot,h[13]=S*Ye+x*dt+E*at+M*hr,h[2]=z*ce+D*We+U*mt+B*Q,h[6]=z*se+D*xe+U*It+B*Te,h[10]=z*Ve+D*Le+U*Je+B*ot,h[14]=z*Ye+D*dt+U*at+B*hr,h[3]=ge*ce+be*We+oe*mt+W*Q,h[7]=ge*se+be*xe+oe*It+W*Te,h[11]=ge*Ve+be*Le+oe*Je+W*ot,h[15]=ge*Ye+be*dt+oe*at+W*hr,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[4],o=e[8],h=e[12],u=e[1],g=e[5],b=e[9],f=e[13],S=e[2],x=e[6],E=e[10],M=e[14],z=e[3],D=e[7],U=e[11],B=e[15];return z*(+h*b*x-o*f*x-h*g*E+s*f*E+o*g*M-s*b*M)+D*(+t*b*M-t*f*E+h*u*E-o*u*M+o*f*S-h*b*S)+U*(+t*f*x-t*g*M-h*u*x+s*u*M+h*g*S-s*f*S)+B*(-o*g*S-t*b*x+t*g*E+o*u*x-s*u*E+s*b*S)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const o=this.elements;return e instanceof Z?(o[12]=e.x,o[13]=e.y,o[14]=e.z):(o[12]=e,o[13]=t,o[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],o=e[2],h=e[3],u=e[4],g=e[5],b=e[6],f=e[7],S=e[8],x=e[9],E=e[10],M=e[11],z=e[12],D=e[13],U=e[14],B=e[15],ge=x*U*f-D*E*f+D*b*M-g*U*M-x*b*B+g*E*B,be=z*E*f-S*U*f-z*b*M+u*U*M+S*b*B-u*E*B,oe=S*D*f-z*x*f+z*g*M-u*D*M-S*g*B+u*x*B,W=z*x*b-S*D*b-z*g*E+u*D*E+S*g*U-u*x*U,ce=t*ge+s*be+o*oe+h*W;if(ce===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const se=1/ce;return e[0]=ge*se,e[1]=(D*E*h-x*U*h-D*o*M+s*U*M+x*o*B-s*E*B)*se,e[2]=(g*U*h-D*b*h+D*o*f-s*U*f-g*o*B+s*b*B)*se,e[3]=(x*b*h-g*E*h-x*o*f+s*E*f+g*o*M-s*b*M)*se,e[4]=be*se,e[5]=(S*U*h-z*E*h+z*o*M-t*U*M-S*o*B+t*E*B)*se,e[6]=(z*b*h-u*U*h-z*o*f+t*U*f+u*o*B-t*b*B)*se,e[7]=(u*E*h-S*b*h+S*o*f-t*E*f-u*o*M+t*b*M)*se,e[8]=oe*se,e[9]=(z*x*h-S*D*h-z*s*M+t*D*M+S*s*B-t*x*B)*se,e[10]=(u*D*h-z*g*h+z*s*f-t*D*f-u*s*B+t*g*B)*se,e[11]=(S*g*h-u*x*h-S*s*f+t*x*f+u*s*M-t*g*M)*se,e[12]=W*se,e[13]=(S*D*o-z*x*o+z*s*E-t*D*E-S*s*U+t*x*U)*se,e[14]=(z*g*o-u*D*o-z*s*b+t*D*b+u*s*U-t*g*U)*se,e[15]=(u*x*o-S*g*o+S*s*b-t*x*b-u*s*E+t*g*E)*se,this}scale(e){const t=this.elements,s=e.x,o=e.y,h=e.z;return t[0]*=s,t[4]*=o,t[8]*=h,t[1]*=s,t[5]*=o,t[9]*=h,t[2]*=s,t[6]*=o,t[10]*=h,t[3]*=s,t[7]*=o,t[11]*=h,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],o=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,o))}makeTranslation(e,t,s){return e instanceof Z?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),o=Math.sin(t),h=1-s,u=e.x,g=e.y,b=e.z,f=h*u,S=h*g;return this.set(f*u+s,f*g-o*b,f*b+o*g,0,f*g+o*b,S*g+s,S*b-o*u,0,f*b-o*g,S*b+o*u,h*b*b+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,o,h,u){return this.set(1,s,h,0,e,1,u,0,t,o,1,0,0,0,0,1),this}compose(e,t,s){const o=this.elements,h=t.x,u=t.y,g=t.z,b=t.w,f=h+h,S=u+u,x=g+g,E=h*f,M=h*S,z=h*x,D=u*S,U=u*x,B=g*x,ge=b*f,be=b*S,oe=b*x,W=s.x,ce=s.y,se=s.z;return o[0]=(1-(D+B))*W,o[1]=(M+oe)*W,o[2]=(z-be)*W,o[3]=0,o[4]=(M-oe)*ce,o[5]=(1-(E+B))*ce,o[6]=(U+ge)*ce,o[7]=0,o[8]=(z+be)*se,o[9]=(U-ge)*se,o[10]=(1-(E+D))*se,o[11]=0,o[12]=e.x,o[13]=e.y,o[14]=e.z,o[15]=1,this}decompose(e,t,s){const o=this.elements;let h=Ln.set(o[0],o[1],o[2]).length();const u=Ln.set(o[4],o[5],o[6]).length(),g=Ln.set(o[8],o[9],o[10]).length();this.determinant()<0&&(h=-h),e.x=o[12],e.y=o[13],e.z=o[14],rr.copy(this);const b=1/h,f=1/u,S=1/g;return rr.elements[0]*=b,rr.elements[1]*=b,rr.elements[2]*=b,rr.elements[4]*=f,rr.elements[5]*=f,rr.elements[6]*=f,rr.elements[8]*=S,rr.elements[9]*=S,rr.elements[10]*=S,t.setFromRotationMatrix(rr),s.x=h,s.y=u,s.z=g,this}equals(e){const t=this.elements,s=e.elements;for(let o=0;o<16;o++)if(t[o]!==s[o])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};oa.IDENTITY=Object.freeze(new oa);let gn=oa;const Ln=new Z,rr=new gn,Fd=new Z(0,0,0),Ud=new Z(1,1,1),Ur=new Z,js=new Z,Rt=new Z;class Re{constructor(e=void 0,t=void 0){this.min=e==null?new Z(1/0,1/0,1/0):new Z(e.x,e.y,e.z),this.max=t==null?new Z(-1/0,-1/0,-1/0):new Z(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(ta.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=ta.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new Re().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new Z(0,0,0):new Z(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ta).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Er[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(e),Er[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(e),Er[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(e),Er[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(e),Er[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(e),Er[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(e),Er[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(e),Er[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(e),this.setFromPoints(Er),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Er=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],ta=new Z,Oo=new $e;class _t{constructor(e=void 0,t=void 0){this.min=e==null?new $e(1/0,1/0):new $e(e.x,e.y),this.max=t==null?new $e(-1/0,-1/0):new $e(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Oo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new _t().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new $e(0,0):new $e(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new $e(0,0):new $e(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Oo).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const zo=new Z,Vd=new Z,jd=new ki;class zs{constructor(e=new Z(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,o){return this.normal.set(e,t,s),this.constant=o,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const o=zo.subVectors(s,t).cross(Vd.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(o,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const s=t||jd.getNormalMatrix(e),o=this.coplanarPoint(zo).applyMatrix3d(e),h=this.normal.applyMatrix3(s).normalize();return this.constant=-o.dot(h),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new zs().copy(this)}}class Me extends $e{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((s,o)=>{s.toArray(t,o*2)}),t}}class $ extends Z{static pointArrayToNumberArray(e,t=!0){const s=t?3:2,o=new Array(e.length*s);return e.forEach((h,u)=>{h.toArray(o,u*s)}),o}}const Do=new gn,Ro=new Wr,Wh=class la{constructor(e=0,t=0,s=0,o=la.DEFAULT_ORDER){this._x=e,this._y=t,this._z=s,this._order=o}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,s,o=this._order){return this._x=e,this._y=t,this._z=s,this._order=o,this._onChangeCallback(),this}clone(){return new la(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,s=!0){const o=e.elements,h=o[0],u=o[4],g=o[8],b=o[1],f=o[5],S=o[9],x=o[2],E=o[6],M=o[10];switch(t){case"XYZ":this._y=Math.asin(kr(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-S,M),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(E,f),this._z=0);break;case"YXZ":this._x=Math.asin(-kr(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(g,M),this._z=Math.atan2(b,f)):(this._y=Math.atan2(-x,h),this._z=0);break;case"ZXY":this._x=Math.asin(kr(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(b,h));break;case"ZYX":this._y=Math.asin(-kr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(E,M),this._z=Math.atan2(b,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(kr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(-S,f),this._y=Math.atan2(-x,h)):(this._x=0,this._y=Math.atan2(g,M));break;case"XZY":this._z=Math.asin(-kr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(E,f),this._y=Math.atan2(g,h)):(this._x=Math.atan2(-S,M),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s=!0){return Do.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Do,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ro.setFromEuler(this),this.setFromQuaternion(Ro,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Wh.DEFAULT_ORDER="XYZ";let Hh=Wh;class qh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Ia extends qh{translate(e){return this.transform(new ki().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Mi extends Ia{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new _t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let s=0;s<this.loops.length;++s){const o=this.loops[s].getPoints(e);t.push(o)}return t}buildHierarchy(){var e;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),o=this.sortBoundaryBoxesByAreas(s),h=new Map,u=o.length;for(let b=0;b<u;b++)h.set(o[b],{index:o[b],children:[]});const g={index:-1,children:[]};for(let b=0;b<u;b++){const f=o[b],S=t[f],x=s[f];let E=b+1;for(;E<u;E++){const M=o[E],z=t[M];if(s[M].containsBox(x)&&Rh.isPointInPolygon(S[Ee.randInt(0,S.length-1)],z)){(e=h.get(M))==null||e.children.push(h.get(f));break}}E===u&&g.children.push(h.get(f))}return g}calculateBoundaryBoxes(e){const t=[];return e.forEach(s=>{t.push(new _t().setFromPoints(s))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((o,h)=>{const u=o.size,g=u.width*u.height;t.push({area:g,index:h})}),t.sort((o,h)=>o.area-h.area);const s=[];return t.forEach(o=>{s.push(o.index)}),s}}class Un extends Ia{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}getSpacedPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPointAt(s/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let s,o=this.getPoint(0),h=0;t.push(0);for(let u=1;u<=e;u++)s=this.getPoint(u/e),h+=s.distanceTo(o),t.push(h),o=s;return t}getUtoTmapping(e,t){const s=this.getLengths();let o=0;const h=s.length;let u;t?u=t:u=e*s[h-1];let g=0,b=h-1,f;for(;g<=b;)if(o=Math.floor(g+(b-g)/2),f=s[o]-u,f<0)g=o+1;else if(f>0)b=o-1;else{b=o;break}if(o=b,s[o]===u)return o/(h-1);const S=s[o],x=s[o+1]-S,E=(u-S)/x;return(o+E)/(h-1)}getTangent(e){let t=e-1e-4,s=e+1e-4;t<0&&(t=0),s>1&&(s=1);const o=this.getPoint(t),h=this.getPoint(s),u=new Me;return u.copy(h).sub(o).normalize(),u}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class Dn extends Un{constructor(e,t,s,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u==3)typeof e=="object"&&typeof t=="object"&&typeof s=="object"?this.createByThreePoints(e,t,s):this.createByStartEndPointsAndBulge(e,t,s);else if(u==5){const g=e;this.center=new Me(g.x,g.y),this.radius=t,this._clockwise=h,this._startAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(s)):Ee.normalizeAngle(s),this._endAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(o)):Ee.normalizeAngle(o)}else throw Ut.ILLEGAL_PARAMETERS}createByThreePoints(e,t,s){const o=(se,Ve)=>({x:(se.x+Ve.x)/2,y:(se.y+Ve.y)/2}),h=(se,Ve)=>(Ve.y-se.y)/(Ve.x-se.x),u=se=>-1/se,g=o(e,t),b=o(t,s),f=h(e,t),S=h(t,s),x=u(f),E=u(S),M=(se,Ve,Ye,We)=>{const xe=(We-Ve)/(se-Ye),Le=se*xe+Ve;return{x:xe,y:Le}},z=g.y-x*g.x,D=b.y-E*b.x,U=M(x,z,E,D),B=Math.sqrt(Math.pow(e.x-U.x,2)+Math.pow(e.y-U.y,2)),ge=(se,Ve)=>Math.atan2(se.y-Ve.y,se.x-Ve.x),be=ge(e,U),oe=ge(t,U),W=ge(s,U),ce=W>be&&W<oe||be>W&&be<oe||oe>W&&oe<be;this.center=U,this.radius=B,this._clockwise=!ce,this._startAngle=be,this._endAngle=W}createByStartEndPointsAndBulge(e,t,s){let o,h,u;s<0?(o=Math.atan(-s)*4,h=new $e(e),u=new $e(t)):(o=Math.atan(s)*4,h=new $e(t),u=new $e(e));const g=new $e().subVectors(u,h),b=g.length(),f=new $e().addVectors(h,g.multiplyScalar(.5)),S=Math.abs(b/2/Math.tan(o/2)),x=g.normalize();let E;if(o<Math.PI){const M=new $e(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(-S))}else{const M=new $e(x.x*Math.cos(Math.PI/2)-x.y*Math.sin(Math.PI/2),x.y*Math.cos(Math.PI/2)+x.x*Math.sin(Math.PI/2));E=f.add(M.multiplyScalar(S))}s<0?(this._startAngle=Math.atan2(h.y-E.y,h.x-E.x),this._endAngle=Math.atan2(u.y-E.y,u.x-E.x)):(this._startAngle=Math.atan2(u.y-E.y,u.x-E.x),this._endAngle=Math.atan2(h.y-E.y,h.x-E.x)),this._clockwise=s<0,this.center=E,this.radius=u.sub(E).length()}get center(){return this._center}set center(e){this._center=new Me(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(e){this._startAngle=this._clockwise?this._mirrorAngle(Ee.normalizeAngle(e)):Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(e){const t=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e);this._endAngle=this._clockwise?this._mirrorAngle(t):t,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(e){return(360-e*180/Math.PI)%360*Math.PI/180}_getInternalAngle(e){return this._clockwise?this._mirrorAngle(e):e}get deltaAngle(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return this.clockwise?Ee.normalizeAngle(e-t):Ee.normalizeAngle(t-e)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle),s=Ee.normalizeAngle((e+t)/2),o=this._clockwise?this._mirrorAngle(s):s;return this.getPointAtAngle(o)}get closed(){const e=this._getInternalAngle(this.startAngle),t=this._getInternalAngle(this.endAngle);return Math.abs(t-e)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of t){const u=this._getInternalAngle(h);Ee.isBetweenAngle(u,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&e.push(this.getPointAtAngle(h))}const s=e.map(h=>h.x),o=e.map(h=>h.y);return new _t(new Me(Math.min(...s),Math.min(...o)),new Me(Math.max(...s),Math.max(...o)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new Dn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(e){const t=this._getInternalAngle(e),s=this.center.x+this.radius*Math.cos(t),o=this.center.y+this.radius*Math.sin(t);return new Me(s,o)}getPoints(e=100){const t=[];let s=this.deltaAngle,o=this._getInternalAngle(this.startAngle);if(this.closed&&(s=nt,o=0),this.clockwise)for(let h=0;h<=e;h++){const u=o-s*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Me(b.x,b.y))}else for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this._clockwise?this._mirrorAngle(u):u,b=this.getPointAtAngle(g);t.push(new Me(b.x,b.y))}return t}}class Gd extends qh{translate(e){return this.transform(new gn().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Ds extends Gd{}class Hr extends Ds{constructor(e,t){super(),this._start=new $(e),this._end=new $(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new Z().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new $((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const s=this.delta(ln).normalize();return new $(this._start).addScaledVector(s,e)}else{const s=this.delta(ln).normalize();return new $(this._end).addScaledVector(s,e)}}extend(e,t=!1){if(t){const s=ln.subVectors(this._start,this._end).normalize();this._start=new $(this._start).addScaledVector(s,e)}else{const s=this.delta(ln).normalize();this._end=new $(this._end).addScaledVector(s,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){Bo.subVectors(e,this._start),Gs.subVectors(this.endPoint,this.startPoint);const s=Gs.dot(Gs);let o=Gs.dot(Bo)/s;return t&&(o=Ee.clamp(o,0,1)),o}closestPointToPoint(e,t,s){const o=this.closestPointToPointParameter(e,t);return this.delta(s).multiplyScalar(o).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,s=ln.subVectors(e,this.startPoint).dot(t);return new $().copy(t).multiplyScalar(s).add(this.startPoint)}perpPoint(e){const t=this.direction,s=this.startPoint,o=ln.subVectors(e,s).dot(t),h=ln.copy(t).multiplyScalar(o);return new $().addVectors(s,h)}calculateBoundingBox(){const e=new $(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),t=new $(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new Re(e,t)}transform(e){return this._start.applyMatrix3d(e),this._end.applyMatrix3d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Hr(this._start.clone(),this._end.clone())}}const ln=new Z,Bo=new Z,Gs=new Z;class mn extends Ds{static computeCenterPoint(e,t,s){const o=new Z().addVectors(e,t).multiplyScalar(.5),h=new Z().addVectors(e,s).multiplyScalar(.5),u=new Z().subVectors(t,e),g=new Z().subVectors(s,e),b=new Z().crossVectors(u,g).normalize();if(b.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new Z().crossVectors(u,b).normalize(),S=new Z().crossVectors(g,b).normalize(),x=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=S.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),M=new Hr(o,o.clone().add(x)),z=new Hr(h,h.clone().add(E)),D=new Z;return M.closestPointToPoint(z.startPoint,!0,D)?D:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,s){const o=mn.computeCenterPoint(e,t,s);if(o){const h=o.distanceTo(e),u=new Z().subVectors(e,o),g=new Z().subVectors(t,o),b=Math.atan2(u.y,u.x),f=Math.atan2(g.y,g.x);return new mn(o,h,b,f,Z.Z_AXIS)}}constructor(e,t,s,o,h,u=Z.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=s,this.endAngle=o,this.normal=h,this.refVec=u,(o-s)%nt==0?(this.startAngle=0,this.endAngle=nt):(this.startAngle=s,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Ee.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new Z(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Ee.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Re({x:t,y:s,z:o},{x:h,y:u,z:g})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=nt,o=0);for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}transform(e){const t=ra.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=ra.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(e),t.applyMatrix3d(e),s.applyMatrix3d(e),this.normal.applyMatrix3d(e).normalize(),this.refVec.applyMatrix3d(e).normalize(),this.startAngle=this.getAngle(t),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new mn(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(ra.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,s=this.refVec,o={x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x},h=this.center,u=this.radius;return new $(h.x+u*(s.x*Math.cos(e)+o.x*Math.sin(e)),h.y+u*(s.y*Math.cos(e)+o.y*Math.sin(e)),h.z+u*(s.z*Math.cos(e)+o.z*Math.sin(e)))}get plane(){const e=new Z(this.center).distanceTo(wa);return new zs(this.normal,e)}}const ra=new Z;class Ti extends Un{constructor(e,t,s,o=0,h=nt,u=!1,g=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=s,(h-o)%nt==0?(this.startAngle=0,this.endAngle=nt):(this.startAngle=o,this.endAngle=h),this.clockwise=u,this.rotation=g}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return Ee.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,s=-1/0,o=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);e=Math.min(e,u.x),t=Math.min(t,u.y),s=Math.max(s,u.x),o=Math.max(o,u.y)}return new _t({x:e,y:t},{x:s,y:o})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let s=this.endAngle-this.startAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=t;for(;s>t;)s-=t;s<Number.EPSILON&&(o?s=0:s=t),this.clockwise===!0&&!o&&(s===t?s=-t:s=s-t);const h=this.startAngle+e*s;let u=this.center.x+this.majorAxisRadius*Math.cos(h),g=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const b=Math.cos(this.rotation),f=Math.sin(this.rotation),S=u-this.center.x,x=g-this.center.y;u=S*b-x*f+this.center.x,g=S*f+x*b+this.center.y}return new Me(u,g)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new Ti(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Ci extends Ds{constructor(e,t,s,o,h,u=0,g=nt){super(),this.center=e,this.normal=t,this.majorAxis=s,this.majorAxisRadius=o,this.minorAxisRadius=h;const b=Math.abs(g-u);Math.abs(b-nt)<1e-10||Math.abs(b-2*nt)<1e-10?(this.startAngle=0,this.endAngle=nt):(this.startAngle=u,this.endAngle=g)}get center(){return this._center}set center(e){this._center=new $(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw Ut.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==nt?e:Ee.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-nt)<1e-10?nt:Ee.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new Z(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new Z(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new Z().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get isCircular(){return Aa.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const e=1e3,t=this.deltaAngle/e;let s=0,o=this.getPointAtAngle(this.startAngle);for(let h=1;h<=e;h++){const u=this.startAngle+h*t,g=this.getPointAtAngle(u),b=g.x-o.x,f=g.y-o.y,S=g.z-o.z;s+=Math.sqrt(b*b+f*f+S*S),o=g}return s}calculateBoundingBox(){if(this.majorAxis.equals(Z.X_AXIS)||this.majorAxis.equals(Z.Y_AXIS)||this.majorAxis.isParallelTo(Z.X_AXIS)||this.majorAxis.isParallelTo(Z.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let b=0;b<2*Math.PI;b+=Math.PI/2)Ee.isBetweenAngle(b,this.startAngle,this.endAngle)&&e.push(b);let t=1/0,s=1/0,o=1/0,h=-1/0,u=-1/0,g=-1/0;for(const b of e){const f=this.getPointAtAngle(b);f.x<t&&(t=f.x),f.y<s&&(s=f.y),f.z<o&&(o=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>g&&(g=f.z)}return new Re({x:t,y:s,z:o},{x:h,y:u,z:g})}else{let e=1/0,t=1/0,s=1/0,o=-1/0,h=-1/0,u=-1/0;for(let g=0;g<=100;g++){const b=this.startAngle+this.deltaAngle*(g/100),f=this.getPointAtAngle(b);e=Math.min(e,f.x),t=Math.min(t,f.y),s=Math.min(s,f.z),o=Math.max(o,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Re({x:e,y:t,z:s},{x:o,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let s=this.deltaAngle,o=this.startAngle;this.closed&&(s=nt,o=0);for(let h=0;h<=e;h++){const u=o+s*(h/e),g=this.getPointAtAngle(u);t.push(g)}return t}getPointAtAngle(e){const t=Math.cos(e),s=Math.sin(e),o=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),h=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(o);return new $(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(e){const t=new Z(e).sub(this.center),s=t.dot(this.majorAxis),o=t.dot(this.minorAxis),h=s/this.majorAxisRadius,u=o/this.minorAxisRadius;return h*h+u*u<=1}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ci(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new Z(this.center).distanceTo(wa);return new zs(this.normal,e)}}class Rs extends Un{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new Me(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new Me(t.x,t.y)}else{const t=this._vertices[e-1];return new Me(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let s=0;s<t;++s){const o=this._vertices[s];let h=null;if(s<t-1?h=this._vertices[s+1]:s==t-1&&this.closed&&(h=this._vertices[0]),h)if(o.bulge){const u=new Dn(o,h,o.bulge);e+=u.length}else e+=new Me(o.x,o.y).distanceTo(h)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}getPointAt(e){const t=this._vertices[e];return new Me(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new _t().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const s=[];return this.getPoints(e).forEach(o=>s.push(new $().set(o.x,o.y,t))),s}getPoints(e){const t=[],s=this._vertices.length;for(let o=0;o<s;++o){const h=this._vertices[o];if(h.bulge){let u=null;if(o<s-1?u=this._vertices[o+1]:o==s-1&&this.closed&&(u=this._vertices[0]),u){const g=new Dn(h,u,h.bulge).getPoints(e),b=g.length;for(let f=0;f<b;++f){const S=g[f];t.push(new Me(S.x,S.y))}}}else t.push(new Me(h.x,h.y)),o==s-1&&this.closed&&t.push(t[0])}return t}}class Ni extends Un{constructor(e,t){super(),this._start=new Me(e),this._end=new Me(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new Me(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new Me(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new _t(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ni(this._start.clone(),this._end.clone())}}class Yh extends Un{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new Me(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new _t;return t.setFromPoints(e),t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(s=>{s.getPoints(e).forEach(o=>{t.push(new Me(o.x,o.y))})}),t}}function Wd(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Xh={exports:{}};(function(i,e){(function(t){i.exports=t()})(function(){var t={},s=this;new Function("try {return this===window;}catch(e){ return false;}");var o=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(o()&&h(),o()||h()){var u=s;if(h()){var g=function(b,f){var S=s;return b.split(".").forEach(function(x){S&&(S=S[x])}),S?S[f]:null};onmessage=function(b){if(!(!b.data.className||!b.data.methodName)){var f=g(b.data.className,b.data.methodName);if(!f)return console.error("could not find "+b.data.className+"."+b.data.methodName);postMessage({result:f.apply(null,b.data.args),id:b.data.id})}}}}return function(b,f,S){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var x={},E=function(){return Te.__string_rec(this,"")};function M(r,n){function a(){}a.prototype=r;var l=new a;for(var c in n)l[c]=n[c];return n.toString!==Object.prototype.toString&&(l.toString=n.toString),l}var z=function(){};x.HxOverrides=z,z.__name__=["HxOverrides"],z.strDate=function(r){var n=r.length;switch(n){case 8:var a=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(a[0]),l.setUTCMinutes(a[1]),l.setUTCSeconds(a[2]),l;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),p=d[0].split("-"),_=d[1].split(":");return new Date(p[0],p[1]-1,p[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},z.cca=function(r,n){var a=r.charCodeAt(n);if(a==a)return a},z.substr=function(r,n,a){return n!=null&&n!=0&&a!=null&&a<0?"":(a==null&&(a=r.length),n<0?(n=r.length+n,n<0&&(n=0)):a<0&&(a=r.length+a-n),r.substr(n,a))},z.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var D=function(){};x.Lambda=D,D.__name__=["Lambda"],D.fold=function(r,n,a){for(var l=Xt(r)();l.hasNext();){var c=l.next();a=n(c,a)}return a};var U=function(){this.length=0};x.List=U,U.__name__=["List"],U.prototype={add:function(r){var n=[r];this.h==null?this.h=n:this.q[1]=n,this.q=n,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:U},Math.__name__=["Math"];var B=function(){};x.Reflect=B,B.__name__=["Reflect"],B.field=function(r,n){try{return r[n]}catch(a){return a instanceof Q&&(a=a.val),null}},B.callMethod=function(r,n,a){return n.apply(r,a)},B.fields=function(r){var n=[];if(r!=null){var a=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&a.call(r,l)&&n.push(l)}return n},B.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},B.deleteField=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)?(delete r[n],!0):!1};var ge=function(){};x.Std=ge,ge.__name__=["Std"],ge.string=function(r){return Te.__string_rec(r,"")},ge.parseFloat=function(r){return parseFloat(r)};var be=function(){this.b=""};x.StringBuf=be,be.__name__=["StringBuf"],be.prototype={add:function(r){this.b+=ge.string(r)},__class__:be};var oe=function(){};x.StringTools=oe,oe.__name__=["StringTools"],oe.fastCodeAt=function(r,n){return r.charCodeAt(n)};var W=x.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};W.TNull=["TNull",0],W.TNull.toString=E,W.TNull.__enum__=W,W.TInt=["TInt",1],W.TInt.toString=E,W.TInt.__enum__=W,W.TFloat=["TFloat",2],W.TFloat.toString=E,W.TFloat.__enum__=W,W.TBool=["TBool",3],W.TBool.toString=E,W.TBool.__enum__=W,W.TObject=["TObject",4],W.TObject.toString=E,W.TObject.__enum__=W,W.TFunction=["TFunction",5],W.TFunction.toString=E,W.TFunction.__enum__=W,W.TClass=function(r){var n=["TClass",6,r];return n.__enum__=W,n.toString=E,n},W.TEnum=function(r){var n=["TEnum",7,r];return n.__enum__=W,n.toString=E,n},W.TUnknown=["TUnknown",8],W.TUnknown.toString=E,W.TUnknown.__enum__=W;var ce=function(){};x.Type=ce,ce.__name__=["Type"],ce.getClassName=function(r){var n=r.__name__;return n==null?null:n.join(".")},ce.getEnumName=function(r){var n=r.__ename__;return n.join(".")},ce.resolveClass=function(r){var n=x[r];return n==null||!n.__name__?null:n},ce.resolveEnum=function(r){var n=x[r];return n==null||!n.__ename__?null:n},ce.createEmptyInstance=function(r){function n(){}return n.prototype=r.prototype,new n},ce.createEnum=function(r,n,a){var l=B.field(r,n);if(l==null)throw new Q("No such constructor "+n);if(B.isFunction(l)){if(a==null)throw new Q("Constructor "+n+" need parameters");return B.callMethod(r,l,a)}if(a!=null&&a.length!=0)throw new Q("Constructor "+n+" does not need parameters");return l},ce.getEnumConstructs=function(r){var n=r.__constructs__;return n.slice()},ce.typeof=function(r){var n=typeof r;switch(n){case"boolean":return W.TBool;case"string":return W.TClass(String);case"number":return Math.ceil(r)==r%2147483648?W.TInt:W.TFloat;case"object":if(r==null)return W.TNull;var a=r.__enum__;if(a!=null)return W.TEnum(a);var l=Te.getClass(r);return l!=null?W.TClass(l):W.TObject;case"function":return r.__name__||r.__ename__?W.TObject:W.TFunction;case"undefined":return W.TNull;default:return W.TUnknown}};var se=function(){};x["haxe.IMap"]=se,se.__name__=["haxe","IMap"];var Ve=function(r,n){this.high=r,this.low=n};x["haxe._Int64.___Int64"]=Ve,Ve.__name__=["haxe","_Int64","___Int64"],Ve.prototype={__class__:Ve};var Ye=function(){this.buf=new be,this.cache=[],this.useCache=Ye.USE_CACHE,this.useEnumIndex=Ye.USE_ENUM_INDEX,this.shash=new mt,this.scount=0};x["haxe.Serializer"]=Ye,Ye.__name__=["haxe","Serializer"],Ye.prototype={toString:function(){return this.buf.b},serializeString:function(r){var n=this.shash.get(r);if(n!=null){this.buf.b+="R",n==null?this.buf.b+="null":this.buf.b+=""+n;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var n=typeof r,a=0,l=this.cache.length;a<l;){var c=a++,d=this.cache[c];if(typeof d==n&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var n=0,a=B.fields(r);n<a.length;){var l=a[n];++n,this.serializeString(l),this.serialize(B.field(r,l))}this.buf.b+="g"},serialize:function(r){{var n=ce.typeof(r);switch(n[1]){case 0:this.buf.b+="n";break;case 1:var a=r;if(a==0){this.buf.b+="z";return}this.buf.b+="i",a==null?this.buf.b+="null":this.buf.b+=""+a;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=n[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var p=r.length,_=0;_<p;){var v=_++;r[v]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[v]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case U:this.buf.b+="l";for(var w=r,P=w.h,A=null;P!=null;){var I;A=P[0],P=P[1],I=A,this.serialize(I)}this.buf.b+="h";break;case Date:var k=r;this.buf.b+="v",this.buf.add(k.getTime());break;case mt:this.buf.b+="b";for(var T=r,L=T.keys();L.hasNext();){var N=L.next();this.serializeString(N),this.serialize(Ri[N]!=null?T.getReserved(N):T.h[N])}this.buf.b+="h";break;case xe:this.buf.b+="q";for(var R=r,O=R.keys();O.hasNext();){var F=O.next();this.buf.b+=":",F==null?this.buf.b+="null":this.buf.b+=""+F,this.serialize(R.h[F])}this.buf.b+="h";break;case Le:this.buf.b+="M";for(var V=r,q=V.keys();q.hasNext();){var J=q.next(),H=B.field(J,"__id__");B.deleteField(J,"__id__"),this.serialize(J),J.__id__=H,this.serialize(V.h[J.__id__])}this.buf.b+="h";break;case It:for(var j=r,X=0,ee=j.length-2,te=new be,ie=Ye.BASE64;X<ee;){var he=j.get(X++),ae=j.get(X++),ue=j.get(X++);te.add(ie.charAt(he>>2)),te.add(ie.charAt((he<<4|ae>>4)&63)),te.add(ie.charAt((ae<<2|ue>>6)&63)),te.add(ie.charAt(ue&63))}if(X==ee){var ne=j.get(X++),de=j.get(X++);te.add(ie.charAt(ne>>2)),te.add(ie.charAt((ne<<4|de>>4)&63)),te.add(ie.charAt(de<<2&63))}else if(X==ee+1){var Y=j.get(X++);te.add(ie.charAt(Y>>2)),te.add(ie.charAt(Y<<4&63))}var pe=te.b;this.buf.b+="s",pe.length==null?this.buf.b+="null":this.buf.b+=""+pe.length,this.buf.b+=":",pe==null?this.buf.b+="null":this.buf.b+=""+pe;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(ce.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(Te.__instanceof(r,uo)){var Pe=ce.getClassName(r);this.buf.b+="A",this.serializeString(Pe)}else if(Te.__instanceof(r,mo))this.buf.b+="B",this.serializeString(ce.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Ge=n[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(ce.getEnumName(Ge)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=ge.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var Xe=r.length;this.buf.b+=ge.string(Xe-2);for(var Fe=2;Fe<Xe;){var Ke=Fe++;this.serialize(r[Ke])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+ge.string(r))}}},__class__:Ye};var We=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var n=We.DEFAULT_RESOLVER;n==null&&(n=ce,We.DEFAULT_RESOLVER=n),this.setResolver(n)};x["haxe.Unserializer"]=We,We.__name__=["haxe","Unserializer"],We.initCodes=function(){for(var r=[],n=0,a=We.BASE64.length;n<a;){var l=n++;r[We.BASE64.charCodeAt(l)]=l}return r},We.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(n){return null},resolveEnum:function(n){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,n=!1,a=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=a)break;n=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return n&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var n=this.buf.charCodeAt(this.pos);if(n>=43&&n<58||n==101||n==69)this.pos++;else break}return ge.parseFloat(z.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var n=this.unserialize();if(typeof n!="string")throw new Q("Invalid object key");var a=this.unserialize();r[n]=a}this.pos++},unserializeEnum:function(r,n){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var a=this.readDigits();if(a==0)return ce.createEnum(r,n);for(var l=[];a-- >0;)l.push(this.unserialize());return ce.createEnum(r,n,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var n=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<n)throw new Q("Invalid string length");var a=z.substr(this.buf,this.pos,n);return this.pos+=n,a=decodeURIComponent(a.split("+").join(" ")),this.scache.push(a),a;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var p={};return this.cache.push(p),this.unserializeObject(p),p;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new Q("Invalid string reference");return this.scache[v];case 120:throw new Q(this.unserialize());case 99:var w=this.unserialize(),P=this.resolver.resolveClass(w);if(P==null)throw new Q("Class not found "+w);var A=ce.createEmptyInstance(P);return this.cache.push(A),this.unserializeObject(A),A;case 119:var I=this.unserialize(),k=this.resolver.resolveEnum(I);if(k==null)throw new Q("Enum not found "+I);var T=this.unserializeEnum(k,this.unserialize());return this.cache.push(T),T;case 106:var L=this.unserialize(),N=this.resolver.resolveEnum(L);if(N==null)throw new Q("Enum not found "+L);this.pos++;var R=this.readDigits(),O=ce.getEnumConstructs(N)[R];if(O==null)throw new Q("Unknown enum index "+L+"@"+R);var F=this.unserializeEnum(N,O);return this.cache.push(F),F;case 108:var V=new U;for(this.cache.push(V),this.buf;this.buf.charCodeAt(this.pos)!=104;)V.add(this.unserialize());return this.pos++,V;case 98:var q=new mt;for(this.cache.push(q),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();q.set(J,this.unserialize())}return this.pos++,q;case 113:var H=new xe;this.cache.push(H),this.buf;for(var j=this.get(this.pos++);j==58;){var X=this.readDigits();H.set(X,this.unserialize()),j=this.get(this.pos++)}if(j!=104)throw new Q("Invalid IntMap format");return H;case 77:var ee=new Le;for(this.cache.push(ee),this.buf;this.buf.charCodeAt(this.pos)!=104;){var te=this.unserialize();ee.set(te,this.unserialize())}return this.pos++,ee;case 118:var ie;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var he=z.substr(this.buf,this.pos,19);ie=z.strDate(he),this.pos+=19}else{var ae=this.readFloat(),ue=new Date;ue.setTime(ae),ie=ue}return this.cache.push(ie),ie;case 115:var ne=this.readDigits(),de=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<ne)throw new Q("Invalid bytes length");var Y=We.CODES;Y==null&&(Y=We.initCodes(),We.CODES=Y);var pe=this.pos,Pe=ne&3,Ge;Ge=(ne>>2)*3+(Pe>=2?Pe-1:0);for(var Xe=pe+(ne-Pe),Fe=It.alloc(Ge),Ke=0;pe<Xe;){var At=Y[oe.fastCodeAt(de,pe++)],Wt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,At<<2|Wt>>4);var vt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,Wt<<4|vt>>2);var gt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,vt<<6|gt)}if(Pe>=2){var St=Y[oe.fastCodeAt(de,pe++)],Tt=Y[oe.fastCodeAt(de,pe++)];if(Fe.set(Ke++,St<<2|Tt>>4),Pe==3){var Kt=Y[oe.fastCodeAt(de,pe++)];Fe.set(Ke++,Tt<<4|Kt>>2)}}return this.pos+=ne,this.cache.push(Fe),Fe;case 67:var or=this.unserialize(),$t=this.resolver.resolveClass(or);if($t==null)throw new Q("Class not found "+or);var Zt=ce.createEmptyInstance($t);if(this.cache.push(Zt),Zt.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return Zt;case 65:var Qt=this.unserialize(),dr=this.resolver.resolveClass(Qt);if(dr==null)throw new Q("Class not found "+Qt);return dr;case 66:var Tn=this.unserialize(),$r=this.resolver.resolveEnum(Tn);if($r==null)throw new Q("Enum not found "+Tn);return $r}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:We};var xe=function(){this.h={}};x["haxe.ds.IntMap"]=xe,xe.__name__=["haxe","ds","IntMap"],xe.__interfaces__=[se],xe.prototype={set:function(r,n){this.h[r]=n},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n|0);return z.iter(r)},__class__:xe};var Le=function(){this.h={},this.h.__keys__={}};x["haxe.ds.ObjectMap"]=Le,Le.__name__=["haxe","ds","ObjectMap"],Le.__interfaces__=[se],Le.prototype={set:function(r,n){var a=r.__id__||(r.__id__=++Le.count);this.h[a]=n,this.h.__keys__[a]=r},keys:function(){var r=[];for(var n in this.h.__keys__)this.h.hasOwnProperty(n)&&r.push(this.h.__keys__[n]);return z.iter(r)},__class__:Le};var dt=x["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};dt.Some=function(r){var n=["Some",0,r];return n.__enum__=dt,n.toString=E,n},dt.None=["None",1],dt.None.toString=E,dt.None.__enum__=dt;var mt=function(){this.h={}};x["haxe.ds.StringMap"]=mt,mt.__name__=["haxe","ds","StringMap"],mt.__interfaces__=[se],mt.prototype={set:function(r,n){Ri[r]!=null?this.setReserved(r,n):this.h[r]=n},get:function(r){return Ri[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,n){this.rh==null&&(this.rh={}),this.rh["$"+r]=n},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return z.iter(r)},arrayKeys:function(){var r=[];for(var n in this.h)this.h.hasOwnProperty(n)&&r.push(n);if(this.rh!=null)for(var n in this.rh)n.charCodeAt(0)==36&&r.push(n.substr(1));return r},__class__:mt};var It=function(r){this.length=r.byteLength,this.b=new Bi(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};x["haxe.io.Bytes"]=It,It.__name__=["haxe","io","Bytes"],It.alloc=function(r){return new It(new Us(r))},It.prototype={get:function(r){return this.b[r]},set:function(r,n){this.b[r]=n&255},__class__:It};var Je=x["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};Je.Blocked=["Blocked",0],Je.Blocked.toString=E,Je.Blocked.__enum__=Je,Je.Overflow=["Overflow",1],Je.Overflow.toString=E,Je.Overflow.__enum__=Je,Je.OutsideBounds=["OutsideBounds",2],Je.OutsideBounds.toString=E,Je.OutsideBounds.__enum__=Je,Je.Custom=function(r){var n=["Custom",3,r];return n.__enum__=Je,n.toString=E,n};var at=function(){};x["haxe.io.FPHelper"]=at,at.__name__=["haxe","io","FPHelper"],at.i32ToFloat=function(r){var n=1-(r>>>31<<1),a=r>>>23&255,l=r&8388607;return l==0&&a==0?0:n*(1+Math.pow(2,-23)*l)*Math.pow(2,a-127)},at.floatToI32=function(r){if(r==0)return 0;var n;r<0?n=-r:n=r;var a=Math.floor(Math.log(n)/.6931471805599453);a<-127?a=-127:a>128&&(a=128);var l=Math.round((n/Math.pow(2,a)-1)*8388608)&8388607;return(r<0?-2147483648:0)|a+127<<23|l},at.i64ToDouble=function(r,n){var a=1-(n>>>31<<1),l=(n>>20&2047)-1023,c=(n&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&l==-1023?0:a*(1+Math.pow(2,-52)*c)*Math.pow(2,l)},at.doubleToI64=function(r){var n=at.i64tmp;if(r==0)n.low=0,n.high=0;else{var a;r<0?a=-r:a=r;var l=Math.floor(Math.log(a)/.6931471805599453),c,d=(a/Math.pow(2,l)-1)*4503599627370496;c=Math.round(d);var p=c|0,_=c/4294967296|0;n.low=p,n.high=(r<0?-2147483648:0)|l+1023<<20|_}return n};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};x["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=M(Error.prototype,{__class__:Q});var Te=function(){};x["js.Boot"]=Te,Te.__name__=["js","Boot"],Te.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var n=r.__class__;if(n!=null)return n;var a=Te.__nativeClassName(r);return a!=null?Te.__resolveNativeClass(a):null},Te.__string_rec=function(r,n){if(r==null)return"null";if(n.length>=5)return"<...>";var a=typeof r;switch(a=="function"&&(r.__name__||r.__ename__)&&(a="object"),a){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";n+=" ";for(var c=2,d=r.length;c<d;){var p=c++;p!=2?l+=","+Te.__string_rec(r[p],n):l+=Te.__string_rec(r[p],n)}return l+")"}var _=r.length,v="[";n+=" ";for(var w=0;w<_;){var P=w++;v+=(P>0?",":"")+Te.__string_rec(r[P],n)}return v+="]",v}var A;try{A=r.toString}catch(N){return N instanceof Q&&(N=N.val),"???"}if(A!=null&&A!=Object.toString&&typeof A=="function"){var I=r.toString();if(I!="[object Object]")return I}var k=null,T=`{
|
|
3
3
|
`;n+=" ";var L=r.hasOwnProperty!=null;for(var k in r)L&&!r.hasOwnProperty(k)||k=="prototype"||k=="__class__"||k=="__super__"||k=="__interfaces__"||k=="__properties__"||(T.length!=2&&(T+=`,
|
|
4
4
|
`),T+=n+k+" : "+Te.__string_rec(r[k],n));return n=n.substring(1),T+=`
|
|
5
|
-
`+n+"}",T;case"function":return"<function>";case"string":return r;default:return String(r)}},Te.__interfLoop=function(r,n){if(r==null)return!1;if(r==n)return!0;var a=r.__interfaces__;if(a!=null)for(var l=0,c=a.length;l<c;){var d=l++,p=a[d];if(p==n||Te.__interfLoop(p,n))return!0}return Te.__interfLoop(r.__super__,n)},Te.__instanceof=function(r,n){if(n==null)return!1;switch(n){case Ec:return(r|0)===r;case ho:return typeof r=="number";case co:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case kc:return!0;default:if(r!=null){if(typeof n=="function"){if(r instanceof n||Te.__interfLoop(Te.getClass(r),n))return!0}else if(typeof n=="object"&&Te.__isNativeObj(n)&&r instanceof n)return!0}else return!1;return n==uo&&r.__name__!=null||n==mo&&r.__ename__!=null?!0:r.__enum__==n}},Te.__nativeClassName=function(r){var n=Te.__toStr.call(r).slice(8,-1);return n=="Object"||n=="Function"||n=="Math"||n=="JSON"?null:n},Te.__isNativeObj=function(r){return Te.__nativeClassName(r)!=null},Te.__resolveNativeClass=function(r){return A[r]};var ot=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var n=r;this.a=[];for(var a=0;a<n;){var l=a++;this.a[l]=0}this.byteLength=n}};x["js.html.compat.ArrayBuffer"]=ot,ot.__name__=["js","html","compat","ArrayBuffer"],ot.sliceImpl=function(r,n){var a=new Bi(this,r,n==null?null:n-r),l=new Us(a.byteLength),c=new Bi(l);return c.set(a),l},ot.prototype={slice:function(r,n){return new ot(this.a.slice(r,n))},__class__:ot};var hr=function(r,n,a){if(this.buf=r,n==null?this.offset=0:this.offset=n,a==null?this.length=r.byteLength-this.offset:this.length=a,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(Je.OutsideBounds)};x["js.html.compat.DataView"]=hr,hr.__name__=["js","html","compat","DataView"],hr.prototype={getInt8:function(r){var n=this.buf.a[this.offset+r];return n>=128?n-256:n},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,n){var a=this.getUint16(r,n);return a>=32768?a-65536:a},getUint16:function(r,n){return n?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,n){var a=this.offset+r,l=this.buf.a[a++],c=this.buf.a[a++],d=this.buf.a[a++],p=this.buf.a[a++];return n?l|c<<8|d<<16|p<<24:p|d<<8|c<<16|l<<24},getUint32:function(r,n){var a=this.getInt32(r,n);return a<0?a+4294967296:a},getFloat32:function(r,n){return at.i32ToFloat(this.getInt32(r,n))},getFloat64:function(r,n){var a=this.getInt32(r,n),l=this.getInt32(r+4,n);return at.i64ToDouble(n?a:l,n?l:a)},setInt8:function(r,n){n<0?this.buf.a[r+this.offset]=n+128&255:this.buf.a[r+this.offset]=n&255},setUint8:function(r,n){this.buf.a[r+this.offset]=n&255},setInt16:function(r,n,a){this.setUint16(r,n<0?n+65536:n,a)},setUint16:function(r,n,a){var l=r+this.offset;a?(this.buf.a[l]=n&255,this.buf.a[l++]=n>>8&255):(this.buf.a[l++]=n>>8&255,this.buf.a[l]=n&255)},setInt32:function(r,n,a){this.setUint32(r,n,a)},setUint32:function(r,n,a){var l=r+this.offset;a?(this.buf.a[l++]=n&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>>24):(this.buf.a[l++]=n>>>24,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n&255)},setFloat32:function(r,n,a){this.setUint32(r,at.floatToI32(n),a)},setFloat64:function(r,n,a){var l=at.doubleToI64(n);a?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:hr};var nr=function(){};x["js.html.compat.Uint8Array"]=nr,nr.__name__=["js","html","compat","Uint8Array"],nr._new=function(r,n,a){var l;if(typeof r=="number"){l=[];for(var c=0;c<r;){var d=c++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new ot(l)}else if(Te.__instanceof(r,ot)){var p=r;n==null&&(n=0),a==null&&(a=p.byteLength-n),n==0?l=p.a:l=p.a.slice(n,n+a),l.byteLength=l.length,l.byteOffset=n,l.buffer=p}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new ot(l);else throw new Q("TODO "+ge.string(r));return l.subarray=nr._subarray,l.set=nr._set,l},nr._set=function(r,n){var a=this;if(Te.__instanceof(r.buffer,ot)){var l=r;if(r.byteLength+n>a.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var p=c++;a[p+n]=l[p]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+n>a.byteLength)throw new Q("set() outside of range");for(var v=0,w=_.length;v<w;){var S=v++;a[S+n]=_[S]}}else throw new Q("TODO")},nr._subarray=function(r,n){var a=this,l=nr._new(a.slice(r,n));return l.byteOffset=r,l};var ke=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&ke.link(r,this,function(n){return n})};x["promhx.base.AsyncBase"]=ke,ke.__name__=["promhx","base","AsyncBase"],ke.link=function(r,n,a){r._update.push({async:n,linkf:function(l){n.handleResolve(a(l))}}),ke.immediateLinkUpdate(r,n,a)},ke.immediateLinkUpdate=function(r,n,a){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&n.handleError(r._errorVal),r._resolved&&!r._pending)try{n.handleResolve(a(r._val))}catch(l){l instanceof Q&&(l=l.val),n.handleError(l)}},ke.linkAll=function(r,n){for(var a=function(d,p,_){if(d.length==0||ke.allFulfilled(d)){for(var v,w=[],S=Xt(r)();S.hasNext();){var P=S.next();w.push(P==p?_:P._val)}v=w,n.handleResolve(v)}},l=Xt(r)();l.hasNext();){var c=l.next();c._update.push({async:n,linkf:function(d,p,_){return function(v){d(p,_,v)}}(a,function(d){for(var p,_=[],v=Xt(r)();v.hasNext();){var w=v.next();w!=c&&_.push(w)}return p=_,p}(),c)})}ke.allFulfilled(r)&&n.handleResolve(function(d){for(var p,_=[],v=Xt(r)();v.hasNext();){var w=v.next();_.push(w._val)}return p=_,p}())},ke.pipeLink=function(r,n,a){var l=!1,c=function(d){if(!l){l=!0;var p=a(d);p._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(p,n,function(_){return _})}};if(r._update.push({async:n,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),n.handleError(d)}},ke.allResolved=function(r){for(var n=Xt(r)();n.hasNext();){var a=n.next();if(!a._resolved)return!1}return!0},ke.allFulfilled=function(r){for(var n=Xt(r)();n.hasNext();){var a=n.next();if(!a._fulfilled)return!1}return!0},ke.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var n=this;this._pending?Pe.enqueue(function(a,l){return function(){a(l)}}(Mt(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,Pe.queue.add(function(){n._val=r;for(var a=0,l=n._update;a<l.length;){var c=l[a];++a;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}n._fulfilled=!0,n._pending=!1}),Pe.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var n=this,a=function(l){if(n._error.length>0)for(var c=0,d=n._error;c<d.length;){var p=d[c];++c,p(l)}else if(n._update.length>0)for(var _=0,v=n._update;_<v.length;){var w=v[_];++_,w.async.handleError(l)}else throw new Q(l);n._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,Pe.queue.add(function(){if(n._errorMap!=null)try{n._resolve(n._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),a(l)}else a(r)}),Pe.continueOnNextLoop())},then:function(r){var n=new ke(null);return ke.link(this,n,r),n},unlink:function(r){var n=this;Pe.queue.add(function(){n._update=n._update.filter(function(a){return a.async!=r})}),Pe.continueOnNextLoop()},isLinked:function(r){for(var n=!1,a=0,l=this._update;a<l.length;){var c=l[a];if(++a,c.async==r)return!0}return n},__class__:ke};var yn=f.promhx.Deferred=function(){ke.call(this)};x["promhx.Deferred"]=yn,yn.__name__=["promhx","Deferred"],yn.__super__=ke,yn.prototype=M(ke.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new pt(this)},stream:function(){return new He(this)},publicStream:function(){return new Tr(this)},__class__:yn});var pt=f.promhx.Promise=function(r){ke.call(this,r),this._rejected=!1};x["promhx.Promise"]=pt,pt.__name__=["promhx","Promise"],pt.whenAll=function(r){var n=new pt(null);return ke.linkAll(r,n),n},pt.promise=function(r){var n=new pt;return n.handleResolve(r),n},pt.__super__=ke,pt.prototype=M(ke.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var n="Promise has already been resolved";throw new Q(bn.AlreadyResolved(n))}this._resolve(r)},then:function(r){var n=new pt(null);return ke.link(this,n,r),n},unlink:function(r){var n=this;Pe.queue.add(function(){if(n._fulfilled)n._update=n._update.filter(function(l){return l.async!=r});else{var a="Downstream Promise is not fullfilled";n.handleError(bn.DownstreamNotFullfilled(a))}}),Pe.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var n=new pt(null);return ke.pipeLink(this,n,r),n},errorPipe:function(r){var n=new pt;return this.catchError(function(a){var l=r(a);l.then(Mt(n,n._resolve))}),this.then(Mt(n,n._resolve)),n},__class__:pt});var He=f.promhx.Stream=function(r){ke.call(this,r),this._end_promise=new pt};x["promhx.Stream"]=He,He.__name__=["promhx","Stream"],He.foreach=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.handleResolve(l)}return n.end(),n},He.wheneverAll=function(r){var n=new He(null);return ke.linkAll(r,n),n},He.concatAll=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.concat(l)}return n},He.mergeAll=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.merge(l)}return n},He.stream=function(r){var n=new He(null);return n.handleResolve(r),n},He.__super__=ke,He.prototype=M(ke.prototype,{then:function(r){var n=new He(null);return ke.link(this,n,r),this._end_promise._update.push({async:n._end_promise,linkf:function(a){n.end()}}),n},detachStream:function(r){for(var n=[],a=!1,l=0,c=this._update;l<c.length;){var d=c[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(p){return p.async!=r._end_promise}),a=!0):n.push(d)}return this._update=n,a},first:function(){var r=new pt(null);return this.then(function(n){r._resolved||r.handleResolve(n)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var n=new He(null);return ke.pipeLink(this,n,r),this._end_promise.then(function(a){n.end()}),n},errorPipe:function(r){var n=new He(null);return this.catchError(function(a){var l=r(a);l.then(Mt(n,n._resolve)),l._end_promise.then((Di=n._end_promise,Mt(Di,Di._resolve)))}),this.then(Mt(n,n._resolve)),this._end_promise.then(function(a){n.end()}),n},handleEnd:function(){if(this._pending)Pe.queue.add(Mt(this,this.handleEnd)),Pe.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=dt.Some(this._val):r=dt.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return Pe.queue.add(Mt(this,this.handleEnd)),Pe.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var n=new He(null);return this._update.push({async:n,linkf:function(a){r(a)&&n.handleResolve(a)}}),ke.immediateLinkUpdate(this,n,function(a){return a}),n},concat:function(r){var n=new He(null);return this._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(this,n,function(a){return a}),this._end_promise.then(function(a){r.pipe(function(l){return n.handleResolve(l),n}),r._end_promise.then(function(l){n.end()})}),n},merge:function(r){var n=new He(null);return this._update.push({async:n,linkf:Mt(n,n.handleResolve)}),r._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(this,n,function(a){return a}),ke.immediateLinkUpdate(r,n,function(a){return a}),n},__class__:He});var Tr=f.promhx.PublicStream=function(r){He.call(this,r)};x["promhx.PublicStream"]=Tr,Tr.__name__=["promhx","PublicStream"],Tr.publicstream=function(r){var n=new Tr(null);return n.handleResolve(r),n},Tr.__super__=He,Tr.prototype=M(He.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Tr});var Pe=function(){};x["promhx.base.EventLoop"]=Pe,Pe.__name__=["promhx","base","EventLoop"],Pe.enqueue=function(r){Pe.queue.add(r),Pe.continueOnNextLoop()},Pe.set_nextLoop=function(r){if(Pe.nextLoop!=null)throw new Q("nextLoop has already been set");return Pe.nextLoop=r,Pe.nextLoop},Pe.queueEmpty=function(){return Pe.queue.isEmpty()},Pe.finish=function(r){r==null&&(r=1e3);for(var n=null;r-- >0&&(n=Pe.queue.pop())!=null;)n();return Pe.queue.isEmpty()},Pe.clear=function(){Pe.queue=new U},Pe.f=function(){var r=Pe.queue.pop();r!=null&&r(),Pe.queue.isEmpty()||Pe.continueOnNextLoop()},Pe.continueOnNextLoop=function(){Pe.nextLoop!=null?Pe.nextLoop(Pe.f):setImmediate(Pe.f)};var bn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};bn.AlreadyResolved=function(r){var n=["AlreadyResolved",0,r];return n.__enum__=bn,n.toString=E,n},bn.DownstreamNotFullfilled=function(r){var n=["DownstreamNotFullfilled",1,r];return n.__enum__=bn,n.toString=E,n};var Bs=function(){};x["verb.Verb"]=Bs,Bs.__name__=["verb","Verb"],Bs.main=function(){b.log("verb 2.1.0")};var K=function(){};x["verb.core.ArrayExtensions"]=K,K.__name__=["verb","core","ArrayExtensions"],K.alloc=function(r,n){if(!(n<0))for(;r.length<n;)r.push(null)},K.reversed=function(r){var n=r.slice();return n.reverse(),n},K.last=function(r){return r[r.length-1]},K.first=function(r){return r[0]},K.spliceAndInsert=function(r,n,a,l){r.splice(n,a),r.splice(n,0,l)},K.left=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(0,n)},K.right=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n)},K.rightWithPivot=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n-1)},K.unique=function(r,n){if(r.length==0)return[];for(var a=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<a.length;){var p=a[d];if(++d,n(l,p)){c=!1;break}}c&&a.push(l)}return a};var De=function(){};x["verb.core.Binomial"]=De,De.__name__=["verb","core","Binomial"],De.get=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;if(n>r-n&&(n=r-n),De.memo_exists(r,n))return De.get_memo(r,n);for(var a=1,l=r,c=1,d=n+1;c<d;){var p=c++;if(De.memo_exists(l,p)){r--,a=De.get_memo(l,p);continue}a*=r--,a/=p,De.memoize(l,p,a)}return a},De.get_no_memo=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;n>r-n&&(n=r-n);for(var a=1,l=1,c=n+1;l<c;){var d=l++;a*=r--,a/=d}return a},De.memo_exists=function(r,n){return De.memo.h.hasOwnProperty(r)&&De.memo.h[r].h.hasOwnProperty(n)},De.get_memo=function(r,n){return De.memo.h[r].h[n]},De.memoize=function(r,n,a){De.memo.h.hasOwnProperty(r)||De.memo.set(r,new xe),De.memo.h[r].h[n]=a};var Et=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=Et,Et.__name__=["verb","core","BoundingBox"],Et.intervalsOverlap=function(r,n,a,l,c){c==null&&(c=-1);var d;c<-.5?d=re.TOLERANCE:d=c;var p=Math.min(r,n)-d,_=Math.max(r,n)+d,v=Math.min(a,l)-d,w=Math.max(a,l)+d;return p>=v&&p<=w||_>=v&&_<=w||v>=p&&v<=_||w>=p&&w<=_},Et.prototype={fromPoint:function(r){return new Et([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var n=0,a=this.dim;n<a;){var l=n++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var n=r.length,a=0;a<n;){var l=a++;this.add(r[l])}return this},contains:function(r,n){return n==null&&(n=-1),this.initialized?this.intersects(new Et([r]),n):!1},intersects:function(r,n){if(n==null&&(n=-1),!this.initialized||!r.initialized)return!1;for(var a=this.min,l=this.max,c=r.min,d=r.max,p=0,_=this.dim;p<_;){var v=p++;if(!Et.intervalsOverlap(a[v],l[v],c[v],d[v],n))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,n=0,a=0,l=this.dim;a<l;){var c=a++,d=this.getAxisLength(c);d>r&&(r=d,n=c)}return n},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,n){if(!this.initialized)return null;var a=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,n))return null;for(var p=[],_=[],v=0,w=this.dim;v<w;){var S=v++;p.push(Math.min(l[S],d[S])),_.push(Math.max(a[S],c[S]))}return new Et([_,p])},__class__:Et};var re=f.core.Constants=function(){};x["verb.core.Constants"]=re,re.__name__=["verb","core","Constants"];var Ze=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=Ze,Ze.__name__=["verb","core","SerializableBase"],Ze.prototype={serialize:function(){var r=new Ye;return r.serialize(this),r.toString()},__class__:Ze};var Vn=f.core.Plane=function(r,n){this.origin=r,this.normal=n};x["verb.core.Plane"]=Vn,Vn.__name__=["verb","core","Plane"],Vn.__super__=Ze,Vn.prototype=M(Ze.prototype,{__class__:Vn});var xn=f.core.Ray=function(r,n){this.origin=r,this.dir=n};x["verb.core.Ray"]=xn,xn.__name__=["verb","core","Ray"],xn.__super__=Ze,xn.prototype=M(Ze.prototype,{__class__:xn});var je=f.core.NurbsCurveData=function(r,n,a){this.degree=r,this.controlPoints=a,this.knots=n};x["verb.core.NurbsCurveData"]=je,je.__name__=["verb","core","NurbsCurveData"],je.__super__=Ze,je.prototype=M(Ze.prototype,{__class__:je});var et=f.core.NurbsSurfaceData=function(r,n,a,l,c){this.degreeU=r,this.degreeV=n,this.knotsU=a,this.knotsV=l,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=et,et.__name__=["verb","core","NurbsSurfaceData"],et.__super__=Ze,et.prototype=M(Ze.prototype,{__class__:et});var qt=f.core.MeshData=function(r,n,a,l){this.faces=r,this.points=n,this.normals=a,this.uvs=l};x["verb.core.MeshData"]=qt,qt.__name__=["verb","core","MeshData"],qt.empty=function(){return new qt([],[],[],[])},qt.__super__=Ze,qt.prototype=M(Ze.prototype,{__class__:qt});var jn=f.core.PolylineData=function(r,n){this.points=r,this.params=n};x["verb.core.PolylineData"]=jn,jn.__name__=["verb","core","PolylineData"],jn.__super__=Ze,jn.prototype=M(Ze.prototype,{__class__:jn});var Gn=f.core.VolumeData=function(r,n,a,l,c,d,p){this.degreeU=r,this.degreeV=n,this.degreeW=a,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=p};x["verb.core.VolumeData"]=Gn,Gn.__name__=["verb","core","VolumeData"],Gn.__super__=Ze,Gn.prototype=M(Ze.prototype,{__class__:Gn});var tt=f.core.Pair=function(r,n){this.item0=r,this.item1=n};x["verb.core.Pair"]=tt,tt.__name__=["verb","core","Pair"],tt.prototype={__class__:tt};var wt=f.core.Interval=function(r,n){this.min=r,this.max=n};x["verb.core.Interval"]=wt,wt.__name__=["verb","core","Interval"],wt.prototype={__class__:wt};var Xr=f.core.CurveCurveIntersection=function(r,n,a,l){this.point0=r,this.point1=n,this.u0=a,this.u1=l};x["verb.core.CurveCurveIntersection"]=Xr,Xr.__name__=["verb","core","CurveCurveIntersection"],Xr.prototype={__class__:Xr};var Wn=f.core.CurveSurfaceIntersection=function(r,n,a,l){this.u=r,this.uv=n,this.curvePoint=a,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=Wn,Wn.__name__=["verb","core","CurveSurfaceIntersection"],Wn.prototype={__class__:Wn};var Cr=f.core.MeshIntersectionPoint=function(r,n,a,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=n,this.point=a,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Cr,Cr.__name__=["verb","core","MeshIntersectionPoint"],Cr.prototype={__class__:Cr};var Hn=f.core.PolylineMeshIntersection=function(r,n,a,l,c){this.point=r,this.u=n,this.uv=a,this.polylineIndex=l,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=Hn,Hn.__name__=["verb","core","PolylineMeshIntersection"],Hn.prototype={__class__:Hn};var qn=f.core.SurfaceSurfaceIntersectionPoint=function(r,n,a,l){this.uv0=r,this.uv1=n,this.point=a,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=qn,qn.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],qn.prototype={__class__:qn};var Yn=f.core.TriSegmentIntersection=function(r,n,a,l){this.point=r,this.s=n,this.t=a,this.p=l};x["verb.core.TriSegmentIntersection"]=Yn,Yn.__name__=["verb","core","TriSegmentIntersection"],Yn.prototype={__class__:Yn};var wn=f.core.CurveTriPoint=function(r,n,a){this.u=r,this.point=n,this.uv=a};x["verb.core.CurveTriPoint"]=wn,wn.__name__=["verb","core","CurveTriPoint"],wn.prototype={__class__:wn};var jt=function(r,n,a,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=a,this.point=r,this.normal=n,this.id=l,this.degen=c};x["verb.core.SurfacePoint"]=jt,jt.__name__=["verb","core","SurfacePoint"],jt.fromUv=function(r,n){return new jt(null,null,[r,n])},jt.prototype={__class__:jt};var Fs=f.core.CurvePoint=function(r,n){this.u=r,this.pt=n};x["verb.core.CurvePoint"]=Fs,Fs.__name__=["verb","core","CurvePoint"],Fs.prototype={__class__:Fs};var Xn=f.core.KdTree=function(r,n){this.dim=3,this.points=r,this.distanceFunction=n,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=Xn,Xn.__name__=["verb","core","KdTree"],Xn.prototype={buildTree:function(r,n,a){var l=n%this.dim,c,d;return r.length==0?null:r.length==1?new Pn(r[0],l,a):(r.sort(function(p,_){var v=p.point[l]-_.point[l];return v==0?0:v>0?1:-1}),c=Math.floor(r.length/2),d=new Pn(r[c],l,a),d.left=this.buildTree(r.slice(0,c),n+1,d),d.right=this.buildTree(r.slice(c+1),n+1,d),d)},nearest:function(r,n,a){var l=this,c=new Kn(function(P){return-P.item1}),d,p=null;p=function(P){for(var I,k=P.dimension,T=l.distanceFunction(r,P.kdPoint.point),L,N=[],R=0,O=l.dim;R<O;)R++,N.push(0);L=N;for(var F,V,q=function(X,ee){c.push(new tt(X,ee)),c.size()>n&&c.pop()},J=0,H=l.dim;J<H;){var j=J++;j==P.dimension?L[j]=r[j]:L[j]=P.kdPoint.point[j]}if(F=l.distanceFunction(L,P.kdPoint.point),P.right==null&&P.left==null){(c.size()<n||T<c.peek().item1)&&q(P,T);return}P.right==null?I=P.left:P.left==null?I=P.right:r[k]<P.kdPoint.point[k]?I=P.left:I=P.right,p(I),(c.size()<n||T<c.peek().item1)&&q(P,T),(c.size()<n||Math.abs(F)<c.peek().item1)&&(I==P.left?V=P.right:V=P.left,V!=null&&p(V))},d=p;for(var _=0;_<n;)_++,c.push(new tt(null,a));d(this.root);for(var v=[],w=0;w<n;){var S=w++;c.content[S].item0!=null&&v.push(new tt(c.content[S].item0.kdPoint,c.content[S].item1))}return v},__class__:Xn};var Kn=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=Kn,Kn.__name__=["verb","core","BinaryHeap"],Kn.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var n=this.content.length,a=0;a<n;){var l=a++;if(this.content[l]==r){var c=this.content.pop();l!=n-1&&(this.content[l]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var n=this.content[r];r>0;){var a=Math.floor((r+1)/2)-1,l=this.content[a];if(this.scoreFunction(n)<this.scoreFunction(l))this.content[a]=n,this.content[r]=l,r=a;else break}},sinkDown:function(r){for(var n=this.content.length,a=this.content[r],l=this.scoreFunction(a);;){var c=(r+1)*2,d=c-1,p=-1,_=0;if(d<n){var v=this.content[d];_=this.scoreFunction(v),_<l&&(p=d)}if(c<n){var w=this.content[c],S=this.scoreFunction(w);S<(p==-1?l:_)&&(p=c)}if(p!=-1)this.content[r]=this.content[p],this.content[p]=a,r=p;else break}},__class__:Kn};var An=f.core.KdPoint=function(r,n){this.point=r,this.obj=n};x["verb.core.KdPoint"]=An,An.__name__=["verb","core","KdPoint"],An.prototype={__class__:An};var Pn=f.core.KdNode=function(r,n,a){this.kdPoint=r,this.left=null,this.right=null,this.parent=a,this.dimension=n};x["verb.core.KdNode"]=Pn,Pn.__name__=["verb","core","KdNode"],Pn.prototype={__class__:Pn};var cr=function(){};x["verb.eval.IBoundingBoxTree"]=cr,cr.__name__=["verb","eval","IBoundingBoxTree"],cr.prototype={__class__:cr};var sr=function(r,n){this._boundingBox=null,this._curve=r,n==null&&(n=m.domain(this._curve.knots)/64),this._knotTol=n};x["verb.core.LazyCurveBoundingBoxTree"]=sr,sr.__name__=["verb","core","LazyCurveBoundingBoxTree"],sr.__interfaces__=[cr],sr.prototype={split:function(){var r=K.first(this._curve.knots),n=K.last(this._curve.knots),a=n-r,l=lt.curveSplit(this._curve,(n+r)/2+a*.1*Math.random());return new tt(new sr(l[0],this._knotTol),new sr(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Et(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return m.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:sr};var ir=function(r,n){if(this._boundingBox=null,this._mesh=r,n==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}n=a}this._faceIndices=n};x["verb.core.LazyMeshBoundingBoxTree"]=ir,ir.__name__=["verb","core","LazyMeshBoundingBoxTree"],ir.__interfaces__=[cr],ir.prototype={split:function(){var r=rt.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),n=K.left(r),a=K.right(r);return new tt(new ir(this._mesh,n),new ir(this._mesh,a))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=rt.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:ir};var ar=function(r,n){this._boundingBox=null,this._polyline=r,n==null&&(n=new wt(0,r.points.length!=0?r.points.length-1:0)),this._interval=n};x["verb.core.LazyPolylineBoundingBoxTree"]=ar,ar.__name__=["verb","core","LazyPolylineBoundingBoxTree"],ar.__interfaces__=[cr],ar.prototype={split:function(){var r=this._interval.min,n=this._interval.max,a=r+Math.ceil((n-r)/2),l=new wt(r,a),c=new wt(a,n);return new tt(new ar(this._polyline,l),new ar(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Et(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:ar};var Nr=function(r,n,a,l){n==null&&(n=!1),this._boundingBox=null,this._surface=r,this._splitV=n,a==null&&(a=m.domain(r.knotsU)/16),l==null&&(l=m.domain(r.knotsV)/16),this._knotTolU=a,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Nr,Nr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Nr.__interfaces__=[cr],Nr.prototype={split:function(){var r,n;this._splitV?(r=K.first(this._surface.knotsV),n=K.last(this._surface.knotsV)):(r=K.first(this._surface.knotsU),n=K.last(this._surface.knotsU));var a=(r+n)/2,l=lt.surfaceSplit(this._surface,a,this._splitV);return new tt(new Nr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Nr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Et;for(var r=0,n=this._surface.controlPoints;r<n.length;){var a=n[r];++r,this._boundingBox.addRange(C.dehomogenize1d(a))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return m.domain(this._surface.knotsV)<this._knotTolV&&m.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Nr};var Ne=f.core.Mat=function(){};x["verb.core.Mat"]=Ne,Ne.__name__=["verb","core","Mat"],Ne.mul=function(r,n){for(var a=[],l=0,c=n.length;l<c;){var d=l++;a.push(m.mul(r,n[d]))}return a},Ne.mult=function(r,n){var a,l,c,d,p,_,v,w;a=r.length,l=n.length,c=n[0].length,d=[];for(var S=a-1,P=0,I=0;S>=0;){for(p=[],_=r[S],I=c-1;I>=0;){for(v=_[l-1]*n[l-1][I],P=l-2;P>=1;)w=P-1,v+=_[P]*n[P][I]+_[w]*n[w][I],P-=2;P==0&&(v+=_[0]*n[0][I]),p[I]=v,I--}d[S]=p,S--}return d},Ne.add=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.add(r[d],n[d]))}return a},Ne.div=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.div(r[d],n))}return a},Ne.sub=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.sub(r[d],n[d]))}return a},Ne.dot=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.dot(r[d],n))}return a},Ne.identity=function(r){for(var n=m.zeros2d(r,r),a=0;a<r;){var l=a++;n[l][l]=1}return n},Ne.transpose=function(r){if(r.length==0)return[];for(var n=[],a=0,l=r[0].length;a<l;){var c=a++;n.push(function(d){for(var p,_=[],v=0,w=r.length;v<w;){var S=v++;_.push(r[S][c])}return p=_,p}())}return n},Ne.solve=function(r,n){return Ne.LUsolve(Ne.LU(r),n)},Ne.LUsolve=function(r,n){var a,l,c=r.LU,d=c.length,p=n.slice(),_=r.P,v,w,S;for(a=d-1;a!=-1;)p[a]=n[a],--a;for(a=0;a<d;){for(v=_[a],_[a]!=a&&(S=p[a],p[a]=p[v],p[v]=S),w=c[a],l=0;l<a;)p[a]-=p[l]*w[l],++l;++a}for(a=d-1;a>=0;){for(w=c[a],l=a+1;l<d;)p[a]-=p[l]*w[l],++l;p[a]/=w[a],--a}return p},Ne.LU=function(r){for(var n,a,l,c,d,p,_,v,w,S=[],P=0,I=r.length;P<I;){var k=P++;S.push(r[k].slice())}r=S;var T=r.length,L=T-1,N=[];for(l=0;l<T;){for(_=l,p=r[l],w=Math.abs(p[l]),a=l+1;a<T;)c=Math.abs(r[a][l]),w<c&&(w=c,_=a),++a;for(N[l]=_,_!=l&&(r[l]=r[_],r[_]=p,p=r[l]),d=p[l],n=l+1;n<T;)r[n][l]/=d,++n;for(n=l+1;n<T;){for(v=r[n],a=l+1;a<L;)v[a]-=v[l]*p[a],++a,v[a]-=v[l]*p[a],++a;a==L&&(v[a]-=v[l]*p[a]),++n}++l}return new $n(r,N)};var $n=function(r,n){this.LU=r,this.P=n};x["verb.core._Mat.LUDecomp"]=$n,$n.__name__=["verb","core","_Mat","LUDecomp"],$n.prototype={__class__:$n};var rt=f.core.Mesh=function(){};x["verb.core.Mesh"]=rt,rt.__name__=["verb","core","Mesh"],rt.getTriangleNorm=function(r,n){var a=r[n[0]],l=r[n[1]],c=r[n[2]],d=m.sub(l,a),p=m.sub(c,a),_=m.cross(d,p);return m.mul(1/m.norm(_),_)},rt.makeMeshAabb=function(r,n){for(var a=new Et,l=0;l<n.length;){var c=n[l];++l,a.add(r.points[r.faces[c][0]]),a.add(r.points[r.faces[c][1]]),a.add(r.points[r.faces[c][2]])}return a},rt.sortTrianglesOnLongestAxis=function(r,n,a){for(var l=r.getLongestAxis(),c=[],d=0;d<a.length;){var p=a[d];++d;var _=rt.getMinCoordOnAxis(n.points,n.faces[p],l);c.push(new tt(_,p))}c.sort(function(I,k){var T=I.item0,L=k.item0;return T==L?0:T>L?1:-1});for(var v=[],w=0,S=c.length;w<S;){var P=w++;v.push(c[P].item1)}return v},rt.getMinCoordOnAxis=function(r,n,a){for(var l=1/0,c=0;c<3;){var d=c++,p=r[n[d]][a];p<l&&(l=p)}return l},rt.getTriangleCentroid=function(r,n){for(var a=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var p=d++;a[p]+=r[n[c]][p]}for(var _=0;_<3;){var v=_++;a[v]/=3}return a},rt.triangleUVFromPoint=function(r,n,a){var l=r.faces[n],c=r.points[l[0]],d=r.points[l[1]],p=r.points[l[2]],_=r.uvs[l[0]],v=r.uvs[l[1]],w=r.uvs[l[2]],S=m.sub(c,a),P=m.sub(d,a),I=m.sub(p,a),k=m.norm(m.cross(m.sub(c,d),m.sub(c,p))),T=m.norm(m.cross(P,I))/k,L=m.norm(m.cross(I,S))/k,N=m.norm(m.cross(S,P))/k;return m.add(m.mul(T,_),m.add(m.mul(L,v),m.mul(N,w)))};var Lr=function(r,n){if(this._empty=!1,this._face=-1,n==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}n=a}if(this._boundingBox=rt.makeMeshAabb(r,n),n.length<1){this._empty=!0;return}else if(n.length<2){this._face=n[0];return}var p=rt.sortTrianglesOnLongestAxis(this._boundingBox,r,n),_=K.left(p),v=K.right(p);this._children=new tt(new Lr(r,_),new Lr(r,v))};x["verb.core.MeshBoundingBoxTree"]=Lr,Lr.__name__=["verb","core","MeshBoundingBoxTree"],Lr.__interfaces__=[cr],Lr.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Lr};var Yt=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=Yt,Yt.__name__=["verb","core","Minimizer"],Yt.uncmin=function(r,n,a,l,c){a==null&&(a=1e-8),l==null&&(l=function(J){return Yt.numericalGradient(r,J)}),c==null&&(c=1e3),n=n.slice(0);var d=n.length,p=r(n),_=p,v;if(isNaN(p))throw new Q("uncmin: f(x0) is a NaN!");a=Math.max(a,re.EPSILON);var w,S,P,I=Ne.identity(d),k=0,T=[],L,N,R,O,F,V,q="";for(S=l(n);k<c;){if(!m.all(m.finite(S))){q="Gradient has Infinity or NaN";break}if(w=m.neg(Ne.dot(I,S)),!m.all(m.finite(w))){q="Search direction has Infinity or NaN";break}if(V=m.norm(w),V<a){q="Newton step smaller than tol";break}for(F=1,v=m.dot(S,w),L=n;k<c&&!(F*V<a);){if(T=m.mul(F,w),L=m.add(n,T),_=r(L),_-p>=.1*F*v||isNaN(_)){F*=.5,++k;continue}break}if(F*V<a){q="Line search step size smaller than tol";break}if(k==c){q="maxit reached during line search";break}P=l(L),N=m.sub(P,S),O=m.dot(N,T),R=Ne.dot(I,N),I=Ne.sub(Ne.add(I,Ne.mul((O+m.dot(N,R))/(O*O),Yt.tensor(T,T))),Ne.div(Ne.add(Yt.tensor(R,T),Yt.tensor(T,R)),O)),n=L,p=_,S=P,++k}return new Zn(n,p,S,I,k,q)},Yt.numericalGradient=function(r,n){var a=n.length,l=r(n);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=n.slice(0),d,p,_=[],v,w=.001,S,P,I,k=0,T,L,N,R=0;R<a;)for(var O=R++,F=Math.max(1e-6*l,1e-8);;){if(++k,k>20)throw new Q("Numerical gradient fails");if(c[O]=n[O]+F,d=r(c),c[O]=n[O]-F,p=r(c),c[O]=n[O],isNaN(d)||isNaN(p)){F/=16;continue}if(_[O]=(d-p)/(2*F),S=n[O]-F,P=n[O],I=n[O]+F,T=(d-l)/F,L=(l-p)/F,N=m.max([Math.abs(_[O]),Math.abs(l),Math.abs(d),Math.abs(p),Math.abs(S),Math.abs(P),Math.abs(I),1e-8]),v=Math.min(m.max([Math.abs(T-_[O]),Math.abs(L-_[O]),Math.abs(T-L)])/N,F/N),v>w)F/=16;else break}return _},Yt.tensor=function(r,n){for(var a=r.length,l=n.length,c=[],d,p,_=a-1;_>=0;){d=[],p=r[_];for(var v=l-1;v>=3;)d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v;for(;v>=0;)d[v]=p*n[v],--v;c[_]=d,_--}return c};var Zn=function(r,n,a,l,c,d){this.solution=r,this.value=n,this.gradient=a,this.invHessian=l,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=Zn,Zn.__name__=["verb","core","MinimizationResult"],Zn.prototype={__class__:Zn};var Sn=function(){};x["verb.core.ISerializable"]=Sn,Sn.__name__=["verb","core","ISerializable"],Sn.prototype={__class__:Sn};var zi=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=zi,zi.__name__=["verb","core","Deserializer"],zi.deserialize=function(r){var n=new We(r),a=n.unserialize();return a};var kt=f.core.Trig=function(){};x["verb.core.Trig"]=kt,kt.__name__=["verb","core","Trig"],kt.isPointInPlane=function(r,n,a){return Math.abs(m.dot(m.sub(r,n.origin),n.normal))<a},kt.distToSegment=function(r,n,a){var l=kt.segmentClosestPoint(n,r,a,0,1);return m.dist(n,l.pt)},kt.rayClosestPoint=function(r,n,a){var l=m.sub(r,n),c=m.dot(l,a),d=m.add(n,m.mul(c,a));return d},kt.distToRay=function(r,n,a){var l=kt.rayClosestPoint(r,n,a),c=m.sub(l,r);return m.norm(c)},kt.threePointsAreFlat=function(r,n,a,l){var c=m.sub(n,r),d=m.sub(a,r),p=m.cross(c,d),_=m.dot(p,p);return _<l},kt.segmentClosestPoint=function(r,n,a,l,c){var d=m.sub(a,n),p=m.norm(d);if(p<re.EPSILON)return{u:l,pt:n};var _=n,v=m.mul(1/p,d),w=m.sub(r,_),S=m.dot(w,v);return S<0?{u:l,pt:n}:S>p?{u:c,pt:a}:{u:l+(c-l)*S/p,pt:m.add(_,m.mul(S,v))}};var m=f.core.Vec=function(){};x["verb.core.Vec"]=m,m.__name__=["verb","core","Vec"],m.angleBetween=function(r,n){return Math.acos(m.dot(r,n)/(m.norm(r)*m.norm(n)))},m.positiveAngleBetween=function(r,n,a){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,S=Math.atan2(v,w),P=m.dot(a,l);return Math.abs(P)<re.EPSILON||P>0?S:-S},m.signedAngleBetween=function(r,n,a){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,S=Math.atan2(v,w),P=m.dot(a,l);return P>0?S:2*Math.PI-S},m.angleBetweenNormalized2d=function(r,n){var a=r[0]*n[1]-r[1]*n[0];return Math.atan2(a,m.dot(r,n))},m.domain=function(r){return K.last(r)-K.first(r)},m.range=function(r){for(var n=[],a=0,l=0;l<r;)l++,n.push(a),a+=1;return n},m.span=function(r,n,a){if(a==null)return[];if(a<re.EPSILON)return[];if(r>n&&a>0)return[];if(n>r&&a<0)return[];for(var l=[],c=r;c<=n;)l.push(c),c+=a;return l},m.neg=function(r){return r.map(function(n){return-n})},m.min=function(r){return D.fold(r,function(n,a){return Math.min(n,a)},1/0)},m.max=function(r){return D.fold(r,function(n,a){return Math.max(n,a)},-1/0)},m.all=function(r){return D.fold(r,function(n,a){return a&&n},!0)},m.finite=function(r){return r.map(function(n){return isFinite(n)})},m.onRay=function(r,n,a){return m.add(r,m.mul(a,n))},m.lerp=function(r,n,a){return m.add(m.mul(r,n),m.mul(1-r,a))},m.normalized=function(r){return m.div(r,m.norm(r))},m.cross=function(r,n){return[r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]]},m.dist=function(r,n){return m.norm(m.sub(r,n))},m.distSquared=function(r,n){return m.normSquared(m.sub(r,n))},m.sum=function(r){return D.fold(r,function(n,a){return a+n},0)},m.addAll=function(r){var n=Xt(r)();if(!n.hasNext())return null;var a=n.next().length;return D.fold(r,function(l,c){return m.add(c,l)},m.rep(a,0))},m.addAllMutate=function(r){for(var n=r[0],a=1,l=r.length;a<l;){var c=a++;m.addMutate(n,r[c])}},m.addMulMutate=function(r,n,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+n*a[d]}},m.subMulMutate=function(r,n,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-n*a[d]}},m.addMutate=function(r,n){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]+n[c]}},m.subMutate=function(r,n){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]-n[c]}},m.mulMutate=function(r,n){for(var a=0,l=n.length;a<l;){var c=a++;n[c]=n[c]*r}},m.norm=function(r){var n=m.normSquared(r);return n!=0?Math.sqrt(n):n},m.normSquared=function(r){return D.fold(r,function(n,a){return a+n*n},0)},m.rep=function(r,n){for(var a=[],l=0;l<r;)l++,a.push(n);return a},m.zeros1d=function(r){for(var n=[],a=0;a<r;)a++,n.push(0);return n},m.zeros2d=function(r,n){for(var a=[],l=0;l<r;)l++,a.push(m.zeros1d(n));return a},m.zeros3d=function(r,n,a){for(var l=[],c=0;c<r;)c++,l.push(m.zeros2d(n,a));return l},m.dot=function(r,n){for(var a=0,l=0,c=r.length;l<c;){var d=l++;a+=r[d]*n[d]}return a},m.add=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]+n[d])}return a},m.mul=function(r,n){for(var a=[],l=0,c=n.length;l<c;){var d=l++;a.push(r*n[d])}return a},m.div=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]/n)}return a},m.sub=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]-n[d])}return a},m.isZero=function(r){for(var n=0,a=r.length;n<a;){var l=n++;if(Math.abs(r[l])>re.TOLERANCE)return!1}return!0},m.sortedSetUnion=function(r,n){for(var a=[],l=0,c=0;l<r.length||c<n.length;){if(l>=r.length){a.push(n[c]),c++;continue}else if(c>=n.length){a.push(r[l]),l++;continue}var d=r[l]-n[c];if(Math.abs(d)<re.EPSILON){a.push(r[l]),l++,c++;continue}if(d>0){a.push(n[c]),c++;continue}a.push(r[l]),l++}return a},m.sortedSetSub=function(r,n){for(var a=[],l=0,c=0;l<r.length;){if(c>=n.length){a.push(r[l]),l++;continue}if(Math.abs(r[l]-n[c])<re.EPSILON){l++,c++;continue}a.push(r[l]),l++}return a};var ve=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=ve,ve.__name__=["verb","eval","Analyze"],ve.knotMultiplicities=function(r){for(var n=[new In(r[0],0)],a=n[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-a.knot)>re.EPSILON&&(a=new In(c,0),n.push(a)),a.inc()}return n},ve.isRationalSurfaceClosed=function(r,n){n==null&&(n=!0);var a;n?a=r.controlPoints:a=Ne.transpose(r.controlPoints);for(var l=0,c=a[0].length;l<c;){var d=l++,p=m.dist(K.first(a)[d],K.last(a)[d])<re.EPSILON;if(!p)return!1}return!0},ve.rationalSurfaceClosestPoint=function(r,n){var a=ve.rationalSurfaceClosestParam(r,n);return C.rationalSurfacePoint(r,a[0],a[1])},ve.rationalSurfaceClosestParam=function(r,n){for(var a=5,l=0,c,d=1e-4,p=5e-4,_,v=r.knotsU[0],w=K.last(r.knotsU),S=r.knotsV[0],P=K.last(r.knotsV),I=ve.isRationalSurfaceClosed(r),k=ve.isRationalSurfaceClosed(r,!1),T,L=Oe.rationalSurfaceAdaptive(r,new Or),N=1/0,R=0,O=L.points.length;R<O;){var F=R++,V=L.points[F],q=m.normSquared(m.sub(n,V));q<N&&(N=q,T=L.uvs[F])}for(var J=function(Ge){return C.rationalSurfaceDerivatives(r,Ge[0],Ge[1],2)},H=function(Ge,Xe,Fe){var Ke=Xe[1][0],At=Xe[0][1],Wt=Xe[2][0],vt=Xe[0][2],gt=Xe[1][1],Pt=Xe[1][1],Tt=m.dot(Ke,Fe),Kt=m.dot(At,Fe),or=[-Tt,-Kt],$t=m.dot(Ke,Ke)+m.dot(Wt,Fe),Zt=m.dot(Ke,At)+m.dot(gt,Fe),Qt=m.dot(Ke,At)+m.dot(Pt,Fe),dr=m.dot(At,At)+m.dot(vt,Fe),Tn=[[$t,Zt],[Qt,dr]],$r=Ne.solve(Tn,or);return m.add($r,Ge)};l<a;){c=J(T),_=m.sub(c[0][0],n);var j=m.norm(_),X=m.dot(c[1][0],_),ee=m.norm(c[1][0])*j,te=m.dot(c[0][1],_),ie=m.norm(c[0][1])*j,he=X/ee,ae=te/ie,ue=j<d,ne=he<p,de=ae<p;if(ue&&ne&&de)return T;var Y=H(T,c,_);Y[0]<v?I?Y=[w-(Y[0]-v),Y[1]]:Y=[v+re.EPSILON,Y[1]]:Y[0]>w&&(I?Y=[v+(Y[0]-w),Y[1]]:Y=[w-re.EPSILON,Y[1]]),Y[1]<S?k?Y=[Y[0],P-(Y[1]-S)]:Y=[Y[0],S+re.EPSILON]:Y[1]>P&&(k?Y=[Y[0],S+(Y[0]-P)]:Y=[Y[0],P-re.EPSILON]);var pe=m.norm(m.mul(Y[0]-T[0],c[1][0])),Se=m.norm(m.mul(Y[1]-T[1],c[0][1]));if(pe+Se<d)return T;T=Y,l++}return T},ve.rationalCurveClosestPoint=function(r,n){return C.rationalCurvePoint(r,ve.rationalCurveClosestParam(r,n))},ve.rationalCurveClosestParam=function(r,n){for(var a=1/0,l=0,c=Oe.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,p=c.length-1;d<p;){var _=d++,v=c[_][0],w=c[_+1][0],S=c[_].slice(1),P=c[_+1].slice(1),I=kt.segmentClosestPoint(n,S,P,v,w),k=m.norm(m.sub(n,I.pt));k<a&&(a=k,l=I.u)}for(var T=5,L=0,N,R=1e-4,O=5e-4,F,V=r.knots[0],q=K.last(r.knots),J=m.normSquared(m.sub(r.controlPoints[0],K.last(r.controlPoints)))<re.EPSILON,H=l,j=function(Y){return C.rationalCurveDerivatives(r,Y,2)},X=function(Y,pe,Se){var Ge=m.dot(pe[1],Se),Xe=m.dot(pe[2],Se),Fe=m.dot(pe[1],pe[1]),Ke=Xe+Fe;return Y-Ge/Ke};L<T;){N=j(H),F=m.sub(N[0],n);var ee=m.norm(F),te=m.dot(N[1],F),ie=m.norm(N[1])*ee,he=te/ie,ae=ee<R,ue=Math.abs(he)<O;if(ae&&ue)return H;var ne=X(H,N,F);ne<V?J?ne=q-(ne-V):ne=V:ne>q&&(J?ne=V+(ne-q):ne=q);var de=m.norm(m.mul(ne-H,N[1]));if(de<R)return H;H=ne,L++}return H},ve.rationalCurveParamAtArcLength=function(r,n,a,l,c){if(a==null&&(a=.001),n<re.EPSILON)return r.knots[0];var d;l!=null?d=l:d=fe.decomposeCurveIntoBeziers(r);var p=0;d[p];var _=-re.EPSILON,v;for(c!=null?v=c:v=[];_<n&&p<d.length;){if(p<v.length?v[p]=v[p]:v[p]=ve.rationalBezierCurveArcLength(r),_+=v[p],n<_+re.EPSILON)return ve.rationalBezierCurveParamAtArcLength(r,n,a,v[p]);p++}return-1},ve.rationalBezierCurveParamAtArcLength=function(r,n,a,l){if(n<0)return r.knots[0];var c;if(l!=null?c=l:c=ve.rationalBezierCurveArcLength(r),n>c)return K.last(r.knots);var d=r.knots[0],p=0,_=K.last(r.knots),v=c,w=0,S=0,P;for(a!=null?P=a:P=re.TOLERANCE*2;v-p>P;)w=(d+_)/2,S=ve.rationalBezierCurveArcLength(r,w),S>n?(_=w,v=S):(d=w,p=S);return(d+_)/2},ve.rationalCurveArcLength=function(r,n,a){a==null&&(a=16),n==null?n=K.last(r.knots):n=n;for(var l=fe.decomposeCurveIntoBeziers(r),c=0,d=l[0],p=0;c<l.length&&d.knots[0]+re.EPSILON<n;){var _=Math.min(K.last(d.knots),n);p+=ve.rationalBezierCurveArcLength(d,_,a),d=l[++c]}return p},ve.rationalBezierCurveArcLength=function(r,n,a){a==null&&(a=16);var l;n==null?l=K.last(r.knots):l=n;for(var c=(l-r.knots[0])/2,d=0,p=r.degree+a,_,v,w=0;w<p;){var S=w++;_=c*ve.Tvalues[p][S]+c+r.knots[0],v=C.rationalCurveDerivatives(r,_,1),d+=ve.Cvalues[p][S]*m.norm(v[1])}return c*d};var In=f.eval.KnotMultiplicity=function(r,n){this.knot=r,this.mult=n};x["verb.eval.KnotMultiplicity"]=In,In.__name__=["verb","eval","KnotMultiplicity"],In.prototype={inc:function(){this.mult++},__class__:In};var Gt=f.eval.Check=function(){};x["verb.eval.Check"]=Gt,Gt.__name__=["verb","eval","Check"],Gt.isValidKnotVector=function(r,n){if(r.length==0||r.length<(n+1)*2)return!1;for(var a=K.first(r),l=0,c=n+1;l<c;){var d=l++;if(Math.abs(r[d]-a)>re.EPSILON)return!1}a=K.last(r);for(var p=r.length-n-1,_=r.length;p<_;){var v=p++;if(Math.abs(r[v]-a)>re.EPSILON)return!1}return Gt.isNonDecreasing(r)},Gt.isNonDecreasing=function(r){for(var n=K.first(r),a=0,l=r.length;a<l;){var c=a++;if(r[c]<n-re.EPSILON)return!1;n=r[c]}return!0},Gt.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Gt.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Gt.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Gt.isValidKnotVector(r.knotsU,r.degreeU)||!Gt.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var lt=f.eval.Divide=function(){};x["verb.eval.Divide"]=lt,lt.__name__=["verb","eval","Divide"],lt.surfaceSplit=function(r,n,a){a==null&&(a=!1);var l,c,d;a?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Ne.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var p,_=[],v=0,w=c+1;v<w;)v++,_.push(n);p=_;for(var S=[],P=[],I=C.knotSpan(c,n,l),k=null,T=0;T<d.length;){var L=d[T];++T,k=fe.curveKnotRefine(new je(c,l,L),p),S.push(k.controlPoints.slice(0,I+1)),P.push(k.controlPoints.slice(I+1))}var N=k.knots.slice(0,I+c+2),R=k.knots.slice(I+1);return a?[new et(r.degreeU,c,r.knotsU.slice(),N,S),new et(r.degreeU,c,r.knotsU.slice(),R,P)]:(S=Ne.transpose(S),P=Ne.transpose(P),[new et(c,r.degreeV,N,r.knotsV.slice(),S),new et(c,r.degreeV,R,r.knotsV.slice(),P)])},lt.curveSplit=function(r,n){var a=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],p=0,_=a+1;p<_;)p++,d.push(n);c=d;var v=fe.curveKnotRefine(r,c),w=C.knotSpan(a,n,l),S=v.knots.slice(0,w+a+2),P=v.knots.slice(w+1),I=v.controlPoints.slice(0,w+1),k=v.controlPoints.slice(w+1);return[new je(a,S,I),new je(a,P,k)]},lt.rationalCurveByEqualArcLength=function(r,n){var a=ve.rationalCurveArcLength(r),l=a/n;return lt.rationalCurveByArcLength(r,l)},lt.rationalCurveByArcLength=function(r,n){var a=fe.decomposeCurveIntoBeziers(r),l=a.map(function(I){return ve.rationalBezierCurveArcLength(I)}),c=m.sum(l),d=[new En(r.knots[0],0)];if(n>c)return d;for(var p=n,_=0,v=p,w=0,S=0,P;_<a.length;){for(w+=l[_];v<w+re.EPSILON;)P=ve.rationalBezierCurveParamAtArcLength(a[_],v-S,re.TOLERANCE,l[_]),d.push(new En(P,v)),v+=p;S+=l[_],_++}return d};var En=f.eval.CurveLengthSample=function(r,n){this.u=r,this.len=n};x["verb.eval.CurveLengthSample"]=En,En.__name__=["verb","eval","CurveLengthSample"],En.prototype={__class__:En};var C=f.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(r,n){var a=C.rationalCurveDerivatives(r,n,1);return a[1]},C.rationalSurfaceNormal=function(r,n,a){var l=C.rationalSurfaceDerivatives(r,n,a,1);return m.cross(l[1][0],l[0][1])},C.rationalSurfaceDerivatives=function(r,n,a,l){l==null&&(l=1);for(var c=C.surfaceDerivatives(r,n,a,l),d=C.rational2d(c),p=C.weight2d(c),_=[],v=d[0][0].length,w=0,S=l+1;w<S;){var P=w++;_.push([]);for(var I=0,k=l-P+1;I<k;){for(var T=I++,L=d[P][T],N=1,R=T+1;N<R;){var O=N++;m.subMulMutate(L,De.get(T,O)*p[0][O],_[P][T-O])}for(var F=1,V=P+1;F<V;){var q=F++;m.subMulMutate(L,De.get(P,q)*p[q][0],_[P-q][T]);for(var J=m.zeros1d(v),H=1,j=T+1;H<j;){var X=H++;m.addMulMutate(J,De.get(T,X)*p[q][X],_[P-q][T-X])}m.subMulMutate(L,De.get(P,q),J)}m.mulMutate(1/p[0][0],L),_[P].push(L)}}return _},C.rationalSurfacePoint=function(r,n,a){return C.dehomogenize(C.surfacePoint(r,n,a))},C.rationalCurveDerivatives=function(r,n,a){a==null&&(a=1);for(var l=C.curveDerivatives(r,n,a),c=C.rational1d(l),d=C.weight1d(l),p=[],_=0,v=a+1;_<v;){for(var w=_++,S=c[w],P=1,I=w+1;P<I;){var k=P++;m.subMulMutate(S,De.get(w,k)*d[k],p[w-k])}m.mulMutate(1/d[0],S),p.push(S)}return p},C.rationalCurvePoint=function(r,n){return C.dehomogenize(C.curvePoint(r,n))},C.surfaceDerivatives=function(r,n,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return C.surfaceDerivativesGivenNM(c,d,r,n,a,l)},C.surfaceDerivativesGivenNM=function(r,n,a,l,c,d){var p=a.degreeU,_=a.degreeV,v=a.controlPoints,w=a.knotsU,S=a.knotsV;if(!C.areValidRelations(p,v.length,w.length)||!C.areValidRelations(_,v[0].length,S.length))throw new Q("Invalid relations between control points, knot vector, and n");var P=v[0][0].length,I;d<p?I=d:I=p;var k;d<_?k=d:k=_;for(var T=m.zeros3d(d+1,d+1,P),L=C.knotSpanGivenN(r,p,l,w),N=C.knotSpanGivenN(n,_,c,S),R=C.derivativeBasisFunctionsGivenNI(L,l,p,r,w),O=C.derivativeBasisFunctionsGivenNI(N,c,_,n,S),F=m.zeros2d(_+1,P),V=0,q=0,J=I+1;q<J;){for(var H=q++,j=0,X=_+1;j<X;){var ee=j++;F[ee]=m.zeros1d(P);for(var te=0,ie=p+1;te<ie;){var he=te++;m.addMulMutate(F[ee],R[H][he],v[L-p+he][N-_+ee])}}var ae=d-H;ae<k?V=ae:V=k;for(var ue=0,ne=V+1;ue<ne;){var de=ue++;T[H][de]=m.zeros1d(P);for(var Y=0,pe=_+1;Y<pe;){var Se=Y++;m.addMulMutate(T[H][de],O[de][Se],F[Se])}}}return T},C.surfacePoint=function(r,n,a){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return C.surfacePointGivenNM(l,c,r,n,a)},C.surfacePointGivenNM=function(r,n,a,l,c){var d=a.degreeU,p=a.degreeV,_=a.controlPoints,v=a.knotsU,w=a.knotsV;if(!C.areValidRelations(d,_.length,v.length)||!C.areValidRelations(p,_[0].length,w.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var S=_[0][0].length,P=C.knotSpanGivenN(r,d,l,v),I=C.knotSpanGivenN(n,p,c,w),k=C.basisFunctionsGivenKnotSpanIndex(P,l,d,v),T=C.basisFunctionsGivenKnotSpanIndex(I,c,p,w),L=P-d,N=I,R=m.zeros1d(S),O=m.zeros1d(S),F=0,V=p+1;F<V;){var q=F++;O=m.zeros1d(S),N=I-p+q;for(var J=0,H=d+1;J<H;){var j=J++;m.addMulMutate(O,k[j],_[L+j][N])}m.addMulMutate(R,T[q],O)}return R},C.curveRegularSamplePoints=function(r,n){for(var a=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=a[0],p=m.mul(l,a[1]),_=m.mul(c*.5,a[2]),v=m.mul(c*l*.5,a[3]),w=m.add(_,_),S=m.add(v,v),P=m.mul(.3333333333333333,v),I=[],k=0,T=n+1;k<T;)k++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,P]),m.addAllMutate([p,w,v]),m.addAllMutate([w,S]),m.addAllMutate([_,v]);return I},C.curveRegularSamplePoints2=function(r,n){for(var a=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=a[0],p=m.mul(l,a[1]),_=m.mul(c*.5,a[2]),v=m.mul(c*l*.5,a[3]),w=m.add(_,_),S=m.add(v,v),P=m.mul(.3333333333333333,v),I=[],k=0,T=n+1;k<T;)k++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,P]),m.addAllMutate([p,w,v]),m.addAllMutate([w,S]),m.addAllMutate([_,v]);return I},C.rationalSurfaceRegularSampleDerivatives=function(r,n,a,l){for(var c=C.surfaceRegularSampleDerivatives(r,n,a,l),d=[],p=n+1,_=a+1,v=l+1,w=0;w<p;){var S=w++,P=[];d.push(P);for(var I=0;I<_;){for(var k=I++,T=c[S][k],L=C.rational2d(T),N=C.weight2d(T),R=[],O=L[0][0].length,F=0;F<v;){var V=F++;R.push([]);for(var q=0,J=v-V;q<J;){for(var H=q++,j=L[V][H],X=1,ee=H+1;X<ee;){var te=X++;m.subMulMutate(j,De.get(H,te)*N[0][te],R[V][H-te])}for(var ie=1,he=V+1;ie<he;){var ae=ie++;m.subMulMutate(j,De.get(V,ae)*N[ae][0],R[V-ae][H]);for(var ue=m.zeros1d(O),ne=1,de=H+1;ne<de;){var Y=ne++;m.addMulMutate(ue,De.get(H,Y)*N[ae][Y],R[V-ae][H-Y])}m.subMulMutate(j,De.get(V,ae),ue)}m.mulMutate(1/N[0][0],j),R[V].push(j)}}P.push(R)}}return d},C.surfaceRegularSampleDerivatives=function(r,n,a,l){var c=r.degreeU,d=r.degreeV,p=r.controlPoints,_=r.knotsU,v=r.knotsV,w=p[0][0].length;(K.last(_)-_[0])/n,(K.last(v)-v[0])/a;for(var S=C.regularlySpacedDerivativeBasisFunctions(c,_,n),P=S.item0,I=S.item1,k=C.regularlySpacedDerivativeBasisFunctions(d,v,a),T=k.item0,L=k.item1,N=[],R=n+1,O=a+1,F=0;F<R;){var V=F++,q=[];N.push(q);for(var J=0;J<O;){var H=J++;q.push(C.surfaceDerivativesGivenBasesKnotSpans(c,d,p,P[V],T[H],I[V],L[H],w,l))}}return N},C.rationalSurfaceRegularSamplePoints=function(r,n,a){return C.dehomogenize2d(C.surfaceRegularSamplePoints(r,n,a))},C.surfaceRegularSamplePoints=function(r,n,a){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,p=r.knotsU,_=r.knotsV,v=d[0][0].length;(K.last(p)-p[0])/n,(K.last(_)-_[0])/a;for(var w=C.regularlySpacedBasisFunctions(l,p,n),S=w.item0,P=w.item1,I=C.regularlySpacedBasisFunctions(c,_,a),k=I.item0,T=I.item1,L=[],N=n+1,R=a+1,O=0;O<N;){var F=O++,V=[];L.push(V);for(var q=0;q<R;){var J=q++;V.push(C.surfacePointGivenBasesKnotSpans(l,c,d,S[F],k[J],P[F],T[J],v))}}return L},C.regularlySpacedBasisFunctions=function(r,n,a){for(var l=n.length-r-2,c=(K.last(n)-n[0])/a,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=a+1,S=0;S<w;){for(S++;_>=n[v+1];)v++;p.push(v),d.push(C.basisFunctionsGivenKnotSpanIndex(v,_,r,n)),_+=c}return new tt(p,d)},C.regularlySpacedDerivativeBasisFunctions=function(r,n,a){for(var l=n.length-r-2,c=(K.last(n)-n[0])/a,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=a+1,S=0;S<w;){for(S++;_>=n[v+1];)v++;p.push(v),d.push(C.derivativeBasisFunctionsGivenNI(v,_,r,l,n)),_+=c}return new tt(p,d)},C.surfacePointGivenBasesKnotSpans=function(r,n,a,l,c,d,p,_){for(var v=m.zeros1d(_),w,S=l-r,P=c-n,I=0,k=n+1;I<k;){var T=I++;w=m.zeros1d(_);for(var L=0,N=r+1;L<N;){var R=L++;m.addMulMutate(w,d[R],a[S+R][P])}P++,m.addMulMutate(v,p[T],w)}return v},C.surfaceDerivativesGivenBasesKnotSpans=function(r,n,a,l,c,d,p,_,v){var w=a[0][0].length,S;v<r?S=v:S=r;var P;v<n?P=v:P=n;for(var I=m.zeros3d(S+1,P+1,w),k=m.zeros2d(n+1,w),T=0,L=0,N=S+1;L<N;){for(var R=L++,O=0,F=n+1;O<F;){var V=O++;k[V]=m.zeros1d(w);for(var q=0,J=r+1;q<J;){var H=q++;m.addMulMutate(k[V],d[R][H],a[l-r+H][c-n+V])}}var j=v-R;j<P?T=j:T=P;for(var X=0,ee=T+1;X<ee;){var te=X++;I[R][te]=m.zeros1d(w);for(var ie=0,he=n+1;ie<he;){var ae=ie++;m.addMulMutate(I[R][te],p[te][ae],k[ae])}}}return I},C.curveDerivatives=function(r,n,a){var l=r.knots.length-r.degree-2;return C.curveDerivativesGivenN(l,r,n,a)},C.curveDerivativesGivenN=function(r,n,a,l){var c=n.degree,d=n.controlPoints,p=n.knots;if(!C.areValidRelations(c,d.length,p.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;l<c?v=l:v=c;for(var w=m.zeros2d(l+1,_),S=C.knotSpanGivenN(r,c,a,p),P=C.derivativeBasisFunctionsGivenNI(S,a,c,v,p),I=0,k=v+1;I<k;)for(var T=I++,L=0,N=c+1;L<N;){var R=L++;m.addMulMutate(w[T],P[T][R],d[S-c+R])}return w},C.curvePoint=function(r,n){var a=r.knots.length-r.degree-2;return C.curvePointGivenN(a,r,n)},C.areValidRelations=function(r,n,a){return n+r+1-a==0},C.curvePointGivenN=function(r,n,a){var l=n.degree,c=n.controlPoints,d=n.knots;if(!C.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var p=C.knotSpanGivenN(r,l,a,d),_=C.basisFunctionsGivenKnotSpanIndex(p,a,l,d),v=m.zeros1d(c[0].length),w=0,S=l+1;w<S;){var P=w++;m.addMulMutate(v,_[P],c[p-l+P])}return v},C.volumePoint=function(r,n,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,p=r.knotsW.length-r.degreeW-2;return C.volumePointGivenNML(r,c,d,p,n,a,l)},C.volumePointGivenNML=function(r,n,a,l,c,d,p){if(!C.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!C.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!C.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,v=r.degreeU,w=r.degreeV,S=r.degreeW,P=r.knotsU,I=r.knotsV,k=r.knotsW,T=_[0][0][0].length,L=C.knotSpanGivenN(n,v,c,P),N=C.knotSpanGivenN(a,w,d,I),R=C.knotSpanGivenN(l,S,p,k),O=C.basisFunctionsGivenKnotSpanIndex(L,c,v,P),F=C.basisFunctionsGivenKnotSpanIndex(N,d,w,I),V=C.basisFunctionsGivenKnotSpanIndex(R,p,S,k),q=L-v,J=m.zeros1d(T),H=m.zeros1d(T),j=m.zeros1d(T),X=0,ee=S+1;X<ee;){var te=X++;j=m.zeros1d(T);for(var ie=R-S+te,he=0,ae=w+1;he<ae;){var ue=he++;H=m.zeros1d(T);for(var ne=N-w+ue,de=0,Y=v+1;de<Y;){var pe=de++;m.addMulMutate(H,O[pe],_[q+pe][ne][ie])}m.addMulMutate(j,F[ue],H)}m.addMulMutate(J,V[te],j)}return J},C.derivativeBasisFunctions=function(r,n,a){var l=C.knotSpan(n,r,a),c=a.length-1,d=c-n-1;return C.derivativeBasisFunctionsGivenNI(l,r,n,d,a)},C.derivativeBasisFunctionsGivenNI=function(r,n,a,l,c){var d=m.zeros2d(a+1,a+1),p=m.zeros1d(a+1),_=m.zeros1d(a+1),v=0,w=0;d[0][0]=1;for(var S=1,P=a+1;S<P;){var I=S++;p[I]=n-c[r+1-I],_[I]=c[r+I]-n,v=0;for(var k=0;k<I;){var T=k++;d[I][T]=_[T+1]+p[I-T],w=d[T][I-1]/d[I][T],d[T][I]=v+_[T+1]*w,v=p[I-T]*w}d[I][I]=v}for(var L=m.zeros2d(l+1,a+1),N=m.zeros2d(2,a+1),R=0,O=1,F=0,V=0,q=0,J=0,H=0,j=0,X=a+1;j<X;){var ee=j++;L[0][ee]=d[ee][a]}for(var te=0,ie=a+1;te<ie;){var he=te++;R=0,O=1,N[0][0]=1;for(var ae=1,ue=l+1;ae<ue;){var ne=ae++;F=0,V=he-ne,q=a-ne,he>=ne&&(N[O][0]=N[R][0]/d[q+1][V],F=N[O][0]*d[V][q]),V>=-1?J=1:J=-V,he-1<=q?H=ne-1:H=a-he;for(var de=J,Y=H+1;de<Y;){var pe=de++;N[O][pe]=(N[R][pe]-N[R][pe-1])/d[q+1][V+pe],F+=N[O][pe]*d[V+pe][q]}he<=q&&(N[O][ne]=-N[R][ne-1]/d[q+1][he],F+=N[O][ne]*d[he][q]),L[ne][he]=F;var Se=R;R=O,O=Se}}for(var Ge=a,Xe=1,Fe=l+1;Xe<Fe;){for(var Ke=Xe++,At=0,Wt=a+1;At<Wt;){var vt=At++;L[Ke][vt]*=Ge}Ge*=a-Ke}return L},C.basisFunctions=function(r,n,a){var l=C.knotSpan(n,r,a);return C.basisFunctionsGivenKnotSpanIndex(l,r,n,a)},C.basisFunctionsGivenKnotSpanIndex=function(r,n,a,l){var c=m.zeros1d(a+1),d=m.zeros1d(a+1),p=m.zeros1d(a+1),_=0,v=0;c[0]=1;for(var w=1,S=a+1;w<S;){var P=w++;d[P]=n-l[r+1-P],p[P]=l[r+P]-n,_=0;for(var I=0;I<P;){var k=I++;v=c[k]/(p[k+1]+d[P-k]),c[k]=_+p[k+1]*v,_=d[P-k]*v}c[P]=_}return c},C.knotSpan=function(r,n,a){return C.knotSpanGivenN(a.length-r-2,r,n,a)},C.knotSpanGivenN=function(r,n,a,l){if(a>l[r+1]-re.EPSILON)return r;if(a<l[n]+re.EPSILON)return n;for(var c=n,d=r+1,p=Math.floor((c+d)/2);a<l[p]||a>=l[p+1];)a<l[p]?d=p:c=p,p=Math.floor((c+d)/2);return p},C.dehomogenize=function(r){for(var n=r.length,a=[],l=r[n-1],c=r.length-1,d=0;d<c;){var p=d++;a.push(r[p]/l)}return a},C.rational1d=function(r){var n=r[0].length-1;return r.map(function(a){return a.slice(0,n)})},C.rational2d=function(r){return r.map(C.rational1d)},C.weight1d=function(r){var n=r[0].length-1;return r.map(function(a){return a[n]})},C.weight2d=function(r){return r.map(C.weight1d)},C.dehomogenize1d=function(r){return r.map(C.dehomogenize)},C.dehomogenize2d=function(r){return r.map(C.dehomogenize1d)},C.homogenize1d=function(r,n){var a=r.length,l=r[0].length,c=[],d=0,p=[],_;n!=null?_=n:_=m.rep(r.length,1);for(var v=0;v<a;){var w=v++,S=[];p=r[w],d=_[w];for(var P=0;P<l;){var I=P++;S.push(p[I]*d)}S.push(d),c.push(S)}return c},C.homogenize2d=function(r,n){var a=r.length,l=[],c;if(n!=null)c=n;else{for(var d=[],p=0;p<a;)p++,d.push(m.rep(r[0].length,1));c=d}for(var _=0;_<a;){var v=_++;l.push(C.homogenize1d(r[v],c[v]))}return l};var le=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=le,le.__name__=["verb","eval","Intersect"],le.surfaces=function(r,n,a){var l=Oe.rationalSurfaceAdaptive(r),c=Oe.rationalSurfaceAdaptive(n),d=le.meshes(l,c),p=d.map(function(_){return _.map(function(v){return le.surfacesAtPointWithEstimate(r,n,v.uv0,v.uv1,a)})});return p.map(function(_){return me.rationalInterpCurve(_.map(function(v){return v.point}),3)})},le.surfacesAtPointWithEstimate=function(r,n,a,l,c){var d,p,_,v,w,S,P,I,k,T,L,N,R,O=5,F=0;do{if(d=C.rationalSurfaceDerivatives(r,a[0],a[1],1),p=d[0][0],v=d[1][0],w=d[0][1],_=m.normalized(m.cross(v,w)),S=m.dot(_,p),P=C.rationalSurfaceDerivatives(n,l[0],l[1],1),I=P[0][0],T=P[1][0],L=P[0][1],k=m.normalized(m.cross(T,L)),N=m.dot(k,I),R=m.distSquared(p,I),R<c*c)break;var V=m.normalized(m.cross(_,k)),q=m.dot(V,p),J=le.threePlanes(_,S,k,N,V,q);if(J==null)throw new Q("panic!");var H=m.sub(J,p),j=m.sub(J,I),X=m.cross(v,_),ee=m.cross(w,_),te=m.cross(T,k),ie=m.cross(L,k),he=m.dot(ee,H)/m.dot(ee,v),ae=m.dot(X,H)/m.dot(X,w),ue=m.dot(ie,j)/m.dot(ie,T),ne=m.dot(te,j)/m.dot(te,L);a=m.add([he,ae],a),l=m.add([ue,ne],l),F++}while(F<O);return new qn(a,l,p,R)},le.meshes=function(r,n,a,l){a==null&&(a=new ir(r)),l==null&&(l=new ir(n));var c=le.boundingBoxTrees(a,l,0),d=K.unique(c.map(function(p){return le.triangles(r,p.item0,n,p.item1)}).filter(function(p){return p!=null}).filter(function(p){return m.distSquared(p.min.point,p.max.point)>re.EPSILON}),function(p,_){var v=m.sub(p.min.uv0,_.min.uv0),w=m.dot(v,v),S=m.sub(p.max.uv0,_.max.uv0),P=m.dot(S,S),I=m.sub(p.min.uv0,_.max.uv0),k=m.dot(I,I),T=m.sub(p.max.uv0,_.min.uv0),L=m.dot(T,T);return w<re.EPSILON&&P<re.EPSILON||k<re.EPSILON&&L<re.EPSILON});return le.makeMeshIntersectionPolylines(d)},le.meshSlices=function(r,n,a,l){for(var c=new Lr(r),d=c.boundingBox(),p=d.min[0],_=d.min[1],v=d.max[0],w=d.max[1],S=m.span(n,a,l),P=[],I=0;I<S.length;){var k=S[I];++I;var T=[[p,_,k],[v,_,k],[v,w,k],[p,w,k]],L=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],R=new qt(N,T,null,L);P.push(le.meshes(r,R,c))}return P},le.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var n=0;n<r.length;){var a=r[n];++n,a.max.opp=a.min,a.min.opp=a.max}for(var l=le.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.min),c.push(p.max)}for(var _=0;_<c.length;){var v=c[_];if(++_,v.adj==null){var w=le.lookupAdjacentSegment(v,l,r.length);w!=null&&w.adj==null&&(v.adj=w,w.adj=v)}}var S=c.filter(function(O){return O.adj==null});S.length==0&&(S=c);for(var P=[],I=0,k=!1;S.length!=0;){var T=S.pop();if(!T.visited){for(var L=[],N=T;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,L.push(N),I+=2,N=N.opp.adj,N==T)););L.length>0&&(L.push(L[L.length-1].opp),P.push(L))}if(S.length==0&&c.length>0&&(k||I<c.length)){k=!0;var R=c.pop();S.push(R)}}return P},le.kdTreeFromSegments=function(r){for(var n=[],a=0;a<r.length;){var l=r[a];++a,n.push(new An(l.min.point,l.min)),n.push(new An(l.max.point,l.max))}return new Xn(n,m.distSquared)},le.lookupAdjacentSegment=function(r,n,a){var l=n.nearest(r.point,a,re.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},le.curveAndSurface=function(r,n,a,l,c){a==null&&(a=.001),l!=null?l=l:l=new sr(r),c!=null?c=c:c=new Nr(n);var d=le.boundingBoxTrees(l,c,a);return K.unique(d.map(function(p){var _=p.item0,v=p.item1,w=K.first(_.knots),S=K.last(_.knots),P=(w+S)/2,I=K.first(v.knotsU),k=K.last(v.knotsU),T=K.first(v.knotsV),L=K.last(v.knotsV),N=[(I+k)/2,(T+L)/2];return le.curveAndSurfaceWithEstimate(_,v,[P].concat(N),a)}).filter(function(p){return m.distSquared(p.curvePoint,p.surfacePoint)<a*a}),function(p,_){return Math.abs(p.u-_.u)<.5*a})},le.curveAndSurfaceWithEstimate=function(r,n,a,l){l==null&&(l=.001);var c=function(v){var w=C.rationalCurvePoint(r,v[0]),S=C.rationalSurfacePoint(n,v[1],v[2]),P=m.sub(w,S);return m.dot(P,P)},d=function(v){var w=C.rationalCurveDerivatives(r,v[0],1),S=C.rationalSurfaceDerivatives(n,v[1],v[2],1),P=m.sub(S[0][0],w[0]),I=m.mul(-1,w[1]),k=S[1][0],T=S[0][1];return[2*m.dot(I,P),2*m.dot(k,P),2*m.dot(T,P)]},p=Yt.uncmin(c,a,l*l,d),_=p.solution;return new Wn(_[0],[_[1],_[2]],C.rationalCurvePoint(r,_[0]),C.rationalSurfacePoint(n,_[1],_[2]))},le.polylineAndMesh=function(r,n,a){for(var l=le.boundingBoxTrees(new ar(r),new ir(n),a),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=le.segmentWithTriangle(r.points[_],r.points[_+1],n.points,n.faces[v]);if(w!=null){var S=w.point,P=m.lerp(w.p,[r.params[_]],[r.params[_+1]])[0],I=rt.triangleUVFromPoint(n,v,S);c.push(new Hn(S,P,I,_,v))}}return c},le.boundingBoxTrees=function(r,n,a){a==null&&(a=1e-9);var l=[],c=[];l.push(r),c.push(n);for(var d=[];l.length>0;){var p=l.pop(),_=c.pop();if(!(p.empty()||_.empty())&&p.boundingBox().intersects(_.boundingBox(),a)){var v=p.indivisible(a),w=_.indivisible(a);if(v&&w){d.push(new tt(p.yield(),_.yield()));continue}else if(v&&!w){var S=_.split();l.push(p),c.push(S.item1),l.push(p),c.push(S.item0);continue}else if(!v&&w){var P=p.split();l.push(P.item1),c.push(_),l.push(P.item0),c.push(_);continue}var I=p.split(),k=_.split();l.push(I.item1),c.push(k.item1),l.push(I.item1),c.push(k.item0),l.push(I.item0),c.push(k.item1),l.push(I.item0),c.push(k.item0)}}return d},le.curves=function(r,n,a){var l=le.boundingBoxTrees(new sr(r),new sr(n),0);return K.unique(l.map(function(c){return le.curvesWithEstimate(r,n,K.first(c.item0.knots),K.first(c.item1.knots),a)}).filter(function(c){return m.distSquared(c.point0,c.point1)<a}),function(c,d){return Math.abs(c.u0-d.u0)<a*5})},le.curvesWithEstimate=function(r,n,a,l,c){var d=function(I){var k=C.rationalCurvePoint(r,I[0]),T=C.rationalCurvePoint(n,I[1]),L=m.sub(k,T);return m.dot(L,L)},p=function(I){var k=C.rationalCurveDerivatives(r,I[0],1),T=C.rationalCurveDerivatives(n,I[1],1),L=m.sub(k[0],T[0]),N=k[1],R=m.mul(-1,T[1]);return[2*m.dot(N,L),2*m.dot(R,L)]},_=Yt.uncmin(d,[a,l],c*c,p),v=_.solution[0],w=_.solution[1],S=C.rationalCurvePoint(r,v),P=C.rationalCurvePoint(n,w);return new Xr(S,P,v,w)},le.triangles=function(r,n,a,l){var c=r.faces[n],d=a.faces[l],p=rt.getTriangleNorm(r.points,c),_=rt.getTriangleNorm(a.points,d),v=r.points[c[0]],w=a.points[d[0]],S=le.planes(v,p,w,_);if(S==null)return null;var P=le.clipRayInCoplanarTriangle(S,r,n);if(P==null)return null;var I=le.clipRayInCoplanarTriangle(S,a,l);if(I==null)return null;var k=le.mergeTriangleClipIntervals(P,I,r,n,a,l);return k==null?null:new wt(new Cr(k.min.uv0,k.min.uv1,k.min.point,n,l),new Cr(k.max.uv0,k.max.uv1,k.max.point,n,l))},le.clipRayInCoplanarTriangle=function(r,n,a){for(var l=n.faces[a],c=[n.points[l[0]],n.points[l[1]],n.points[l[2]]],d=[n.uvs[l[0]],n.uvs[l[1]],n.uvs[l[2]]],p=[m.sub(d[1],d[0]),m.sub(d[2],d[1]),m.sub(d[0],d[2])],_=[m.sub(c[1],c[0]),m.sub(c[2],c[1]),m.sub(c[0],c[2])],v=_.map(m.normalized),w=_.map(m.norm),S=null,P=null,I=0;I<3;){var k=I++,T=c[k],L=v[k],N=le.rays(T,L,r.origin,r.dir);if(N!=null){var R=N.u0,O=N.u1;R<-re.EPSILON||R>w[k]+re.EPSILON||((S==null||O<S.u)&&(S=new wn(O,m.onRay(r.origin,r.dir,O),m.onRay(d[k],p[k],R/w[k]))),(P==null||O>P.u)&&(P=new wn(O,m.onRay(r.origin,r.dir,O),m.onRay(d[k],p[k],R/w[k]))))}}return P==null||S==null?null:new wt(S,P)},le.mergeTriangleClipIntervals=function(r,n,a,l,c,d){if(n.min.u>r.max.u+re.EPSILON||r.min.u>n.max.u+re.EPSILON)return null;var p;r.min.u>n.min.u?p=new tt(r.min,0):p=new tt(n.min,1);var _;r.max.u<n.max.u?_=new tt(r.max,0):_=new tt(n.max,1);var v=new wt(new Cr(null,null,p.item0.point,l,d),new Cr(null,null,_.item0.point,l,d));return p.item1==0?(v.min.uv0=p.item0.uv,v.min.uv1=rt.triangleUVFromPoint(c,d,p.item0.point)):(v.min.uv0=rt.triangleUVFromPoint(a,l,p.item0.point),v.min.uv1=p.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=rt.triangleUVFromPoint(c,d,_.item0.point)):(v.max.uv0=rt.triangleUVFromPoint(a,l,_.item0.point),v.max.uv1=_.item0.uv),v},le.planes=function(r,n,a,l){var c=m.cross(n,l);if(m.dot(c,c)<re.EPSILON)return null;var d=0,p=Math.abs(c[0]),_=Math.abs(c[1]),v=Math.abs(c[2]);_>p&&(d=1,p=_),v>p&&(d=2,p=v);var w,S,P,I;d==0?(w=n[1],S=n[2],P=l[1],I=l[2]):d==1?(w=n[0],S=n[2],P=l[0],I=l[2]):(w=n[0],S=n[1],P=l[0],I=l[1]);var k=-m.dot(r,n),T=-m.dot(a,l),L=w*I-S*P,N=(S*T-k*I)/L,R=(k*P-w*T)/L,O;return d==0?O=[0,N,R]:d==1?O=[N,0,R]:O=[N,R,0],new xn(O,m.normalized(c))},le.threePlanes=function(r,n,a,l,c,d){var p=m.cross(a,c),_=m.dot(r,p);if(Math.abs(_)<re.EPSILON)return null;var v=m.sub(m.mul(d,a),m.mul(l,c)),w=m.add(m.mul(n,p),m.cross(r,v));return m.mul(1/_,w)},le.polylines=function(r,n,a){for(var l=le.boundingBoxTrees(new ar(r),new ar(n),a),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=le.segments(r.points[_],r.points[_+1],n.points[v],n.points[v+1],a);w!=null&&(w.u0=m.lerp(w.u0,[r.params[_]],[r.params[_+1]])[0],w.u1=m.lerp(w.u1,[n.params[v]],[n.params[v+1]])[0],c.push(w))}return c},le.segments=function(r,n,a,l,c){var d=m.sub(n,r),p=Math.sqrt(m.dot(d,d)),_=m.mul(1/p,d),v=m.sub(l,a),w=Math.sqrt(m.dot(v,v)),S=m.mul(1/w,v),P=le.rays(r,_,a,S);if(P!=null){var I=Math.min(Math.max(0,P.u0/p),1),k=Math.min(Math.max(0,P.u1/w),1),T=m.onRay(r,d,I),L=m.onRay(a,v,k),N=m.distSquared(T,L);if(N<c*c)return new Xr(T,L,I,k)}return null},le.rays=function(r,n,a,l){var c=m.dot(n,l),d=m.dot(n,a),p=m.dot(n,r),_=m.dot(l,a),v=m.dot(l,r),w=m.dot(n,n),S=m.dot(l,l),P=w*S-c*c;if(Math.abs(P)<re.EPSILON)return null;var I=c*(d-p)-w*(_-v),k=I/P,T=(d-p+k*c)/w,L=m.onRay(r,n,T),N=m.onRay(a,l,k);return new Xr(L,N,T,k)},le.segmentWithTriangle=function(r,n,a,l){var c=a[l[0]],d=a[l[1]],p=a[l[2]],_=m.sub(d,c),v=m.sub(p,c),w=m.cross(_,v),S=m.sub(n,r),P=m.sub(r,c),I=-m.dot(w,P),k=m.dot(w,S);if(Math.abs(k)<re.EPSILON)return null;var T=I/k;if(T<0||T>1)return null;var L=m.add(r,m.mul(T,S)),N=m.dot(_,v),R=m.dot(_,_),O=m.dot(v,v),F=m.sub(L,c),V=m.dot(F,_),q=m.dot(F,v),J=N*N-R*O;if(Math.abs(J)<re.EPSILON)return null;var H=(N*q-O*V)/J,j=(N*V-R*q)/J;return H>1+re.EPSILON||j>1+re.EPSILON||j<-re.EPSILON||H<-re.EPSILON||H+j>1+re.EPSILON?null:new Yn(L,H,j,T)},le.segmentAndPlane=function(r,n,a,l){var c=m.dot(l,m.sub(n,r));if(Math.abs(c)<re.EPSILON)return null;var d=m.dot(l,m.sub(a,r)),p=d/c;return p>1+re.EPSILON||p<-re.EPSILON?null:{p}};var me=f.eval.Make=function(){};x["verb.eval.Make"]=me,me.__name__=["verb","eval","Make"],me.rationalTranslationalSurface=function(r,n){for(var a=C.rationalCurvePoint(n,K.first(n.knots)),l=K.first(n.knots),c=K.last(n.knots),d=2*n.controlPoints.length,p=(c-l)/(d-1),_=[],v=0;v<d;){var w=v++,S=m.sub(C.rationalCurvePoint(n,l+w*p),a),P=fe.rationalCurveTransform(r,[[1,0,0,S[0]],[0,1,0,S[1]],[0,0,1,S[2]],[0,0,0,1]]);_.push(P)}return me.loftedSurface(_)},me.surfaceBoundaryCurves=function(r){var n=me.surfaceIsocurve(r,K.first(r.knotsU),!1),a=me.surfaceIsocurve(r,K.last(r.knotsU),!1),l=me.surfaceIsocurve(r,K.first(r.knotsV),!0),c=me.surfaceIsocurve(r,K.last(r.knotsV),!0);return[n,a,l,c]},me.surfaceIsocurve=function(r,n,a){a==null&&(a=!1);var l;a?l=r.knotsV:l=r.knotsU;var c;a?c=r.degreeV:c=r.degreeU;for(var d=ve.knotMultiplicities(l),p=-1,_=0,v=d.length;_<v;){var w=_++;if(Math.abs(n-d[w].knot)<re.EPSILON){p=w;break}}var S=c+1;p>=0&&(S=S-d[p].mult);var P;S>0?P=fe.surfaceKnotRefine(r,m.rep(S,n),a):P=r;var I=C.knotSpan(c,n,l);return Math.abs(n-K.first(l))<re.EPSILON?I=0:Math.abs(n-K.last(l))<re.EPSILON&&(I=(a?P.controlPoints[0].length:P.controlPoints.length)-1),a?new je(P.degreeU,P.knotsU,function(k){for(var T,L=[],N=0,R=P.controlPoints;N<R.length;){var O=R[N];++N,L.push(O[I])}return T=L,T}()):new je(P.degreeV,P.knotsV,P.controlPoints[I])},me.loftedSurface=function(r,n){r=fe.unifyCurveKnotVectors(r);var a=r[0].degree;n==null&&(n=3),n>r.length-1&&(n=r.length-1);for(var l=r[0].knots,c=[],d=[],p=0,_=r[0].controlPoints.length;p<_;){var v=[p++],w=r.map(function(P){return function(I){return I.controlPoints[P[0]]}}(v)),S=me.rationalInterpCurve(w,n,!0);d.push(S.controlPoints),c=S.knots}return new et(a,n,l,c,d)},me.clonedCurve=function(r){return new je(r.degree,r.knots.slice(),r.controlPoints.map(function(n){return n.slice()}))},me.rationalBezierCurve=function(r,n){for(var a=r.length-1,l=[],c=0,d=a+1;c<d;)c++,l.push(0);for(var p=0,_=a+1;p<_;)p++,l.push(1);return n==null&&(n=m.rep(r.length,1)),new je(a,l,C.homogenize1d(r,n))},me.fourPointSurface=function(r,n,a,l,c){c==null&&(c=3);for(var d=c,p=[],_=0,v=c+1;_<v;){for(var w=_++,S=[],P=0,I=c+1;P<I;){var k=P++,T=1-w/d,L=m.lerp(T,r,n),N=m.lerp(T,l,a),R=m.lerp(1-k/d,L,N);R.push(1),S.push(R)}p.push(S)}var O=m.rep(c+1,0),F=m.rep(c+1,1);return new et(c,c,O.concat(F),O.concat(F),p)},me.ellipseArc=function(r,n,a,l,c){var d=m.norm(n),p=m.norm(a);n=m.normalized(n),a=m.normalized(a),c<l&&(c=2*Math.PI+l);var _=c-l,v=0;_<=Math.PI/2?v=1:_<=Math.PI?v=2:_<=3*Math.PI/2?v=3:v=4;var w=_/v,S=Math.cos(w/2),P=m.add(r,m.add(m.mul(d*Math.cos(l),n),m.mul(p*Math.sin(l),a))),I=m.sub(m.mul(Math.cos(l),a),m.mul(Math.sin(l),n)),k=[],T=m.zeros1d(2*v+3),L=0,N=l,R=m.zeros1d(v*2);k[0]=P,R[0]=1;for(var O=1,F=v+1;O<F;){var V=O++;N+=w;var q=m.add(r,m.add(m.mul(d*Math.cos(N),n),m.mul(p*Math.sin(N),a)));R[L+2]=1,k[L+2]=q;var J=m.sub(m.mul(Math.cos(N),a),m.mul(Math.sin(N),n)),H=le.rays(P,m.mul(1/m.norm(I),I),q,m.mul(1/m.norm(J),J)),j=m.add(P,m.mul(H.u0,I));R[L+1]=S,k[L+1]=j,L+=2,V<v&&(P=q,I=J)}for(var X=2*v+1,ee=0;ee<3;){var te=ee++;T[te]=0,T[te+X]=1}switch(v){case 2:T[3]=T[4]=.5;break;case 3:T[3]=T[4]=.3333333333333333,T[5]=T[6]=.6666666666666666;break;case 4:T[3]=T[4]=.25,T[5]=T[6]=.5,T[7]=T[8]=.75;break}return new je(2,T,C.homogenize1d(k,R))},me.arc=function(r,n,a,l,c,d){return me.ellipseArc(r,m.mul(l,m.normalized(n)),m.mul(l,m.normalized(a)),c,d)},me.polyline=function(r){for(var n=[0,0],a=0,l=0,c=r.length-1;l<c;){var d=l++;a+=m.dist(r[d],r[d+1]),n.push(a)}n.push(a),n=m.mul(1/a,n);for(var p,_=[],v=0,w=r.length;v<w;)v++,_.push(1);return p=_,new je(1,n,C.homogenize1d(r.slice(0),p))},me.extrudedSurface=function(r,n,a){for(var l=[[],[],[]],c=[[],[],[]],d=C.dehomogenize1d(a.controlPoints),p=C.weight1d(a.controlPoints),_=m.mul(n,r),v=m.mul(.5*n,r),w=0,S=d.length;w<S;){var P=w++;l[2][P]=d[P],l[1][P]=m.add(v,d[P]),l[0][P]=m.add(_,d[P]),c[0][P]=p[P],c[1][P]=p[P],c[2][P]=p[P]}return new et(2,a.degree,[0,0,0,1,1,1],a.knots,C.homogenize2d(l,c))},me.cylindricalSurface=function(r,n,a,l,c){var d=m.cross(r,n),p=me.arc(a,n,d,c,0,2*Math.PI);return me.extrudedSurface(r,l,p)},me.revolvedSurface=function(r,n,a,l){var c=C.dehomogenize1d(r.controlPoints),d=C.weight1d(r.controlPoints),p,_;l<=Math.PI/2?(p=1,_=m.zeros1d(6+2*(p-1))):l<=Math.PI?(p=2,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(p=3,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(p=4,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=l/p,w=3+2*(p-1),S=0;S<3;){var P=S++;_[P]=0,_[w+P]=1}for(var I=Math.cos(v/2),k=0,T=m.zeros1d(p+1),L=m.zeros1d(p+1),N=m.zeros3d(2*p+1,c.length,3),R=m.zeros2d(2*p+1,c.length),O=1,F=p+1;O<F;){var V=O++;k+=v,L[V]=Math.cos(k),T[V]=Math.sin(k)}for(var q=0,J=c.length;q<J;){var H=q++,j=kt.rayClosestPoint(c[H],n,a),X=m.sub(c[H],j),ee=m.norm(X),te=m.cross(a,X);ee>re.EPSILON&&(X=m.mul(1/ee,X),te=m.mul(1/ee,te)),N[0][H]=c[H];var ie=c[H];R[0][H]=d[H];for(var he=te,ae=0,ue=1,ne=p+1;ue<ne;){var de=ue++,Y;ee==0?Y=j:Y=m.add(j,m.add(m.mul(ee*L[de],X),m.mul(ee*T[de],te))),N[ae+2][H]=Y,R[ae+2][H]=d[H];var pe=m.sub(m.mul(L[de],te),m.mul(T[de],X));if(ee==0)N[ae+1][H]=j;else{var Se=le.rays(ie,m.mul(1/m.norm(he),he),Y,m.mul(1/m.norm(pe),pe)),Ge=m.add(ie,m.mul(Se.u0,he));N[ae+1][H]=Ge}R[ae+1][H]=I*d[H],ae+=2,de<p&&(ie=Y,he=pe)}}return new et(2,r.degree,_,r.knots,C.homogenize2d(N,R))},me.sphericalSurface=function(r,n,a,l){var c=me.arc(r,m.mul(-1,n),a,l,0,Math.PI);return me.revolvedSurface(c,r,n,2*Math.PI)},me.conicalSurface=function(r,n,a,l,c){var d=2*Math.PI,p=1,_=[m.add(a,m.mul(l,r)),m.add(a,m.mul(c,n))],v=[0,0,1,1],w=[1,1],S=new je(p,v,C.homogenize1d(_,w));return me.revolvedSurface(S,a,r,d)},me.rationalInterpCurve=function(r,n,a,l,c){if(a==null&&(a=!1),n==null&&(n=3),r.length<n+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],p=1,_=r.length;p<_;){var v=p++,w=m.norm(m.sub(r[v],r[v-1])),S=d[d.length-1];d.push(S+w)}for(var P=d[d.length-1],I=0,k=d.length;I<k;){var T=I++;d[T]=d[T]/P}var L=m.rep(n+1,0),N=l!=null&&c!=null,R;N?R=0:R=1;var O;N?O=d.length-n+1:O=d.length-n;for(var F=R;F<O;){for(var V=F++,q=0,J=0;J<n;){var H=J++;q+=d[V+H]}L.push(1/n*q)}var j=L.concat(m.rep(n+1,1)),X=[],ee;N?ee=r.length+1:ee=r.length-1;var te;N?te=r.length-(n-1):te=r.length-(n+1);for(var ie=0;ie<d.length;){var he=d[ie];++ie;var ae=C.knotSpanGivenN(ee,n,he,j),ue=C.basisFunctionsGivenKnotSpanIndex(ae,he,n,j),ne=ae-n,de=m.zeros1d(ne),Y=m.zeros1d(te-ne);X.push(de.concat(ue).concat(Y))}if(N){var pe=X[0].length-2,Se=[-1,1].concat(m.zeros1d(pe)),Ge=m.zeros1d(pe).concat([-1,1]);K.spliceAndInsert(X,1,0,Se),K.spliceAndInsert(X,X.length-1,0,Ge)}for(var Xe=r[0].length,Fe=[],Ke=(1-j[j.length-n-2])/n,At=j[n+1]/n,Wt=0;Wt<Xe;){var vt=[Wt++],gt;if(!N)gt=r.map(function(Qt){return function(dr){return dr[Qt[0]]}}(vt));else{gt=[r[0][vt[0]]],gt.push(At*l[vt[0]]);for(var Pt=1,Tt=r.length-1;Pt<Tt;){var Kt=Pt++;gt.push(r[Kt][vt[0]])}gt.push(Ke*c[vt[0]]),gt.push(K.last(r)[vt[0]])}var or=Ne.solve(X,gt);Fe.push(or)}var $t=Ne.transpose(Fe);if(!a){var Zt=m.rep($t.length,1);$t=C.homogenize1d($t,Zt)}return new je(n,j,$t)};var fe=f.eval.Modify=function(){};x["verb.eval.Modify"]=fe,fe.__name__=["verb","eval","Modify"],fe.curveReverse=function(r){return new je(r.degree,fe.knotsReverse(r.knots),K.reversed(r.controlPoints))},fe.surfaceReverse=function(r,n){return n==null&&(n=!1),n?new et(r.degreeU,r.degreeV,r.knotsU,fe.knotsReverse(r.knotsV),function(a){for(var l,c=[],d=0,p=r.controlPoints;d<p.length;){var _=p[d];++d,c.push(K.reversed(_))}return l=c,l}()):new et(r.degreeU,r.degreeV,fe.knotsReverse(r.knotsU),r.knotsV,K.reversed(r.controlPoints))},fe.knotsReverse=function(r){var n=K.first(r);K.last(r);for(var a=[n],l=r.length,c=1;c<l;){var d=c++;a.push(a[d-1]+(r[l-d]-r[l-d-1]))}return a},fe.unifyCurveKnotVectors=function(r){r=r.map(me.clonedCurve);for(var n=D.fold(r,function(j,X){return fe.imax(j.degree,X)},0),a=0,l=r.length;a<l;){var c=a++;r[c].degree<n&&(r[c]=fe.curveElevateDegree(r[c],n))}for(var d,p=[],_=0;_<r.length;){var v=r[_];++_,p.push(new wt(K.first(v.knots),K.last(v.knots)))}d=p;for(var w=0,S=r.length;w<S;){var P=w++,I=[d[P].min];r[P].knots=r[P].knots.map(function(j){return function(X){return X-j[0]}}(I))}for(var k=d.map(function(j){return j.max-j.min}),T=D.fold(k,function(j,X){return Math.max(j,X)},0),L=0,N=r.length;L<N;){var R=L++,O=[T/k[R]];r[R].knots=r[R].knots.map(function(j){return function(X){return X*j[0]}}(O))}for(var F=D.fold(r,function(j,X){return m.sortedSetUnion(j.knots,X)},[]),V=0,q=r.length;V<q;){var J=V++,H=m.sortedSetSub(F,r[J].knots);H.length==0&&(r[J]=r[J]),r[J]=fe.curveKnotRefine(r[J],H)}return r},fe.imin=function(r,n){return r<n?r:n},fe.imax=function(r,n){return r>n?r:n},fe.curveElevateDegree=function(r,n){if(n<=r.degree)return r;var a=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,p=n-r.degree,_=r.controlPoints[0].length,v=m.zeros2d(l+p+1,l+1),w=[],S=[],P=[],I=a+l+1,k=n,T=Math.floor(k/2),L=[],N=[];v[0][0]=1,v[k][l]=1;for(var R=1,O=T+1;R<O;)for(var F=R++,V=1/De.get(k,F),q=fe.imin(l,F),J=fe.imax(0,F-p),H=q+1;J<H;){var j=J++;v[F][j]=V*De.get(l,j)*De.get(p,F-j)}for(var X=T+1;X<k;)for(var ee=X++,te=fe.imin(l,ee),ie=fe.imax(0,ee-p),he=te+1;ie<he;){var ae=ie++;v[ee][ae]=v[k-ee][l-ae]}var ue=k+1,ne=-1,de=l,Y=l+1,pe=1,Se=c[0];L[0]=d[0];for(var Ge=0,Xe=k+1;Ge<Xe;){var Fe=Ge++;N[Fe]=Se}for(var Ke=0,At=l+1;Ke<At;){var Wt=Ke++;w[Wt]=d[Wt]}for(;Y<I;){for(var vt=Y;Y<I&&c[Y]==c[Y+1];)Y=Y+1;var gt=Y-vt+1,Pt=c[Y],Tt=ne;ne=l-gt;var Kt;Tt>0?Kt=Math.floor((Tt+2)/2):Kt=1;var or;if(ne>0?or=Math.floor(k-(ne+1)/2):or=k,ne>0){for(var $t=Pt-Se,Zt=[],Qt=l;Qt>gt;)Zt[Qt-gt-1]=$t/(c[de+Qt]-Se),Qt--;for(var dr=1,Tn=ne+1;dr<Tn;){for(var $r=dr++,Mc=ne-$r,Fi=gt+$r,Zr=l;Zr>=Fi;)w[Zr]=m.add(m.mul(Zt[Zr-Fi],w[Zr]),m.mul(1-Zt[Zr-Fi],w[Zr-1])),Zr--;P[Mc]=w[l]}}for(var po=Kt,Tc=k+1;po<Tc;){var Cn=po++;S[Cn]=m.zeros1d(_);for(var Cc=fe.imin(l,Cn),go=fe.imax(0,Cn-p),Nc=Cc+1;go<Nc;){var fo=go++;S[Cn]=m.add(S[Cn],m.mul(v[Cn][fo],w[fo]))}}if(Tt>1)for(var Ui=ue-2,Vi=ue,_o=Pt-Se,Lc=(Pt-N[ue-1])/_o,vo=1;vo<Tt;){for(var ji=vo++,mr=Ui,Qr=Vi,Fr=Qr-ue+1;Qr-mr>ji;){if(mr<pe){var Oc=(Pt-N[mr])/(Se-N[mr]);L[mr]=m.lerp(Oc,L[mr],L[mr-1])}if(Qr>=Kt){if(Qr-ji<=ue-k+Tt){var zc=(Pt-N[Qr-ji])/_o;S[Fr]=m.lerp(zc,S[Fr],S[Fr+1])}}else S[Fr]=m.lerp(Lc,S[Fr],S[Fr+1]);mr=mr+1,Qr=Qr-1,Fr=Fr-1}Ui=Ui-1,Vi=Vi+1}if(de!=l)for(var yo=0,Dc=k-Tt;yo<Dc;)yo++,N[ue]=Se,ue=ue+1;for(var bo=Kt,Rc=or+1;bo<Rc;){var Bc=bo++;L[pe]=S[Bc],pe=pe+1}if(Y<I){for(var xo=0;xo<ne;){var wo=xo++;w[wo]=P[wo]}for(var Ao=ne,Fc=l+1;Ao<Fc;){var Po=Ao++;w[Po]=d[Y-l+Po]}de=Y,Y=Y+1,Se=Pt}else for(var So=0,Uc=k+1;So<Uc;){var Vc=So++;N[ue+Vc]=Pt}}return new je(n,N,L)},fe.rationalSurfaceTransform=function(r,n){for(var a=C.dehomogenize2d(r.controlPoints),l=0,c=a.length;l<c;)for(var d=l++,p=0,_=a[d].length;p<_;){var v=p++,w=a[d][v];w.push(1),a[d][v]=Ne.dot(n,w).slice(0,w.length-1)}return new et(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),C.homogenize2d(a,C.weight2d(r.controlPoints)))},fe.rationalCurveTransform=function(r,n){for(var a=C.dehomogenize1d(r.controlPoints),l=0,c=a.length;l<c;){var d=l++,p=a[d];p.push(1),a[d]=Ne.dot(n,p).slice(0,p.length-1)}return new je(r.degree,r.knots.slice(),C.homogenize1d(a,C.weight1d(r.controlPoints)))},fe.surfaceKnotRefine=function(r,n,a){var l=[],c,d,p;a?(p=r.controlPoints,c=r.knotsV,d=r.degreeV):(p=Ne.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,v=0;v<p.length;){var w=p[v];++v,_=fe.curveKnotRefine(new je(d,c,w),n),l.push(_.controlPoints)}var S=_.knots;return a?new et(r.degreeU,r.degreeV,r.knotsU.slice(),S,l):(l=Ne.transpose(l),new et(r.degreeU,r.degreeV,S,r.knotsV.slice(),l))},fe.decomposeCurveIntoBeziers=function(r){for(var n=r.degree,a=r.controlPoints,l=r.knots,c=ve.knotMultiplicities(l),d=n+1,p=0;p<c.length;){var _=c[p];if(++p,_.mult<d){var v=m.rep(d-_.mult,_.knot),w=fe.curveKnotRefine(new je(n,l,a),v);l=w.knots,a=w.controlPoints}}l.length/d-1;for(var S=d*2,P=[],I=0;I<a.length;){var k=l.slice(I,I+S),T=a.slice(I,I+d);P.push(new je(n,k,T)),I+=d}return P},fe.curveKnotRefine=function(r,n){if(n.length==0)return me.clonedCurve(r);for(var a=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,p=d+a+1,_=n.length-1,v=C.knotSpan(a,n[0],c),w=C.knotSpan(a,n[_],c),S=[],P=[],I=0,k=v-a+1;I<k;){var T=I++;S[T]=l[T]}for(var L=w-1,N=d+1;L<N;){var R=L++;S[R+_+1]=l[R]}for(var O=0,F=v+1;O<F;){var V=O++;P[V]=c[V]}for(var q=w+a,J=p+1;q<J;){var H=q++;P[H+_+1]=c[H]}for(var j=w+a-1,X=w+a+_,ee=_;ee>=0;){for(;n[ee]<=c[j]&&j>v;)S[X-a-1]=l[j-a-1],P[X]=c[j],X=X-1,j=j-1;S[X-a-1]=S[X-a];for(var te=1,ie=a+1;te<ie;){var he=te++,ae=X-a+he,ue=P[X+he]-n[ee];Math.abs(ue)<re.EPSILON?S[ae-1]=S[ae]:(ue=ue/(P[X+he]-c[j-a+he]),S[ae-1]=m.add(m.mul(ue,S[ae-1]),m.mul(1-ue,S[ae])))}P[X]=n[ee],X=X-1,ee--}return new je(a,P,S)},fe.curveKnotInsert=function(r,n,a){for(var l=r.degree,c=r.controlPoints,d=r.knots,p=0,_=c.length,v=C.knotSpan(l,n,d),w=[],S=[],P=[],I=1,k=v+1;I<k;){var T=I++;S[T]=d[T]}for(var L=1,N=a+1;L<N;){var R=L++;S[v+R]=n}for(var O=v+1,F=d.length;O<F;){var V=O++;S[V+a]=d[V]}for(var q=0,J=v-l+1;q<J;){var H=q++;P[H]=c[H]}for(var j=v-p;j<_;){var X=j++;P[X+a]=c[X]}for(var ee=0,te=l-p+1;ee<te;){var ie=ee++;w[ie]=c[v-l+ie]}for(var he=0,ae=0,ue=1,ne=a+1;ue<ne;){var de=ue++;he=v-l+de;for(var Y=0,pe=l-de-p+1;Y<pe;){var Se=Y++;ae=(n-d[he+Se])/(d[Se+v+1]-d[he+Se]),w[Se]=m.add(m.mul(ae,w[Se+1]),m.mul(1-ae,w[Se]))}P[he]=w[0],P[v+a-de-p]=w[l-de-p]}for(var Ge=he+1,Xe=v-p;Ge<Xe;){var Fe=Ge++;P[Fe]=w[Fe-he]}return new je(l,S,P)};var Oe=f.eval.Tess=function(){};x["verb.eval.Tess"]=Oe,Oe.__name__=["verb","eval","Tess"],Oe.rationalCurveRegularSample=function(r,n,a){return Oe.rationalCurveRegularSampleRange(r,r.knots[0],K.last(r.knots),n,a)},Oe.rationalCurveRegularSampleRange=function(r,n,a,l,c){l<1&&(l=2);for(var d=[],p=(a-n)/(l-1),_=0,v=0;v<l;){var w=v++;_=n+p*w,c?d.push([_].concat(C.rationalCurvePoint(r,_))):d.push(C.rationalCurvePoint(r,_))}return d},Oe.rationalCurveAdaptiveSample=function(r,n,a){if(a==null&&(a=!1),n==null&&(n=1e-6),r.degree==1)if(a){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var p=c++;l.push([r.knots[p+1]].concat(C.dehomogenize(r.controlPoints[p])))}return l}else return r.controlPoints.map(C.dehomogenize);return Oe.rationalCurveAdaptiveSampleRange(r,r.knots[0],K.last(r.knots),n,a)},Oe.rationalCurveAdaptiveSampleRange=function(r,n,a,l,c){var d=C.rationalCurvePoint(r,n),p=C.rationalCurvePoint(r,a),_=.5+.2*Math.random(),v=n+(a-n)*_,w=C.rationalCurvePoint(r,v),S=m.sub(d,p),P=m.sub(d,w);if(m.dot(S,S)<l&&m.dot(P,P)>l||!kt.threePointsAreFlat(d,w,p,l)){var I=n+(a-n)*.5,k=Oe.rationalCurveAdaptiveSampleRange(r,n,I,l,c),T=Oe.rationalCurveAdaptiveSampleRange(r,I,a,l,c);return k.slice(0,-1).concat(T)}else return c?[[n].concat(d),[a].concat(p)]:[d,p]},Oe.rationalSurfaceNaive=function(r,n,a){n<1&&(n=1),a<1&&(a=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=K.last(l)-l[0],p=K.last(c)-c[0],_=d/n,v=p/a,w=[],S=[],P=[],I=0,k=n+1;I<k;)for(var T=I++,L=0,N=a+1;L<N;){var R=L++,O=T*_,F=R*v;S.push([O,F]);var V=C.rationalSurfaceDerivatives(r,O,F,1),q=V[0][0];w.push(q);var J=m.normalized(m.cross(V[1][0],V[0][1]));P.push(J)}for(var H=[],j=0;j<n;)for(var X=j++,ee=0;ee<a;){var te=ee++,ie=X*(a+1)+te,he=(X+1)*(a+1)+te,ae=he+1,ue=ie+1,ne=[ie,he,ae],de=[ie,ae,ue];H.push(ne),H.push(de)}return new qt(H,w,P,S)},Oe.divideRationalSurfaceAdaptive=function(r,n){n==null&&(n=new Or),n.minDivsU!=null?n.minDivsU=n.minDivsU:n.minDivsU=1,n.minDivsV!=null?n.minDivsU=n.minDivsV:n.minDivsU=1,n.refine!=null?n.refine=n.refine:n.refine=!0;var a=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;n.minDivsU>a?c=n.minDivsU=n.minDivsU:c=n.minDivsU=a;var d;n.minDivsV>l?d=n.minDivsV=n.minDivsV:d=n.minDivsV=l;for(var p=K.last(r.knotsU),_=r.knotsU[0],v=K.last(r.knotsV),w=r.knotsV[0],S=(p-_)/c,P=(v-w)/d,I=[],k=[],T=0,L=d+1;T<L;){for(var N=T++,R=[],O=0,F=c+1;O<F;){var V=O++,q=_+S*V,J=w+P*N,H=C.rationalSurfaceDerivatives(r,q,J,1),j=m.normalized(m.cross(H[0][1],H[1][0]));R.push(new jt(H[0][0],j,[q,J],-1,m.isZero(j)))}k.push(R)}for(var X=0;X<d;)for(var ee=X++,te=0;te<c;){var ie=te++,he=[k[d-ee-1][ie],k[d-ee-1][ie+1],k[d-ee][ie+1],k[d-ee][ie]];I.push(new ur(r,he))}if(!n.refine)return I;for(var ae=0;ae<d;)for(var ue=ae++,ne=0;ne<c;){var de=ne++,Y=ue*c+de,pe=Oe.north(Y,ue,de,c,d,I),Se=Oe.east(Y,ue,de,c,d,I),Ge=Oe.south(Y,ue,de,c,d,I),Xe=Oe.west(Y,ue,de,c,d,I);I[Y].neighbors=[Ge,Se,pe,Xe],I[Y].divide(n)}return I},Oe.north=function(r,n,a,l,c,d){return n==0?null:d[r-l]},Oe.south=function(r,n,a,l,c,d){return n==c-1?null:d[r+l]},Oe.east=function(r,n,a,l,c,d){return a==l-1?null:d[r+1]},Oe.west=function(r,n,a,l,c,d){return a==0?null:d[r-1]},Oe.triangulateAdaptiveRefinementNodeTree=function(r){for(var n=qt.empty(),a=0;a<r.length;){var l=r[a];++a,l.triangulate(n)}return n},Oe.rationalSurfaceAdaptive=function(r,n){n!=null?n=n:n=new Or;var a=Oe.divideRationalSurfaceAdaptive(r,n);return Oe.triangulateAdaptiveRefinementNodeTree(a)};var Or=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=Or,Or.__name__=["verb","eval","AdaptiveRefinementOptions"],Or.prototype={__class__:Or};var ur=f.core.AdaptiveRefinementNode=function(r,n,a){if(this.srf=r,a==null?this.neighbors=[null,null,null,null]:this.neighbors=a,this.corners=n,this.corners==null){var l=r.knotsU[0],c=K.last(r.knotsU),d=r.knotsV[0],p=K.last(r.knotsV);this.corners=[jt.fromUv(l,d),jt.fromUv(c,d),jt.fromUv(c,p),jt.fromUv(l,p)]}};x["verb.eval.AdaptiveRefinementNode"]=ur,ur.__name__=["verb","eval","AdaptiveRefinementNode"],ur.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var n=r++;if(this.corners[n].point==null){var a=this.corners[n];this.evalSrf(a.uv[0],a.uv[1],a)}}},evalSrf:function(r,n,a){var l=C.rationalSurfaceDerivatives(this.srf,r,n,1),c=l[0][0],d=m.cross(l[0][1],l[1][0]),p=m.isZero(d);return p||(d=m.normalized(d)),a!=null?(a.degen=p,a.point=c,a.normal=d,a):new jt(c,d,[r,n],-1,p)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var n=[this.corners[r]];if(this.neighbors[r]==null)return n;var a=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=re.EPSILON,d=this,p=[function(v){return v.uv[0]>d.corners[0].uv[0]+c&&v.uv[0]<d.corners[2].uv[0]-c},function(v){return v.uv[1]>d.corners[0].uv[1]+c&&v.uv[1]<d.corners[2].uv[1]-c}],_=a.filter(p[l]);return _.reverse(),n.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,n=0;n<r;){var a=n++;if(this.corners[a],this.corners[a].degen){var l=this.corners[(a+1)%r],c=this.corners[(a+3)%r];l.degen?this.corners[a].normal=c.normal:this.corners[a].normal=l.normal}}},shouldDivide:function(r,n){if(n<r.minDepth)return!0;if(n>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=m.normSquared(m.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=m.normSquared(m.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var a=this.center();return m.normSquared(m.sub(a.normal,this.corners[0].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new Or),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,n,a){if(this.evalCorners(),!!this.shouldDivide(r,n)){if(n++,this.splitVert&&!this.splitHoriz?a=!1:!this.splitVert&&this.splitHoriz&&(a=!0),this.horizontal=a,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new ur(this.srf,l),new ur(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],p=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new ur(this.srf,d),new ur(this.srf,p)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,v=this.children;_<v.length;){var w=v[_];++_,w._divide(r,n,!a)}}},triangulate:function(r){if(r==null&&(r=qt.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var n=0,a=this.children;n<a.length;){var l=a[n];if(++n,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var n=r.points.length,a=[],l=[],c=0,d=0;d<4;){var p=d++,_=this.getAllCorners(p);_.length==2&&(c=p+1);for(var v=0,w=_.length;v<w;){var S=v++;a.push(_[S])}}for(var P=0;P<a.length;){var I=a[P];if(++P,I.id!=-1){l.push(I.id);continue}r.uvs.push(I.uv),r.points.push(I.point),r.normals.push(I.normal),I.id=n,l.push(n),n++}if(a.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(a.length==5){var k=l.length;return r.faces.push([l[c],l[(c+2)%k],l[(c+1)%k]]),r.faces.push([l[(c+4)%k],l[(c+3)%k],l[c]]),r.faces.push([l[c],l[(c+3)%k],l[(c+2)%k]]),r}var T=this.center();r.uvs.push(T.uv),r.points.push(T.point),r.normals.push(T.normal);for(var L=r.points.length-1,N=0,R=a.length-1;N<a.length;)r.faces.push([L,l[N],l[R]]),R=N++;return r},__class__:ur};var we=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=we,we.__name__=["verb","exe","Dispatcher"],we.init=function(){we._init||(we._workerPool=new zr(we.THREADS),we._init=!0)},we.dispatchMethod=function(r,n,a){we.init();var l=new yn,c=function(d){l.resolve(d)};return we._workerPool.addWork(ce.getClassName(r),n,a,c),new pt(l)};var zr=f.exe.WorkerPool=function(r,n){n==null&&(n="verb.js"),r==null&&(r=1),this._callbacks=new xe,this._working=new xe,this._pool=[],this._queue=[];for(var a=0;a<r;){a++;var l;try{l=new Worker(zr.basePath+n)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(zr.basePath+n.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=zr,zr.__name__=["verb","exe","WorkerPool"],zr.prototype={addWork:function(r,n,a,l){var c=new Kr(r,n,a);this._callbacks.set(c.id,l),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var n=this._queue.shift(),a=[n.id],l=[this._pool.shift()];this._working.h[a[0]]=l[0],l[0].onmessage=function(c,d){return function(p){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](p.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,a),l[0].postMessage(n)}},__class__:zr};var Kr=function(r,n,a){this.className=r,this.methodName=n,this.args=a,this.id=Kr.uuid++};x["verb.exe._WorkerPool.Work"]=Kr,Kr.__name__=["verb","exe","_WorkerPool","Work"],Kr.prototype={__class__:Kr};var kn=function(){};x["verb.geom.ICurve"]=kn,kn.__name__=["verb","geom","ICurve"],kn.__interfaces__=[Sn],kn.prototype={__class__:kn};var Ce=f.geom.NurbsCurve=function(r){this._data=Gt.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=Ce,Ce.__name__=["verb","geom","NurbsCurve"],Ce.__interfaces__=[kn],Ce.byKnotsControlPointsWeights=function(r,n,a,l){return new Ce(new je(r,n.slice(),C.homogenize1d(a,l)))},Ce.byPoints=function(r,n){return n==null&&(n=3),new Ce(me.rationalInterpCurve(r,n))},Ce.__super__=Ze,Ce.prototype=M(Ze.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new je(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Ce(this._data)},domain:function(){return new wt(K.first(this._data.knots),K.last(this._data.knots))},transform:function(r){return new Ce(fe.rationalCurveTransform(this._data,r))},transformAsync:function(r){return we.dispatchMethod(fe,"rationalCurveTransform",[this._data,r]).then(function(n){return new Ce(n)})},point:function(r){return C.rationalCurvePoint(this._data,r)},pointAsync:function(r){return we.dispatchMethod(C,"rationalCurvePoint",[this._data,r])},tangent:function(r){return C.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return we.dispatchMethod(C,"rationalCurveTangent",[this._data,r])},derivatives:function(r,n){return n==null&&(n=1),C.rationalCurveDerivatives(this._data,r,n)},derivativesAsync:function(r,n){return n==null&&(n=1),we.dispatchMethod(C,"rationalCurveDerivatives",[this._data,r,n])},closestPoint:function(r){return ve.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return we.dispatchMethod(ve,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return ve.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return we.dispatchMethod(ve,"rationalCurveClosestParam",[this._data,r])},length:function(){return ve.rationalCurveArcLength(this._data)},lengthAsync:function(){return we.dispatchMethod(ve,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return ve.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return we.dispatchMethod(ve,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,n){return ve.rationalCurveParamAtArcLength(this._data,r,n)},paramAtLengthAsync:function(r,n){return we.dispatchMethod(ve,"rationalCurveParamAtArcLength",[this._data,r,n])},divideByEqualArcLength:function(r){return lt.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return we.dispatchMethod(lt,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return lt.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return we.dispatchMethod(lt,"rationalCurveByArcLength",[this._data,r])},split:function(r){return lt.curveSplit(this._data,r).map(function(n){return new Ce(n)})},splitAsync:function(r){return we.dispatchMethod(lt,"curveSplit",[this._data,r]).then(function(n){return n.map(function(a){return new Ce(a)})})},reverse:function(){return new Ce(fe.curveReverse(this._data))},reverseAsync:function(){return we.dispatchMethod(fe,"curveReverse",[this._data]).then(function(r){return new Ce(r)})},tessellate:function(r){return Oe.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return we.dispatchMethod(Oe,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Ce});var Dr=f.geom.Arc=function(r,n,a,l,c,d){Ce.call(this,me.arc(r,n,a,l,c,d)),this._center=r,this._xaxis=n,this._yaxis=a,this._radius=l,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Dr,Dr.__name__=["verb","geom","Arc"],Dr.__super__=Ce,Dr.prototype=M(Ce.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Dr});var Qn=f.geom.BezierCurve=function(r,n){Ce.call(this,me.rationalBezierCurve(r,n))};x["verb.geom.BezierCurve"]=Qn,Qn.__name__=["verb","geom","BezierCurve"],Qn.__super__=Ce,Qn.prototype=M(Ce.prototype,{__class__:Qn});var Jn=f.geom.Circle=function(r,n,a,l){Dr.call(this,r,n,a,l,0,Math.PI*2)};x["verb.geom.Circle"]=Jn,Jn.__name__=["verb","geom","Circle"],Jn.__super__=Dr,Jn.prototype=M(Dr.prototype,{__class__:Jn});var Mn=function(){};x["verb.geom.ISurface"]=Mn,Mn.__name__=["verb","geom","ISurface"],Mn.__interfaces__=[Sn],Mn.prototype={__class__:Mn};var Ie=f.geom.NurbsSurface=function(r){this._data=Gt.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Ie,Ie.__name__=["verb","geom","NurbsSurface"],Ie.__interfaces__=[Mn],Ie.byKnotsControlPointsWeights=function(r,n,a,l,c,d){return new Ie(new et(r,n,a,l,C.homogenize2d(c,d)))},Ie.byCorners=function(r,n,a,l){return new Ie(me.fourPointSurface(r,n,a,l))},Ie.byLoftingCurves=function(r,n){return new Ie(me.loftedSurface(function(a){for(var l,c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.asNurbs())}return l=c,l}(),n))},Ie.__super__=Ze,Ie.prototype=M(Ze.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new et(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Ie(this.asNurbs())},domainU:function(){return new wt(K.first(this._data.knotsU),K.last(this._data.knotsU))},domainV:function(){return new wt(K.first(this._data.knotsV),K.last(this._data.knotsV))},point:function(r,n){return C.rationalSurfacePoint(this._data,r,n)},pointAsync:function(r,n){return we.dispatchMethod(C,"rationalSurfacePoint",[this._data,r,n])},normal:function(r,n){return C.rationalSurfaceNormal(this._data,r,n)},normalAsync:function(r,n){return we.dispatchMethod(C,"rationalSurfaceNormal",[this._data,r,n])},derivatives:function(r,n,a){return a==null&&(a=1),C.rationalSurfaceDerivatives(this._data,r,n,a)},derivativesAsync:function(r,n,a){return a==null&&(a=1),we.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,r,n,a])},closestParam:function(r){return ve.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return we.dispatchMethod(ve,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return ve.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return we.dispatchMethod(ve,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,n){return n==null&&(n=!1),lt.surfaceSplit(this._data,r,n).map(function(a){return new Ie(a)})},splitAsync:function(r,n){return n==null&&(n=!1),we.dispatchMethod(lt,"surfaceSplit",[this._data,r,n]).then(function(a){return a.map(function(l){return new Ie(l)})})},reverse:function(r){return r==null&&(r=!1),new Ie(fe.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),we.dispatchMethod(fe,"surfaceReverse",[this._data,r]).then(function(n){return new Ie(n)})},isocurve:function(r,n){return n==null&&(n=!1),new Ce(me.surfaceIsocurve(this._data,r,n))},isocurveAsync:function(r,n){return n==null&&(n=!1),we.dispatchMethod(me,"surfaceIsocurve",[this._data,r,n]).then(function(a){return new Ce(a)})},boundaries:function(r){return me.surfaceBoundaryCurves(this._data).map(function(n){return new Ce(n)})},boundariesAsync:function(r){return we.dispatchMethod(me,"surfaceBoundaryCurves",[this._data]).then(function(n){return n.map(function(a){return new Ce(a)})})},tessellate:function(r){return Oe.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return we.dispatchMethod(Oe,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Ie(fe.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return we.dispatchMethod(fe,"rationalSurfaceTransform",[this._data,r]).then(function(n){return new Ie(n)})},__class__:Ie});var es=f.geom.ConicalSurface=function(r,n,a,l,c){Ie.call(this,me.conicalSurface(r,n,a,l,c)),this._axis=r,this._xaxis=n,this._base=a,this._height=l,this._radius=c};x["verb.geom.ConicalSurface"]=es,es.__name__=["verb","geom","ConicalSurface"],es.__super__=Ie,es.prototype=M(Ie.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:es});var ts=f.geom.CylindricalSurface=function(r,n,a,l,c){Ie.call(this,me.cylindricalSurface(r,n,a,l,c)),this._axis=r,this._xaxis=n,this._base=a,this._height=l,this._radius=c};x["verb.geom.CylindricalSurface"]=ts,ts.__name__=["verb","geom","CylindricalSurface"],ts.__super__=Ie,ts.prototype=M(Ie.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:ts});var Rr=f.geom.EllipseArc=function(r,n,a,l,c){Ce.call(this,me.ellipseArc(r,n,a,l,c)),this._center=r,this._xaxis=n,this._yaxis=a,this._minAngle=l,this._maxAngle=c};x["verb.geom.EllipseArc"]=Rr,Rr.__name__=["verb","geom","EllipseArc"],Rr.__super__=Ce,Rr.prototype=M(Ce.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Rr});var rs=f.geom.Ellipse=function(r,n,a){Rr.call(this,r,n,a,0,Math.PI*2)};x["verb.geom.Ellipse"]=rs,rs.__name__=["verb","geom","Ellipse"],rs.__super__=Rr,rs.prototype=M(Rr.prototype,{__class__:rs});var ns=f.geom.ExtrudedSurface=function(r,n){Ie.call(this,me.extrudedSurface(m.normalized(n),m.norm(n),r.asNurbs())),this._profile=r,this._direction=n};x["verb.geom.ExtrudedSurface"]=ns,ns.__name__=["verb","geom","ExtrudedSurface"],ns.__super__=Ie,ns.prototype=M(Ie.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:ns});var Br=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=Br,Br.__name__=["verb","geom","Intersect"],Br.curves=function(r,n,a){return a==null&&(a=.001),le.curves(r.asNurbs(),n.asNurbs(),a)},Br.curvesAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"curves",[r.asNurbs(),n.asNurbs(),a])},Br.curveAndSurface=function(r,n,a){return a==null&&(a=.001),le.curveAndSurface(r.asNurbs(),n.asNurbs(),a)},Br.curveAndSurfaceAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"curveAndSurface",[r.asNurbs(),n.asNurbs(),a])},Br.surfaces=function(r,n,a){return a==null&&(a=.001),le.surfaces(r.asNurbs(),n.asNurbs(),a).map(function(l){return new Ce(l)})},Br.surfacesAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"surfaces",[r.asNurbs(),n.asNurbs(),a]).then(function(l){return l.map(function(c){return new Ce(c)})})};var ss=f.geom.Line=function(r,n){Ce.call(this,me.polyline([r,n])),this._start=r,this._end=n};x["verb.geom.Line"]=ss,ss.__name__=["verb","geom","Line"],ss.__super__=Ce,ss.prototype=M(Ce.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:ss});var is=f.geom.RevolvedSurface=function(r,n,a,l){Ie.call(this,me.revolvedSurface(r.asNurbs(),n,a,l)),this._profile=r,this._center=n,this._axis=a,this._angle=l};x["verb.geom.RevolvedSurface"]=is,is.__name__=["verb","geom","RevolvedSurface"],is.__super__=Ie,is.prototype=M(Ie.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:is});var as=f.geom.SphericalSurface=function(r,n){Ie.call(this,me.sphericalSurface(r,[0,0,1],[1,0,0],n)),this._center=r,this._radius=n};x["verb.geom.SphericalSurface"]=as,as.__name__=["verb","geom","SphericalSurface"],as.__super__=Ie,as.prototype=M(Ie.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:as});var os=f.geom.SweptSurface=function(r,n){Ie.call(this,me.rationalTranslationalSurface(r.asNurbs(),n.asNurbs())),this._profile=r,this._rail=n};x["verb.geom.SweptSurface"]=os,os.__name__=["verb","geom","SweptSurface"],os.__super__=Ie,os.prototype=M(Ie.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:os});function Xt(r){return r instanceof Array?function(){return z.iter(r)}:typeof r.iterator=="function"?Mt(r,r.iterator):r.iterator}var Di,Ic=0;function Mt(r,n){if(n==null)return null;n.__id__==null&&(n.__id__=Ic++);var a;return r.hx__closures__==null?r.hx__closures__={}:a=r.hx__closures__[n.__id__],a==null&&(a=function(){return a.method.apply(a.scope,arguments)},a.scope=r,a.method=n,r.hx__closures__[n.__id__]=a),a}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var Ec=x.Int={__name__:["Int"]},kc=x.Dynamic={__name__:["Dynamic"]},ho=x.Float=Number;ho.__name__=["Float"];var co=x.Bool=Boolean;co.__ename__=["Bool"];var uo=x.Class={__name__:["Class"]},mo={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var n=[],a=0,l=this.length;a<l;){var c=a++;n[c]=r(this[c])}return n}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var n=[],a=0,l=this.length;a<l;){var c=a++,d=this[c];r(d)&&n.push(d)}return n});var Ri={},Us=A.ArrayBuffer||ot;Us.prototype.slice==null&&(Us.prototype.slice=ot.sliceImpl),A.DataView;var Bi=A.Uint8Array||nr._new;(function(r,n){if(r.setImmediate)return;var a=1,l={},c=!1,d=r.document,p;function _(O){return l[a]=v.apply(n,O),a++}function v(O){var F=[].slice.call(arguments,1);return function(){typeof O=="function"?O.apply(n,F):new Function(""+O)()}}function w(O){if(c)setTimeout(v(w,O),0);else{var F=l[O];if(F){c=!0;try{F()}finally{S(O),c=!1}}}}function S(O){delete l[O]}function P(){p=function(){var O=_(arguments);return process.nextTick(v(w,O)),O}}function I(){if(r.postMessage&&!r.importScripts){var O=!0,F=r.onmessage;return r.onmessage=function(){O=!1},r.postMessage("","*"),r.onmessage=F,O}}function k(){var O="setImmediate$"+Math.random()+"$",F=function(V){V.source===r&&typeof V.data=="string"&&V.data.indexOf(O)===0&&w(+V.data.slice(O.length))};r.addEventListener?r.addEventListener("message",F,!1):r.attachEvent("onmessage",F),p=function(){var V=_(arguments);return r.postMessage(O+V,"*"),V}}function T(){var O=new MessageChannel;O.port1.onmessage=function(F){var V=F.data;w(V)},p=function(){var F=_(arguments);return O.port2.postMessage(F),F}}function L(){var O=d.documentElement;p=function(){var F=_(arguments),V=d.createElement("script");return V.onreadystatechange=function(){w(F),V.onreadystatechange=null,O.removeChild(V),V=null},O.appendChild(V),F}}function N(){p=function(){var O=_(arguments);return setTimeout(v(w,O),0),O}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?P():I()?k():r.MessageChannel?T():d&&"onreadystatechange"in d.createElement("script")?L():N(),R.setImmediate=p,R.clearImmediate=S})(new Function("return this")()),Ye.USE_CACHE=!1,Ye.USE_ENUM_INDEX=!1,Ye.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",We.DEFAULT_RESOLVER=ce,We.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Le.count=0,at.i64tmp=function(r){var n,a=new Ve(0,0);return n=a,n}(),Te.__toStr={}.toString,nr.BYTES_PER_ELEMENT=1,Pe.queue=new U,De.memo=new xe,re.TOLERANCE=1e-6,re.EPSILON=1e-10,re.VERSION="2.0.0",ve.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],ve.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],we.THREADS=1,we._init=!1,zr.basePath="",Kr.uuid=0,Bs.main()}(typeof console<"u"?console:{log:function(){}},t,typeof u<"u"?u:typeof s<"u"?s:typeof self<"u"?self:this),t})})(Xh);var Hd=Xh.exports;const On=Wd(Hd);class na{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(e,t,s,o){this.c0=e,this.c1=s,this.c2=-3*e+3*t-2*s-o,this.c3=2*e-2*t+s+o}initCatmullRom(e,t,s,o,h){this.init(t,s,h*(s-e),h*(o-t))}initNonuniformCatmullRom(e,t,s,o,h,u,g){let b=(t-e)/h-(s-e)/(h+u)+(s-t)/u,f=(s-t)/u-(o-t)/(u+g)+(o-s)/g;b*=u,f*=u,this.init(t,s,b,f)}calc(e){const t=e*e,s=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*s}}class Kh extends Ds{constructor(e=[],t=!1,s="centripetal",o=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new Z,this._px=new na,this._py=new na,this._pz=new na,this._points=e.map(h=>new $(h)),this._closed=t,this._curveType=s,this._tension=o}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new $}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new $}get length(){if(this._points.length<2)return 0;let e=0;for(let t=1;t<this._points.length;t++)e+=this._points[t-1].distanceTo(this._points[t]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e}getPoint(e,t=new $){const s=t,o=this._points,h=o.length;if(h===0)return s.set(0,0,0);if(h===1)return s.copy(o[0]);const u=(h-(this._closed?0:1))*e;let g=Math.floor(u),b=u-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,A;this._closed||g>0?f=o[(g-1)%h]:(this._tmp.subVectors(o[0],o[1]).add(o[0]),f=new $(this._tmp.x,this._tmp.y,this._tmp.z));const x=o[g%h],E=o[(g+1)%h];if(this._closed||g+2<h?A=o[(g+2)%h]:(this._tmp.subVectors(o[h-1],o[h-2]).add(o[h-1]),A=new $(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const M=this._curveType==="chordal"?.5:.25;let z=Math.pow(f.distanceToSquared(x),M),D=Math.pow(x.distanceToSquared(E),M),U=Math.pow(E.distanceToSquared(A),M);D<1e-4&&(D=1),z<1e-4&&(z=D),U<1e-4&&(U=D),this._px.initNonuniformCatmullRom(f.x,x.x,E.x,A.x,z,D,U),this._py.initNonuniformCatmullRom(f.y,x.y,E.y,A.y,z,D,U),this._pz.initNonuniformCatmullRom(f.z,x.z,E.z,A.z,z,D,U)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,E.x,A.x,this._tension),this._py.initCatmullRom(f.y,x.y,E.y,A.y,this._tension),this._pz.initCatmullRom(f.z,x.z,E.z,A.z,this._tension));return s.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),s}getPoints(e){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}setPoints(e){this._points=e.map(t=>new $(t)),this._boundingBoxNeedsUpdate=!0}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)}setCurveType(e){this._curveType=e}setTension(e){this._tension=e}transform(e){return this._points=this._points.map(t=>{const s=new $;return s.copy(t),s.applyMatrix3d(e),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Re;const e=new Re;return this._points.forEach(t=>{e.expandByPoint(t)}),e}}class pn{constructor(e,t,s,o){this._degree=e,this._knots=[...t],this._controlPoints=s.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=o?[...o]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z}))}weights(){return[...this._weights]}point(e){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return Ms(e,this._degree,this._knots,t,this._weights)}length(){const e=this._controlPoints.map(t=>[t.x,t.y,t.z]);return Vh(this._degree,this._knots,e,this._weights)}static byKnotsControlPointsWeights(e,t,s,o){return new pn(e,t,s,o)}static byPoints(e,t,s="Uniform"){let o;switch(s){case"Chord":o=Fh(t,e);break;case"SqrtChord":o=Uh(t,e);break;case"Uniform":default:o=Bh(t,e.length);break}const h=e.map(g=>({x:g[0],y:g[1],z:g[2]})),u=new Array(h.length).fill(1);return new pn(t,o,h,u)}getParameterRange(){const e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}}getPoints(e){const t=[],{start:s,end:o}=this.getParameterRange();for(let h=0;h<=e;h++){const u=s+(o-s)*(h/e);t.push(this.point(u))}return t}isClosed(e=1e-6){const{start:t,end:s}=this.getParameterRange(),o=this.point(t),h=this.point(s),u=o[0]-h[0],g=o[1]-h[1],b=o[2]-h[2];return Math.sqrt(u*u+g*g+b*b)<e}static createFitPointsForClosedCurve(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const t=new Kh(e,!0,"centripetal"),s=Math.max(50,e.length*2);return t.getPoints(s)}static createClosedCurve(e,t,s="Chord"){const o=this.createFitPointsForClosedCurve(e).map(h=>[h.x,h.y,h.z]);return pn.byPoints(o,t,s)}}class qr extends Ds{constructor(e,t,s,o,h){super();const u=arguments.length;if(u<2||u>5)throw Ut.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(t)){this._controlPoints=e;let g,b=3,f=!1;if(u>=3&&(Array.isArray(s)?(g=s,u>=4&&(b=o||3),u>=5&&(f=h)):s!==void 0&&(b=s||3,u>=4&&(f=o))),s===void 0&&u>=4&&(b=o||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Ut.ILLEGAL_PARAMETERS;const A=this.toVerbPoints(this._controlPoints);this._nurbsCurve=On.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,A,g)}else{if(this._fitPoints=e,this._knotParameterization=t,u>=3&&(this._degree=s||3),u>=4&&(this._closed=o),this._fitPoints.length<this._degree+1)throw Ut.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=On.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const e=pn.createFitPointsForClosedCurve(this._fitPoints),t=this.toNurbsPoints(e);this._nurbsCurve=On.geom.NurbsCurve.byPoints(t,this._degree)}else{const e=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=On.geom.NurbsCurve.byPoints(e,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const e=pn.createFitPointsForClosedCurve(this._controlPoints),t=this.toNurbsPoints(e);this._nurbsCurve=On.geom.NurbsCurve.byPoints(t,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const e=this._nurbsCurve.knots(),t=this._nurbsCurve.weights(),s=this.toVerbPoints(this._controlPoints);this._nurbsCurve=On.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,s,t)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[t],o=this._nurbsCurve.point(s);return new $(o[0],o[1],o[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[e.length-t-1],o=this._nurbsCurve.point(s);return new $(o[0],o[1],o[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,s=e<0||e>=t?t-1:e,o=this._fitPoints[s];return{x:o.x,y:o.y,z:o.z||0}}getControlPointAt(e){const t=this._controlPoints.length,s=e<0||e>=t?t-1:e;return this._controlPoints[s]}getPoints(e=100){const t=this._nurbsCurve,s=[],o=t.knots(),h=this._nurbsCurve.degree(),u=o[h],g=o[o.length-h-1],b=(g-u)/(e-1);for(let f=0;f<e;f++){const A=f===e-1?g:u+f*b,x=t.point(A);s.push(new $(x[0],x[1],x[2]))}return s}getCurvePoints(e,t){const s=[],o=e.knots(),h=o[3],u=(o[o.length-4]-h)/(t-1);for(let g=0;g<t;g++){const b=h+g*u;s.push(e.point(b))}return s}calculateBoundingBox(){const e=this.getPoints(100);return new Re().setFromPoints(e)}get closed(){return this._closed}set closed(e){this.setClosed(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]=[s.x,s.y,s.z||0]}),t}toVerbPoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]=[s.x,s.y,s.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]={x:s[0],y:s[1],z:s[2]}}),t}static createClosedSpline(e,t="Uniform",s=3){if(e.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new qr(e,t,s,!0)}}var un=256,$h=[],Fo=256,Ws;for(;un--;)$h[un]=(un+256).toString(16).substring(1);function qd(i){var e=0,t=11;if(!Ws||un+t>Fo*2)for(Ws="",un=0;e<Fo;e++)Ws+=$h[Math.random()*256|0];return Ws.substring(un,un+++t)}class Yr{constructor(e,t){e=e||{},Bn(e,{objectId:qd()}),this._attrs=new Ko(e,t)}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get database(){return this._database?this._database:Oa().workingDatabase}set database(e){this._database=e}close(){}}const za=class za extends Yr{constructor(){super(...arguments),this._layer="0",this._color=new fn,this._lineType=Qs,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(e){this._layer=e}get color(){return this._color}set color(e){this._color.copy(e)}get rgbColor(){let e=this.database.cecolor;if(this.color.isByLayer){const t=this.getLayerColor();t&&t.color&&(e=t)}else this.color.isByBlock||this.color.color!=null&&(e=this.color);return e.color==null?16777215:e.color}get lineType(){return this._lineType}set lineType(e){this._lineType=e||Qs}get lineWeight(){return this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,s,o,h){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const e=this.getLineType(),t=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(e);return t?{...t.linetype,color:this.rgbColor}:{name:e,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Qs){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==uh?ei:this.lineType;return ei}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return e.color;return null}attachEntityInfo(e){e&&(e.objectId=this.objectId,e.ownerId=this.ownerId,e.layerName=this.layer,e.visible=this.visibility)}};za.typeName="Entity";let Ht=za;const Da=class Da extends Ht{constructor(e){super(),this._blockName=e,this._position=new $,this._rotation=0,this._normal=new Z(0,0,1),this._scaleFactors=new $(1,1,1)}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const e=new Re,t=this.blockTableRecord;if(t!=null){const h=t.newIterator();for(const u of h)e.union(u.geometricExtents)}const s=new Wr().setFromEuler(new Hh(this.rotation,0,0)),o=new gn;return o.compose(this.position,s,this.scaleFactors),e.applyMatrix4(o),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const o=this.computeTransformMatrix(),h=Gr.instance.draw(e,s,this.rgbColor,!0,o,this.normal);return this.attachEntityInfo(h),h}else{const o=e.group(t);return this.attachEntityInfo(o),o}}computeTransformMatrix(){const e=new Wr;return e.setFromAxisAngle(Z.Z_AXIS,this.rotation),new gn().compose(this._position,e,this._scaleFactors)}};Da.typeName="BlockReference";let Cs=Da;const Ra=class Ra extends Ht{};Ra.typeName="Curve";let Vt=Ra;const Ba=class Ba extends Vt{constructor(e,t,s,o,h,u,g){super(),this._geo=new Ci(e,t,s,o,h,u,g)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(e){return e.ellipticalArc(this._geo,this.lineStyle)}};Ba.typeName="Ellipse";let ri=Ba;const Fa=class Fa extends Vt{constructor(e,t,s,o){super(),this._geo=new mn(e,t,s,o,Z.Z_AXIS,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}};Fa.typeName="Arc";let ni=Fa;const Ua=class Ua extends Vt{constructor(e,t,s=Z.Z_AXIS){super(),this._geo=new mn(e,t,0,nt,s,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}};Ua.typeName="Circle";let si=Ua;var Zh=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(Zh||{}),Qh=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(Qh||{});const Va=class Va extends Ht{constructor(){super(),this._elevation=0,this._geo=new Mi,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e}get patternType(){return this._patternType}set patternType(e){this._patternType=e}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e}add(e){this._geo.add(e)}get geometricExtents(){const e=this._geo.box;return new Re({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){return e.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}};Va.typeName="Hatch";let ii=Va;var Jh=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(Jh||{});const ja=class ja extends Vt{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}appendVertex(e){this._vertices.push(new $().copy(e)),this._updated=!0}setVertexAt(e,t){throw(e<0||e>=this._vertices.length)&&(this._vertices[e].copy(t),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(e){throw(e<0||e>=this._vertices.length)&&this._vertices[e],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Re().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}draw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t,this.lineStyle)}else return e.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new qr(this._vertices,"Uniform"),this._updated=!1)}};ja.typeName="Leader";let ai=ja;const Ga=class Ga extends Vt{constructor(e,t){super(),this._geo=new Hr(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,s,o,h){const u=this.startPoint,g=this.endPoint;switch(e){case cn.EndPoint:h.push(u),h.push(g);break;case cn.MidPoint:h.push(this.midPoint);break;case cn.Nearest:{const b=this._geo.project(s);h.push(b)}break;case cn.Perpendicular:{const b=this._geo.perpPoint(s);h.push(b)}break;case cn.Tangent:h.push(u);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,o=[new $(t.x,t.y,0),new $(s.x,s.y,0)];return e.lines(o,this.lineStyle)}};Ga.typeName="Line";let oi=Ga;var Ea=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(Ea||{}),Li=(i=>(i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE",i))(Li||{}),Rn=(i=>(i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i))(Rn||{}),ka=(i=>(i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",i))(ka||{}),Ma=(i=>(i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT",i))(Ma||{}),Ta=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(Ta||{});class Oi{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new $,this._height=0,this._width=0,this._viewCenter=new $,this._viewHeight=0}get number(){return this._number}set number(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new _t;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new _t;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new Oi;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}}const Wa=class Wa extends Ht{constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new $,this._attachmentPoint=Rn.TopLeft,this._direction=new Z(1,0,0),this._drawingDirection=Li.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new Re}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const s={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor},o={...this.getTextStyle(),color:this.rgbColor};return e.mtext(s,o,t)}};Wa.typeName="MText";let li=Wa;const Ha=class Ha extends Vt{constructor(e,t,s,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Ut.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new qr(e,t,s,o):this._geo=new qr(e,t,s,o,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}draw(e){const t=this._geo.getPoints(100);return e.lines(t,this.lineStyle)}};Ha.typeName="Spline";let Ns=Ha;const Yd=new Z,qa=class qa extends Cs{constructor(e,t,s){super(e),this._attachmentPoint=Rn.TopLeft,this._numColumns=s,this._numRows=t,this._columnWidth=new Array(s),this._rowHeight=new Array(t),this._cells=new Array(t*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,s){return this._cells[e*t].text}setTextString(e,t,s){this._cells[e*t].text=s}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new Re}draw(e){let t=0,s=0;const o=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let E=0;E<=this.numRows;E++){t-=E>0?this.rowHeight(E-1):0,s=0;for(let M=0;M<=this.numColumns;M++)s+=M>0?this.columnWidth(M-1):0,h[u++]=s,h[u++]=t,h[u++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,u=0;let f=0;for(let E=0;E<this.numColumns;E++){s+=E>0?this.columnWidth(E-1):0,t=0;for(let M=0;M<this.numRows;M++){t+=M>0?this.rowHeight(M-1):0;const z=this.cell(M*this.numColumns+E);if(f=M*this.numColumns+E,z&&!b[f]){const D=z.borderWidth??1,U=z.borderHeight??1;this.fillVisited(b,f,this.numColumns,D,U),o[u++]=E+M*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1)+D;const B=h[o[u-1]*3]-s,ge=E+(M+U)*(this.numColumns+1)+D;E+D==this.numColumns&&(o[u++]=E+M*(this.numColumns+1)+D,o[u++]=ge);const be=-h[ge*3+1]-t;if(M+U==this.numRows&&(o[u++]=E+(M+U)*(this.numColumns+1)+U,o[u++]=E+(M+U)*(this.numColumns+1)),o[u++]=E+(M+U)*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1),z.text){const oe=z.attachmentPoint||this.attachmentPoint||Rn.MiddleCenter,W=this.getTableTextOffset(oe,B,be),ce={text:z.text,height:z.textHeight,width:B,position:Yd.set(s,-t,0).clone().add(W),rotation:this.rotation,attachmentPoint:oe},se={...this.getTextStyle(z),color:this.color.color};g.push(e.mtext(ce,se))}}}}g.push(e.lineSegments(h,3,o,this.lineStyle));const A=e.group(g),x=new Wr;return x.setFromAxisAngle(Z.Z_AXIS,this.rotation),Uo.compose(this.position,x,this.scaleFactors),A.applyMatrix(Uo),this.attachEntityInfo(A),A}fillVisited(e,t,s,o,h){if(h==1&&o==1)e[t]=!0;else for(let u=0;u<o;++u)for(let g=0;g<h;++g)e[t+u+g*s]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let s;return e.textStyle&&(s=t.getAt(e.textStyle)),s||(s=t.getAt("STANDARD")||t.getAt("Standard")),s.textStyle}getTableTextOffset(e,t,s){const o=new Z;switch(e){case 1:break;case 2:o.setX(t/2);break;case 3:o.setX(t);break;case 4:o.setY(-s/2);break;case 5:o.set(t/2,-s/2,0);break;case 6:o.set(t,-s/2,0);break;case 7:o.setY(-s);break;case 8:o.set(t/2,-s,0);break;case 9:o.set(t,-s,0);break}return o}};qa.typeName="Table";let hi=qa;const Uo=new gn;var ec=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(ec||{}),tc=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(tc||{});const Ya=class Ya extends Ht{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new $,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new Re}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Li.BOTTOM_TO_TOP,attachmentPoint:Rn.BottomLeft},o={...this.getTextStyle(),color:this.rgbColor};return e.mtext(s,o,t)}};Ya.typeName="Text";let ci=Ya;const Xa=class Xa extends Vt{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new $,new $,new $,new $]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new Re().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<4;++t)e.push(this.getPointAt(t));return e}draw(e){const t=new Rs(this._vertices,!0),s=new Mi;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}};Xa.typeName="Trace";let ui=Xa;const Ka=class Ka extends Vt{constructor(){super(),this._elevation=0,this._geo=new Rs}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,s=0,o=-1,h=-1){const u=o<0?void 0:o,g=h<0?void 0:h,b={x:t.x,y:t.y,bulge:s,startWidth:u,endWidth:g};this._geo.addVertexAt(e,b)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new $(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Re({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}draw(e){const t=[];return this._geo.getPoints(100).forEach(o=>t.push(new $().set(o.x,o.y,this.elevation))),e.lines(t,this.lineStyle)}};Ka.typeName="Polyline";let di=Ka;const $a=class $a extends Ht{constructor(){super(),this._geo=new $}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Re().expandByPoint(this._geo)}transformBy(e){return this._geo.applyMatrix3d(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}};$a.typeName="Point";let mi=$a;var rc=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(rc||{}),nc=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(nc||{});const Za=class Za extends Ht{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new $,this._scale=new $e(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new Re;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}draw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t,this.lineStyle)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,s=this._height,o=new _t;o.setFromPoints(this._clipBoundary);const h=new Me;h.setX(this._position.x-o.min.x*t),h.setY(this._position.y-o.min.y*s),this._clipBoundary.forEach(u=>{const g=u.x*t+h.x,b=u.y*s+h.y;e.push(new $(g,b,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Vo.copy(e[1]);for(let t=1;t<4;t++)Hs.copy(e[t]),Hs.rotateAround(Vo,this._rotation),e[t].setX(Hs.x),e[t].setY(Hs.y)}e.push(e[0])}return e}};Za.typeName="RasterImage";let Ls=Za;const Vo=new Me,Hs=new Me,Qa=class Qa extends Vt{constructor(){super(),this._basePoint=new $,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Re;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}};Qa.typeName="Ray";let pi=Qa;const Ja=class Ja extends Ht{constructor(){super(),this._centerPoint=new $,this._height=0,this._width=0,this._viewCenter=new $,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new Re}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport(),s=e.group(this.createViewportRect(t,e));return this.attachEntityInfo(s),s}}toGiViewport(){const e=new Oi;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const s=[];return s.push(t.lines([new $(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new $(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new $(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new $(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new $(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}};Ja.typeName="Viewport";let gi=Ja;const eo=class eo extends Ls{draw(e){const t=this.boundaryPath(),s=new Mi;return s.add(new Rs(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}};eo.typeName="Wipeout";let fi=eo;const to=class to extends Vt{constructor(){super(),this._basePoint=new $,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Re;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}};to.typeName="Xline";let _i=to;var sc=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(sc||{});const ro=class ro extends Ht{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new $,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new Os),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}draw(e){if(this.dimBlockId){const s=this.database.tables.blockTable.getAt(this.dimBlockId);if(s){const o=Gr.instance.draw(e,s,this.rgbColor,!1);return this.attachEntityInfo(o),o}}const t=e.group([]);return this.attachEntityInfo(t),t}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Gr.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Gr.instance.draw(e,t,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}getLineArrowStyle(e){}findPointOnLine1(e,t,s){const o=new $().subVectors(t,e).normalize();return new $(t).addScaledVector(o,s)}findPointOnLine2(e,t,s){const o=e.x+s*Math.cos(t),h=e.y+s*Math.sin(t);return{x:o,y:h}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():Ea.Closed}};ro.typeName="Dimension";let Mr=ro;const no=class no extends Mr{constructor(e,t,s,o,h=null,u=null){super(),this._centerPoint=new $().copy(e),this._xLine1Point=new $().copy(t),this._xLine2Point=new $().copy(s),this._arcPoint=new $().copy(o),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Re}};no.typeName="3PointAngularDimension";let vi=no;const so=class so extends Mr{constructor(e,t,s,o=null,h=null){super(),this._dimLinePoint=new $().copy(s),this._xLine1Point=new $().copy(e),this._xLine2Point=new $().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=o,this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get geometricExtents(){return new Re}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),o=this.findIntersectionPoint(t,this._dimLinePoint),h=this.findIntersectionPoint(s,this._dimLinePoint),u=new Hr(o,h);return e.push(u),t.endPoint=o,this.adjustExtensionLine(t),e.push(t),s.endPoint=h,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new Hr(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,o=e.endPoint,h=new Z().subVectors(o,s).normalize(),g=new Z().subVectors(t,s).dot(h),b=new Z().copy(h).multiplyScalar(g);return new Z().addVectors(s,b)}};so.typeName="AlignedDimension";let yi=so;const io=class io extends Mr{constructor(e,t,s,o,h=null,u=null){super(),this._arcPoint=new $().copy(o),this._xLine1Point=new $().copy(t),this._xLine2Point=new $().copy(s),this._centerPoint=new $().copy(e),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Re}};io.typeName="ArcDimension";let ha=io;const ao=class ao extends Mr{constructor(e,t,s=0,o=null,h=null){super(),this._chordPoint=new $().copy(e),this._farChordPoint=new $().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=o,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Re}drawLines(e,t){const s=[],o=t.length;return o==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):o==3?(this.sortLines(t),s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(e,t[1])),s.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(h=>{s.push(this.drawLine(e,h))}),s}drawLine(e,t,s){if(s){const o=[t.startPoint,t.endPoint];return e.lines(o,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,o)=>s.x!==o.x?s.x-o.x:s.y!==o.y?s.y-o.y:s.z-o.z;e.sort((s,o)=>{const h=t(s.startPoint,o.startPoint);return h!==0?h:t(s.endPoint,o.endPoint)})}};ao.typeName="DiametricDimension";let bi=ao;const oo=class oo extends Mr{constructor(e,t,s=null,o=null){super(),this._definingPoint=new $().copy(e),this._leaderEndPoint=new $().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get geometricExtents(){return new Re}get arrowLineCount(){return 0}};oo.typeName="OrdinateDimension";let xi=oo;const lo=class lo extends Mr{constructor(e,t,s,o=null,h=null){super(),this._center=new $().copy(e),this._chordPoint=new $().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=o,this.dimensionStyleName=h}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLenght(e){this._leaderLength=e}get geometricExtents(){return new Re}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}};lo.typeName="RadialDimension";let wi=lo;class jo{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="ARC"?this.convertArc(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"||e.type=="LWPOLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertArc(e){return new ni(e.center,e.radius,Ee.degToRad(e.startAngle),Ee.degToRad(e.endAngle))}convertCirle(e){return new si(e.center,e.radius)}convertEllipse(e){const t=new Z(e.majorAxisEndPoint),s=t.length();return new ri(e.center,Z.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new oi(new $(t.x,t.y,t.z||0),new $(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new Ns(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null)return new Ns(t,"Uniform",e.degree,!!(e.flag&1))}return null}convertPoint(e){const t=new mi;return t.position=e.position,t}convertSolid(e){const t=new ui;return e.points.forEach((s,o)=>t.setPointAt(o,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new di;return t.closed=!!(e.flag&1),e.vertices.forEach((s,o)=>{t.addVertexAt(o,new Me(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var o;const t=new ii;return(o=e.definitionLines)==null||o.forEach(h=>{t.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:e.patternAngle,t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new Rs;b.closed=g.isClosed,g.vertices.forEach((f,A)=>{b.addVertexAt(A,{x:f.x,y:f.y,bulge:f.bulge})}),t.add(b)}else{const g=h,b=new Yh;g.edges.forEach(f=>{if(f.type==1){const A=f;b.add(new Ni(A.start,A.end))}else if(f.type==2){const A=f;b.add(new Dn(A.center,A.radius,Ee.degToRad(A.startAngle||0),Ee.degToRad(A.endAngle||0),!A.isCCW))}else if(f.type==3){const A=f;new $e().subVectors(A.end,A.center);const E=Math.sqrt(Math.pow(A.end.x,2)+Math.pow(A.end.y,2)),M=E*A.lengthOfMinorAxis;let z=Ee.degToRad(A.startAngle||0),D=Ee.degToRad(A.endAngle||0);const U=Math.atan2(A.end.y,A.end.x);A.isCCW||(z=Math.PI*2-z,D=Math.PI*2-D),b.add(new Ti({...A.center,z:0},E,M,z,D,!A.isCCW,U))}else if(f.type==4){const A=f;if(A.numberOfControlPoints>0&&A.numberOfKnots>0){const x=A.controlPoints.map(z=>({x:z.x,y:z.y,z:0}));let E=!0;const M=A.controlPoints.map(z=>(z.weight==null&&(E=!1),z.weight||1));b.add(new qr(x,A.knots,E?M:void 0))}else if(A.numberOfFitData>0){const x=A.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));b.add(new qr(x,"Uniform"))}}}),t.add(b)}}),t}convertTable(e){const t=new hi(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,o)=>t.setColumnWidth(o,s)),e.rowHeightArr.forEach((s,o)=>t.setRowHeight(o,s)),e.cells.forEach((s,o)=>{t.setCell(o,s)}),t}convertText(e){const t=new ci;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=Ee.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new li;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=Ee.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new Z(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new ai;return e.vertices.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName,t.annoType=e.leaderCreationFlag,t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"||e.subclassMarker=="AcDbRotatedDimension"){const t=e,s=new yi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=Ee.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new vi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new xi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new wi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new bi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(s=>{t.clipBoundary.push(new Me(s))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new Ls;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(s=>{t.clipBoundary.push(new Me(s))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new fi;return this.processWipeout(e,t),t}convertViewport(e){const t=new gi;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new pi;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new _i;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new Cs(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?Ee.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement}processCommonAttrs(e,t){t.layer=e.layer,t.objectId=e.handle,t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&(t.color.color=e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName!=null&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=e.transparency)}numberArrayToPointArray(e,t){const s=e.length;let o=0;if(s/2==t?o=2:s/3==t&&(o=3),o==0)return;const h=[];for(let u=0,g=s/o;u<g;++u)h.push({x:e[u*o],y:e[u*o+1],z:o==3?e[u*o+2]:0});return h}}class Ca extends Yr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new _t,this._extents=new Re}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}}class Na extends Yr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,o)=>{s===t&&(this._recordsByName.delete(o),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:o}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new Ei(this._recordsByName)}}class ic extends Na{getBtrIdAt(e){for(const[t,s]of this._recordsByName)if(s.blockTableRecordId==e)return s}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class ac extends Yr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class Xd{convertLayout(e,t){var o;const s=new Ca;return s.layoutName=e.layoutName,s.tabOrder=e.tabOrder,(o=t.tables.BLOCK_RECORD)==null||o.entries.some(h=>h.layoutObjects===e.handle?(s.blockTableRecordId=h.handle,!0):!1),s.limits.min.copy(e.minLimit),s.limits.max.copy(e.maxLimit),s.extents.min.copy(e.minExtent),s.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,s),s}convertImageDef(e){const t=new ac;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class oc{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const s=Date.now(),o=this.generateTaskId();try{return await this.executeInWorker(o,e,t||this.config.workerUrl)}catch(h){const u=Date.now()-s;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(e,t,s){const o=Date.now();return new Promise((h,u)=>{const g=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(g),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),u(x)},timeout:b});const f=x=>{const{id:E,success:M,data:z,error:D}=x.data;if(E!==e)return;this.cleanupTask(e);const U=Date.now()-o;h(M?{success:!0,data:z,duration:U}:{success:!1,error:D,duration:U})},A=x=>{this.cleanupTask(e),u(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",A),g.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[s,o]of this.workers)if(!o.isBusy)return o.isBusy=!0,o.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(e,{type:"module"}),o=this.generateWorkerId(),h={worker:s,isBusy:!0,id:o,createdAt:new Date};return this.workers.set(o,h),s}const t=Array.from(this.workers.values()).sort((s,o)=>s.createdAt.getTime()-o.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,s]of this.workers)if(s.worker===e){s.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class lc{constructor(e){this.framework=new oc(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function hc(i){return new lc(i)}class Kd{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:s}=e.data;try{const o=await this.executeTask(s);this.sendResponse(t,!0,o)}catch(o){this.sendResponse(t,!1,void 0,o instanceof Error?o.message:String(o))}}}sendResponse(e,t,s,o){const h={id:e,success:t,data:s,error:o};self.postMessage(h)}}class cc extends ph{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e){if(this.config.useWorker&&this.config.parserWorkerUrl){const t=hc({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),s=await t.execute(e);return t.destroy(),s.data}else return new Od().parseSync(e)}getFonts(e){var h;const t=new Map,s=u=>{if(u){const g=u.lastIndexOf(".");return g>=0?u.substring(0,g).toLowerCase():u.toLowerCase()}};(h=e.tables.STYLE)==null||h.entries.forEach(u=>{const g=[];let b=s(u.font);b&&g.push(b),b=s(u.bigFont),b&&g.push(b),t.set(u.name,g)});const o=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,o),Array.from(o)}getFontsInBlock(e,t,s,o){const h=/\\f(.*?)\|/g;e.forEach(u=>{if(u.type=="MTEXT"){const g=u;[...g.text.matchAll(h)].forEach(A=>{o.add(A[1].toLowerCase())});const f=s.get(g.styleName);f==null||f.forEach(A=>o.add(A))}else if(u.type=="TEXT"){const g=u,b=s.get(g.styleName);b==null||b.forEach(f=>o.add(f))}else if(u.type=="INSERT"){const b=t[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,t,s,o)}})}async processEntities(e,t,s,o,h){const u=new jo;let g=e.entities;const b=g.length,f=new tl(b,100-o.value,s);this.config.convertByEntityType&&(g=this.groupAndFlattenByType(g));const A=t.tables.blockTable.modelSpace;await f.processChunk(async(x,E)=>{let M=[],z=x<E?g[x].type:"";for(let D=x;D<E;D++){const U=g[D],B=u.convert(U);B&&(this.config.convertByEntityType&&U.type!==z&&(A.appendEntity(M),M=[],z=U.type),M.push(B))}if(A.appendEntity(M),h){let D=o.value+E/b*(100-o.value);D>100&&(D=100),await h(D,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t){const s=new jo,o=e.length,h=[];for(let u=0;u<o;u++){const g=e[u],b=s.convert(g);b&&h.push(b)}t.appendEntity(h)}processBlocks(e,t){const s=e.blocks;for(const[o,h]of Object.entries(s)){let u=t.tables.blockTable.getAt(h.name);u||(u=new Ft,u.objectId=h.handle,u.name=o,u.origin.copy(h.position),t.tables.blockTable.add(u)),h.entities&&this.processEntitiesInBlock(h.entities,u)}}processHeader(e,t){const s=e.header;t.cecolor.colorIndex=s.$CECOLOR||256,t.angBase=s.$ANGBASE||0,t.angDir=s.$ANGDIR||0,t.aunits=s.$AUNITS,t.extmax=s.$EXTMAX,t.extmin=s.$EXTMIN,t.insunits=s.$INSUNITS,t.pdmode=s.$PDMODE||0,t.pdsize=s.$PDSIZE||0}processBlockTables(e,t){var o;const s=(o=e.tables.BLOCK_RECORD)==null?void 0:o.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(h=>{const u=new Ft;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,t.tables.blockTable.add(u)}))}processObjects(e,t){const s=e.objects.byName,o=new Xd;if("LAYOUT"in s){const h=t.dictionaries.layouts;s.LAYOUT.forEach(u=>{const g=o.convertLayout(u,e);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in s){const h=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(u=>{const g=o.convertImageDef(u);h.setAt(g.objectId,g)})}}processViewports(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new Pc;this.processCommonTableEntryAttrs(u,g),u.circleSides&&(g.circleSides=u.circleSides),g.standardFlag=u.standardFlag,g.center.copy(u.center),g.lowerLeftCorner.copy(u.lowerLeftCorner),g.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&g.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(g.snapAngle=u.snapRotationAngle),u.snapSpacing&&g.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(g.gridMajor=u.majorGridLines),u.gridSpacing&&g.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(g.backgroundObjectId=u.backgroundObjectId),g.gsView.center.copy(u.center),g.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),g.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(g.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(g.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(g.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(g.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(g.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(g.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(g.gsView.styleSheet=u.styleSheet),u.renderMode&&(g.gsView.renderMode=u.renderMode),u.viewMode&&(g.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(g.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&g.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&g.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&g.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(g.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(g.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(g.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(g.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(g.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(g.gsView.brightness=u.brightness),u.contrast&&(g.gsView.contrast=u.contrast),u.ambientColor&&(g.gsView.ambientColor=u.ambientColor),t.tables.viewportTable.add(g)})}processLayers(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new fn;g.colorIndex=u.colorIndex;const b=new La({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:g,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),t.tables.layerTable.add(b)})}processLineTypes(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new wc(u);this.processCommonTableEntryAttrs(u,g),g.name=u.name,t.tables.linetypeTable.add(g)})}processTextStyles(e,t){var o;const s=(o=e.tables.STYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u=new Ac(h);this.processCommonTableEntryAttrs(h,u),t.tables.textStyleTable.add(u)})}processDimStyles(e,t){var o;const s=(o=e.tables.DIMSTYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new Os(u);this.processCommonTableEntryAttrs(h,g),t.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}groupAndFlattenByType(e){const t={},s=[];for(const o of e)t[o.type]||(t[o.type]=[],s.push(o.type)),t[o.type].push(o);return s.flatMap(o=>t[o])}}var Ts=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Ts||{});class lr{constructor(){this.events={registered:new it,unregistered:new it},this._converters=new Map,this.register("dxf",new cc)}static createInstance(){return lr._instance==null&&(lr._instance=new lr),this._instance}static get instance(){return lr._instance||(lr._instance=new lr),lr._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}class _n extends Yr{constructor(e,t){e=e||{},Bn(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const jr=class jr extends _n{static isModelSapceName(e){return e.toLowerCase()==jr.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(jr.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new $,this._layoutId="",this._entities=new Map}get isModelSapce(){return jr.isModelSapceName(this.name)}get isPaperSapce(){return jr.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}appendEntity(e){if(Array.isArray(e))for(let t=0;t<e.length;++t){const s=e[t];s.database=this.database,s.ownerId=this.objectId,this._entities.set(s.objectId,s)}else e.database=this.database,e.ownerId=this.objectId,this._entities.set(e.objectId,e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}newIterator(){return new Ei(this._entities)}getIdAt(e){return this._entities.get(e)}};jr.MODEL_SPACE_NAME="*MODEL_SPACE",jr.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let Ft=jr;class vn extends Yr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}add(e){e.database=this.database;const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),s=this._recordsByName.get(t);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(e),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(t.name),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new Ei(this._recordsByName)}normalizeName(e){return e}}class uc extends vn{constructor(e){super(e)}get modelSpace(){let e=this.getAt(Ft.MODEL_SPACE_NAME);return e||(e=new Ft,e.name=Ft.MODEL_SPACE_NAME,this.add(e)),e}normalizeName(e){let t=e;if(Ft.isModelSapceName(e))t=Ft.MODEL_SPACE_NAME;else if(Ft.isPaperSapceName(e)){const s=Ft.PAPER_SPACE_NAME_PREFIX,o=e.substring(s.length);t=s+o}return t}}class dc extends vn{constructor(e){super(e)}}class La extends _n{constructor(e,t){e=e||{},Bn(e,{color:new fn,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e)}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}}class mc extends vn{constructor(e){super(e);const t=new fn;t.color=16777215;const s=new La({name:"0",standardFlags:0,linetype:ei,lineWeight:1,isOff:!1,color:t,isPlottable:!0});this.add(s)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class pc extends vn{constructor(e){super(e)}}class gc extends vn{constructor(e){super(e)}get fonts(){const e=new Set,t=o=>{if(o){const h=o.lastIndexOf(".");if(h>=0){const u=o.substring(0,h).toLowerCase();e.add(u)}else e.add(o.toLowerCase())}},s=this.newIterator();for(const o of s)t(o.fileName),t(o.bigFontFileName);return Array.from(e)}}class fc extends vn{constructor(e){super(e)}}class $d extends Yr{constructor(){super(),this.events={dictObjetSet:new it,dictObjectErased:new it,entityAppended:new it,entityModified:new it,layerAppended:new it,layerModified:new it,layerErased:new it,openProgress:new it,headerSysVarChanged:new it},this._angBase=0,this._angDir=0,this._aunits=ga.DecimalDegrees,this._celtscale=1,this._cecolor=new fn,this._extents=new Re,this._insunits=fa.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new uc(this),dimStyleTable:new dc(this),linetypeTable:new pc(this),textStyleTable:new gc(this),layerTable:new mc(this),viewportTable:new fc(this)},this._dictionaries={layouts:new ic(this),imageDefs:new Na(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this._aunits=e||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(e){this._insunits=e||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(e){this._ltscale=e||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(e){this._cecolor=e||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(e){this._celtscale=e||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(e){this._angBase=e||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(e){this._angDir=e||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(e){this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmax")}get extmin(){return this._extents.min}set extmin(e){this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmin")}get pdmode(){return this._pdmode}set pdmode(e){this._pdmode=e||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(e){this._pdsize=e||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(e,t,s=Ts.DXF){const o=lr.instance.get(s);if(o==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await o.read(e,this,t&&t.minimumChunkSize||10,async(h,u,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,stageStatus:g}),t&&t.fontLoader&&u=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await t.fontLoader.load(f)}})}async openUri(e,t){var E;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",stageStatus:"START"});const s=await fetch(e);if(!s.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",stageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${s.status}'!`);const o=s.headers.get("content-length"),h=o?parseInt(o,10):null;let u=0;const g=(E=s.body)==null?void 0:E.getReader();if(!g)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:M,value:z}=await g.read();if(M)break;if(b.push(z),u+=z.length,h!==null){const D=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:D,stage:"FETCH_FILE",stageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let A=0;for(const M of b)f.set(M,A),A+=M.length;if(e.toLowerCase().split(".").pop()==="dwg")await this.read(f.buffer,t,Ts.DWG);else{const M=new TextDecoder().decode(f);await this.read(M,t,Ts.DXF)}this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",stageStatus:"END"})}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}}var _c=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(_c||{}),vc=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))(vc||{}),yc=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(yc||{}),bc=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(bc||{}),xc=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(xc||{});const Pi=class Pi extends _n{constructor(e,t){e=e||{},Bn(e,Pi.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}};Pi.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let Os=Pi;class wc extends _n{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}}class Ac extends _n{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const s=t.lastIndexOf(".");return s===-1?t:t.substring(0,s)}return e}}const Zd={center:new Me,viewDirectionFromTarget:new $(0,0,1),viewTarget:new $(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:ka.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new $(0,0,0),ucsXAxis:new $(1,0,0),ucsYAxis:new $(0,1,0),orthographicType:Ma.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Ta.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class Pc extends _n{constructor(){super(),this._circleSides=100,this._center=new Me,this._lowerLeftCorner=new Me(0,0),this._upperRightCorner=new Me(1,1),this._snapBase=new Me(0,0),this._snapAngle=0,this._snapSpacing=new Me(0,0),this._standardFlag=0,this._gridSpacing=new Me,this._gridMajor=10,this._gsView=Zd}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get gsView(){return this._gsView}}class Sc{constructor(){this.events={layoutCreated:new it,layoutRemoved:new it,layoutRenamed:new it,layoutSwitched:new it}}countLayouts(e){return this.getWorkingDatabase(e).dictionaries.layouts.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(o,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(o,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(o,s)}renameLayout(e,t,s){const h=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return h?(h.layoutName=t,this.events.layoutRenamed.dispatch({layout:h,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){const s=this.getWorkingDatabase(t).dictionaries.layouts,o=s.getAt(e);let h=!1;return o&&(h=s.remove(e),h&&this.events.layoutRemoved.dispatch({layout:o})),h}createLayout(e,t){const s=this.getWorkingDatabase(t),o=new Ca;o.layoutName=e,o.tabOrder=s.dictionaries.layouts.maxTabOrder;const h=new Ft;return h.name=`*Paper_Space${o.tabOrder}`,s.tables.blockTable.add(h),s.dictionaries.layouts.setAt(e,o),this.events.layoutCreated.dispatch({layout:o}),{layout:o,btr:h}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||Oa().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function Oa(){return Ai.instance}const Si=class Si{constructor(){this._workingDatabase=null,this._layoutManager=new Sc}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager}};Si.instance=new Si;let Ai=Si;exports.AcCmColor=fn;exports.AcCmErrors=Ut;exports.AcCmEventDispatcher=Gc;exports.AcCmEventManager=it;exports.AcCmLoader=Zc;exports.AcCmLoadingManager=Jo;exports.AcCmObject=Ko;exports.AcCmPerformanceCollector=ca;exports.AcCmTask=Zo;exports.AcCmTaskScheduler=Qo;exports.AcDb3PointAngularDimension=vi;exports.AcDbAlignedDimension=yi;exports.AcDbAngleUnits=ga;exports.AcDbArc=ni;exports.AcDbArcDimension=ha;exports.AcDbBaseWorker=Kd;exports.AcDbBatchProcessing=tl;exports.AcDbBlockReference=Cs;exports.AcDbBlockTable=uc;exports.AcDbBlockTableRecord=Ft;exports.AcDbCircle=si;exports.AcDbCurve=Vt;exports.AcDbDatabase=$d;exports.AcDbDatabaseConverter=ph;exports.AcDbDatabaseConverterManager=lr;exports.AcDbDiametricDimension=bi;exports.AcDbDictionary=Na;exports.AcDbDimArrowType=dh;exports.AcDbDimStyleTable=dc;exports.AcDbDimStyleTableRecord=Os;exports.AcDbDimTextHorizontal=_c;exports.AcDbDimTextVertical=vc;exports.AcDbDimVerticalJustification=xc;exports.AcDbDimZeroSuppression=yc;exports.AcDbDimZeroSuppressionAngular=bc;exports.AcDbDimension=Mr;exports.AcDbDxfConverter=cc;exports.AcDbEllipse=ri;exports.AcDbEntity=Ht;exports.AcDbFileType=Ts;exports.AcDbHatch=ii;exports.AcDbHatchPatternType=Zh;exports.AcDbHatchStyle=Qh;exports.AcDbHostApplicationServices=Ai;exports.AcDbLayerTable=mc;exports.AcDbLayerTableRecord=La;exports.AcDbLayout=Ca;exports.AcDbLayoutDictionary=ic;exports.AcDbLayoutManager=Sc;exports.AcDbLeader=ai;exports.AcDbLeaderAnnotationType=Jh;exports.AcDbLine=oi;exports.AcDbLineSpacingStyle=sc;exports.AcDbLinetypeTable=pc;exports.AcDbLinetypeTableRecord=wc;exports.AcDbMText=li;exports.AcDbObject=Yr;exports.AcDbObjectIterator=Ei;exports.AcDbOrdinateDimension=xi;exports.AcDbOsnapMode=cn;exports.AcDbPoint=mi;exports.AcDbPolyline=di;exports.AcDbRadialDimension=wi;exports.AcDbRasterImage=Ls;exports.AcDbRasterImageClipBoundaryType=rc;exports.AcDbRasterImageDef=ac;exports.AcDbRasterImageImageDisplayOpt=nc;exports.AcDbRay=pi;exports.AcDbRenderingCache=Gr;exports.AcDbSpline=Ns;exports.AcDbSymbolTable=vn;exports.AcDbSymbolTableRecord=_n;exports.AcDbTable=hi;exports.AcDbText=ci;exports.AcDbTextHorizontalMode=ec;exports.AcDbTextStyleTable=gc;exports.AcDbTextStyleTableRecord=Ac;exports.AcDbTextVerticalMode=tc;exports.AcDbTrace=ui;exports.AcDbUnitsValue=fa;exports.AcDbViewport=gi;exports.AcDbViewportTable=fc;exports.AcDbViewportTableRecord=Pc;exports.AcDbWipeout=fi;exports.AcDbWorkerApi=lc;exports.AcDbWorkerManager=oc;exports.AcDbXline=_i;exports.AcGeArea2d=Mi;exports.AcGeBox2d=_t;exports.AcGeBox3d=Re;exports.AcGeCatmullRomCurve3d=Kh;exports.AcGeCircArc2d=Dn;exports.AcGeCircArc3d=mn;exports.AcGeCurve2d=Un;exports.AcGeEllipseArc2d=Ti;exports.AcGeEllipseArc3d=Ci;exports.AcGeEuler=Hh;exports.AcGeGeometryUtil=Rh;exports.AcGeLine2d=Ni;exports.AcGeLine3d=Hr;exports.AcGeLoop2d=Yh;exports.AcGeMathUtil=Ee;exports.AcGeMatrix2d=ki;exports.AcGeMatrix3d=gn;exports.AcGeNurbsCurve=pn;exports.AcGePlane=zs;exports.AcGePoint2d=Me;exports.AcGePoint3d=$;exports.AcGePolyline2d=Rs;exports.AcGeQuaternion=Wr;exports.AcGeShape2d=Ia;exports.AcGeSpline3d=qr;exports.AcGeTol=Aa;exports.AcGeVector2d=$e;exports.AcGeVector3d=Z;exports.AcGiArrowType=Ea;exports.AcGiDefaultLightingType=Ta;exports.AcGiMTextAttachmentPoint=Rn;exports.AcGiMTextFlowDirection=Li;exports.AcGiOrthographicType=Ma;exports.AcGiRenderMode=ka;exports.AcGiViewport=Oi;exports.AcTrStringUtil=$c;exports.ByBlock=uh;exports.ByLayer=Qs;exports.DEBUG_MODE=Xc;exports.DEFAULT_LINE_TYPE=ei;exports.DEFAULT_TOL=Pa;exports.DEG2RAD=_a;exports.DefaultLoadingManager=el;exports.FLOAT_TOL=hn;exports.ORIGIN_POINT_2D=Rd;exports.ORIGIN_POINT_3D=wa;exports.RAD2DEG=va;exports.TAU=nt;exports.acdbHostApplicationServices=Oa;exports.basisFunction=ti;exports.calculateCurveLength=Vh;exports.ceilPowerOfTwo=Mh;exports.clamp=kr;exports.clone=Ss;exports.createWorkerApi=hc;exports.damp=vh;exports.defaults=Bn;exports.degToRad=Ih;exports.euclideanModulo=ya;exports.evaluateNurbsPoint=Ms;exports.floorPowerOfTwo=Th;exports.generateChordKnots=Fh;exports.generateSqrtChordKnots=Uh;exports.generateUUID=gh;exports.generateUniformKnots=Bh;exports.has=Yo;exports.intPartLength=xa;exports.interpolateControlPoints=Bd;exports.inverseLerp=_h;exports.isBetween=Ch;exports.isBetweenAngle=Nh;exports.isEmpty=Xo;exports.isEqual=zn;exports.isImperialUnits=Dd;exports.isMetricUnits=zd;exports.isPointInPolygon=Sa;exports.isPolygonIntersect=Dh;exports.isPowerOfTwo=kh;exports.lerp=ba;exports.log=Es;exports.mapLinear=fh;exports.normalizeAngle=ks;exports.pingpong=yh;exports.radToDeg=Eh;exports.randFloat=Ah;exports.randFloatSpread=Ph;exports.randInt=wh;exports.relativeEps=Lh;exports.seededRandom=Sh;exports.setLogLevel=Kc;exports.smootherstep=xh;exports.smoothstep=bh;
|
|
5
|
+
`+n+"}",T;case"function":return"<function>";case"string":return r;default:return String(r)}},Te.__interfLoop=function(r,n){if(r==null)return!1;if(r==n)return!0;var a=r.__interfaces__;if(a!=null)for(var l=0,c=a.length;l<c;){var d=l++,p=a[d];if(p==n||Te.__interfLoop(p,n))return!0}return Te.__interfLoop(r.__super__,n)},Te.__instanceof=function(r,n){if(n==null)return!1;switch(n){case Ec:return(r|0)===r;case ho:return typeof r=="number";case co:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case kc:return!0;default:if(r!=null){if(typeof n=="function"){if(r instanceof n||Te.__interfLoop(Te.getClass(r),n))return!0}else if(typeof n=="object"&&Te.__isNativeObj(n)&&r instanceof n)return!0}else return!1;return n==uo&&r.__name__!=null||n==mo&&r.__ename__!=null?!0:r.__enum__==n}},Te.__nativeClassName=function(r){var n=Te.__toStr.call(r).slice(8,-1);return n=="Object"||n=="Function"||n=="Math"||n=="JSON"?null:n},Te.__isNativeObj=function(r){return Te.__nativeClassName(r)!=null},Te.__resolveNativeClass=function(r){return S[r]};var ot=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var n=r;this.a=[];for(var a=0;a<n;){var l=a++;this.a[l]=0}this.byteLength=n}};x["js.html.compat.ArrayBuffer"]=ot,ot.__name__=["js","html","compat","ArrayBuffer"],ot.sliceImpl=function(r,n){var a=new Bi(this,r,n==null?null:n-r),l=new Us(a.byteLength),c=new Bi(l);return c.set(a),l},ot.prototype={slice:function(r,n){return new ot(this.a.slice(r,n))},__class__:ot};var hr=function(r,n,a){if(this.buf=r,n==null?this.offset=0:this.offset=n,a==null?this.length=r.byteLength-this.offset:this.length=a,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(Je.OutsideBounds)};x["js.html.compat.DataView"]=hr,hr.__name__=["js","html","compat","DataView"],hr.prototype={getInt8:function(r){var n=this.buf.a[this.offset+r];return n>=128?n-256:n},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,n){var a=this.getUint16(r,n);return a>=32768?a-65536:a},getUint16:function(r,n){return n?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,n){var a=this.offset+r,l=this.buf.a[a++],c=this.buf.a[a++],d=this.buf.a[a++],p=this.buf.a[a++];return n?l|c<<8|d<<16|p<<24:p|d<<8|c<<16|l<<24},getUint32:function(r,n){var a=this.getInt32(r,n);return a<0?a+4294967296:a},getFloat32:function(r,n){return at.i32ToFloat(this.getInt32(r,n))},getFloat64:function(r,n){var a=this.getInt32(r,n),l=this.getInt32(r+4,n);return at.i64ToDouble(n?a:l,n?l:a)},setInt8:function(r,n){n<0?this.buf.a[r+this.offset]=n+128&255:this.buf.a[r+this.offset]=n&255},setUint8:function(r,n){this.buf.a[r+this.offset]=n&255},setInt16:function(r,n,a){this.setUint16(r,n<0?n+65536:n,a)},setUint16:function(r,n,a){var l=r+this.offset;a?(this.buf.a[l]=n&255,this.buf.a[l++]=n>>8&255):(this.buf.a[l++]=n>>8&255,this.buf.a[l]=n&255)},setInt32:function(r,n,a){this.setUint32(r,n,a)},setUint32:function(r,n,a){var l=r+this.offset;a?(this.buf.a[l++]=n&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>>24):(this.buf.a[l++]=n>>>24,this.buf.a[l++]=n>>16&255,this.buf.a[l++]=n>>8&255,this.buf.a[l++]=n&255)},setFloat32:function(r,n,a){this.setUint32(r,at.floatToI32(n),a)},setFloat64:function(r,n,a){var l=at.doubleToI64(n);a?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:hr};var nr=function(){};x["js.html.compat.Uint8Array"]=nr,nr.__name__=["js","html","compat","Uint8Array"],nr._new=function(r,n,a){var l;if(typeof r=="number"){l=[];for(var c=0;c<r;){var d=c++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new ot(l)}else if(Te.__instanceof(r,ot)){var p=r;n==null&&(n=0),a==null&&(a=p.byteLength-n),n==0?l=p.a:l=p.a.slice(n,n+a),l.byteLength=l.length,l.byteOffset=n,l.buffer=p}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new ot(l);else throw new Q("TODO "+ge.string(r));return l.subarray=nr._subarray,l.set=nr._set,l},nr._set=function(r,n){var a=this;if(Te.__instanceof(r.buffer,ot)){var l=r;if(r.byteLength+n>a.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var p=c++;a[p+n]=l[p]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+n>a.byteLength)throw new Q("set() outside of range");for(var v=0,w=_.length;v<w;){var P=v++;a[P+n]=_[P]}}else throw new Q("TODO")},nr._subarray=function(r,n){var a=this,l=nr._new(a.slice(r,n));return l.byteOffset=r,l};var ke=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&ke.link(r,this,function(n){return n})};x["promhx.base.AsyncBase"]=ke,ke.__name__=["promhx","base","AsyncBase"],ke.link=function(r,n,a){r._update.push({async:n,linkf:function(l){n.handleResolve(a(l))}}),ke.immediateLinkUpdate(r,n,a)},ke.immediateLinkUpdate=function(r,n,a){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&n.handleError(r._errorVal),r._resolved&&!r._pending)try{n.handleResolve(a(r._val))}catch(l){l instanceof Q&&(l=l.val),n.handleError(l)}},ke.linkAll=function(r,n){for(var a=function(d,p,_){if(d.length==0||ke.allFulfilled(d)){for(var v,w=[],P=Xt(r)();P.hasNext();){var A=P.next();w.push(A==p?_:A._val)}v=w,n.handleResolve(v)}},l=Xt(r)();l.hasNext();){var c=l.next();c._update.push({async:n,linkf:function(d,p,_){return function(v){d(p,_,v)}}(a,function(d){for(var p,_=[],v=Xt(r)();v.hasNext();){var w=v.next();w!=c&&_.push(w)}return p=_,p}(),c)})}ke.allFulfilled(r)&&n.handleResolve(function(d){for(var p,_=[],v=Xt(r)();v.hasNext();){var w=v.next();_.push(w._val)}return p=_,p}())},ke.pipeLink=function(r,n,a){var l=!1,c=function(d){if(!l){l=!0;var p=a(d);p._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(p,n,function(_){return _})}};if(r._update.push({async:n,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),n.handleError(d)}},ke.allResolved=function(r){for(var n=Xt(r)();n.hasNext();){var a=n.next();if(!a._resolved)return!1}return!0},ke.allFulfilled=function(r){for(var n=Xt(r)();n.hasNext();){var a=n.next();if(!a._fulfilled)return!1}return!0},ke.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var n=this;this._pending?Se.enqueue(function(a,l){return function(){a(l)}}(Mt(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,Se.queue.add(function(){n._val=r;for(var a=0,l=n._update;a<l.length;){var c=l[a];++a;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}n._fulfilled=!0,n._pending=!1}),Se.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var n=this,a=function(l){if(n._error.length>0)for(var c=0,d=n._error;c<d.length;){var p=d[c];++c,p(l)}else if(n._update.length>0)for(var _=0,v=n._update;_<v.length;){var w=v[_];++_,w.async.handleError(l)}else throw new Q(l);n._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,Se.queue.add(function(){if(n._errorMap!=null)try{n._resolve(n._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),a(l)}else a(r)}),Se.continueOnNextLoop())},then:function(r){var n=new ke(null);return ke.link(this,n,r),n},unlink:function(r){var n=this;Se.queue.add(function(){n._update=n._update.filter(function(a){return a.async!=r})}),Se.continueOnNextLoop()},isLinked:function(r){for(var n=!1,a=0,l=this._update;a<l.length;){var c=l[a];if(++a,c.async==r)return!0}return n},__class__:ke};var yn=f.promhx.Deferred=function(){ke.call(this)};x["promhx.Deferred"]=yn,yn.__name__=["promhx","Deferred"],yn.__super__=ke,yn.prototype=M(ke.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new pt(this)},stream:function(){return new He(this)},publicStream:function(){return new Tr(this)},__class__:yn});var pt=f.promhx.Promise=function(r){ke.call(this,r),this._rejected=!1};x["promhx.Promise"]=pt,pt.__name__=["promhx","Promise"],pt.whenAll=function(r){var n=new pt(null);return ke.linkAll(r,n),n},pt.promise=function(r){var n=new pt;return n.handleResolve(r),n},pt.__super__=ke,pt.prototype=M(ke.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var n="Promise has already been resolved";throw new Q(bn.AlreadyResolved(n))}this._resolve(r)},then:function(r){var n=new pt(null);return ke.link(this,n,r),n},unlink:function(r){var n=this;Se.queue.add(function(){if(n._fulfilled)n._update=n._update.filter(function(l){return l.async!=r});else{var a="Downstream Promise is not fullfilled";n.handleError(bn.DownstreamNotFullfilled(a))}}),Se.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var n=new pt(null);return ke.pipeLink(this,n,r),n},errorPipe:function(r){var n=new pt;return this.catchError(function(a){var l=r(a);l.then(Mt(n,n._resolve))}),this.then(Mt(n,n._resolve)),n},__class__:pt});var He=f.promhx.Stream=function(r){ke.call(this,r),this._end_promise=new pt};x["promhx.Stream"]=He,He.__name__=["promhx","Stream"],He.foreach=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.handleResolve(l)}return n.end(),n},He.wheneverAll=function(r){var n=new He(null);return ke.linkAll(r,n),n},He.concatAll=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.concat(l)}return n},He.mergeAll=function(r){for(var n=new He(null),a=Xt(r)();a.hasNext();){var l=a.next();n.merge(l)}return n},He.stream=function(r){var n=new He(null);return n.handleResolve(r),n},He.__super__=ke,He.prototype=M(ke.prototype,{then:function(r){var n=new He(null);return ke.link(this,n,r),this._end_promise._update.push({async:n._end_promise,linkf:function(a){n.end()}}),n},detachStream:function(r){for(var n=[],a=!1,l=0,c=this._update;l<c.length;){var d=c[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(p){return p.async!=r._end_promise}),a=!0):n.push(d)}return this._update=n,a},first:function(){var r=new pt(null);return this.then(function(n){r._resolved||r.handleResolve(n)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var n=new He(null);return ke.pipeLink(this,n,r),this._end_promise.then(function(a){n.end()}),n},errorPipe:function(r){var n=new He(null);return this.catchError(function(a){var l=r(a);l.then(Mt(n,n._resolve)),l._end_promise.then((Di=n._end_promise,Mt(Di,Di._resolve)))}),this.then(Mt(n,n._resolve)),this._end_promise.then(function(a){n.end()}),n},handleEnd:function(){if(this._pending)Se.queue.add(Mt(this,this.handleEnd)),Se.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=dt.Some(this._val):r=dt.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return Se.queue.add(Mt(this,this.handleEnd)),Se.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var n=new He(null);return this._update.push({async:n,linkf:function(a){r(a)&&n.handleResolve(a)}}),ke.immediateLinkUpdate(this,n,function(a){return a}),n},concat:function(r){var n=new He(null);return this._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(this,n,function(a){return a}),this._end_promise.then(function(a){r.pipe(function(l){return n.handleResolve(l),n}),r._end_promise.then(function(l){n.end()})}),n},merge:function(r){var n=new He(null);return this._update.push({async:n,linkf:Mt(n,n.handleResolve)}),r._update.push({async:n,linkf:Mt(n,n.handleResolve)}),ke.immediateLinkUpdate(this,n,function(a){return a}),ke.immediateLinkUpdate(r,n,function(a){return a}),n},__class__:He});var Tr=f.promhx.PublicStream=function(r){He.call(this,r)};x["promhx.PublicStream"]=Tr,Tr.__name__=["promhx","PublicStream"],Tr.publicstream=function(r){var n=new Tr(null);return n.handleResolve(r),n},Tr.__super__=He,Tr.prototype=M(He.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Tr});var Se=function(){};x["promhx.base.EventLoop"]=Se,Se.__name__=["promhx","base","EventLoop"],Se.enqueue=function(r){Se.queue.add(r),Se.continueOnNextLoop()},Se.set_nextLoop=function(r){if(Se.nextLoop!=null)throw new Q("nextLoop has already been set");return Se.nextLoop=r,Se.nextLoop},Se.queueEmpty=function(){return Se.queue.isEmpty()},Se.finish=function(r){r==null&&(r=1e3);for(var n=null;r-- >0&&(n=Se.queue.pop())!=null;)n();return Se.queue.isEmpty()},Se.clear=function(){Se.queue=new U},Se.f=function(){var r=Se.queue.pop();r!=null&&r(),Se.queue.isEmpty()||Se.continueOnNextLoop()},Se.continueOnNextLoop=function(){Se.nextLoop!=null?Se.nextLoop(Se.f):setImmediate(Se.f)};var bn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};bn.AlreadyResolved=function(r){var n=["AlreadyResolved",0,r];return n.__enum__=bn,n.toString=E,n},bn.DownstreamNotFullfilled=function(r){var n=["DownstreamNotFullfilled",1,r];return n.__enum__=bn,n.toString=E,n};var Bs=function(){};x["verb.Verb"]=Bs,Bs.__name__=["verb","Verb"],Bs.main=function(){b.log("verb 2.1.0")};var K=function(){};x["verb.core.ArrayExtensions"]=K,K.__name__=["verb","core","ArrayExtensions"],K.alloc=function(r,n){if(!(n<0))for(;r.length<n;)r.push(null)},K.reversed=function(r){var n=r.slice();return n.reverse(),n},K.last=function(r){return r[r.length-1]},K.first=function(r){return r[0]},K.spliceAndInsert=function(r,n,a,l){r.splice(n,a),r.splice(n,0,l)},K.left=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(0,n)},K.right=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n)},K.rightWithPivot=function(r){if(r.length==0)return[];var n=Math.ceil(r.length/2);return r.slice(n-1)},K.unique=function(r,n){if(r.length==0)return[];for(var a=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<a.length;){var p=a[d];if(++d,n(l,p)){c=!1;break}}c&&a.push(l)}return a};var De=function(){};x["verb.core.Binomial"]=De,De.__name__=["verb","core","Binomial"],De.get=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;if(n>r-n&&(n=r-n),De.memo_exists(r,n))return De.get_memo(r,n);for(var a=1,l=r,c=1,d=n+1;c<d;){var p=c++;if(De.memo_exists(l,p)){r--,a=De.get_memo(l,p);continue}a*=r--,a/=p,De.memoize(l,p,a)}return a},De.get_no_memo=function(r,n){if(n==0)return 1;if(r==0||n>r)return 0;n>r-n&&(n=r-n);for(var a=1,l=1,c=n+1;l<c;){var d=l++;a*=r--,a/=d}return a},De.memo_exists=function(r,n){return De.memo.h.hasOwnProperty(r)&&De.memo.h[r].h.hasOwnProperty(n)},De.get_memo=function(r,n){return De.memo.h[r].h[n]},De.memoize=function(r,n,a){De.memo.h.hasOwnProperty(r)||De.memo.set(r,new xe),De.memo.h[r].h[n]=a};var Et=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};x["verb.core.BoundingBox"]=Et,Et.__name__=["verb","core","BoundingBox"],Et.intervalsOverlap=function(r,n,a,l,c){c==null&&(c=-1);var d;c<-.5?d=re.TOLERANCE:d=c;var p=Math.min(r,n)-d,_=Math.max(r,n)+d,v=Math.min(a,l)-d,w=Math.max(a,l)+d;return p>=v&&p<=w||_>=v&&_<=w||v>=p&&v<=_||w>=p&&w<=_},Et.prototype={fromPoint:function(r){return new Et([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var n=0,a=this.dim;n<a;){var l=n++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var n=r.length,a=0;a<n;){var l=a++;this.add(r[l])}return this},contains:function(r,n){return n==null&&(n=-1),this.initialized?this.intersects(new Et([r]),n):!1},intersects:function(r,n){if(n==null&&(n=-1),!this.initialized||!r.initialized)return!1;for(var a=this.min,l=this.max,c=r.min,d=r.max,p=0,_=this.dim;p<_;){var v=p++;if(!Et.intervalsOverlap(a[v],l[v],c[v],d[v],n))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,n=0,a=0,l=this.dim;a<l;){var c=a++,d=this.getAxisLength(c);d>r&&(r=d,n=c)}return n},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,n){if(!this.initialized)return null;var a=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,n))return null;for(var p=[],_=[],v=0,w=this.dim;v<w;){var P=v++;p.push(Math.min(l[P],d[P])),_.push(Math.max(a[P],c[P]))}return new Et([_,p])},__class__:Et};var re=f.core.Constants=function(){};x["verb.core.Constants"]=re,re.__name__=["verb","core","Constants"];var Ze=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=Ze,Ze.__name__=["verb","core","SerializableBase"],Ze.prototype={serialize:function(){var r=new Ye;return r.serialize(this),r.toString()},__class__:Ze};var Vn=f.core.Plane=function(r,n){this.origin=r,this.normal=n};x["verb.core.Plane"]=Vn,Vn.__name__=["verb","core","Plane"],Vn.__super__=Ze,Vn.prototype=M(Ze.prototype,{__class__:Vn});var xn=f.core.Ray=function(r,n){this.origin=r,this.dir=n};x["verb.core.Ray"]=xn,xn.__name__=["verb","core","Ray"],xn.__super__=Ze,xn.prototype=M(Ze.prototype,{__class__:xn});var je=f.core.NurbsCurveData=function(r,n,a){this.degree=r,this.controlPoints=a,this.knots=n};x["verb.core.NurbsCurveData"]=je,je.__name__=["verb","core","NurbsCurveData"],je.__super__=Ze,je.prototype=M(Ze.prototype,{__class__:je});var et=f.core.NurbsSurfaceData=function(r,n,a,l,c){this.degreeU=r,this.degreeV=n,this.knotsU=a,this.knotsV=l,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=et,et.__name__=["verb","core","NurbsSurfaceData"],et.__super__=Ze,et.prototype=M(Ze.prototype,{__class__:et});var qt=f.core.MeshData=function(r,n,a,l){this.faces=r,this.points=n,this.normals=a,this.uvs=l};x["verb.core.MeshData"]=qt,qt.__name__=["verb","core","MeshData"],qt.empty=function(){return new qt([],[],[],[])},qt.__super__=Ze,qt.prototype=M(Ze.prototype,{__class__:qt});var jn=f.core.PolylineData=function(r,n){this.points=r,this.params=n};x["verb.core.PolylineData"]=jn,jn.__name__=["verb","core","PolylineData"],jn.__super__=Ze,jn.prototype=M(Ze.prototype,{__class__:jn});var Gn=f.core.VolumeData=function(r,n,a,l,c,d,p){this.degreeU=r,this.degreeV=n,this.degreeW=a,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=p};x["verb.core.VolumeData"]=Gn,Gn.__name__=["verb","core","VolumeData"],Gn.__super__=Ze,Gn.prototype=M(Ze.prototype,{__class__:Gn});var tt=f.core.Pair=function(r,n){this.item0=r,this.item1=n};x["verb.core.Pair"]=tt,tt.__name__=["verb","core","Pair"],tt.prototype={__class__:tt};var wt=f.core.Interval=function(r,n){this.min=r,this.max=n};x["verb.core.Interval"]=wt,wt.__name__=["verb","core","Interval"],wt.prototype={__class__:wt};var Xr=f.core.CurveCurveIntersection=function(r,n,a,l){this.point0=r,this.point1=n,this.u0=a,this.u1=l};x["verb.core.CurveCurveIntersection"]=Xr,Xr.__name__=["verb","core","CurveCurveIntersection"],Xr.prototype={__class__:Xr};var Wn=f.core.CurveSurfaceIntersection=function(r,n,a,l){this.u=r,this.uv=n,this.curvePoint=a,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=Wn,Wn.__name__=["verb","core","CurveSurfaceIntersection"],Wn.prototype={__class__:Wn};var Cr=f.core.MeshIntersectionPoint=function(r,n,a,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=n,this.point=a,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Cr,Cr.__name__=["verb","core","MeshIntersectionPoint"],Cr.prototype={__class__:Cr};var Hn=f.core.PolylineMeshIntersection=function(r,n,a,l,c){this.point=r,this.u=n,this.uv=a,this.polylineIndex=l,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=Hn,Hn.__name__=["verb","core","PolylineMeshIntersection"],Hn.prototype={__class__:Hn};var qn=f.core.SurfaceSurfaceIntersectionPoint=function(r,n,a,l){this.uv0=r,this.uv1=n,this.point=a,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=qn,qn.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],qn.prototype={__class__:qn};var Yn=f.core.TriSegmentIntersection=function(r,n,a,l){this.point=r,this.s=n,this.t=a,this.p=l};x["verb.core.TriSegmentIntersection"]=Yn,Yn.__name__=["verb","core","TriSegmentIntersection"],Yn.prototype={__class__:Yn};var wn=f.core.CurveTriPoint=function(r,n,a){this.u=r,this.point=n,this.uv=a};x["verb.core.CurveTriPoint"]=wn,wn.__name__=["verb","core","CurveTriPoint"],wn.prototype={__class__:wn};var jt=function(r,n,a,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=a,this.point=r,this.normal=n,this.id=l,this.degen=c};x["verb.core.SurfacePoint"]=jt,jt.__name__=["verb","core","SurfacePoint"],jt.fromUv=function(r,n){return new jt(null,null,[r,n])},jt.prototype={__class__:jt};var Fs=f.core.CurvePoint=function(r,n){this.u=r,this.pt=n};x["verb.core.CurvePoint"]=Fs,Fs.__name__=["verb","core","CurvePoint"],Fs.prototype={__class__:Fs};var Xn=f.core.KdTree=function(r,n){this.dim=3,this.points=r,this.distanceFunction=n,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=Xn,Xn.__name__=["verb","core","KdTree"],Xn.prototype={buildTree:function(r,n,a){var l=n%this.dim,c,d;return r.length==0?null:r.length==1?new Sn(r[0],l,a):(r.sort(function(p,_){var v=p.point[l]-_.point[l];return v==0?0:v>0?1:-1}),c=Math.floor(r.length/2),d=new Sn(r[c],l,a),d.left=this.buildTree(r.slice(0,c),n+1,d),d.right=this.buildTree(r.slice(c+1),n+1,d),d)},nearest:function(r,n,a){var l=this,c=new Kn(function(A){return-A.item1}),d,p=null;p=function(A){for(var I,k=A.dimension,T=l.distanceFunction(r,A.kdPoint.point),L,N=[],R=0,O=l.dim;R<O;)R++,N.push(0);L=N;for(var F,V,q=function(X,ee){c.push(new tt(X,ee)),c.size()>n&&c.pop()},J=0,H=l.dim;J<H;){var j=J++;j==A.dimension?L[j]=r[j]:L[j]=A.kdPoint.point[j]}if(F=l.distanceFunction(L,A.kdPoint.point),A.right==null&&A.left==null){(c.size()<n||T<c.peek().item1)&&q(A,T);return}A.right==null?I=A.left:A.left==null?I=A.right:r[k]<A.kdPoint.point[k]?I=A.left:I=A.right,p(I),(c.size()<n||T<c.peek().item1)&&q(A,T),(c.size()<n||Math.abs(F)<c.peek().item1)&&(I==A.left?V=A.right:V=A.left,V!=null&&p(V))},d=p;for(var _=0;_<n;)_++,c.push(new tt(null,a));d(this.root);for(var v=[],w=0;w<n;){var P=w++;c.content[P].item0!=null&&v.push(new tt(c.content[P].item0.kdPoint,c.content[P].item1))}return v},__class__:Xn};var Kn=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=Kn,Kn.__name__=["verb","core","BinaryHeap"],Kn.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],n=this.content.pop();return this.content.length>0&&(this.content[0]=n,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var n=this.content.length,a=0;a<n;){var l=a++;if(this.content[l]==r){var c=this.content.pop();l!=n-1&&(this.content[l]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var n=this.content[r];r>0;){var a=Math.floor((r+1)/2)-1,l=this.content[a];if(this.scoreFunction(n)<this.scoreFunction(l))this.content[a]=n,this.content[r]=l,r=a;else break}},sinkDown:function(r){for(var n=this.content.length,a=this.content[r],l=this.scoreFunction(a);;){var c=(r+1)*2,d=c-1,p=-1,_=0;if(d<n){var v=this.content[d];_=this.scoreFunction(v),_<l&&(p=d)}if(c<n){var w=this.content[c],P=this.scoreFunction(w);P<(p==-1?l:_)&&(p=c)}if(p!=-1)this.content[r]=this.content[p],this.content[p]=a,r=p;else break}},__class__:Kn};var An=f.core.KdPoint=function(r,n){this.point=r,this.obj=n};x["verb.core.KdPoint"]=An,An.__name__=["verb","core","KdPoint"],An.prototype={__class__:An};var Sn=f.core.KdNode=function(r,n,a){this.kdPoint=r,this.left=null,this.right=null,this.parent=a,this.dimension=n};x["verb.core.KdNode"]=Sn,Sn.__name__=["verb","core","KdNode"],Sn.prototype={__class__:Sn};var cr=function(){};x["verb.eval.IBoundingBoxTree"]=cr,cr.__name__=["verb","eval","IBoundingBoxTree"],cr.prototype={__class__:cr};var sr=function(r,n){this._boundingBox=null,this._curve=r,n==null&&(n=m.domain(this._curve.knots)/64),this._knotTol=n};x["verb.core.LazyCurveBoundingBoxTree"]=sr,sr.__name__=["verb","core","LazyCurveBoundingBoxTree"],sr.__interfaces__=[cr],sr.prototype={split:function(){var r=K.first(this._curve.knots),n=K.last(this._curve.knots),a=n-r,l=lt.curveSplit(this._curve,(n+r)/2+a*.1*Math.random());return new tt(new sr(l[0],this._knotTol),new sr(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Et(C.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return m.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:sr};var ir=function(r,n){if(this._boundingBox=null,this._mesh=r,n==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}n=a}this._faceIndices=n};x["verb.core.LazyMeshBoundingBoxTree"]=ir,ir.__name__=["verb","core","LazyMeshBoundingBoxTree"],ir.__interfaces__=[cr],ir.prototype={split:function(){var r=rt.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),n=K.left(r),a=K.right(r);return new tt(new ir(this._mesh,n),new ir(this._mesh,a))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=rt.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:ir};var ar=function(r,n){this._boundingBox=null,this._polyline=r,n==null&&(n=new wt(0,r.points.length!=0?r.points.length-1:0)),this._interval=n};x["verb.core.LazyPolylineBoundingBoxTree"]=ar,ar.__name__=["verb","core","LazyPolylineBoundingBoxTree"],ar.__interfaces__=[cr],ar.prototype={split:function(){var r=this._interval.min,n=this._interval.max,a=r+Math.ceil((n-r)/2),l=new wt(r,a),c=new wt(a,n);return new tt(new ar(this._polyline,l),new ar(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Et(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:ar};var Nr=function(r,n,a,l){n==null&&(n=!1),this._boundingBox=null,this._surface=r,this._splitV=n,a==null&&(a=m.domain(r.knotsU)/16),l==null&&(l=m.domain(r.knotsV)/16),this._knotTolU=a,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Nr,Nr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Nr.__interfaces__=[cr],Nr.prototype={split:function(){var r,n;this._splitV?(r=K.first(this._surface.knotsV),n=K.last(this._surface.knotsV)):(r=K.first(this._surface.knotsU),n=K.last(this._surface.knotsU));var a=(r+n)/2,l=lt.surfaceSplit(this._surface,a,this._splitV);return new tt(new Nr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Nr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Et;for(var r=0,n=this._surface.controlPoints;r<n.length;){var a=n[r];++r,this._boundingBox.addRange(C.dehomogenize1d(a))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return m.domain(this._surface.knotsV)<this._knotTolV&&m.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Nr};var Ne=f.core.Mat=function(){};x["verb.core.Mat"]=Ne,Ne.__name__=["verb","core","Mat"],Ne.mul=function(r,n){for(var a=[],l=0,c=n.length;l<c;){var d=l++;a.push(m.mul(r,n[d]))}return a},Ne.mult=function(r,n){var a,l,c,d,p,_,v,w;a=r.length,l=n.length,c=n[0].length,d=[];for(var P=a-1,A=0,I=0;P>=0;){for(p=[],_=r[P],I=c-1;I>=0;){for(v=_[l-1]*n[l-1][I],A=l-2;A>=1;)w=A-1,v+=_[A]*n[A][I]+_[w]*n[w][I],A-=2;A==0&&(v+=_[0]*n[0][I]),p[I]=v,I--}d[P]=p,P--}return d},Ne.add=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.add(r[d],n[d]))}return a},Ne.div=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.div(r[d],n))}return a},Ne.sub=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.sub(r[d],n[d]))}return a},Ne.dot=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(m.dot(r[d],n))}return a},Ne.identity=function(r){for(var n=m.zeros2d(r,r),a=0;a<r;){var l=a++;n[l][l]=1}return n},Ne.transpose=function(r){if(r.length==0)return[];for(var n=[],a=0,l=r[0].length;a<l;){var c=a++;n.push(function(d){for(var p,_=[],v=0,w=r.length;v<w;){var P=v++;_.push(r[P][c])}return p=_,p}())}return n},Ne.solve=function(r,n){return Ne.LUsolve(Ne.LU(r),n)},Ne.LUsolve=function(r,n){var a,l,c=r.LU,d=c.length,p=n.slice(),_=r.P,v,w,P;for(a=d-1;a!=-1;)p[a]=n[a],--a;for(a=0;a<d;){for(v=_[a],_[a]!=a&&(P=p[a],p[a]=p[v],p[v]=P),w=c[a],l=0;l<a;)p[a]-=p[l]*w[l],++l;++a}for(a=d-1;a>=0;){for(w=c[a],l=a+1;l<d;)p[a]-=p[l]*w[l],++l;p[a]/=w[a],--a}return p},Ne.LU=function(r){for(var n,a,l,c,d,p,_,v,w,P=[],A=0,I=r.length;A<I;){var k=A++;P.push(r[k].slice())}r=P;var T=r.length,L=T-1,N=[];for(l=0;l<T;){for(_=l,p=r[l],w=Math.abs(p[l]),a=l+1;a<T;)c=Math.abs(r[a][l]),w<c&&(w=c,_=a),++a;for(N[l]=_,_!=l&&(r[l]=r[_],r[_]=p,p=r[l]),d=p[l],n=l+1;n<T;)r[n][l]/=d,++n;for(n=l+1;n<T;){for(v=r[n],a=l+1;a<L;)v[a]-=v[l]*p[a],++a,v[a]-=v[l]*p[a],++a;a==L&&(v[a]-=v[l]*p[a]),++n}++l}return new $n(r,N)};var $n=function(r,n){this.LU=r,this.P=n};x["verb.core._Mat.LUDecomp"]=$n,$n.__name__=["verb","core","_Mat","LUDecomp"],$n.prototype={__class__:$n};var rt=f.core.Mesh=function(){};x["verb.core.Mesh"]=rt,rt.__name__=["verb","core","Mesh"],rt.getTriangleNorm=function(r,n){var a=r[n[0]],l=r[n[1]],c=r[n[2]],d=m.sub(l,a),p=m.sub(c,a),_=m.cross(d,p);return m.mul(1/m.norm(_),_)},rt.makeMeshAabb=function(r,n){for(var a=new Et,l=0;l<n.length;){var c=n[l];++l,a.add(r.points[r.faces[c][0]]),a.add(r.points[r.faces[c][1]]),a.add(r.points[r.faces[c][2]])}return a},rt.sortTrianglesOnLongestAxis=function(r,n,a){for(var l=r.getLongestAxis(),c=[],d=0;d<a.length;){var p=a[d];++d;var _=rt.getMinCoordOnAxis(n.points,n.faces[p],l);c.push(new tt(_,p))}c.sort(function(I,k){var T=I.item0,L=k.item0;return T==L?0:T>L?1:-1});for(var v=[],w=0,P=c.length;w<P;){var A=w++;v.push(c[A].item1)}return v},rt.getMinCoordOnAxis=function(r,n,a){for(var l=1/0,c=0;c<3;){var d=c++,p=r[n[d]][a];p<l&&(l=p)}return l},rt.getTriangleCentroid=function(r,n){for(var a=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var p=d++;a[p]+=r[n[c]][p]}for(var _=0;_<3;){var v=_++;a[v]/=3}return a},rt.triangleUVFromPoint=function(r,n,a){var l=r.faces[n],c=r.points[l[0]],d=r.points[l[1]],p=r.points[l[2]],_=r.uvs[l[0]],v=r.uvs[l[1]],w=r.uvs[l[2]],P=m.sub(c,a),A=m.sub(d,a),I=m.sub(p,a),k=m.norm(m.cross(m.sub(c,d),m.sub(c,p))),T=m.norm(m.cross(A,I))/k,L=m.norm(m.cross(I,P))/k,N=m.norm(m.cross(P,A))/k;return m.add(m.mul(T,_),m.add(m.mul(L,v),m.mul(N,w)))};var Lr=function(r,n){if(this._empty=!1,this._face=-1,n==null){for(var a=[],l=0,c=r.faces.length;l<c;){var d=l++;a.push(d)}n=a}if(this._boundingBox=rt.makeMeshAabb(r,n),n.length<1){this._empty=!0;return}else if(n.length<2){this._face=n[0];return}var p=rt.sortTrianglesOnLongestAxis(this._boundingBox,r,n),_=K.left(p),v=K.right(p);this._children=new tt(new Lr(r,_),new Lr(r,v))};x["verb.core.MeshBoundingBoxTree"]=Lr,Lr.__name__=["verb","core","MeshBoundingBoxTree"],Lr.__interfaces__=[cr],Lr.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:Lr};var Yt=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=Yt,Yt.__name__=["verb","core","Minimizer"],Yt.uncmin=function(r,n,a,l,c){a==null&&(a=1e-8),l==null&&(l=function(J){return Yt.numericalGradient(r,J)}),c==null&&(c=1e3),n=n.slice(0);var d=n.length,p=r(n),_=p,v;if(isNaN(p))throw new Q("uncmin: f(x0) is a NaN!");a=Math.max(a,re.EPSILON);var w,P,A,I=Ne.identity(d),k=0,T=[],L,N,R,O,F,V,q="";for(P=l(n);k<c;){if(!m.all(m.finite(P))){q="Gradient has Infinity or NaN";break}if(w=m.neg(Ne.dot(I,P)),!m.all(m.finite(w))){q="Search direction has Infinity or NaN";break}if(V=m.norm(w),V<a){q="Newton step smaller than tol";break}for(F=1,v=m.dot(P,w),L=n;k<c&&!(F*V<a);){if(T=m.mul(F,w),L=m.add(n,T),_=r(L),_-p>=.1*F*v||isNaN(_)){F*=.5,++k;continue}break}if(F*V<a){q="Line search step size smaller than tol";break}if(k==c){q="maxit reached during line search";break}A=l(L),N=m.sub(A,P),O=m.dot(N,T),R=Ne.dot(I,N),I=Ne.sub(Ne.add(I,Ne.mul((O+m.dot(N,R))/(O*O),Yt.tensor(T,T))),Ne.div(Ne.add(Yt.tensor(R,T),Yt.tensor(T,R)),O)),n=L,p=_,P=A,++k}return new Zn(n,p,P,I,k,q)},Yt.numericalGradient=function(r,n){var a=n.length,l=r(n);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=n.slice(0),d,p,_=[],v,w=.001,P,A,I,k=0,T,L,N,R=0;R<a;)for(var O=R++,F=Math.max(1e-6*l,1e-8);;){if(++k,k>20)throw new Q("Numerical gradient fails");if(c[O]=n[O]+F,d=r(c),c[O]=n[O]-F,p=r(c),c[O]=n[O],isNaN(d)||isNaN(p)){F/=16;continue}if(_[O]=(d-p)/(2*F),P=n[O]-F,A=n[O],I=n[O]+F,T=(d-l)/F,L=(l-p)/F,N=m.max([Math.abs(_[O]),Math.abs(l),Math.abs(d),Math.abs(p),Math.abs(P),Math.abs(A),Math.abs(I),1e-8]),v=Math.min(m.max([Math.abs(T-_[O]),Math.abs(L-_[O]),Math.abs(T-L)])/N,F/N),v>w)F/=16;else break}return _},Yt.tensor=function(r,n){for(var a=r.length,l=n.length,c=[],d,p,_=a-1;_>=0;){d=[],p=r[_];for(var v=l-1;v>=3;)d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v,d[v]=p*n[v],--v;for(;v>=0;)d[v]=p*n[v],--v;c[_]=d,_--}return c};var Zn=function(r,n,a,l,c,d){this.solution=r,this.value=n,this.gradient=a,this.invHessian=l,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=Zn,Zn.__name__=["verb","core","MinimizationResult"],Zn.prototype={__class__:Zn};var Pn=function(){};x["verb.core.ISerializable"]=Pn,Pn.__name__=["verb","core","ISerializable"],Pn.prototype={__class__:Pn};var zi=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=zi,zi.__name__=["verb","core","Deserializer"],zi.deserialize=function(r){var n=new We(r),a=n.unserialize();return a};var kt=f.core.Trig=function(){};x["verb.core.Trig"]=kt,kt.__name__=["verb","core","Trig"],kt.isPointInPlane=function(r,n,a){return Math.abs(m.dot(m.sub(r,n.origin),n.normal))<a},kt.distToSegment=function(r,n,a){var l=kt.segmentClosestPoint(n,r,a,0,1);return m.dist(n,l.pt)},kt.rayClosestPoint=function(r,n,a){var l=m.sub(r,n),c=m.dot(l,a),d=m.add(n,m.mul(c,a));return d},kt.distToRay=function(r,n,a){var l=kt.rayClosestPoint(r,n,a),c=m.sub(l,r);return m.norm(c)},kt.threePointsAreFlat=function(r,n,a,l){var c=m.sub(n,r),d=m.sub(a,r),p=m.cross(c,d),_=m.dot(p,p);return _<l},kt.segmentClosestPoint=function(r,n,a,l,c){var d=m.sub(a,n),p=m.norm(d);if(p<re.EPSILON)return{u:l,pt:n};var _=n,v=m.mul(1/p,d),w=m.sub(r,_),P=m.dot(w,v);return P<0?{u:l,pt:n}:P>p?{u:c,pt:a}:{u:l+(c-l)*P/p,pt:m.add(_,m.mul(P,v))}};var m=f.core.Vec=function(){};x["verb.core.Vec"]=m,m.__name__=["verb","core","Vec"],m.angleBetween=function(r,n){return Math.acos(m.dot(r,n)/(m.norm(r)*m.norm(n)))},m.positiveAngleBetween=function(r,n,a){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(a,l);return Math.abs(A)<re.EPSILON||A>0?P:-P},m.signedAngleBetween=function(r,n,a){var l=m.cross(r,n),c=m.norm(r),d=m.norm(n),p=c*d,_=m.dot(r,n),v=m.norm(l)/p,w=_/p,P=Math.atan2(v,w),A=m.dot(a,l);return A>0?P:2*Math.PI-P},m.angleBetweenNormalized2d=function(r,n){var a=r[0]*n[1]-r[1]*n[0];return Math.atan2(a,m.dot(r,n))},m.domain=function(r){return K.last(r)-K.first(r)},m.range=function(r){for(var n=[],a=0,l=0;l<r;)l++,n.push(a),a+=1;return n},m.span=function(r,n,a){if(a==null)return[];if(a<re.EPSILON)return[];if(r>n&&a>0)return[];if(n>r&&a<0)return[];for(var l=[],c=r;c<=n;)l.push(c),c+=a;return l},m.neg=function(r){return r.map(function(n){return-n})},m.min=function(r){return D.fold(r,function(n,a){return Math.min(n,a)},1/0)},m.max=function(r){return D.fold(r,function(n,a){return Math.max(n,a)},-1/0)},m.all=function(r){return D.fold(r,function(n,a){return a&&n},!0)},m.finite=function(r){return r.map(function(n){return isFinite(n)})},m.onRay=function(r,n,a){return m.add(r,m.mul(a,n))},m.lerp=function(r,n,a){return m.add(m.mul(r,n),m.mul(1-r,a))},m.normalized=function(r){return m.div(r,m.norm(r))},m.cross=function(r,n){return[r[1]*n[2]-r[2]*n[1],r[2]*n[0]-r[0]*n[2],r[0]*n[1]-r[1]*n[0]]},m.dist=function(r,n){return m.norm(m.sub(r,n))},m.distSquared=function(r,n){return m.normSquared(m.sub(r,n))},m.sum=function(r){return D.fold(r,function(n,a){return a+n},0)},m.addAll=function(r){var n=Xt(r)();if(!n.hasNext())return null;var a=n.next().length;return D.fold(r,function(l,c){return m.add(c,l)},m.rep(a,0))},m.addAllMutate=function(r){for(var n=r[0],a=1,l=r.length;a<l;){var c=a++;m.addMutate(n,r[c])}},m.addMulMutate=function(r,n,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+n*a[d]}},m.subMulMutate=function(r,n,a){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-n*a[d]}},m.addMutate=function(r,n){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]+n[c]}},m.subMutate=function(r,n){for(var a=0,l=r.length;a<l;){var c=a++;r[c]=r[c]-n[c]}},m.mulMutate=function(r,n){for(var a=0,l=n.length;a<l;){var c=a++;n[c]=n[c]*r}},m.norm=function(r){var n=m.normSquared(r);return n!=0?Math.sqrt(n):n},m.normSquared=function(r){return D.fold(r,function(n,a){return a+n*n},0)},m.rep=function(r,n){for(var a=[],l=0;l<r;)l++,a.push(n);return a},m.zeros1d=function(r){for(var n=[],a=0;a<r;)a++,n.push(0);return n},m.zeros2d=function(r,n){for(var a=[],l=0;l<r;)l++,a.push(m.zeros1d(n));return a},m.zeros3d=function(r,n,a){for(var l=[],c=0;c<r;)c++,l.push(m.zeros2d(n,a));return l},m.dot=function(r,n){for(var a=0,l=0,c=r.length;l<c;){var d=l++;a+=r[d]*n[d]}return a},m.add=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]+n[d])}return a},m.mul=function(r,n){for(var a=[],l=0,c=n.length;l<c;){var d=l++;a.push(r*n[d])}return a},m.div=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]/n)}return a},m.sub=function(r,n){for(var a=[],l=0,c=r.length;l<c;){var d=l++;a.push(r[d]-n[d])}return a},m.isZero=function(r){for(var n=0,a=r.length;n<a;){var l=n++;if(Math.abs(r[l])>re.TOLERANCE)return!1}return!0},m.sortedSetUnion=function(r,n){for(var a=[],l=0,c=0;l<r.length||c<n.length;){if(l>=r.length){a.push(n[c]),c++;continue}else if(c>=n.length){a.push(r[l]),l++;continue}var d=r[l]-n[c];if(Math.abs(d)<re.EPSILON){a.push(r[l]),l++,c++;continue}if(d>0){a.push(n[c]),c++;continue}a.push(r[l]),l++}return a},m.sortedSetSub=function(r,n){for(var a=[],l=0,c=0;l<r.length;){if(c>=n.length){a.push(r[l]),l++;continue}if(Math.abs(r[l]-n[c])<re.EPSILON){l++,c++;continue}a.push(r[l]),l++}return a};var ve=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=ve,ve.__name__=["verb","eval","Analyze"],ve.knotMultiplicities=function(r){for(var n=[new In(r[0],0)],a=n[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-a.knot)>re.EPSILON&&(a=new In(c,0),n.push(a)),a.inc()}return n},ve.isRationalSurfaceClosed=function(r,n){n==null&&(n=!0);var a;n?a=r.controlPoints:a=Ne.transpose(r.controlPoints);for(var l=0,c=a[0].length;l<c;){var d=l++,p=m.dist(K.first(a)[d],K.last(a)[d])<re.EPSILON;if(!p)return!1}return!0},ve.rationalSurfaceClosestPoint=function(r,n){var a=ve.rationalSurfaceClosestParam(r,n);return C.rationalSurfacePoint(r,a[0],a[1])},ve.rationalSurfaceClosestParam=function(r,n){for(var a=5,l=0,c,d=1e-4,p=5e-4,_,v=r.knotsU[0],w=K.last(r.knotsU),P=r.knotsV[0],A=K.last(r.knotsV),I=ve.isRationalSurfaceClosed(r),k=ve.isRationalSurfaceClosed(r,!1),T,L=Oe.rationalSurfaceAdaptive(r,new Or),N=1/0,R=0,O=L.points.length;R<O;){var F=R++,V=L.points[F],q=m.normSquared(m.sub(n,V));q<N&&(N=q,T=L.uvs[F])}for(var J=function(Ge){return C.rationalSurfaceDerivatives(r,Ge[0],Ge[1],2)},H=function(Ge,Xe,Fe){var Ke=Xe[1][0],At=Xe[0][1],Wt=Xe[2][0],vt=Xe[0][2],gt=Xe[1][1],St=Xe[1][1],Tt=m.dot(Ke,Fe),Kt=m.dot(At,Fe),or=[-Tt,-Kt],$t=m.dot(Ke,Ke)+m.dot(Wt,Fe),Zt=m.dot(Ke,At)+m.dot(gt,Fe),Qt=m.dot(Ke,At)+m.dot(St,Fe),dr=m.dot(At,At)+m.dot(vt,Fe),Tn=[[$t,Zt],[Qt,dr]],$r=Ne.solve(Tn,or);return m.add($r,Ge)};l<a;){c=J(T),_=m.sub(c[0][0],n);var j=m.norm(_),X=m.dot(c[1][0],_),ee=m.norm(c[1][0])*j,te=m.dot(c[0][1],_),ie=m.norm(c[0][1])*j,he=X/ee,ae=te/ie,ue=j<d,ne=he<p,de=ae<p;if(ue&&ne&&de)return T;var Y=H(T,c,_);Y[0]<v?I?Y=[w-(Y[0]-v),Y[1]]:Y=[v+re.EPSILON,Y[1]]:Y[0]>w&&(I?Y=[v+(Y[0]-w),Y[1]]:Y=[w-re.EPSILON,Y[1]]),Y[1]<P?k?Y=[Y[0],A-(Y[1]-P)]:Y=[Y[0],P+re.EPSILON]:Y[1]>A&&(k?Y=[Y[0],P+(Y[0]-A)]:Y=[Y[0],A-re.EPSILON]);var pe=m.norm(m.mul(Y[0]-T[0],c[1][0])),Pe=m.norm(m.mul(Y[1]-T[1],c[0][1]));if(pe+Pe<d)return T;T=Y,l++}return T},ve.rationalCurveClosestPoint=function(r,n){return C.rationalCurvePoint(r,ve.rationalCurveClosestParam(r,n))},ve.rationalCurveClosestParam=function(r,n){for(var a=1/0,l=0,c=Oe.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,p=c.length-1;d<p;){var _=d++,v=c[_][0],w=c[_+1][0],P=c[_].slice(1),A=c[_+1].slice(1),I=kt.segmentClosestPoint(n,P,A,v,w),k=m.norm(m.sub(n,I.pt));k<a&&(a=k,l=I.u)}for(var T=5,L=0,N,R=1e-4,O=5e-4,F,V=r.knots[0],q=K.last(r.knots),J=m.normSquared(m.sub(r.controlPoints[0],K.last(r.controlPoints)))<re.EPSILON,H=l,j=function(Y){return C.rationalCurveDerivatives(r,Y,2)},X=function(Y,pe,Pe){var Ge=m.dot(pe[1],Pe),Xe=m.dot(pe[2],Pe),Fe=m.dot(pe[1],pe[1]),Ke=Xe+Fe;return Y-Ge/Ke};L<T;){N=j(H),F=m.sub(N[0],n);var ee=m.norm(F),te=m.dot(N[1],F),ie=m.norm(N[1])*ee,he=te/ie,ae=ee<R,ue=Math.abs(he)<O;if(ae&&ue)return H;var ne=X(H,N,F);ne<V?J?ne=q-(ne-V):ne=V:ne>q&&(J?ne=V+(ne-q):ne=q);var de=m.norm(m.mul(ne-H,N[1]));if(de<R)return H;H=ne,L++}return H},ve.rationalCurveParamAtArcLength=function(r,n,a,l,c){if(a==null&&(a=.001),n<re.EPSILON)return r.knots[0];var d;l!=null?d=l:d=fe.decomposeCurveIntoBeziers(r);var p=0;d[p];var _=-re.EPSILON,v;for(c!=null?v=c:v=[];_<n&&p<d.length;){if(p<v.length?v[p]=v[p]:v[p]=ve.rationalBezierCurveArcLength(r),_+=v[p],n<_+re.EPSILON)return ve.rationalBezierCurveParamAtArcLength(r,n,a,v[p]);p++}return-1},ve.rationalBezierCurveParamAtArcLength=function(r,n,a,l){if(n<0)return r.knots[0];var c;if(l!=null?c=l:c=ve.rationalBezierCurveArcLength(r),n>c)return K.last(r.knots);var d=r.knots[0],p=0,_=K.last(r.knots),v=c,w=0,P=0,A;for(a!=null?A=a:A=re.TOLERANCE*2;v-p>A;)w=(d+_)/2,P=ve.rationalBezierCurveArcLength(r,w),P>n?(_=w,v=P):(d=w,p=P);return(d+_)/2},ve.rationalCurveArcLength=function(r,n,a){a==null&&(a=16),n==null?n=K.last(r.knots):n=n;for(var l=fe.decomposeCurveIntoBeziers(r),c=0,d=l[0],p=0;c<l.length&&d.knots[0]+re.EPSILON<n;){var _=Math.min(K.last(d.knots),n);p+=ve.rationalBezierCurveArcLength(d,_,a),d=l[++c]}return p},ve.rationalBezierCurveArcLength=function(r,n,a){a==null&&(a=16);var l;n==null?l=K.last(r.knots):l=n;for(var c=(l-r.knots[0])/2,d=0,p=r.degree+a,_,v,w=0;w<p;){var P=w++;_=c*ve.Tvalues[p][P]+c+r.knots[0],v=C.rationalCurveDerivatives(r,_,1),d+=ve.Cvalues[p][P]*m.norm(v[1])}return c*d};var In=f.eval.KnotMultiplicity=function(r,n){this.knot=r,this.mult=n};x["verb.eval.KnotMultiplicity"]=In,In.__name__=["verb","eval","KnotMultiplicity"],In.prototype={inc:function(){this.mult++},__class__:In};var Gt=f.eval.Check=function(){};x["verb.eval.Check"]=Gt,Gt.__name__=["verb","eval","Check"],Gt.isValidKnotVector=function(r,n){if(r.length==0||r.length<(n+1)*2)return!1;for(var a=K.first(r),l=0,c=n+1;l<c;){var d=l++;if(Math.abs(r[d]-a)>re.EPSILON)return!1}a=K.last(r);for(var p=r.length-n-1,_=r.length;p<_;){var v=p++;if(Math.abs(r[v]-a)>re.EPSILON)return!1}return Gt.isNonDecreasing(r)},Gt.isNonDecreasing=function(r){for(var n=K.first(r),a=0,l=r.length;a<l;){var c=a++;if(r[c]<n-re.EPSILON)return!1;n=r[c]}return!0},Gt.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Gt.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Gt.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Gt.isValidKnotVector(r.knotsU,r.degreeU)||!Gt.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var lt=f.eval.Divide=function(){};x["verb.eval.Divide"]=lt,lt.__name__=["verb","eval","Divide"],lt.surfaceSplit=function(r,n,a){a==null&&(a=!1);var l,c,d;a?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Ne.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var p,_=[],v=0,w=c+1;v<w;)v++,_.push(n);p=_;for(var P=[],A=[],I=C.knotSpan(c,n,l),k=null,T=0;T<d.length;){var L=d[T];++T,k=fe.curveKnotRefine(new je(c,l,L),p),P.push(k.controlPoints.slice(0,I+1)),A.push(k.controlPoints.slice(I+1))}var N=k.knots.slice(0,I+c+2),R=k.knots.slice(I+1);return a?[new et(r.degreeU,c,r.knotsU.slice(),N,P),new et(r.degreeU,c,r.knotsU.slice(),R,A)]:(P=Ne.transpose(P),A=Ne.transpose(A),[new et(c,r.degreeV,N,r.knotsV.slice(),P),new et(c,r.degreeV,R,r.knotsV.slice(),A)])},lt.curveSplit=function(r,n){var a=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],p=0,_=a+1;p<_;)p++,d.push(n);c=d;var v=fe.curveKnotRefine(r,c),w=C.knotSpan(a,n,l),P=v.knots.slice(0,w+a+2),A=v.knots.slice(w+1),I=v.controlPoints.slice(0,w+1),k=v.controlPoints.slice(w+1);return[new je(a,P,I),new je(a,A,k)]},lt.rationalCurveByEqualArcLength=function(r,n){var a=ve.rationalCurveArcLength(r),l=a/n;return lt.rationalCurveByArcLength(r,l)},lt.rationalCurveByArcLength=function(r,n){var a=fe.decomposeCurveIntoBeziers(r),l=a.map(function(I){return ve.rationalBezierCurveArcLength(I)}),c=m.sum(l),d=[new En(r.knots[0],0)];if(n>c)return d;for(var p=n,_=0,v=p,w=0,P=0,A;_<a.length;){for(w+=l[_];v<w+re.EPSILON;)A=ve.rationalBezierCurveParamAtArcLength(a[_],v-P,re.TOLERANCE,l[_]),d.push(new En(A,v)),v+=p;P+=l[_],_++}return d};var En=f.eval.CurveLengthSample=function(r,n){this.u=r,this.len=n};x["verb.eval.CurveLengthSample"]=En,En.__name__=["verb","eval","CurveLengthSample"],En.prototype={__class__:En};var C=f.eval.Eval=function(){};x["verb.eval.Eval"]=C,C.__name__=["verb","eval","Eval"],C.rationalCurveTangent=function(r,n){var a=C.rationalCurveDerivatives(r,n,1);return a[1]},C.rationalSurfaceNormal=function(r,n,a){var l=C.rationalSurfaceDerivatives(r,n,a,1);return m.cross(l[1][0],l[0][1])},C.rationalSurfaceDerivatives=function(r,n,a,l){l==null&&(l=1);for(var c=C.surfaceDerivatives(r,n,a,l),d=C.rational2d(c),p=C.weight2d(c),_=[],v=d[0][0].length,w=0,P=l+1;w<P;){var A=w++;_.push([]);for(var I=0,k=l-A+1;I<k;){for(var T=I++,L=d[A][T],N=1,R=T+1;N<R;){var O=N++;m.subMulMutate(L,De.get(T,O)*p[0][O],_[A][T-O])}for(var F=1,V=A+1;F<V;){var q=F++;m.subMulMutate(L,De.get(A,q)*p[q][0],_[A-q][T]);for(var J=m.zeros1d(v),H=1,j=T+1;H<j;){var X=H++;m.addMulMutate(J,De.get(T,X)*p[q][X],_[A-q][T-X])}m.subMulMutate(L,De.get(A,q),J)}m.mulMutate(1/p[0][0],L),_[A].push(L)}}return _},C.rationalSurfacePoint=function(r,n,a){return C.dehomogenize(C.surfacePoint(r,n,a))},C.rationalCurveDerivatives=function(r,n,a){a==null&&(a=1);for(var l=C.curveDerivatives(r,n,a),c=C.rational1d(l),d=C.weight1d(l),p=[],_=0,v=a+1;_<v;){for(var w=_++,P=c[w],A=1,I=w+1;A<I;){var k=A++;m.subMulMutate(P,De.get(w,k)*d[k],p[w-k])}m.mulMutate(1/d[0],P),p.push(P)}return p},C.rationalCurvePoint=function(r,n){return C.dehomogenize(C.curvePoint(r,n))},C.surfaceDerivatives=function(r,n,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return C.surfaceDerivativesGivenNM(c,d,r,n,a,l)},C.surfaceDerivativesGivenNM=function(r,n,a,l,c,d){var p=a.degreeU,_=a.degreeV,v=a.controlPoints,w=a.knotsU,P=a.knotsV;if(!C.areValidRelations(p,v.length,w.length)||!C.areValidRelations(_,v[0].length,P.length))throw new Q("Invalid relations between control points, knot vector, and n");var A=v[0][0].length,I;d<p?I=d:I=p;var k;d<_?k=d:k=_;for(var T=m.zeros3d(d+1,d+1,A),L=C.knotSpanGivenN(r,p,l,w),N=C.knotSpanGivenN(n,_,c,P),R=C.derivativeBasisFunctionsGivenNI(L,l,p,r,w),O=C.derivativeBasisFunctionsGivenNI(N,c,_,n,P),F=m.zeros2d(_+1,A),V=0,q=0,J=I+1;q<J;){for(var H=q++,j=0,X=_+1;j<X;){var ee=j++;F[ee]=m.zeros1d(A);for(var te=0,ie=p+1;te<ie;){var he=te++;m.addMulMutate(F[ee],R[H][he],v[L-p+he][N-_+ee])}}var ae=d-H;ae<k?V=ae:V=k;for(var ue=0,ne=V+1;ue<ne;){var de=ue++;T[H][de]=m.zeros1d(A);for(var Y=0,pe=_+1;Y<pe;){var Pe=Y++;m.addMulMutate(T[H][de],O[de][Pe],F[Pe])}}}return T},C.surfacePoint=function(r,n,a){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return C.surfacePointGivenNM(l,c,r,n,a)},C.surfacePointGivenNM=function(r,n,a,l,c){var d=a.degreeU,p=a.degreeV,_=a.controlPoints,v=a.knotsU,w=a.knotsV;if(!C.areValidRelations(d,_.length,v.length)||!C.areValidRelations(p,_[0].length,w.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var P=_[0][0].length,A=C.knotSpanGivenN(r,d,l,v),I=C.knotSpanGivenN(n,p,c,w),k=C.basisFunctionsGivenKnotSpanIndex(A,l,d,v),T=C.basisFunctionsGivenKnotSpanIndex(I,c,p,w),L=A-d,N=I,R=m.zeros1d(P),O=m.zeros1d(P),F=0,V=p+1;F<V;){var q=F++;O=m.zeros1d(P),N=I-p+q;for(var J=0,H=d+1;J<H;){var j=J++;m.addMulMutate(O,k[j],_[L+j][N])}m.addMulMutate(R,T[q],O)}return R},C.curveRegularSamplePoints=function(r,n){for(var a=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=a[0],p=m.mul(l,a[1]),_=m.mul(c*.5,a[2]),v=m.mul(c*l*.5,a[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],k=0,T=n+1;k<T;)k++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.curveRegularSamplePoints2=function(r,n){for(var a=C.curveDerivatives(r,r.knots[0],r.degree),l=1/n,c=l*l,d=a[0],p=m.mul(l,a[1]),_=m.mul(c*.5,a[2]),v=m.mul(c*l*.5,a[3]),w=m.add(_,_),P=m.add(v,v),A=m.mul(.3333333333333333,v),I=[],k=0,T=n+1;k<T;)k++,I.push(C.dehomogenize(d)),m.addAllMutate([d,p,_,A]),m.addAllMutate([p,w,v]),m.addAllMutate([w,P]),m.addAllMutate([_,v]);return I},C.rationalSurfaceRegularSampleDerivatives=function(r,n,a,l){for(var c=C.surfaceRegularSampleDerivatives(r,n,a,l),d=[],p=n+1,_=a+1,v=l+1,w=0;w<p;){var P=w++,A=[];d.push(A);for(var I=0;I<_;){for(var k=I++,T=c[P][k],L=C.rational2d(T),N=C.weight2d(T),R=[],O=L[0][0].length,F=0;F<v;){var V=F++;R.push([]);for(var q=0,J=v-V;q<J;){for(var H=q++,j=L[V][H],X=1,ee=H+1;X<ee;){var te=X++;m.subMulMutate(j,De.get(H,te)*N[0][te],R[V][H-te])}for(var ie=1,he=V+1;ie<he;){var ae=ie++;m.subMulMutate(j,De.get(V,ae)*N[ae][0],R[V-ae][H]);for(var ue=m.zeros1d(O),ne=1,de=H+1;ne<de;){var Y=ne++;m.addMulMutate(ue,De.get(H,Y)*N[ae][Y],R[V-ae][H-Y])}m.subMulMutate(j,De.get(V,ae),ue)}m.mulMutate(1/N[0][0],j),R[V].push(j)}}A.push(R)}}return d},C.surfaceRegularSampleDerivatives=function(r,n,a,l){var c=r.degreeU,d=r.degreeV,p=r.controlPoints,_=r.knotsU,v=r.knotsV,w=p[0][0].length;(K.last(_)-_[0])/n,(K.last(v)-v[0])/a;for(var P=C.regularlySpacedDerivativeBasisFunctions(c,_,n),A=P.item0,I=P.item1,k=C.regularlySpacedDerivativeBasisFunctions(d,v,a),T=k.item0,L=k.item1,N=[],R=n+1,O=a+1,F=0;F<R;){var V=F++,q=[];N.push(q);for(var J=0;J<O;){var H=J++;q.push(C.surfaceDerivativesGivenBasesKnotSpans(c,d,p,A[V],T[H],I[V],L[H],w,l))}}return N},C.rationalSurfaceRegularSamplePoints=function(r,n,a){return C.dehomogenize2d(C.surfaceRegularSamplePoints(r,n,a))},C.surfaceRegularSamplePoints=function(r,n,a){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,p=r.knotsU,_=r.knotsV,v=d[0][0].length;(K.last(p)-p[0])/n,(K.last(_)-_[0])/a;for(var w=C.regularlySpacedBasisFunctions(l,p,n),P=w.item0,A=w.item1,I=C.regularlySpacedBasisFunctions(c,_,a),k=I.item0,T=I.item1,L=[],N=n+1,R=a+1,O=0;O<N;){var F=O++,V=[];L.push(V);for(var q=0;q<R;){var J=q++;V.push(C.surfacePointGivenBasesKnotSpans(l,c,d,P[F],k[J],A[F],T[J],v))}}return L},C.regularlySpacedBasisFunctions=function(r,n,a){for(var l=n.length-r-2,c=(K.last(n)-n[0])/a,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=a+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.basisFunctionsGivenKnotSpanIndex(v,_,r,n)),_+=c}return new tt(p,d)},C.regularlySpacedDerivativeBasisFunctions=function(r,n,a){for(var l=n.length-r-2,c=(K.last(n)-n[0])/a,d=[],p=[],_=n[0],v=C.knotSpanGivenN(l,r,_,n),w=a+1,P=0;P<w;){for(P++;_>=n[v+1];)v++;p.push(v),d.push(C.derivativeBasisFunctionsGivenNI(v,_,r,l,n)),_+=c}return new tt(p,d)},C.surfacePointGivenBasesKnotSpans=function(r,n,a,l,c,d,p,_){for(var v=m.zeros1d(_),w,P=l-r,A=c-n,I=0,k=n+1;I<k;){var T=I++;w=m.zeros1d(_);for(var L=0,N=r+1;L<N;){var R=L++;m.addMulMutate(w,d[R],a[P+R][A])}A++,m.addMulMutate(v,p[T],w)}return v},C.surfaceDerivativesGivenBasesKnotSpans=function(r,n,a,l,c,d,p,_,v){var w=a[0][0].length,P;v<r?P=v:P=r;var A;v<n?A=v:A=n;for(var I=m.zeros3d(P+1,A+1,w),k=m.zeros2d(n+1,w),T=0,L=0,N=P+1;L<N;){for(var R=L++,O=0,F=n+1;O<F;){var V=O++;k[V]=m.zeros1d(w);for(var q=0,J=r+1;q<J;){var H=q++;m.addMulMutate(k[V],d[R][H],a[l-r+H][c-n+V])}}var j=v-R;j<A?T=j:T=A;for(var X=0,ee=T+1;X<ee;){var te=X++;I[R][te]=m.zeros1d(w);for(var ie=0,he=n+1;ie<he;){var ae=ie++;m.addMulMutate(I[R][te],p[te][ae],k[ae])}}}return I},C.curveDerivatives=function(r,n,a){var l=r.knots.length-r.degree-2;return C.curveDerivativesGivenN(l,r,n,a)},C.curveDerivativesGivenN=function(r,n,a,l){var c=n.degree,d=n.controlPoints,p=n.knots;if(!C.areValidRelations(c,d.length,p.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;l<c?v=l:v=c;for(var w=m.zeros2d(l+1,_),P=C.knotSpanGivenN(r,c,a,p),A=C.derivativeBasisFunctionsGivenNI(P,a,c,v,p),I=0,k=v+1;I<k;)for(var T=I++,L=0,N=c+1;L<N;){var R=L++;m.addMulMutate(w[T],A[T][R],d[P-c+R])}return w},C.curvePoint=function(r,n){var a=r.knots.length-r.degree-2;return C.curvePointGivenN(a,r,n)},C.areValidRelations=function(r,n,a){return n+r+1-a==0},C.curvePointGivenN=function(r,n,a){var l=n.degree,c=n.controlPoints,d=n.knots;if(!C.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var p=C.knotSpanGivenN(r,l,a,d),_=C.basisFunctionsGivenKnotSpanIndex(p,a,l,d),v=m.zeros1d(c[0].length),w=0,P=l+1;w<P;){var A=w++;m.addMulMutate(v,_[A],c[p-l+A])}return v},C.volumePoint=function(r,n,a,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,p=r.knotsW.length-r.degreeW-2;return C.volumePointGivenNML(r,c,d,p,n,a,l)},C.volumePointGivenNML=function(r,n,a,l,c,d,p){if(!C.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!C.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!C.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,v=r.degreeU,w=r.degreeV,P=r.degreeW,A=r.knotsU,I=r.knotsV,k=r.knotsW,T=_[0][0][0].length,L=C.knotSpanGivenN(n,v,c,A),N=C.knotSpanGivenN(a,w,d,I),R=C.knotSpanGivenN(l,P,p,k),O=C.basisFunctionsGivenKnotSpanIndex(L,c,v,A),F=C.basisFunctionsGivenKnotSpanIndex(N,d,w,I),V=C.basisFunctionsGivenKnotSpanIndex(R,p,P,k),q=L-v,J=m.zeros1d(T),H=m.zeros1d(T),j=m.zeros1d(T),X=0,ee=P+1;X<ee;){var te=X++;j=m.zeros1d(T);for(var ie=R-P+te,he=0,ae=w+1;he<ae;){var ue=he++;H=m.zeros1d(T);for(var ne=N-w+ue,de=0,Y=v+1;de<Y;){var pe=de++;m.addMulMutate(H,O[pe],_[q+pe][ne][ie])}m.addMulMutate(j,F[ue],H)}m.addMulMutate(J,V[te],j)}return J},C.derivativeBasisFunctions=function(r,n,a){var l=C.knotSpan(n,r,a),c=a.length-1,d=c-n-1;return C.derivativeBasisFunctionsGivenNI(l,r,n,d,a)},C.derivativeBasisFunctionsGivenNI=function(r,n,a,l,c){var d=m.zeros2d(a+1,a+1),p=m.zeros1d(a+1),_=m.zeros1d(a+1),v=0,w=0;d[0][0]=1;for(var P=1,A=a+1;P<A;){var I=P++;p[I]=n-c[r+1-I],_[I]=c[r+I]-n,v=0;for(var k=0;k<I;){var T=k++;d[I][T]=_[T+1]+p[I-T],w=d[T][I-1]/d[I][T],d[T][I]=v+_[T+1]*w,v=p[I-T]*w}d[I][I]=v}for(var L=m.zeros2d(l+1,a+1),N=m.zeros2d(2,a+1),R=0,O=1,F=0,V=0,q=0,J=0,H=0,j=0,X=a+1;j<X;){var ee=j++;L[0][ee]=d[ee][a]}for(var te=0,ie=a+1;te<ie;){var he=te++;R=0,O=1,N[0][0]=1;for(var ae=1,ue=l+1;ae<ue;){var ne=ae++;F=0,V=he-ne,q=a-ne,he>=ne&&(N[O][0]=N[R][0]/d[q+1][V],F=N[O][0]*d[V][q]),V>=-1?J=1:J=-V,he-1<=q?H=ne-1:H=a-he;for(var de=J,Y=H+1;de<Y;){var pe=de++;N[O][pe]=(N[R][pe]-N[R][pe-1])/d[q+1][V+pe],F+=N[O][pe]*d[V+pe][q]}he<=q&&(N[O][ne]=-N[R][ne-1]/d[q+1][he],F+=N[O][ne]*d[he][q]),L[ne][he]=F;var Pe=R;R=O,O=Pe}}for(var Ge=a,Xe=1,Fe=l+1;Xe<Fe;){for(var Ke=Xe++,At=0,Wt=a+1;At<Wt;){var vt=At++;L[Ke][vt]*=Ge}Ge*=a-Ke}return L},C.basisFunctions=function(r,n,a){var l=C.knotSpan(n,r,a);return C.basisFunctionsGivenKnotSpanIndex(l,r,n,a)},C.basisFunctionsGivenKnotSpanIndex=function(r,n,a,l){var c=m.zeros1d(a+1),d=m.zeros1d(a+1),p=m.zeros1d(a+1),_=0,v=0;c[0]=1;for(var w=1,P=a+1;w<P;){var A=w++;d[A]=n-l[r+1-A],p[A]=l[r+A]-n,_=0;for(var I=0;I<A;){var k=I++;v=c[k]/(p[k+1]+d[A-k]),c[k]=_+p[k+1]*v,_=d[A-k]*v}c[A]=_}return c},C.knotSpan=function(r,n,a){return C.knotSpanGivenN(a.length-r-2,r,n,a)},C.knotSpanGivenN=function(r,n,a,l){if(a>l[r+1]-re.EPSILON)return r;if(a<l[n]+re.EPSILON)return n;for(var c=n,d=r+1,p=Math.floor((c+d)/2);a<l[p]||a>=l[p+1];)a<l[p]?d=p:c=p,p=Math.floor((c+d)/2);return p},C.dehomogenize=function(r){for(var n=r.length,a=[],l=r[n-1],c=r.length-1,d=0;d<c;){var p=d++;a.push(r[p]/l)}return a},C.rational1d=function(r){var n=r[0].length-1;return r.map(function(a){return a.slice(0,n)})},C.rational2d=function(r){return r.map(C.rational1d)},C.weight1d=function(r){var n=r[0].length-1;return r.map(function(a){return a[n]})},C.weight2d=function(r){return r.map(C.weight1d)},C.dehomogenize1d=function(r){return r.map(C.dehomogenize)},C.dehomogenize2d=function(r){return r.map(C.dehomogenize1d)},C.homogenize1d=function(r,n){var a=r.length,l=r[0].length,c=[],d=0,p=[],_;n!=null?_=n:_=m.rep(r.length,1);for(var v=0;v<a;){var w=v++,P=[];p=r[w],d=_[w];for(var A=0;A<l;){var I=A++;P.push(p[I]*d)}P.push(d),c.push(P)}return c},C.homogenize2d=function(r,n){var a=r.length,l=[],c;if(n!=null)c=n;else{for(var d=[],p=0;p<a;)p++,d.push(m.rep(r[0].length,1));c=d}for(var _=0;_<a;){var v=_++;l.push(C.homogenize1d(r[v],c[v]))}return l};var le=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=le,le.__name__=["verb","eval","Intersect"],le.surfaces=function(r,n,a){var l=Oe.rationalSurfaceAdaptive(r),c=Oe.rationalSurfaceAdaptive(n),d=le.meshes(l,c),p=d.map(function(_){return _.map(function(v){return le.surfacesAtPointWithEstimate(r,n,v.uv0,v.uv1,a)})});return p.map(function(_){return me.rationalInterpCurve(_.map(function(v){return v.point}),3)})},le.surfacesAtPointWithEstimate=function(r,n,a,l,c){var d,p,_,v,w,P,A,I,k,T,L,N,R,O=5,F=0;do{if(d=C.rationalSurfaceDerivatives(r,a[0],a[1],1),p=d[0][0],v=d[1][0],w=d[0][1],_=m.normalized(m.cross(v,w)),P=m.dot(_,p),A=C.rationalSurfaceDerivatives(n,l[0],l[1],1),I=A[0][0],T=A[1][0],L=A[0][1],k=m.normalized(m.cross(T,L)),N=m.dot(k,I),R=m.distSquared(p,I),R<c*c)break;var V=m.normalized(m.cross(_,k)),q=m.dot(V,p),J=le.threePlanes(_,P,k,N,V,q);if(J==null)throw new Q("panic!");var H=m.sub(J,p),j=m.sub(J,I),X=m.cross(v,_),ee=m.cross(w,_),te=m.cross(T,k),ie=m.cross(L,k),he=m.dot(ee,H)/m.dot(ee,v),ae=m.dot(X,H)/m.dot(X,w),ue=m.dot(ie,j)/m.dot(ie,T),ne=m.dot(te,j)/m.dot(te,L);a=m.add([he,ae],a),l=m.add([ue,ne],l),F++}while(F<O);return new qn(a,l,p,R)},le.meshes=function(r,n,a,l){a==null&&(a=new ir(r)),l==null&&(l=new ir(n));var c=le.boundingBoxTrees(a,l,0),d=K.unique(c.map(function(p){return le.triangles(r,p.item0,n,p.item1)}).filter(function(p){return p!=null}).filter(function(p){return m.distSquared(p.min.point,p.max.point)>re.EPSILON}),function(p,_){var v=m.sub(p.min.uv0,_.min.uv0),w=m.dot(v,v),P=m.sub(p.max.uv0,_.max.uv0),A=m.dot(P,P),I=m.sub(p.min.uv0,_.max.uv0),k=m.dot(I,I),T=m.sub(p.max.uv0,_.min.uv0),L=m.dot(T,T);return w<re.EPSILON&&A<re.EPSILON||k<re.EPSILON&&L<re.EPSILON});return le.makeMeshIntersectionPolylines(d)},le.meshSlices=function(r,n,a,l){for(var c=new Lr(r),d=c.boundingBox(),p=d.min[0],_=d.min[1],v=d.max[0],w=d.max[1],P=m.span(n,a,l),A=[],I=0;I<P.length;){var k=P[I];++I;var T=[[p,_,k],[v,_,k],[v,w,k],[p,w,k]],L=[[0,0],[1,0],[1,1],[0,1]],N=[[0,1,2],[0,2,3]],R=new qt(N,T,null,L);A.push(le.meshes(r,R,c))}return A},le.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var n=0;n<r.length;){var a=r[n];++n,a.max.opp=a.min,a.min.opp=a.max}for(var l=le.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.min),c.push(p.max)}for(var _=0;_<c.length;){var v=c[_];if(++_,v.adj==null){var w=le.lookupAdjacentSegment(v,l,r.length);w!=null&&w.adj==null&&(v.adj=w,w.adj=v)}}var P=c.filter(function(O){return O.adj==null});P.length==0&&(P=c);for(var A=[],I=0,k=!1;P.length!=0;){var T=P.pop();if(!T.visited){for(var L=[],N=T;N!=null&&!(N.visited||(N.visited=!0,N.opp.visited=!0,L.push(N),I+=2,N=N.opp.adj,N==T)););L.length>0&&(L.push(L[L.length-1].opp),A.push(L))}if(P.length==0&&c.length>0&&(k||I<c.length)){k=!0;var R=c.pop();P.push(R)}}return A},le.kdTreeFromSegments=function(r){for(var n=[],a=0;a<r.length;){var l=r[a];++a,n.push(new An(l.min.point,l.min)),n.push(new An(l.max.point,l.max))}return new Xn(n,m.distSquared)},le.lookupAdjacentSegment=function(r,n,a){var l=n.nearest(r.point,a,re.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},le.curveAndSurface=function(r,n,a,l,c){a==null&&(a=.001),l!=null?l=l:l=new sr(r),c!=null?c=c:c=new Nr(n);var d=le.boundingBoxTrees(l,c,a);return K.unique(d.map(function(p){var _=p.item0,v=p.item1,w=K.first(_.knots),P=K.last(_.knots),A=(w+P)/2,I=K.first(v.knotsU),k=K.last(v.knotsU),T=K.first(v.knotsV),L=K.last(v.knotsV),N=[(I+k)/2,(T+L)/2];return le.curveAndSurfaceWithEstimate(_,v,[A].concat(N),a)}).filter(function(p){return m.distSquared(p.curvePoint,p.surfacePoint)<a*a}),function(p,_){return Math.abs(p.u-_.u)<.5*a})},le.curveAndSurfaceWithEstimate=function(r,n,a,l){l==null&&(l=.001);var c=function(v){var w=C.rationalCurvePoint(r,v[0]),P=C.rationalSurfacePoint(n,v[1],v[2]),A=m.sub(w,P);return m.dot(A,A)},d=function(v){var w=C.rationalCurveDerivatives(r,v[0],1),P=C.rationalSurfaceDerivatives(n,v[1],v[2],1),A=m.sub(P[0][0],w[0]),I=m.mul(-1,w[1]),k=P[1][0],T=P[0][1];return[2*m.dot(I,A),2*m.dot(k,A),2*m.dot(T,A)]},p=Yt.uncmin(c,a,l*l,d),_=p.solution;return new Wn(_[0],[_[1],_[2]],C.rationalCurvePoint(r,_[0]),C.rationalSurfacePoint(n,_[1],_[2]))},le.polylineAndMesh=function(r,n,a){for(var l=le.boundingBoxTrees(new ar(r),new ir(n),a),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=le.segmentWithTriangle(r.points[_],r.points[_+1],n.points,n.faces[v]);if(w!=null){var P=w.point,A=m.lerp(w.p,[r.params[_]],[r.params[_+1]])[0],I=rt.triangleUVFromPoint(n,v,P);c.push(new Hn(P,A,I,_,v))}}return c},le.boundingBoxTrees=function(r,n,a){a==null&&(a=1e-9);var l=[],c=[];l.push(r),c.push(n);for(var d=[];l.length>0;){var p=l.pop(),_=c.pop();if(!(p.empty()||_.empty())&&p.boundingBox().intersects(_.boundingBox(),a)){var v=p.indivisible(a),w=_.indivisible(a);if(v&&w){d.push(new tt(p.yield(),_.yield()));continue}else if(v&&!w){var P=_.split();l.push(p),c.push(P.item1),l.push(p),c.push(P.item0);continue}else if(!v&&w){var A=p.split();l.push(A.item1),c.push(_),l.push(A.item0),c.push(_);continue}var I=p.split(),k=_.split();l.push(I.item1),c.push(k.item1),l.push(I.item1),c.push(k.item0),l.push(I.item0),c.push(k.item1),l.push(I.item0),c.push(k.item0)}}return d},le.curves=function(r,n,a){var l=le.boundingBoxTrees(new sr(r),new sr(n),0);return K.unique(l.map(function(c){return le.curvesWithEstimate(r,n,K.first(c.item0.knots),K.first(c.item1.knots),a)}).filter(function(c){return m.distSquared(c.point0,c.point1)<a}),function(c,d){return Math.abs(c.u0-d.u0)<a*5})},le.curvesWithEstimate=function(r,n,a,l,c){var d=function(I){var k=C.rationalCurvePoint(r,I[0]),T=C.rationalCurvePoint(n,I[1]),L=m.sub(k,T);return m.dot(L,L)},p=function(I){var k=C.rationalCurveDerivatives(r,I[0],1),T=C.rationalCurveDerivatives(n,I[1],1),L=m.sub(k[0],T[0]),N=k[1],R=m.mul(-1,T[1]);return[2*m.dot(N,L),2*m.dot(R,L)]},_=Yt.uncmin(d,[a,l],c*c,p),v=_.solution[0],w=_.solution[1],P=C.rationalCurvePoint(r,v),A=C.rationalCurvePoint(n,w);return new Xr(P,A,v,w)},le.triangles=function(r,n,a,l){var c=r.faces[n],d=a.faces[l],p=rt.getTriangleNorm(r.points,c),_=rt.getTriangleNorm(a.points,d),v=r.points[c[0]],w=a.points[d[0]],P=le.planes(v,p,w,_);if(P==null)return null;var A=le.clipRayInCoplanarTriangle(P,r,n);if(A==null)return null;var I=le.clipRayInCoplanarTriangle(P,a,l);if(I==null)return null;var k=le.mergeTriangleClipIntervals(A,I,r,n,a,l);return k==null?null:new wt(new Cr(k.min.uv0,k.min.uv1,k.min.point,n,l),new Cr(k.max.uv0,k.max.uv1,k.max.point,n,l))},le.clipRayInCoplanarTriangle=function(r,n,a){for(var l=n.faces[a],c=[n.points[l[0]],n.points[l[1]],n.points[l[2]]],d=[n.uvs[l[0]],n.uvs[l[1]],n.uvs[l[2]]],p=[m.sub(d[1],d[0]),m.sub(d[2],d[1]),m.sub(d[0],d[2])],_=[m.sub(c[1],c[0]),m.sub(c[2],c[1]),m.sub(c[0],c[2])],v=_.map(m.normalized),w=_.map(m.norm),P=null,A=null,I=0;I<3;){var k=I++,T=c[k],L=v[k],N=le.rays(T,L,r.origin,r.dir);if(N!=null){var R=N.u0,O=N.u1;R<-re.EPSILON||R>w[k]+re.EPSILON||((P==null||O<P.u)&&(P=new wn(O,m.onRay(r.origin,r.dir,O),m.onRay(d[k],p[k],R/w[k]))),(A==null||O>A.u)&&(A=new wn(O,m.onRay(r.origin,r.dir,O),m.onRay(d[k],p[k],R/w[k]))))}}return A==null||P==null?null:new wt(P,A)},le.mergeTriangleClipIntervals=function(r,n,a,l,c,d){if(n.min.u>r.max.u+re.EPSILON||r.min.u>n.max.u+re.EPSILON)return null;var p;r.min.u>n.min.u?p=new tt(r.min,0):p=new tt(n.min,1);var _;r.max.u<n.max.u?_=new tt(r.max,0):_=new tt(n.max,1);var v=new wt(new Cr(null,null,p.item0.point,l,d),new Cr(null,null,_.item0.point,l,d));return p.item1==0?(v.min.uv0=p.item0.uv,v.min.uv1=rt.triangleUVFromPoint(c,d,p.item0.point)):(v.min.uv0=rt.triangleUVFromPoint(a,l,p.item0.point),v.min.uv1=p.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=rt.triangleUVFromPoint(c,d,_.item0.point)):(v.max.uv0=rt.triangleUVFromPoint(a,l,_.item0.point),v.max.uv1=_.item0.uv),v},le.planes=function(r,n,a,l){var c=m.cross(n,l);if(m.dot(c,c)<re.EPSILON)return null;var d=0,p=Math.abs(c[0]),_=Math.abs(c[1]),v=Math.abs(c[2]);_>p&&(d=1,p=_),v>p&&(d=2,p=v);var w,P,A,I;d==0?(w=n[1],P=n[2],A=l[1],I=l[2]):d==1?(w=n[0],P=n[2],A=l[0],I=l[2]):(w=n[0],P=n[1],A=l[0],I=l[1]);var k=-m.dot(r,n),T=-m.dot(a,l),L=w*I-P*A,N=(P*T-k*I)/L,R=(k*A-w*T)/L,O;return d==0?O=[0,N,R]:d==1?O=[N,0,R]:O=[N,R,0],new xn(O,m.normalized(c))},le.threePlanes=function(r,n,a,l,c,d){var p=m.cross(a,c),_=m.dot(r,p);if(Math.abs(_)<re.EPSILON)return null;var v=m.sub(m.mul(d,a),m.mul(l,c)),w=m.add(m.mul(n,p),m.cross(r,v));return m.mul(1/_,w)},le.polylines=function(r,n,a){for(var l=le.boundingBoxTrees(new ar(r),new ar(n),a),c=[],d=0;d<l.length;){var p=l[d];++d;var _=p.item0,v=p.item1,w=le.segments(r.points[_],r.points[_+1],n.points[v],n.points[v+1],a);w!=null&&(w.u0=m.lerp(w.u0,[r.params[_]],[r.params[_+1]])[0],w.u1=m.lerp(w.u1,[n.params[v]],[n.params[v+1]])[0],c.push(w))}return c},le.segments=function(r,n,a,l,c){var d=m.sub(n,r),p=Math.sqrt(m.dot(d,d)),_=m.mul(1/p,d),v=m.sub(l,a),w=Math.sqrt(m.dot(v,v)),P=m.mul(1/w,v),A=le.rays(r,_,a,P);if(A!=null){var I=Math.min(Math.max(0,A.u0/p),1),k=Math.min(Math.max(0,A.u1/w),1),T=m.onRay(r,d,I),L=m.onRay(a,v,k),N=m.distSquared(T,L);if(N<c*c)return new Xr(T,L,I,k)}return null},le.rays=function(r,n,a,l){var c=m.dot(n,l),d=m.dot(n,a),p=m.dot(n,r),_=m.dot(l,a),v=m.dot(l,r),w=m.dot(n,n),P=m.dot(l,l),A=w*P-c*c;if(Math.abs(A)<re.EPSILON)return null;var I=c*(d-p)-w*(_-v),k=I/A,T=(d-p+k*c)/w,L=m.onRay(r,n,T),N=m.onRay(a,l,k);return new Xr(L,N,T,k)},le.segmentWithTriangle=function(r,n,a,l){var c=a[l[0]],d=a[l[1]],p=a[l[2]],_=m.sub(d,c),v=m.sub(p,c),w=m.cross(_,v),P=m.sub(n,r),A=m.sub(r,c),I=-m.dot(w,A),k=m.dot(w,P);if(Math.abs(k)<re.EPSILON)return null;var T=I/k;if(T<0||T>1)return null;var L=m.add(r,m.mul(T,P)),N=m.dot(_,v),R=m.dot(_,_),O=m.dot(v,v),F=m.sub(L,c),V=m.dot(F,_),q=m.dot(F,v),J=N*N-R*O;if(Math.abs(J)<re.EPSILON)return null;var H=(N*q-O*V)/J,j=(N*V-R*q)/J;return H>1+re.EPSILON||j>1+re.EPSILON||j<-re.EPSILON||H<-re.EPSILON||H+j>1+re.EPSILON?null:new Yn(L,H,j,T)},le.segmentAndPlane=function(r,n,a,l){var c=m.dot(l,m.sub(n,r));if(Math.abs(c)<re.EPSILON)return null;var d=m.dot(l,m.sub(a,r)),p=d/c;return p>1+re.EPSILON||p<-re.EPSILON?null:{p}};var me=f.eval.Make=function(){};x["verb.eval.Make"]=me,me.__name__=["verb","eval","Make"],me.rationalTranslationalSurface=function(r,n){for(var a=C.rationalCurvePoint(n,K.first(n.knots)),l=K.first(n.knots),c=K.last(n.knots),d=2*n.controlPoints.length,p=(c-l)/(d-1),_=[],v=0;v<d;){var w=v++,P=m.sub(C.rationalCurvePoint(n,l+w*p),a),A=fe.rationalCurveTransform(r,[[1,0,0,P[0]],[0,1,0,P[1]],[0,0,1,P[2]],[0,0,0,1]]);_.push(A)}return me.loftedSurface(_)},me.surfaceBoundaryCurves=function(r){var n=me.surfaceIsocurve(r,K.first(r.knotsU),!1),a=me.surfaceIsocurve(r,K.last(r.knotsU),!1),l=me.surfaceIsocurve(r,K.first(r.knotsV),!0),c=me.surfaceIsocurve(r,K.last(r.knotsV),!0);return[n,a,l,c]},me.surfaceIsocurve=function(r,n,a){a==null&&(a=!1);var l;a?l=r.knotsV:l=r.knotsU;var c;a?c=r.degreeV:c=r.degreeU;for(var d=ve.knotMultiplicities(l),p=-1,_=0,v=d.length;_<v;){var w=_++;if(Math.abs(n-d[w].knot)<re.EPSILON){p=w;break}}var P=c+1;p>=0&&(P=P-d[p].mult);var A;P>0?A=fe.surfaceKnotRefine(r,m.rep(P,n),a):A=r;var I=C.knotSpan(c,n,l);return Math.abs(n-K.first(l))<re.EPSILON?I=0:Math.abs(n-K.last(l))<re.EPSILON&&(I=(a?A.controlPoints[0].length:A.controlPoints.length)-1),a?new je(A.degreeU,A.knotsU,function(k){for(var T,L=[],N=0,R=A.controlPoints;N<R.length;){var O=R[N];++N,L.push(O[I])}return T=L,T}()):new je(A.degreeV,A.knotsV,A.controlPoints[I])},me.loftedSurface=function(r,n){r=fe.unifyCurveKnotVectors(r);var a=r[0].degree;n==null&&(n=3),n>r.length-1&&(n=r.length-1);for(var l=r[0].knots,c=[],d=[],p=0,_=r[0].controlPoints.length;p<_;){var v=[p++],w=r.map(function(A){return function(I){return I.controlPoints[A[0]]}}(v)),P=me.rationalInterpCurve(w,n,!0);d.push(P.controlPoints),c=P.knots}return new et(a,n,l,c,d)},me.clonedCurve=function(r){return new je(r.degree,r.knots.slice(),r.controlPoints.map(function(n){return n.slice()}))},me.rationalBezierCurve=function(r,n){for(var a=r.length-1,l=[],c=0,d=a+1;c<d;)c++,l.push(0);for(var p=0,_=a+1;p<_;)p++,l.push(1);return n==null&&(n=m.rep(r.length,1)),new je(a,l,C.homogenize1d(r,n))},me.fourPointSurface=function(r,n,a,l,c){c==null&&(c=3);for(var d=c,p=[],_=0,v=c+1;_<v;){for(var w=_++,P=[],A=0,I=c+1;A<I;){var k=A++,T=1-w/d,L=m.lerp(T,r,n),N=m.lerp(T,l,a),R=m.lerp(1-k/d,L,N);R.push(1),P.push(R)}p.push(P)}var O=m.rep(c+1,0),F=m.rep(c+1,1);return new et(c,c,O.concat(F),O.concat(F),p)},me.ellipseArc=function(r,n,a,l,c){var d=m.norm(n),p=m.norm(a);n=m.normalized(n),a=m.normalized(a),c<l&&(c=2*Math.PI+l);var _=c-l,v=0;_<=Math.PI/2?v=1:_<=Math.PI?v=2:_<=3*Math.PI/2?v=3:v=4;var w=_/v,P=Math.cos(w/2),A=m.add(r,m.add(m.mul(d*Math.cos(l),n),m.mul(p*Math.sin(l),a))),I=m.sub(m.mul(Math.cos(l),a),m.mul(Math.sin(l),n)),k=[],T=m.zeros1d(2*v+3),L=0,N=l,R=m.zeros1d(v*2);k[0]=A,R[0]=1;for(var O=1,F=v+1;O<F;){var V=O++;N+=w;var q=m.add(r,m.add(m.mul(d*Math.cos(N),n),m.mul(p*Math.sin(N),a)));R[L+2]=1,k[L+2]=q;var J=m.sub(m.mul(Math.cos(N),a),m.mul(Math.sin(N),n)),H=le.rays(A,m.mul(1/m.norm(I),I),q,m.mul(1/m.norm(J),J)),j=m.add(A,m.mul(H.u0,I));R[L+1]=P,k[L+1]=j,L+=2,V<v&&(A=q,I=J)}for(var X=2*v+1,ee=0;ee<3;){var te=ee++;T[te]=0,T[te+X]=1}switch(v){case 2:T[3]=T[4]=.5;break;case 3:T[3]=T[4]=.3333333333333333,T[5]=T[6]=.6666666666666666;break;case 4:T[3]=T[4]=.25,T[5]=T[6]=.5,T[7]=T[8]=.75;break}return new je(2,T,C.homogenize1d(k,R))},me.arc=function(r,n,a,l,c,d){return me.ellipseArc(r,m.mul(l,m.normalized(n)),m.mul(l,m.normalized(a)),c,d)},me.polyline=function(r){for(var n=[0,0],a=0,l=0,c=r.length-1;l<c;){var d=l++;a+=m.dist(r[d],r[d+1]),n.push(a)}n.push(a),n=m.mul(1/a,n);for(var p,_=[],v=0,w=r.length;v<w;)v++,_.push(1);return p=_,new je(1,n,C.homogenize1d(r.slice(0),p))},me.extrudedSurface=function(r,n,a){for(var l=[[],[],[]],c=[[],[],[]],d=C.dehomogenize1d(a.controlPoints),p=C.weight1d(a.controlPoints),_=m.mul(n,r),v=m.mul(.5*n,r),w=0,P=d.length;w<P;){var A=w++;l[2][A]=d[A],l[1][A]=m.add(v,d[A]),l[0][A]=m.add(_,d[A]),c[0][A]=p[A],c[1][A]=p[A],c[2][A]=p[A]}return new et(2,a.degree,[0,0,0,1,1,1],a.knots,C.homogenize2d(l,c))},me.cylindricalSurface=function(r,n,a,l,c){var d=m.cross(r,n),p=me.arc(a,n,d,c,0,2*Math.PI);return me.extrudedSurface(r,l,p)},me.revolvedSurface=function(r,n,a,l){var c=C.dehomogenize1d(r.controlPoints),d=C.weight1d(r.controlPoints),p,_;l<=Math.PI/2?(p=1,_=m.zeros1d(6+2*(p-1))):l<=Math.PI?(p=2,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(p=3,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(p=4,_=m.zeros1d(6+2*(p-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=l/p,w=3+2*(p-1),P=0;P<3;){var A=P++;_[A]=0,_[w+A]=1}for(var I=Math.cos(v/2),k=0,T=m.zeros1d(p+1),L=m.zeros1d(p+1),N=m.zeros3d(2*p+1,c.length,3),R=m.zeros2d(2*p+1,c.length),O=1,F=p+1;O<F;){var V=O++;k+=v,L[V]=Math.cos(k),T[V]=Math.sin(k)}for(var q=0,J=c.length;q<J;){var H=q++,j=kt.rayClosestPoint(c[H],n,a),X=m.sub(c[H],j),ee=m.norm(X),te=m.cross(a,X);ee>re.EPSILON&&(X=m.mul(1/ee,X),te=m.mul(1/ee,te)),N[0][H]=c[H];var ie=c[H];R[0][H]=d[H];for(var he=te,ae=0,ue=1,ne=p+1;ue<ne;){var de=ue++,Y;ee==0?Y=j:Y=m.add(j,m.add(m.mul(ee*L[de],X),m.mul(ee*T[de],te))),N[ae+2][H]=Y,R[ae+2][H]=d[H];var pe=m.sub(m.mul(L[de],te),m.mul(T[de],X));if(ee==0)N[ae+1][H]=j;else{var Pe=le.rays(ie,m.mul(1/m.norm(he),he),Y,m.mul(1/m.norm(pe),pe)),Ge=m.add(ie,m.mul(Pe.u0,he));N[ae+1][H]=Ge}R[ae+1][H]=I*d[H],ae+=2,de<p&&(ie=Y,he=pe)}}return new et(2,r.degree,_,r.knots,C.homogenize2d(N,R))},me.sphericalSurface=function(r,n,a,l){var c=me.arc(r,m.mul(-1,n),a,l,0,Math.PI);return me.revolvedSurface(c,r,n,2*Math.PI)},me.conicalSurface=function(r,n,a,l,c){var d=2*Math.PI,p=1,_=[m.add(a,m.mul(l,r)),m.add(a,m.mul(c,n))],v=[0,0,1,1],w=[1,1],P=new je(p,v,C.homogenize1d(_,w));return me.revolvedSurface(P,a,r,d)},me.rationalInterpCurve=function(r,n,a,l,c){if(a==null&&(a=!1),n==null&&(n=3),r.length<n+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],p=1,_=r.length;p<_;){var v=p++,w=m.norm(m.sub(r[v],r[v-1])),P=d[d.length-1];d.push(P+w)}for(var A=d[d.length-1],I=0,k=d.length;I<k;){var T=I++;d[T]=d[T]/A}var L=m.rep(n+1,0),N=l!=null&&c!=null,R;N?R=0:R=1;var O;N?O=d.length-n+1:O=d.length-n;for(var F=R;F<O;){for(var V=F++,q=0,J=0;J<n;){var H=J++;q+=d[V+H]}L.push(1/n*q)}var j=L.concat(m.rep(n+1,1)),X=[],ee;N?ee=r.length+1:ee=r.length-1;var te;N?te=r.length-(n-1):te=r.length-(n+1);for(var ie=0;ie<d.length;){var he=d[ie];++ie;var ae=C.knotSpanGivenN(ee,n,he,j),ue=C.basisFunctionsGivenKnotSpanIndex(ae,he,n,j),ne=ae-n,de=m.zeros1d(ne),Y=m.zeros1d(te-ne);X.push(de.concat(ue).concat(Y))}if(N){var pe=X[0].length-2,Pe=[-1,1].concat(m.zeros1d(pe)),Ge=m.zeros1d(pe).concat([-1,1]);K.spliceAndInsert(X,1,0,Pe),K.spliceAndInsert(X,X.length-1,0,Ge)}for(var Xe=r[0].length,Fe=[],Ke=(1-j[j.length-n-2])/n,At=j[n+1]/n,Wt=0;Wt<Xe;){var vt=[Wt++],gt;if(!N)gt=r.map(function(Qt){return function(dr){return dr[Qt[0]]}}(vt));else{gt=[r[0][vt[0]]],gt.push(At*l[vt[0]]);for(var St=1,Tt=r.length-1;St<Tt;){var Kt=St++;gt.push(r[Kt][vt[0]])}gt.push(Ke*c[vt[0]]),gt.push(K.last(r)[vt[0]])}var or=Ne.solve(X,gt);Fe.push(or)}var $t=Ne.transpose(Fe);if(!a){var Zt=m.rep($t.length,1);$t=C.homogenize1d($t,Zt)}return new je(n,j,$t)};var fe=f.eval.Modify=function(){};x["verb.eval.Modify"]=fe,fe.__name__=["verb","eval","Modify"],fe.curveReverse=function(r){return new je(r.degree,fe.knotsReverse(r.knots),K.reversed(r.controlPoints))},fe.surfaceReverse=function(r,n){return n==null&&(n=!1),n?new et(r.degreeU,r.degreeV,r.knotsU,fe.knotsReverse(r.knotsV),function(a){for(var l,c=[],d=0,p=r.controlPoints;d<p.length;){var _=p[d];++d,c.push(K.reversed(_))}return l=c,l}()):new et(r.degreeU,r.degreeV,fe.knotsReverse(r.knotsU),r.knotsV,K.reversed(r.controlPoints))},fe.knotsReverse=function(r){var n=K.first(r);K.last(r);for(var a=[n],l=r.length,c=1;c<l;){var d=c++;a.push(a[d-1]+(r[l-d]-r[l-d-1]))}return a},fe.unifyCurveKnotVectors=function(r){r=r.map(me.clonedCurve);for(var n=D.fold(r,function(j,X){return fe.imax(j.degree,X)},0),a=0,l=r.length;a<l;){var c=a++;r[c].degree<n&&(r[c]=fe.curveElevateDegree(r[c],n))}for(var d,p=[],_=0;_<r.length;){var v=r[_];++_,p.push(new wt(K.first(v.knots),K.last(v.knots)))}d=p;for(var w=0,P=r.length;w<P;){var A=w++,I=[d[A].min];r[A].knots=r[A].knots.map(function(j){return function(X){return X-j[0]}}(I))}for(var k=d.map(function(j){return j.max-j.min}),T=D.fold(k,function(j,X){return Math.max(j,X)},0),L=0,N=r.length;L<N;){var R=L++,O=[T/k[R]];r[R].knots=r[R].knots.map(function(j){return function(X){return X*j[0]}}(O))}for(var F=D.fold(r,function(j,X){return m.sortedSetUnion(j.knots,X)},[]),V=0,q=r.length;V<q;){var J=V++,H=m.sortedSetSub(F,r[J].knots);H.length==0&&(r[J]=r[J]),r[J]=fe.curveKnotRefine(r[J],H)}return r},fe.imin=function(r,n){return r<n?r:n},fe.imax=function(r,n){return r>n?r:n},fe.curveElevateDegree=function(r,n){if(n<=r.degree)return r;var a=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,p=n-r.degree,_=r.controlPoints[0].length,v=m.zeros2d(l+p+1,l+1),w=[],P=[],A=[],I=a+l+1,k=n,T=Math.floor(k/2),L=[],N=[];v[0][0]=1,v[k][l]=1;for(var R=1,O=T+1;R<O;)for(var F=R++,V=1/De.get(k,F),q=fe.imin(l,F),J=fe.imax(0,F-p),H=q+1;J<H;){var j=J++;v[F][j]=V*De.get(l,j)*De.get(p,F-j)}for(var X=T+1;X<k;)for(var ee=X++,te=fe.imin(l,ee),ie=fe.imax(0,ee-p),he=te+1;ie<he;){var ae=ie++;v[ee][ae]=v[k-ee][l-ae]}var ue=k+1,ne=-1,de=l,Y=l+1,pe=1,Pe=c[0];L[0]=d[0];for(var Ge=0,Xe=k+1;Ge<Xe;){var Fe=Ge++;N[Fe]=Pe}for(var Ke=0,At=l+1;Ke<At;){var Wt=Ke++;w[Wt]=d[Wt]}for(;Y<I;){for(var vt=Y;Y<I&&c[Y]==c[Y+1];)Y=Y+1;var gt=Y-vt+1,St=c[Y],Tt=ne;ne=l-gt;var Kt;Tt>0?Kt=Math.floor((Tt+2)/2):Kt=1;var or;if(ne>0?or=Math.floor(k-(ne+1)/2):or=k,ne>0){for(var $t=St-Pe,Zt=[],Qt=l;Qt>gt;)Zt[Qt-gt-1]=$t/(c[de+Qt]-Pe),Qt--;for(var dr=1,Tn=ne+1;dr<Tn;){for(var $r=dr++,Mc=ne-$r,Fi=gt+$r,Zr=l;Zr>=Fi;)w[Zr]=m.add(m.mul(Zt[Zr-Fi],w[Zr]),m.mul(1-Zt[Zr-Fi],w[Zr-1])),Zr--;A[Mc]=w[l]}}for(var po=Kt,Tc=k+1;po<Tc;){var Cn=po++;P[Cn]=m.zeros1d(_);for(var Cc=fe.imin(l,Cn),go=fe.imax(0,Cn-p),Nc=Cc+1;go<Nc;){var fo=go++;P[Cn]=m.add(P[Cn],m.mul(v[Cn][fo],w[fo]))}}if(Tt>1)for(var Ui=ue-2,Vi=ue,_o=St-Pe,Lc=(St-N[ue-1])/_o,vo=1;vo<Tt;){for(var ji=vo++,mr=Ui,Qr=Vi,Fr=Qr-ue+1;Qr-mr>ji;){if(mr<pe){var Oc=(St-N[mr])/(Pe-N[mr]);L[mr]=m.lerp(Oc,L[mr],L[mr-1])}if(Qr>=Kt){if(Qr-ji<=ue-k+Tt){var zc=(St-N[Qr-ji])/_o;P[Fr]=m.lerp(zc,P[Fr],P[Fr+1])}}else P[Fr]=m.lerp(Lc,P[Fr],P[Fr+1]);mr=mr+1,Qr=Qr-1,Fr=Fr-1}Ui=Ui-1,Vi=Vi+1}if(de!=l)for(var yo=0,Dc=k-Tt;yo<Dc;)yo++,N[ue]=Pe,ue=ue+1;for(var bo=Kt,Rc=or+1;bo<Rc;){var Bc=bo++;L[pe]=P[Bc],pe=pe+1}if(Y<I){for(var xo=0;xo<ne;){var wo=xo++;w[wo]=A[wo]}for(var Ao=ne,Fc=l+1;Ao<Fc;){var So=Ao++;w[So]=d[Y-l+So]}de=Y,Y=Y+1,Pe=St}else for(var Po=0,Uc=k+1;Po<Uc;){var Vc=Po++;N[ue+Vc]=St}}return new je(n,N,L)},fe.rationalSurfaceTransform=function(r,n){for(var a=C.dehomogenize2d(r.controlPoints),l=0,c=a.length;l<c;)for(var d=l++,p=0,_=a[d].length;p<_;){var v=p++,w=a[d][v];w.push(1),a[d][v]=Ne.dot(n,w).slice(0,w.length-1)}return new et(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),C.homogenize2d(a,C.weight2d(r.controlPoints)))},fe.rationalCurveTransform=function(r,n){for(var a=C.dehomogenize1d(r.controlPoints),l=0,c=a.length;l<c;){var d=l++,p=a[d];p.push(1),a[d]=Ne.dot(n,p).slice(0,p.length-1)}return new je(r.degree,r.knots.slice(),C.homogenize1d(a,C.weight1d(r.controlPoints)))},fe.surfaceKnotRefine=function(r,n,a){var l=[],c,d,p;a?(p=r.controlPoints,c=r.knotsV,d=r.degreeV):(p=Ne.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,v=0;v<p.length;){var w=p[v];++v,_=fe.curveKnotRefine(new je(d,c,w),n),l.push(_.controlPoints)}var P=_.knots;return a?new et(r.degreeU,r.degreeV,r.knotsU.slice(),P,l):(l=Ne.transpose(l),new et(r.degreeU,r.degreeV,P,r.knotsV.slice(),l))},fe.decomposeCurveIntoBeziers=function(r){for(var n=r.degree,a=r.controlPoints,l=r.knots,c=ve.knotMultiplicities(l),d=n+1,p=0;p<c.length;){var _=c[p];if(++p,_.mult<d){var v=m.rep(d-_.mult,_.knot),w=fe.curveKnotRefine(new je(n,l,a),v);l=w.knots,a=w.controlPoints}}l.length/d-1;for(var P=d*2,A=[],I=0;I<a.length;){var k=l.slice(I,I+P),T=a.slice(I,I+d);A.push(new je(n,k,T)),I+=d}return A},fe.curveKnotRefine=function(r,n){if(n.length==0)return me.clonedCurve(r);for(var a=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,p=d+a+1,_=n.length-1,v=C.knotSpan(a,n[0],c),w=C.knotSpan(a,n[_],c),P=[],A=[],I=0,k=v-a+1;I<k;){var T=I++;P[T]=l[T]}for(var L=w-1,N=d+1;L<N;){var R=L++;P[R+_+1]=l[R]}for(var O=0,F=v+1;O<F;){var V=O++;A[V]=c[V]}for(var q=w+a,J=p+1;q<J;){var H=q++;A[H+_+1]=c[H]}for(var j=w+a-1,X=w+a+_,ee=_;ee>=0;){for(;n[ee]<=c[j]&&j>v;)P[X-a-1]=l[j-a-1],A[X]=c[j],X=X-1,j=j-1;P[X-a-1]=P[X-a];for(var te=1,ie=a+1;te<ie;){var he=te++,ae=X-a+he,ue=A[X+he]-n[ee];Math.abs(ue)<re.EPSILON?P[ae-1]=P[ae]:(ue=ue/(A[X+he]-c[j-a+he]),P[ae-1]=m.add(m.mul(ue,P[ae-1]),m.mul(1-ue,P[ae])))}A[X]=n[ee],X=X-1,ee--}return new je(a,A,P)},fe.curveKnotInsert=function(r,n,a){for(var l=r.degree,c=r.controlPoints,d=r.knots,p=0,_=c.length,v=C.knotSpan(l,n,d),w=[],P=[],A=[],I=1,k=v+1;I<k;){var T=I++;P[T]=d[T]}for(var L=1,N=a+1;L<N;){var R=L++;P[v+R]=n}for(var O=v+1,F=d.length;O<F;){var V=O++;P[V+a]=d[V]}for(var q=0,J=v-l+1;q<J;){var H=q++;A[H]=c[H]}for(var j=v-p;j<_;){var X=j++;A[X+a]=c[X]}for(var ee=0,te=l-p+1;ee<te;){var ie=ee++;w[ie]=c[v-l+ie]}for(var he=0,ae=0,ue=1,ne=a+1;ue<ne;){var de=ue++;he=v-l+de;for(var Y=0,pe=l-de-p+1;Y<pe;){var Pe=Y++;ae=(n-d[he+Pe])/(d[Pe+v+1]-d[he+Pe]),w[Pe]=m.add(m.mul(ae,w[Pe+1]),m.mul(1-ae,w[Pe]))}A[he]=w[0],A[v+a-de-p]=w[l-de-p]}for(var Ge=he+1,Xe=v-p;Ge<Xe;){var Fe=Ge++;A[Fe]=w[Fe-he]}return new je(l,P,A)};var Oe=f.eval.Tess=function(){};x["verb.eval.Tess"]=Oe,Oe.__name__=["verb","eval","Tess"],Oe.rationalCurveRegularSample=function(r,n,a){return Oe.rationalCurveRegularSampleRange(r,r.knots[0],K.last(r.knots),n,a)},Oe.rationalCurveRegularSampleRange=function(r,n,a,l,c){l<1&&(l=2);for(var d=[],p=(a-n)/(l-1),_=0,v=0;v<l;){var w=v++;_=n+p*w,c?d.push([_].concat(C.rationalCurvePoint(r,_))):d.push(C.rationalCurvePoint(r,_))}return d},Oe.rationalCurveAdaptiveSample=function(r,n,a){if(a==null&&(a=!1),n==null&&(n=1e-6),r.degree==1)if(a){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var p=c++;l.push([r.knots[p+1]].concat(C.dehomogenize(r.controlPoints[p])))}return l}else return r.controlPoints.map(C.dehomogenize);return Oe.rationalCurveAdaptiveSampleRange(r,r.knots[0],K.last(r.knots),n,a)},Oe.rationalCurveAdaptiveSampleRange=function(r,n,a,l,c){var d=C.rationalCurvePoint(r,n),p=C.rationalCurvePoint(r,a),_=.5+.2*Math.random(),v=n+(a-n)*_,w=C.rationalCurvePoint(r,v),P=m.sub(d,p),A=m.sub(d,w);if(m.dot(P,P)<l&&m.dot(A,A)>l||!kt.threePointsAreFlat(d,w,p,l)){var I=n+(a-n)*.5,k=Oe.rationalCurveAdaptiveSampleRange(r,n,I,l,c),T=Oe.rationalCurveAdaptiveSampleRange(r,I,a,l,c);return k.slice(0,-1).concat(T)}else return c?[[n].concat(d),[a].concat(p)]:[d,p]},Oe.rationalSurfaceNaive=function(r,n,a){n<1&&(n=1),a<1&&(a=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=K.last(l)-l[0],p=K.last(c)-c[0],_=d/n,v=p/a,w=[],P=[],A=[],I=0,k=n+1;I<k;)for(var T=I++,L=0,N=a+1;L<N;){var R=L++,O=T*_,F=R*v;P.push([O,F]);var V=C.rationalSurfaceDerivatives(r,O,F,1),q=V[0][0];w.push(q);var J=m.normalized(m.cross(V[1][0],V[0][1]));A.push(J)}for(var H=[],j=0;j<n;)for(var X=j++,ee=0;ee<a;){var te=ee++,ie=X*(a+1)+te,he=(X+1)*(a+1)+te,ae=he+1,ue=ie+1,ne=[ie,he,ae],de=[ie,ae,ue];H.push(ne),H.push(de)}return new qt(H,w,A,P)},Oe.divideRationalSurfaceAdaptive=function(r,n){n==null&&(n=new Or),n.minDivsU!=null?n.minDivsU=n.minDivsU:n.minDivsU=1,n.minDivsV!=null?n.minDivsU=n.minDivsV:n.minDivsU=1,n.refine!=null?n.refine=n.refine:n.refine=!0;var a=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;n.minDivsU>a?c=n.minDivsU=n.minDivsU:c=n.minDivsU=a;var d;n.minDivsV>l?d=n.minDivsV=n.minDivsV:d=n.minDivsV=l;for(var p=K.last(r.knotsU),_=r.knotsU[0],v=K.last(r.knotsV),w=r.knotsV[0],P=(p-_)/c,A=(v-w)/d,I=[],k=[],T=0,L=d+1;T<L;){for(var N=T++,R=[],O=0,F=c+1;O<F;){var V=O++,q=_+P*V,J=w+A*N,H=C.rationalSurfaceDerivatives(r,q,J,1),j=m.normalized(m.cross(H[0][1],H[1][0]));R.push(new jt(H[0][0],j,[q,J],-1,m.isZero(j)))}k.push(R)}for(var X=0;X<d;)for(var ee=X++,te=0;te<c;){var ie=te++,he=[k[d-ee-1][ie],k[d-ee-1][ie+1],k[d-ee][ie+1],k[d-ee][ie]];I.push(new ur(r,he))}if(!n.refine)return I;for(var ae=0;ae<d;)for(var ue=ae++,ne=0;ne<c;){var de=ne++,Y=ue*c+de,pe=Oe.north(Y,ue,de,c,d,I),Pe=Oe.east(Y,ue,de,c,d,I),Ge=Oe.south(Y,ue,de,c,d,I),Xe=Oe.west(Y,ue,de,c,d,I);I[Y].neighbors=[Ge,Pe,pe,Xe],I[Y].divide(n)}return I},Oe.north=function(r,n,a,l,c,d){return n==0?null:d[r-l]},Oe.south=function(r,n,a,l,c,d){return n==c-1?null:d[r+l]},Oe.east=function(r,n,a,l,c,d){return a==l-1?null:d[r+1]},Oe.west=function(r,n,a,l,c,d){return a==0?null:d[r-1]},Oe.triangulateAdaptiveRefinementNodeTree=function(r){for(var n=qt.empty(),a=0;a<r.length;){var l=r[a];++a,l.triangulate(n)}return n},Oe.rationalSurfaceAdaptive=function(r,n){n!=null?n=n:n=new Or;var a=Oe.divideRationalSurfaceAdaptive(r,n);return Oe.triangulateAdaptiveRefinementNodeTree(a)};var Or=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};x["verb.eval.AdaptiveRefinementOptions"]=Or,Or.__name__=["verb","eval","AdaptiveRefinementOptions"],Or.prototype={__class__:Or};var ur=f.core.AdaptiveRefinementNode=function(r,n,a){if(this.srf=r,a==null?this.neighbors=[null,null,null,null]:this.neighbors=a,this.corners=n,this.corners==null){var l=r.knotsU[0],c=K.last(r.knotsU),d=r.knotsV[0],p=K.last(r.knotsV);this.corners=[jt.fromUv(l,d),jt.fromUv(c,d),jt.fromUv(c,p),jt.fromUv(l,p)]}};x["verb.eval.AdaptiveRefinementNode"]=ur,ur.__name__=["verb","eval","AdaptiveRefinementNode"],ur.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var n=r++;if(this.corners[n].point==null){var a=this.corners[n];this.evalSrf(a.uv[0],a.uv[1],a)}}},evalSrf:function(r,n,a){var l=C.rationalSurfaceDerivatives(this.srf,r,n,1),c=l[0][0],d=m.cross(l[0][1],l[1][0]),p=m.isZero(d);return p||(d=m.normalized(d)),a!=null?(a.degen=p,a.point=c,a.normal=d,a):new jt(c,d,[r,n],-1,p)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var n=[this.corners[r]];if(this.neighbors[r]==null)return n;var a=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=re.EPSILON,d=this,p=[function(v){return v.uv[0]>d.corners[0].uv[0]+c&&v.uv[0]<d.corners[2].uv[0]-c},function(v){return v.uv[1]>d.corners[0].uv[1]+c&&v.uv[1]<d.corners[2].uv[1]-c}],_=a.filter(p[l]);return _.reverse(),n.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,n=0;n<r;){var a=n++;if(this.corners[a],this.corners[a].degen){var l=this.corners[(a+1)%r],c=this.corners[(a+3)%r];l.degen?this.corners[a].normal=c.normal:this.corners[a].normal=l.normal}}},shouldDivide:function(r,n){if(n<r.minDepth)return!0;if(n>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=m.normSquared(m.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=m.normSquared(m.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var a=this.center();return m.normSquared(m.sub(a.normal,this.corners[0].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[1].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[2].normal))>r.normTol||m.normSquared(m.sub(a.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new Or),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,n,a){if(this.evalCorners(),!!this.shouldDivide(r,n)){if(n++,this.splitVert&&!this.splitHoriz?a=!1:!this.splitVert&&this.splitHoriz&&(a=!0),this.horizontal=a,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new ur(this.srf,l),new ur(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],p=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new ur(this.srf,d),new ur(this.srf,p)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,v=this.children;_<v.length;){var w=v[_];++_,w._divide(r,n,!a)}}},triangulate:function(r){if(r==null&&(r=qt.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var n=0,a=this.children;n<a.length;){var l=a[n];if(++n,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var n=r.points.length,a=[],l=[],c=0,d=0;d<4;){var p=d++,_=this.getAllCorners(p);_.length==2&&(c=p+1);for(var v=0,w=_.length;v<w;){var P=v++;a.push(_[P])}}for(var A=0;A<a.length;){var I=a[A];if(++A,I.id!=-1){l.push(I.id);continue}r.uvs.push(I.uv),r.points.push(I.point),r.normals.push(I.normal),I.id=n,l.push(n),n++}if(a.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(a.length==5){var k=l.length;return r.faces.push([l[c],l[(c+2)%k],l[(c+1)%k]]),r.faces.push([l[(c+4)%k],l[(c+3)%k],l[c]]),r.faces.push([l[c],l[(c+3)%k],l[(c+2)%k]]),r}var T=this.center();r.uvs.push(T.uv),r.points.push(T.point),r.normals.push(T.normal);for(var L=r.points.length-1,N=0,R=a.length-1;N<a.length;)r.faces.push([L,l[N],l[R]]),R=N++;return r},__class__:ur};var we=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=we,we.__name__=["verb","exe","Dispatcher"],we.init=function(){we._init||(we._workerPool=new zr(we.THREADS),we._init=!0)},we.dispatchMethod=function(r,n,a){we.init();var l=new yn,c=function(d){l.resolve(d)};return we._workerPool.addWork(ce.getClassName(r),n,a,c),new pt(l)};var zr=f.exe.WorkerPool=function(r,n){n==null&&(n="verb.js"),r==null&&(r=1),this._callbacks=new xe,this._working=new xe,this._pool=[],this._queue=[];for(var a=0;a<r;){a++;var l;try{l=new Worker(zr.basePath+n)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(zr.basePath+n.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=zr,zr.__name__=["verb","exe","WorkerPool"],zr.prototype={addWork:function(r,n,a,l){var c=new Kr(r,n,a);this._callbacks.set(c.id,l),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var n=this._queue.shift(),a=[n.id],l=[this._pool.shift()];this._working.h[a[0]]=l[0],l[0].onmessage=function(c,d){return function(p){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](p.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,a),l[0].postMessage(n)}},__class__:zr};var Kr=function(r,n,a){this.className=r,this.methodName=n,this.args=a,this.id=Kr.uuid++};x["verb.exe._WorkerPool.Work"]=Kr,Kr.__name__=["verb","exe","_WorkerPool","Work"],Kr.prototype={__class__:Kr};var kn=function(){};x["verb.geom.ICurve"]=kn,kn.__name__=["verb","geom","ICurve"],kn.__interfaces__=[Pn],kn.prototype={__class__:kn};var Ce=f.geom.NurbsCurve=function(r){this._data=Gt.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=Ce,Ce.__name__=["verb","geom","NurbsCurve"],Ce.__interfaces__=[kn],Ce.byKnotsControlPointsWeights=function(r,n,a,l){return new Ce(new je(r,n.slice(),C.homogenize1d(a,l)))},Ce.byPoints=function(r,n){return n==null&&(n=3),new Ce(me.rationalInterpCurve(r,n))},Ce.__super__=Ze,Ce.prototype=M(Ze.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return C.dehomogenize1d(this._data.controlPoints)},weights:function(){return C.weight1d(this._data.controlPoints)},asNurbs:function(){return new je(this.degree(),this.knots(),C.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Ce(this._data)},domain:function(){return new wt(K.first(this._data.knots),K.last(this._data.knots))},transform:function(r){return new Ce(fe.rationalCurveTransform(this._data,r))},transformAsync:function(r){return we.dispatchMethod(fe,"rationalCurveTransform",[this._data,r]).then(function(n){return new Ce(n)})},point:function(r){return C.rationalCurvePoint(this._data,r)},pointAsync:function(r){return we.dispatchMethod(C,"rationalCurvePoint",[this._data,r])},tangent:function(r){return C.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return we.dispatchMethod(C,"rationalCurveTangent",[this._data,r])},derivatives:function(r,n){return n==null&&(n=1),C.rationalCurveDerivatives(this._data,r,n)},derivativesAsync:function(r,n){return n==null&&(n=1),we.dispatchMethod(C,"rationalCurveDerivatives",[this._data,r,n])},closestPoint:function(r){return ve.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return we.dispatchMethod(ve,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return ve.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return we.dispatchMethod(ve,"rationalCurveClosestParam",[this._data,r])},length:function(){return ve.rationalCurveArcLength(this._data)},lengthAsync:function(){return we.dispatchMethod(ve,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return ve.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return we.dispatchMethod(ve,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,n){return ve.rationalCurveParamAtArcLength(this._data,r,n)},paramAtLengthAsync:function(r,n){return we.dispatchMethod(ve,"rationalCurveParamAtArcLength",[this._data,r,n])},divideByEqualArcLength:function(r){return lt.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return we.dispatchMethod(lt,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return lt.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return we.dispatchMethod(lt,"rationalCurveByArcLength",[this._data,r])},split:function(r){return lt.curveSplit(this._data,r).map(function(n){return new Ce(n)})},splitAsync:function(r){return we.dispatchMethod(lt,"curveSplit",[this._data,r]).then(function(n){return n.map(function(a){return new Ce(a)})})},reverse:function(){return new Ce(fe.curveReverse(this._data))},reverseAsync:function(){return we.dispatchMethod(fe,"curveReverse",[this._data]).then(function(r){return new Ce(r)})},tessellate:function(r){return Oe.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return we.dispatchMethod(Oe,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Ce});var Dr=f.geom.Arc=function(r,n,a,l,c,d){Ce.call(this,me.arc(r,n,a,l,c,d)),this._center=r,this._xaxis=n,this._yaxis=a,this._radius=l,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Dr,Dr.__name__=["verb","geom","Arc"],Dr.__super__=Ce,Dr.prototype=M(Ce.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Dr});var Qn=f.geom.BezierCurve=function(r,n){Ce.call(this,me.rationalBezierCurve(r,n))};x["verb.geom.BezierCurve"]=Qn,Qn.__name__=["verb","geom","BezierCurve"],Qn.__super__=Ce,Qn.prototype=M(Ce.prototype,{__class__:Qn});var Jn=f.geom.Circle=function(r,n,a,l){Dr.call(this,r,n,a,l,0,Math.PI*2)};x["verb.geom.Circle"]=Jn,Jn.__name__=["verb","geom","Circle"],Jn.__super__=Dr,Jn.prototype=M(Dr.prototype,{__class__:Jn});var Mn=function(){};x["verb.geom.ISurface"]=Mn,Mn.__name__=["verb","geom","ISurface"],Mn.__interfaces__=[Pn],Mn.prototype={__class__:Mn};var Ie=f.geom.NurbsSurface=function(r){this._data=Gt.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Ie,Ie.__name__=["verb","geom","NurbsSurface"],Ie.__interfaces__=[Mn],Ie.byKnotsControlPointsWeights=function(r,n,a,l,c,d){return new Ie(new et(r,n,a,l,C.homogenize2d(c,d)))},Ie.byCorners=function(r,n,a,l){return new Ie(me.fourPointSurface(r,n,a,l))},Ie.byLoftingCurves=function(r,n){return new Ie(me.loftedSurface(function(a){for(var l,c=[],d=0;d<r.length;){var p=r[d];++d,c.push(p.asNurbs())}return l=c,l}(),n))},Ie.__super__=Ze,Ie.prototype=M(Ze.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return C.dehomogenize2d(this._data.controlPoints)},weights:function(){return C.weight2d(this._data.controlPoints)},asNurbs:function(){return new et(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),C.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Ie(this.asNurbs())},domainU:function(){return new wt(K.first(this._data.knotsU),K.last(this._data.knotsU))},domainV:function(){return new wt(K.first(this._data.knotsV),K.last(this._data.knotsV))},point:function(r,n){return C.rationalSurfacePoint(this._data,r,n)},pointAsync:function(r,n){return we.dispatchMethod(C,"rationalSurfacePoint",[this._data,r,n])},normal:function(r,n){return C.rationalSurfaceNormal(this._data,r,n)},normalAsync:function(r,n){return we.dispatchMethod(C,"rationalSurfaceNormal",[this._data,r,n])},derivatives:function(r,n,a){return a==null&&(a=1),C.rationalSurfaceDerivatives(this._data,r,n,a)},derivativesAsync:function(r,n,a){return a==null&&(a=1),we.dispatchMethod(C,"rationalSurfaceDerivatives",[this._data,r,n,a])},closestParam:function(r){return ve.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return we.dispatchMethod(ve,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return ve.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return we.dispatchMethod(ve,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,n){return n==null&&(n=!1),lt.surfaceSplit(this._data,r,n).map(function(a){return new Ie(a)})},splitAsync:function(r,n){return n==null&&(n=!1),we.dispatchMethod(lt,"surfaceSplit",[this._data,r,n]).then(function(a){return a.map(function(l){return new Ie(l)})})},reverse:function(r){return r==null&&(r=!1),new Ie(fe.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),we.dispatchMethod(fe,"surfaceReverse",[this._data,r]).then(function(n){return new Ie(n)})},isocurve:function(r,n){return n==null&&(n=!1),new Ce(me.surfaceIsocurve(this._data,r,n))},isocurveAsync:function(r,n){return n==null&&(n=!1),we.dispatchMethod(me,"surfaceIsocurve",[this._data,r,n]).then(function(a){return new Ce(a)})},boundaries:function(r){return me.surfaceBoundaryCurves(this._data).map(function(n){return new Ce(n)})},boundariesAsync:function(r){return we.dispatchMethod(me,"surfaceBoundaryCurves",[this._data]).then(function(n){return n.map(function(a){return new Ce(a)})})},tessellate:function(r){return Oe.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return we.dispatchMethod(Oe,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Ie(fe.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return we.dispatchMethod(fe,"rationalSurfaceTransform",[this._data,r]).then(function(n){return new Ie(n)})},__class__:Ie});var es=f.geom.ConicalSurface=function(r,n,a,l,c){Ie.call(this,me.conicalSurface(r,n,a,l,c)),this._axis=r,this._xaxis=n,this._base=a,this._height=l,this._radius=c};x["verb.geom.ConicalSurface"]=es,es.__name__=["verb","geom","ConicalSurface"],es.__super__=Ie,es.prototype=M(Ie.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:es});var ts=f.geom.CylindricalSurface=function(r,n,a,l,c){Ie.call(this,me.cylindricalSurface(r,n,a,l,c)),this._axis=r,this._xaxis=n,this._base=a,this._height=l,this._radius=c};x["verb.geom.CylindricalSurface"]=ts,ts.__name__=["verb","geom","CylindricalSurface"],ts.__super__=Ie,ts.prototype=M(Ie.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:ts});var Rr=f.geom.EllipseArc=function(r,n,a,l,c){Ce.call(this,me.ellipseArc(r,n,a,l,c)),this._center=r,this._xaxis=n,this._yaxis=a,this._minAngle=l,this._maxAngle=c};x["verb.geom.EllipseArc"]=Rr,Rr.__name__=["verb","geom","EllipseArc"],Rr.__super__=Ce,Rr.prototype=M(Ce.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Rr});var rs=f.geom.Ellipse=function(r,n,a){Rr.call(this,r,n,a,0,Math.PI*2)};x["verb.geom.Ellipse"]=rs,rs.__name__=["verb","geom","Ellipse"],rs.__super__=Rr,rs.prototype=M(Rr.prototype,{__class__:rs});var ns=f.geom.ExtrudedSurface=function(r,n){Ie.call(this,me.extrudedSurface(m.normalized(n),m.norm(n),r.asNurbs())),this._profile=r,this._direction=n};x["verb.geom.ExtrudedSurface"]=ns,ns.__name__=["verb","geom","ExtrudedSurface"],ns.__super__=Ie,ns.prototype=M(Ie.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:ns});var Br=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=Br,Br.__name__=["verb","geom","Intersect"],Br.curves=function(r,n,a){return a==null&&(a=.001),le.curves(r.asNurbs(),n.asNurbs(),a)},Br.curvesAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"curves",[r.asNurbs(),n.asNurbs(),a])},Br.curveAndSurface=function(r,n,a){return a==null&&(a=.001),le.curveAndSurface(r.asNurbs(),n.asNurbs(),a)},Br.curveAndSurfaceAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"curveAndSurface",[r.asNurbs(),n.asNurbs(),a])},Br.surfaces=function(r,n,a){return a==null&&(a=.001),le.surfaces(r.asNurbs(),n.asNurbs(),a).map(function(l){return new Ce(l)})},Br.surfacesAsync=function(r,n,a){return a==null&&(a=.001),we.dispatchMethod(le,"surfaces",[r.asNurbs(),n.asNurbs(),a]).then(function(l){return l.map(function(c){return new Ce(c)})})};var ss=f.geom.Line=function(r,n){Ce.call(this,me.polyline([r,n])),this._start=r,this._end=n};x["verb.geom.Line"]=ss,ss.__name__=["verb","geom","Line"],ss.__super__=Ce,ss.prototype=M(Ce.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:ss});var is=f.geom.RevolvedSurface=function(r,n,a,l){Ie.call(this,me.revolvedSurface(r.asNurbs(),n,a,l)),this._profile=r,this._center=n,this._axis=a,this._angle=l};x["verb.geom.RevolvedSurface"]=is,is.__name__=["verb","geom","RevolvedSurface"],is.__super__=Ie,is.prototype=M(Ie.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:is});var as=f.geom.SphericalSurface=function(r,n){Ie.call(this,me.sphericalSurface(r,[0,0,1],[1,0,0],n)),this._center=r,this._radius=n};x["verb.geom.SphericalSurface"]=as,as.__name__=["verb","geom","SphericalSurface"],as.__super__=Ie,as.prototype=M(Ie.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:as});var os=f.geom.SweptSurface=function(r,n){Ie.call(this,me.rationalTranslationalSurface(r.asNurbs(),n.asNurbs())),this._profile=r,this._rail=n};x["verb.geom.SweptSurface"]=os,os.__name__=["verb","geom","SweptSurface"],os.__super__=Ie,os.prototype=M(Ie.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:os});function Xt(r){return r instanceof Array?function(){return z.iter(r)}:typeof r.iterator=="function"?Mt(r,r.iterator):r.iterator}var Di,Ic=0;function Mt(r,n){if(n==null)return null;n.__id__==null&&(n.__id__=Ic++);var a;return r.hx__closures__==null?r.hx__closures__={}:a=r.hx__closures__[n.__id__],a==null&&(a=function(){return a.method.apply(a.scope,arguments)},a.scope=r,a.method=n,r.hx__closures__[n.__id__]=a),a}x.Math=Math,String.prototype.__class__=x.String=String,String.__name__=["String"],x.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=x.Date=Date,Date.__name__=["Date"];var Ec=x.Int={__name__:["Int"]},kc=x.Dynamic={__name__:["Dynamic"]},ho=x.Float=Number;ho.__name__=["Float"];var co=x.Bool=Boolean;co.__ename__=["Bool"];var uo=x.Class={__name__:["Class"]},mo={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var n=[],a=0,l=this.length;a<l;){var c=a++;n[c]=r(this[c])}return n}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var n=[],a=0,l=this.length;a<l;){var c=a++,d=this[c];r(d)&&n.push(d)}return n});var Ri={},Us=S.ArrayBuffer||ot;Us.prototype.slice==null&&(Us.prototype.slice=ot.sliceImpl),S.DataView;var Bi=S.Uint8Array||nr._new;(function(r,n){if(r.setImmediate)return;var a=1,l={},c=!1,d=r.document,p;function _(O){return l[a]=v.apply(n,O),a++}function v(O){var F=[].slice.call(arguments,1);return function(){typeof O=="function"?O.apply(n,F):new Function(""+O)()}}function w(O){if(c)setTimeout(v(w,O),0);else{var F=l[O];if(F){c=!0;try{F()}finally{P(O),c=!1}}}}function P(O){delete l[O]}function A(){p=function(){var O=_(arguments);return process.nextTick(v(w,O)),O}}function I(){if(r.postMessage&&!r.importScripts){var O=!0,F=r.onmessage;return r.onmessage=function(){O=!1},r.postMessage("","*"),r.onmessage=F,O}}function k(){var O="setImmediate$"+Math.random()+"$",F=function(V){V.source===r&&typeof V.data=="string"&&V.data.indexOf(O)===0&&w(+V.data.slice(O.length))};r.addEventListener?r.addEventListener("message",F,!1):r.attachEvent("onmessage",F),p=function(){var V=_(arguments);return r.postMessage(O+V,"*"),V}}function T(){var O=new MessageChannel;O.port1.onmessage=function(F){var V=F.data;w(V)},p=function(){var F=_(arguments);return O.port2.postMessage(F),F}}function L(){var O=d.documentElement;p=function(){var F=_(arguments),V=d.createElement("script");return V.onreadystatechange=function(){w(F),V.onreadystatechange=null,O.removeChild(V),V=null},O.appendChild(V),F}}function N(){p=function(){var O=_(arguments);return setTimeout(v(w,O),0),O}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?A():I()?k():r.MessageChannel?T():d&&"onreadystatechange"in d.createElement("script")?L():N(),R.setImmediate=p,R.clearImmediate=P})(new Function("return this")()),Ye.USE_CACHE=!1,Ye.USE_ENUM_INDEX=!1,Ye.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",We.DEFAULT_RESOLVER=ce,We.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Le.count=0,at.i64tmp=function(r){var n,a=new Ve(0,0);return n=a,n}(),Te.__toStr={}.toString,nr.BYTES_PER_ELEMENT=1,Se.queue=new U,De.memo=new xe,re.TOLERANCE=1e-6,re.EPSILON=1e-10,re.VERSION="2.0.0",ve.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],ve.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],we.THREADS=1,we._init=!1,zr.basePath="",Kr.uuid=0,Bs.main()}(typeof console<"u"?console:{log:function(){}},t,typeof u<"u"?u:typeof s<"u"?s:typeof self<"u"?self:this),t})})(Xh);var Hd=Xh.exports;const On=Wd(Hd);class na{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(e,t,s,o){this.c0=e,this.c1=s,this.c2=-3*e+3*t-2*s-o,this.c3=2*e-2*t+s+o}initCatmullRom(e,t,s,o,h){this.init(t,s,h*(s-e),h*(o-t))}initNonuniformCatmullRom(e,t,s,o,h,u,g){let b=(t-e)/h-(s-e)/(h+u)+(s-t)/u,f=(s-t)/u-(o-t)/(u+g)+(o-s)/g;b*=u,f*=u,this.init(t,s,b,f)}calc(e){const t=e*e,s=t*e;return this.c0+this.c1*e+this.c2*t+this.c3*s}}class Kh extends Ds{constructor(e=[],t=!1,s="centripetal",o=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new Z,this._px=new na,this._py=new na,this._pz=new na,this._points=e.map(h=>new $(h)),this._closed=t,this._curveType=s,this._tension=o}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new $}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new $}get length(){if(this._points.length<2)return 0;let e=0;for(let t=1;t<this._points.length;t++)e+=this._points[t-1].distanceTo(this._points[t]);return this._closed&&this._points.length>2&&(e+=this._points[this._points.length-1].distanceTo(this._points[0])),e}getPoint(e,t=new $){const s=t,o=this._points,h=o.length;if(h===0)return s.set(0,0,0);if(h===1)return s.copy(o[0]);const u=(h-(this._closed?0:1))*e;let g=Math.floor(u),b=u-g;this._closed?g+=g>0?0:(Math.floor(Math.abs(g)/h)+1)*h:b===0&&g===h-1&&(g=h-2,b=1);let f,S;this._closed||g>0?f=o[(g-1)%h]:(this._tmp.subVectors(o[0],o[1]).add(o[0]),f=new $(this._tmp.x,this._tmp.y,this._tmp.z));const x=o[g%h],E=o[(g+1)%h];if(this._closed||g+2<h?S=o[(g+2)%h]:(this._tmp.subVectors(o[h-1],o[h-2]).add(o[h-1]),S=new $(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const M=this._curveType==="chordal"?.5:.25;let z=Math.pow(f.distanceToSquared(x),M),D=Math.pow(x.distanceToSquared(E),M),U=Math.pow(E.distanceToSquared(S),M);D<1e-4&&(D=1),z<1e-4&&(z=D),U<1e-4&&(U=D),this._px.initNonuniformCatmullRom(f.x,x.x,E.x,S.x,z,D,U),this._py.initNonuniformCatmullRom(f.y,x.y,E.y,S.y,z,D,U),this._pz.initNonuniformCatmullRom(f.z,x.z,E.z,S.z,z,D,U)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,E.x,S.x,this._tension),this._py.initCatmullRom(f.y,x.y,E.y,S.y,this._tension),this._pz.initCatmullRom(f.z,x.z,E.z,S.z,this._tension));return s.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),s}getPoints(e){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}setPoints(e){this._points=e.map(t=>new $(t)),this._boundingBoxNeedsUpdate=!0}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0)}setCurveType(e){this._curveType=e}setTension(e){this._tension=e}transform(e){return this._points=this._points.map(t=>{const s=new $;return s.copy(t),s.applyMatrix3d(e),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Re;const e=new Re;return this._points.forEach(t=>{e.expandByPoint(t)}),e}}class pn{constructor(e,t,s,o){this._degree=e,this._knots=[...t],this._controlPoints=s.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=o?[...o]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>({x:e.x,y:e.y,z:e.z}))}weights(){return[...this._weights]}point(e){const t=this._controlPoints.map(s=>[s.x,s.y,s.z]);return Ms(e,this._degree,this._knots,t,this._weights)}length(){const e=this._controlPoints.map(t=>[t.x,t.y,t.z]);return Vh(this._degree,this._knots,e,this._weights)}static byKnotsControlPointsWeights(e,t,s,o){return new pn(e,t,s,o)}static byPoints(e,t,s="Uniform"){let o;switch(s){case"Chord":o=Fh(t,e);break;case"SqrtChord":o=Uh(t,e);break;case"Uniform":default:o=Bh(t,e.length);break}const h=e.map(g=>({x:g[0],y:g[1],z:g[2]})),u=new Array(h.length).fill(1);return new pn(t,o,h,u)}getParameterRange(){const e=this._knots[this._degree],t=this._knots[this._knots.length-this._degree-1];return{start:e,end:t}}getPoints(e){const t=[],{start:s,end:o}=this.getParameterRange();for(let h=0;h<=e;h++){const u=s+(o-s)*(h/e);t.push(this.point(u))}return t}isClosed(e=1e-6){const{start:t,end:s}=this.getParameterRange(),o=this.point(t),h=this.point(s),u=o[0]-h[0],g=o[1]-h[1],b=o[2]-h[2];return Math.sqrt(u*u+g*g+b*b)<e}static createFitPointsForClosedCurve(e){if(e.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const t=new Kh(e,!0,"centripetal"),s=Math.max(50,e.length*2);return t.getPoints(s)}static createClosedCurve(e,t,s="Chord"){const o=this.createFitPointsForClosedCurve(e).map(h=>[h.x,h.y,h.z]);return pn.byPoints(o,t,s)}}class qr extends Ds{constructor(e,t,s,o,h){super();const u=arguments.length;if(u<2||u>5)throw Ut.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(t)){this._controlPoints=e;let g,b=3,f=!1;if(u>=3&&(Array.isArray(s)?(g=s,u>=4&&(b=o||3),u>=5&&(f=h)):s!==void 0&&(b=s||3,u>=4&&(f=o))),s===void 0&&u>=4&&(b=o||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Ut.ILLEGAL_PARAMETERS;const S=this.toVerbPoints(this._controlPoints);this._nurbsCurve=On.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,S,g)}else{if(this._fitPoints=e,this._knotParameterization=t,u>=3&&(this._degree=s||3),u>=4&&(this._closed=o),this._fitPoints.length<this._degree+1)throw Ut.ILLEGAL_PARAMETERS;const g=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=On.geom.NurbsCurve.byPoints(g,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const e=pn.createFitPointsForClosedCurve(this._fitPoints),t=this.toNurbsPoints(e);this._nurbsCurve=On.geom.NurbsCurve.byPoints(t,this._degree)}else{const e=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=On.geom.NurbsCurve.byPoints(e,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const e=pn.createFitPointsForClosedCurve(this._controlPoints),t=this.toNurbsPoints(e);this._nurbsCurve=On.geom.NurbsCurve.byPoints(t,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const e=this._nurbsCurve.knots(),t=this._nurbsCurve.weights(),s=this.toVerbPoints(this._controlPoints);this._nurbsCurve=On.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,s,t)}}setClosed(e){this._closed!==e&&(this._closed=e,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[t],o=this._nurbsCurve.point(s);return new $(o[0],o[1],o[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[e.length-t-1],o=this._nurbsCurve.point(s);return new $(o[0],o[1],o[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,s=e<0||e>=t?t-1:e,o=this._fitPoints[s];return{x:o.x,y:o.y,z:o.z||0}}getControlPointAt(e){const t=this._controlPoints.length,s=e<0||e>=t?t-1:e;return this._controlPoints[s]}getPoints(e=100){const t=this._nurbsCurve,s=[],o=t.knots(),h=this._nurbsCurve.degree(),u=o[h],g=o[o.length-h-1],b=(g-u)/(e-1);for(let f=0;f<e;f++){const S=f===e-1?g:u+f*b,x=t.point(S);s.push(new $(x[0],x[1],x[2]))}return s}getCurvePoints(e,t){const s=[],o=e.knots(),h=o[3],u=(o[o.length-4]-h)/(t-1);for(let g=0;g<t;g++){const b=h+g*u;s.push(e.point(b))}return s}calculateBoundingBox(){const e=this.getPoints(100);return new Re().setFromPoints(e)}get closed(){return this._closed}set closed(e){this.setClosed(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]=[s.x,s.y,s.z||0]}),t}toVerbPoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]=[s.x,s.y,s.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((s,o)=>{t[o]={x:s[0],y:s[1],z:s[2]}}),t}static createClosedSpline(e,t="Uniform",s=3){if(e.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new qr(e,t,s,!0)}}var un=256,$h=[],Fo=256,Ws;for(;un--;)$h[un]=(un+256).toString(16).substring(1);function qd(i){var e=0,t=11;if(!Ws||un+t>Fo*2)for(Ws="",un=0;e<Fo;e++)Ws+=$h[Math.random()*256|0];return Ws.substring(un,un+++t)}class Yr{constructor(e,t){e=e||{},Bn(e,{objectId:qd()}),this._attrs=new Ko(e,t)}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get database(){return this._database?this._database:Oa().workingDatabase}set database(e){this._database=e}close(){}}const za=class za extends Yr{constructor(){super(...arguments),this._layer="0",this._color=new fn,this._lineType=Qs,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.typeName}get layer(){return this._layer}set layer(e){this._layer=e}get color(){return this._color}set color(e){this._color.copy(e)}get rgbColor(){let e=this.database.cecolor;if(this.color.isByLayer){const t=this.getLayerColor();t&&t.color&&(e=t)}else this.color.isByBlock||this.color.color!=null&&(e=this.color);return e.color==null?16777215:e.color}get lineType(){return this._lineType}set lineType(e){this._lineType=e||Qs}get lineWeight(){return this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,s,o,h){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const e=this.getLineType(),t=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(e);return t?{...t.linetype,color:this.rgbColor}:{name:e,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Qs){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==uh?ei:this.lineType;return ei}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return e.color;return null}attachEntityInfo(e){e&&(e.objectId=this.objectId,e.ownerId=this.ownerId,e.layerName=this.layer,e.visible=this.visibility)}};za.typeName="Entity";let Ht=za;const Da=class Da extends Ht{constructor(e){super(),this._blockName=e,this._position=new $,this._rotation=0,this._normal=new Z(0,0,1),this._scaleFactors=new $(1,1,1)}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const e=new Re,t=this.blockTableRecord;if(t!=null){const h=t.newIterator();for(const u of h)e.union(u.geometricExtents)}const s=new Wr().setFromEuler(new Hh(this.rotation,0,0)),o=new gn;return o.compose(this.position,s,this.scaleFactors),e.applyMatrix4(o),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const o=this.computeTransformMatrix(),h=Gr.instance.draw(e,s,this.rgbColor,!0,o,this.normal);return this.attachEntityInfo(h),h}else{const o=e.group(t);return this.attachEntityInfo(o),o}}computeTransformMatrix(){const e=new Wr;return e.setFromAxisAngle(Z.Z_AXIS,this.rotation),new gn().compose(this._position,e,this._scaleFactors)}};Da.typeName="BlockReference";let Cs=Da;const Ra=class Ra extends Ht{};Ra.typeName="Curve";let Vt=Ra;const Ba=class Ba extends Vt{constructor(e,t,s,o,h,u,g){super(),this._geo=new Ci(e,t,s,o,h,u,g)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(e){return e.ellipticalArc(this._geo,this.lineStyle)}};Ba.typeName="Ellipse";let ri=Ba;const Fa=class Fa extends Vt{constructor(e,t,s,o){super(),this._geo=new mn(e,t,s,o,Z.Z_AXIS,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}};Fa.typeName="Arc";let ni=Fa;const Ua=class Ua extends Vt{constructor(e,t,s=Z.Z_AXIS){super(),this._geo=new mn(e,t,0,nt,s,Z.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}};Ua.typeName="Circle";let si=Ua;var Zh=(i=>(i[i.UserDefined=0]="UserDefined",i[i.Predefined=1]="Predefined",i[i.Custom=2]="Custom",i))(Zh||{}),Qh=(i=>(i[i.Normal=0]="Normal",i[i.Outer=1]="Outer",i[i.Ignore=2]="Ignore",i))(Qh||{});const Va=class Va extends Ht{constructor(){super(),this._elevation=0,this._geo=new Mi,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e}get patternType(){return this._patternType}set patternType(e){this._patternType=e}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e}add(e){this._geo.add(e)}get geometricExtents(){const e=this._geo.box;return new Re({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){return e.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}};Va.typeName="Hatch";let ii=Va;var Jh=(i=>(i[i.MText=0]="MText",i[i.Fcf=1]="Fcf",i[i.BlockReference=2]="BlockReference",i[i.NoAnnotation=3]="NoAnnotation",i))(Jh||{});const ja=class ja extends Vt{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}appendVertex(e){this._vertices.push(new $().copy(e)),this._updated=!0}setVertexAt(e,t){throw(e<0||e>=this._vertices.length)&&(this._vertices[e].copy(t),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(e){throw(e<0||e>=this._vertices.length)&&this._vertices[e],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Re().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}draw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t,this.lineStyle)}else return e.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new qr(this._vertices,"Uniform"),this._updated=!1)}};ja.typeName="Leader";let ai=ja;const Ga=class Ga extends Vt{constructor(e,t){super(),this._geo=new Hr(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,s,o,h){const u=this.startPoint,g=this.endPoint;switch(e){case cn.EndPoint:h.push(u),h.push(g);break;case cn.MidPoint:h.push(this.midPoint);break;case cn.Nearest:{const b=this._geo.project(s);h.push(b)}break;case cn.Perpendicular:{const b=this._geo.perpPoint(s);h.push(b)}break;case cn.Tangent:h.push(u);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,o=[new $(t.x,t.y,0),new $(s.x,s.y,0)];return e.lines(o,this.lineStyle)}};Ga.typeName="Line";let oi=Ga;var Ea=(i=>(i.ClosedFilled="",i.Dot="_DOT",i.DotSmall="_DOTSMALL",i.DotBlank="_DOTBLANK",i.Origin="_ORIGIN",i.Origin2="_ORIGIN2",i.Open="_OPEN",i.Open90="_OPEN90",i.Open30="_OPEN30",i.Closed="_CLOSED",i.Small="_SMALL",i.None="_NONE",i.Oblique="_OBLIQUE",i.BoxFilled="_BOXFILLED",i.Box="_BOXBLANK",i.ClosedBlank="_CLOSEDBLANK",i.DatumBlank="_DATUMBLANK",i.DatumFilled="_DATUMFILLED",i.Integral="_INTEGRAL",i.ArchTick="_ARCHTICK",i))(Ea||{}),Li=(i=>(i[i.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",i[i.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",i[i.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",i[i.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",i[i.BY_STYLE=5]="BY_STYLE",i))(Li||{}),Rn=(i=>(i[i.TopLeft=1]="TopLeft",i[i.TopCenter=2]="TopCenter",i[i.TopRight=3]="TopRight",i[i.MiddleLeft=4]="MiddleLeft",i[i.MiddleCenter=5]="MiddleCenter",i[i.MiddleRight=6]="MiddleRight",i[i.BottomLeft=7]="BottomLeft",i[i.BottomCenter=8]="BottomCenter",i[i.BottomRight=9]="BottomRight",i))(Rn||{}),ka=(i=>(i[i.OPTIMIZED_2D=0]="OPTIMIZED_2D",i[i.WIREFRAME=1]="WIREFRAME",i[i.HIDDEN_LINE=2]="HIDDEN_LINE",i[i.FLAT_SHADED=3]="FLAT_SHADED",i[i.GOURAUD_SHADED=4]="GOURAUD_SHADED",i[i.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",i[i.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",i))(ka||{}),Ma=(i=>(i[i.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",i[i.TOP=1]="TOP",i[i.BOTTOM=2]="BOTTOM",i[i.FRONT=3]="FRONT",i[i.BACK=4]="BACK",i[i.LEFT=5]="LEFT",i[i.RIGHT=6]="RIGHT",i))(Ma||{}),Ta=(i=>(i[i.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",i[i.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",i))(Ta||{});class Oi{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new $,this._height=0,this._width=0,this._viewCenter=new $,this._viewHeight=0}get number(){return this._number}set number(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new _t;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new _t;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new Oi;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}}const Wa=class Wa extends Ht{constructor(){super(),this._contents="",this._height=0,this._width=0,this._lineSpacingFactor=.25,this._lineSpacingStyle=0,this._backgroundFill=!1,this._backgroundFillColor=13158600,this._backgroundFillTransparency=1,this._backgroundScaleFactor=1,this._rotation=0,this._styleName="",this._location=new $,this._attachmentPoint=Rn.TopLeft,this._direction=new Z(1,0,0),this._drawingDirection=Li.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new Re}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const s={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor},o={...this.getTextStyle(),color:this.rgbColor};return e.mtext(s,o,t)}};Wa.typeName="MText";let li=Wa;const Ha=class Ha extends Vt{constructor(e,t,s,o,h){super();const u=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(o!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Ut.ILLEGAL_PARAMETERS;!Array.isArray(t)?this._geo=new qr(e,t,s,o):this._geo=new qr(e,t,s,o,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}draw(e){const t=this._geo.getPoints(100);return e.lines(t,this.lineStyle)}};Ha.typeName="Spline";let Ns=Ha;const Yd=new Z,qa=class qa extends Cs{constructor(e,t,s){super(e),this._attachmentPoint=Rn.TopLeft,this._numColumns=s,this._numRows=t,this._columnWidth=new Array(s),this._rowHeight=new Array(t),this._cells=new Array(t*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,s){return this._cells[e*t].text}setTextString(e,t,s){this._cells[e*t].text=s}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new Re}draw(e){let t=0,s=0;const o=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let E=0;E<=this.numRows;E++){t-=E>0?this.rowHeight(E-1):0,s=0;for(let M=0;M<=this.numColumns;M++)s+=M>0?this.columnWidth(M-1):0,h[u++]=s,h[u++]=t,h[u++]=0}const g=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,u=0;let f=0;for(let E=0;E<this.numColumns;E++){s+=E>0?this.columnWidth(E-1):0,t=0;for(let M=0;M<this.numRows;M++){t+=M>0?this.rowHeight(M-1):0;const z=this.cell(M*this.numColumns+E);if(f=M*this.numColumns+E,z&&!b[f]){const D=z.borderWidth??1,U=z.borderHeight??1;this.fillVisited(b,f,this.numColumns,D,U),o[u++]=E+M*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1)+D;const B=h[o[u-1]*3]-s,ge=E+(M+U)*(this.numColumns+1)+D;E+D==this.numColumns&&(o[u++]=E+M*(this.numColumns+1)+D,o[u++]=ge);const be=-h[ge*3+1]-t;if(M+U==this.numRows&&(o[u++]=E+(M+U)*(this.numColumns+1)+U,o[u++]=E+(M+U)*(this.numColumns+1)),o[u++]=E+(M+U)*(this.numColumns+1),o[u++]=E+M*(this.numColumns+1),z.text){const oe=z.attachmentPoint||this.attachmentPoint||Rn.MiddleCenter,W=this.getTableTextOffset(oe,B,be),ce={text:z.text,height:z.textHeight,width:B,position:Yd.set(s,-t,0).clone().add(W),rotation:this.rotation,attachmentPoint:oe},se={...this.getTextStyle(z),color:this.color.color};g.push(e.mtext(ce,se))}}}}g.push(e.lineSegments(h,3,o,this.lineStyle));const S=e.group(g),x=new Wr;return x.setFromAxisAngle(Z.Z_AXIS,this.rotation),Uo.compose(this.position,x,this.scaleFactors),S.applyMatrix(Uo),this.attachEntityInfo(S),S}fillVisited(e,t,s,o,h){if(h==1&&o==1)e[t]=!0;else for(let u=0;u<o;++u)for(let g=0;g<h;++g)e[t+u+g*s]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let s;return e.textStyle&&(s=t.getAt(e.textStyle)),s||(s=t.getAt("STANDARD")||t.getAt("Standard")),s.textStyle}getTableTextOffset(e,t,s){const o=new Z;switch(e){case 1:break;case 2:o.setX(t/2);break;case 3:o.setX(t);break;case 4:o.setY(-s/2);break;case 5:o.set(t/2,-s/2,0);break;case 6:o.set(t,-s/2,0);break;case 7:o.setY(-s);break;case 8:o.set(t/2,-s,0);break;case 9:o.set(t,-s,0);break}return o}};qa.typeName="Table";let hi=qa;const Uo=new gn;var ec=(i=>(i[i.LEFT=0]="LEFT",i[i.CENTER=1]="CENTER",i[i.RIGHT=2]="RIGHT",i[i.ALIGNED=3]="ALIGNED",i[i.MIDDLE=4]="MIDDLE",i[i.FIT=5]="FIT",i))(ec||{}),tc=(i=>(i[i.BASELINE=0]="BASELINE",i[i.BOTTOM=1]="BOTTOM",i[i.MIDDLE=2]="MIDDLE",i[i.TOP=3]="TOP",i))(tc||{});const Ya=class Ya extends Ht{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new $,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new Re}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e,t){const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Li.BOTTOM_TO_TOP,attachmentPoint:Rn.BottomLeft},o={...this.getTextStyle(),color:this.rgbColor};return e.mtext(s,o,t)}};Ya.typeName="Text";let ci=Ya;const Xa=class Xa extends Vt{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new $,new $,new $,new $]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new Re().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<4;++t)e.push(this.getPointAt(t));return e}draw(e){const t=new Rs(this._vertices,!0),s=new Mi;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}};Xa.typeName="Trace";let ui=Xa;const Ka=class Ka extends Vt{constructor(){super(),this._elevation=0,this._geo=new Rs}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,s=0,o=-1,h=-1){const u=o<0?void 0:o,g=h<0?void 0:h,b={x:t.x,y:t.y,bulge:s,startWidth:u,endWidth:g};this._geo.addVertexAt(e,b)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new $(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new Re({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}draw(e){const t=[];return this._geo.getPoints(100).forEach(o=>t.push(new $().set(o.x,o.y,this.elevation))),e.lines(t,this.lineStyle)}};Ka.typeName="Polyline";let di=Ka;const $a=class $a extends Ht{constructor(){super(),this._geo=new $}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new Re().expandByPoint(this._geo)}transformBy(e){return this._geo.applyMatrix3d(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}};$a.typeName="Point";let mi=$a;var rc=(i=>(i[i.Invalid=0]="Invalid",i[i.Rect=1]="Rect",i[i.Poly=2]="Poly",i))(rc||{}),nc=(i=>(i[i.Show=1]="Show",i[i.ShowUnAligned=2]="ShowUnAligned",i[i.Clip=4]="Clip",i[i.Transparent=8]="Transparent",i))(nc||{});const Za=class Za extends Ht{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new $,this._scale=new $e(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isShownClipped(){return this._isShownClipped}set isShownClipped(e){this._isShownClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new Re;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}draw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t,this.lineStyle)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,s=this._height,o=new _t;o.setFromPoints(this._clipBoundary);const h=new Me;h.setX(this._position.x-o.min.x*t),h.setY(this._position.y-o.min.y*s),this._clipBoundary.forEach(u=>{const g=u.x*t+h.x,b=u.y*s+h.y;e.push(new $(g,b,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Vo.copy(e[1]);for(let t=1;t<4;t++)Hs.copy(e[t]),Hs.rotateAround(Vo,this._rotation),e[t].setX(Hs.x),e[t].setY(Hs.y)}e.push(e[0])}return e}};Za.typeName="RasterImage";let Ls=Za;const Vo=new Me,Hs=new Me,Qa=class Qa extends Vt{constructor(){super(),this._basePoint=new $,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Re;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}};Qa.typeName="Ray";let pi=Qa;const Ja=class Ja extends Ht{constructor(){super(),this._centerPoint=new $,this._height=0,this._width=0,this._viewCenter=new $,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new Re}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport(),s=e.group(this.createViewportRect(t,e));return this.attachEntityInfo(s),s}}toGiViewport(){const e=new Oi;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const s=[];return s.push(t.lines([new $(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new $(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new $(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new $(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new $(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new $(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}};Ja.typeName="Viewport";let gi=Ja;const eo=class eo extends Ls{draw(e){const t=this.boundaryPath(),s=new Mi;return s.add(new Rs(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}};eo.typeName="Wipeout";let fi=eo;const to=class to extends Vt{constructor(){super(),this._basePoint=new $,this._unitDir=new Z}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new Re;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}};to.typeName="Xline";let _i=to;var sc=(i=>(i[i.AtLeast=1]="AtLeast",i[i.Exactly=2]="Exactly",i))(sc||{});const ro=class ro extends Ht{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new $,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new Os),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}draw(e){if(this.dimBlockId){const s=this.database.tables.blockTable.getAt(this.dimBlockId);if(s){const o=Gr.instance.draw(e,s,this.rgbColor,!1);return this.attachEntityInfo(o),o}}const t=e.group([]);return this.attachEntityInfo(t),t}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Gr.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Gr.instance.draw(e,t,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}getLineArrowStyle(e){}findPointOnLine1(e,t,s){const o=new $().subVectors(t,e).normalize();return new $(t).addScaledVector(o,s)}findPointOnLine2(e,t,s){const o=e.x+s*Math.cos(t),h=e.y+s*Math.sin(t);return{x:o,y:h}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():Ea.Closed}};ro.typeName="Dimension";let Mr=ro;const no=class no extends Mr{constructor(e,t,s,o,h=null,u=null){super(),this._centerPoint=new $().copy(e),this._xLine1Point=new $().copy(t),this._xLine2Point=new $().copy(s),this._arcPoint=new $().copy(o),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Re}};no.typeName="3PointAngularDimension";let vi=no;const so=class so extends Mr{constructor(e,t,s,o=null,h=null){super(),this._dimLinePoint=new $().copy(s),this._xLine1Point=new $().copy(e),this._xLine2Point=new $().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=o,this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get geometricExtents(){return new Re}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),o=this.findIntersectionPoint(t,this._dimLinePoint),h=this.findIntersectionPoint(s,this._dimLinePoint),u=new Hr(o,h);return e.push(u),t.endPoint=o,this.adjustExtensionLine(t),e.push(t),s.endPoint=h,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new Hr(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,o=e.endPoint,h=new Z().subVectors(o,s).normalize(),g=new Z().subVectors(t,s).dot(h),b=new Z().copy(h).multiplyScalar(g);return new Z().addVectors(s,b)}};so.typeName="AlignedDimension";let yi=so;const io=class io extends Mr{constructor(e,t,s,o,h=null,u=null){super(),this._arcPoint=new $().copy(o),this._xLine1Point=new $().copy(t),this._xLine2Point=new $().copy(s),this._centerPoint=new $().copy(e),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new Re}};io.typeName="ArcDimension";let ha=io;const ao=class ao extends Mr{constructor(e,t,s=0,o=null,h=null){super(),this._chordPoint=new $().copy(e),this._farChordPoint=new $().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=o,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Re}drawLines(e,t){const s=[],o=t.length;return o==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):o==3?(this.sortLines(t),s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(e,t[1])),s.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(h=>{s.push(this.drawLine(e,h))}),s}drawLine(e,t,s){if(s){const o=[t.startPoint,t.endPoint];return e.lines(o,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,o)=>s.x!==o.x?s.x-o.x:s.y!==o.y?s.y-o.y:s.z-o.z;e.sort((s,o)=>{const h=t(s.startPoint,o.startPoint);return h!==0?h:t(s.endPoint,o.endPoint)})}};ao.typeName="DiametricDimension";let bi=ao;const oo=class oo extends Mr{constructor(e,t,s=null,o=null){super(),this._definingPoint=new $().copy(e),this._leaderEndPoint=new $().copy(t),this.dimensionText=s,this.dimensionStyleName=o}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get geometricExtents(){return new Re}get arrowLineCount(){return 0}};oo.typeName="OrdinateDimension";let xi=oo;const lo=class lo extends Mr{constructor(e,t,s,o=null,h=null){super(),this._center=new $().copy(e),this._chordPoint=new $().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=o,this.dimensionStyleName=h}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLenght(e){this._leaderLength=e}get geometricExtents(){return new Re}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}};lo.typeName="RadialDimension";let wi=lo;class jo{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="ARC"?this.convertArc(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"||e.type=="LWPOLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertArc(e){return new ni(e.center,e.radius,Ee.degToRad(e.startAngle),Ee.degToRad(e.endAngle))}convertCirle(e){return new si(e.center,e.radius)}convertEllipse(e){const t=new Z(e.majorAxisEndPoint),s=t.length();return new ri(e.center,Z.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new oi(new $(t.x,t.y,t.z||0),new $(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0)return new Ns(e.controlPoints,e.knots,e.weights,e.degree,!!(e.flag&1));if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null)return new Ns(t,"Uniform",e.degree,!!(e.flag&1))}return null}convertPoint(e){const t=new mi;return t.position=e.position,t}convertSolid(e){const t=new ui;return e.points.forEach((s,o)=>t.setPointAt(o,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new di;return t.closed=!!(e.flag&1),e.vertices.forEach((s,o)=>{t.addVertexAt(o,new Me(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var o;const t=new ii;return(o=e.definitionLines)==null||o.forEach(h=>{t.definitionLines.push({angle:h.angle,origin:h.base,delta:h.offset,dashPattern:h.numberOfDashLengths>0?h.dashLengths:[]})}),t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:e.patternAngle,t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const g=h,b=new Rs;b.closed=g.isClosed,g.vertices.forEach((f,S)=>{b.addVertexAt(S,{x:f.x,y:f.y,bulge:f.bulge})}),t.add(b)}else{const g=h,b=new Yh;g.edges.forEach(f=>{if(f.type==1){const S=f;b.add(new Ni(S.start,S.end))}else if(f.type==2){const S=f;b.add(new Dn(S.center,S.radius,Ee.degToRad(S.startAngle||0),Ee.degToRad(S.endAngle||0),!S.isCCW))}else if(f.type==3){const S=f;new $e().subVectors(S.end,S.center);const E=Math.sqrt(Math.pow(S.end.x,2)+Math.pow(S.end.y,2)),M=E*S.lengthOfMinorAxis;let z=Ee.degToRad(S.startAngle||0),D=Ee.degToRad(S.endAngle||0);const U=Math.atan2(S.end.y,S.end.x);S.isCCW||(z=Math.PI*2-z,D=Math.PI*2-D),b.add(new Ti({...S.center,z:0},E,M,z,D,!S.isCCW,U))}else if(f.type==4){const S=f;if(S.numberOfControlPoints>0&&S.numberOfKnots>0){const x=S.controlPoints.map(z=>({x:z.x,y:z.y,z:0}));let E=!0;const M=S.controlPoints.map(z=>(z.weight==null&&(E=!1),z.weight||1));b.add(new qr(x,S.knots,E?M:void 0))}else if(S.numberOfFitData>0){const x=S.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));b.add(new qr(x,"Uniform"))}}}),t.add(b)}}),t}convertTable(e){const t=new hi(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,o)=>t.setColumnWidth(o,s)),e.rowHeightArr.forEach((s,o)=>t.setRowHeight(o,s)),e.cells.forEach((s,o)=>{t.setCell(o,s)}),t}convertText(e){const t=new ci;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=Ee.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new li;return t.contents=e.text,e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=Ee.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new Z(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new ai;return e.vertices.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName,t.annoType=e.leaderCreationFlag,t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"||e.subclassMarker=="AcDbRotatedDimension"){const t=e,s=new yi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=Ee.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new vi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new xi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new wi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new bi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,t.imageDefId=e.imageDefHandle,t.isClipped=e.isClipped,e.clippingBoundaryPath.forEach(s=>{t.clipBoundary.push(new Me(s))}),t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new Ls;return this.processImage(e,t),t.clipBoundaryType=e.clippingBoundaryType,t}processWipeout(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.isShownClipped=(e.displayFlag|4)>0,t.isImageShown=(e.displayFlag|3)>0,t.isImageTransparent=(e.displayFlag|8)>0,t.imageDefId=e.imageDefHardId,t.isClipped=e.isClipping,e.boundary.forEach(s=>{t.clipBoundary.push(new Me(s))}),t.clipBoundaryType=e.boundaryType,t.width=Math.sqrt(e.uDirection.x**2+e.uDirection.y**2+e.uDirection.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vDirection.x**2+e.vDirection.y**2+e.vDirection.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uDirection.y,e.uDirection.x)}convertWipeout(e){const t=new fi;return this.processWipeout(e,t),t}convertViewport(e){const t=new gi;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new pi;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertXline(e){const t=new _i;return t.basePoint.copy(e.position),t.unitDir.copy(e.direction),t}convertBlockReference(e){const t=new Cs(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?Ee.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection??{x:0,y:0,z:1}),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement}processCommonAttrs(e,t){t.layer=e.layer,t.objectId=e.handle,t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&(t.color.color=e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName!=null&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=e.transparency)}numberArrayToPointArray(e,t){const s=e.length;let o=0;if(s/2==t?o=2:s/3==t&&(o=3),o==0)return;const h=[];for(let u=0,g=s/o;u<g;++u)h.push({x:e[u*o],y:e[u*o+1],z:o==3?e[u*o+2]:0});return h}}class Ca extends Yr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new _t,this._extents=new Re}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}}class Na extends Yr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t),this.database.events.dictObjetSet.dispatch({database:this.database,object:t,key:e})}remove(e){const t=this.getAt(e);return t?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e}),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,o)=>{s===t&&(this._recordsByName.delete(o),this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:o}))}),!0):!1}removeAll(){this._recordsByName.forEach((e,t)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t})}),this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new Ei(this._recordsByName)}}class ic extends Na{getBtrIdAt(e){for(const[t,s]of this._recordsByName)if(s.blockTableRecordId==e)return s}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class ac extends Yr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class Xd{convertLayout(e,t){var o;const s=new Ca;return s.layoutName=e.layoutName,s.tabOrder=e.tabOrder,(o=t.tables.BLOCK_RECORD)==null||o.entries.some(h=>h.layoutObjects===e.handle?(s.blockTableRecordId=h.handle,!0):!1),s.limits.min.copy(e.minLimit),s.limits.max.copy(e.maxLimit),s.extents.min.copy(e.minExtent),s.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,s),s}convertImageDef(e){const t=new ac;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class oc{constructor(e){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:e.workerUrl,timeout:e.timeout??3e4,maxConcurrentWorkers:e.maxConcurrentWorkers??4}}async execute(e,t){const s=Date.now(),o=this.generateTaskId();try{return await this.executeInWorker(o,e,t||this.config.workerUrl)}catch(h){const u=Date.now()-s;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(e,t,s){const o=Date.now();return new Promise((h,u)=>{const g=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(e),this.releaseWorker(g),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(e,{resolve:x=>{clearTimeout(b),this.releaseWorker(g),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(g),u(x)},timeout:b});const f=x=>{const{id:E,success:M,data:z,error:D}=x.data;if(E!==e)return;this.cleanupTask(e);const U=Date.now()-o;h(M?{success:!0,data:z,duration:U}:{success:!1,error:D,duration:U})},S=x=>{this.cleanupTask(e),u(new Error(`Worker error: ${x.message}`))};g.addEventListener("message",f),g.addEventListener("error",S),g.postMessage({id:e,input:t})})}cleanupTask(e){const t=this.pendingTasks.get(e);t&&(clearTimeout(t.timeout),this.pendingTasks.delete(e))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(e){for(const[s,o]of this.workers)if(!o.isBusy)return o.isBusy=!0,o.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(e,{type:"module"}),o=this.generateWorkerId(),h={worker:s,isBusy:!0,id:o,createdAt:new Date};return this.workers.set(o,h),s}const t=Array.from(this.workers.values()).sort((s,o)=>s.createdAt.getTime()-o.createdAt.getTime())[0];return t.isBusy=!0,t.worker}releaseWorker(e){for(const[t,s]of this.workers)if(s.worker===e){s.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(e=>e.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[e,t]of this.pendingTasks)clearTimeout(t.timeout),t.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[e,t]of this.workers)t.worker.terminate();this.workers.clear()}}class lc{constructor(e){this.framework=new oc(e)}async execute(e,t){return this.framework.execute(e,t)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function hc(i){return new lc(i)}class Kd{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async e=>{const{id:t,input:s}=e.data;try{const o=await this.executeTask(s);this.sendResponse(t,!0,o)}catch(o){this.sendResponse(t,!1,void 0,o instanceof Error?o.message:String(o))}}}sendResponse(e,t,s,o){const h={id:e,success:t,data:s,error:o};self.postMessage(h)}}class cc extends ph{constructor(e={}){super(e),e.parserWorkerUrl||(e.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(e){if(this.config.useWorker&&this.config.parserWorkerUrl){const t=hc({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),s=await t.execute(e);return t.destroy(),{model:s.data,data:{unknownEntityCount:0}}}else return{model:new Od().parseSync(e),data:{unknownEntityCount:0}}}getFonts(e){var h;const t=new Map,s=u=>{if(u){const g=u.lastIndexOf(".");return g>=0?u.substring(0,g).toLowerCase():u.toLowerCase()}};(h=e.tables.STYLE)==null||h.entries.forEach(u=>{const g=[];let b=s(u.font);b&&g.push(b),b=s(u.bigFont),b&&g.push(b),t.set(u.name,g)});const o=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,o),Array.from(o)}getFontsInBlock(e,t,s,o){const h=/\\f(.*?)\|/g;e.forEach(u=>{if(u.type=="MTEXT"){const g=u;[...g.text.matchAll(h)].forEach(S=>{o.add(S[1].toLowerCase())});const f=s.get(g.styleName);f==null||f.forEach(S=>o.add(S))}else if(u.type=="TEXT"){const g=u,b=s.get(g.styleName);b==null||b.forEach(f=>o.add(f))}else if(u.type=="INSERT"){const b=t[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,t,s,o)}})}async processEntities(e,t,s,o,h){const u=new jo;let g=e.entities;const b=g.length,f=new tl(b,100-o.value,s);this.config.convertByEntityType&&(g=this.groupAndFlattenByType(g));const S=t.tables.blockTable.modelSpace;await f.processChunk(async(x,E)=>{let M=[],z=x<E?g[x].type:"";for(let D=x;D<E;D++){const U=g[D],B=u.convert(U);B&&(this.config.convertByEntityType&&U.type!==z&&(S.appendEntity(M),M=[],z=U.type),M.push(B))}if(S.appendEntity(M),h){let D=o.value+E/b*(100-o.value);D>100&&(D=100),await h(D,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t){const s=new jo,o=e.length,h=[];for(let u=0;u<o;u++){const g=e[u],b=s.convert(g);b&&h.push(b)}t.appendEntity(h)}processBlocks(e,t){const s=e.blocks;for(const[o,h]of Object.entries(s)){let u=t.tables.blockTable.getAt(h.name);u||(u=new Ft,u.objectId=h.handle,u.name=o,u.origin.copy(h.position),t.tables.blockTable.add(u)),h.entities&&this.processEntitiesInBlock(h.entities,u)}}processHeader(e,t){const s=e.header;t.cecolor.colorIndex=s.$CECOLOR||256,t.angBase=s.$ANGBASE||0,t.angDir=s.$ANGDIR||0,t.aunits=s.$AUNITS,t.extmax=s.$EXTMAX,t.extmin=s.$EXTMIN,t.insunits=s.$INSUNITS,t.pdmode=s.$PDMODE||0,t.pdsize=s.$PDSIZE||0}processBlockTables(e,t){var o;const s=(o=e.tables.BLOCK_RECORD)==null?void 0:o.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(h=>{const u=new Ft;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,t.tables.blockTable.add(u)}))}processObjects(e,t){const s=e.objects.byName,o=new Xd;if("LAYOUT"in s){const h=t.dictionaries.layouts;s.LAYOUT.forEach(u=>{const g=o.convertLayout(u,e);h.setAt(g.layoutName,g)})}if("IMAGEDEF"in s){const h=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(u=>{const g=o.convertImageDef(u);h.setAt(g.objectId,g)})}}processViewports(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new Sc;this.processCommonTableEntryAttrs(u,g),u.circleSides&&(g.circleSides=u.circleSides),g.standardFlag=u.standardFlag,g.center.copy(u.center),g.lowerLeftCorner.copy(u.lowerLeftCorner),g.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&g.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(g.snapAngle=u.snapRotationAngle),u.snapSpacing&&g.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(g.gridMajor=u.majorGridLines),u.gridSpacing&&g.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(g.backgroundObjectId=u.backgroundObjectId),g.gsView.center.copy(u.center),g.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),g.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(g.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(g.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(g.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(g.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(g.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(g.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(g.gsView.styleSheet=u.styleSheet),u.renderMode&&(g.gsView.renderMode=u.renderMode),u.viewMode&&(g.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(g.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&g.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&g.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&g.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(g.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(g.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(g.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(g.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(g.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(g.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(g.gsView.brightness=u.brightness),u.contrast&&(g.gsView.contrast=u.contrast),u.ambientColor&&(g.gsView.ambientColor=u.ambientColor),t.tables.viewportTable.add(g)})}processLayers(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new fn;g.colorIndex=u.colorIndex;const b=new La({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:g,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),t.tables.layerTable.add(b)})}processLineTypes(e,t){var o,h;const s=(h=(o=e.tables)==null?void 0:o.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const g=new wc(u);this.processCommonTableEntryAttrs(u,g),g.name=u.name,t.tables.linetypeTable.add(g)})}processTextStyles(e,t){var o;const s=(o=e.tables.STYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u=new Ac(h);this.processCommonTableEntryAttrs(h,u),t.tables.textStyleTable.add(u)})}processDimStyles(e,t){var o;const s=(o=e.tables.DIMSTYLE)==null?void 0:o.entries;s&&s.length>0&&s.forEach(h=>{const u={name:h.name,ownerId:h.ownerObjectId,dimpost:h.DIMPOST||"",dimapost:h.DIMAPOST||"",dimscale:h.DIMSCALE,dimasz:h.DIMASZ,dimexo:h.DIMEXO,dimdli:h.DIMDLI,dimexe:h.DIMEXE,dimrnd:h.DIMRND,dimdle:h.DIMDLE,dimtp:h.DIMTP,dimtm:h.DIMTM,dimtxt:h.DIMTXT,dimcen:h.DIMCEN,dimtsz:h.DIMTSZ,dimaltf:h.DIMALTF,dimlfac:h.DIMLFAC,dimtvp:h.DIMTVP,dimtfac:h.DIMTFAC,dimgap:h.DIMGAP,dimaltrnd:h.DIMALTRND,dimtol:h.DIMTOL==null||h.DIMTOL==0?0:1,dimlim:h.DIMLIM==null||h.DIMLIM==0?0:1,dimtih:h.DIMTIH==null||h.DIMTIH==0?0:1,dimtoh:h.DIMTOH==null||h.DIMTOH==0?0:1,dimse1:h.DIMSE1==null||h.DIMSE1==0?0:1,dimse2:h.DIMSE2==null||h.DIMSE2==0?0:1,dimtad:h.DIMTAD,dimzin:h.DIMZIN,dimazin:h.DIMAZIN,dimalt:h.DIMALT,dimaltd:h.DIMALTD,dimtofl:h.DIMTOFL,dimsah:h.DIMSAH,dimtix:h.DIMTIX,dimsoxd:h.DIMSOXD,dimclrd:h.DIMCLRD,dimclre:h.DIMCLRE,dimclrt:h.DIMCLRT,dimadec:h.DIMADEC||0,dimunit:h.DIMUNIT||2,dimdec:h.DIMDEC,dimtdec:h.DIMTDEC,dimaltu:h.DIMALTU,dimalttd:h.DIMALTTD,dimaunit:h.DIMAUNIT,dimfrac:h.DIMFRAC,dimlunit:h.DIMLUNIT,dimdsep:h.DIMDSEP,dimtmove:h.DIMTMOVE||0,dimjust:h.DIMJUST,dimsd1:h.DIMSD1,dimsd2:h.DIMSD2,dimtolj:h.DIMTOLJ,dimtzin:h.DIMTZIN,dimaltz:h.DIMALTZ,dimalttz:h.DIMALTTZ,dimfit:h.DIMFIT||0,dimupt:h.DIMUPT,dimatfit:h.DIMATFIT,dimtxsty:h.DIMTXSTY||"Standard",dimldrblk:h.DIMLDRBLK||"",dimblk:h.DIMBLK||"",dimblk1:h.DIMBLK1||"",dimblk2:h.DIMBLK2||"",dimlwd:h.DIMLWD,dimlwe:h.DIMLWE},g=new Os(u);this.processCommonTableEntryAttrs(h,g),t.tables.dimStyleTable.add(g)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}groupAndFlattenByType(e){const t={},s=[];for(const o of e)t[o.type]||(t[o.type]=[],s.push(o.type)),t[o.type].push(o);return s.flatMap(o=>t[o])}}var Ts=(i=>(i.DXF="dxf",i.DWG="dwg",i))(Ts||{});class lr{constructor(){this.events={registered:new it,unregistered:new it},this._converters=new Map,this.register("dxf",new cc)}static createInstance(){return lr._instance==null&&(lr._instance=new lr),this._instance}static get instance(){return lr._instance||(lr._instance=new lr),lr._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}class _n extends Yr{constructor(e,t){e=e||{},Bn(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const jr=class jr extends _n{static isModelSapceName(e){return e.toLowerCase()==jr.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(e){return e.toLowerCase().startsWith(jr.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new $,this._layoutId="",this._entities=new Map}get isModelSapce(){return jr.isModelSapceName(this.name)}get isPaperSapce(){return jr.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(e){this._origin.copy(e)}get layoutId(){return this._layoutId}set layoutId(e){this._layoutId=e}appendEntity(e){if(Array.isArray(e))for(let t=0;t<e.length;++t){const s=e[t];s.database=this.database,s.ownerId=this.objectId,this._entities.set(s.objectId,s)}else e.database=this.database,e.ownerId=this.objectId,this._entities.set(e.objectId,e);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}newIterator(){return new Ei(this._entities)}getIdAt(e){return this._entities.get(e)}};jr.MODEL_SPACE_NAME="*MODEL_SPACE",jr.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let Ft=jr;class vn extends Yr{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}add(e){e.database=this.database;const t=this.normalizeName(e.name);this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this.normalizeName(e),s=this._recordsByName.get(t);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(e),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(t.name),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){const t=this.normalizeName(e);return this._recordsByName.has(t)}hasId(e){return this._recordsById.has(e)}getAt(e){const t=this.normalizeName(e);return this._recordsByName.get(t)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){return this._recordsById.get(e)}newIterator(){return new Ei(this._recordsByName)}normalizeName(e){return e}}class uc extends vn{constructor(e){super(e)}get modelSpace(){let e=this.getAt(Ft.MODEL_SPACE_NAME);return e||(e=new Ft,e.name=Ft.MODEL_SPACE_NAME,this.add(e)),e}normalizeName(e){let t=e;if(Ft.isModelSapceName(e))t=Ft.MODEL_SPACE_NAME;else if(Ft.isPaperSapceName(e)){const s=Ft.PAPER_SPACE_NAME_PREFIX,o=e.substring(s.length);t=s+o}return t}}class dc extends vn{constructor(e){super(e)}}class La extends _n{constructor(e,t){e=e||{},Bn(e,{color:new fn,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e)}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}}class mc extends vn{constructor(e){super(e);const t=new fn;t.color=16777215;const s=new La({name:"0",standardFlags:0,linetype:ei,lineWeight:1,isOff:!1,color:t,isPlottable:!0});this.add(s)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class pc extends vn{constructor(e){super(e)}}class gc extends vn{constructor(e){super(e)}get fonts(){const e=new Set,t=o=>{if(o){const h=o.lastIndexOf(".");if(h>=0){const u=o.substring(0,h).toLowerCase();e.add(u)}else e.add(o.toLowerCase())}},s=this.newIterator();for(const o of s)t(o.fileName),t(o.bigFontFileName);return Array.from(e)}}class fc extends vn{constructor(e){super(e)}}class $d extends Yr{constructor(){super(),this.events={dictObjetSet:new it,dictObjectErased:new it,entityAppended:new it,entityModified:new it,layerAppended:new it,layerModified:new it,layerErased:new it,openProgress:new it,headerSysVarChanged:new it},this._angBase=0,this._angDir=0,this._aunits=ga.DecimalDegrees,this._celtscale=1,this._cecolor=new fn,this._extents=new Re,this._insunits=fa.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new uc(this),dimStyleTable:new dc(this),linetypeTable:new pc(this),textStyleTable:new gc(this),layerTable:new mc(this),viewportTable:new fc(this)},this._dictionaries={layouts:new ic(this),imageDefs:new Na(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this._aunits=e||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(e){this._insunits=e||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(e){this._ltscale=e||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(e){this._cecolor=e||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(e){this._celtscale=e||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(e){this._angBase=e||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(e){this._angDir=e||0,this.triggerHeaderSysVarChangedEvent("angdir")}get extmax(){return this._extents.max}set extmax(e){this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmax")}get extmin(){return this._extents.min}set extmin(e){this._extents.expandByPoint(e),this.triggerHeaderSysVarChangedEvent("extmin")}get pdmode(){return this._pdmode}set pdmode(e){this._pdmode=e||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(e){this._pdsize=e||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(e,t,s=Ts.DXF){const o=lr.instance.get(s);if(o==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await o.read(e,this,t&&t.minimumChunkSize||10,async(h,u,g,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,subStageStatus:g,data:b}),t&&t.fontLoader&&u=="FONT"&&g=="END"){const f=b||this.tables.textStyleTable.fonts;await t.fontLoader.load(f)}})}async openUri(e,t){var E;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const s=await fetch(e);if(!s.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${e}' with HTTP status code '${s.status}'!`);const o=s.headers.get("content-length"),h=o?parseInt(o,10):null;let u=0;const g=(E=s.body)==null?void 0:E.getReader();if(!g)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:M,value:z}=await g.read();if(M)break;if(b.push(z),u+=z.length,h!==null){const D=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:D,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let S=0;for(const M of b)f.set(M,S),S+=M.length;if(e.toLowerCase().split(".").pop()==="dwg")await this.read(f.buffer,t,Ts.DWG);else{const M=new TextDecoder().decode(f);await this.read(M,t,Ts.DXF)}this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._dictionaries.layouts.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}}var _c=(i=>(i[i.Center=0]="Center",i[i.Left=1]="Left",i[i.Right=2]="Right",i[i.OverFirst=3]="OverFirst",i[i.OverSecond=4]="OverSecond",i))(_c||{}),vc=(i=>(i[i.Center=0]="Center",i[i.Above=1]="Above",i[i.Outside=2]="Outside",i[i.JIS=3]="JIS",i[i.Below=4]="Below",i))(vc||{}),yc=(i=>(i[i.Feet=0]="Feet",i[i.None=1]="None",i[i.Inch=2]="Inch",i[i.FeetAndInch=3]="FeetAndInch",i[i.Leading=4]="Leading",i[i.Trailing=8]="Trailing",i[i.LeadingAndTrailing=12]="LeadingAndTrailing",i))(yc||{}),bc=(i=>(i[i.None=0]="None",i[i.Leading=1]="Leading",i[i.Trailing=2]="Trailing",i[i.LeadingAndTrailing=3]="LeadingAndTrailing",i))(bc||{}),xc=(i=>(i[i.Bottom=0]="Bottom",i[i.Middle=1]="Middle",i[i.Top=2]="Top",i))(xc||{});const Si=class Si extends _n{constructor(e,t){e=e||{},Bn(e,Si.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}};Si.DEFAULT_DIM_VALUES={name:"",dimpost:"",dimapost:"",dimscale:1,dimasz:2.5,dimexo:.625,dimdli:.38,dimexe:.18,dimrnd:0,dimdle:0,dimtp:0,dimtm:0,dimtxt:2.5,dimcen:2.5,dimtsz:0,dimaltf:0,dimlfac:1,dimtvp:0,dimtfac:1,dimgap:1,dimaltrnd:0,dimtol:0,dimlim:0,dimtih:0,dimtoh:0,dimse1:0,dimse2:0,dimtad:0,dimzin:0,dimazin:0,dimalt:0,dimaltd:2,dimtofl:0,dimsah:0,dimtix:0,dimsoxd:0,dimclrd:0,dimclre:0,dimclrt:0,dimadec:0,dimunit:2,dimdec:4,dimtdec:4,dimaltu:2,dimalttd:2,dimaunit:0,dimfrac:0,dimlunit:2,dimdsep:".",dimtmove:0,dimjust:0,dimsd1:0,dimsd2:0,dimtolj:0,dimtzin:0,dimaltz:0,dimalttz:0,dimfit:0,dimupt:0,dimatfit:3,dimtxsty:"Standard",dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let Os=Si;class wc extends _n{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}}class Ac extends _n{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const s=t.lastIndexOf(".");return s===-1?t:t.substring(0,s)}return e}}const Zd={center:new Me,viewDirectionFromTarget:new $(0,0,1),viewTarget:new $(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:ka.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new $(0,0,0),ucsXAxis:new $(1,0,0),ucsYAxis:new $(0,1,0),orthographicType:Ma.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Ta.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class Sc extends _n{constructor(){super(),this._circleSides=100,this._center=new Me,this._lowerLeftCorner=new Me(0,0),this._upperRightCorner=new Me(1,1),this._snapBase=new Me(0,0),this._snapAngle=0,this._snapSpacing=new Me(0,0),this._standardFlag=0,this._gridSpacing=new Me,this._gridMajor=10,this._gsView=Zd}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get gsView(){return this._gsView}}class Pc{constructor(){this.events={layoutCreated:new it,layoutRemoved:new it,layoutRenamed:new it,layoutSwitched:new it}}countLayouts(e){return this.getWorkingDatabase(e).dictionaries.layouts.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(o,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(o,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),o=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(o,s)}renameLayout(e,t,s){const h=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return h?(h.layoutName=t,this.events.layoutRenamed.dispatch({layout:h,oldName:e,newName:t}),!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){const s=this.getWorkingDatabase(t).dictionaries.layouts,o=s.getAt(e);let h=!1;return o&&(h=s.remove(e),h&&this.events.layoutRemoved.dispatch({layout:o})),h}createLayout(e,t){const s=this.getWorkingDatabase(t),o=new Ca;o.layoutName=e,o.tabOrder=s.dictionaries.layouts.maxTabOrder;const h=new Ft;return h.name=`*Paper_Space${o.tabOrder}`,s.tables.blockTable.add(h),s.dictionaries.layouts.setAt(e,o),this.events.layoutCreated.dispatch({layout:o}),{layout:o,btr:h}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||Oa().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({layout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function Oa(){return Ai.instance}const Pi=class Pi{constructor(){this._workingDatabase=null,this._layoutManager=new Pc}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager}};Pi.instance=new Pi;let Ai=Pi;exports.AcCmColor=fn;exports.AcCmErrors=Ut;exports.AcCmEventDispatcher=Gc;exports.AcCmEventManager=it;exports.AcCmLoader=Zc;exports.AcCmLoadingManager=Jo;exports.AcCmObject=Ko;exports.AcCmPerformanceCollector=ca;exports.AcCmTask=Zo;exports.AcCmTaskScheduler=Qo;exports.AcDb3PointAngularDimension=vi;exports.AcDbAlignedDimension=yi;exports.AcDbAngleUnits=ga;exports.AcDbArc=ni;exports.AcDbArcDimension=ha;exports.AcDbBaseWorker=Kd;exports.AcDbBatchProcessing=tl;exports.AcDbBlockReference=Cs;exports.AcDbBlockTable=uc;exports.AcDbBlockTableRecord=Ft;exports.AcDbCircle=si;exports.AcDbCurve=Vt;exports.AcDbDatabase=$d;exports.AcDbDatabaseConverter=ph;exports.AcDbDatabaseConverterManager=lr;exports.AcDbDiametricDimension=bi;exports.AcDbDictionary=Na;exports.AcDbDimArrowType=dh;exports.AcDbDimStyleTable=dc;exports.AcDbDimStyleTableRecord=Os;exports.AcDbDimTextHorizontal=_c;exports.AcDbDimTextVertical=vc;exports.AcDbDimVerticalJustification=xc;exports.AcDbDimZeroSuppression=yc;exports.AcDbDimZeroSuppressionAngular=bc;exports.AcDbDimension=Mr;exports.AcDbDxfConverter=cc;exports.AcDbEllipse=ri;exports.AcDbEntity=Ht;exports.AcDbFileType=Ts;exports.AcDbHatch=ii;exports.AcDbHatchPatternType=Zh;exports.AcDbHatchStyle=Qh;exports.AcDbHostApplicationServices=Ai;exports.AcDbLayerTable=mc;exports.AcDbLayerTableRecord=La;exports.AcDbLayout=Ca;exports.AcDbLayoutDictionary=ic;exports.AcDbLayoutManager=Pc;exports.AcDbLeader=ai;exports.AcDbLeaderAnnotationType=Jh;exports.AcDbLine=oi;exports.AcDbLineSpacingStyle=sc;exports.AcDbLinetypeTable=pc;exports.AcDbLinetypeTableRecord=wc;exports.AcDbMText=li;exports.AcDbObject=Yr;exports.AcDbObjectIterator=Ei;exports.AcDbOrdinateDimension=xi;exports.AcDbOsnapMode=cn;exports.AcDbPoint=mi;exports.AcDbPolyline=di;exports.AcDbRadialDimension=wi;exports.AcDbRasterImage=Ls;exports.AcDbRasterImageClipBoundaryType=rc;exports.AcDbRasterImageDef=ac;exports.AcDbRasterImageImageDisplayOpt=nc;exports.AcDbRay=pi;exports.AcDbRenderingCache=Gr;exports.AcDbSpline=Ns;exports.AcDbSymbolTable=vn;exports.AcDbSymbolTableRecord=_n;exports.AcDbTable=hi;exports.AcDbText=ci;exports.AcDbTextHorizontalMode=ec;exports.AcDbTextStyleTable=gc;exports.AcDbTextStyleTableRecord=Ac;exports.AcDbTextVerticalMode=tc;exports.AcDbTrace=ui;exports.AcDbUnitsValue=fa;exports.AcDbViewport=gi;exports.AcDbViewportTable=fc;exports.AcDbViewportTableRecord=Sc;exports.AcDbWipeout=fi;exports.AcDbWorkerApi=lc;exports.AcDbWorkerManager=oc;exports.AcDbXline=_i;exports.AcGeArea2d=Mi;exports.AcGeBox2d=_t;exports.AcGeBox3d=Re;exports.AcGeCatmullRomCurve3d=Kh;exports.AcGeCircArc2d=Dn;exports.AcGeCircArc3d=mn;exports.AcGeCurve2d=Un;exports.AcGeEllipseArc2d=Ti;exports.AcGeEllipseArc3d=Ci;exports.AcGeEuler=Hh;exports.AcGeGeometryUtil=Rh;exports.AcGeLine2d=Ni;exports.AcGeLine3d=Hr;exports.AcGeLoop2d=Yh;exports.AcGeMathUtil=Ee;exports.AcGeMatrix2d=ki;exports.AcGeMatrix3d=gn;exports.AcGeNurbsCurve=pn;exports.AcGePlane=zs;exports.AcGePoint2d=Me;exports.AcGePoint3d=$;exports.AcGePolyline2d=Rs;exports.AcGeQuaternion=Wr;exports.AcGeShape2d=Ia;exports.AcGeSpline3d=qr;exports.AcGeTol=Aa;exports.AcGeVector2d=$e;exports.AcGeVector3d=Z;exports.AcGiArrowType=Ea;exports.AcGiDefaultLightingType=Ta;exports.AcGiMTextAttachmentPoint=Rn;exports.AcGiMTextFlowDirection=Li;exports.AcGiOrthographicType=Ma;exports.AcGiRenderMode=ka;exports.AcGiViewport=Oi;exports.AcTrStringUtil=$c;exports.ByBlock=uh;exports.ByLayer=Qs;exports.DEBUG_MODE=Xc;exports.DEFAULT_LINE_TYPE=ei;exports.DEFAULT_TOL=Sa;exports.DEG2RAD=_a;exports.DefaultLoadingManager=el;exports.FLOAT_TOL=hn;exports.ORIGIN_POINT_2D=Rd;exports.ORIGIN_POINT_3D=wa;exports.RAD2DEG=va;exports.TAU=nt;exports.acdbHostApplicationServices=Oa;exports.basisFunction=ti;exports.calculateCurveLength=Vh;exports.ceilPowerOfTwo=Mh;exports.clamp=kr;exports.clone=Ps;exports.createWorkerApi=hc;exports.damp=vh;exports.defaults=Bn;exports.degToRad=Ih;exports.euclideanModulo=ya;exports.evaluateNurbsPoint=Ms;exports.floorPowerOfTwo=Th;exports.generateChordKnots=Fh;exports.generateSqrtChordKnots=Uh;exports.generateUUID=gh;exports.generateUniformKnots=Bh;exports.has=Yo;exports.intPartLength=xa;exports.interpolateControlPoints=Bd;exports.inverseLerp=_h;exports.isBetween=Ch;exports.isBetweenAngle=Nh;exports.isEmpty=Xo;exports.isEqual=zn;exports.isImperialUnits=Dd;exports.isMetricUnits=zd;exports.isPointInPolygon=Pa;exports.isPolygonIntersect=Dh;exports.isPowerOfTwo=kh;exports.lerp=ba;exports.log=Es;exports.mapLinear=fh;exports.normalizeAngle=ks;exports.pingpong=yh;exports.radToDeg=Eh;exports.randFloat=Ah;exports.randFloatSpread=Sh;exports.randInt=wh;exports.relativeEps=Lh;exports.seededRandom=Ph;exports.setLogLevel=Kc;exports.smootherstep=xh;exports.smoothstep=bh;
|