@mlightcad/data-model 1.7.2 → 1.7.3

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.
@@ -2,4 +2,4 @@
2
2
  `;i+=" ";var B=r.hasOwnProperty!=null;for(var T in r)B&&!r.hasOwnProperty(T)||T=="prototype"||T=="__class__"||T=="__super__"||T=="__interfaces__"||T=="__properties__"||(k.length!=2&&(k+=`,
3
3
  `),k+=i+T+" : "+Lt.__string_rec(r[T],i));return i=i.substring(1),k+=`
4
4
  `+i+"}",k;case"function":return"<function>";case"string":return r;default:return String(r)}},Lt.__interfLoop=function(r,i){if(r==null)return!1;if(r==i)return!0;var o=r.__interfaces__;if(o!=null)for(var l=0,c=o.length;l<c;){var d=l++,g=o[d];if(g==i||Lt.__interfLoop(g,i))return!0}return Lt.__interfLoop(r.__super__,i)},Lt.__instanceof=function(r,i){if(i==null)return!1;switch(i){case vc:return(r|0)===r;case $o:return typeof r=="number";case Zo:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case bc:return!0;default:if(r!=null){if(typeof i=="function"){if(r instanceof i||Lt.__interfLoop(Lt.getClass(r),i))return!0}else if(typeof i=="object"&&Lt.__isNativeObj(i)&&r instanceof i)return!0}else return!1;return i==Qo&&r.__name__!=null||i==Jo&&r.__ename__!=null?!0:r.__enum__==i}},Lt.__nativeClassName=function(r){var i=Lt.__toStr.call(r).slice(8,-1);return i=="Object"||i=="Function"||i=="Math"||i=="JSON"?null:i},Lt.__isNativeObj=function(r){return Lt.__nativeClassName(r)!=null},Lt.__resolveNativeClass=function(r){return w[r]};var ce=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var i=r;this.a=[];for(var o=0;o<i;){var l=o++;this.a[l]=0}this.byteLength=i}};x["js.html.compat.ArrayBuffer"]=ce,ce.__name__=["js","html","compat","ArrayBuffer"],ce.sliceImpl=function(r,i){var o=new oa(this,r,i==null?null:i-r),l=new ii(o.byteLength),c=new oa(l);return c.set(o),l},ce.prototype={slice:function(r,i){return new ce(this.a.slice(r,i))},__class__:ce};var yr=function(r,i,o){if(this.buf=r,i==null?this.offset=0:this.offset=i,o==null?this.length=r.byteLength-this.offset:this.length=o,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(re.OutsideBounds)};x["js.html.compat.DataView"]=yr,yr.__name__=["js","html","compat","DataView"],yr.prototype={getInt8:function(r){var i=this.buf.a[this.offset+r];return i>=128?i-256:i},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,i){var o=this.getUint16(r,i);return o>=32768?o-65536:o},getUint16:function(r,i){return i?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,i){var o=this.offset+r,l=this.buf.a[o++],c=this.buf.a[o++],d=this.buf.a[o++],g=this.buf.a[o++];return i?l|c<<8|d<<16|g<<24:g|d<<8|c<<16|l<<24},getUint32:function(r,i){var o=this.getInt32(r,i);return o<0?o+4294967296:o},getFloat32:function(r,i){return ue.i32ToFloat(this.getInt32(r,i))},getFloat64:function(r,i){var o=this.getInt32(r,i),l=this.getInt32(r+4,i);return ue.i64ToDouble(i?o:l,i?l:o)},setInt8:function(r,i){i<0?this.buf.a[r+this.offset]=i+128&255:this.buf.a[r+this.offset]=i&255},setUint8:function(r,i){this.buf.a[r+this.offset]=i&255},setInt16:function(r,i,o){this.setUint16(r,i<0?i+65536:i,o)},setUint16:function(r,i,o){var l=r+this.offset;o?(this.buf.a[l]=i&255,this.buf.a[l++]=i>>8&255):(this.buf.a[l++]=i>>8&255,this.buf.a[l]=i&255)},setInt32:function(r,i,o){this.setUint32(r,i,o)},setUint32:function(r,i,o){var l=r+this.offset;o?(this.buf.a[l++]=i&255,this.buf.a[l++]=i>>8&255,this.buf.a[l++]=i>>16&255,this.buf.a[l++]=i>>>24):(this.buf.a[l++]=i>>>24,this.buf.a[l++]=i>>16&255,this.buf.a[l++]=i>>8&255,this.buf.a[l++]=i&255)},setFloat32:function(r,i,o){this.setUint32(r,ue.floatToI32(i),o)},setFloat64:function(r,i,o){var l=ue.doubleToI64(i);o?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:yr};var ur=function(){};x["js.html.compat.Uint8Array"]=ur,ur.__name__=["js","html","compat","Uint8Array"],ur._new=function(r,i,o){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 ce(l)}else if(Lt.__instanceof(r,ce)){var g=r;i==null&&(i=0),o==null&&(o=g.byteLength-i),i==0?l=g.a:l=g.a.slice(i,i+o),l.byteLength=l.length,l.byteOffset=i,l.buffer=g}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new ce(l);else throw new Q("TODO "+at.string(r));return l.subarray=ur._subarray,l.set=ur._set,l},ur._set=function(r,i){var o=this;if(Lt.__instanceof(r.buffer,ce)){var l=r;if(r.byteLength+i>o.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var g=c++;o[g+i]=l[g]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+i>o.byteLength)throw new Q("set() outside of range");for(var y=0,S=_.length;y<S;){var I=y++;o[I+i]=_[I]}}else throw new Q("TODO")},ur._subarray=function(r,i){var o=this,l=ur._new(o.slice(r,i));return l.byteOffset=r,l};var Tt=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&Tt.link(r,this,function(i){return i})};x["promhx.base.AsyncBase"]=Tt,Tt.__name__=["promhx","base","AsyncBase"],Tt.link=function(r,i,o){r._update.push({async:i,linkf:function(l){i.handleResolve(o(l))}}),Tt.immediateLinkUpdate(r,i,o)},Tt.immediateLinkUpdate=function(r,i,o){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&i.handleError(r._errorVal),r._resolved&&!r._pending)try{i.handleResolve(o(r._val))}catch(l){l instanceof Q&&(l=l.val),i.handleError(l)}},Tt.linkAll=function(r,i){for(var o=function(d,g,_){if(d.length==0||Tt.allFulfilled(d)){for(var y,S=[],I=er(r)();I.hasNext();){var P=I.next();S.push(P==g?_:P._val)}y=S,i.handleResolve(y)}},l=er(r)();l.hasNext();){var c=l.next();c._update.push({async:i,linkf:function(d,g,_){return function(y){d(g,_,y)}}(o,function(d){for(var g,_=[],y=er(r)();y.hasNext();){var S=y.next();S!=c&&_.push(S)}return g=_,g}(),c)})}Tt.allFulfilled(r)&&i.handleResolve(function(d){for(var g,_=[],y=er(r)();y.hasNext();){var S=y.next();_.push(S._val)}return g=_,g}())},Tt.pipeLink=function(r,i,o){var l=!1,c=function(d){if(!l){l=!0;var g=o(d);g._update.push({async:i,linkf:Ve(i,i.handleResolve)}),Tt.immediateLinkUpdate(g,i,function(_){return _})}};if(r._update.push({async:i,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),i.handleError(d)}},Tt.allResolved=function(r){for(var i=er(r)();i.hasNext();){var o=i.next();if(!o._resolved)return!1}return!0},Tt.allFulfilled=function(r){for(var i=er(r)();i.hasNext();){var o=i.next();if(!o._fulfilled)return!1}return!0},Tt.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 i=this;this._pending?At.enqueue(function(o,l){return function(){o(l)}}(Ve(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,At.queue.add(function(){i._val=r;for(var o=0,l=i._update;o<l.length;){var c=l[o];++o;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}i._fulfilled=!0,i._pending=!1}),At.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var i=this,o=function(l){if(i._error.length>0)for(var c=0,d=i._error;c<d.length;){var g=d[c];++c,g(l)}else if(i._update.length>0)for(var _=0,y=i._update;_<y.length;){var S=y[_];++_,S.async.handleError(l)}else throw new Q(l);i._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,At.queue.add(function(){if(i._errorMap!=null)try{i._resolve(i._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),o(l)}else o(r)}),At.continueOnNextLoop())},then:function(r){var i=new Tt(null);return Tt.link(this,i,r),i},unlink:function(r){var i=this;At.queue.add(function(){i._update=i._update.filter(function(o){return o.async!=r})}),At.continueOnNextLoop()},isLinked:function(r){for(var i=!1,o=0,l=this._update;o<l.length;){var c=l[o];if(++o,c.async==r)return!0}return i},__class__:Tt};var En=f.promhx.Deferred=function(){Tt.call(this)};x["promhx.Deferred"]=En,En.__name__=["promhx","Deferred"],En.__super__=Tt,En.prototype=M(Tt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new ve(this)},stream:function(){return new Xt(this)},publicStream:function(){return new Gr(this)},__class__:En});var ve=f.promhx.Promise=function(r){Tt.call(this,r),this._rejected=!1};x["promhx.Promise"]=ve,ve.__name__=["promhx","Promise"],ve.whenAll=function(r){var i=new ve(null);return Tt.linkAll(r,i),i},ve.promise=function(r){var i=new ve;return i.handleResolve(r),i},ve.__super__=Tt,ve.prototype=M(Tt.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var i="Promise has already been resolved";throw new Q(Mn.AlreadyResolved(i))}this._resolve(r)},then:function(r){var i=new ve(null);return Tt.link(this,i,r),i},unlink:function(r){var i=this;At.queue.add(function(){if(i._fulfilled)i._update=i._update.filter(function(l){return l.async!=r});else{var o="Downstream Promise is not fullfilled";i.handleError(Mn.DownstreamNotFullfilled(o))}}),At.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var i=new ve(null);return Tt.pipeLink(this,i,r),i},errorPipe:function(r){var i=new ve;return this.catchError(function(o){var l=r(o);l.then(Ve(i,i._resolve))}),this.then(Ve(i,i._resolve)),i},__class__:ve});var Xt=f.promhx.Stream=function(r){Tt.call(this,r),this._end_promise=new ve};x["promhx.Stream"]=Xt,Xt.__name__=["promhx","Stream"],Xt.foreach=function(r){for(var i=new Xt(null),o=er(r)();o.hasNext();){var l=o.next();i.handleResolve(l)}return i.end(),i},Xt.wheneverAll=function(r){var i=new Xt(null);return Tt.linkAll(r,i),i},Xt.concatAll=function(r){for(var i=new Xt(null),o=er(r)();o.hasNext();){var l=o.next();i.concat(l)}return i},Xt.mergeAll=function(r){for(var i=new Xt(null),o=er(r)();o.hasNext();){var l=o.next();i.merge(l)}return i},Xt.stream=function(r){var i=new Xt(null);return i.handleResolve(r),i},Xt.__super__=Tt,Xt.prototype=M(Tt.prototype,{then:function(r){var i=new Xt(null);return Tt.link(this,i,r),this._end_promise._update.push({async:i._end_promise,linkf:function(o){i.end()}}),i},detachStream:function(r){for(var i=[],o=!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(g){return g.async!=r._end_promise}),o=!0):i.push(d)}return this._update=i,o},first:function(){var r=new ve(null);return this.then(function(i){r._resolved||r.handleResolve(i)}),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 i=new Xt(null);return Tt.pipeLink(this,i,r),this._end_promise.then(function(o){i.end()}),i},errorPipe:function(r){var i=new Xt(null);return this.catchError(function(o){var l=r(o);l.then(Ve(i,i._resolve)),l._end_promise.then((ia=i._end_promise,Ve(ia,ia._resolve)))}),this.then(Ve(i,i._resolve)),this._end_promise.then(function(o){i.end()}),i},handleEnd:function(){if(this._pending)At.queue.add(Ve(this,this.handleEnd)),At.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=_e.Some(this._val):r=_e.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return At.queue.add(Ve(this,this.handleEnd)),At.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var i=new Xt(null);return this._update.push({async:i,linkf:function(o){r(o)&&i.handleResolve(o)}}),Tt.immediateLinkUpdate(this,i,function(o){return o}),i},concat:function(r){var i=new Xt(null);return this._update.push({async:i,linkf:Ve(i,i.handleResolve)}),Tt.immediateLinkUpdate(this,i,function(o){return o}),this._end_promise.then(function(o){r.pipe(function(l){return i.handleResolve(l),i}),r._end_promise.then(function(l){i.end()})}),i},merge:function(r){var i=new Xt(null);return this._update.push({async:i,linkf:Ve(i,i.handleResolve)}),r._update.push({async:i,linkf:Ve(i,i.handleResolve)}),Tt.immediateLinkUpdate(this,i,function(o){return o}),Tt.immediateLinkUpdate(r,i,function(o){return o}),i},__class__:Xt});var Gr=f.promhx.PublicStream=function(r){Xt.call(this,r)};x["promhx.PublicStream"]=Gr,Gr.__name__=["promhx","PublicStream"],Gr.publicstream=function(r){var i=new Gr(null);return i.handleResolve(r),i},Gr.__super__=Xt,Gr.prototype=M(Xt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Gr});var At=function(){};x["promhx.base.EventLoop"]=At,At.__name__=["promhx","base","EventLoop"],At.enqueue=function(r){At.queue.add(r),At.continueOnNextLoop()},At.set_nextLoop=function(r){if(At.nextLoop!=null)throw new Q("nextLoop has already been set");return At.nextLoop=r,At.nextLoop},At.queueEmpty=function(){return At.queue.isEmpty()},At.finish=function(r){r==null&&(r=1e3);for(var i=null;r-- >0&&(i=At.queue.pop())!=null;)i();return At.queue.isEmpty()},At.clear=function(){At.queue=new V},At.f=function(){var r=At.queue.pop();r!=null&&r(),At.queue.isEmpty()||At.continueOnNextLoop()},At.continueOnNextLoop=function(){At.nextLoop!=null?At.nextLoop(At.f):setImmediate(At.f)};var Mn=x["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};Mn.AlreadyResolved=function(r){var i=["AlreadyResolved",0,r];return i.__enum__=Mn,i.toString=A,i},Mn.DownstreamNotFullfilled=function(r){var i=["DownstreamNotFullfilled",1,r];return i.__enum__=Mn,i.toString=A,i};var ni=function(){};x["verb.Verb"]=ni,ni.__name__=["verb","Verb"],ni.main=function(){b.log("verb 2.1.0")};var Z=function(){};x["verb.core.ArrayExtensions"]=Z,Z.__name__=["verb","core","ArrayExtensions"],Z.alloc=function(r,i){if(!(i<0))for(;r.length<i;)r.push(null)},Z.reversed=function(r){var i=r.slice();return i.reverse(),i},Z.last=function(r){return r[r.length-1]},Z.first=function(r){return r[0]},Z.spliceAndInsert=function(r,i,o,l){r.splice(i,o),r.splice(i,0,l)},Z.left=function(r){if(r.length==0)return[];var i=Math.ceil(r.length/2);return r.slice(0,i)},Z.right=function(r){if(r.length==0)return[];var i=Math.ceil(r.length/2);return r.slice(i)},Z.rightWithPivot=function(r){if(r.length==0)return[];var i=Math.ceil(r.length/2);return r.slice(i-1)},Z.unique=function(r,i){if(r.length==0)return[];for(var o=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<o.length;){var g=o[d];if(++d,i(l,g)){c=!1;break}}c&&o.push(l)}return o};var Vt=function(){};x["verb.core.Binomial"]=Vt,Vt.__name__=["verb","core","Binomial"],Vt.get=function(r,i){if(i==0)return 1;if(r==0||i>r)return 0;if(i>r-i&&(i=r-i),Vt.memo_exists(r,i))return Vt.get_memo(r,i);for(var o=1,l=r,c=1,d=i+1;c<d;){var g=c++;if(Vt.memo_exists(l,g)){r--,o=Vt.get_memo(l,g);continue}o*=r--,o/=g,Vt.memoize(l,g,o)}return o},Vt.get_no_memo=function(r,i){if(i==0)return 1;if(r==0||i>r)return 0;i>r-i&&(i=r-i);for(var o=1,l=1,c=i+1;l<c;){var d=l++;o*=r--,o/=d}return o},Vt.memo_exists=function(r,i){return Vt.memo.h.hasOwnProperty(r)&&Vt.memo.h[r].h.hasOwnProperty(i)},Vt.get_memo=function(r,i){return Vt.memo.h[r].h[i]},Vt.memoize=function(r,i,o){Vt.memo.h.hasOwnProperty(r)||Vt.memo.set(r,new wt),Vt.memo.h[r].h[i]=o};var Re=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"]=Re,Re.__name__=["verb","core","BoundingBox"],Re.intervalsOverlap=function(r,i,o,l,c){c==null&&(c=-1);var d;c<-.5?d=rt.TOLERANCE:d=c;var g=Math.min(r,i)-d,_=Math.max(r,i)+d,y=Math.min(o,l)-d,S=Math.max(o,l)+d;return g>=y&&g<=S||_>=y&&_<=S||y>=g&&y<=_||S>=g&&S<=_},Re.prototype={fromPoint:function(r){return new Re([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 i=0,o=this.dim;i<o;){var l=i++;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 i=r.length,o=0;o<i;){var l=o++;this.add(r[l])}return this},contains:function(r,i){return i==null&&(i=-1),this.initialized?this.intersects(new Re([r]),i):!1},intersects:function(r,i){if(i==null&&(i=-1),!this.initialized||!r.initialized)return!1;for(var o=this.min,l=this.max,c=r.min,d=r.max,g=0,_=this.dim;g<_;){var y=g++;if(!Re.intervalsOverlap(o[y],l[y],c[y],d[y],i))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,i=0,o=0,l=this.dim;o<l;){var c=o++,d=this.getAxisLength(c);d>r&&(r=d,i=c)}return i},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,i){if(!this.initialized)return null;var o=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,i))return null;for(var g=[],_=[],y=0,S=this.dim;y<S;){var I=y++;g.push(Math.min(l[I],d[I])),_.push(Math.max(o[I],c[I]))}return new Re([_,g])},__class__:Re};var rt=f.core.Constants=function(){};x["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var te=f.core.SerializableBase=function(){};x["verb.core.SerializableBase"]=te,te.__name__=["verb","core","SerializableBase"],te.prototype={serialize:function(){var r=new Kt;return r.serialize(this),r.toString()},__class__:te};var es=f.core.Plane=function(r,i){this.origin=r,this.normal=i};x["verb.core.Plane"]=es,es.__name__=["verb","core","Plane"],es.__super__=te,es.prototype=M(te.prototype,{__class__:es});var Tn=f.core.Ray=function(r,i){this.origin=r,this.dir=i};x["verb.core.Ray"]=Tn,Tn.__name__=["verb","core","Ray"],Tn.__super__=te,Tn.prototype=M(te.prototype,{__class__:Tn});var Dt=f.core.NurbsCurveData=function(r,i,o){this.degree=r,this.controlPoints=o,this.knots=i};x["verb.core.NurbsCurveData"]=Dt,Dt.__name__=["verb","core","NurbsCurveData"],Dt.__super__=te,Dt.prototype=M(te.prototype,{__class__:Dt});var ne=f.core.NurbsSurfaceData=function(r,i,o,l,c){this.degreeU=r,this.degreeV=i,this.knotsU=o,this.knotsV=l,this.controlPoints=c};x["verb.core.NurbsSurfaceData"]=ne,ne.__name__=["verb","core","NurbsSurfaceData"],ne.__super__=te,ne.prototype=M(te.prototype,{__class__:ne});var Je=f.core.MeshData=function(r,i,o,l){this.faces=r,this.points=i,this.normals=o,this.uvs=l};x["verb.core.MeshData"]=Je,Je.__name__=["verb","core","MeshData"],Je.empty=function(){return new Je([],[],[],[])},Je.__super__=te,Je.prototype=M(te.prototype,{__class__:Je});var rs=f.core.PolylineData=function(r,i){this.points=r,this.params=i};x["verb.core.PolylineData"]=rs,rs.__name__=["verb","core","PolylineData"],rs.__super__=te,rs.prototype=M(te.prototype,{__class__:rs});var ns=f.core.VolumeData=function(r,i,o,l,c,d,g){this.degreeU=r,this.degreeV=i,this.degreeW=o,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=g};x["verb.core.VolumeData"]=ns,ns.__name__=["verb","core","VolumeData"],ns.__super__=te,ns.prototype=M(te.prototype,{__class__:ns});var se=f.core.Pair=function(r,i){this.item0=r,this.item1=i};x["verb.core.Pair"]=se,se.__name__=["verb","core","Pair"],se.prototype={__class__:se};var Le=f.core.Interval=function(r,i){this.min=r,this.max=i};x["verb.core.Interval"]=Le,Le.__name__=["verb","core","Interval"],Le.prototype={__class__:Le};var on=f.core.CurveCurveIntersection=function(r,i,o,l){this.point0=r,this.point1=i,this.u0=o,this.u1=l};x["verb.core.CurveCurveIntersection"]=on,on.__name__=["verb","core","CurveCurveIntersection"],on.prototype={__class__:on};var ss=f.core.CurveSurfaceIntersection=function(r,i,o,l){this.u=r,this.uv=i,this.curvePoint=o,this.surfacePoint=l};x["verb.core.CurveSurfaceIntersection"]=ss,ss.__name__=["verb","core","CurveSurfaceIntersection"],ss.prototype={__class__:ss};var Wr=f.core.MeshIntersectionPoint=function(r,i,o,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=i,this.point=o,this.faceIndex0,this.faceIndex1};x["verb.core.MeshIntersectionPoint"]=Wr,Wr.__name__=["verb","core","MeshIntersectionPoint"],Wr.prototype={__class__:Wr};var is=f.core.PolylineMeshIntersection=function(r,i,o,l,c){this.point=r,this.u=i,this.uv=o,this.polylineIndex=l,this.faceIndex=c};x["verb.core.PolylineMeshIntersection"]=is,is.__name__=["verb","core","PolylineMeshIntersection"],is.prototype={__class__:is};var as=f.core.SurfaceSurfaceIntersectionPoint=function(r,i,o,l){this.uv0=r,this.uv1=i,this.point=o,this.dist=l};x["verb.core.SurfaceSurfaceIntersectionPoint"]=as,as.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],as.prototype={__class__:as};var os=f.core.TriSegmentIntersection=function(r,i,o,l){this.point=r,this.s=i,this.t=o,this.p=l};x["verb.core.TriSegmentIntersection"]=os,os.__name__=["verb","core","TriSegmentIntersection"],os.prototype={__class__:os};var kn=f.core.CurveTriPoint=function(r,i,o){this.u=r,this.point=i,this.uv=o};x["verb.core.CurveTriPoint"]=kn,kn.__name__=["verb","core","CurveTriPoint"],kn.prototype={__class__:kn};var $e=function(r,i,o,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=o,this.point=r,this.normal=i,this.id=l,this.degen=c};x["verb.core.SurfacePoint"]=$e,$e.__name__=["verb","core","SurfacePoint"],$e.fromUv=function(r,i){return new $e(null,null,[r,i])},$e.prototype={__class__:$e};var si=f.core.CurvePoint=function(r,i){this.u=r,this.pt=i};x["verb.core.CurvePoint"]=si,si.__name__=["verb","core","CurvePoint"],si.prototype={__class__:si};var ls=f.core.KdTree=function(r,i){this.dim=3,this.points=r,this.distanceFunction=i,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};x["verb.core.KdTree"]=ls,ls.__name__=["verb","core","KdTree"],ls.prototype={buildTree:function(r,i,o){var l=i%this.dim,c,d;return r.length==0?null:r.length==1?new Ln(r[0],l,o):(r.sort(function(g,_){var y=g.point[l]-_.point[l];return y==0?0:y>0?1:-1}),c=Math.floor(r.length/2),d=new Ln(r[c],l,o),d.left=this.buildTree(r.slice(0,c),i+1,d),d.right=this.buildTree(r.slice(c+1),i+1,d),d)},nearest:function(r,i,o){var l=this,c=new hs(function(P){return-P.item1}),d,g=null;g=function(P){for(var E,T=P.dimension,k=l.distanceFunction(r,P.kdPoint.point),B,C=[],R=0,z=l.dim;R<z;)R++,C.push(0);B=C;for(var U,j,X=function($,tt){c.push(new se($,tt)),c.size()>i&&c.pop()},J=0,q=l.dim;J<q;){var G=J++;G==P.dimension?B[G]=r[G]:B[G]=P.kdPoint.point[G]}if(U=l.distanceFunction(B,P.kdPoint.point),P.right==null&&P.left==null){(c.size()<i||k<c.peek().item1)&&X(P,k);return}P.right==null?E=P.left:P.left==null?E=P.right:r[T]<P.kdPoint.point[T]?E=P.left:E=P.right,g(E),(c.size()<i||k<c.peek().item1)&&X(P,k),(c.size()<i||Math.abs(U)<c.peek().item1)&&(E==P.left?j=P.right:j=P.left,j!=null&&g(j))},d=g;for(var _=0;_<i;)_++,c.push(new se(null,o));d(this.root);for(var y=[],S=0;S<i;){var I=S++;c.content[I].item0!=null&&y.push(new se(c.content[I].item0.kdPoint,c.content[I].item1))}return y},__class__:ls};var hs=function(r){this.content=[],this.scoreFunction=r};x["verb.core.BinaryHeap"]=hs,hs.__name__=["verb","core","BinaryHeap"],hs.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],i=this.content.pop();return this.content.length>0&&(this.content[0]=i,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var i=this.content.length,o=0;o<i;){var l=o++;if(this.content[l]==r){var c=this.content.pop();l!=i-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 i=this.content[r];r>0;){var o=Math.floor((r+1)/2)-1,l=this.content[o];if(this.scoreFunction(i)<this.scoreFunction(l))this.content[o]=i,this.content[r]=l,r=o;else break}},sinkDown:function(r){for(var i=this.content.length,o=this.content[r],l=this.scoreFunction(o);;){var c=(r+1)*2,d=c-1,g=-1,_=0;if(d<i){var y=this.content[d];_=this.scoreFunction(y),_<l&&(g=d)}if(c<i){var S=this.content[c],I=this.scoreFunction(S);I<(g==-1?l:_)&&(g=c)}if(g!=-1)this.content[r]=this.content[g],this.content[g]=o,r=g;else break}},__class__:hs};var Nn=f.core.KdPoint=function(r,i){this.point=r,this.obj=i};x["verb.core.KdPoint"]=Nn,Nn.__name__=["verb","core","KdPoint"],Nn.prototype={__class__:Nn};var Ln=f.core.KdNode=function(r,i,o){this.kdPoint=r,this.left=null,this.right=null,this.parent=o,this.dimension=i};x["verb.core.KdNode"]=Ln,Ln.__name__=["verb","core","KdNode"],Ln.prototype={__class__:Ln};var vr=function(){};x["verb.eval.IBoundingBoxTree"]=vr,vr.__name__=["verb","eval","IBoundingBoxTree"],vr.prototype={__class__:vr};var cr=function(r,i){this._boundingBox=null,this._curve=r,i==null&&(i=p.domain(this._curve.knots)/64),this._knotTol=i};x["verb.core.LazyCurveBoundingBoxTree"]=cr,cr.__name__=["verb","core","LazyCurveBoundingBoxTree"],cr.__interfaces__=[vr],cr.prototype={split:function(){var r=Z.first(this._curve.knots),i=Z.last(this._curve.knots),o=i-r,l=de.curveSplit(this._curve,(i+r)/2+o*.1*Math.random());return new se(new cr(l[0],this._knotTol),new cr(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Re(N.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return p.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:cr};var dr=function(r,i){if(this._boundingBox=null,this._mesh=r,i==null){for(var o=[],l=0,c=r.faces.length;l<c;){var d=l++;o.push(d)}i=o}this._faceIndices=i};x["verb.core.LazyMeshBoundingBoxTree"]=dr,dr.__name__=["verb","core","LazyMeshBoundingBoxTree"],dr.__interfaces__=[vr],dr.prototype={split:function(){var r=ie.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),i=Z.left(r),o=Z.right(r);return new se(new dr(this._mesh,i),new dr(this._mesh,o))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=ie.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__:dr};var pr=function(r,i){this._boundingBox=null,this._polyline=r,i==null&&(i=new Le(0,r.points.length!=0?r.points.length-1:0)),this._interval=i};x["verb.core.LazyPolylineBoundingBoxTree"]=pr,pr.__name__=["verb","core","LazyPolylineBoundingBoxTree"],pr.__interfaces__=[vr],pr.prototype={split:function(){var r=this._interval.min,i=this._interval.max,o=r+Math.ceil((i-r)/2),l=new Le(r,o),c=new Le(o,i);return new se(new pr(this._polyline,l),new pr(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Re(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__:pr};var Dr=function(r,i,o,l){i==null&&(i=!1),this._boundingBox=null,this._surface=r,this._splitV=i,o==null&&(o=p.domain(r.knotsU)/16),l==null&&(l=p.domain(r.knotsV)/16),this._knotTolU=o,this._knotTolV=l};x["verb.core.LazySurfaceBoundingBoxTree"]=Dr,Dr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Dr.__interfaces__=[vr],Dr.prototype={split:function(){var r,i;this._splitV?(r=Z.first(this._surface.knotsV),i=Z.last(this._surface.knotsV)):(r=Z.first(this._surface.knotsU),i=Z.last(this._surface.knotsU));var o=(r+i)/2,l=de.surfaceSplit(this._surface,o,this._splitV);return new se(new Dr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Dr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Re;for(var r=0,i=this._surface.controlPoints;r<i.length;){var o=i[r];++r,this._boundingBox.addRange(N.dehomogenize1d(o))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return p.domain(this._surface.knotsV)<this._knotTolV&&p.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Dr};var Ot=f.core.Mat=function(){};x["verb.core.Mat"]=Ot,Ot.__name__=["verb","core","Mat"],Ot.mul=function(r,i){for(var o=[],l=0,c=i.length;l<c;){var d=l++;o.push(p.mul(r,i[d]))}return o},Ot.mult=function(r,i){var o,l,c,d,g,_,y,S;o=r.length,l=i.length,c=i[0].length,d=[];for(var I=o-1,P=0,E=0;I>=0;){for(g=[],_=r[I],E=c-1;E>=0;){for(y=_[l-1]*i[l-1][E],P=l-2;P>=1;)S=P-1,y+=_[P]*i[P][E]+_[S]*i[S][E],P-=2;P==0&&(y+=_[0]*i[0][E]),g[E]=y,E--}d[I]=g,I--}return d},Ot.add=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(p.add(r[d],i[d]))}return o},Ot.div=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(p.div(r[d],i))}return o},Ot.sub=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(p.sub(r[d],i[d]))}return o},Ot.dot=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(p.dot(r[d],i))}return o},Ot.identity=function(r){for(var i=p.zeros2d(r,r),o=0;o<r;){var l=o++;i[l][l]=1}return i},Ot.transpose=function(r){if(r.length==0)return[];for(var i=[],o=0,l=r[0].length;o<l;){var c=o++;i.push(function(d){for(var g,_=[],y=0,S=r.length;y<S;){var I=y++;_.push(r[I][c])}return g=_,g}())}return i},Ot.solve=function(r,i){return Ot.LUsolve(Ot.LU(r),i)},Ot.LUsolve=function(r,i){var o,l,c=r.LU,d=c.length,g=i.slice(),_=r.P,y,S,I;for(o=d-1;o!=-1;)g[o]=i[o],--o;for(o=0;o<d;){for(y=_[o],_[o]!=o&&(I=g[o],g[o]=g[y],g[y]=I),S=c[o],l=0;l<o;)g[o]-=g[l]*S[l],++l;++o}for(o=d-1;o>=0;){for(S=c[o],l=o+1;l<d;)g[o]-=g[l]*S[l],++l;g[o]/=S[o],--o}return g},Ot.LU=function(r){for(var i,o,l,c,d,g,_,y,S,I=[],P=0,E=r.length;P<E;){var T=P++;I.push(r[T].slice())}r=I;var k=r.length,B=k-1,C=[];for(l=0;l<k;){for(_=l,g=r[l],S=Math.abs(g[l]),o=l+1;o<k;)c=Math.abs(r[o][l]),S<c&&(S=c,_=o),++o;for(C[l]=_,_!=l&&(r[l]=r[_],r[_]=g,g=r[l]),d=g[l],i=l+1;i<k;)r[i][l]/=d,++i;for(i=l+1;i<k;){for(y=r[i],o=l+1;o<B;)y[o]-=y[l]*g[o],++o,y[o]-=y[l]*g[o],++o;o==B&&(y[o]-=y[l]*g[o]),++i}++l}return new us(r,C)};var us=function(r,i){this.LU=r,this.P=i};x["verb.core._Mat.LUDecomp"]=us,us.__name__=["verb","core","_Mat","LUDecomp"],us.prototype={__class__:us};var ie=f.core.Mesh=function(){};x["verb.core.Mesh"]=ie,ie.__name__=["verb","core","Mesh"],ie.getTriangleNorm=function(r,i){var o=r[i[0]],l=r[i[1]],c=r[i[2]],d=p.sub(l,o),g=p.sub(c,o),_=p.cross(d,g);return p.mul(1/p.norm(_),_)},ie.makeMeshAabb=function(r,i){for(var o=new Re,l=0;l<i.length;){var c=i[l];++l,o.add(r.points[r.faces[c][0]]),o.add(r.points[r.faces[c][1]]),o.add(r.points[r.faces[c][2]])}return o},ie.sortTrianglesOnLongestAxis=function(r,i,o){for(var l=r.getLongestAxis(),c=[],d=0;d<o.length;){var g=o[d];++d;var _=ie.getMinCoordOnAxis(i.points,i.faces[g],l);c.push(new se(_,g))}c.sort(function(E,T){var k=E.item0,B=T.item0;return k==B?0:k>B?1:-1});for(var y=[],S=0,I=c.length;S<I;){var P=S++;y.push(c[P].item1)}return y},ie.getMinCoordOnAxis=function(r,i,o){for(var l=1/0,c=0;c<3;){var d=c++,g=r[i[d]][o];g<l&&(l=g)}return l},ie.getTriangleCentroid=function(r,i){for(var o=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var g=d++;o[g]+=r[i[c]][g]}for(var _=0;_<3;){var y=_++;o[y]/=3}return o},ie.triangleUVFromPoint=function(r,i,o){var l=r.faces[i],c=r.points[l[0]],d=r.points[l[1]],g=r.points[l[2]],_=r.uvs[l[0]],y=r.uvs[l[1]],S=r.uvs[l[2]],I=p.sub(c,o),P=p.sub(d,o),E=p.sub(g,o),T=p.norm(p.cross(p.sub(c,d),p.sub(c,g))),k=p.norm(p.cross(P,E))/T,B=p.norm(p.cross(E,I))/T,C=p.norm(p.cross(I,P))/T;return p.add(p.mul(k,_),p.add(p.mul(B,y),p.mul(C,S)))};var Hr=function(r,i){if(this._empty=!1,this._face=-1,i==null){for(var o=[],l=0,c=r.faces.length;l<c;){var d=l++;o.push(d)}i=o}if(this._boundingBox=ie.makeMeshAabb(r,i),i.length<1){this._empty=!0;return}else if(i.length<2){this._face=i[0];return}var g=ie.sortTrianglesOnLongestAxis(this._boundingBox,r,i),_=Z.left(g),y=Z.right(g);this._children=new se(new Hr(r,_),new Hr(r,y))};x["verb.core.MeshBoundingBoxTree"]=Hr,Hr.__name__=["verb","core","MeshBoundingBoxTree"],Hr.__interfaces__=[vr],Hr.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__:Hr};var tr=f.core.Minimizer=function(){};x["verb.core.Minimizer"]=tr,tr.__name__=["verb","core","Minimizer"],tr.uncmin=function(r,i,o,l,c){o==null&&(o=1e-8),l==null&&(l=function(J){return tr.numericalGradient(r,J)}),c==null&&(c=1e3),i=i.slice(0);var d=i.length,g=r(i),_=g,y;if(isNaN(g))throw new Q("uncmin: f(x0) is a NaN!");o=Math.max(o,rt.EPSILON);var S,I,P,E=Ot.identity(d),T=0,k=[],B,C,R,z,U,j,X="";for(I=l(i);T<c;){if(!p.all(p.finite(I))){X="Gradient has Infinity or NaN";break}if(S=p.neg(Ot.dot(E,I)),!p.all(p.finite(S))){X="Search direction has Infinity or NaN";break}if(j=p.norm(S),j<o){X="Newton step smaller than tol";break}for(U=1,y=p.dot(I,S),B=i;T<c&&!(U*j<o);){if(k=p.mul(U,S),B=p.add(i,k),_=r(B),_-g>=.1*U*y||isNaN(_)){U*=.5,++T;continue}break}if(U*j<o){X="Line search step size smaller than tol";break}if(T==c){X="maxit reached during line search";break}P=l(B),C=p.sub(P,I),z=p.dot(C,k),R=Ot.dot(E,C),E=Ot.sub(Ot.add(E,Ot.mul((z+p.dot(C,R))/(z*z),tr.tensor(k,k))),Ot.div(Ot.add(tr.tensor(R,k),tr.tensor(k,R)),z)),i=B,g=_,I=P,++T}return new cs(i,g,I,E,T,X)},tr.numericalGradient=function(r,i){var o=i.length,l=r(i);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=i.slice(0),d,g,_=[],y,S=.001,I,P,E,T=0,k,B,C,R=0;R<o;)for(var z=R++,U=Math.max(1e-6*l,1e-8);;){if(++T,T>20)throw new Q("Numerical gradient fails");if(c[z]=i[z]+U,d=r(c),c[z]=i[z]-U,g=r(c),c[z]=i[z],isNaN(d)||isNaN(g)){U/=16;continue}if(_[z]=(d-g)/(2*U),I=i[z]-U,P=i[z],E=i[z]+U,k=(d-l)/U,B=(l-g)/U,C=p.max([Math.abs(_[z]),Math.abs(l),Math.abs(d),Math.abs(g),Math.abs(I),Math.abs(P),Math.abs(E),1e-8]),y=Math.min(p.max([Math.abs(k-_[z]),Math.abs(B-_[z]),Math.abs(k-B)])/C,U/C),y>S)U/=16;else break}return _},tr.tensor=function(r,i){for(var o=r.length,l=i.length,c=[],d,g,_=o-1;_>=0;){d=[],g=r[_];for(var y=l-1;y>=3;)d[y]=g*i[y],--y,d[y]=g*i[y],--y,d[y]=g*i[y],--y,d[y]=g*i[y],--y;for(;y>=0;)d[y]=g*i[y],--y;c[_]=d,_--}return c};var cs=function(r,i,o,l,c,d){this.solution=r,this.value=i,this.gradient=o,this.invHessian=l,this.iterations=c,this.message=d};x["verb.core.MinimizationResult"]=cs,cs.__name__=["verb","core","MinimizationResult"],cs.prototype={__class__:cs};var Cn=function(){};x["verb.core.ISerializable"]=Cn,Cn.__name__=["verb","core","ISerializable"],Cn.prototype={__class__:Cn};var sa=f.core.Deserializer=function(){};x["verb.core.Deserializer"]=sa,sa.__name__=["verb","core","Deserializer"],sa.deserialize=function(r){var i=new qt(r),o=i.unserialize();return o};var Fe=f.core.Trig=function(){};x["verb.core.Trig"]=Fe,Fe.__name__=["verb","core","Trig"],Fe.isPointInPlane=function(r,i,o){return Math.abs(p.dot(p.sub(r,i.origin),i.normal))<o},Fe.distToSegment=function(r,i,o){var l=Fe.segmentClosestPoint(i,r,o,0,1);return p.dist(i,l.pt)},Fe.rayClosestPoint=function(r,i,o){var l=p.sub(r,i),c=p.dot(l,o),d=p.add(i,p.mul(c,o));return d},Fe.distToRay=function(r,i,o){var l=Fe.rayClosestPoint(r,i,o),c=p.sub(l,r);return p.norm(c)},Fe.threePointsAreFlat=function(r,i,o,l){var c=p.sub(i,r),d=p.sub(o,r),g=p.cross(c,d),_=p.dot(g,g);return _<l},Fe.segmentClosestPoint=function(r,i,o,l,c){var d=p.sub(o,i),g=p.norm(d);if(g<rt.EPSILON)return{u:l,pt:i};var _=i,y=p.mul(1/g,d),S=p.sub(r,_),I=p.dot(S,y);return I<0?{u:l,pt:i}:I>g?{u:c,pt:o}:{u:l+(c-l)*I/g,pt:p.add(_,p.mul(I,y))}};var p=f.core.Vec=function(){};x["verb.core.Vec"]=p,p.__name__=["verb","core","Vec"],p.angleBetween=function(r,i){return Math.acos(p.dot(r,i)/(p.norm(r)*p.norm(i)))},p.positiveAngleBetween=function(r,i,o){var l=p.cross(r,i),c=p.norm(r),d=p.norm(i),g=c*d,_=p.dot(r,i),y=p.norm(l)/g,S=_/g,I=Math.atan2(y,S),P=p.dot(o,l);return Math.abs(P)<rt.EPSILON||P>0?I:-I},p.signedAngleBetween=function(r,i,o){var l=p.cross(r,i),c=p.norm(r),d=p.norm(i),g=c*d,_=p.dot(r,i),y=p.norm(l)/g,S=_/g,I=Math.atan2(y,S),P=p.dot(o,l);return P>0?I:2*Math.PI-I},p.angleBetweenNormalized2d=function(r,i){var o=r[0]*i[1]-r[1]*i[0];return Math.atan2(o,p.dot(r,i))},p.domain=function(r){return Z.last(r)-Z.first(r)},p.range=function(r){for(var i=[],o=0,l=0;l<r;)l++,i.push(o),o+=1;return i},p.span=function(r,i,o){if(o==null)return[];if(o<rt.EPSILON)return[];if(r>i&&o>0)return[];if(i>r&&o<0)return[];for(var l=[],c=r;c<=i;)l.push(c),c+=o;return l},p.neg=function(r){return r.map(function(i){return-i})},p.min=function(r){return O.fold(r,function(i,o){return Math.min(i,o)},1/0)},p.max=function(r){return O.fold(r,function(i,o){return Math.max(i,o)},-1/0)},p.all=function(r){return O.fold(r,function(i,o){return o&&i},!0)},p.finite=function(r){return r.map(function(i){return isFinite(i)})},p.onRay=function(r,i,o){return p.add(r,p.mul(o,i))},p.lerp=function(r,i,o){return p.add(p.mul(r,i),p.mul(1-r,o))},p.normalized=function(r){return p.div(r,p.norm(r))},p.cross=function(r,i){return[r[1]*i[2]-r[2]*i[1],r[2]*i[0]-r[0]*i[2],r[0]*i[1]-r[1]*i[0]]},p.dist=function(r,i){return p.norm(p.sub(r,i))},p.distSquared=function(r,i){return p.normSquared(p.sub(r,i))},p.sum=function(r){return O.fold(r,function(i,o){return o+i},0)},p.addAll=function(r){var i=er(r)();if(!i.hasNext())return null;var o=i.next().length;return O.fold(r,function(l,c){return p.add(c,l)},p.rep(o,0))},p.addAllMutate=function(r){for(var i=r[0],o=1,l=r.length;o<l;){var c=o++;p.addMutate(i,r[c])}},p.addMulMutate=function(r,i,o){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+i*o[d]}},p.subMulMutate=function(r,i,o){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-i*o[d]}},p.addMutate=function(r,i){for(var o=0,l=r.length;o<l;){var c=o++;r[c]=r[c]+i[c]}},p.subMutate=function(r,i){for(var o=0,l=r.length;o<l;){var c=o++;r[c]=r[c]-i[c]}},p.mulMutate=function(r,i){for(var o=0,l=i.length;o<l;){var c=o++;i[c]=i[c]*r}},p.norm=function(r){var i=p.normSquared(r);return i!=0?Math.sqrt(i):i},p.normSquared=function(r){return O.fold(r,function(i,o){return o+i*i},0)},p.rep=function(r,i){for(var o=[],l=0;l<r;)l++,o.push(i);return o},p.zeros1d=function(r){for(var i=[],o=0;o<r;)o++,i.push(0);return i},p.zeros2d=function(r,i){for(var o=[],l=0;l<r;)l++,o.push(p.zeros1d(i));return o},p.zeros3d=function(r,i,o){for(var l=[],c=0;c<r;)c++,l.push(p.zeros2d(i,o));return l},p.dot=function(r,i){for(var o=0,l=0,c=r.length;l<c;){var d=l++;o+=r[d]*i[d]}return o},p.add=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]+i[d])}return o},p.mul=function(r,i){for(var o=[],l=0,c=i.length;l<c;){var d=l++;o.push(r*i[d])}return o},p.div=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]/i)}return o},p.sub=function(r,i){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]-i[d])}return o},p.isZero=function(r){for(var i=0,o=r.length;i<o;){var l=i++;if(Math.abs(r[l])>rt.TOLERANCE)return!1}return!0},p.sortedSetUnion=function(r,i){for(var o=[],l=0,c=0;l<r.length||c<i.length;){if(l>=r.length){o.push(i[c]),c++;continue}else if(c>=i.length){o.push(r[l]),l++;continue}var d=r[l]-i[c];if(Math.abs(d)<rt.EPSILON){o.push(r[l]),l++,c++;continue}if(d>0){o.push(i[c]),c++;continue}o.push(r[l]),l++}return o},p.sortedSetSub=function(r,i){for(var o=[],l=0,c=0;l<r.length;){if(c>=i.length){o.push(r[l]),l++;continue}if(Math.abs(r[l]-i[c])<rt.EPSILON){l++,c++;continue}o.push(r[l]),l++}return o};var bt=f.eval.Analyze=function(){};x["verb.eval.Analyze"]=bt,bt.__name__=["verb","eval","Analyze"],bt.knotMultiplicities=function(r){for(var i=[new On(r[0],0)],o=i[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-o.knot)>rt.EPSILON&&(o=new On(c,0),i.push(o)),o.inc()}return i},bt.isRationalSurfaceClosed=function(r,i){i==null&&(i=!0);var o;i?o=r.controlPoints:o=Ot.transpose(r.controlPoints);for(var l=0,c=o[0].length;l<c;){var d=l++,g=p.dist(Z.first(o)[d],Z.last(o)[d])<rt.EPSILON;if(!g)return!1}return!0},bt.rationalSurfaceClosestPoint=function(r,i){var o=bt.rationalSurfaceClosestParam(r,i);return N.rationalSurfacePoint(r,o[0],o[1])},bt.rationalSurfaceClosestParam=function(r,i){for(var o=5,l=0,c,d=1e-4,g=5e-4,_,y=r.knotsU[0],S=Z.last(r.knotsU),I=r.knotsV[0],P=Z.last(r.knotsV),E=bt.isRationalSurfaceClosed(r),T=bt.isRationalSurfaceClosed(r,!1),k,B=zt.rationalSurfaceAdaptive(r,new qr),C=1/0,R=0,z=B.points.length;R<z;){var U=R++,j=B.points[U],X=p.normSquared(p.sub(i,j));X<C&&(C=X,k=B.uvs[U])}for(var J=function(Ht){return N.rationalSurfaceDerivatives(r,Ht[0],Ht[1],2)},q=function(Ht,$t,jt){var Qt=$t[1][0],Ce=$t[0][1],Qe=$t[2][0],Pe=$t[0][2],be=$t[1][1],Oe=$t[1][1],Ue=p.dot(Qt,jt),rr=p.dot(Ce,jt),mr=[-Ue,-rr],nr=p.dot(Qt,Qt)+p.dot(Qe,jt),sr=p.dot(Qt,Ce)+p.dot(be,jt),ir=p.dot(Qt,Ce)+p.dot(Oe,jt),xr=p.dot(Ce,Ce)+p.dot(Pe,jt),Fn=[[nr,sr],[ir,xr]],hn=Ot.solve(Fn,mr);return p.add(hn,Ht)};l<o;){c=J(k),_=p.sub(c[0][0],i);var G=p.norm(_),$=p.dot(c[1][0],_),tt=p.norm(c[1][0])*G,et=p.dot(c[0][1],_),ot=p.norm(c[0][1])*G,ut=$/tt,lt=et/ot,pt=G<d,nt=ut<g,mt=lt<g;if(pt&&nt&&mt)return k;var K=q(k,c,_);K[0]<y?E?K=[S-(K[0]-y),K[1]]:K=[y+rt.EPSILON,K[1]]:K[0]>S&&(E?K=[y+(K[0]-S),K[1]]:K=[S-rt.EPSILON,K[1]]),K[1]<I?T?K=[K[0],P-(K[1]-I)]:K=[K[0],I+rt.EPSILON]:K[1]>P&&(T?K=[K[0],I+(K[0]-P)]:K=[K[0],P-rt.EPSILON]);var _t=p.norm(p.mul(K[0]-k[0],c[1][0])),Et=p.norm(p.mul(K[1]-k[1],c[0][1]));if(_t+Et<d)return k;k=K,l++}return k},bt.rationalCurveClosestPoint=function(r,i){return N.rationalCurvePoint(r,bt.rationalCurveClosestParam(r,i))},bt.rationalCurveClosestParam=function(r,i){for(var o=1/0,l=0,c=zt.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,g=c.length-1;d<g;){var _=d++,y=c[_][0],S=c[_+1][0],I=c[_].slice(1),P=c[_+1].slice(1),E=Fe.segmentClosestPoint(i,I,P,y,S),T=p.norm(p.sub(i,E.pt));T<o&&(o=T,l=E.u)}for(var k=5,B=0,C,R=1e-4,z=5e-4,U,j=r.knots[0],X=Z.last(r.knots),J=p.normSquared(p.sub(r.controlPoints[0],Z.last(r.controlPoints)))<rt.EPSILON,q=l,G=function(K){return N.rationalCurveDerivatives(r,K,2)},$=function(K,_t,Et){var Ht=p.dot(_t[1],Et),$t=p.dot(_t[2],Et),jt=p.dot(_t[1],_t[1]),Qt=$t+jt;return K-Ht/Qt};B<k;){C=G(q),U=p.sub(C[0],i);var tt=p.norm(U),et=p.dot(C[1],U),ot=p.norm(C[1])*tt,ut=et/ot,lt=tt<R,pt=Math.abs(ut)<z;if(lt&&pt)return q;var nt=$(q,C,U);nt<j?J?nt=X-(nt-j):nt=j:nt>X&&(J?nt=j+(nt-X):nt=X);var mt=p.norm(p.mul(nt-q,C[1]));if(mt<R)return q;q=nt,B++}return q},bt.rationalCurveParamAtArcLength=function(r,i,o,l,c){if(o==null&&(o=.001),i<rt.EPSILON)return r.knots[0];var d;l!=null?d=l:d=yt.decomposeCurveIntoBeziers(r);var g=0;d[g];var _=-rt.EPSILON,y;for(c!=null?y=c:y=[];_<i&&g<d.length;){if(g<y.length?y[g]=y[g]:y[g]=bt.rationalBezierCurveArcLength(r),_+=y[g],i<_+rt.EPSILON)return bt.rationalBezierCurveParamAtArcLength(r,i,o,y[g]);g++}return-1},bt.rationalBezierCurveParamAtArcLength=function(r,i,o,l){if(i<0)return r.knots[0];var c;if(l!=null?c=l:c=bt.rationalBezierCurveArcLength(r),i>c)return Z.last(r.knots);var d=r.knots[0],g=0,_=Z.last(r.knots),y=c,S=0,I=0,P;for(o!=null?P=o:P=rt.TOLERANCE*2;y-g>P;)S=(d+_)/2,I=bt.rationalBezierCurveArcLength(r,S),I>i?(_=S,y=I):(d=S,g=I);return(d+_)/2},bt.rationalCurveArcLength=function(r,i,o){o==null&&(o=16),i==null?i=Z.last(r.knots):i=i;for(var l=yt.decomposeCurveIntoBeziers(r),c=0,d=l[0],g=0;c<l.length&&d.knots[0]+rt.EPSILON<i;){var _=Math.min(Z.last(d.knots),i);g+=bt.rationalBezierCurveArcLength(d,_,o),d=l[++c]}return g},bt.rationalBezierCurveArcLength=function(r,i,o){o==null&&(o=16);var l;i==null?l=Z.last(r.knots):l=i;for(var c=(l-r.knots[0])/2,d=0,g=r.degree+o,_,y,S=0;S<g;){var I=S++;_=c*bt.Tvalues[g][I]+c+r.knots[0],y=N.rationalCurveDerivatives(r,_,1),d+=bt.Cvalues[g][I]*p.norm(y[1])}return c*d};var On=f.eval.KnotMultiplicity=function(r,i){this.knot=r,this.mult=i};x["verb.eval.KnotMultiplicity"]=On,On.__name__=["verb","eval","KnotMultiplicity"],On.prototype={inc:function(){this.mult++},__class__:On};var Ze=f.eval.Check=function(){};x["verb.eval.Check"]=Ze,Ze.__name__=["verb","eval","Check"],Ze.isValidKnotVector=function(r,i){if(r.length==0||r.length<(i+1)*2)return!1;for(var o=Z.first(r),l=0,c=i+1;l<c;){var d=l++;if(Math.abs(r[d]-o)>rt.EPSILON)return!1}o=Z.last(r);for(var g=r.length-i-1,_=r.length;g<_;){var y=g++;if(Math.abs(r[y]-o)>rt.EPSILON)return!1}return Ze.isNonDecreasing(r)},Ze.isNonDecreasing=function(r){for(var i=Z.first(r),o=0,l=r.length;o<l;){var c=o++;if(r[c]<i-rt.EPSILON)return!1;i=r[c]}return!0},Ze.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(!Ze.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},Ze.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(!Ze.isValidKnotVector(r.knotsU,r.degreeU)||!Ze.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 de=f.eval.Divide=function(){};x["verb.eval.Divide"]=de,de.__name__=["verb","eval","Divide"],de.surfaceSplit=function(r,i,o){o==null&&(o=!1);var l,c,d;o?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Ot.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var g,_=[],y=0,S=c+1;y<S;)y++,_.push(i);g=_;for(var I=[],P=[],E=N.knotSpan(c,i,l),T=null,k=0;k<d.length;){var B=d[k];++k,T=yt.curveKnotRefine(new Dt(c,l,B),g),I.push(T.controlPoints.slice(0,E+1)),P.push(T.controlPoints.slice(E+1))}var C=T.knots.slice(0,E+c+2),R=T.knots.slice(E+1);return o?[new ne(r.degreeU,c,r.knotsU.slice(),C,I),new ne(r.degreeU,c,r.knotsU.slice(),R,P)]:(I=Ot.transpose(I),P=Ot.transpose(P),[new ne(c,r.degreeV,C,r.knotsV.slice(),I),new ne(c,r.degreeV,R,r.knotsV.slice(),P)])},de.curveSplit=function(r,i){var o=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],g=0,_=o+1;g<_;)g++,d.push(i);c=d;var y=yt.curveKnotRefine(r,c),S=N.knotSpan(o,i,l),I=y.knots.slice(0,S+o+2),P=y.knots.slice(S+1),E=y.controlPoints.slice(0,S+1),T=y.controlPoints.slice(S+1);return[new Dt(o,I,E),new Dt(o,P,T)]},de.rationalCurveByEqualArcLength=function(r,i){var o=bt.rationalCurveArcLength(r),l=o/i;return de.rationalCurveByArcLength(r,l)},de.rationalCurveByArcLength=function(r,i){var o=yt.decomposeCurveIntoBeziers(r),l=o.map(function(E){return bt.rationalBezierCurveArcLength(E)}),c=p.sum(l),d=[new Bn(r.knots[0],0)];if(i>c)return d;for(var g=i,_=0,y=g,S=0,I=0,P;_<o.length;){for(S+=l[_];y<S+rt.EPSILON;)P=bt.rationalBezierCurveParamAtArcLength(o[_],y-I,rt.TOLERANCE,l[_]),d.push(new Bn(P,y)),y+=g;I+=l[_],_++}return d};var Bn=f.eval.CurveLengthSample=function(r,i){this.u=r,this.len=i};x["verb.eval.CurveLengthSample"]=Bn,Bn.__name__=["verb","eval","CurveLengthSample"],Bn.prototype={__class__:Bn};var N=f.eval.Eval=function(){};x["verb.eval.Eval"]=N,N.__name__=["verb","eval","Eval"],N.rationalCurveTangent=function(r,i){var o=N.rationalCurveDerivatives(r,i,1);return o[1]},N.rationalSurfaceNormal=function(r,i,o){var l=N.rationalSurfaceDerivatives(r,i,o,1);return p.cross(l[1][0],l[0][1])},N.rationalSurfaceDerivatives=function(r,i,o,l){l==null&&(l=1);for(var c=N.surfaceDerivatives(r,i,o,l),d=N.rational2d(c),g=N.weight2d(c),_=[],y=d[0][0].length,S=0,I=l+1;S<I;){var P=S++;_.push([]);for(var E=0,T=l-P+1;E<T;){for(var k=E++,B=d[P][k],C=1,R=k+1;C<R;){var z=C++;p.subMulMutate(B,Vt.get(k,z)*g[0][z],_[P][k-z])}for(var U=1,j=P+1;U<j;){var X=U++;p.subMulMutate(B,Vt.get(P,X)*g[X][0],_[P-X][k]);for(var J=p.zeros1d(y),q=1,G=k+1;q<G;){var $=q++;p.addMulMutate(J,Vt.get(k,$)*g[X][$],_[P-X][k-$])}p.subMulMutate(B,Vt.get(P,X),J)}p.mulMutate(1/g[0][0],B),_[P].push(B)}}return _},N.rationalSurfacePoint=function(r,i,o){return N.dehomogenize(N.surfacePoint(r,i,o))},N.rationalCurveDerivatives=function(r,i,o){o==null&&(o=1);for(var l=N.curveDerivatives(r,i,o),c=N.rational1d(l),d=N.weight1d(l),g=[],_=0,y=o+1;_<y;){for(var S=_++,I=c[S],P=1,E=S+1;P<E;){var T=P++;p.subMulMutate(I,Vt.get(S,T)*d[T],g[S-T])}p.mulMutate(1/d[0],I),g.push(I)}return g},N.rationalCurvePoint=function(r,i){return N.dehomogenize(N.curvePoint(r,i))},N.surfaceDerivatives=function(r,i,o,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return N.surfaceDerivativesGivenNM(c,d,r,i,o,l)},N.surfaceDerivativesGivenNM=function(r,i,o,l,c,d){var g=o.degreeU,_=o.degreeV,y=o.controlPoints,S=o.knotsU,I=o.knotsV;if(!N.areValidRelations(g,y.length,S.length)||!N.areValidRelations(_,y[0].length,I.length))throw new Q("Invalid relations between control points, knot vector, and n");var P=y[0][0].length,E;d<g?E=d:E=g;var T;d<_?T=d:T=_;for(var k=p.zeros3d(d+1,d+1,P),B=N.knotSpanGivenN(r,g,l,S),C=N.knotSpanGivenN(i,_,c,I),R=N.derivativeBasisFunctionsGivenNI(B,l,g,r,S),z=N.derivativeBasisFunctionsGivenNI(C,c,_,i,I),U=p.zeros2d(_+1,P),j=0,X=0,J=E+1;X<J;){for(var q=X++,G=0,$=_+1;G<$;){var tt=G++;U[tt]=p.zeros1d(P);for(var et=0,ot=g+1;et<ot;){var ut=et++;p.addMulMutate(U[tt],R[q][ut],y[B-g+ut][C-_+tt])}}var lt=d-q;lt<T?j=lt:j=T;for(var pt=0,nt=j+1;pt<nt;){var mt=pt++;k[q][mt]=p.zeros1d(P);for(var K=0,_t=_+1;K<_t;){var Et=K++;p.addMulMutate(k[q][mt],z[mt][Et],U[Et])}}}return k},N.surfacePoint=function(r,i,o){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return N.surfacePointGivenNM(l,c,r,i,o)},N.surfacePointGivenNM=function(r,i,o,l,c){var d=o.degreeU,g=o.degreeV,_=o.controlPoints,y=o.knotsU,S=o.knotsV;if(!N.areValidRelations(d,_.length,y.length)||!N.areValidRelations(g,_[0].length,S.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var I=_[0][0].length,P=N.knotSpanGivenN(r,d,l,y),E=N.knotSpanGivenN(i,g,c,S),T=N.basisFunctionsGivenKnotSpanIndex(P,l,d,y),k=N.basisFunctionsGivenKnotSpanIndex(E,c,g,S),B=P-d,C=E,R=p.zeros1d(I),z=p.zeros1d(I),U=0,j=g+1;U<j;){var X=U++;z=p.zeros1d(I),C=E-g+X;for(var J=0,q=d+1;J<q;){var G=J++;p.addMulMutate(z,T[G],_[B+G][C])}p.addMulMutate(R,k[X],z)}return R},N.curveRegularSamplePoints=function(r,i){for(var o=N.curveDerivatives(r,r.knots[0],r.degree),l=1/i,c=l*l,d=o[0],g=p.mul(l,o[1]),_=p.mul(c*.5,o[2]),y=p.mul(c*l*.5,o[3]),S=p.add(_,_),I=p.add(y,y),P=p.mul(.3333333333333333,y),E=[],T=0,k=i+1;T<k;)T++,E.push(N.dehomogenize(d)),p.addAllMutate([d,g,_,P]),p.addAllMutate([g,S,y]),p.addAllMutate([S,I]),p.addAllMutate([_,y]);return E},N.curveRegularSamplePoints2=function(r,i){for(var o=N.curveDerivatives(r,r.knots[0],r.degree),l=1/i,c=l*l,d=o[0],g=p.mul(l,o[1]),_=p.mul(c*.5,o[2]),y=p.mul(c*l*.5,o[3]),S=p.add(_,_),I=p.add(y,y),P=p.mul(.3333333333333333,y),E=[],T=0,k=i+1;T<k;)T++,E.push(N.dehomogenize(d)),p.addAllMutate([d,g,_,P]),p.addAllMutate([g,S,y]),p.addAllMutate([S,I]),p.addAllMutate([_,y]);return E},N.rationalSurfaceRegularSampleDerivatives=function(r,i,o,l){for(var c=N.surfaceRegularSampleDerivatives(r,i,o,l),d=[],g=i+1,_=o+1,y=l+1,S=0;S<g;){var I=S++,P=[];d.push(P);for(var E=0;E<_;){for(var T=E++,k=c[I][T],B=N.rational2d(k),C=N.weight2d(k),R=[],z=B[0][0].length,U=0;U<y;){var j=U++;R.push([]);for(var X=0,J=y-j;X<J;){for(var q=X++,G=B[j][q],$=1,tt=q+1;$<tt;){var et=$++;p.subMulMutate(G,Vt.get(q,et)*C[0][et],R[j][q-et])}for(var ot=1,ut=j+1;ot<ut;){var lt=ot++;p.subMulMutate(G,Vt.get(j,lt)*C[lt][0],R[j-lt][q]);for(var pt=p.zeros1d(z),nt=1,mt=q+1;nt<mt;){var K=nt++;p.addMulMutate(pt,Vt.get(q,K)*C[lt][K],R[j-lt][q-K])}p.subMulMutate(G,Vt.get(j,lt),pt)}p.mulMutate(1/C[0][0],G),R[j].push(G)}}P.push(R)}}return d},N.surfaceRegularSampleDerivatives=function(r,i,o,l){var c=r.degreeU,d=r.degreeV,g=r.controlPoints,_=r.knotsU,y=r.knotsV,S=g[0][0].length;(Z.last(_)-_[0])/i,(Z.last(y)-y[0])/o;for(var I=N.regularlySpacedDerivativeBasisFunctions(c,_,i),P=I.item0,E=I.item1,T=N.regularlySpacedDerivativeBasisFunctions(d,y,o),k=T.item0,B=T.item1,C=[],R=i+1,z=o+1,U=0;U<R;){var j=U++,X=[];C.push(X);for(var J=0;J<z;){var q=J++;X.push(N.surfaceDerivativesGivenBasesKnotSpans(c,d,g,P[j],k[q],E[j],B[q],S,l))}}return C},N.rationalSurfaceRegularSamplePoints=function(r,i,o){return N.dehomogenize2d(N.surfaceRegularSamplePoints(r,i,o))},N.surfaceRegularSamplePoints=function(r,i,o){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,g=r.knotsU,_=r.knotsV,y=d[0][0].length;(Z.last(g)-g[0])/i,(Z.last(_)-_[0])/o;for(var S=N.regularlySpacedBasisFunctions(l,g,i),I=S.item0,P=S.item1,E=N.regularlySpacedBasisFunctions(c,_,o),T=E.item0,k=E.item1,B=[],C=i+1,R=o+1,z=0;z<C;){var U=z++,j=[];B.push(j);for(var X=0;X<R;){var J=X++;j.push(N.surfacePointGivenBasesKnotSpans(l,c,d,I[U],T[J],P[U],k[J],y))}}return B},N.regularlySpacedBasisFunctions=function(r,i,o){for(var l=i.length-r-2,c=(Z.last(i)-i[0])/o,d=[],g=[],_=i[0],y=N.knotSpanGivenN(l,r,_,i),S=o+1,I=0;I<S;){for(I++;_>=i[y+1];)y++;g.push(y),d.push(N.basisFunctionsGivenKnotSpanIndex(y,_,r,i)),_+=c}return new se(g,d)},N.regularlySpacedDerivativeBasisFunctions=function(r,i,o){for(var l=i.length-r-2,c=(Z.last(i)-i[0])/o,d=[],g=[],_=i[0],y=N.knotSpanGivenN(l,r,_,i),S=o+1,I=0;I<S;){for(I++;_>=i[y+1];)y++;g.push(y),d.push(N.derivativeBasisFunctionsGivenNI(y,_,r,l,i)),_+=c}return new se(g,d)},N.surfacePointGivenBasesKnotSpans=function(r,i,o,l,c,d,g,_){for(var y=p.zeros1d(_),S,I=l-r,P=c-i,E=0,T=i+1;E<T;){var k=E++;S=p.zeros1d(_);for(var B=0,C=r+1;B<C;){var R=B++;p.addMulMutate(S,d[R],o[I+R][P])}P++,p.addMulMutate(y,g[k],S)}return y},N.surfaceDerivativesGivenBasesKnotSpans=function(r,i,o,l,c,d,g,_,y){var S=o[0][0].length,I;y<r?I=y:I=r;var P;y<i?P=y:P=i;for(var E=p.zeros3d(I+1,P+1,S),T=p.zeros2d(i+1,S),k=0,B=0,C=I+1;B<C;){for(var R=B++,z=0,U=i+1;z<U;){var j=z++;T[j]=p.zeros1d(S);for(var X=0,J=r+1;X<J;){var q=X++;p.addMulMutate(T[j],d[R][q],o[l-r+q][c-i+j])}}var G=y-R;G<P?k=G:k=P;for(var $=0,tt=k+1;$<tt;){var et=$++;E[R][et]=p.zeros1d(S);for(var ot=0,ut=i+1;ot<ut;){var lt=ot++;p.addMulMutate(E[R][et],g[et][lt],T[lt])}}}return E},N.curveDerivatives=function(r,i,o){var l=r.knots.length-r.degree-2;return N.curveDerivativesGivenN(l,r,i,o)},N.curveDerivativesGivenN=function(r,i,o,l){var c=i.degree,d=i.controlPoints,g=i.knots;if(!N.areValidRelations(c,d.length,g.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,y;l<c?y=l:y=c;for(var S=p.zeros2d(l+1,_),I=N.knotSpanGivenN(r,c,o,g),P=N.derivativeBasisFunctionsGivenNI(I,o,c,y,g),E=0,T=y+1;E<T;)for(var k=E++,B=0,C=c+1;B<C;){var R=B++;p.addMulMutate(S[k],P[k][R],d[I-c+R])}return S},N.curvePoint=function(r,i){var o=r.knots.length-r.degree-2;return N.curvePointGivenN(o,r,i)},N.areValidRelations=function(r,i,o){return i+r+1-o==0},N.curvePointGivenN=function(r,i,o){var l=i.degree,c=i.controlPoints,d=i.knots;if(!N.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var g=N.knotSpanGivenN(r,l,o,d),_=N.basisFunctionsGivenKnotSpanIndex(g,o,l,d),y=p.zeros1d(c[0].length),S=0,I=l+1;S<I;){var P=S++;p.addMulMutate(y,_[P],c[g-l+P])}return y},N.volumePoint=function(r,i,o,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,g=r.knotsW.length-r.degreeW-2;return N.volumePointGivenNML(r,c,d,g,i,o,l)},N.volumePointGivenNML=function(r,i,o,l,c,d,g){if(!N.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!N.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!N.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,y=r.degreeU,S=r.degreeV,I=r.degreeW,P=r.knotsU,E=r.knotsV,T=r.knotsW,k=_[0][0][0].length,B=N.knotSpanGivenN(i,y,c,P),C=N.knotSpanGivenN(o,S,d,E),R=N.knotSpanGivenN(l,I,g,T),z=N.basisFunctionsGivenKnotSpanIndex(B,c,y,P),U=N.basisFunctionsGivenKnotSpanIndex(C,d,S,E),j=N.basisFunctionsGivenKnotSpanIndex(R,g,I,T),X=B-y,J=p.zeros1d(k),q=p.zeros1d(k),G=p.zeros1d(k),$=0,tt=I+1;$<tt;){var et=$++;G=p.zeros1d(k);for(var ot=R-I+et,ut=0,lt=S+1;ut<lt;){var pt=ut++;q=p.zeros1d(k);for(var nt=C-S+pt,mt=0,K=y+1;mt<K;){var _t=mt++;p.addMulMutate(q,z[_t],_[X+_t][nt][ot])}p.addMulMutate(G,U[pt],q)}p.addMulMutate(J,j[et],G)}return J},N.derivativeBasisFunctions=function(r,i,o){var l=N.knotSpan(i,r,o),c=o.length-1,d=c-i-1;return N.derivativeBasisFunctionsGivenNI(l,r,i,d,o)},N.derivativeBasisFunctionsGivenNI=function(r,i,o,l,c){var d=p.zeros2d(o+1,o+1),g=p.zeros1d(o+1),_=p.zeros1d(o+1),y=0,S=0;d[0][0]=1;for(var I=1,P=o+1;I<P;){var E=I++;g[E]=i-c[r+1-E],_[E]=c[r+E]-i,y=0;for(var T=0;T<E;){var k=T++;d[E][k]=_[k+1]+g[E-k],S=d[k][E-1]/d[E][k],d[k][E]=y+_[k+1]*S,y=g[E-k]*S}d[E][E]=y}for(var B=p.zeros2d(l+1,o+1),C=p.zeros2d(2,o+1),R=0,z=1,U=0,j=0,X=0,J=0,q=0,G=0,$=o+1;G<$;){var tt=G++;B[0][tt]=d[tt][o]}for(var et=0,ot=o+1;et<ot;){var ut=et++;R=0,z=1,C[0][0]=1;for(var lt=1,pt=l+1;lt<pt;){var nt=lt++;U=0,j=ut-nt,X=o-nt,ut>=nt&&(C[z][0]=C[R][0]/d[X+1][j],U=C[z][0]*d[j][X]),j>=-1?J=1:J=-j,ut-1<=X?q=nt-1:q=o-ut;for(var mt=J,K=q+1;mt<K;){var _t=mt++;C[z][_t]=(C[R][_t]-C[R][_t-1])/d[X+1][j+_t],U+=C[z][_t]*d[j+_t][X]}ut<=X&&(C[z][nt]=-C[R][nt-1]/d[X+1][ut],U+=C[z][nt]*d[ut][X]),B[nt][ut]=U;var Et=R;R=z,z=Et}}for(var Ht=o,$t=1,jt=l+1;$t<jt;){for(var Qt=$t++,Ce=0,Qe=o+1;Ce<Qe;){var Pe=Ce++;B[Qt][Pe]*=Ht}Ht*=o-Qt}return B},N.basisFunctions=function(r,i,o){var l=N.knotSpan(i,r,o);return N.basisFunctionsGivenKnotSpanIndex(l,r,i,o)},N.basisFunctionsGivenKnotSpanIndex=function(r,i,o,l){var c=p.zeros1d(o+1),d=p.zeros1d(o+1),g=p.zeros1d(o+1),_=0,y=0;c[0]=1;for(var S=1,I=o+1;S<I;){var P=S++;d[P]=i-l[r+1-P],g[P]=l[r+P]-i,_=0;for(var E=0;E<P;){var T=E++;y=c[T]/(g[T+1]+d[P-T]),c[T]=_+g[T+1]*y,_=d[P-T]*y}c[P]=_}return c},N.knotSpan=function(r,i,o){return N.knotSpanGivenN(o.length-r-2,r,i,o)},N.knotSpanGivenN=function(r,i,o,l){if(o>l[r+1]-rt.EPSILON)return r;if(o<l[i]+rt.EPSILON)return i;for(var c=i,d=r+1,g=Math.floor((c+d)/2);o<l[g]||o>=l[g+1];)o<l[g]?d=g:c=g,g=Math.floor((c+d)/2);return g},N.dehomogenize=function(r){for(var i=r.length,o=[],l=r[i-1],c=r.length-1,d=0;d<c;){var g=d++;o.push(r[g]/l)}return o},N.rational1d=function(r){var i=r[0].length-1;return r.map(function(o){return o.slice(0,i)})},N.rational2d=function(r){return r.map(N.rational1d)},N.weight1d=function(r){var i=r[0].length-1;return r.map(function(o){return o[i]})},N.weight2d=function(r){return r.map(N.weight1d)},N.dehomogenize1d=function(r){return r.map(N.dehomogenize)},N.dehomogenize2d=function(r){return r.map(N.dehomogenize1d)},N.homogenize1d=function(r,i){var o=r.length,l=r[0].length,c=[],d=0,g=[],_;i!=null?_=i:_=p.rep(r.length,1);for(var y=0;y<o;){var S=y++,I=[];g=r[S],d=_[S];for(var P=0;P<l;){var E=P++;I.push(g[E]*d)}I.push(d),c.push(I)}return c},N.homogenize2d=function(r,i){var o=r.length,l=[],c;if(i!=null)c=i;else{for(var d=[],g=0;g<o;)g++,d.push(p.rep(r[0].length,1));c=d}for(var _=0;_<o;){var y=_++;l.push(N.homogenize1d(r[y],c[y]))}return l};var ht=f.eval.Intersect=function(){};x["verb.eval.Intersect"]=ht,ht.__name__=["verb","eval","Intersect"],ht.surfaces=function(r,i,o){var l=zt.rationalSurfaceAdaptive(r),c=zt.rationalSurfaceAdaptive(i),d=ht.meshes(l,c),g=d.map(function(_){return _.map(function(y){return ht.surfacesAtPointWithEstimate(r,i,y.uv0,y.uv1,o)})});return g.map(function(_){return gt.rationalInterpCurve(_.map(function(y){return y.point}),3)})},ht.surfacesAtPointWithEstimate=function(r,i,o,l,c){var d,g,_,y,S,I,P,E,T,k,B,C,R,z=5,U=0;do{if(d=N.rationalSurfaceDerivatives(r,o[0],o[1],1),g=d[0][0],y=d[1][0],S=d[0][1],_=p.normalized(p.cross(y,S)),I=p.dot(_,g),P=N.rationalSurfaceDerivatives(i,l[0],l[1],1),E=P[0][0],k=P[1][0],B=P[0][1],T=p.normalized(p.cross(k,B)),C=p.dot(T,E),R=p.distSquared(g,E),R<c*c)break;var j=p.normalized(p.cross(_,T)),X=p.dot(j,g),J=ht.threePlanes(_,I,T,C,j,X);if(J==null)throw new Q("panic!");var q=p.sub(J,g),G=p.sub(J,E),$=p.cross(y,_),tt=p.cross(S,_),et=p.cross(k,T),ot=p.cross(B,T),ut=p.dot(tt,q)/p.dot(tt,y),lt=p.dot($,q)/p.dot($,S),pt=p.dot(ot,G)/p.dot(ot,k),nt=p.dot(et,G)/p.dot(et,B);o=p.add([ut,lt],o),l=p.add([pt,nt],l),U++}while(U<z);return new as(o,l,g,R)},ht.meshes=function(r,i,o,l){o==null&&(o=new dr(r)),l==null&&(l=new dr(i));var c=ht.boundingBoxTrees(o,l,0),d=Z.unique(c.map(function(g){return ht.triangles(r,g.item0,i,g.item1)}).filter(function(g){return g!=null}).filter(function(g){return p.distSquared(g.min.point,g.max.point)>rt.EPSILON}),function(g,_){var y=p.sub(g.min.uv0,_.min.uv0),S=p.dot(y,y),I=p.sub(g.max.uv0,_.max.uv0),P=p.dot(I,I),E=p.sub(g.min.uv0,_.max.uv0),T=p.dot(E,E),k=p.sub(g.max.uv0,_.min.uv0),B=p.dot(k,k);return S<rt.EPSILON&&P<rt.EPSILON||T<rt.EPSILON&&B<rt.EPSILON});return ht.makeMeshIntersectionPolylines(d)},ht.meshSlices=function(r,i,o,l){for(var c=new Hr(r),d=c.boundingBox(),g=d.min[0],_=d.min[1],y=d.max[0],S=d.max[1],I=p.span(i,o,l),P=[],E=0;E<I.length;){var T=I[E];++E;var k=[[g,_,T],[y,_,T],[y,S,T],[g,S,T]],B=[[0,0],[1,0],[1,1],[0,1]],C=[[0,1,2],[0,2,3]],R=new Je(C,k,null,B);P.push(ht.meshes(r,R,c))}return P},ht.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var i=0;i<r.length;){var o=r[i];++i,o.max.opp=o.min,o.min.opp=o.max}for(var l=ht.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var g=r[d];++d,c.push(g.min),c.push(g.max)}for(var _=0;_<c.length;){var y=c[_];if(++_,y.adj==null){var S=ht.lookupAdjacentSegment(y,l,r.length);S!=null&&S.adj==null&&(y.adj=S,S.adj=y)}}var I=c.filter(function(z){return z.adj==null});I.length==0&&(I=c);for(var P=[],E=0,T=!1;I.length!=0;){var k=I.pop();if(!k.visited){for(var B=[],C=k;C!=null&&!(C.visited||(C.visited=!0,C.opp.visited=!0,B.push(C),E+=2,C=C.opp.adj,C==k)););B.length>0&&(B.push(B[B.length-1].opp),P.push(B))}if(I.length==0&&c.length>0&&(T||E<c.length)){T=!0;var R=c.pop();I.push(R)}}return P},ht.kdTreeFromSegments=function(r){for(var i=[],o=0;o<r.length;){var l=r[o];++o,i.push(new Nn(l.min.point,l.min)),i.push(new Nn(l.max.point,l.max))}return new ls(i,p.distSquared)},ht.lookupAdjacentSegment=function(r,i,o){var l=i.nearest(r.point,o,rt.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},ht.curveAndSurface=function(r,i,o,l,c){o==null&&(o=.001),l!=null?l=l:l=new cr(r),c!=null?c=c:c=new Dr(i);var d=ht.boundingBoxTrees(l,c,o);return Z.unique(d.map(function(g){var _=g.item0,y=g.item1,S=Z.first(_.knots),I=Z.last(_.knots),P=(S+I)/2,E=Z.first(y.knotsU),T=Z.last(y.knotsU),k=Z.first(y.knotsV),B=Z.last(y.knotsV),C=[(E+T)/2,(k+B)/2];return ht.curveAndSurfaceWithEstimate(_,y,[P].concat(C),o)}).filter(function(g){return p.distSquared(g.curvePoint,g.surfacePoint)<o*o}),function(g,_){return Math.abs(g.u-_.u)<.5*o})},ht.curveAndSurfaceWithEstimate=function(r,i,o,l){l==null&&(l=.001);var c=function(y){var S=N.rationalCurvePoint(r,y[0]),I=N.rationalSurfacePoint(i,y[1],y[2]),P=p.sub(S,I);return p.dot(P,P)},d=function(y){var S=N.rationalCurveDerivatives(r,y[0],1),I=N.rationalSurfaceDerivatives(i,y[1],y[2],1),P=p.sub(I[0][0],S[0]),E=p.mul(-1,S[1]),T=I[1][0],k=I[0][1];return[2*p.dot(E,P),2*p.dot(T,P),2*p.dot(k,P)]},g=tr.uncmin(c,o,l*l,d),_=g.solution;return new ss(_[0],[_[1],_[2]],N.rationalCurvePoint(r,_[0]),N.rationalSurfacePoint(i,_[1],_[2]))},ht.polylineAndMesh=function(r,i,o){for(var l=ht.boundingBoxTrees(new pr(r),new dr(i),o),c=[],d=0;d<l.length;){var g=l[d];++d;var _=g.item0,y=g.item1,S=ht.segmentWithTriangle(r.points[_],r.points[_+1],i.points,i.faces[y]);if(S!=null){var I=S.point,P=p.lerp(S.p,[r.params[_]],[r.params[_+1]])[0],E=ie.triangleUVFromPoint(i,y,I);c.push(new is(I,P,E,_,y))}}return c},ht.boundingBoxTrees=function(r,i,o){o==null&&(o=1e-9);var l=[],c=[];l.push(r),c.push(i);for(var d=[];l.length>0;){var g=l.pop(),_=c.pop();if(!(g.empty()||_.empty())&&g.boundingBox().intersects(_.boundingBox(),o)){var y=g.indivisible(o),S=_.indivisible(o);if(y&&S){d.push(new se(g.yield(),_.yield()));continue}else if(y&&!S){var I=_.split();l.push(g),c.push(I.item1),l.push(g),c.push(I.item0);continue}else if(!y&&S){var P=g.split();l.push(P.item1),c.push(_),l.push(P.item0),c.push(_);continue}var E=g.split(),T=_.split();l.push(E.item1),c.push(T.item1),l.push(E.item1),c.push(T.item0),l.push(E.item0),c.push(T.item1),l.push(E.item0),c.push(T.item0)}}return d},ht.curves=function(r,i,o){var l=ht.boundingBoxTrees(new cr(r),new cr(i),0);return Z.unique(l.map(function(c){return ht.curvesWithEstimate(r,i,Z.first(c.item0.knots),Z.first(c.item1.knots),o)}).filter(function(c){return p.distSquared(c.point0,c.point1)<o}),function(c,d){return Math.abs(c.u0-d.u0)<o*5})},ht.curvesWithEstimate=function(r,i,o,l,c){var d=function(E){var T=N.rationalCurvePoint(r,E[0]),k=N.rationalCurvePoint(i,E[1]),B=p.sub(T,k);return p.dot(B,B)},g=function(E){var T=N.rationalCurveDerivatives(r,E[0],1),k=N.rationalCurveDerivatives(i,E[1],1),B=p.sub(T[0],k[0]),C=T[1],R=p.mul(-1,k[1]);return[2*p.dot(C,B),2*p.dot(R,B)]},_=tr.uncmin(d,[o,l],c*c,g),y=_.solution[0],S=_.solution[1],I=N.rationalCurvePoint(r,y),P=N.rationalCurvePoint(i,S);return new on(I,P,y,S)},ht.triangles=function(r,i,o,l){var c=r.faces[i],d=o.faces[l],g=ie.getTriangleNorm(r.points,c),_=ie.getTriangleNorm(o.points,d),y=r.points[c[0]],S=o.points[d[0]],I=ht.planes(y,g,S,_);if(I==null)return null;var P=ht.clipRayInCoplanarTriangle(I,r,i);if(P==null)return null;var E=ht.clipRayInCoplanarTriangle(I,o,l);if(E==null)return null;var T=ht.mergeTriangleClipIntervals(P,E,r,i,o,l);return T==null?null:new Le(new Wr(T.min.uv0,T.min.uv1,T.min.point,i,l),new Wr(T.max.uv0,T.max.uv1,T.max.point,i,l))},ht.clipRayInCoplanarTriangle=function(r,i,o){for(var l=i.faces[o],c=[i.points[l[0]],i.points[l[1]],i.points[l[2]]],d=[i.uvs[l[0]],i.uvs[l[1]],i.uvs[l[2]]],g=[p.sub(d[1],d[0]),p.sub(d[2],d[1]),p.sub(d[0],d[2])],_=[p.sub(c[1],c[0]),p.sub(c[2],c[1]),p.sub(c[0],c[2])],y=_.map(p.normalized),S=_.map(p.norm),I=null,P=null,E=0;E<3;){var T=E++,k=c[T],B=y[T],C=ht.rays(k,B,r.origin,r.dir);if(C!=null){var R=C.u0,z=C.u1;R<-rt.EPSILON||R>S[T]+rt.EPSILON||((I==null||z<I.u)&&(I=new kn(z,p.onRay(r.origin,r.dir,z),p.onRay(d[T],g[T],R/S[T]))),(P==null||z>P.u)&&(P=new kn(z,p.onRay(r.origin,r.dir,z),p.onRay(d[T],g[T],R/S[T]))))}}return P==null||I==null?null:new Le(I,P)},ht.mergeTriangleClipIntervals=function(r,i,o,l,c,d){if(i.min.u>r.max.u+rt.EPSILON||r.min.u>i.max.u+rt.EPSILON)return null;var g;r.min.u>i.min.u?g=new se(r.min,0):g=new se(i.min,1);var _;r.max.u<i.max.u?_=new se(r.max,0):_=new se(i.max,1);var y=new Le(new Wr(null,null,g.item0.point,l,d),new Wr(null,null,_.item0.point,l,d));return g.item1==0?(y.min.uv0=g.item0.uv,y.min.uv1=ie.triangleUVFromPoint(c,d,g.item0.point)):(y.min.uv0=ie.triangleUVFromPoint(o,l,g.item0.point),y.min.uv1=g.item0.uv),_.item1==0?(y.max.uv0=_.item0.uv,y.max.uv1=ie.triangleUVFromPoint(c,d,_.item0.point)):(y.max.uv0=ie.triangleUVFromPoint(o,l,_.item0.point),y.max.uv1=_.item0.uv),y},ht.planes=function(r,i,o,l){var c=p.cross(i,l);if(p.dot(c,c)<rt.EPSILON)return null;var d=0,g=Math.abs(c[0]),_=Math.abs(c[1]),y=Math.abs(c[2]);_>g&&(d=1,g=_),y>g&&(d=2,g=y);var S,I,P,E;d==0?(S=i[1],I=i[2],P=l[1],E=l[2]):d==1?(S=i[0],I=i[2],P=l[0],E=l[2]):(S=i[0],I=i[1],P=l[0],E=l[1]);var T=-p.dot(r,i),k=-p.dot(o,l),B=S*E-I*P,C=(I*k-T*E)/B,R=(T*P-S*k)/B,z;return d==0?z=[0,C,R]:d==1?z=[C,0,R]:z=[C,R,0],new Tn(z,p.normalized(c))},ht.threePlanes=function(r,i,o,l,c,d){var g=p.cross(o,c),_=p.dot(r,g);if(Math.abs(_)<rt.EPSILON)return null;var y=p.sub(p.mul(d,o),p.mul(l,c)),S=p.add(p.mul(i,g),p.cross(r,y));return p.mul(1/_,S)},ht.polylines=function(r,i,o){for(var l=ht.boundingBoxTrees(new pr(r),new pr(i),o),c=[],d=0;d<l.length;){var g=l[d];++d;var _=g.item0,y=g.item1,S=ht.segments(r.points[_],r.points[_+1],i.points[y],i.points[y+1],o);S!=null&&(S.u0=p.lerp(S.u0,[r.params[_]],[r.params[_+1]])[0],S.u1=p.lerp(S.u1,[i.params[y]],[i.params[y+1]])[0],c.push(S))}return c},ht.segments=function(r,i,o,l,c){var d=p.sub(i,r),g=Math.sqrt(p.dot(d,d)),_=p.mul(1/g,d),y=p.sub(l,o),S=Math.sqrt(p.dot(y,y)),I=p.mul(1/S,y),P=ht.rays(r,_,o,I);if(P!=null){var E=Math.min(Math.max(0,P.u0/g),1),T=Math.min(Math.max(0,P.u1/S),1),k=p.onRay(r,d,E),B=p.onRay(o,y,T),C=p.distSquared(k,B);if(C<c*c)return new on(k,B,E,T)}return null},ht.rays=function(r,i,o,l){var c=p.dot(i,l),d=p.dot(i,o),g=p.dot(i,r),_=p.dot(l,o),y=p.dot(l,r),S=p.dot(i,i),I=p.dot(l,l),P=S*I-c*c;if(Math.abs(P)<rt.EPSILON)return null;var E=c*(d-g)-S*(_-y),T=E/P,k=(d-g+T*c)/S,B=p.onRay(r,i,k),C=p.onRay(o,l,T);return new on(B,C,k,T)},ht.segmentWithTriangle=function(r,i,o,l){var c=o[l[0]],d=o[l[1]],g=o[l[2]],_=p.sub(d,c),y=p.sub(g,c),S=p.cross(_,y),I=p.sub(i,r),P=p.sub(r,c),E=-p.dot(S,P),T=p.dot(S,I);if(Math.abs(T)<rt.EPSILON)return null;var k=E/T;if(k<0||k>1)return null;var B=p.add(r,p.mul(k,I)),C=p.dot(_,y),R=p.dot(_,_),z=p.dot(y,y),U=p.sub(B,c),j=p.dot(U,_),X=p.dot(U,y),J=C*C-R*z;if(Math.abs(J)<rt.EPSILON)return null;var q=(C*X-z*j)/J,G=(C*j-R*X)/J;return q>1+rt.EPSILON||G>1+rt.EPSILON||G<-rt.EPSILON||q<-rt.EPSILON||q+G>1+rt.EPSILON?null:new os(B,q,G,k)},ht.segmentAndPlane=function(r,i,o,l){var c=p.dot(l,p.sub(i,r));if(Math.abs(c)<rt.EPSILON)return null;var d=p.dot(l,p.sub(o,r)),g=d/c;return g>1+rt.EPSILON||g<-rt.EPSILON?null:{p:g}};var gt=f.eval.Make=function(){};x["verb.eval.Make"]=gt,gt.__name__=["verb","eval","Make"],gt.rationalTranslationalSurface=function(r,i){for(var o=N.rationalCurvePoint(i,Z.first(i.knots)),l=Z.first(i.knots),c=Z.last(i.knots),d=2*i.controlPoints.length,g=(c-l)/(d-1),_=[],y=0;y<d;){var S=y++,I=p.sub(N.rationalCurvePoint(i,l+S*g),o),P=yt.rationalCurveTransform(r,[[1,0,0,I[0]],[0,1,0,I[1]],[0,0,1,I[2]],[0,0,0,1]]);_.push(P)}return gt.loftedSurface(_)},gt.surfaceBoundaryCurves=function(r){var i=gt.surfaceIsocurve(r,Z.first(r.knotsU),!1),o=gt.surfaceIsocurve(r,Z.last(r.knotsU),!1),l=gt.surfaceIsocurve(r,Z.first(r.knotsV),!0),c=gt.surfaceIsocurve(r,Z.last(r.knotsV),!0);return[i,o,l,c]},gt.surfaceIsocurve=function(r,i,o){o==null&&(o=!1);var l;o?l=r.knotsV:l=r.knotsU;var c;o?c=r.degreeV:c=r.degreeU;for(var d=bt.knotMultiplicities(l),g=-1,_=0,y=d.length;_<y;){var S=_++;if(Math.abs(i-d[S].knot)<rt.EPSILON){g=S;break}}var I=c+1;g>=0&&(I=I-d[g].mult);var P;I>0?P=yt.surfaceKnotRefine(r,p.rep(I,i),o):P=r;var E=N.knotSpan(c,i,l);return Math.abs(i-Z.first(l))<rt.EPSILON?E=0:Math.abs(i-Z.last(l))<rt.EPSILON&&(E=(o?P.controlPoints[0].length:P.controlPoints.length)-1),o?new Dt(P.degreeU,P.knotsU,function(T){for(var k,B=[],C=0,R=P.controlPoints;C<R.length;){var z=R[C];++C,B.push(z[E])}return k=B,k}()):new Dt(P.degreeV,P.knotsV,P.controlPoints[E])},gt.loftedSurface=function(r,i){r=yt.unifyCurveKnotVectors(r);var o=r[0].degree;i==null&&(i=3),i>r.length-1&&(i=r.length-1);for(var l=r[0].knots,c=[],d=[],g=0,_=r[0].controlPoints.length;g<_;){var y=[g++],S=r.map(function(P){return function(E){return E.controlPoints[P[0]]}}(y)),I=gt.rationalInterpCurve(S,i,!0);d.push(I.controlPoints),c=I.knots}return new ne(o,i,l,c,d)},gt.clonedCurve=function(r){return new Dt(r.degree,r.knots.slice(),r.controlPoints.map(function(i){return i.slice()}))},gt.rationalBezierCurve=function(r,i){for(var o=r.length-1,l=[],c=0,d=o+1;c<d;)c++,l.push(0);for(var g=0,_=o+1;g<_;)g++,l.push(1);return i==null&&(i=p.rep(r.length,1)),new Dt(o,l,N.homogenize1d(r,i))},gt.fourPointSurface=function(r,i,o,l,c){c==null&&(c=3);for(var d=c,g=[],_=0,y=c+1;_<y;){for(var S=_++,I=[],P=0,E=c+1;P<E;){var T=P++,k=1-S/d,B=p.lerp(k,r,i),C=p.lerp(k,l,o),R=p.lerp(1-T/d,B,C);R.push(1),I.push(R)}g.push(I)}var z=p.rep(c+1,0),U=p.rep(c+1,1);return new ne(c,c,z.concat(U),z.concat(U),g)},gt.ellipseArc=function(r,i,o,l,c){var d=p.norm(i),g=p.norm(o);i=p.normalized(i),o=p.normalized(o),c<l&&(c=2*Math.PI+l);var _=c-l,y=0;_<=Math.PI/2?y=1:_<=Math.PI?y=2:_<=3*Math.PI/2?y=3:y=4;var S=_/y,I=Math.cos(S/2),P=p.add(r,p.add(p.mul(d*Math.cos(l),i),p.mul(g*Math.sin(l),o))),E=p.sub(p.mul(Math.cos(l),o),p.mul(Math.sin(l),i)),T=[],k=p.zeros1d(2*y+3),B=0,C=l,R=p.zeros1d(y*2);T[0]=P,R[0]=1;for(var z=1,U=y+1;z<U;){var j=z++;C+=S;var X=p.add(r,p.add(p.mul(d*Math.cos(C),i),p.mul(g*Math.sin(C),o)));R[B+2]=1,T[B+2]=X;var J=p.sub(p.mul(Math.cos(C),o),p.mul(Math.sin(C),i)),q=ht.rays(P,p.mul(1/p.norm(E),E),X,p.mul(1/p.norm(J),J)),G=p.add(P,p.mul(q.u0,E));R[B+1]=I,T[B+1]=G,B+=2,j<y&&(P=X,E=J)}for(var $=2*y+1,tt=0;tt<3;){var et=tt++;k[et]=0,k[et+$]=1}switch(y){case 2:k[3]=k[4]=.5;break;case 3:k[3]=k[4]=.3333333333333333,k[5]=k[6]=.6666666666666666;break;case 4:k[3]=k[4]=.25,k[5]=k[6]=.5,k[7]=k[8]=.75;break}return new Dt(2,k,N.homogenize1d(T,R))},gt.arc=function(r,i,o,l,c,d){return gt.ellipseArc(r,p.mul(l,p.normalized(i)),p.mul(l,p.normalized(o)),c,d)},gt.polyline=function(r){for(var i=[0,0],o=0,l=0,c=r.length-1;l<c;){var d=l++;o+=p.dist(r[d],r[d+1]),i.push(o)}i.push(o),i=p.mul(1/o,i);for(var g,_=[],y=0,S=r.length;y<S;)y++,_.push(1);return g=_,new Dt(1,i,N.homogenize1d(r.slice(0),g))},gt.extrudedSurface=function(r,i,o){for(var l=[[],[],[]],c=[[],[],[]],d=N.dehomogenize1d(o.controlPoints),g=N.weight1d(o.controlPoints),_=p.mul(i,r),y=p.mul(.5*i,r),S=0,I=d.length;S<I;){var P=S++;l[2][P]=d[P],l[1][P]=p.add(y,d[P]),l[0][P]=p.add(_,d[P]),c[0][P]=g[P],c[1][P]=g[P],c[2][P]=g[P]}return new ne(2,o.degree,[0,0,0,1,1,1],o.knots,N.homogenize2d(l,c))},gt.cylindricalSurface=function(r,i,o,l,c){var d=p.cross(r,i),g=gt.arc(o,i,d,c,0,2*Math.PI);return gt.extrudedSurface(r,l,g)},gt.revolvedSurface=function(r,i,o,l){var c=N.dehomogenize1d(r.controlPoints),d=N.weight1d(r.controlPoints),g,_;l<=Math.PI/2?(g=1,_=p.zeros1d(6+2*(g-1))):l<=Math.PI?(g=2,_=p.zeros1d(6+2*(g-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(g=3,_=p.zeros1d(6+2*(g-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(g=4,_=p.zeros1d(6+2*(g-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var y=l/g,S=3+2*(g-1),I=0;I<3;){var P=I++;_[P]=0,_[S+P]=1}for(var E=Math.cos(y/2),T=0,k=p.zeros1d(g+1),B=p.zeros1d(g+1),C=p.zeros3d(2*g+1,c.length,3),R=p.zeros2d(2*g+1,c.length),z=1,U=g+1;z<U;){var j=z++;T+=y,B[j]=Math.cos(T),k[j]=Math.sin(T)}for(var X=0,J=c.length;X<J;){var q=X++,G=Fe.rayClosestPoint(c[q],i,o),$=p.sub(c[q],G),tt=p.norm($),et=p.cross(o,$);tt>rt.EPSILON&&($=p.mul(1/tt,$),et=p.mul(1/tt,et)),C[0][q]=c[q];var ot=c[q];R[0][q]=d[q];for(var ut=et,lt=0,pt=1,nt=g+1;pt<nt;){var mt=pt++,K;tt==0?K=G:K=p.add(G,p.add(p.mul(tt*B[mt],$),p.mul(tt*k[mt],et))),C[lt+2][q]=K,R[lt+2][q]=d[q];var _t=p.sub(p.mul(B[mt],et),p.mul(k[mt],$));if(tt==0)C[lt+1][q]=G;else{var Et=ht.rays(ot,p.mul(1/p.norm(ut),ut),K,p.mul(1/p.norm(_t),_t)),Ht=p.add(ot,p.mul(Et.u0,ut));C[lt+1][q]=Ht}R[lt+1][q]=E*d[q],lt+=2,mt<g&&(ot=K,ut=_t)}}return new ne(2,r.degree,_,r.knots,N.homogenize2d(C,R))},gt.sphericalSurface=function(r,i,o,l){var c=gt.arc(r,p.mul(-1,i),o,l,0,Math.PI);return gt.revolvedSurface(c,r,i,2*Math.PI)},gt.conicalSurface=function(r,i,o,l,c){var d=2*Math.PI,g=1,_=[p.add(o,p.mul(l,r)),p.add(o,p.mul(c,i))],y=[0,0,1,1],S=[1,1],I=new Dt(g,y,N.homogenize1d(_,S));return gt.revolvedSurface(I,o,r,d)},gt.rationalInterpCurve=function(r,i,o,l,c){if(o==null&&(o=!1),i==null&&(i=3),r.length<i+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],g=1,_=r.length;g<_;){var y=g++,S=p.norm(p.sub(r[y],r[y-1])),I=d[d.length-1];d.push(I+S)}for(var P=d[d.length-1],E=0,T=d.length;E<T;){var k=E++;d[k]=d[k]/P}var B=p.rep(i+1,0),C=l!=null&&c!=null,R;C?R=0:R=1;var z;C?z=d.length-i+1:z=d.length-i;for(var U=R;U<z;){for(var j=U++,X=0,J=0;J<i;){var q=J++;X+=d[j+q]}B.push(1/i*X)}var G=B.concat(p.rep(i+1,1)),$=[],tt;C?tt=r.length+1:tt=r.length-1;var et;C?et=r.length-(i-1):et=r.length-(i+1);for(var ot=0;ot<d.length;){var ut=d[ot];++ot;var lt=N.knotSpanGivenN(tt,i,ut,G),pt=N.basisFunctionsGivenKnotSpanIndex(lt,ut,i,G),nt=lt-i,mt=p.zeros1d(nt),K=p.zeros1d(et-nt);$.push(mt.concat(pt).concat(K))}if(C){var _t=$[0].length-2,Et=[-1,1].concat(p.zeros1d(_t)),Ht=p.zeros1d(_t).concat([-1,1]);Z.spliceAndInsert($,1,0,Et),Z.spliceAndInsert($,$.length-1,0,Ht)}for(var $t=r[0].length,jt=[],Qt=(1-G[G.length-i-2])/i,Ce=G[i+1]/i,Qe=0;Qe<$t;){var Pe=[Qe++],be;if(!C)be=r.map(function(ir){return function(xr){return xr[ir[0]]}}(Pe));else{be=[r[0][Pe[0]]],be.push(Ce*l[Pe[0]]);for(var Oe=1,Ue=r.length-1;Oe<Ue;){var rr=Oe++;be.push(r[rr][Pe[0]])}be.push(Qt*c[Pe[0]]),be.push(Z.last(r)[Pe[0]])}var mr=Ot.solve($,be);jt.push(mr)}var nr=Ot.transpose(jt);if(!o){var sr=p.rep(nr.length,1);nr=N.homogenize1d(nr,sr)}return new Dt(i,G,nr)};var yt=f.eval.Modify=function(){};x["verb.eval.Modify"]=yt,yt.__name__=["verb","eval","Modify"],yt.curveReverse=function(r){return new Dt(r.degree,yt.knotsReverse(r.knots),Z.reversed(r.controlPoints))},yt.surfaceReverse=function(r,i){return i==null&&(i=!1),i?new ne(r.degreeU,r.degreeV,r.knotsU,yt.knotsReverse(r.knotsV),function(o){for(var l,c=[],d=0,g=r.controlPoints;d<g.length;){var _=g[d];++d,c.push(Z.reversed(_))}return l=c,l}()):new ne(r.degreeU,r.degreeV,yt.knotsReverse(r.knotsU),r.knotsV,Z.reversed(r.controlPoints))},yt.knotsReverse=function(r){var i=Z.first(r);Z.last(r);for(var o=[i],l=r.length,c=1;c<l;){var d=c++;o.push(o[d-1]+(r[l-d]-r[l-d-1]))}return o},yt.unifyCurveKnotVectors=function(r){r=r.map(gt.clonedCurve);for(var i=O.fold(r,function(G,$){return yt.imax(G.degree,$)},0),o=0,l=r.length;o<l;){var c=o++;r[c].degree<i&&(r[c]=yt.curveElevateDegree(r[c],i))}for(var d,g=[],_=0;_<r.length;){var y=r[_];++_,g.push(new Le(Z.first(y.knots),Z.last(y.knots)))}d=g;for(var S=0,I=r.length;S<I;){var P=S++,E=[d[P].min];r[P].knots=r[P].knots.map(function(G){return function($){return $-G[0]}}(E))}for(var T=d.map(function(G){return G.max-G.min}),k=O.fold(T,function(G,$){return Math.max(G,$)},0),B=0,C=r.length;B<C;){var R=B++,z=[k/T[R]];r[R].knots=r[R].knots.map(function(G){return function($){return $*G[0]}}(z))}for(var U=O.fold(r,function(G,$){return p.sortedSetUnion(G.knots,$)},[]),j=0,X=r.length;j<X;){var J=j++,q=p.sortedSetSub(U,r[J].knots);q.length==0&&(r[J]=r[J]),r[J]=yt.curveKnotRefine(r[J],q)}return r},yt.imin=function(r,i){return r<i?r:i},yt.imax=function(r,i){return r>i?r:i},yt.curveElevateDegree=function(r,i){if(i<=r.degree)return r;var o=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,g=i-r.degree,_=r.controlPoints[0].length,y=p.zeros2d(l+g+1,l+1),S=[],I=[],P=[],E=o+l+1,T=i,k=Math.floor(T/2),B=[],C=[];y[0][0]=1,y[T][l]=1;for(var R=1,z=k+1;R<z;)for(var U=R++,j=1/Vt.get(T,U),X=yt.imin(l,U),J=yt.imax(0,U-g),q=X+1;J<q;){var G=J++;y[U][G]=j*Vt.get(l,G)*Vt.get(g,U-G)}for(var $=k+1;$<T;)for(var tt=$++,et=yt.imin(l,tt),ot=yt.imax(0,tt-g),ut=et+1;ot<ut;){var lt=ot++;y[tt][lt]=y[T-tt][l-lt]}var pt=T+1,nt=-1,mt=l,K=l+1,_t=1,Et=c[0];B[0]=d[0];for(var Ht=0,$t=T+1;Ht<$t;){var jt=Ht++;C[jt]=Et}for(var Qt=0,Ce=l+1;Qt<Ce;){var Qe=Qt++;S[Qe]=d[Qe]}for(;K<E;){for(var Pe=K;K<E&&c[K]==c[K+1];)K=K+1;var be=K-Pe+1,Oe=c[K],Ue=nt;nt=l-be;var rr;Ue>0?rr=Math.floor((Ue+2)/2):rr=1;var mr;if(nt>0?mr=Math.floor(T-(nt+1)/2):mr=T,nt>0){for(var nr=Oe-Et,sr=[],ir=l;ir>be;)sr[ir-be-1]=nr/(c[mt+ir]-Et),ir--;for(var xr=1,Fn=nt+1;xr<Fn;){for(var hn=xr++,xc=nt-hn,la=be+hn,un=l;un>=la;)S[un]=p.add(p.mul(sr[un-la],S[un]),p.mul(1-sr[un-la],S[un-1])),un--;P[xc]=S[l]}}for(var tl=rr,wc=T+1;tl<wc;){var Vn=tl++;I[Vn]=p.zeros1d(_);for(var Sc=yt.imin(l,Vn),el=yt.imax(0,Vn-g),Pc=Sc+1;el<Pc;){var rl=el++;I[Vn]=p.add(I[Vn],p.mul(y[Vn][rl],S[rl]))}}if(Ue>1)for(var ha=pt-2,ua=pt,nl=Oe-Et,Ic=(Oe-C[pt-1])/nl,sl=1;sl<Ue;){for(var ca=sl++,wr=ha,cn=ua,Zr=cn-pt+1;cn-wr>ca;){if(wr<_t){var Ac=(Oe-C[wr])/(Et-C[wr]);B[wr]=p.lerp(Ac,B[wr],B[wr-1])}if(cn>=rr){if(cn-ca<=pt-T+Ue){var Ec=(Oe-C[cn-ca])/nl;I[Zr]=p.lerp(Ec,I[Zr],I[Zr+1])}}else I[Zr]=p.lerp(Ic,I[Zr],I[Zr+1]);wr=wr+1,cn=cn-1,Zr=Zr-1}ha=ha-1,ua=ua+1}if(mt!=l)for(var il=0,Mc=T-Ue;il<Mc;)il++,C[pt]=Et,pt=pt+1;for(var al=rr,Tc=mr+1;al<Tc;){var kc=al++;B[_t]=I[kc],_t=_t+1}if(K<E){for(var ol=0;ol<nt;){var ll=ol++;S[ll]=P[ll]}for(var hl=nt,Nc=l+1;hl<Nc;){var ul=hl++;S[ul]=d[K-l+ul]}mt=K,K=K+1,Et=Oe}else for(var cl=0,Lc=T+1;cl<Lc;){var Cc=cl++;C[pt+Cc]=Oe}}return new Dt(i,C,B)},yt.rationalSurfaceTransform=function(r,i){for(var o=N.dehomogenize2d(r.controlPoints),l=0,c=o.length;l<c;)for(var d=l++,g=0,_=o[d].length;g<_;){var y=g++,S=o[d][y];S.push(1),o[d][y]=Ot.dot(i,S).slice(0,S.length-1)}return new ne(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),N.homogenize2d(o,N.weight2d(r.controlPoints)))},yt.rationalCurveTransform=function(r,i){for(var o=N.dehomogenize1d(r.controlPoints),l=0,c=o.length;l<c;){var d=l++,g=o[d];g.push(1),o[d]=Ot.dot(i,g).slice(0,g.length-1)}return new Dt(r.degree,r.knots.slice(),N.homogenize1d(o,N.weight1d(r.controlPoints)))},yt.surfaceKnotRefine=function(r,i,o){var l=[],c,d,g;o?(g=r.controlPoints,c=r.knotsV,d=r.degreeV):(g=Ot.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,y=0;y<g.length;){var S=g[y];++y,_=yt.curveKnotRefine(new Dt(d,c,S),i),l.push(_.controlPoints)}var I=_.knots;return o?new ne(r.degreeU,r.degreeV,r.knotsU.slice(),I,l):(l=Ot.transpose(l),new ne(r.degreeU,r.degreeV,I,r.knotsV.slice(),l))},yt.decomposeCurveIntoBeziers=function(r){for(var i=r.degree,o=r.controlPoints,l=r.knots,c=bt.knotMultiplicities(l),d=i+1,g=0;g<c.length;){var _=c[g];if(++g,_.mult<d){var y=p.rep(d-_.mult,_.knot),S=yt.curveKnotRefine(new Dt(i,l,o),y);l=S.knots,o=S.controlPoints}}l.length/d-1;for(var I=d*2,P=[],E=0;E<o.length;){var T=l.slice(E,E+I),k=o.slice(E,E+d);P.push(new Dt(i,T,k)),E+=d}return P},yt.curveKnotRefine=function(r,i){if(i.length==0)return gt.clonedCurve(r);for(var o=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,g=d+o+1,_=i.length-1,y=N.knotSpan(o,i[0],c),S=N.knotSpan(o,i[_],c),I=[],P=[],E=0,T=y-o+1;E<T;){var k=E++;I[k]=l[k]}for(var B=S-1,C=d+1;B<C;){var R=B++;I[R+_+1]=l[R]}for(var z=0,U=y+1;z<U;){var j=z++;P[j]=c[j]}for(var X=S+o,J=g+1;X<J;){var q=X++;P[q+_+1]=c[q]}for(var G=S+o-1,$=S+o+_,tt=_;tt>=0;){for(;i[tt]<=c[G]&&G>y;)I[$-o-1]=l[G-o-1],P[$]=c[G],$=$-1,G=G-1;I[$-o-1]=I[$-o];for(var et=1,ot=o+1;et<ot;){var ut=et++,lt=$-o+ut,pt=P[$+ut]-i[tt];Math.abs(pt)<rt.EPSILON?I[lt-1]=I[lt]:(pt=pt/(P[$+ut]-c[G-o+ut]),I[lt-1]=p.add(p.mul(pt,I[lt-1]),p.mul(1-pt,I[lt])))}P[$]=i[tt],$=$-1,tt--}return new Dt(o,P,I)},yt.curveKnotInsert=function(r,i,o){for(var l=r.degree,c=r.controlPoints,d=r.knots,g=0,_=c.length,y=N.knotSpan(l,i,d),S=[],I=[],P=[],E=1,T=y+1;E<T;){var k=E++;I[k]=d[k]}for(var B=1,C=o+1;B<C;){var R=B++;I[y+R]=i}for(var z=y+1,U=d.length;z<U;){var j=z++;I[j+o]=d[j]}for(var X=0,J=y-l+1;X<J;){var q=X++;P[q]=c[q]}for(var G=y-g;G<_;){var $=G++;P[$+o]=c[$]}for(var tt=0,et=l-g+1;tt<et;){var ot=tt++;S[ot]=c[y-l+ot]}for(var ut=0,lt=0,pt=1,nt=o+1;pt<nt;){var mt=pt++;ut=y-l+mt;for(var K=0,_t=l-mt-g+1;K<_t;){var Et=K++;lt=(i-d[ut+Et])/(d[Et+y+1]-d[ut+Et]),S[Et]=p.add(p.mul(lt,S[Et+1]),p.mul(1-lt,S[Et]))}P[ut]=S[0],P[y+o-mt-g]=S[l-mt-g]}for(var Ht=ut+1,$t=y-g;Ht<$t;){var jt=Ht++;P[jt]=S[jt-ut]}return new Dt(l,I,P)};var zt=f.eval.Tess=function(){};x["verb.eval.Tess"]=zt,zt.__name__=["verb","eval","Tess"],zt.rationalCurveRegularSample=function(r,i,o){return zt.rationalCurveRegularSampleRange(r,r.knots[0],Z.last(r.knots),i,o)},zt.rationalCurveRegularSampleRange=function(r,i,o,l,c){l<1&&(l=2);for(var d=[],g=(o-i)/(l-1),_=0,y=0;y<l;){var S=y++;_=i+g*S,c?d.push([_].concat(N.rationalCurvePoint(r,_))):d.push(N.rationalCurvePoint(r,_))}return d},zt.rationalCurveAdaptiveSample=function(r,i,o){if(o==null&&(o=!1),i==null&&(i=1e-6),r.degree==1)if(o){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var g=c++;l.push([r.knots[g+1]].concat(N.dehomogenize(r.controlPoints[g])))}return l}else return r.controlPoints.map(N.dehomogenize);return zt.rationalCurveAdaptiveSampleRange(r,r.knots[0],Z.last(r.knots),i,o)},zt.rationalCurveAdaptiveSampleRange=function(r,i,o,l,c){var d=N.rationalCurvePoint(r,i),g=N.rationalCurvePoint(r,o),_=.5+.2*Math.random(),y=i+(o-i)*_,S=N.rationalCurvePoint(r,y),I=p.sub(d,g),P=p.sub(d,S);if(p.dot(I,I)<l&&p.dot(P,P)>l||!Fe.threePointsAreFlat(d,S,g,l)){var E=i+(o-i)*.5,T=zt.rationalCurveAdaptiveSampleRange(r,i,E,l,c),k=zt.rationalCurveAdaptiveSampleRange(r,E,o,l,c);return T.slice(0,-1).concat(k)}else return c?[[i].concat(d),[o].concat(g)]:[d,g]},zt.rationalSurfaceNaive=function(r,i,o){i<1&&(i=1),o<1&&(o=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=Z.last(l)-l[0],g=Z.last(c)-c[0],_=d/i,y=g/o,S=[],I=[],P=[],E=0,T=i+1;E<T;)for(var k=E++,B=0,C=o+1;B<C;){var R=B++,z=k*_,U=R*y;I.push([z,U]);var j=N.rationalSurfaceDerivatives(r,z,U,1),X=j[0][0];S.push(X);var J=p.normalized(p.cross(j[1][0],j[0][1]));P.push(J)}for(var q=[],G=0;G<i;)for(var $=G++,tt=0;tt<o;){var et=tt++,ot=$*(o+1)+et,ut=($+1)*(o+1)+et,lt=ut+1,pt=ot+1,nt=[ot,ut,lt],mt=[ot,lt,pt];q.push(nt),q.push(mt)}return new Je(q,S,P,I)},zt.divideRationalSurfaceAdaptive=function(r,i){i==null&&(i=new qr),i.minDivsU!=null?i.minDivsU=i.minDivsU:i.minDivsU=1,i.minDivsV!=null?i.minDivsU=i.minDivsV:i.minDivsU=1,i.refine!=null?i.refine=i.refine:i.refine=!0;var o=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;i.minDivsU>o?c=i.minDivsU=i.minDivsU:c=i.minDivsU=o;var d;i.minDivsV>l?d=i.minDivsV=i.minDivsV:d=i.minDivsV=l;for(var g=Z.last(r.knotsU),_=r.knotsU[0],y=Z.last(r.knotsV),S=r.knotsV[0],I=(g-_)/c,P=(y-S)/d,E=[],T=[],k=0,B=d+1;k<B;){for(var C=k++,R=[],z=0,U=c+1;z<U;){var j=z++,X=_+I*j,J=S+P*C,q=N.rationalSurfaceDerivatives(r,X,J,1),G=p.normalized(p.cross(q[0][1],q[1][0]));R.push(new $e(q[0][0],G,[X,J],-1,p.isZero(G)))}T.push(R)}for(var $=0;$<d;)for(var tt=$++,et=0;et<c;){var ot=et++,ut=[T[d-tt-1][ot],T[d-tt-1][ot+1],T[d-tt][ot+1],T[d-tt][ot]];E.push(new br(r,ut))}if(!i.refine)return E;for(var lt=0;lt<d;)for(var pt=lt++,nt=0;nt<c;){var mt=nt++,K=pt*c+mt,_t=zt.north(K,pt,mt,c,d,E),Et=zt.east(K,pt,mt,c,d,E),Ht=zt.south(K,pt,mt,c,d,E),$t=zt.west(K,pt,mt,c,d,E);E[K].neighbors=[Ht,Et,_t,$t],E[K].divide(i)}return E},zt.north=function(r,i,o,l,c,d){return i==0?null:d[r-l]},zt.south=function(r,i,o,l,c,d){return i==c-1?null:d[r+l]},zt.east=function(r,i,o,l,c,d){return o==l-1?null:d[r+1]},zt.west=function(r,i,o,l,c,d){return o==0?null:d[r-1]},zt.triangulateAdaptiveRefinementNodeTree=function(r){for(var i=Je.empty(),o=0;o<r.length;){var l=r[o];++o,l.triangulate(i)}return i},zt.rationalSurfaceAdaptive=function(r,i){i!=null?i=i:i=new qr;var o=zt.divideRationalSurfaceAdaptive(r,i);return zt.triangulateAdaptiveRefinementNodeTree(o)};var qr=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"]=qr,qr.__name__=["verb","eval","AdaptiveRefinementOptions"],qr.prototype={__class__:qr};var br=f.core.AdaptiveRefinementNode=function(r,i,o){if(this.srf=r,o==null?this.neighbors=[null,null,null,null]:this.neighbors=o,this.corners=i,this.corners==null){var l=r.knotsU[0],c=Z.last(r.knotsU),d=r.knotsV[0],g=Z.last(r.knotsV);this.corners=[$e.fromUv(l,d),$e.fromUv(c,d),$e.fromUv(c,g),$e.fromUv(l,g)]}};x["verb.eval.AdaptiveRefinementNode"]=br,br.__name__=["verb","eval","AdaptiveRefinementNode"],br.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 i=r++;if(this.corners[i].point==null){var o=this.corners[i];this.evalSrf(o.uv[0],o.uv[1],o)}}},evalSrf:function(r,i,o){var l=N.rationalSurfaceDerivatives(this.srf,r,i,1),c=l[0][0],d=p.cross(l[0][1],l[1][0]),g=p.isZero(d);return g||(d=p.normalized(d)),o!=null?(o.degen=g,o.point=c,o.normal=d,o):new $e(c,d,[r,i],-1,g)},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 i=[this.corners[r]];if(this.neighbors[r]==null)return i;var o=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=rt.EPSILON,d=this,g=[function(y){return y.uv[0]>d.corners[0].uv[0]+c&&y.uv[0]<d.corners[2].uv[0]-c},function(y){return y.uv[1]>d.corners[0].uv[1]+c&&y.uv[1]<d.corners[2].uv[1]-c}],_=o.filter(g[l]);return _.reverse(),i.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,i=0;i<r;){var o=i++;if(this.corners[o],this.corners[o].degen){var l=this.corners[(o+1)%r],c=this.corners[(o+3)%r];l.degen?this.corners[o].normal=c.normal:this.corners[o].normal=l.normal}}},shouldDivide:function(r,i){if(i<r.minDepth)return!0;if(i>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=p.normSquared(p.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=p.normSquared(p.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var o=this.center();return p.normSquared(p.sub(o.normal,this.corners[0].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[1].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[2].normal))>r.normTol||p.normSquared(p.sub(o.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new qr),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,i,o){if(this.evalCorners(),!!this.shouldDivide(r,i)){if(i++,this.splitVert&&!this.splitHoriz?o=!1:!this.splitVert&&this.splitHoriz&&(o=!0),this.horizontal=o,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 br(this.srf,l),new br(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]],g=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new br(this.srf,d),new br(this.srf,g)],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,y=this.children;_<y.length;){var S=y[_];++_,S._divide(r,i,!o)}}},triangulate:function(r){if(r==null&&(r=Je.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var i=0,o=this.children;i<o.length;){var l=o[i];if(++i,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var i=r.points.length,o=[],l=[],c=0,d=0;d<4;){var g=d++,_=this.getAllCorners(g);_.length==2&&(c=g+1);for(var y=0,S=_.length;y<S;){var I=y++;o.push(_[I])}}for(var P=0;P<o.length;){var E=o[P];if(++P,E.id!=-1){l.push(E.id);continue}r.uvs.push(E.uv),r.points.push(E.point),r.normals.push(E.normal),E.id=i,l.push(i),i++}if(o.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(o.length==5){var T=l.length;return r.faces.push([l[c],l[(c+2)%T],l[(c+1)%T]]),r.faces.push([l[(c+4)%T],l[(c+3)%T],l[c]]),r.faces.push([l[c],l[(c+3)%T],l[(c+2)%T]]),r}var k=this.center();r.uvs.push(k.uv),r.points.push(k.point),r.normals.push(k.normal);for(var B=r.points.length-1,C=0,R=o.length-1;C<o.length;)r.faces.push([B,l[C],l[R]]),R=C++;return r},__class__:br};var St=f.exe.Dispatcher=function(){};x["verb.exe.Dispatcher"]=St,St.__name__=["verb","exe","Dispatcher"],St.init=function(){St._init||(St._workerPool=new Xr(St.THREADS),St._init=!0)},St.dispatchMethod=function(r,i,o){St.init();var l=new En,c=function(d){l.resolve(d)};return St._workerPool.addWork(dt.getClassName(r),i,o,c),new ve(l)};var Xr=f.exe.WorkerPool=function(r,i){i==null&&(i="verb.js"),r==null&&(r=1),this._callbacks=new wt,this._working=new wt,this._pool=[],this._queue=[];for(var o=0;o<r;){o++;var l;try{l=new Worker(Xr.basePath+i)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(Xr.basePath+i.substring(0,-3)+".min.js")}this._pool.push(l)}};x["verb.exe.WorkerPool"]=Xr,Xr.__name__=["verb","exe","WorkerPool"],Xr.prototype={addWork:function(r,i,o,l){var c=new ln(r,i,o);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 i=this._queue.shift(),o=[i.id],l=[this._pool.shift()];this._working.h[o[0]]=l[0],l[0].onmessage=function(c,d){return function(g){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](g.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),b.log(_)}r.processQueue()}}(l,o),l[0].postMessage(i)}},__class__:Xr};var ln=function(r,i,o){this.className=r,this.methodName=i,this.args=o,this.id=ln.uuid++};x["verb.exe._WorkerPool.Work"]=ln,ln.__name__=["verb","exe","_WorkerPool","Work"],ln.prototype={__class__:ln};var zn=function(){};x["verb.geom.ICurve"]=zn,zn.__name__=["verb","geom","ICurve"],zn.__interfaces__=[Cn],zn.prototype={__class__:zn};var Ct=f.geom.NurbsCurve=function(r){this._data=Ze.isValidNurbsCurveData(r)};x["verb.geom.NurbsCurve"]=Ct,Ct.__name__=["verb","geom","NurbsCurve"],Ct.__interfaces__=[zn],Ct.byKnotsControlPointsWeights=function(r,i,o,l){return new Ct(new Dt(r,i.slice(),N.homogenize1d(o,l)))},Ct.byPoints=function(r,i){return i==null&&(i=3),new Ct(gt.rationalInterpCurve(r,i))},Ct.__super__=te,Ct.prototype=M(te.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return N.dehomogenize1d(this._data.controlPoints)},weights:function(){return N.weight1d(this._data.controlPoints)},asNurbs:function(){return new Dt(this.degree(),this.knots(),N.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Ct(this._data)},domain:function(){return new Le(Z.first(this._data.knots),Z.last(this._data.knots))},transform:function(r){return new Ct(yt.rationalCurveTransform(this._data,r))},transformAsync:function(r){return St.dispatchMethod(yt,"rationalCurveTransform",[this._data,r]).then(function(i){return new Ct(i)})},point:function(r){return N.rationalCurvePoint(this._data,r)},pointAsync:function(r){return St.dispatchMethod(N,"rationalCurvePoint",[this._data,r])},tangent:function(r){return N.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return St.dispatchMethod(N,"rationalCurveTangent",[this._data,r])},derivatives:function(r,i){return i==null&&(i=1),N.rationalCurveDerivatives(this._data,r,i)},derivativesAsync:function(r,i){return i==null&&(i=1),St.dispatchMethod(N,"rationalCurveDerivatives",[this._data,r,i])},closestPoint:function(r){return bt.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return St.dispatchMethod(bt,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return bt.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return St.dispatchMethod(bt,"rationalCurveClosestParam",[this._data,r])},length:function(){return bt.rationalCurveArcLength(this._data)},lengthAsync:function(){return St.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return bt.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return St.dispatchMethod(bt,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,i){return bt.rationalCurveParamAtArcLength(this._data,r,i)},paramAtLengthAsync:function(r,i){return St.dispatchMethod(bt,"rationalCurveParamAtArcLength",[this._data,r,i])},divideByEqualArcLength:function(r){return de.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return St.dispatchMethod(de,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return de.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return St.dispatchMethod(de,"rationalCurveByArcLength",[this._data,r])},split:function(r){return de.curveSplit(this._data,r).map(function(i){return new Ct(i)})},splitAsync:function(r){return St.dispatchMethod(de,"curveSplit",[this._data,r]).then(function(i){return i.map(function(o){return new Ct(o)})})},reverse:function(){return new Ct(yt.curveReverse(this._data))},reverseAsync:function(){return St.dispatchMethod(yt,"curveReverse",[this._data]).then(function(r){return new Ct(r)})},tessellate:function(r){return zt.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return St.dispatchMethod(zt,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Ct});var Yr=f.geom.Arc=function(r,i,o,l,c,d){Ct.call(this,gt.arc(r,i,o,l,c,d)),this._center=r,this._xaxis=i,this._yaxis=o,this._radius=l,this._minAngle=c,this._maxAngle=d};x["verb.geom.Arc"]=Yr,Yr.__name__=["verb","geom","Arc"],Yr.__super__=Ct,Yr.prototype=M(Ct.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__:Yr});var ds=f.geom.BezierCurve=function(r,i){Ct.call(this,gt.rationalBezierCurve(r,i))};x["verb.geom.BezierCurve"]=ds,ds.__name__=["verb","geom","BezierCurve"],ds.__super__=Ct,ds.prototype=M(Ct.prototype,{__class__:ds});var ps=f.geom.Circle=function(r,i,o,l){Yr.call(this,r,i,o,l,0,Math.PI*2)};x["verb.geom.Circle"]=ps,ps.__name__=["verb","geom","Circle"],ps.__super__=Yr,ps.prototype=M(Yr.prototype,{__class__:ps});var Rn=function(){};x["verb.geom.ISurface"]=Rn,Rn.__name__=["verb","geom","ISurface"],Rn.__interfaces__=[Cn],Rn.prototype={__class__:Rn};var Mt=f.geom.NurbsSurface=function(r){this._data=Ze.isValidNurbsSurfaceData(r)};x["verb.geom.NurbsSurface"]=Mt,Mt.__name__=["verb","geom","NurbsSurface"],Mt.__interfaces__=[Rn],Mt.byKnotsControlPointsWeights=function(r,i,o,l,c,d){return new Mt(new ne(r,i,o,l,N.homogenize2d(c,d)))},Mt.byCorners=function(r,i,o,l){return new Mt(gt.fourPointSurface(r,i,o,l))},Mt.byLoftingCurves=function(r,i){return new Mt(gt.loftedSurface(function(o){for(var l,c=[],d=0;d<r.length;){var g=r[d];++d,c.push(g.asNurbs())}return l=c,l}(),i))},Mt.__super__=te,Mt.prototype=M(te.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 N.dehomogenize2d(this._data.controlPoints)},weights:function(){return N.weight2d(this._data.controlPoints)},asNurbs:function(){return new ne(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),N.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Mt(this.asNurbs())},domainU:function(){return new Le(Z.first(this._data.knotsU),Z.last(this._data.knotsU))},domainV:function(){return new Le(Z.first(this._data.knotsV),Z.last(this._data.knotsV))},point:function(r,i){return N.rationalSurfacePoint(this._data,r,i)},pointAsync:function(r,i){return St.dispatchMethod(N,"rationalSurfacePoint",[this._data,r,i])},normal:function(r,i){return N.rationalSurfaceNormal(this._data,r,i)},normalAsync:function(r,i){return St.dispatchMethod(N,"rationalSurfaceNormal",[this._data,r,i])},derivatives:function(r,i,o){return o==null&&(o=1),N.rationalSurfaceDerivatives(this._data,r,i,o)},derivativesAsync:function(r,i,o){return o==null&&(o=1),St.dispatchMethod(N,"rationalSurfaceDerivatives",[this._data,r,i,o])},closestParam:function(r){return bt.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return St.dispatchMethod(bt,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return bt.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return St.dispatchMethod(bt,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,i){return i==null&&(i=!1),de.surfaceSplit(this._data,r,i).map(function(o){return new Mt(o)})},splitAsync:function(r,i){return i==null&&(i=!1),St.dispatchMethod(de,"surfaceSplit",[this._data,r,i]).then(function(o){return o.map(function(l){return new Mt(l)})})},reverse:function(r){return r==null&&(r=!1),new Mt(yt.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),St.dispatchMethod(yt,"surfaceReverse",[this._data,r]).then(function(i){return new Mt(i)})},isocurve:function(r,i){return i==null&&(i=!1),new Ct(gt.surfaceIsocurve(this._data,r,i))},isocurveAsync:function(r,i){return i==null&&(i=!1),St.dispatchMethod(gt,"surfaceIsocurve",[this._data,r,i]).then(function(o){return new Ct(o)})},boundaries:function(r){return gt.surfaceBoundaryCurves(this._data).map(function(i){return new Ct(i)})},boundariesAsync:function(r){return St.dispatchMethod(gt,"surfaceBoundaryCurves",[this._data]).then(function(i){return i.map(function(o){return new Ct(o)})})},tessellate:function(r){return zt.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return St.dispatchMethod(zt,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Mt(yt.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return St.dispatchMethod(yt,"rationalSurfaceTransform",[this._data,r]).then(function(i){return new Mt(i)})},__class__:Mt});var ms=f.geom.ConicalSurface=function(r,i,o,l,c){Mt.call(this,gt.conicalSurface(r,i,o,l,c)),this._axis=r,this._xaxis=i,this._base=o,this._height=l,this._radius=c};x["verb.geom.ConicalSurface"]=ms,ms.__name__=["verb","geom","ConicalSurface"],ms.__super__=Mt,ms.prototype=M(Mt.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__:ms});var gs=f.geom.CylindricalSurface=function(r,i,o,l,c){Mt.call(this,gt.cylindricalSurface(r,i,o,l,c)),this._axis=r,this._xaxis=i,this._base=o,this._height=l,this._radius=c};x["verb.geom.CylindricalSurface"]=gs,gs.__name__=["verb","geom","CylindricalSurface"],gs.__super__=Mt,gs.prototype=M(Mt.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__:gs});var Kr=f.geom.EllipseArc=function(r,i,o,l,c){Ct.call(this,gt.ellipseArc(r,i,o,l,c)),this._center=r,this._xaxis=i,this._yaxis=o,this._minAngle=l,this._maxAngle=c};x["verb.geom.EllipseArc"]=Kr,Kr.__name__=["verb","geom","EllipseArc"],Kr.__super__=Ct,Kr.prototype=M(Ct.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__:Kr});var fs=f.geom.Ellipse=function(r,i,o){Kr.call(this,r,i,o,0,Math.PI*2)};x["verb.geom.Ellipse"]=fs,fs.__name__=["verb","geom","Ellipse"],fs.__super__=Kr,fs.prototype=M(Kr.prototype,{__class__:fs});var _s=f.geom.ExtrudedSurface=function(r,i){Mt.call(this,gt.extrudedSurface(p.normalized(i),p.norm(i),r.asNurbs())),this._profile=r,this._direction=i};x["verb.geom.ExtrudedSurface"]=_s,_s.__name__=["verb","geom","ExtrudedSurface"],_s.__super__=Mt,_s.prototype=M(Mt.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:_s});var $r=f.geom.Intersect=function(){};x["verb.geom.Intersect"]=$r,$r.__name__=["verb","geom","Intersect"],$r.curves=function(r,i,o){return o==null&&(o=.001),ht.curves(r.asNurbs(),i.asNurbs(),o)},$r.curvesAsync=function(r,i,o){return o==null&&(o=.001),St.dispatchMethod(ht,"curves",[r.asNurbs(),i.asNurbs(),o])},$r.curveAndSurface=function(r,i,o){return o==null&&(o=.001),ht.curveAndSurface(r.asNurbs(),i.asNurbs(),o)},$r.curveAndSurfaceAsync=function(r,i,o){return o==null&&(o=.001),St.dispatchMethod(ht,"curveAndSurface",[r.asNurbs(),i.asNurbs(),o])},$r.surfaces=function(r,i,o){return o==null&&(o=.001),ht.surfaces(r.asNurbs(),i.asNurbs(),o).map(function(l){return new Ct(l)})},$r.surfacesAsync=function(r,i,o){return o==null&&(o=.001),St.dispatchMethod(ht,"surfaces",[r.asNurbs(),i.asNurbs(),o]).then(function(l){return l.map(function(c){return new Ct(c)})})};var ys=f.geom.Line=function(r,i){Ct.call(this,gt.polyline([r,i])),this._start=r,this._end=i};x["verb.geom.Line"]=ys,ys.__name__=["verb","geom","Line"],ys.__super__=Ct,ys.prototype=M(Ct.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:ys});var vs=f.geom.RevolvedSurface=function(r,i,o,l){Mt.call(this,gt.revolvedSurface(r.asNurbs(),i,o,l)),this._profile=r,this._center=i,this._axis=o,this._angle=l};x["verb.geom.RevolvedSurface"]=vs,vs.__name__=["verb","geom","RevolvedSurface"],vs.__super__=Mt,vs.prototype=M(Mt.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:vs});var bs=f.geom.SphericalSurface=function(r,i){Mt.call(this,gt.sphericalSurface(r,[0,0,1],[1,0,0],i)),this._center=r,this._radius=i};x["verb.geom.SphericalSurface"]=bs,bs.__name__=["verb","geom","SphericalSurface"],bs.__super__=Mt,bs.prototype=M(Mt.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:bs});var xs=f.geom.SweptSurface=function(r,i){Mt.call(this,gt.rationalTranslationalSurface(r.asNurbs(),i.asNurbs())),this._profile=r,this._rail=i};x["verb.geom.SweptSurface"]=xs,xs.__name__=["verb","geom","SweptSurface"],xs.__super__=Mt,xs.prototype=M(Mt.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:xs});function er(r){return r instanceof Array?function(){return L.iter(r)}:typeof r.iterator=="function"?Ve(r,r.iterator):r.iterator}var ia,yc=0;function Ve(r,i){if(i==null)return null;i.__id__==null&&(i.__id__=yc++);var o;return r.hx__closures__==null?r.hx__closures__={}:o=r.hx__closures__[i.__id__],o==null&&(o=function(){return o.method.apply(o.scope,arguments)},o.scope=r,o.method=i,r.hx__closures__[i.__id__]=o),o}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 vc=x.Int={__name__:["Int"]},bc=x.Dynamic={__name__:["Dynamic"]},$o=x.Float=Number;$o.__name__=["Float"];var Zo=x.Bool=Boolean;Zo.__ename__=["Bool"];var Qo=x.Class={__name__:["Class"]},Jo={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var i=[],o=0,l=this.length;o<l;){var c=o++;i[c]=r(this[c])}return i}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var i=[],o=0,l=this.length;o<l;){var c=o++,d=this[c];r(d)&&i.push(d)}return i});var aa={},ii=w.ArrayBuffer||ce;ii.prototype.slice==null&&(ii.prototype.slice=ce.sliceImpl),w.DataView;var oa=w.Uint8Array||ur._new;(function(r,i){if(r.setImmediate)return;var o=1,l={},c=!1,d=r.document,g;function _(z){return l[o]=y.apply(i,z),o++}function y(z){var U=[].slice.call(arguments,1);return function(){typeof z=="function"?z.apply(i,U):new Function(""+z)()}}function S(z){if(c)setTimeout(y(S,z),0);else{var U=l[z];if(U){c=!0;try{U()}finally{I(z),c=!1}}}}function I(z){delete l[z]}function P(){g=function(){var z=_(arguments);return process.nextTick(y(S,z)),z}}function E(){if(r.postMessage&&!r.importScripts){var z=!0,U=r.onmessage;return r.onmessage=function(){z=!1},r.postMessage("","*"),r.onmessage=U,z}}function T(){var z="setImmediate$"+Math.random()+"$",U=function(j){j.source===r&&typeof j.data=="string"&&j.data.indexOf(z)===0&&S(+j.data.slice(z.length))};r.addEventListener?r.addEventListener("message",U,!1):r.attachEvent("onmessage",U),g=function(){var j=_(arguments);return r.postMessage(z+j,"*"),j}}function k(){var z=new MessageChannel;z.port1.onmessage=function(U){var j=U.data;S(j)},g=function(){var U=_(arguments);return z.port2.postMessage(U),U}}function B(){var z=d.documentElement;g=function(){var U=_(arguments),j=d.createElement("script");return j.onreadystatechange=function(){S(U),j.onreadystatechange=null,z.removeChild(j),j=null},z.appendChild(j),U}}function C(){g=function(){var z=_(arguments);return setTimeout(y(S,z),0),z}}var R=Object.getPrototypeOf&&Object.getPrototypeOf(r);R=R&&R.setTimeout?R:r,{}.toString.call(r.process)==="[object process]"?P():E()?T():r.MessageChannel?k():d&&"onreadystatechange"in d.createElement("script")?B():C(),R.setImmediate=g,R.clearImmediate=I})(new Function("return this")()),Kt.USE_CACHE=!1,Kt.USE_ENUM_INDEX=!1,Kt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",qt.DEFAULT_RESOLVER=dt,qt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Bt.count=0,ue.i64tmp=function(r){var i,o=new Wt(0,0);return i=o,i}(),Lt.__toStr={}.toString,ur.BYTES_PER_ELEMENT=1,At.queue=new V,Vt.memo=new wt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",bt.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]],bt.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]],St.THREADS=1,St._init=!1,Xr.basePath="",ln.uuid=0,ni.main()}(typeof console<"u"?console:{log:function(){}},e,typeof u<"u"?u:typeof s<"u"?s:typeof self<"u"?self:this),e})})(wh);var ed=wh.exports;const jn=td(ed);class _a{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,s,a){this.c0=t,this.c1=s,this.c2=-3*t+3*e-2*s-a,this.c3=2*t-2*e+s+a}initCatmullRom(t,e,s,a,h){this.init(e,s,h*(s-t),h*(a-e))}initNonuniformCatmullRom(t,e,s,a,h,u,m){let b=(e-t)/h-(s-t)/(h+u)+(s-e)/u,f=(s-e)/u-(a-e)/(u+m)+(a-s)/m;b*=u,f*=u,this.init(e,s,b,f)}calc(t){const e=t*t,s=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*s}}let Sh=class extends ei{constructor(t=[],e=!1,s="centripetal",a=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new Y,this._px=new _a,this._py=new _a,this._pz=new _a,this._points=t.map(h=>new W(h)),this._closed=e,this._curveType=s,this._tension=a}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 W}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new W}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new W){const s=e,a=this._points,h=a.length;if(h===0)return s.set(0,0,0);if(h===1)return s.copy(a[0]);const u=(h-(this._closed?0:1))*t;let m=Math.floor(u),b=u-m;this._closed?m+=m>0?0:(Math.floor(Math.abs(m)/h)+1)*h:b===0&&m===h-1&&(m=h-2,b=1);let f,w;this._closed||m>0?f=a[(m-1)%h]:(this._tmp.subVectors(a[0],a[1]).add(a[0]),f=new W(this._tmp.x,this._tmp.y,this._tmp.z));const x=a[m%h],A=a[(m+1)%h];if(this._closed||m+2<h?w=a[(m+2)%h]:(this._tmp.subVectors(a[h-1],a[h-2]).add(a[h-1]),w=new W(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const M=this._curveType==="chordal"?.5:.25;let L=Math.pow(f.distanceToSquared(x),M),O=Math.pow(x.distanceToSquared(A),M),V=Math.pow(A.distanceToSquared(w),M);O<1e-4&&(O=1),L<1e-4&&(L=O),V<1e-4&&(V=O),this._px.initNonuniformCatmullRom(f.x,x.x,A.x,w.x,L,O,V),this._py.initNonuniformCatmullRom(f.y,x.y,A.y,w.y,L,O,V),this._pz.initNonuniformCatmullRom(f.z,x.z,A.z,w.z,L,O,V)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,x.x,A.x,w.x,this._tension),this._py.initCatmullRom(f.y,x.y,A.y,w.y,this._tension),this._pz.initCatmullRom(f.z,x.z,A.z,w.z,this._tension));return s.set(this._px.calc(b),this._py.calc(b),this._pz.calc(b)),s}getPoints(t){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}setPoints(t){this._points=t.map(e=>new W(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const s=new W;return s.copy(e),s.applyMatrix4(t),s}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Nt;const t=new Nt;return this._points.forEach(e=>{t.expandByPoint(e)}),t}};class Sn{constructor(t,e,s,a){this._degree=t,this._knots=[...e],this._controlPoints=s.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=a?[...a]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(s=>[s.x,s.y,s.z]);return Gs(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return gh(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,s,a){return new Sn(t,e,s,a)}static byPoints(t,e,s="Uniform"){let a;switch(s){case"Chord":a=ph(e,t);break;case"SqrtChord":a=mh(e,t);break;case"Uniform":default:a=dh(e,t.length);break}const h=t.map(m=>({x:m[0],y:m[1],z:m[2]})),u=new Array(h.length).fill(1);return new Sn(e,a,h,u)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:s,end:a}=this.getParameterRange();for(let h=0;h<=t;h++){const u=s+(a-s)*(h/t);e.push(this.point(u))}return e}isClosed(t=1e-6){const{start:e,end:s}=this.getParameterRange(),a=this.point(e),h=this.point(s),u=a[0]-h[0],m=a[1]-h[1],b=a[2]-h[2];return Math.sqrt(u*u+m*m+b*b)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Sh(t,!0,"centripetal"),s=Math.max(50,t.length*2);return e.getPoints(s)}static createClosedCurve(t,e,s="Chord"){const a=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return Sn.byPoints(a,e,s)}}class rn extends ei{constructor(t,e,s,a,h){super();const u=arguments.length;if(u<2||u>5)throw Ke.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let m,b=3,f=!1;if(u>=3&&(Array.isArray(s)?(m=s,u>=4&&(b=a||3),u>=5&&(f=h)):s!==void 0&&(b=s||3,u>=4&&(f=a))),s===void 0&&u>=4&&(b=a||3,u>=5&&(f=h)),this._degree=b,this._closed=f,this._controlPoints.length<this._degree+1)throw Ke.ILLEGAL_PARAMETERS;const w=this.toVerbPoints(this._controlPoints);this._nurbsCurve=jn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,w,m)}else{if(this._fitPoints=t,this._knotParameterization=e,u>=3&&(this._degree=s||3),u>=4&&(this._closed=a),this._fitPoints.length<this._degree+1)throw Ke.ILLEGAL_PARAMETERS;const m=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=jn.geom.NurbsCurve.byPoints(m,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=Sn.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=jn.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=jn.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=Sn.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=jn.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),s=this.toVerbPoints(this._controlPoints);this._nurbsCurve=jn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,s,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[e],a=this._nurbsCurve.point(s);return new W(a[0],a[1],a[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),s=t[t.length-e-1],a=this._nurbsCurve.point(s);return new W(a[0],a[1],a[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,s=t<0||t>=e?e-1:t,a=this._fitPoints[s];return{x:a.x,y:a.y,z:a.z||0}}getControlPointAt(t){const e=this._controlPoints.length,s=t<0||t>=e?e-1:t;return this._controlPoints[s]}getPoints(t=100){const e=this._nurbsCurve,s=[],a=e.knots(),h=this._nurbsCurve.degree(),u=a[h],m=a[a.length-h-1],b=(m-u)/(t-1);for(let f=0;f<t;f++){const w=f===t-1?m:u+f*b,x=e.point(w);s.push(new W(x[0],x[1],x[2]))}return s}getCurvePoints(t,e){const s=[],a=t.knots(),h=a[3],u=(a[a.length-4]-h)/(e-1);for(let m=0;m<e;m++){const b=h+m*u;s.push(t.point(b))}return s}calculateBoundingBox(){const t=this.getPoints(100);return new Nt().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((s,a)=>{e[a]=[s.x,s.y,s.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((s,a)=>{e[a]=[s.x,s.y,s.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((s,a)=>{e[a]={x:s[0],y:s[1],z:s[2]}}),e}static createClosedSpline(t,e="Uniform",s=3){if(t.length<s+1)throw new Error(`At least ${s+1} points are required for a degree ${s} closed spline`);return new rn(t,e,s,!0)}}var to=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(to||{}),nn=(n=>(n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211",n))(nn||{}),Vr=(n=>(n[n.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",n[n.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",n[n.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",n[n.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",n[n.BY_STYLE=5]="BY_STYLE",n))(Vr||{}),we=(n=>(n[n.TopLeft=1]="TopLeft",n[n.TopCenter=2]="TopCenter",n[n.TopRight=3]="TopRight",n[n.MiddleLeft=4]="MiddleLeft",n[n.MiddleCenter=5]="MiddleCenter",n[n.MiddleRight=6]="MiddleRight",n[n.BottomLeft=7]="BottomLeft",n[n.BottomCenter=8]="BottomCenter",n[n.BottomRight=9]="BottomRight",n))(we||{}),eo=(n=>(n[n.OPTIMIZED_2D=0]="OPTIMIZED_2D",n[n.WIREFRAME=1]="WIREFRAME",n[n.HIDDEN_LINE=2]="HIDDEN_LINE",n[n.FLAT_SHADED=3]="FLAT_SHADED",n[n.GOURAUD_SHADED=4]="GOURAUD_SHADED",n[n.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",n[n.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",n))(eo||{}),ro=(n=>(n[n.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",n[n.TOP=1]="TOP",n[n.BOTTOM=2]="BOTTOM",n[n.FRONT=3]="FRONT",n[n.BACK=4]="BACK",n[n.LEFT=5]="LEFT",n[n.RIGHT=6]="RIGHT",n))(ro||{}),no=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(no||{});let Ph=class Ih{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new Se;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new Se;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new Ih;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}};var wn=256,Ah=[],xl=256,li;for(;wn--;)Ah[wn]=(wn+256).toString(16).substring(1);function rd(n){var t=0,e=11;if(!li||wn+e>xl*2)for(li="",wn=0;t<xl;t++)li+=Ah[Math.random()*256|0];return li.substring(wn,wn+++e)}class jr{constructor(t,e){t=t||{},Zn(t,{objectId:rd()}),this._attrs=new Bl(t,e),this._xDataMap=new Map}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){return this._database?this._database:po().workingDatabase}set database(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===Ra.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}}const go=class go extends jr{constructor(){super(...arguments),this._lineType=di,this._visibility=!0,this._transparency=new $i}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this._color==null&&(this._color=new fe,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}set color(t){this._color==null&&(this._color=new fe),this._color.copy(t)}get rgbColor(){let t=this.color;if(t.isByLayer){const s=this.getLayerColor();s&&s.RGB!=null&&(t=s)}else t.isByBlock;const e=t.RGB;return e??16777215}get lineType(){return this._lineType}set lineType(t){this._lineType=t||di}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??nn.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone()}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&(this._color=new fe,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??nn.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,s,a,h){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){const s=t.subEntityTraits;s.color=this.color,s.rgbColor=this.rgbColor,s.lineType=this.lineStyle,s.lineTypeScale=this.linetypeScale,s.lineWeight=this.lineWeight,s.transparency=this.transparency,s.layer=this.layer,"thickness"in this&&(s.thickness=this.thickness);const a=this.subWorldDraw(t,e);return this.attachEntityInfo(a),a}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color.copy(t)}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var a;const{type:t,name:e}=this.getLineType(),s=(a=this.database)==null?void 0:a.tables.linetypeTable.getAt(e);return s?{type:t,...s.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==di){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==Gl?{type:"ByBlock",name:vi}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:vi}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};go.typeName="Entity";let ke=go;const fo=class fo extends ke{};fo.typeName="Curve";let Ne=fo;var Wn=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))(Wn||{});const _o=class _o extends Ne{constructor(t,e,s=0,a=!1,h=0,u=0,m=null){super(),this._polyType=t,this._elevation=s;const b=m&&(m==null?void 0:m.length)===e.length,f=e.map((w,x)=>({x:w.x,y:w.y,bulge:b?m[x]:void 0}));this._geo=new An(f,a)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const s=this._geo.getPointAt(e);t.push(new W(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const u=this._geo.getPointAt(h);a.push(new W(u.x,u.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}};_o.typeName="2dPolyline";let xi=_o;var Eh=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(Eh||{});const yo=class yo extends ke{constructor(){super(),this._position=new W,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Nt().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}};yo.typeName="2dVertex";let La=yo;var Ds=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(Ds||{});const vo=class vo extends Ne{constructor(t,e,s=!1){super(),this._polyType=t,this._geo=new An(e,s)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:0},{x:t.max.x,y:t.max.y,z:0})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const s=this._geo.getPointAt(e);t.push(new W(s.x,s.y,0))}return t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const u=this._geo.getPointAt(h);a.push(new W(u.x,u.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,0))),t.lines(e)}};vo.typeName="3dPolyline";let wi=vo;var Mh=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(Mh||{});const bo=class bo extends ke{constructor(){super(),this._position=new W,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Nt().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,s,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}};bo.typeName="3dVertex";let Ca=bo;const xo=class xo extends Ne{constructor(t,e,s,a,h=Y.Z_AXIS){super(),this._geo=new Qa(t,e,s,a,h,Y.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>Pt.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,a){const h=this.startPoint,u=this.endPoint;switch(t){case Ft.EndPoint:a.push(h),a.push(u);break;case Ft.MidPoint:a.push(this.midPoint);break;case Ft.Nearest:{const m=this._geo.nearestPoint(e);a.push(m)}break;case Ft.Perpendicular:break;case Ft.Tangent:{const m=this._geo.tangentPoints(e);a.push(...m);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}};xo.typeName="Arc";let Si=xo;var Th=(n=>(n[n.LEFT=0]="LEFT",n[n.CENTER=1]="CENTER",n[n.RIGHT=2]="RIGHT",n[n.ALIGNED=3]="ALIGNED",n[n.MIDDLE=4]="MIDDLE",n[n.FIT=5]="FIT",n))(Th||{}),kh=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(kh||{});const wo=class wo extends ke{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new W,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new Nt}subGetOsnapPoints(t,e,s,a){Ft.Insertion===t&&a.push(this._position)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}subWorldDraw(t,e){const s={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Vr.BOTTOM_TO_TOP,attachmentPoint:we.BottomLeft};return t.mtext(s,this.getTextStyle(),e)}};wo.typeName="Text";let Yn=wo;var le=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(le||{}),_r=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(_r||{});const So=class So extends Yn{constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}};So.typeName="AttDef";let Pi=So;const Po=class Po extends Yn{constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&le.Invisible)!==0}set isInvisible(t){t?this._flags|=le.Invisible:this._flags&=~le.Invisible}get isConst(){return(this._flags&le.Const)!==0}set isConst(t){t?this._flags|=le.Const:this._flags&=~le.Const}get isVerifiable(){return(this._flags&le.Verifiable)!==0}set isVerifiable(t){t?this._flags|=le.Verifiable:this._flags&=~le.Verifiable}get isPreset(){return(this._flags&le.Preset)!==0}set isPreset(t){t?this._flags|=le.Preset:this._flags&=~le.Preset}get isMTextAttribute(){return(this._mtextFlag&_r.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=_r.MultiLine:this._mtextFlag&=~_r.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&_r.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=_r.ConstMultiLine:this._mtextFlag&=~_r.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}};Po.typeName="Attrib";let Ii=Po;const Io=class Io extends ke{constructor(t){super(),this._blockName=t,this._position=new W,this._rotation=0,this._normal=new Y(0,0,1),this._scaleFactors=new W(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId}attributeIterator(){return new ri(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??W.ORIGIN,s=new Ye().makeTranslation(-e.x,-e.y,-e.z),a=new Ye().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),h=new In().setFromAxisAngle(Y.Z_AXIS,this._rotation),u=new Ye().makeRotationFromQuaternion(h),m=new Ye().makeTranslation(this._position.x,this._position.y,this._position.z);return new Ye().multiplyMatrices(m,u).multiply(a).multiply(s)}subGetOsnapPoints(t,e,s,a,h){Ft.Insertion===t?a.push(this._position):h&&this.subEntityGetOsnapPoints(t,e,s,a,h)}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(s=>{e.properties.push({name:s.tag,type:"string",editable:!s.isConst,skipTranslation:!0,accessor:{get:()=>s.textString,set:a=>{s.textString=a}}})})}return t}get geometricExtents(){const t=new Nt,e=this.blockTableRecord;if(e!=null){const a=e.newIterator();for(const h of a)t.union(h.geometricExtents)}const s=this.blockTransform;return t.applyMatrix4(s),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const s=this.blockTransform,a=[];return this._attribs.forEach(u=>{if(!u.isInvisible){const m=u.worldDraw(t);m&&a.push(m)}}),Qn.instance.draw(t,e,this.rgbColor,a,!0,s,this._normal)}else return t.group([])}subEntityGetOsnapPoints(t,e,s,a,h){var m;if(h===this.objectId)return;const u=(m=this.database)==null?void 0:m.tables.blockTable;if(u!=null){const b=u.getEntityById(h);if(b){const f=[];b.subGetOsnapPoints(t,e,s,f,h);const w=this.blockTransform;f.forEach(x=>{const A=x.clone().applyMatrix4(w);a.push(A)})}}}};Io.typeName="BlockReference";let Kn=Io;const Ao=class Ao extends Ne{constructor(t,e,s=Y.Z_AXIS){super(),this._geo=new Qa(t,e,0,Zt,s,Y.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.Center:case Ft.Centroid:a.push(this._geo.center);break;case Ft.Quadrant:a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case Ft.Nearest:{const h=this._geo.nearestPoint(e);a.push(h)}break;case Ft.Tangent:{const h=this._geo.tangentPoints(e);a.push(...h);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}};Ao.typeName="Circle";let Ai=Ao;const Eo=class Eo extends Ne{constructor(t,e,s,a,h,u,m){super(),this._geo=new ta(t,e,s,a,h,u,m)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:this.closed||(a.push(this._geo.startPoint),a.push(this._geo.endPoint));break;case Ft.MidPoint:this.closed||a.push(this._geo.midPoint);break;case Ft.Quadrant:this.closed&&(a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3)));break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}};Eo.typeName="Ellipse";let Ei=Eo;const Mo=class Mo extends ke{constructor(){super(),this._vertices=[new W,new W,new W],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new W),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new Nt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=this._vertices.length,s=new Float32Array(e*3),a=new Uint16Array(e*2);for(let h=0;h<e;h++)s[h*3]=this._vertices[h].x,s[h*3+1]=this._vertices[h].y,s[h*3+2]=this._vertices[h].z,this.isEdgeVisibleAt(h)&&(a[h*2]=h,a[h*2+1]=(h+1)%4);return t.lineSegments(s,3,a)}};Mo.typeName="Face";let Mi=Mo;var Hs=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Hs||{}),Nh=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(Nh||{});const To=class To extends ke{constructor(){super(),this._elevation=0,this._geo=new Qi,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Hs[0],value:0},{label:Hs[1],value:1},{label:Hs[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;return e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,definitionLines:this.definitionLines},t.area(this._geo)}};To.typeName="Hatch";let Ks=To;var Lh=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(Lh||{});const ko=class ko extends Ne{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(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new W().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Nt().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new rn(this._vertices,"Uniform"),this._updated=!1)}};ko.typeName="Leader";let Ti=ko;var Ft=(n=>(n[n.EndPoint=1]="EndPoint",n[n.MidPoint=2]="MidPoint",n[n.Center=3]="Center",n[n.Node=4]="Node",n[n.Quadrant=5]="Quadrant",n[n.Insertion=7]="Insertion",n[n.Perpendicular=8]="Perpendicular",n[n.Tangent=9]="Tangent",n[n.Nearest=10]="Nearest",n[n.Centroid=11]="Centroid",n))(Ft||{});function nd(n){let t=0;for(const e of n)t|=1<<e-1;return t}function sd(n){const t=[];for(const e of Object.values(Ft)){if(typeof e!="number")continue;const s=1<<e-1;n&s&&t.push(e)}return t}function id(n,t){return n^1<<t-1}function ad(n,t){return(n&1<<t-1)!==0}function od(n,t){return n|1<<t-1}function ld(n,t){return n&~(1<<t-1)}const No=class No extends Ne{constructor(t,e){super(),this._geo=new Xn(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,s,a){const h=this.startPoint,u=this.endPoint;switch(t){case Ft.EndPoint:a.push(h),a.push(u);break;case Ft.MidPoint:a.push(this.midPoint);break;case Ft.Nearest:{const m=this._geo.project(e);a.push(m)}break;case Ft.Perpendicular:{const m=this._geo.perpPoint(e);a.push(m)}break;case Ft.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,s=this.endPoint,a=[new W(e.x,e.y,0),new W(s.x,s.y,0)];return t.lines(a)}};No.typeName="Line";let $s=No;const Lo=class Lo extends ke{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 W,this._attachmentPoint=we.TopLeft,this._direction=new Y(1,0,0),this._drawingDirection=Vr.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new Nt}subGetOsnapPoints(t,e,s,a){Ft.Insertion===t&&a.push(this._location)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:we[1],value:1},{label:we[2],value:2},{label:we[3],value:3},{label:we[4],value:4},{label:we[5],value:5},{label:we[6],value:6},{label:we[7],value:7},{label:we[8],value:8},{label:we[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:Vr[1],value:1},{label:Vr[2],value:2},{label:Vr[3],value:3},{label:Vr[4],value:4},{label:Vr[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt("STANDARD")||t.getAt("Standard")),e.textStyle}subWorldDraw(t,e){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};return t.mtext(s,this.getTextStyle(),e)}};Lo.typeName="MText";let Zs=Lo;const Co=class Co extends Ne{constructor(t,e,s,a,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(s!==void 0)+ +(a!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Ke.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new rn(t,e,s,a):this._geo=new rn(t,e,s,a,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:a.push(this._geo.startPoint),a.push(this._geo.endPoint);break}}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}};Co.typeName="Spline";let Qs=Co;const hd=new Y,Oo=class Oo extends Kn{constructor(t,e,s){super(t),this._attachmentPoint=we.TopLeft,this._numColumns=s,this._numRows=e,this._columnWidth=new Array(s),this._rowHeight=new Array(e),this._cells=new Array(e*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,s){return this._cells[t*e].text}setTextString(t,e,s){this._cells[t*e].text=s}isEmpty(t,e){return!this._cells[t*e].text}get geometricExtents(){return new Nt}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){let e=0,s=0;const a=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let A=0;A<=this.numRows;A++){e-=A>0?this.rowHeight(A-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++]=e,h[u++]=0}const m=[],b=new Array(this.numRows*this.numColumns).fill(!1);s=0,u=0;let f=0;for(let A=0;A<this.numColumns;A++){s+=A>0?this.columnWidth(A-1):0,e=0;for(let M=0;M<this.numRows;M++){e+=M>0?this.rowHeight(M-1):0;const L=this.cell(M*this.numColumns+A);if(f=M*this.numColumns+A,L&&!b[f]){const O=L.borderWidth??1,V=L.borderHeight??1;this.fillVisited(b,f,this.numColumns,O,V),a[u++]=A+M*(this.numColumns+1),a[u++]=A+M*(this.numColumns+1)+O;const F=h[a[u-1]*3]-s,at=A+(M+V)*(this.numColumns+1)+O;A+O==this.numColumns&&(a[u++]=A+M*(this.numColumns+1)+O,a[u++]=at);const ft=-h[at*3+1]-e;if(M+V==this.numRows&&(a[u++]=A+(M+V)*(this.numColumns+1)+V,a[u++]=A+(M+V)*(this.numColumns+1)),a[u++]=A+(M+V)*(this.numColumns+1),a[u++]=A+M*(this.numColumns+1),L.text){const st=L.attachmentPoint||this.attachmentPoint||we.MiddleCenter,H=this.getTableTextOffset(st,F,ft),dt={text:L.text,height:L.textHeight,width:F,position:hd.set(s,-e,0).clone().add(H),rotation:this.rotation,attachmentPoint:st},it=this.getTextStyle(L);m.push(t.mtext(dt,it))}}}}m.push(t.lineSegments(h,3,a));const w=t.group(m),x=new In;return x.setFromAxisAngle(Y.Z_AXIS,this.rotation),wl.compose(this.position,x,this.scaleFactors),w.applyMatrix(wl),w}fillVisited(t,e,s,a,h){if(h==1&&a==1)t[e]=!0;else for(let u=0;u<a;++u)for(let m=0;m<h;++m)t[e+u+m*s]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let s;return t.textStyle&&(s=e.getAt(t.textStyle)),s||(s=e.getAt("STANDARD")||e.getAt("Standard")),s.textStyle}getTableTextOffset(t,e,s){const a=new Y;switch(t){case 1:break;case 2:a.setX(e/2);break;case 3:a.setX(e);break;case 4:a.setY(-s/2);break;case 5:a.set(e/2,-s/2,0);break;case 6:a.set(e,-s/2,0);break;case 7:a.setY(-s);break;case 8:a.set(e/2,-s,0);break;case 9:a.set(e,-s,0);break}return a}};Oo.typeName="Table";let ki=Oo;const wl=new Ye,Bo=class Bo extends Ne{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new W,new W,new W,new W]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new Nt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=new An(this._vertices,!0),s=new Qi;s.add(e);const a=t.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(s)}};Bo.typeName="Trace";let Ni=Bo;const zo=class zo extends Ne{constructor(){super(),this._elevation=0,this._geo=new An}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,s=0,a=-1,h=-1){const u=a<0?void 0:a,m=h<0?void 0:h,b={x:e.x,y:e.y,bulge:s,startWidth:u,endWidth:m};this._geo.addVertexAt(t,b)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new W(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subGetOsnapPoints(t,e,s,a){const h=new Array;for(let u=0;u<this.numberOfVertices;++u)h.push(this.getPoint3dAt(u));switch(t){case Ft.EndPoint:a.push(...h);break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}};zo.typeName="Polyline";let Li=zo;const Ro=class Ro extends ke{constructor(){super(),this._geo=new W}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new Nt().expandByPoint(this._geo)}subGetOsnapPoints(t,e,s,a){Ft.Node===t&&a.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}};Ro.typeName="Point";let Ci=Ro;var Ch=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(Ch||{}),Oh=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Oh||{});const Fo=class Fo extends ke{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new W,this._scale=new Jt(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(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new Nt;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,s=this._height,a=new Se;a.setFromPoints(this._clipBoundary);const h=new kt;h.setX(this._position.x-a.min.x*e),h.setY(this._position.y-a.min.y*s),this._clipBoundary.forEach(u=>{const m=u.x*e+h.x,b=u.y*s+h.y;t.push(new W(m,b,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Sl.copy(t[1]);for(let e=1;e<4;e++)hi.copy(t[e]),hi.rotateAround(Sl,this._rotation),t[e].setX(hi.x),t[e].setY(hi.y)}t.push(t[0])}return t}};Fo.typeName="RasterImage";let Js=Fo;const Sl=new kt,hi=new kt,Vo=class Vo extends Ne{constructor(){super(),this._basePoint=new W,this._unitDir=new Y}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Nt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subGetOsnapPoints(t,e,s,a){switch(t){case Ft.EndPoint:a.push(this.basePoint);break}}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}};Vo.typeName="Ray";let Oi=Vo;const Uo=class Uo extends ke{constructor(){super(),this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new Nt}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Ph;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const s=[];return s.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),s.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),s.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),s}};Uo.typeName="Viewport";let Bi=Uo;const jo=class jo extends Js{subWorldDraw(t){const e=this.boundaryPath(),s=new Qi;return s.add(new An(e)),t.area(s)}};jo.typeName="Wipeout";let zi=jo;const Go=class Go extends Ne{constructor(){super(),this._basePoint=new W,this._unitDir=new Y}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Nt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}};Go.typeName="Xline";let Ri=Go;var Bh=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(Bh||{});const Wo=class Wo extends ke{constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new W,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new W,this._textRotation=0,this._normal=new Y(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new $n),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}subWorldDraw(t){if(this.dimBlockId){const s=this.database.tables.blockTable.getAt(this.dimBlockId);if(s){const a=this.computeDimBlockTransform();return Qn.instance.draw(t,s,this.rgbColor,[],!1,a,this._normal)}}return t.group([])}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 t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,s){const a=new W().subVectors(e,t).normalize();return new W(e).addScaledVector(a,s)}findPointOnLine2(t,e,s){const a=t.x+s*Math.cos(e),h=t.y+s*Math.sin(e);return{x:a,y:h}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():to.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??W.ORIGIN,s=new Ye().makeTranslation(-e.x,-e.y,-e.z),a=new Ye().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new Ye().multiplyMatrices(a,s)}};Wo.typeName="Dimension";let Ur=Wo;const Do=class Do extends Ur{constructor(t,e,s,a,h=null,u=null){super(),this._centerPoint=new W().copy(t),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(s),this._arcPoint=new W().copy(a),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Nt}};Do.typeName="3PointAngularDimension";let Fi=Do;const Ho=class Ho extends Ur{constructor(t,e,s,a=null,h=null){super(),this._dimLinePoint=new W().copy(s),this._xLine1Point=new W().copy(t),this._xLine2Point=new W().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),a?this.dimensionText=a:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get geometricExtents(){return new Nt}get isAppendArrow(){return!1}createDimBlock(t){const e=new he;e.name=t;const s=this.createLines();s.forEach(m=>e.appendEntity(new $s(m.startPoint,m.endPoint))),this.createArrows(s[0]).forEach(m=>e.appendEntity(m));const h=s[0].midPoint,u=this.createMText(h,this._rotation);return u&&e.appendEntity(u),e}createMText(t,e){const s=a=>({x:Math.cos(a),y:Math.sin(a),z:0});if(this.dimensionText){const a=new Zs;return a.attachmentPoint=we.MiddleLeft,a.layer="0",a.color=new fe(ct.ByBlock),a.location=t,a.contents=this.dimensionText??"",a.height=10,a.direction=s(e),a.styleName=this.dimensionStyle.dimtxsty,a}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,s){const a="_CAXARROW",h=new Kn(a);return h.position=t,h.rotation=e,h.scaleFactors={x:s,y:s,z:s},h}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),a=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(s,this._dimLinePoint),u=new Xn(a,h);return t.push(u),e.endPoint=a,this.adjustExtensionLine(e),t.push(e),s.endPoint=h,this.adjustExtensionLine(s),t.push(s),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,s=this.findPointOnLine2(t,e,100);return new Xn(t,{...s,z:t.z})}findIntersectionPoint(t,e){const s=t.startPoint,a=t.endPoint,h=new Y().subVectors(a,s).normalize(),m=new Y().subVectors(e,s).dot(h),b=new Y().copy(h).multiplyScalar(m);return new Y().addVectors(s,b)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,s=e.x-t.x,a=e.y-t.y;this._rotation=Math.atan2(a,s)}};Ho.typeName="AlignedDimension";let Vi=Ho;const qo=class qo extends Ur{constructor(t,e,s,a,h=null,u=null){super(),this._arcPoint=new W().copy(a),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(s),this._centerPoint=new W().copy(t),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Nt}};qo.typeName="ArcDimension";let Oa=qo;const Xo=class Xo extends Ur{constructor(t,e,s=0,a=null,h=null){super(),this._chordPoint=new W().copy(t),this._farChordPoint=new W().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=a,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Nt}drawLines(t,e){const s=[],a=e.length;return a==1?s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):a==3?(this.sortLines(e),s.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(t,e[1])),s.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{s.push(this.drawLine(t,h))}),s}drawLine(t,e,s){if(s){const a=[e.startPoint,e.endPoint];return t.lines(a)}else return e.worldDraw(t)}sortLines(t){const e=(s,a)=>s.x!==a.x?s.x-a.x:s.y!==a.y?s.y-a.y:s.z-a.z;t.sort((s,a)=>{const h=e(s.startPoint,a.startPoint);return h!==0?h:e(s.endPoint,a.endPoint)})}};Xo.typeName="DiametricDimension";let Ui=Xo;const Yo=class Yo extends Ur{constructor(t,e,s=null,a=null){super(),this._definingPoint=new W().copy(t),this._leaderEndPoint=new W().copy(e),this.dimensionText=s,this.dimensionStyleName=a}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new Nt}get arrowLineCount(){return 0}};Yo.typeName="OrdinateDimension";let ji=Yo;const Ko=class Ko extends Ur{constructor(t,e,s,a=null,h=null){super(),this._center=new W().copy(t),this._chordPoint=new W().copy(e),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=a,this.dimensionStyleName=h}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new Nt}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}};Ko.typeName="RadialDimension";let Gi=Ko;class ea extends jr{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new Se,this._extents=new Nt}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}}class qs extends jr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,a)=>{s===e&&(this._recordsByName.delete(a),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:a}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new ri(this._recordsByName)}}class zh extends qs{getBtrIdAt(t){for(const[e,s]of this._recordsByName)if(s.blockTableRecordId==t)return s}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class Rh extends jr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}}var Fh=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(Fh||{});class so extends jr{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){var e;const t=new so;return t._data=((e=this._data)==null?void 0:e.clone())??null,t}getDuplicateRecordCloning(){return 0}}class Vh{constructor(t){this.db=t}createDefaultLayer(){const t=new fe;return t.colorIndex=7,this.db.tables.layerTable.add(new na({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new Ys({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ys({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new Ys({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new co({name:"Standard",standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new $n({name:"Standard",dimtxsty:"Standard"}))}createDefaultLayout(){const t=new ea;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new Ks;e.patternName="SOLID";const s=new Ja;s.add(new Ws({x:0,y:0},{x:-1,y:.125})),s.add(new Ws({x:-1,y:.125},{x:-1,y:-.125})),s.add(new Ws({x:-1,y:-.125},{x:0,y:0})),e.add(s);const a=new he;a.name="_CAXARROW",a.appendEntity(e),this.db.tables.blockTable.add(a)}}}var Uh=(n=>(n.ClosedFilled="",n.Dot="_DOT",n.DotSmall="_DOTSMALL",n.DotBlank="_DOTBLANK",n.Origin="_ORIGIN",n.Origin2="_ORIGIN2",n.Open="_OPEN",n.Open90="_OPEN90",n.Open30="_OPEN30",n.Closed="_CLOSED",n.Small="_SMALL",n.None="_NONE",n.Oblique="_OBLIQUE",n.BoxFilled="_BOXFILLED",n.Box="_BOXBLANK",n.ClosedBlank="_CLOSEDBLANK",n.DatumBlank="_DATUMBLANK",n.DatumFilled="_DATUMFILLED",n.Integral="_INTEGRAL",n.ArchTick="_ARCHTICK",n))(Uh||{});class ri{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}var io=(n=>(n[n.Undefined=0]="Undefined",n[n.Inches=1]="Inches",n[n.Feet=2]="Feet",n[n.Miles=3]="Miles",n[n.Millimeters=4]="Millimeters",n[n.Centimeters=5]="Centimeters",n[n.Meters=6]="Meters",n[n.Kilometers=7]="Kilometers",n[n.Microinches=8]="Microinches",n[n.Mils=9]="Mils",n[n.Yards=10]="Yards",n[n.Angstroms=11]="Angstroms",n[n.Nanometers=12]="Nanometers",n[n.Microns=13]="Microns",n[n.Decimeters=14]="Decimeters",n[n.Dekameters=15]="Dekameters",n[n.Hectometers=16]="Hectometers",n[n.Gigameters=17]="Gigameters",n[n.Astronomical=18]="Astronomical",n[n.LightYears=19]="LightYears",n[n.Parsecs=20]="Parsecs",n[n.USSurveyFeet=21]="USSurveyFeet",n[n.USSurveyInch=22]="USSurveyInch",n[n.USSurveyYard=23]="USSurveyYard",n[n.USSurveyMile=24]="USSurveyMile",n[n.Max=24]="Max",n))(io||{});function ud(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function cd(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}const jh="Load Database";class Be extends Rl{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Fa.getInstance().getEntry(jh),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const a=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",a?a.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-s),a}}class ao{constructor(t={}){this.config=t}async read(t,e,s,a){const h={name:jh,data:{total:0},format(){let f="";return Object.keys(this.data).forEach(w=>{w!=="total"&&(f+=`- ${w}: ${this.data[w]} ms
5
- `)}),f+=`- total: ${this.data.total} ms`,f}};Fa.getInstance().collect(h),this.progress=a;const u={value:0},m=new Fl;m.setCompleteCallback(()=>this.onFinished()),m.setErrorCallback(f=>this.onError(f)),m.addTask(new Be({stage:"START",step:1,progress:u,task:async f=>f},a)),m.addTask(new Be({stage:"PARSE",step:5,progress:u,task:async f=>await this.parse(f)},a)),m.addTask(new Be({stage:"FONT",step:5,progress:u,task:async f=>{const w=this.getFonts(f.model);return{model:f.model,data:w}}},a)),m.addTask(new Be({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,e),f)},a)),m.addTask(new Be({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,e),f)},a)),m.addTask(new Be({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,e),f)},a)),m.addTask(new Be({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),f)},a)),m.addTask(new Be({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,e),f)},a)),m.addTask(new Be({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,e),f)},a)),m.addTask(new Be({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,e),f)},a)),m.addTask(new Be({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),f)},a)),m.addTask(new Be({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,e),f)},a)),m.addTask(new Be({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,e,s,u,a),f)},a)),m.addTask(new Be({stage:"END",step:0,progress:u,task:async f=>f},a));const b=Date.now();await m.run(t),h.data.total=Date.now()-b}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),Qn.instance.clear())}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,s,a,h){throw new Error("Not impelemented yet!")}}var pe,ws,ee,ae,Ss,or,Ie,Pr,lr,pn,Ps,Is,mn,gn,As,Es,Ms,Ge,Ir,Yt,fn,Ts,vt,Ae,ks,Ee,Ns,Ar,Er,hr,Ls,_n,We,Mr,yn,ya,va,Tr,kr,Cs,Os,Nr,Bs,ba,xa,me,Lr,ge,De,wa,Sa,Pa,Ia,Cr,He,vn,zs,bn,qe,Or,Xe,Br;(pe={})[pe.None=0]="None",pe[pe.Anonymous=1]="Anonymous",pe[pe.NonConstant=2]="NonConstant",pe[pe.Xref=4]="Xref",pe[pe.XrefOverlay=8]="XrefOverlay",pe[pe.ExternallyDependent=16]="ExternallyDependent",pe[pe.ResolvedOrDependent=32]="ResolvedOrDependent",pe[pe.ReferencedXref=64]="ReferencedXref";(ws={})[ws.BYBLOCK=0]="BYBLOCK",ws[ws.BYLAYER=256]="BYLAYER";(ee={})[ee.Rotated=0]="Rotated",ee[ee.Aligned=1]="Aligned",ee[ee.Angular=2]="Angular",ee[ee.Diameter=3]="Diameter",ee[ee.Radius=4]="Radius",ee[ee.Angular3Point=5]="Angular3Point",ee[ee.Ordinate=6]="Ordinate",ee[ee.ReferenceIsExclusive=32]="ReferenceIsExclusive",ee[ee.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",ee[ee.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(ae={})[ae.TopLeft=1]="TopLeft",ae[ae.TopCenter=2]="TopCenter",ae[ae.TopRight=3]="TopRight",ae[ae.MiddleLeft=4]="MiddleLeft",ae[ae.MiddleCenter=5]="MiddleCenter",ae[ae.MiddleRight=6]="MiddleRight",ae[ae.BottomLeft=7]="BottomLeft",ae[ae.BottomCenter=8]="BottomCenter",ae[ae.BottomRight=9]="BottomRight";(Ss={})[Ss.AtLeast=1]="AtLeast",Ss[Ss.Exact=2]="Exact";var Pl=((or={})[or.Center=0]="Center",or[or.Above=1]="Above",or[or.Outside=2]="Outside",or[or.JIS=3]="JIS",or[or.Below=4]="Below",or),Gn=((Ie={})[Ie.Feet=0]="Feet",Ie[Ie.None=1]="None",Ie[Ie.Inch=2]="Inch",Ie[Ie.FeetAndInch=3]="FeetAndInch",Ie[Ie.Leading=4]="Leading",Ie[Ie.Trailing=8]="Trailing",Ie[Ie.LeadingAndTrailing=12]="LeadingAndTrailing",Ie),dd=((Pr={})[Pr.None=0]="None",Pr[Pr.Leading=1]="Leading",Pr[Pr.Trailing=2]="Trailing",Pr[Pr.LeadingAndTrailing=3]="LeadingAndTrailing",Pr),pd=((lr={})[lr.Center=0]="Center",lr[lr.Left=1]="Left",lr[lr.Right=2]="Right",lr[lr.OverFirst=3]="OverFirst",lr[lr.OverSecond=4]="OverSecond",lr),md=((pn={})[pn.Bottom=0]="Bottom",pn[pn.Center=1]="Center",pn[pn.Top=2]="Top",pn),gd=((Ps={})[Ps.PatternFill=0]="PatternFill",Ps[Ps.SolidFill=1]="SolidFill",Ps);(Is={})[Is.NonAssociative=0]="NonAssociative",Is[Is.Associative=1]="Associative";(mn={})[mn.Normal=0]="Normal",mn[mn.Outer=1]="Outer",mn[mn.Ignore=2]="Ignore";(gn={})[gn.UserDefined=0]="UserDefined",gn[gn.Predefined=1]="Predefined",gn[gn.Custom=2]="Custom";(As={})[As.NotAnnotated=0]="NotAnnotated",As[As.Annotated=1]="Annotated";(Es={})[Es.Solid=0]="Solid",Es[Es.Gradient=1]="Gradient";(Ms={})[Ms.TwoColor=0]="TwoColor",Ms[Ms.OneColor=1]="OneColor";var fd=((Ge={})[Ge.Default=0]="Default",Ge[Ge.External=1]="External",Ge[Ge.Polyline=2]="Polyline",Ge[Ge.Derived=4]="Derived",Ge[Ge.Textbox=8]="Textbox",Ge[Ge.Outermost=16]="Outermost",Ge),ui=((Ir={})[Ir.Line=1]="Line",Ir[Ir.Circular=2]="Circular",Ir[Ir.Elliptic=3]="Elliptic",Ir[Ir.Spline=4]="Spline",Ir),_d=((Yt={})[Yt.Off=0]="Off",Yt[Yt.Solid=1]="Solid",Yt[Yt.Dashed=2]="Dashed",Yt[Yt.Dotted=3]="Dotted",Yt[Yt.ShotDash=4]="ShotDash",Yt[Yt.MediumDash=5]="MediumDash",Yt[Yt.LongDash=6]="LongDash",Yt[Yt.DoubleShortDash=7]="DoubleShortDash",Yt[Yt.DoubleMediumDash=8]="DoubleMediumDash",Yt[Yt.DoubleLongDash=9]="DoubleLongDash",Yt[Yt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Yt[Yt.SparseDot=11]="SparseDot",Yt);_d.Off;(fn={})[fn.Standard=-3]="Standard",fn[fn.ByLayer=-2]="ByLayer",fn[fn.ByBlock=-1]="ByBlock";(Ts={})[Ts.English=0]="English",Ts[Ts.Metric=1]="Metric";(vt={})[vt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",vt[vt.FRONT_CLIPPING=2]="FRONT_CLIPPING",vt[vt.BACK_CLIPPING=4]="BACK_CLIPPING",vt[vt.UCS_FOLLOW=8]="UCS_FOLLOW",vt[vt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",vt[vt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",vt[vt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",vt[vt.FAST_ZOOM=128]="FAST_ZOOM",vt[vt.SNAP_MODE=256]="SNAP_MODE",vt[vt.GRID_MODE=512]="GRID_MODE",vt[vt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",vt[vt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",vt[vt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",vt[vt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",vt[vt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",vt[vt.UNUSED=32768]="UNUSED",vt[vt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",vt[vt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",vt[vt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",vt[vt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",vt[vt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",vt[vt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(Ae={})[Ae.OPTIMIZED_2D=0]="OPTIMIZED_2D",Ae[Ae.WIREFRAME=1]="WIREFRAME",Ae[Ae.HIDDEN_LINE=2]="HIDDEN_LINE",Ae[Ae.FLAT_SHADED=3]="FLAT_SHADED",Ae[Ae.GOURAUD_SHADED=4]="GOURAUD_SHADED",Ae[Ae.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Ae[Ae.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(ks={})[ks.UCS_UNCHANGED=0]="UCS_UNCHANGED",ks[ks.HAS_OWN_UCS=1]="HAS_OWN_UCS";(Ee={})[Ee.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",Ee[Ee.TOP=1]="TOP",Ee[Ee.BOTTOM=2]="BOTTOM",Ee[Ee.FRONT=3]="FRONT",Ee[Ee.BACK=4]="BACK",Ee[Ee.LEFT=5]="LEFT",Ee[Ee.RIGHT=6]="RIGHT";(Ns={})[Ns.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ns[Ns.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Ar={})[Ar.ByLayer=0]="ByLayer",Ar[Ar.ByBlock=1]="ByBlock",Ar[Ar.ByDictionaryDefault=2]="ByDictionaryDefault",Ar[Ar.ByObject=3]="ByObject";function It(n,t,e){return n.code===t&&(e==null||n.value===e)}function Rt(n){let t={};n.rewind();let e=n.next(),s=e.code;if(t.x=e.value,(e=n.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=n.next()).code!==s+20?n.rewind():t.z=e.value,t}let oo=Symbol();function xt(n,t){return(e,s,a)=>{let h=function(b,f=!1){return b.reduce((w,x)=>{x.pushContext&&w.push({});let A=w[w.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let L=A[M]??(A[M]=[]);x.isMultiple&&L.length&&f&&console.warn(`Snippet ${L[L.length-1].name} for code(${M}) is shadowed by ${x.name}`),L.push(x)}return w},[{}])}(n,s.debug),u=!1,m=h.length-1;for(;!It(e,0,"EOF");){let b=function(V,F,at){return V.find((ft,st)=>{var H;return st>=at&&((H=ft[F])==null?void 0:H.length)})}(h,e.code,m),f=b==null?void 0:b[e.code],w=f==null?void 0:f[f.length-1];if(!b||!w){s.rewind();break}w.isMultiple||b[e.code].pop();let{name:x,parser:A,isMultiple:M,isReducible:L}=w,O=A==null?void 0:A(e,s,a);if(O===oo){s.rewind();break}if(x){let[V,F]=function(at,ft){let st=ft.split(".");if(!st.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let H=at;for(let dt=0;dt<st.length-1;++dt){let it=Aa(st[dt]),Wt=Aa(st[dt+1]);Object.prototype.hasOwnProperty.call(H,it)||(typeof Wt=="number"?H[it]=[]:H[it]={}),H=H[it]}return[H,Aa(st[st.length-1])]}(a,x);M&&!L?(Object.prototype.hasOwnProperty.call(V,F)||(V[F]=[]),V[F].push(O)):V[F]=O}w.pushContext&&(m-=1),u=!0,e=s.next()}return t&&Object.setPrototypeOf(a,t),u}}function Aa(n){let t=Number.parseInt(n);return Number.isNaN(t)?n:t}function v({value:n}){return n}function D(n,t){return Rt(t)}function Ut({value:n}){return!!n}let yd=[{code:1001,name:"xdata",parser:Gh}];function Gh(n,t){var a;if(!It(n,1001))throw Error("XData must starts with code 1001");let e={appName:n.value,value:[]};n=t.next();let s=[e.value];for(;!It(n,0,"EOF")&&n.code>=1e3;){let h=s[s.length-1];switch(n.code){case 1002:n.value==="{"?s.push([]):(s.pop(),(a=s[s.length-1])==null||a.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:zr(n.code),value:n.value});break;case 1003:h.push({name:"layer",type:zr(n.code),value:n.value});break;case 1005:h.push({name:"handle",type:zr(n.code),value:n.value});break;case 1010:h.push({type:zr(n.code),value:Rt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:zr(n.code),value:Rt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:zr(n.code),value:Rt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:zr(n.code),value:Rt(t)});break;case 1041:h.push({name:"distance",type:zr(n.code),value:n.value});break;case 1042:h.push({name:"scale",type:zr(n.code),value:n.value})}n=t.next()}return t.rewind(),e}function zr(n){switch(n){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 Pn(n,t,e){for(;It(n,102);){var s;let a=n.value;if(n=t.next(),!a.startsWith("{")){t.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${a}`),function(u,m){for(;!It(u,102)&&!It(u,0,"EOF");)u=m.next()}(n,t),n=t.next();continue}let h=a.slice(1).trim();e.extensions??(e.extensions={}),(s=e.extensions)[h]??(s[h]=[]),function(u,m,b){for(;!It(u,102,"}")&&!It(u,0,"EOF");)b.push(u),u=m.next()}(n,t,e.extensions[h]),n=t.next()}t.rewind()}let vd=0;function Wh(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=vd++)}var bd=[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 Dh(n){return bd[n]}(Er={})[Er.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Er[Er.CAST=1]="CAST",Er[Er.RECEIVE=2]="RECEIVE",Er[Er.IGNORE=3]="IGNORE";let Gt=[...yd,{code:284,name:"shadowMode",parser:v},{code:390,name:"plotStyleHardId",parser:v},{code:380,name:"plotStyleType",parser:v},{code:440,name:"transparency",parser:v},{code:430,name:"colorName",parser:v},{code:420,name:"color",parser:v},{code:310,name:"proxyEntity",isMultiple:!0,parser:v},{code:92,name:"proxyByte",parser:v},{code:60,name:"isVisible",parser:Ut},{code:48,name:"lineTypeScale",parser:v},{code:370,name:"lineweight",parser:v},{code:62,name:"colorIndex",parser(n,t,e){let s=n.value;return s>0&&s<256&&(e.color=Dh(Math.abs(s))),s}},{code:347,name:"materialObjectHardId",parser:v},{code:6,name:"lineType",parser:v},{code:8,name:"layer",parser:v},{code:410,name:"layoutTabName",parser:v},{code:67,name:"isInPaperSpace",parser:Ut},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:v},{code:102,parser:Pn},{code:102,parser:Pn},{code:102,parser:Pn},{code:5,name:"handle",parser:v}];function ra(n){return[{code:3,name:n,parser:(t,e,s)=>(s._code3text=(s._code3text??"")+t.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(t,e,s)=>(s._code1text=t.value,(s._code3text??"")+s._code1text)}]}function Hh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let xd={extrusionDirection:{x:0,y:0,z:1}},wd=[{code:210,name:"extrusionDirection",parser:D},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:100,name:"subclassMarker",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D},{code:39,name:"thickness",parser:v},{code:100},...Gt];class qh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Hh(this,"parser",xt(wd,xd))}}Hh(qh,"ForEntityName","ARC");(hr={})[hr.NONE=0]="NONE",hr[hr.INVISIBLE=1]="INVISIBLE",hr[hr.CONSTANT=2]="CONSTANT",hr[hr.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",hr[hr.PRESET=8]="PRESET";(Ls={})[Ls.MULTILINE=2]="MULTILINE",Ls[Ls.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(_n={})[_n.NONE=0]="NONE",_n[_n.MIRRORED_X=2]="MIRRORED_X",_n[_n.MIRRORED_Y=4]="MIRRORED_Y";var Sd=((We={})[We.LEFT=0]="LEFT",We[We.CENTER=1]="CENTER",We[We.RIGHT=2]="RIGHT",We[We.ALIGNED=3]="ALIGNED",We[We.MIDDLE=4]="MIDDLE",We[We.FIT=5]="FIT",We),Pd=((Mr={})[Mr.BASELINE=0]="BASELINE",Mr[Mr.BOTTOM=1]="BOTTOM",Mr[Mr.MIDDLE=2]="MIDDLE",Mr[Mr.TOP=3]="TOP",Mr);function Xh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Yh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Sd.LEFT,valign:Pd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Kh=[{code:73,name:"valign",parser:v},{code:100},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"endPoint",parser:D},{code:72,name:"valign",parser:v},{code:72,name:"halign",parser:v},{code:71,name:"generationFlag",parser:v},{code:7,name:"styleName",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"xScale",parser:v},{code:50,name:"rotation",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class $h{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xh(this,"parser",xt(Kh,Yh))}}function Zh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Xh($h,"ForEntityName","TEXT");let Id={...Yh},Ad=[{code:2},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:D},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Ut},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedRecord",parser:Ut},{code:100},{code:280,name:"isLocked",parser:Ut},{code:74,name:"valign",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:3,name:"prompt",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},...Kh.slice(2)];class Qh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zh(this,"parser",xt(Ad,Id))}}Zh(Qh,"ForEntityName","ATTDEF");(yn={})[yn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",yn[yn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",yn[yn.BY_STYLE=5]="BY_STYLE";function Ed(n,t){let e={};for(let s of n){let a=t(s);a!=null&&(e[a]??(e[a]=[]),e[a].push(s))}return e}function*Wi(n,t=1/0,e=1){for(let s=n;s!==t;s+=e)yield s}function tn(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function lo(n,t,e){if(It(t,102))return Pn(t,e,n),!0;switch(t.code){case 0:n.type=t.value;break;case 5:n.handle=t.value;break;case 330:n.ownerBlockRecordSoftId=t.value;break;case 67:n.isInPaperSpace=!!t.value;break;case 8:n.layer=t.value;break;case 6:n.lineType=t.value;break;case 347:n.materialObjectHardId=t.value;break;case 62:n.colorIndex=t.value,n.color=Dh(Math.abs(t.value));break;case 370:n.lineweight=t.value;break;case 48:n.lineTypeScale=t.value;break;case 60:n.isVisible=!!t.value;break;case 92:n.proxyByte=t.value;break;case 310:n.proxyEntity=t.value;break;case 100:break;case 420:n.color=t.value;break;case 430:n.transparency=t.value;break;case 390:n.plotStyleHardId=t.value;break;case 284:n.shadowMode=t.value;break;case 1001:n.xdata=Gh(t,e);break;default:return!1}return!0}function Jh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Md={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},mi=[{code:46,name:"annotationHeight",parser:v},{code:101,parser(n,t){(function(e){e.rewind();let s=e.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=e.next();while(s.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:v},{code:49,name:"columnGutter",parser:v},{code:48,name:"columnWidth",parser:v},{code:79,name:"columnAutoHeight",parser:v},{code:78,name:"columnFlowReversed",parser:v},{code:76,name:"columnCount",parser:v},{code:75,name:"columnType",parser:v},{code:441,name:"backgroundFillTransparency",parser:v},{code:63,name:"backgroundFillColor",parser:v},{code:45,name:"fillBoxScale",parser:v},{code:[...Wi(430,440)],name:"backgroundColor",parser:v},{code:[...Wi(420,430)],name:"backgroundColor",parser:v},{code:90,name:"backgroundFill",parser:v},{code:44,name:"lineSpacing",parser:v},{code:73,name:"lineSpacingStyle",parser:v},{code:50,name:"rotation",parser:v},{code:43},{code:42},{code:11,name:"direction",parser:D},{code:210,name:"extrusionDirection",parser:D},{code:7,name:"styleName",parser:v},...ra("text"),{code:72,name:"drawingDirection",parser:v},{code:71,name:"attachmentPoint",parser:v},{code:41,name:"width",parser:v},{code:40,name:"height",parser:v},{code:10,name:"insertionPoint",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class tu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Jh(this,"parser",xt(mi,Md))}}function eu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Jh(tu,"ForEntityName","MTEXT");let Td={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},kd=[...mi.slice(mi.findIndex(({name:n})=>n==="columnType"),mi.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!It(n,0,"MTEXT"))return oo}},{code:2,name:"definitionTag",parser:v},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:D},{code:340,name:"secondaryAttributesHardId",parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Ut},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedEntriesKeep",parser:Ut},{code:100},{code:280,name:"lockPositionFlag",parser:Ut},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"alignmentPoint",parser:D},{code:74,name:"verticalJustification",parser:v},{code:72,name:"horizontalJustification",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:7,name:"textStyle",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"scale",parser:v},{code:50,name:"rotation",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100},...Gt];class ru{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){eu(this,"parser",xt(kd,Td))}}function nu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}eu(ru,"ForEntityName","ATTRIB");let Nd=[...ra("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class su{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nu(this,"parser",xt(Nd))}}function iu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}nu(su,"ForEntityName","BODY");let Ld={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Cd=[{code:210,name:"extrusionDirection",parser:D},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class au{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){iu(this,"parser",xt(Cd,Ld))}}iu(au,"ForEntityName","CIRCLE");class gi{parseEntity(t,e){let s={};for(;!It(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(a,h,u){switch(h.code){case 100:a.subclassMarker=h.value;break;case 280:a.version=h.value;break;case 2:a.name=h.value;break;case 10:a.definitionPoint=Rt(u);break;case 11:a.textPoint=Rt(u);break;case 12:a.insertionPoint=Rt(u);break;case 13:a.subDefinitionPoint1=Rt(u);break;case 14:a.subDefinitionPoint2=Rt(u);break;case 15:a.centerPoint=Rt(u);break;case 16:a.arcPoint=Rt(u);break;case 70:a.dimensionType=h.value;break;case 71:a.attachmentPoint=h.value;break;case 72:a.textLineSpacingStyle=h.value;break;case 40:a.leaderLength=h.value;break;case 41:a.textLineSpacingFactor=h.value;break;case 42:a.measurement=h.value;break;case 1:a.text=h.value;break;case 50:a.rotationAngle=h.value;break;case 52:a.obliqueAngle=h.value;break;case 53:a.textRotation=h.value;break;case 51:a.ocsRotation=h.value;break;case 210:a.extrusionDirection=Rt(u);break;case 3:a.styleName=h.value;break;default:lo(a,h,u)}})(s,e,t),e=t.next()}return s}}function ou(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}va="DIMENSION",(ya="ForEntityName")in gi?Object.defineProperty(gi,ya,{value:va,enumerable:!0,configurable:!0,writable:!0}):gi[ya]=va;let Od={extrusionDirection:{x:0,y:0,z:1}},Bd=[{code:42,name:"endAngle",parser:v},{code:41,name:"startAngle",parser:v},{code:40,name:"axisRatio",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"majorAxisEndPoint",parser:D},{code:10,name:"center",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class lu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ou(this,"parser",xt(Bd,Od))}}ou(lu,"ForEntityName","ELLIPSE");(Tr={})[Tr.First=1]="First",Tr[Tr.Second=2]="Second",Tr[Tr.Third=4]="Third",Tr[Tr.Fourth=8]="Fourth";function hu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let zd=[{code:13,name:"vertices.3",parser:D},{code:12,name:"vertices.2",parser:D},{code:11,name:"vertices.1",parser:D},{code:10,name:"vertices.0",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class uu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){hu(this,"parser",xt(zd))}}hu(uu,"ForEntityName","3DFACE");let cu=[{code:330,name:"sourceBoundaryObjects",parser:v,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:v}],Rd=[{code:11,name:"end",parser:D},{code:10,name:"start",parser:D}],Fd=[{code:73,name:"isCCW",parser:Ut},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D}],Vd=[{code:73,name:"isCCW",parser:Ut},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"lengthOfMinorAxis",parser:v},{code:11,name:"end",parser:D},{code:10,name:"center",parser:D}],Ud=[{code:13,name:"endTangent",parser:D},{code:12,name:"startTangent",parser:D},{code:11,name:"fitDatum",isMultiple:!0,parser:D},{code:97,name:"numberOfFitData",parser:v},{code:10,name:"controlPoints",isMultiple:!0,parser(n,t){let e={...Rt(t),weight:1};return(n=t.next()).code===42?e.weight=n.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:v},{code:96,name:"numberOfControlPoints",parser:v},{code:95,name:"numberOfKnots",parser:v},{code:74,name:"isPeriodic",parser:Ut},{code:73,name:"splineFlag",parser:v},{code:94,name:"degree",parser:v}],jd={[ui.Line]:Rd,[ui.Circular]:Fd,[ui.Elliptic]:Vd,[ui.Spline]:Ud},Gd=[...cu,{code:72,name:"edges",parser(n,t){let e={type:n.value},s=xt(jd[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(n=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:v}],Wd=[...cu,{code:10,name:"vertices",parser(n,t){let e={...Rt(t),bulge:0};return(n=t.next()).code===42?e.bulge=n.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:v},{code:73,name:"isClosed",parser:Ut},{code:72,name:"hasBulge",parser:Ut}],Dd=[{code:49,name:"dashLengths",parser:v,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:v},{code:45,name:"offset",parser:Il},{code:43,name:"base",parser:Il},{code:53,name:"angle",parser:v}];function Il(n,t){let e=n.code+1,s={x:n.value,y:1};return(n=t.next()).code===e?s.y=n.value:t.rewind(),s}function du(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Hd={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},qd=[{code:470},{code:463},{code:462,name:"colorTint",parser:v},{code:461,name:"gradientDefinition",parser:v},{code:460,name:"gradientRotation",parser:v},{code:453,name:"numberOfColors",parser:v},{code:452,name:"gradientColorFlag",parser:v},{code:451},{code:450,name:"gradientFlag",parser:v},{code:10,name:"seedPoints",parser:D,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:D},{code:98,name:"numberOfSeedPoints",parser:v},{code:47,name:"pixelSize",parser:v},{code:53,name:"definitionLines",parser:function(n,t){let e={};return xt(Dd)(n,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:v},{code:77,name:"isDouble",parser:Ut},{code:73,name:"isAnnotated",parser:Ut},{code:41,name:"patternScale",parser:v},{code:52,name:"patternAngle",parser:v},{code:76,name:"patternType",parser:v},{code:75,name:"hatchStyle",parser:v},{code:92,name:"boundaryPaths",parser:function(n,t){let e={boundaryPathTypeFlag:n.value},s=e.boundaryPathTypeFlag&fd.Polyline;return n=t.next(),s?xt(Wd)(n,t,e):xt(Gd)(n,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:v},{code:71,name:"associativity",parser:v},{code:63,name:"patternFillColor",parser:v},{code:70,name:"solidFill",parser:v},{code:2,name:"patternName",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:10,name:"elevationPoint",parser:D},{code:100,name:"subclassMarker",parser:v,pushContext:!0},...Gt];class pu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){du(this,"parser",xt(qd,Hd))}}du(pu,"ForEntityName","HATCH");(kr={})[kr.ShowImage=1]="ShowImage",kr[kr.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",kr[kr.UseClippingBoundary=4]="UseClippingBoundary",kr[kr.TransparencyIsOn=8]="TransparencyIsOn";(Cs={})[Cs.Rectangular=1]="Rectangular",Cs[Cs.Polygonal=2]="Polygonal";(Os={})[Os.Outside=0]="Outside",Os[Os.Inside=1]="Inside";function mu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Xd={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Yd=[{code:290,name:"clipMode",parser:v},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:D},{code:91,name:"countBoundaryPoints",parser:v},{code:71,name:"clippingBoundaryType",parser:v},{code:360,name:"imageDefReactorHandle",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipped",parser:Ut},{code:70,name:"flags",parser:v},{code:340,name:"imageDefHandle",parser:v},{code:13,name:"imageSize",parser:D},{code:12,name:"vPixel",parser:D},{code:11,name:"uPixel",parser:D},{code:10,name:"position",parser:D},{code:90,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class gu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){mu(this,"parser",xt(Yd,Xd))}}function fu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}mu(gu,"ForEntityName","IMAGE");let Kd={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},$d=[{code:210,name:"extrusionDirection",parser:D},{code:45,name:"rowSpacing",parser:v},{code:44,name:"columnSpacing",parser:v},{code:71,name:"rowCount",parser:v},{code:70,name:"columnCount",parser:v},{code:50,name:"rotation",parser:v},{code:43,name:"zScale",parser:v},{code:42,name:"yScale",parser:v},{code:41,name:"xScale",parser:v},{code:10,name:"insertionPoint",parser:D},{code:2,name:"name",parser:v},{code:66,name:"isVariableAttributes",parser:Ut},{code:100,name:"subclassMarker",parser:v},...Gt];class _u{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){fu(this,"parser",xt($d,Kd))}}function yu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}fu(_u,"ForEntityName","INSERT");let Zd={isArrowheadEnabled:!0},Qd=[{code:213,name:"offsetFromAnnotation",parser:D},{code:212,name:"offsetFromBlock",parser:D},{code:211,name:"horizontalDirection",parser:D},{code:210,name:"normal",parser:D},{code:340,name:"associatedAnnotation",parser:v},{code:77,name:"byBlockColor",parser:v},{code:10,name:"vertices",parser:D,isMultiple:!0},{code:76,name:"numberOfVertices",parser:v},{code:41,name:"textWidth",parser:v},{code:40,name:"textHeight",parser:v},{code:75,name:"isHooklineExists",parser:Ut},{code:74,name:"isHooklineSameDirection",parser:Ut},{code:73,name:"leaderCreationFlag",parser:v},{code:72,name:"isSpline",parser:Ut},{code:71,name:"isArrowheadEnabled",parser:Ut},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class vu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yu(this,"parser",xt(Qd,Zd))}}yu(vu,"ForEntityName","LEADER");(Nr={})[Nr.TextAnnotation=0]="TextAnnotation",Nr[Nr.ToleranceAnnotation=1]="ToleranceAnnotation",Nr[Nr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Nr[Nr.NoAnnotation=3]="NoAnnotation";function bu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Jd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},t0=[{code:210,name:"extrusionDirection",parser:D},{code:11,name:"endPoint",parser:D},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class xu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){bu(this,"parser",xt(t0,Jd))}}bu(xu,"ForEntityName","LINE");(Bs={})[Bs.IS_CLOSED=1]="IS_CLOSED",Bs[Bs.PLINE_GEN=128]="PLINE_GEN";let e0={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},r0={bulge:0},n0=[{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:91,name:"id",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v}],s0=[{code:210,name:"extrusionDirection",parser:D},{code:10,name:"vertices",isMultiple:!0,parser(n,t){let e={};return xt(n0,r0)(n,t,e),e}},{code:39,name:"thickness",parser:v},{code:38,name:"elevation",parser:v},{code:43,name:"constantWidth",parser:v},{code:70,name:"flag",parser:v},{code:90,name:"numberOfVertices",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class fi{parseEntity(t,e){let s={};return xt(s0,e0)(e,t,s),s}}function wu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}xa="LWPOLYLINE",(ba="ForEntityName")in fi?Object.defineProperty(fi,ba,{value:xa,enumerable:!0,configurable:!0,writable:!0}):fi[ba]=xa;let i0=[{code:90,name:"overridenSubEntityCount",parser:v},{code:140,name:"edgeCreaseWeights",parser:v,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:v},{code:94,parser(n,t,e){e.edgeCount=n.value,e.edgeIndices=[];for(let s=0;s<e.edgeCount;++s){let a=[];n=t.next(),a[0]=n.value,n=t.next(),a[1]=n.value,e.edgeIndices.push(a)}}},{code:93,parser(n,t,e){e.totalFaceIndices=n.value,e.faceIndices=[];let s=[];for(let h=0;h<e.totalFaceIndices&&!It(n,0);++h)n=t.next(),s.push(n.value);let a=0;for(;a<s.length;){let h=s[a++],u=[];for(let m=0;m<h;++m)u.push(s[a++]);e.faceIndices.push(u)}}},{code:10,name:"vertices",parser:D,isMultiple:!0},{code:92,name:"verticesCount",parser:v},{code:91,name:"subdivisionLevel",parser:v},{code:40,name:"blendCrease",parser:v},{code:72,name:"isBlendCreased",parser:Ut},{code:71,name:"version",parser:v},{code:100,name:"subclassMarker",parser:function({value:n}){return n.trim()},pushContext:!0},...Gt];class Su{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){wu(this,"parser",xt(i0))}}function Pu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}wu(Su,"ForEntityName","MESH");let a0={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},o0=[{code:50,name:"angle",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:39,name:"thickness",parser:v},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class Iu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Pu(this,"parser",xt(o0,a0))}}Pu(Iu,"ForEntityName","POINT");(me={})[me.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",me[me.CURVE_FIT=2]="CURVE_FIT",me[me.SPLINE_FIT=4]="SPLINE_FIT",me[me.POLYLINE_3D=8]="POLYLINE_3D",me[me.POLYGON_3D=16]="POLYGON_3D",me[me.CLOSED_POLYGON=32]="CLOSED_POLYGON",me[me.POLYFACE=64]="POLYFACE",me[me.CONTINUOUS=128]="CONTINUOUS";var ci=((Lr={})[Lr.NONE=0]="NONE",Lr[Lr.QUADRATIC=5]="QUADRATIC",Lr[Lr.CUBIC=6]="CUBIC",Lr[Lr.BEZIER=8]="BEZIER",Lr),l0=((ge={})[ge.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ge[ge.TANGENT_DEFINED=2]="TANGENT_DEFINED",ge[ge.NOT_USED=4]="NOT_USED",ge[ge.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ge[ge.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ge[ge.FOR_POLYLINE=32]="FOR_POLYLINE",ge[ge.FOR_POLYGON=64]="FOR_POLYGON",ge[ge.POLYFACE=128]="POLYFACE",ge);function Au(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let h0={startWidth:0,endWidth:0,bulge:0},u0=[{code:91,name:"id",parser:v},{code:[...Wi(71,75)],name:"faces",isMultiple:!0,parser:v},{code:50,name:"tangentDirection",parser:v},{code:70,name:"flag",parser:v},{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:30,name:"z",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...Gt];class ho{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Au(this,"parser",xt(u0,h0))}}function Eu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Au(ho,"ForEntityName","VERTEX");let c0={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:[]},d0=[{code:0,name:"vertices",isMultiple:!0,parser:(n,t)=>It(n,0,"VERTEX")?(n=t.next(),new ho().parseEntity(t,n)):oo},{code:210,name:"extrusionDirection",parser:D},{code:75,name:"smoothType",parser:v},{code:74,name:"surfaceNDensity",parser:v},{code:73,name:"surfaceMDensity",parser:v},{code:72,name:"meshNVertexCount",parser:v},{code:71,name:"meshMVertexCount",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:70,name:"flag",parser:v},{code:39,name:"thickness",parser:v},{code:30,name:"elevation",parser:v},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:v},...Gt];class Mu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Eu(this,"parser",xt(d0,c0))}}function Tu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Eu(Mu,"ForEntityName","POLYLINE");let p0=[{code:11,name:"direction",parser:D},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class ku{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Tu(this,"parser",xt(p0))}}function Nu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Tu(ku,"ForEntityName","RAY");let m0=[...ra("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Lu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Nu(this,"parser",xt(m0))}}function Cu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Nu(Lu,"ForEntityName","REGION");let g0={vertices:[],backLineVertices:[]},f0=[{code:360,name:"geometrySettingHardId",parser:v},{code:12,name:"backLineVertices",isMultiple:!0,parser:D},{code:93,name:"numberOfBackLineVertices",parser:v},{code:11,name:"vertices",isMultiple:!0,parser:D},{code:92,name:"verticesCount",parser:v},{code:[63,411],name:"indicatorColor",parser:v},{code:70,name:"indicatorTransparency",parser:v},{code:41,name:"bottomHeight",parser:v},{code:40,name:"topHeight",parser:v},{code:10,name:"verticalDirection",parser:D},{code:1,name:"name",parser:v},{code:91,name:"flag",parser:v},{code:90,name:"state",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Ou{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Cu(this,"parser",xt(f0,g0))}}function Bu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Cu(Ou,"ForEntityName","SECTION");let _0={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},y0=[{code:210,name:"extrusionDirection",parser:D},{code:39,name:"thickness",parser:v},{code:[...Wi(10,14)],name:"points",isMultiple:!0,parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class zu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Bu(this,"parser",xt(y0,_0))}}function Ru(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Bu(zu,"ForEntityName","SOLID");let v0=[{code:350,name:"historyObjectSoftId",parser:v},{code:100,name:"subclassMarker",parser:v},...ra("data"),{code:70,name:"version",parser:v},{code:100},...Gt];class Fu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ru(this,"parser",xt(v0))}}Ru(Fu,"ForEntityName","3DSOLID");(De={})[De.NONE=0]="NONE",De[De.CLOSED=1]="CLOSED",De[De.PERIODIC=2]="PERIODIC",De[De.RATIONAL=4]="RATIONAL",De[De.PLANAR=8]="PLANAR",De[De.LINEAR=16]="LINEAR";function Vu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let b0={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},x0=[{code:11,name:"fitPoints",isMultiple:!0,parser:D},{code:10,name:"controlPoints",isMultiple:!0,parser:D},{code:41,name:"weights",isMultiple:!0,parser:v},{code:40,name:"knots",isMultiple:!0,parser:v},{code:13,name:"endTangent",parser:D},{code:12,name:"startTangent",parser:D},{code:44,name:"fitTolerance",parser:v},{code:43,name:"controlTolerance",parser:v},{code:42,name:"knotTolerance",parser:v},{code:74,name:"numberOfFitPoints",parser:v},{code:73,name:"numberOfControlPoints",parser:v},{code:72,name:"numberOfKnots",parser:v},{code:71,name:"degree",parser:v},{code:70,name:"flag",parser:v},{code:210,name:"normal",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class Uu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Vu(this,"parser",xt(x0,b0))}}Vu(Uu,"ForEntityName","SPLINE");class _i{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=tn(Rt(t)),e=t.lastReadGroup;break;case 11:s.directionVector=tn(Rt(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(a,h){let u=!1,m=!1,b={};for(;!a.isEOF()&&h.code!==0&&!m;)switch(h.code){case 171:if(u){m=!0;continue}b.cellType=h.value,u=!0,h=a.next();break;case 172:b.flagValue=h.value,h=a.next();break;case 173:b.mergedValue=h.value,h=a.next();break;case 174:b.autoFit=h.value,h=a.next();break;case 175:b.borderWidth=h.value,h=a.next();break;case 176:b.borderHeight=h.value,h=a.next();break;case 91:b.overrideFlag=h.value,h=a.next();break;case 178:b.virtualEdgeFlag=h.value,h=a.next();break;case 145:b.rotation=h.value,h=a.next();break;case 345:b.fieldObjetId=h.value,h=a.next();break;case 340:b.blockTableRecordId=h.value,h=a.next();break;case 146:b.blockScale=h.value,h=a.next();break;case 177:b.blockAttrNum=h.value,h=a.next();break;case 7:b.textStyle=h.value,h=a.next();break;case 140:b.textHeight=h.value,h=a.next();break;case 170:b.attachmentPoint=h.value,h=a.next();break;case 92:b.extendedCellFlags=h.value,h=a.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=a.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=a.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=a.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=a.next();break;case 301:(function(f,w,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=w.next();break;case 1:f.text=x.value,x=w.next();break;case 300:f.attrText=x.value,x=w.next();break;case 302:f.text=x.value?x.value:f.text,x=w.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=w.next()}})(b,a,h),h=a.next();break;default:return b}return u=!1,m=!1,b}(t,e)),e=t.lastReadGroup;break;default:lo(s,e,t),e=t.next()}}return s}}function ju(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Sa="ACAD_TABLE",(wa="ForEntityName")in _i?Object.defineProperty(_i,wa,{value:Sa,enumerable:!0,configurable:!0,writable:!0}):_i[wa]=Sa;let w0=[{code:11,name:"xAxisDirection",parser:D},{code:210,name:"extrusionDirection",parser:D},{code:1,name:"text",parser:v},{code:10,name:"position",parser:D},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Gu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ju(this,"parser",xt(w0))}}ju(Gu,"ForEntityName","TOLERANCE");class yi{parseEntity(t,e){let s={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(a,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:a.layer=u.value;break;case 100:a.subclassMarker=u.value;break;case 10:a.viewportCenter=tn(Rt(h));break;case 40:a.width=u.value;break;case 41:a.height=u.value;break;case 68:a.status=u.value;break;case 69:a.viewportId=u.value;break;case 12:a.displayCenter=Rt(h);break;case 13:a.snapBase=Rt(h);break;case 14:a.snapSpacing=Rt(h);break;case 15:a.gridSpacing=Rt(h);break;case 16:a.viewDirection=tn(Rt(h));break;case 17:a.targetPoint=tn(Rt(h));break;case 42:a.perspectiveLensLength=u.value;break;case 43:a.frontClipZ=u.value;break;case 44:a.backClipZ=u.value;break;case 45:a.viewHeight=u.value;break;case 50:a.snapAngle=u.value;break;case 51:a.viewTwistAngle=u.value;break;case 72:a.circleZoomPercent=u.value;break;case 331:a.frozenLayerIds??(a.frozenLayerIds=[]),a.frozenLayerIds.push(u.value);break;case 90:a.statusBitFlags=u.value;break;case 340:a.clippingBoundaryId=u.value;break;case 1:a.sheetName=u.value;break;case 281:a.renderMode=u.value;break;case 71:a.ucsPerViewport=u.value;break;case 110:a.ucsOrigin=tn(Rt(h));break;case 111:a.ucsXAxis=tn(Rt(h));break;case 112:a.ucsYAxis=tn(Rt(h));break;case 345:a.ucsId=u.value;break;case 346:a.ucsBaseId=u.value;break;case 79:a.orthographicType=u.value;break;case 146:a.elevation=u.value;break;case 170:a.shadePlotMode=u.value;break;case 61:a.majorGridFrequency=u.value;break;case 332:a.backgroundId=u.value;break;case 333:a.shadePlotId=u.value;break;case 348:a.visualStyleId=u.value;break;case 292:a.isDefaultLighting=!!u.value;break;case 282:a.defaultLightingType=u.value;break;case 141:a.brightness=u.value;break;case 142:a.contrast=u.value;break;case 63:case 421:case 431:a.ambientLightColor=u.value;break;case 361:a.sunId=u.value;break;case 335:case 343:case 344:case 91:a.softPointer=u.value}return!0}(s,t,e)&&lo(s,e,t),e=t.next()}return s}}Ia="VIEWPORT",(Pa="ForEntityName")in yi?Object.defineProperty(yi,Pa,{value:Ia,enumerable:!0,configurable:!0,writable:!0}):yi[Pa]=Ia;(Cr={})[Cr.ShowImage=1]="ShowImage",Cr[Cr.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Cr[Cr.UseClippingBoundary=4]="UseClippingBoundary",Cr[Cr.Transparency=8]="Transparency";function Wu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let S0={brightness:50,constrast:50,fade:0},P0=[{code:14,name:"boundary",isMultiple:!0,parser:D},{code:91,name:"numberOfVertices",parser:v},{code:71,name:"boundaryType",parser:v},{code:360,name:"imageDefReactorHardId",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipping",parser:Ut},{code:70,name:"displayFlag",parser:v},{code:340,name:"imageDefHardId",parser:v},{code:13,name:"imageSize",parser:D},{code:12,name:"vDirection",parser:D},{code:11,name:"uDirection",parser:D},{code:10,name:"position",parser:D},{code:90,name:"classVersion",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Du{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Wu(this,"parser",xt(P0,S0))}}function Hu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Wu(Du,"ForEntityName","WIPEOUT");let I0=[{code:11,name:"direction",parser:D},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class qu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Hu(this,"parser",xt(I0))}}function Xu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Hu(qu,"ForEntityName","XLINE");let A0={},E0=[{code:170,name:"multileaderType",parser:v},{code:291,name:"doglegEnabled",parser:Ut},{code:40,name:"doglegLength",parser:v},{code:172,name:"contentType",parser:v},{code:3,name:"textContent",parser:v},{code:12,name:"textAnchor",parser:D},{code:344,name:"blockHandle",parser:v},{code:15,name:"blockPosition",parser:D},{code:302,name:"leaderSections",parser:function(n,t,e){let s,a={leaderLines:[]};for(;t.hasNext()&&(s=t.next()).code!==303;)switch(s.code){case 10:a.landingPoint=(s.value,Rt(t));break;case 11:a.doglegVector=(s.value,Rt(t));break;case 40:a.doglegLength=s.value;break;case 304:a.leaderLines.push(function(h,u,m){let b,f={vertices:[]};for(;u.hasNext()&&(b=u.next()).code!==305;)b.code===10&&f.vertices.push((b.value,Rt(u)));return f}(0,t))}return a},isMultiple:!0},...Gt];class Yu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xu(this,"parser",xt(E0,A0))}}Xu(Yu,"ForEntityName","MULTILEADER");let M0=Object.fromEntries([qh,Qh,ru,su,au,gi,lu,uu,gu,_u,vu,xu,fi,Su,tu,Yu,Iu,Mu,ku,Lu,Ou,zu,Fu,Uu,_i,$h,Gu,pu,ho,yi,Du,qu].map(n=>[n.ForEntityName,new n]));function Ku(n,t){let e=[];for(;!It(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){t.rewind();break}let s=M0[n.value];if(s){let a=n.value;n=t.next();let h=s.parseEntity(t,n);h.type=a,Wh(h),e.push(h)}else t.debug&&console.warn(`Unsupported ENTITY type: ${n.value}`)}n=t.next()}return e}function T0(n,t){let e={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");){if(It(n,0,"BLOCK")){let s=k0(n=t.next(),t);Wh(s),s.name&&(e[s.name]=s)}n=t.next()}return e}function k0(n,t){let e={};for(;!It(n,0,"EOF");){if(It(n,0,"ENDBLK")){for(n=t.next();!It(n,0,"EOF");){if(It(n,100,"AcDbBlockEnd"))return e;n=t.next()}break}switch(n.code){case 1:e.xrefPath=n.value;break;case 2:e.name=n.value;break;case 3:e.name2=n.value;break;case 5:e.handle=n.value;break;case 8:e.layer=n.value;break;case 10:e.position=Rt(t);break;case 67:e.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(e.type=n.value);break;case 100:break;case 330:e.ownerHandle=n.value;break;case 0:e.entities=Ku(n,t)}n=t.next()}return e}function N0(n,t){let e=null,s={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");)n.code===9?e=n.value:n.code===10?s[e]=Rt(t):s[e]=n.value,n=t.next();return s}(He={})[He.NOT_APPLICABLE=0]="NOT_APPLICABLE",He[He.KEEP_EXISTING=1]="KEEP_EXISTING",He[He.USE_CLONE=2]="USE_CLONE",He[He.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",He[He.VALUE_NAME=4]="VALUE_NAME",He[He.UNMANGLE_NAME=5]="UNMANGLE_NAME";let uo=[{code:330,name:"ownerObjectId",parser:v},{code:102,parser:Pn},{code:102,parser:Pn},{code:102,parser:Pn},{code:5,name:"handle",parser:v}],L0=[{code:3,name:"entries",parser:(n,t)=>{let e={name:n.value};return(n=t.next()).code===350?e.objectSoftId=n.value:n.code===360?e.objectHardId=n.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:v},{code:280,name:"isHardOwned",parser:Ut},{code:100,name:"subclassMarker",parser:v},...uo],C0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:v},{code:90,name:"version",parser:v},{code:1,name:"fileName",parser:v},{code:10,name:"size",parser:D},{code:11,name:"sizeOfOnePixel",parser:D},{code:280,name:"isLoaded",parser:v},{code:281,name:"resolutionUnits",parser:v},{code:100,name:"subclassMarker",parser:v}];(vn={})[vn.NOUNIT=0]="NOUNIT",vn[vn.CENTIMETERS=2]="CENTIMETERS",vn[vn.INCH=5]="INCH";(zs={})[zs.PSLTSCALE=1]="PSLTSCALE",zs[zs.LIMCHECK=2]="LIMCHECK";(bn={})[bn.INCHES=0]="INCHES",bn[bn.MILLIMETERS=1]="MILLIMETERS",bn[bn.PIXELS=2]="PIXELS";(qe={})[qe.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",qe[qe.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",qe[qe.DRAWING_LIMITS=2]="DRAWING_LIMITS",qe[qe.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",qe[qe.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",qe[qe.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Or={})[Or.AS_DISPLAYED=0]="AS_DISPLAYED",Or[Or.WIREFRAME=1]="WIREFRAME",Or[Or.HIDDEN=2]="HIDDEN",Or[Or.RENDERED=3]="RENDERED";(Xe={})[Xe.DRAFT=0]="DRAFT",Xe[Xe.PREVIEW=1]="PREVIEW",Xe[Xe.NORMAL=2]="NORMAL",Xe[Xe.PRESENTATION=3]="PRESENTATION",Xe[Xe.MAXIMUM=4]="MAXIMUM",Xe[Xe.CUSTOM=5]="CUSTOM";let $u=[{code:333,name:"shadePlotId",parser:v},{code:149,name:"imageOriginY",parser:v},{code:148,name:"imageOriginX",parser:v},{code:147,name:"scaleFactor",parser:v},{code:78,name:"shadePlotCustomDPI",parser:v},{code:77,name:"shadePlotResolution",parser:v},{code:76,name:"shadePlotMode",parser:v},{code:75,name:"standardScaleType",parser:v},{code:7,name:"currentStyleSheet",parser:v},{code:74,name:"plotType",parser:v},{code:73,name:"plotRotation",parser:v},{code:72,name:"plotPaperUnit",parser:v},{code:70,name:"layoutFlag",parser:v},{code:143,name:"printScaleDenominator",parser:v},{code:142,name:"printScaleNumerator",parser:v},{code:141,name:"windowAreaYMax",parser:v},{code:140,name:"windowAreaXMax",parser:v},{code:49,name:"windowAreaYMin",parser:v},{code:48,name:"windowAreaXMin",parser:v},{code:47,name:"plotOriginY",parser:v},{code:46,name:"plotOriginX",parser:v},{code:45,name:"paperHeight",parser:v},{code:44,name:"paperWidth",parser:v},{code:43,name:"marginTop",parser:v},{code:42,name:"marginRight",parser:v},{code:41,name:"marginBottom",parser:v},{code:40,name:"marginLeft",parser:v},{code:6,name:"plotViewName",parser:v},{code:4,name:"paperSize",parser:v},{code:2,name:"configName",parser:v},{code:1,name:"pageSetupName",parser:v},{code:100,name:"subclassMarker",parser:v},...uo],O0=[{code:346,name:"orthographicUcsId",parser:v},{code:345,name:"namedUcsId",parser:v},{code:331,name:"viewportId",parser:v},{code:330,name:"paperSpaceTableId",parser:v},{code:76,name:"orthographicType",parser:v},{code:17,name:"ucsYAxis",parser:D},{code:16,name:"ucsXAxis",parser:D},{code:13,name:"ucsOrigin",parser:D},{code:146,name:"elevation",parser:v},{code:15,name:"maxExtent",parser:D},{code:14,name:"minExtent",parser:D},{code:12,name:"insertionPoint",parser:D},{code:11,name:"maxLimit",parser:D},{code:10,name:"minLimit",parser:D},{code:71,name:"tabOrder",parser:v},{code:70,name:"controlFlag",parser:v},{code:1,name:"layoutName",parser:v},{code:100,name:"subclassMarker",parser:v},...$u],B0=[{code:40,name:"wcsToOCSTransform",parser:Al},{code:40,name:"ocsToWCSTransform",parser:Al},{code:41,name:"backClippingDistance",parser:v},{code:73,name:"isBackClipping",parser:Ut,pushContext:!0},{code:40,name:"frontClippingDistance",parser:v},{code:72,name:"isFrontClipping",parser:Ut,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Ut},{code:11,name:"position",parser:D},{code:210,name:"normal",parser:D},{code:10,name:"boundaryVertices",parser:D,isMultiple:!0},{code:70,name:"boundaryCount",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...uo];function Al(n,t){let e=[];for(let s=0;s<3&&It(n,40);++s){let a=[];for(let h=0;h<4&&It(n,40);++h)a.push(n.value),n=t.next();e.push(a)}return t.rewind(),e}let z0={LAYOUT:O0,PLOTSETTINGS:$u,DICTIONARY:L0,SPATIAL_FILTER:B0,IMAGEDEF:C0};function R0(n,t){let e=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let s=n.value,a=z0[s];if(n.code===0&&(a!=null&&a.length)){let h=xt(a),u={name:s};h(n=t.next(),t,u)?(e.push(u),n=t.peek()):n=t.next()}else n=t.next()}return{byName:Ed(e,({name:s})=>s)}}let ts=[{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102,parser(n,t){for(;!It(n,0,"EOF")&&!It(n,102,"}");)n=t.next()}},{code:5,name:"handle",parser:v}],F0=xt([{code:310,name:"bmpPreview",parser:v},{code:281,name:"scalability",parser:v},{code:280,name:"explodability",parser:v},{code:70,name:"insertionUnits",parser:v},{code:340,name:"layoutObjects",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),V0=[{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:Pl.Above,defaultValueImperial:Pl.Center},{name:"DIMZIN",code:78,defaultValue:Gn.Trailing,defaultValueImperial:Gn.Feet},{name:"DIMAZIN",code:79,defaultValue:dd.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:pd.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:md.Center},{name:"DIMTZIN",code:284,defaultValue:Gn.Trailing,defaultValueImperial:Gn.Feet},{name:"DIMALTZ",code:285,defaultValue:Gn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Gn.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}],U0=xt([...V0.map(n=>({...n,parser:v})),{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},{code:105,name:"handle",parser:v},...ts.filter(n=>n.code!==5)]),j0=xt([{code:347,name:"materialObjectId",parser:v},{code:390,name:"plotStyleNameObjectId",parser:v},{code:370,name:"lineweight",parser:v},{code:290,name:"isPlotting",parser:Ut},{code:6,name:"lineType",parser:v},{code:62,name:"colorIndex",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]);(Br={})[Br.NONE=0]="NONE",Br[Br.AbsoluteRotation=1]="AbsoluteRotation",Br[Br.TextEmbedded=2]="TextEmbedded",Br[Br.ShapeEmbedded=4]="ShapeEmbedded";let G0=xt([{code:9,name:"text",parser:v},{code:45,name:"offsetY",parser:v},{code:44,name:"offsetX",parser:v},{code:50,name:"rotation",parser:v},{code:46,name:"scale",parser:v},{code:340,name:"styleObjectId",parser:v},{code:75,name:"shapeNumber",parser:v},{code:74,name:"elementTypeFlag",parser:v},{code:49,name:"elementLength",parser:v}],{elementTypeFlag:0,elementLength:0}),W0=xt([{code:49,name:"pattern",parser(n,t){let e={};return G0(n,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:v},{code:73,name:"numberOfLineTypes",parser:v},{code:72,parser:v},{code:3,name:"description",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),D0=xt([{code:1e3,name:"extendedFont",parser:v},{code:1001},{code:4,name:"bigFont",parser:v},{code:3,name:"font",parser:v},{code:42,name:"lastHeight",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:50,name:"obliqueAngle",parser:v},{code:41,name:"widthFactor",parser:v},{code:40,name:"fixedTextHeight",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),H0=xt([{code:[63,421,431],name:"ambientColor",parser:v},{code:142,name:"contrast",parser:v},{code:141,name:"brightness",parser:v},{code:282,name:"defaultLightingType",parser:v},{code:292,name:"isDefaultLightingOn",parser:Ut},{code:348,name:"visualStyleObjectId",parser:v},{code:333,name:"shadePlotObjectId",parser:v},{code:332,name:"backgroundObjectId",parser:v},{code:61,name:"majorGridLines",parser:v},{code:170,name:"shadePlotSetting",parser:v},{code:146,name:"elevation",parser:v},{code:79,name:"orthographicType",parser:v},{code:112,name:"ucsYAxis",parser:D},{code:111,name:"ucsXAxis",parser:D},{code:110,name:"ucsOrigin",parser:D},{code:74,name:"ucsIconSetting",parser:v},{code:71,name:"viewMode",parser:v},{code:281,name:"renderMode",parser:v},{code:1,name:"styleSheet",parser:v},{code:[331,441],name:"frozenLayers",parser:v,isMultiple:!0},{code:72,name:"circleSides",parser:v},{code:51,name:"viewTwistAngle",parser:v},{code:50,name:"snapRotationAngle",parser:v},{code:45,name:"viewHeight",parser:v},{code:44,name:"backClippingPlane",parser:v},{code:43,name:"frontClippingPlane",parser:v},{code:42,name:"lensLength",parser:v},{code:17,name:"viewTarget",parser:D},{code:16,name:"viewDirectionFromTarget",parser:D},{code:15,name:"gridSpacing",parser:D},{code:14,name:"snapSpacing",parser:D},{code:13,name:"snapBasePoint",parser:D},{code:12,name:"center",parser:D},{code:11,name:"upperRightCorner",parser:D},{code:10,name:"lowerLeftCorner",parser:D},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),q0={BLOCK_RECORD:F0,DIMSTYLE:U0,LAYER:j0,LTYPE:W0,STYLE:D0,VPORT:H0},X0=xt([{code:70,name:"maxNumberOfEntries",parser:v},{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:v},{code:2,name:"name",parser:v}]);function Y0(n,t){var s;let e={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");){if(It(n,0,"TABLE")){n=t.next();let a={entries:[]};X0(n,t,a),e[a.name]=a}if(It(n,0)&&!It(n,0,"ENDTAB")){let a=n.value;n=t.next();let h=q0[a];if(!h){t.debug&&console.warn(`parseTable: Invalid table name '${a}'`),n=t.next();continue}let u={};h(n,t,u),(s=e[a])==null||s.entries.push(u)}n=t.next()}return e}function Rs(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class El{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 t=parseInt(this._data[this._pointer++],10),e=Ml(t,this._data[this._pointer++],this.debug),s={code:t,value:e};return It(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 t={code:parseInt(this._data[this._pointer]),value:0};return t.value=Ml(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){Rs(this,"_data",void 0),Rs(this,"debug",void 0),Rs(this,"_pointer",void 0),Rs(this,"_eof",void 0),Rs(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Ml(n,t,e=!1){return n<=9?t:n>=10&&n<=59?parseFloat(t.trim()):n>=60&&n<=99?parseInt(t.trim()):n>=100&&n<=109?t:n>=110&&n<=149?parseFloat(t.trim()):n>=160&&n<=179?parseInt(t.trim()):n>=210&&n<=239?parseFloat(t.trim()):n>=270&&n<=289?parseInt(t.trim()):n>=290&&n<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(t.trim()):n>=300&&n<=369?t:n>=370&&n<=389?parseInt(t.trim()):n>=390&&n<=399?t:n>=400&&n<=409?parseInt(t.trim()):n>=410&&n<=419?t:n>=420&&n<=429?parseInt(t.trim()):n>=430&&n<=439?t:n>=440&&n<=459?parseInt(t.trim()):n>=460&&n<=469?parseFloat(t.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?t:n>=1010&&n<=1059?parseFloat(t.trim()):n>=1060&&n<=1071?parseInt(t.trim()):(e&&console.warn("WARNING: Group code does not have a defined type: %j",{code:n,value:t}),t)}function Ba(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class K0{constructor(){Ba(this,"encoding","utf-8"),Ba(this,"encodingFailureFatal",!1)}}class $0 extends EventTarget{parseSync(t,e=!1){let s=new El(t.split(/\r\n|\r|\n/g),e);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(t){let e="",s=this;return new Promise((a,h)=>{t.on("data",u=>{e+=u}),t.on("end",()=>{try{let u=e.split(/\r\n|\r|\n/g),m=new El(u);if(!m.hasNext())throw Error("Empty file");a(s.parseAll(m))}catch(u){h(u)}}),t.on("error",u=>{h(u)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let a=s.body.getReader(),h="";for(;;){let{done:u,value:m}=await a.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(m,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!It(s,0,"EOF");)It(s,0,"SECTION")&&(It(s=t.next(),2,"HEADER")?(s=t.next(),e.header=N0(s,t)):It(s,2,"BLOCKS")?(s=t.next(),e.blocks=T0(s,t)):It(s,2,"ENTITIES")?(s=t.next(),e.entities=Ku(s,t)):It(s,2,"TABLES")?(s=t.next(),e.tables=Y0(s,t)):It(s,2,"OBJECTS")&&(s=t.next(),e.objects=R0(s,t))),s=t.next();return e}constructor(t=new K0){super(),Ba(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}const Tl=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class Dn{constructor(t){if(typeof t=="string"){const e=Tl.find(s=>s.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=Tl.find(s=>s.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Z0{parse(t){const e=new $0,s=this.getDxfInfoFromBuffer(t);let a="";return s.version&&s.version.value<=23&&s.encoding?a=new TextDecoder(s.encoding).decode(t):a=new TextDecoder().decode(t),e.parseSync(a)}getDxfInfoFromBuffer(t){var f,w,x;const s=new TextDecoder("utf-8");let a=0,h="",u=null,m=null,b=!1;for(;a<t.byteLength;){const A=Math.min(a+65536,t.byteLength),M=t.slice(a,A);a=A;const O=(h+s.decode(M,{stream:!0})).split(/\r?\n/);h=O.pop()??"";for(let V=0;V<O.length;V++){const F=O[V].trim();if(F==="SECTION"&&((f=O[V+2])==null?void 0:f.trim())==="HEADER")b=!0;else if(F==="ENDSEC"&&b)return{version:u,encoding:m};if(b&&F==="$ACADVER"){const at=(w=O[V+2])==null?void 0:w.trim();at&&(u=new Dn(at))}else if(b&&F==="$DWGCODEPAGE"){const at=(x=O[V+2])==null?void 0:x.trim();if(at){const ft=ja[at];m=jl(ft)}}if(u&&m)return{version:u,encoding:m}}}return{version:u,encoding:m}}}class kl{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new Mi;return t.vertices.forEach((s,a)=>e.setVertexAt(a,s)),e}convertArc(t){return new Si(t.center,t.radius,Pt.degToRad(t.startAngle),Pt.degToRad(t.endAngle),t.extrusionDirection??Y.Z_AXIS)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&le.Invisible)!==0,e.isConst=(t.attributeFlag&le.Const)!==0,e.isVerifiable=(t.attributeFlag&le.Verifiable)!==0,e.isPreset=(t.attributeFlag&le.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&_r.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&_r.ConstMultiLine)!==0}convertAttribute(t){const e=new Ii;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new Pi;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){return new Ai(t.center,t.radius,t.extrusionDirection??Y.Z_AXIS)}convertEllipse(t){const e=new Y(t.majorAxisEndPoint),s=e.length();return new Ei(t.center,t.extrusionDirection??Y.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new $s(new W(e.x,e.y,e.z||0),new W(s.x,s.y,s.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new Qs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new Qs(e,"Uniform",t.degree,!!(t.flag&1))}}catch(e){console.log(`Failed to convert spline with error: ${e}`)}return null}convertPoint(t){const e=new Ci;return e.position=t.position,e}convertSolid(t){const e=new Ni;return t.points.forEach((s,a)=>e.setPointAt(a,s)),e.thickness=t.thickness,e}convertPolyline(t){const e=!!(t.flag&1),s=!!(t.flag&8),a=[],h=[];if(t.vertices.map(u=>{u.flag&l0.SPLINE_CONTROL_POINT||(a.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0))}),s){let u=Ds.SimplePoly;return t.flag&4&&(t.smoothType==ci.CUBIC?u=Ds.CubicSplinePoly:t.smoothType==ci.QUADRATIC&&(u=Ds.QuadSplinePoly)),new wi(u,a,e)}else{let u=Wn.SimplePoly;return t.flag&2?u=Wn.FitCurvePoly:t.flag&4&&(t.smoothType==ci.CUBIC?u=Wn.CubicSplinePoly:t.smoothType==ci.QUADRATIC&&(u=Wn.QuadSplinePoly)),new xi(u,a,0,e,t.startWidth,t.endWidth,h)}}convertLWPolyline(t){const e=new Li;return e.closed=!!(t.flag&1),t.vertices.forEach((s,a)=>{e.addVertexAt(a,new kt(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),e}convertHatch(t){var a;const e=new Ks;return(a=t.definitionLines)==null||a.forEach(h=>{e.definitionLines.push({angle:h.angle,base:h.base,offset:h.offset,dashLengths:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.isSolidFill=t.solidFill==gd.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const m=h,b=new An;b.closed=m.isClosed,m.vertices.forEach((f,w)=>{b.addVertexAt(w,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(b)}else{const m=h,b=new Ja;m.edges.forEach(f=>{if(f.type==1){const w=f;b.add(new Ws(w.start,w.end))}else if(f.type==2){const w=f;b.add(new qn(w.center,w.radius,Pt.degToRad(w.startAngle||0),Pt.degToRad(w.endAngle||0),!w.isCCW))}else if(f.type==3){const w=f;new Jt().subVectors(w.end,w.center);const A=Math.sqrt(Math.pow(w.end.x,2)+Math.pow(w.end.y,2)),M=A*w.lengthOfMinorAxis;let L=Pt.degToRad(w.startAngle||0),O=Pt.degToRad(w.endAngle||0);const V=Math.atan2(w.end.y,w.end.x);w.isCCW||(L=Math.PI*2-L,O=Math.PI*2-O),b.add(new Ji({...w.center,z:0},A,M,L,O,!w.isCCW,V))}else if(f.type==4){const w=f;if(w.numberOfControlPoints>0&&w.numberOfKnots>0){const x=w.controlPoints.map(L=>({x:L.x,y:L.y,z:0}));let A=!0;const M=w.controlPoints.map(L=>(L.weight==null&&(A=!1),L.weight||1));b.add(new rn(x,w.knots,A?M:void 0))}else if(w.numberOfFitData>0){const x=w.fitDatum.map(A=>({x:A.x,y:A.y,z:0}));b.add(new rn(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new ki(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((s,a)=>e.setColumnWidth(a,s)),t.rowHeightArr.forEach((s,a)=>e.setRowHeight(a,s)),t.cells.forEach((s,a)=>{e.setCell(a,s)}),e}convertText(t){const e=new Yn;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=Pt.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Zs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=Pt.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new Y(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new Ti;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new Vi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=Pt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new Fi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new ji(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new Gi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new Ui(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new kt(s))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new Js;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(s=>{e.clipBoundary.push(new kt(s))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new zi;return this.processWipeout(t,e),e}convertViewport(t){const e=new Bi;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Oi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new Ri;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Kn(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?Pt.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=$i.deserialize(t.transparency))}numberArrayToPointArray(t,e){const s=t.length;let a=0;if(s/2==e?a=2:s/3==e&&(a=3),a==0)return;const h=[];for(let u=0,m=s/a;u<m;++u)h.push({x:t[u*a],y:t[u*a+1],z:a==3?t[u*a+2]:0});return h}}class sn extends jr{constructor(t,e){t=t||{},Zn(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const en=class en extends sn{static isModelSapceName(t){return t.toLowerCase()==en.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(en.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new W,this._layoutId="",this._entities=new Map}get isModelSapce(){return en.isModelSapceName(this.name)}get isPaperSapce(){return en.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}appendEntity(t){if(Array.isArray(t))for(let e=0;e<t.length;++e){const s=t[e];s.database=this.database,s.ownerId=this.objectId,s.resolveEffectiveProperties(),this._entities.set(s.objectId,s)}else t.database=this.database,t.ownerId=this.objectId,t.resolveEffectiveProperties(),this._entities.set(t.objectId,t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],s=[];return e.forEach(a=>{const h=this._entities.get(a);h&&s.push(h),this._entities.delete(a)}),s.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:s}),s.length>0}newIterator(){return new ri(this._entities)}getIdAt(t){return this._entities.get(t)}};en.MODEL_SPACE_NAME="*MODEL_SPACE",en.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let he=en;class Q0{convertLayout(t,e){var a,h;const s=new ea;if(s.layoutName=t.layoutName,s.tabOrder=t.tabOrder,t.layoutName==="Model"){const u=he.MODEL_SPACE_NAME;(a=e.tables.BLOCK_RECORD)==null||a.entries.some(m=>m.name.toUpperCase()===u?(s.blockTableRecordId=m.handle,!0):!1)}else(h=e.tables.BLOCK_RECORD)==null||h.entries.some(u=>u.layoutObjects===t.handle?(s.blockTableRecordId=u.handle,!0):!1),s.blockTableRecordId||(s.blockTableRecordId=t.paperSpaceTableId);return s.limits.min.copy(t.minLimit),s.limits.max.copy(t.maxLimit),s.extents.min.copy(t.minExtent),s.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,s),s}convertImageDef(t){const e=new Rh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Zu{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const s=Date.now(),a=this.generateTaskId();try{return await this.executeInWorker(a,t,e||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(t,e,s){const a=Date.now();return new Promise((h,u)=>{const m=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(m),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:x=>{clearTimeout(b),this.releaseWorker(m),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(m),u(x)},timeout:b});const f=x=>{const{id:A,success:M,data:L,error:O}=x.data;if(A!==t)return;this.cleanupTask(t);const V=Date.now()-a;h(M?{success:!0,data:L,duration:V}:{success:!1,error:O,duration:V})},w=x=>{this.cleanupTask(t),u(new Error(`Worker error: ${x.message}`))};m.addEventListener("message",f),m.addEventListener("error",w),m.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[s,a]of this.workers)if(!a.isBusy)return a.isBusy=!0,a.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),a=this.generateWorkerId(),h={worker:s,isBusy:!0,id:a,createdAt:new Date};return this.workers.set(a,h),s}const e=Array.from(this.workers.values()).sort((s,a)=>s.createdAt.getTime()-a.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){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(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Qu{constructor(t){this.framework=new Zu(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Ju(n){return new Qu(n)}class J0{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const a=await this.executeTask(s);this.sendResponse(e,!0,a)}catch(a){this.sendResponse(e,!1,void 0,a instanceof Error?a.message:String(a))}}}sendResponse(t,e,s,a){const h={id:t,success:e,data:s,error:a};self.postMessage(h)}}class tc extends ao{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t){if(this.config.useWorker&&this.config.parserWorkerUrl){const e=Ju({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),s=await e.execute(t);if(e.destroy(),s.success)return{model:s.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${s.error}'`)}else return{model:new Z0().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var h;const e=new Map,s=u=>{if(u){const m=u.lastIndexOf(".");return m>=0?u.substring(0,m).toLowerCase():u.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(u=>{const m=[];if(u.font){const b=s(u.font);b&&m.push(b)}if(u.bigFont){const b=s(u.bigFont);b&&m.push(b)}if(u.extendedFont){const b=s(u.extendedFont);b&&m.push(b)}e.set(u.name,m)});const a=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,a),Array.from(a)}getFontsInBlock(t,e,s,a){const h=/\\f(.*?)\|/g;t.forEach(u=>{if(u.type=="MTEXT"){const m=u;[...m.text.matchAll(h)].forEach(w=>{a.add(w[1].toLowerCase())});const f=s.get(m.styleName);f==null||f.forEach(w=>a.add(w))}else if(u.type=="TEXT"){const m=u,b=s.get(m.styleName);b==null||b.forEach(f=>a.add(f))}else if(u.type=="INSERT"){const b=e[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,s,a)}})}async processEntities(t,e,s,a,h){const u=new kl;let m=t.entities;const b=m.length,f=new Va(b,100-a.value,s);this.config.convertByEntityType&&(m=this.groupAndFlattenByType(m));const w=new Map;for(let A=0;A<b;A++){const M=m[A];if(M.type==="ATTRIB"){const L=u.convert(M);if(L&&L.ownerId&&L.ownerId!=="0"){let O=w.get(L==null?void 0:L.ownerId);O==null&&(O=[],w.set(L.ownerId,O)),O.push(L)}}}const x=e.tables.blockTable.modelSpace;await f.processChunk(async(A,M)=>{let L=[],O=A<M?m[A].type:"";for(let F=A;F<M;F++){const at=m[F];if(at.type!=="ATTRIB"){const ft=u.convert(at);if(ft){if(this.config.convertByEntityType&&at.type!==O&&(x.appendEntity(L),L=[],O=at.type),at.type==="INSERT"){const st=w.get(ft.objectId);st&&st.length>0&&st.forEach(H=>{ft.appendAttributes(H)})}L.push(ft)}}}x.appendEntity(L);let V=a.value+M/b*(100-a.value);V>100&&(V=100),h&&await h(V,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,s=!1){const a=new kl,h=t.length,u=[],m=e.objectId,b=[];for(let f=0;f<h;f++){const w=t[f],x=a.convert(w);x&&(w.type==="ATTRIB"?b.push(x):(!s||w.ownerBlockRecordSoftId===m)&&u.push(x))}b.forEach(f=>{const w=e.getIdAt(f.ownerId);w&&w.appendAttributes(f)}),e.appendEntity(u)}processBlocks(t,e){const s=t.blocks;for(const[a,h]of Object.entries(s)){let u=e.tables.blockTable.getAt(h.name);u||(u=new he,u.objectId=h.handle,u.name=a,u.origin.copy(h.position),e.tables.blockTable.add(u)),h.entities?this.processEntitiesInBlock(h.entities,u):u.isPaperSapce&&this.processEntitiesInBlock(t.entities,u,!0)}}processHeader(t,e){const s=t.header;s.$ACADVER&&(e.version=s.$ACADVER),e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,s.$AUNITS!=null&&(e.aunits=s.$AUNITS),e.celtscale=s.$CELTSCALE||1,e.ltscale=s.$LTSCALE||1,s.$EXTMAX&&(e.extmax=s.$EXTMAX),s.$EXTMIN&&(e.extmin=s.$EXTMIN),s.$INSUNITS!=null&&(e.insunits=s.$INSUNITS),e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0}processBlockTables(t,e){var a;const s=(a=t.tables.BLOCK_RECORD)==null?void 0:a.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(h=>{const u=new he;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,e.tables.blockTable.add(u)}))}processObjects(t,e){const s=t.objects.byName,a=new Q0;if("LAYOUT"in s){const h=e.objects.layout;s.LAYOUT.forEach(u=>{const m=a.convertLayout(u,t);h.setAt(m.layoutName,m)})}if("IMAGEDEF"in s){const h=e.objects.imageDefinition;s.IMAGEDEF.forEach(u=>{const m=a.convertImageDef(u);h.setAt(m.objectId,m)})}}processViewports(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new gc;this.processCommonTableEntryAttrs(u,m),u.circleSides&&(m.circleSides=u.circleSides),m.standardFlag=u.standardFlag,m.center.copy(u.center),m.lowerLeftCorner.copy(u.lowerLeftCorner),m.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&m.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(m.snapAngle=u.snapRotationAngle),u.snapSpacing&&m.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(m.gridMajor=u.majorGridLines),u.gridSpacing&&m.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(m.backgroundObjectId=u.backgroundObjectId),m.gsView.center.copy(u.center),m.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),m.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(m.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(m.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(m.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(m.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(m.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(m.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(m.gsView.styleSheet=u.styleSheet),u.renderMode&&(m.gsView.renderMode=u.renderMode),u.viewMode&&(m.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(m.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&m.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&m.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&m.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(m.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(m.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(m.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(m.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(m.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(m.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(m.gsView.brightness=u.brightness),u.contrast&&(m.gsView.contrast=u.contrast),u.ambientColor&&(m.gsView.ambientColor=u.ambientColor),e.tables.viewportTable.add(m)})}processLayers(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new fe;m.colorIndex=u.colorIndex;const b=new na({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:m,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new Ys(u);this.processCommonTableEntryAttrs(u,m),m.name=u.name,e.tables.linetypeTable.add(m)})}processTextStyles(t,e){var a;const s=(a=t.tables.STYLE)==null?void 0:a.entries;s&&s.length>0&&s.forEach(h=>{const u=new co(h);this.processCommonTableEntryAttrs(h,u),e.tables.textStyleTable.add(u)})}processDimStyles(t,e){var a;const s=(a=t.tables.DIMSTYLE)==null?void 0:a.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},m=new $n(u);this.processCommonTableEntryAttrs(h,m),e.tables.dimStyleTable.add(m)})}processCommonTableEntryAttrs(t,e){e.name=t.name,e.objectId=t.handle,e.ownerId=t.ownerObjectId}groupAndFlattenByType(t){const e={},s=[];for(const a of t)e[a.type]||(e[a.type]=[],s.push(a.type)),e[a.type].push(a);return s.flatMap(a=>e[a])}}class ec extends ao{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,s,a,h){let u=t.tables.blockTable.modelSpace.newIterator().toArray();const m=u.length,b=new Va(m,100-a.value,s);this.config.convertByEntityType&&(u=this.groupAndFlattenByType(u));const f=e.tables.blockTable.modelSpace;await b.processChunk(async(w,x)=>{let A=[],M=w<x?u[w].type:"";for(let L=w;L<x;L++){const O=u[L];this.config.convertByEntityType&&O.type!==M&&(this.triggerEvents(f,A),A=[],M=O.type),A.push(O)}if(this.triggerEvents(f,A),h){let L=a.value+x/m*(100-a.value);L>100&&(L=100),await h(L,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const s=e.newIterator().toArray();this.triggerEvents(e,s)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},s=[];for(const a of t)e[a.type]||(e[a.type]=[],s.push(a.type)),e[a.type].push(a);return s.flatMap(a=>e[a])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}var Xs=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Xs||{});class fr{constructor(){this.events={registered:new oe,unregistered:new oe},this._converters=new Map,this.register("dxf",new tc)}static createInstance(){return fr._instance==null&&(fr._instance=new fr),this._instance}static get instance(){return fr._instance||(fr._instance=new fr),fr._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}class an extends jr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database;const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new ri(this._recordsByName)}normalizeName(t){return t}}class rc extends an{constructor(t){super(t)}get modelSpace(){let t=this.getAt(he.MODEL_SPACE_NAME);return t||(t=new he,t.name=he.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const s=e.getIdAt(t);if(s)return s}}removeEntity(t){let e=!1;for(const s of this.database.tables.blockTable.newIterator())if(s.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(he.isModelSapceName(t))e=he.MODEL_SPACE_NAME;else if(he.isPaperSapceName(t)){const s=he.PAPER_SPACE_NAME_PREFIX,a=t.substring(s.length);e=s+a}return e}}class nc extends an{constructor(t){super(t)}}class na extends sn{constructor(t,e){t=t||{},Zn(t,{color:new fe,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new $i,linetype:"",lineWeight:1,materialId:-1}),super(t,e),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(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}}class sc extends an{constructor(t){super(t);const e=new fe,s=new na({name:"0",standardFlags:0,linetype:vi,lineWeight:nn.ByLineWeightDefault,isOff:!1,color:e,isPlottable:!0});this.add(s)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class ic extends an{constructor(t){super(t)}}class ac extends an{constructor(t){super(t)}get fonts(){const t=new Set,e=a=>{if(a){const h=a.lastIndexOf(".");if(h>=0){const u=a.substring(0,h).toLowerCase();t.add(u)}else t.add(a.toLowerCase())}},s=this.newIterator();for(const a of s)e(a.fileName),e(a.bigFontFileName);return Array.from(t)}}class oc extends an{constructor(t){super(t)}}class lc extends an{constructor(t){super(t)}}class hc extends sn{constructor(t){super(),this.name=t}}const qi=class qi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new oe},this.registerVar({name:"CECOLOR",type:"color",isDbVar:!0,defaultValue:new fe(ct.ByLayer)}),this.registerVar({name:"CELTSCALE",type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:"CELWEIGHT",type:"number",isDbVar:!0,defaultValue:nn.ByLayer}),this.registerVar({name:"CLAYER",type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:"LWDISPLAY",type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:"PICKBOX",type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:"WHITEBKCOLOR",type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new qi),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const s=this.getDescriptor(t);if(s){if(s.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}}setVar(t,e,s){t=this.normalizeName(t);const a=this.getDescriptor(t);if(a){const h=this.getVar(t,s);if(a.type!=="string"&&(typeof e=="string"||e instanceof String)){if(a.type==="number"){const u=Number(e);if(Number.isNaN(u))throw new Error("Invalid number input!");e=u}else if(a.type==="boolean")e=this.parseBoolean(e);else if(a.type==="color"){const u=fe.fromString(e);if(u==null)throw new Error("Invalid color value!");e=u}}a.isDbVar?s[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(h,e)&&this.events.sysVarChanged.dispatch({database:s,name:t,newVal:e,oldVal:h}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),s=new Set(["true","t","1","yes","y"]),a=new Set(["false","f","0","no","n"]);return s.has(e)?!0:(a.has(e),!1)}hasValueChanged(t,e){return t instanceof fe&&e instanceof fe?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};qi._instance=null;let Di=qi;const Xi=class Xi extends jr{constructor(){super(),this.events={dictObjetSet:new oe,dictObjectErased:new oe,entityAppended:new oe,entityModified:new oe,entityErased:new oe,layerAppended:new oe,layerModified:new oe,layerErased:new oe,openProgress:new oe},this._version=new Dn("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Ua.DecimalDegrees,this._celtscale=1,this._cecolor=new fe,this._celweight=nn.ByLayer,this._clayer="0",this._extents=new Nt,this._insunits=io.Millimeters,this._ltscale=1,this._lwdisplay=!0,this._pdmode=0,this._pdsize=0,this._tables={appIdTable:new lc(this),blockTable:new rc(this),dimStyleTable:new nc(this),linetypeTable:new ic(this),textStyleTable:new ac(this),layerTable:new sc(this),viewportTable:new oc(this)},this._objects={dictionary:new qs(this),imageDefinition:new qs(this),layout:new zh(this),xrecord:new qs(this)},this._tables.appIdTable.add(new hc(Xi.MLIGHTCAD_APPID))}get tables(){return this._tables}get objects(){return this._objects}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar("aunits",this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar("version",this._version,new Dn(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar("insunits",this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar("ltscale",this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar("lwdisplay",this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar("cecolor",this._cecolor,t||0,e=>{this._cecolor=e})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar("celtscale",this._celtscale,t??1,e=>{this._celtscale=e})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar("celweight",this._celweight,t??nn.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar("clayer",this._clayer,t??"0",e=>{this._clayer=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar("angbase",this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar("angdir",this._angDir,t??0,e=>{this._angDir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent("extmax",e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent("extmin",e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar("pdmode",this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar("pdsize",this._pdsize,t??0,e=>{this._pdsize=e})}async read(t,e,s=Xs.DXF){const a=fr.instance.get(s);if(a==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await a.read(t,this,e&&e.minimumChunkSize||10,async(h,u,m,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,subStageStatus:m,data:b}),e&&e.fontLoader&&u=="FONT"&&m=="END"){const f=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}})}async openUri(t,e){var M;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const s=await fetch(t);if(!s.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${s.status}'!`);const a=s.headers.get("content-length"),h=a?parseInt(a,10):null;let u=0;const m=(M=s.body)==null?void 0:M.getReader();if(!m)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:L,value:O}=await m.read();if(L)break;if(b.push(O),u+=O.length,h!==null){const V=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:V,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let w=0;for(const L of b)f.set(L,w),w+=L.length;const A=this.getFileNameFromUri(t).toLowerCase().split(".").pop();A==="dwg"?await this.read(f.buffer,e,Xs.DWG):A==="dxf"?await this.read(f.buffer,e,Xs.DXF):await this.read(f.buffer,e,A),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}async regen(){await new ec(this).read(null,this,500,async(e,s,a,h)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:s,subStageStatus:a,data:h})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Vh(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}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._objects.layout.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,s,a){this.hasSysVarValueChanged(e,s)&&(a(s),this.triggerSysVarChangedEvent(t,e,s))}hasSysVarValueChanged(t,e){return t instanceof fe&&e instanceof fe?!t.equals(e):t instanceof Dn&&e instanceof Dn?t.value!==e.value:!Object.is(t,e)}triggerSysVarChangedEvent(t,e,s){const a=Di.instance(),h=t.toLowerCase();a.getDescriptor(h)!=null&&a.events.sysVarChanged.dispatch({database:this,name:h,oldVal:e,newVal:s})}getFileNameFromUri(t){try{const s=new URL(t).pathname.split("/");return s[s.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}};Xi.MLIGHTCAD_APPID="mlightcad";let za=Xi;var uc=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(uc||{}),cc=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(cc||{}),dc=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(dc||{}),pc=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(pc||{}),mc=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(mc||{});const Yi=class Yi extends sn{constructor(t,e){t=t||{},Zn(t,Yi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}};Yi.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 $n=Yi;class Ys extends sn{constructor(t){super(),this.name=t.name,this._linetype=t}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(t){if(t<0||t>=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[t].elementLength}}class co extends sn{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}}const tp={center:new kt,viewDirectionFromTarget:new W(0,0,1),viewTarget:new W(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:eo.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new W(0,0,0),ucsXAxis:new W(1,0,0),ucsYAxis:new W(0,1,0),orthographicType:ro.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:no.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class gc extends sn{constructor(){super(),this._circleSides=100,this._center=new kt,this._lowerLeftCorner=new kt(0,0),this._upperRightCorner=new kt(1,1),this._snapBase=new kt(0,0),this._snapAngle=0,this._snapSpacing=new kt(0,0),this._standardFlag=0,this._gridSpacing=new kt,this._gridMajor=10,this._gsView=tp}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get gsView(){return this._gsView}}class fc{constructor(){this.events={layoutCreated:new oe,layoutRemoved:new oe,layoutRenamed:new oe,layoutSwitched:new oe}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(a,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(a,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getAt(t);return this.setCurrentLayoutInternal(a,s)}renameLayout(t,e,s){const h=this.getWorkingDatabase(s).objects.layout.getAt(t);return h?(h.layoutName=e,this.events.layoutRenamed.dispatch({layout:h,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const s=this.getWorkingDatabase(e).objects.layout,a=s.getAt(t);let h=!1;return a&&(h=s.remove(t),h&&this.events.layoutRemoved.dispatch({layout:a})),h}createLayout(t,e){const s=this.getWorkingDatabase(e),a=new ea;a.layoutName=t,a.tabOrder=s.objects.layout.maxTabOrder;const h=new he;return h.name=`*Paper_Space${a.tabOrder}`,s.tables.blockTable.add(h),s.objects.layout.setAt(t,a),this.events.layoutCreated.dispatch({layout:a}),{layout:a,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||po().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function po(){return Hi.instance}const Ki=class Ki{constructor(){this._workingDatabase=null,this._layoutManager=new fc}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager}};Ki.instance=new Ki;let Hi=Ki;var _c=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(_c||{});class mo{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new mo(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}exports.AcCmColor=fe;exports.AcCmColorMethod=ct;exports.AcCmColorUtil=Jr;exports.AcCmEntityColor=Bc;exports.AcCmErrors=Ke;exports.AcCmEventDispatcher=zc;exports.AcCmEventManager=oe;exports.AcCmLoader=Dc;exports.AcCmLoadingManager=Vl;exports.AcCmObject=Bl;exports.AcCmPerformanceCollector=Fa;exports.AcCmTask=Rl;exports.AcCmTaskScheduler=Fl;exports.AcCmTransparency=$i;exports.AcCmTransparencyMethod=Te;exports.AcDb2dPolyline=xi;exports.AcDb2dVertex=La;exports.AcDb2dVertexType=Eh;exports.AcDb3PointAngularDimension=Fi;exports.AcDb3dPolyline=wi;exports.AcDb3dVertex=Ca;exports.AcDb3dVertexType=Mh;exports.AcDbAlignedDimension=Vi;exports.AcDbAngleUnits=Ua;exports.AcDbArc=Si;exports.AcDbArcDimension=Oa;exports.AcDbAttribute=Ii;exports.AcDbAttributeDefinition=Pi;exports.AcDbAttributeFlags=le;exports.AcDbAttributeMTextFlag=_r;exports.AcDbBaseWorker=J0;exports.AcDbBatchProcessing=Va;exports.AcDbBlockReference=Kn;exports.AcDbBlockTable=rc;exports.AcDbBlockTableRecord=he;exports.AcDbCircle=Ai;exports.AcDbCodePage=ja;exports.AcDbCurve=Ne;exports.AcDbDataGenerator=Vh;exports.AcDbDatabase=za;exports.AcDbDatabaseConverter=ao;exports.AcDbDatabaseConverterManager=fr;exports.AcDbDiametricDimension=Ui;exports.AcDbDictionary=qs;exports.AcDbDimArrowType=Uh;exports.AcDbDimStyleTable=nc;exports.AcDbDimStyleTableRecord=$n;exports.AcDbDimTextHorizontal=uc;exports.AcDbDimTextVertical=cc;exports.AcDbDimVerticalJustification=mc;exports.AcDbDimZeroSuppression=dc;exports.AcDbDimZeroSuppressionAngular=pc;exports.AcDbDimension=Ur;exports.AcDbDuplicateRecordCloning=Fh;exports.AcDbDwgVersion=Dn;exports.AcDbDxfCode=Ra;exports.AcDbDxfConverter=tc;exports.AcDbEllipse=Ei;exports.AcDbEntity=ke;exports.AcDbFace=Mi;exports.AcDbFileType=Xs;exports.AcDbHatch=Ks;exports.AcDbHatchPatternType=Hs;exports.AcDbHatchStyle=Nh;exports.AcDbHostApplicationServices=Hi;exports.AcDbLayerTable=sc;exports.AcDbLayerTableRecord=na;exports.AcDbLayout=ea;exports.AcDbLayoutDictionary=zh;exports.AcDbLayoutManager=fc;exports.AcDbLeader=Ti;exports.AcDbLeaderAnnotationType=Lh;exports.AcDbLine=$s;exports.AcDbLineSpacingStyle=Bh;exports.AcDbLinetypeTable=ic;exports.AcDbLinetypeTableRecord=Ys;exports.AcDbMText=Zs;exports.AcDbObject=jr;exports.AcDbObjectIterator=ri;exports.AcDbOpenMode=_c;exports.AcDbOrdinateDimension=ji;exports.AcDbOsnapMode=Ft;exports.AcDbPoint=Ci;exports.AcDbPoly2dType=Wn;exports.AcDbPoly3dType=Ds;exports.AcDbPolyline=Li;exports.AcDbRadialDimension=Gi;exports.AcDbRasterImage=Js;exports.AcDbRasterImageClipBoundaryType=Ch;exports.AcDbRasterImageDef=Rh;exports.AcDbRasterImageImageDisplayOpt=Oh;exports.AcDbRay=Oi;exports.AcDbRegAppTable=lc;exports.AcDbRegAppTableRecord=hc;exports.AcDbRegenerator=ec;exports.AcDbRenderingCache=Qn;exports.AcDbResultBuffer=mo;exports.AcDbSpline=Qs;exports.AcDbSymbolTable=an;exports.AcDbSymbolTableRecord=sn;exports.AcDbSysVarManager=Di;exports.AcDbTable=ki;exports.AcDbText=Yn;exports.AcDbTextHorizontalMode=Th;exports.AcDbTextStyleTable=ac;exports.AcDbTextStyleTableRecord=co;exports.AcDbTextVerticalMode=kh;exports.AcDbTrace=Ni;exports.AcDbUnitsValue=io;exports.AcDbViewport=Bi;exports.AcDbViewportTable=oc;exports.AcDbViewportTableRecord=gc;exports.AcDbWipeout=zi;exports.AcDbWorkerApi=Qu;exports.AcDbWorkerManager=Zu;exports.AcDbXline=Ri;exports.AcDbXrecord=so;exports.AcGeArea2d=Qi;exports.AcGeBox2d=Se;exports.AcGeBox3d=Nt;exports.AcGeCatmullRomCurve3d=Sh;exports.AcGeCircArc2d=qn;exports.AcGeCircArc3d=Qa;exports.AcGeCurve2d=Jn;exports.AcGeEllipseArc2d=Ji;exports.AcGeEllipseArc3d=ta;exports.AcGeEuler=Qc;exports.AcGeGeometryUtil=ch;exports.AcGeLine2d=Ws;exports.AcGeLine3d=Xn;exports.AcGeLoop2d=Ja;exports.AcGeMathUtil=Pt;exports.AcGeMatrix2d=Zi;exports.AcGeMatrix3d=Ye;exports.AcGeNurbsCurve=Sn;exports.AcGePlane=ti;exports.AcGePoint2d=kt;exports.AcGePoint3d=W;exports.AcGePolyline2d=An;exports.AcGeQuaternion=In;exports.AcGeShape2d=Za;exports.AcGeSpline3d=rn;exports.AcGeTol=Ya;exports.AcGeVector2d=Jt;exports.AcGeVector3d=Y;exports.AcGiArrowType=to;exports.AcGiDefaultLightingType=no;exports.AcGiLineWeight=nn;exports.AcGiMTextAttachmentPoint=we;exports.AcGiMTextFlowDirection=Vr;exports.AcGiOrthographicType=ro;exports.AcGiRenderMode=eo;exports.AcGiViewport=Ph;exports.AcTrStringUtil=Wc;exports.ByBlock=Gl;exports.ByLayer=di;exports.DEBUG_MODE=jc;exports.DEFAULT_LINE_TYPE=vi;exports.DEFAULT_TOL=Ka;exports.DEG2RAD=Ga;exports.DefaultLoadingManager=Ul;exports.FLOAT_TOL=xn;exports.ORIGIN_POINT_2D=qc;exports.ORIGIN_POINT_3D=Xa;exports.RAD2DEG=Wa;exports.TAU=Zt;exports.acdbDisableOsnapMode=ld;exports.acdbEnableOsnapMode=od;exports.acdbHasOsnapMode=ad;exports.acdbHostApplicationServices=po;exports.acdbMaskToOsnapModes=sd;exports.acdbOsnapModesToMask=nd;exports.acdbToggleOsnapMode=id;exports.basisFunction=bi;exports.calculateCurveLength=gh;exports.ceilPowerOfTwo=nh;exports.clamp=Fr;exports.clone=Fs;exports.createWorkerApi=Ju;exports.damp=ql;exports.deepClone=Ea;exports.defaults=Zn;exports.degToRad=th;exports.dwgCodePageToEncoding=jl;exports.euclideanModulo=Da;exports.evaluateNurbsPoint=Gs;exports.floorPowerOfTwo=sh;exports.generateChordKnots=ph;exports.generateSqrtChordKnots=mh;exports.generateUUID=Wl;exports.generateUniformKnots=dh;exports.has=Nl;exports.intPartLength=qa;exports.interpolateControlPoints=Xc;exports.inverseLerp=Hl;exports.isBetween=ih;exports.isBetweenAngle=ah;exports.isEmpty=Ll;exports.isEqual=Hn;exports.isImperialUnits=cd;exports.isMetricUnits=ud;exports.isPointInPolygon=$a;exports.isPolygonIntersect=uh;exports.isPowerOfTwo=rh;exports.lerp=Ha;exports.log=Us;exports.mapLinear=Dl;exports.normalizeAngle=js;exports.pingpong=Xl;exports.radToDeg=eh;exports.randFloat=Zl;exports.randFloatSpread=Ql;exports.randInt=$l;exports.relativeEps=oh;exports.seededRandom=Jl;exports.setLogLevel=Gc;exports.smootherstep=Kl;exports.smoothstep=Yl;
5
+ `)}),f+=`- total: ${this.data.total} ms`,f}};Fa.getInstance().collect(h),this.progress=a;const u={value:0},m=new Fl;m.setCompleteCallback(()=>this.onFinished()),m.setErrorCallback(f=>this.onError(f)),m.addTask(new Be({stage:"START",step:1,progress:u,task:async f=>f},a)),m.addTask(new Be({stage:"PARSE",step:5,progress:u,task:async f=>await this.parse(f)},a)),m.addTask(new Be({stage:"FONT",step:5,progress:u,task:async f=>{const w=this.getFonts(f.model);return{model:f.model,data:w}}},a)),m.addTask(new Be({stage:"LTYPE",step:1,progress:u,task:async f=>(this.processLineTypes(f.model,e),f)},a)),m.addTask(new Be({stage:"STYLE",step:1,progress:u,task:async f=>(this.processTextStyles(f.model,e),f)},a)),m.addTask(new Be({stage:"DIMSTYLE",step:1,progress:u,task:async f=>(this.processDimStyles(f.model,e),f)},a)),m.addTask(new Be({stage:"LAYER",step:1,progress:u,task:async f=>(this.processLayers(f.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),f)},a)),m.addTask(new Be({stage:"VPORT",step:1,progress:u,task:async f=>(this.processViewports(f.model,e),f)},a)),m.addTask(new Be({stage:"HEADER",step:1,progress:u,task:async f=>(this.processHeader(f.model,e),f)},a)),m.addTask(new Be({stage:"BLOCK_RECORD",step:5,progress:u,task:async f=>(this.processBlockTables(f.model,e),f)},a)),m.addTask(new Be({stage:"OBJECT",step:5,progress:u,task:async f=>(this.processObjects(f.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),f)},a)),m.addTask(new Be({stage:"BLOCK",step:5,progress:u,task:async f=>(await this.processBlocks(f.model,e),f)},a)),m.addTask(new Be({stage:"ENTITY",step:100,progress:u,task:async f=>(await this.processEntities(f.model,e,s,u,a),f)},a)),m.addTask(new Be({stage:"END",step:0,progress:u,task:async f=>f},a));const b=Date.now();await m.run(t),h.data.total=Date.now()-b}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),Qn.instance.clear())}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,s,a,h){throw new Error("Not impelemented yet!")}}var pe,ws,ee,ae,Ss,or,Ie,Pr,lr,pn,Ps,Is,mn,gn,As,Es,Ms,Ge,Ir,Yt,fn,Ts,vt,Ae,ks,Ee,Ns,Ar,Er,hr,Ls,_n,We,Mr,yn,ya,va,Tr,kr,Cs,Os,Nr,Bs,ba,xa,me,Lr,ge,De,wa,Sa,Pa,Ia,Cr,He,vn,zs,bn,qe,Or,Xe,Br;(pe={})[pe.None=0]="None",pe[pe.Anonymous=1]="Anonymous",pe[pe.NonConstant=2]="NonConstant",pe[pe.Xref=4]="Xref",pe[pe.XrefOverlay=8]="XrefOverlay",pe[pe.ExternallyDependent=16]="ExternallyDependent",pe[pe.ResolvedOrDependent=32]="ResolvedOrDependent",pe[pe.ReferencedXref=64]="ReferencedXref";(ws={})[ws.BYBLOCK=0]="BYBLOCK",ws[ws.BYLAYER=256]="BYLAYER";(ee={})[ee.Rotated=0]="Rotated",ee[ee.Aligned=1]="Aligned",ee[ee.Angular=2]="Angular",ee[ee.Diameter=3]="Diameter",ee[ee.Radius=4]="Radius",ee[ee.Angular3Point=5]="Angular3Point",ee[ee.Ordinate=6]="Ordinate",ee[ee.ReferenceIsExclusive=32]="ReferenceIsExclusive",ee[ee.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",ee[ee.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(ae={})[ae.TopLeft=1]="TopLeft",ae[ae.TopCenter=2]="TopCenter",ae[ae.TopRight=3]="TopRight",ae[ae.MiddleLeft=4]="MiddleLeft",ae[ae.MiddleCenter=5]="MiddleCenter",ae[ae.MiddleRight=6]="MiddleRight",ae[ae.BottomLeft=7]="BottomLeft",ae[ae.BottomCenter=8]="BottomCenter",ae[ae.BottomRight=9]="BottomRight";(Ss={})[Ss.AtLeast=1]="AtLeast",Ss[Ss.Exact=2]="Exact";var Pl=((or={})[or.Center=0]="Center",or[or.Above=1]="Above",or[or.Outside=2]="Outside",or[or.JIS=3]="JIS",or[or.Below=4]="Below",or),Gn=((Ie={})[Ie.Feet=0]="Feet",Ie[Ie.None=1]="None",Ie[Ie.Inch=2]="Inch",Ie[Ie.FeetAndInch=3]="FeetAndInch",Ie[Ie.Leading=4]="Leading",Ie[Ie.Trailing=8]="Trailing",Ie[Ie.LeadingAndTrailing=12]="LeadingAndTrailing",Ie),dd=((Pr={})[Pr.None=0]="None",Pr[Pr.Leading=1]="Leading",Pr[Pr.Trailing=2]="Trailing",Pr[Pr.LeadingAndTrailing=3]="LeadingAndTrailing",Pr),pd=((lr={})[lr.Center=0]="Center",lr[lr.Left=1]="Left",lr[lr.Right=2]="Right",lr[lr.OverFirst=3]="OverFirst",lr[lr.OverSecond=4]="OverSecond",lr),md=((pn={})[pn.Bottom=0]="Bottom",pn[pn.Center=1]="Center",pn[pn.Top=2]="Top",pn),gd=((Ps={})[Ps.PatternFill=0]="PatternFill",Ps[Ps.SolidFill=1]="SolidFill",Ps);(Is={})[Is.NonAssociative=0]="NonAssociative",Is[Is.Associative=1]="Associative";(mn={})[mn.Normal=0]="Normal",mn[mn.Outer=1]="Outer",mn[mn.Ignore=2]="Ignore";(gn={})[gn.UserDefined=0]="UserDefined",gn[gn.Predefined=1]="Predefined",gn[gn.Custom=2]="Custom";(As={})[As.NotAnnotated=0]="NotAnnotated",As[As.Annotated=1]="Annotated";(Es={})[Es.Solid=0]="Solid",Es[Es.Gradient=1]="Gradient";(Ms={})[Ms.TwoColor=0]="TwoColor",Ms[Ms.OneColor=1]="OneColor";var fd=((Ge={})[Ge.Default=0]="Default",Ge[Ge.External=1]="External",Ge[Ge.Polyline=2]="Polyline",Ge[Ge.Derived=4]="Derived",Ge[Ge.Textbox=8]="Textbox",Ge[Ge.Outermost=16]="Outermost",Ge),ui=((Ir={})[Ir.Line=1]="Line",Ir[Ir.Circular=2]="Circular",Ir[Ir.Elliptic=3]="Elliptic",Ir[Ir.Spline=4]="Spline",Ir),_d=((Yt={})[Yt.Off=0]="Off",Yt[Yt.Solid=1]="Solid",Yt[Yt.Dashed=2]="Dashed",Yt[Yt.Dotted=3]="Dotted",Yt[Yt.ShotDash=4]="ShotDash",Yt[Yt.MediumDash=5]="MediumDash",Yt[Yt.LongDash=6]="LongDash",Yt[Yt.DoubleShortDash=7]="DoubleShortDash",Yt[Yt.DoubleMediumDash=8]="DoubleMediumDash",Yt[Yt.DoubleLongDash=9]="DoubleLongDash",Yt[Yt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Yt[Yt.SparseDot=11]="SparseDot",Yt);_d.Off;(fn={})[fn.Standard=-3]="Standard",fn[fn.ByLayer=-2]="ByLayer",fn[fn.ByBlock=-1]="ByBlock";(Ts={})[Ts.English=0]="English",Ts[Ts.Metric=1]="Metric";(vt={})[vt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",vt[vt.FRONT_CLIPPING=2]="FRONT_CLIPPING",vt[vt.BACK_CLIPPING=4]="BACK_CLIPPING",vt[vt.UCS_FOLLOW=8]="UCS_FOLLOW",vt[vt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",vt[vt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",vt[vt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",vt[vt.FAST_ZOOM=128]="FAST_ZOOM",vt[vt.SNAP_MODE=256]="SNAP_MODE",vt[vt.GRID_MODE=512]="GRID_MODE",vt[vt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",vt[vt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",vt[vt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",vt[vt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",vt[vt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",vt[vt.UNUSED=32768]="UNUSED",vt[vt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",vt[vt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",vt[vt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",vt[vt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",vt[vt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",vt[vt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(Ae={})[Ae.OPTIMIZED_2D=0]="OPTIMIZED_2D",Ae[Ae.WIREFRAME=1]="WIREFRAME",Ae[Ae.HIDDEN_LINE=2]="HIDDEN_LINE",Ae[Ae.FLAT_SHADED=3]="FLAT_SHADED",Ae[Ae.GOURAUD_SHADED=4]="GOURAUD_SHADED",Ae[Ae.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Ae[Ae.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(ks={})[ks.UCS_UNCHANGED=0]="UCS_UNCHANGED",ks[ks.HAS_OWN_UCS=1]="HAS_OWN_UCS";(Ee={})[Ee.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",Ee[Ee.TOP=1]="TOP",Ee[Ee.BOTTOM=2]="BOTTOM",Ee[Ee.FRONT=3]="FRONT",Ee[Ee.BACK=4]="BACK",Ee[Ee.LEFT=5]="LEFT",Ee[Ee.RIGHT=6]="RIGHT";(Ns={})[Ns.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ns[Ns.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Ar={})[Ar.ByLayer=0]="ByLayer",Ar[Ar.ByBlock=1]="ByBlock",Ar[Ar.ByDictionaryDefault=2]="ByDictionaryDefault",Ar[Ar.ByObject=3]="ByObject";function It(n,t,e){return n.code===t&&(e==null||n.value===e)}function Rt(n){let t={};n.rewind();let e=n.next(),s=e.code;if(t.x=e.value,(e=n.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=n.next()).code!==s+20?n.rewind():t.z=e.value,t}let oo=Symbol();function xt(n,t){return(e,s,a)=>{let h=function(b,f=!1){return b.reduce((w,x)=>{x.pushContext&&w.push({});let A=w[w.length-1];for(let M of typeof x.code=="number"?[x.code]:x.code){let L=A[M]??(A[M]=[]);x.isMultiple&&L.length&&f&&console.warn(`Snippet ${L[L.length-1].name} for code(${M}) is shadowed by ${x.name}`),L.push(x)}return w},[{}])}(n,s.debug),u=!1,m=h.length-1;for(;!It(e,0,"EOF");){let b=function(V,F,at){return V.find((ft,st)=>{var H;return st>=at&&((H=ft[F])==null?void 0:H.length)})}(h,e.code,m),f=b==null?void 0:b[e.code],w=f==null?void 0:f[f.length-1];if(!b||!w){s.rewind();break}w.isMultiple||b[e.code].pop();let{name:x,parser:A,isMultiple:M,isReducible:L}=w,O=A==null?void 0:A(e,s,a);if(O===oo){s.rewind();break}if(x){let[V,F]=function(at,ft){let st=ft.split(".");if(!st.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let H=at;for(let dt=0;dt<st.length-1;++dt){let it=Aa(st[dt]),Wt=Aa(st[dt+1]);Object.prototype.hasOwnProperty.call(H,it)||(typeof Wt=="number"?H[it]=[]:H[it]={}),H=H[it]}return[H,Aa(st[st.length-1])]}(a,x);M&&!L?(Object.prototype.hasOwnProperty.call(V,F)||(V[F]=[]),V[F].push(O)):V[F]=O}w.pushContext&&(m-=1),u=!0,e=s.next()}return t&&Object.setPrototypeOf(a,t),u}}function Aa(n){let t=Number.parseInt(n);return Number.isNaN(t)?n:t}function v({value:n}){return n}function D(n,t){return Rt(t)}function Ut({value:n}){return!!n}let yd=[{code:1001,name:"xdata",parser:Gh}];function Gh(n,t){var a;if(!It(n,1001))throw Error("XData must starts with code 1001");let e={appName:n.value,value:[]};n=t.next();let s=[e.value];for(;!It(n,0,"EOF")&&n.code>=1e3;){let h=s[s.length-1];switch(n.code){case 1002:n.value==="{"?s.push([]):(s.pop(),(a=s[s.length-1])==null||a.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:zr(n.code),value:n.value});break;case 1003:h.push({name:"layer",type:zr(n.code),value:n.value});break;case 1005:h.push({name:"handle",type:zr(n.code),value:n.value});break;case 1010:h.push({type:zr(n.code),value:Rt(t)});break;case 1011:h.push({name:"worldSpacePosition",type:zr(n.code),value:Rt(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:zr(n.code),value:Rt(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:zr(n.code),value:Rt(t)});break;case 1041:h.push({name:"distance",type:zr(n.code),value:n.value});break;case 1042:h.push({name:"scale",type:zr(n.code),value:n.value})}n=t.next()}return t.rewind(),e}function zr(n){switch(n){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 Pn(n,t,e){for(;It(n,102);){var s;let a=n.value;if(n=t.next(),!a.startsWith("{")){t.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${a}`),function(u,m){for(;!It(u,102)&&!It(u,0,"EOF");)u=m.next()}(n,t),n=t.next();continue}let h=a.slice(1).trim();e.extensions??(e.extensions={}),(s=e.extensions)[h]??(s[h]=[]),function(u,m,b){for(;!It(u,102,"}")&&!It(u,0,"EOF");)b.push(u),u=m.next()}(n,t,e.extensions[h]),n=t.next()}t.rewind()}let vd=0;function Wh(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=vd++)}var bd=[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 Dh(n){return bd[n]}(Er={})[Er.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Er[Er.CAST=1]="CAST",Er[Er.RECEIVE=2]="RECEIVE",Er[Er.IGNORE=3]="IGNORE";let Gt=[...yd,{code:284,name:"shadowMode",parser:v},{code:390,name:"plotStyleHardId",parser:v},{code:380,name:"plotStyleType",parser:v},{code:440,name:"transparency",parser:v},{code:430,name:"colorName",parser:v},{code:420,name:"color",parser:v},{code:310,name:"proxyEntity",isMultiple:!0,parser:v},{code:92,name:"proxyByte",parser:v},{code:60,name:"isVisible",parser:Ut},{code:48,name:"lineTypeScale",parser:v},{code:370,name:"lineweight",parser:v},{code:62,name:"colorIndex",parser(n,t,e){let s=n.value;return s>0&&s<256&&(e.color=Dh(Math.abs(s))),s}},{code:347,name:"materialObjectHardId",parser:v},{code:6,name:"lineType",parser:v},{code:8,name:"layer",parser:v},{code:410,name:"layoutTabName",parser:v},{code:67,name:"isInPaperSpace",parser:Ut},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:v},{code:102,parser:Pn},{code:102,parser:Pn},{code:102,parser:Pn},{code:5,name:"handle",parser:v}];function ra(n){return[{code:3,name:n,parser:(t,e,s)=>(s._code3text=(s._code3text??"")+t.value,s._code3text+(s._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(t,e,s)=>(s._code1text=t.value,(s._code3text??"")+s._code1text)}]}function Hh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let xd={extrusionDirection:{x:0,y:0,z:1}},wd=[{code:210,name:"extrusionDirection",parser:D},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:100,name:"subclassMarker",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D},{code:39,name:"thickness",parser:v},{code:100},...Gt];class qh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Hh(this,"parser",xt(wd,xd))}}Hh(qh,"ForEntityName","ARC");(hr={})[hr.NONE=0]="NONE",hr[hr.INVISIBLE=1]="INVISIBLE",hr[hr.CONSTANT=2]="CONSTANT",hr[hr.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",hr[hr.PRESET=8]="PRESET";(Ls={})[Ls.MULTILINE=2]="MULTILINE",Ls[Ls.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(_n={})[_n.NONE=0]="NONE",_n[_n.MIRRORED_X=2]="MIRRORED_X",_n[_n.MIRRORED_Y=4]="MIRRORED_Y";var Sd=((We={})[We.LEFT=0]="LEFT",We[We.CENTER=1]="CENTER",We[We.RIGHT=2]="RIGHT",We[We.ALIGNED=3]="ALIGNED",We[We.MIDDLE=4]="MIDDLE",We[We.FIT=5]="FIT",We),Pd=((Mr={})[Mr.BASELINE=0]="BASELINE",Mr[Mr.BOTTOM=1]="BOTTOM",Mr[Mr.MIDDLE=2]="MIDDLE",Mr[Mr.TOP=3]="TOP",Mr);function Xh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Yh={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Sd.LEFT,valign:Pd.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Kh=[{code:73,name:"valign",parser:v},{code:100},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"endPoint",parser:D},{code:72,name:"valign",parser:v},{code:72,name:"halign",parser:v},{code:71,name:"generationFlag",parser:v},{code:7,name:"styleName",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"xScale",parser:v},{code:50,name:"rotation",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class $h{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xh(this,"parser",xt(Kh,Yh))}}function Zh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Xh($h,"ForEntityName","TEXT");let Id={...Yh},Ad=[{code:2},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:D},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Ut},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedRecord",parser:Ut},{code:100},{code:280,name:"isLocked",parser:Ut},{code:74,name:"valign",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:3,name:"prompt",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},...Kh.slice(2)];class Qh{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Zh(this,"parser",xt(Ad,Id))}}Zh(Qh,"ForEntityName","ATTDEF");(yn={})[yn.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",yn[yn.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",yn[yn.BY_STYLE=5]="BY_STYLE";function Ed(n,t){let e={};for(let s of n){let a=t(s);a!=null&&(e[a]??(e[a]=[]),e[a].push(s))}return e}function*Wi(n,t=1/0,e=1){for(let s=n;s!==t;s+=e)yield s}function tn(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function lo(n,t,e){if(It(t,102))return Pn(t,e,n),!0;switch(t.code){case 0:n.type=t.value;break;case 5:n.handle=t.value;break;case 330:n.ownerBlockRecordSoftId=t.value;break;case 67:n.isInPaperSpace=!!t.value;break;case 8:n.layer=t.value;break;case 6:n.lineType=t.value;break;case 347:n.materialObjectHardId=t.value;break;case 62:n.colorIndex=t.value,n.color=Dh(Math.abs(t.value));break;case 370:n.lineweight=t.value;break;case 48:n.lineTypeScale=t.value;break;case 60:n.isVisible=!!t.value;break;case 92:n.proxyByte=t.value;break;case 310:n.proxyEntity=t.value;break;case 100:break;case 420:n.color=t.value;break;case 430:n.transparency=t.value;break;case 390:n.plotStyleHardId=t.value;break;case 284:n.shadowMode=t.value;break;case 1001:n.xdata=Gh(t,e);break;default:return!1}return!0}function Jh(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Md={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},mi=[{code:46,name:"annotationHeight",parser:v},{code:101,parser(n,t){(function(e){e.rewind();let s=e.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=e.next();while(s.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:v},{code:49,name:"columnGutter",parser:v},{code:48,name:"columnWidth",parser:v},{code:79,name:"columnAutoHeight",parser:v},{code:78,name:"columnFlowReversed",parser:v},{code:76,name:"columnCount",parser:v},{code:75,name:"columnType",parser:v},{code:441,name:"backgroundFillTransparency",parser:v},{code:63,name:"backgroundFillColor",parser:v},{code:45,name:"fillBoxScale",parser:v},{code:[...Wi(430,440)],name:"backgroundColor",parser:v},{code:[...Wi(420,430)],name:"backgroundColor",parser:v},{code:90,name:"backgroundFill",parser:v},{code:44,name:"lineSpacing",parser:v},{code:73,name:"lineSpacingStyle",parser:v},{code:50,name:"rotation",parser:v},{code:43},{code:42},{code:11,name:"direction",parser:D},{code:210,name:"extrusionDirection",parser:D},{code:7,name:"styleName",parser:v},...ra("text"),{code:72,name:"drawingDirection",parser:v},{code:71,name:"attachmentPoint",parser:v},{code:41,name:"width",parser:v},{code:40,name:"height",parser:v},{code:10,name:"insertionPoint",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class tu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Jh(this,"parser",xt(mi,Md))}}function eu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Jh(tu,"ForEntityName","MTEXT");let Td={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},kd=[...mi.slice(mi.findIndex(({name:n})=>n==="columnType"),mi.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!It(n,0,"MTEXT"))return oo}},{code:2,name:"definitionTag",parser:v},{code:40,name:"annotationScale",parser:v},{code:10,name:"alignmentPoint",parser:D},{code:340,name:"secondaryAttributesHardId",parser:v},{code:70,name:"numberOfSecondaryAttributes",parser:v},{code:70,name:"isReallyLocked",parser:Ut},{code:70,name:"mtextFlag",parser:v},{code:280,name:"isDuplicatedEntriesKeep",parser:Ut},{code:100},{code:280,name:"lockPositionFlag",parser:Ut},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"alignmentPoint",parser:D},{code:74,name:"verticalJustification",parser:v},{code:72,name:"horizontalJustification",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:7,name:"textStyle",parser:v},{code:51,name:"obliqueAngle",parser:v},{code:41,name:"scale",parser:v},{code:50,name:"rotation",parser:v},{code:73},{code:70,name:"attributeFlag",parser:v},{code:2,name:"tag",parser:v},{code:280},{code:100,name:"subclassMarker",parser:v},{code:1,name:"text",parser:v},{code:40,name:"textHeight",parser:v},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100},...Gt];class ru{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){eu(this,"parser",xt(kd,Td))}}function nu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}eu(ru,"ForEntityName","ATTRIB");let Nd=[...ra("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class su{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){nu(this,"parser",xt(Nd))}}function iu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}nu(su,"ForEntityName","BODY");let Ld={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Cd=[{code:210,name:"extrusionDirection",parser:D},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class au{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){iu(this,"parser",xt(Cd,Ld))}}iu(au,"ForEntityName","CIRCLE");class gi{parseEntity(t,e){let s={};for(;!It(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(a,h,u){switch(h.code){case 100:a.subclassMarker=h.value;break;case 280:a.version=h.value;break;case 2:a.name=h.value;break;case 10:a.definitionPoint=Rt(u);break;case 11:a.textPoint=Rt(u);break;case 12:a.insertionPoint=Rt(u);break;case 13:a.subDefinitionPoint1=Rt(u);break;case 14:a.subDefinitionPoint2=Rt(u);break;case 15:a.centerPoint=Rt(u);break;case 16:a.arcPoint=Rt(u);break;case 70:a.dimensionType=h.value;break;case 71:a.attachmentPoint=h.value;break;case 72:a.textLineSpacingStyle=h.value;break;case 40:a.leaderLength=h.value;break;case 41:a.textLineSpacingFactor=h.value;break;case 42:a.measurement=h.value;break;case 1:a.text=h.value;break;case 50:a.rotationAngle=h.value;break;case 52:a.obliqueAngle=h.value;break;case 53:a.textRotation=h.value;break;case 51:a.ocsRotation=h.value;break;case 210:a.extrusionDirection=Rt(u);break;case 3:a.styleName=h.value;break;default:lo(a,h,u)}})(s,e,t),e=t.next()}return s}}function ou(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}va="DIMENSION",(ya="ForEntityName")in gi?Object.defineProperty(gi,ya,{value:va,enumerable:!0,configurable:!0,writable:!0}):gi[ya]=va;let Od={extrusionDirection:{x:0,y:0,z:1}},Bd=[{code:42,name:"endAngle",parser:v},{code:41,name:"startAngle",parser:v},{code:40,name:"axisRatio",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:11,name:"majorAxisEndPoint",parser:D},{code:10,name:"center",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class lu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ou(this,"parser",xt(Bd,Od))}}ou(lu,"ForEntityName","ELLIPSE");(Tr={})[Tr.First=1]="First",Tr[Tr.Second=2]="Second",Tr[Tr.Third=4]="Third",Tr[Tr.Fourth=8]="Fourth";function hu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let zd=[{code:13,name:"vertices.3",parser:D},{code:12,name:"vertices.2",parser:D},{code:11,name:"vertices.1",parser:D},{code:10,name:"vertices.0",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class uu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){hu(this,"parser",xt(zd))}}hu(uu,"ForEntityName","3DFACE");let cu=[{code:330,name:"sourceBoundaryObjects",parser:v,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:v}],Rd=[{code:11,name:"end",parser:D},{code:10,name:"start",parser:D}],Fd=[{code:73,name:"isCCW",parser:Ut},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"radius",parser:v},{code:10,name:"center",parser:D}],Vd=[{code:73,name:"isCCW",parser:Ut},{code:51,name:"endAngle",parser:v},{code:50,name:"startAngle",parser:v},{code:40,name:"lengthOfMinorAxis",parser:v},{code:11,name:"end",parser:D},{code:10,name:"center",parser:D}],Ud=[{code:13,name:"endTangent",parser:D},{code:12,name:"startTangent",parser:D},{code:11,name:"fitDatum",isMultiple:!0,parser:D},{code:97,name:"numberOfFitData",parser:v},{code:10,name:"controlPoints",isMultiple:!0,parser(n,t){let e={...Rt(t),weight:1};return(n=t.next()).code===42?e.weight=n.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:v},{code:96,name:"numberOfControlPoints",parser:v},{code:95,name:"numberOfKnots",parser:v},{code:74,name:"isPeriodic",parser:Ut},{code:73,name:"splineFlag",parser:v},{code:94,name:"degree",parser:v}],jd={[ui.Line]:Rd,[ui.Circular]:Fd,[ui.Elliptic]:Vd,[ui.Spline]:Ud},Gd=[...cu,{code:72,name:"edges",parser(n,t){let e={type:n.value},s=xt(jd[e.type]);if(!s)throw Error(`Invalid edge type ${e.type}`);return s(n=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:v}],Wd=[...cu,{code:10,name:"vertices",parser(n,t){let e={...Rt(t),bulge:0};return(n=t.next()).code===42?e.bulge=n.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:v},{code:73,name:"isClosed",parser:Ut},{code:72,name:"hasBulge",parser:Ut}],Dd=[{code:49,name:"dashLengths",parser:v,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:v},{code:45,name:"offset",parser:Il},{code:43,name:"base",parser:Il},{code:53,name:"angle",parser:v}];function Il(n,t){let e=n.code+1,s={x:n.value,y:1};return(n=t.next()).code===e?s.y=n.value:t.rewind(),s}function du(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Hd={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},qd=[{code:470},{code:463},{code:462,name:"colorTint",parser:v},{code:461,name:"gradientDefinition",parser:v},{code:460,name:"gradientRotation",parser:v},{code:453,name:"numberOfColors",parser:v},{code:452,name:"gradientColorFlag",parser:v},{code:451},{code:450,name:"gradientFlag",parser:v},{code:10,name:"seedPoints",parser:D,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:D},{code:98,name:"numberOfSeedPoints",parser:v},{code:47,name:"pixelSize",parser:v},{code:53,name:"definitionLines",parser:function(n,t){let e={};return xt(Dd)(n,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:v},{code:77,name:"isDouble",parser:Ut},{code:73,name:"isAnnotated",parser:Ut},{code:41,name:"patternScale",parser:v},{code:52,name:"patternAngle",parser:v},{code:76,name:"patternType",parser:v},{code:75,name:"hatchStyle",parser:v},{code:92,name:"boundaryPaths",parser:function(n,t){let e={boundaryPathTypeFlag:n.value},s=e.boundaryPathTypeFlag&fd.Polyline;return n=t.next(),s?xt(Wd)(n,t,e):xt(Gd)(n,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:v},{code:71,name:"associativity",parser:v},{code:63,name:"patternFillColor",parser:v},{code:70,name:"solidFill",parser:v},{code:2,name:"patternName",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:10,name:"elevationPoint",parser:D},{code:100,name:"subclassMarker",parser:v,pushContext:!0},...Gt];class pu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){du(this,"parser",xt(qd,Hd))}}du(pu,"ForEntityName","HATCH");(kr={})[kr.ShowImage=1]="ShowImage",kr[kr.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",kr[kr.UseClippingBoundary=4]="UseClippingBoundary",kr[kr.TransparencyIsOn=8]="TransparencyIsOn";(Cs={})[Cs.Rectangular=1]="Rectangular",Cs[Cs.Polygonal=2]="Polygonal";(Os={})[Os.Outside=0]="Outside",Os[Os.Inside=1]="Inside";function mu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Xd={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Yd=[{code:290,name:"clipMode",parser:v},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:D},{code:91,name:"countBoundaryPoints",parser:v},{code:71,name:"clippingBoundaryType",parser:v},{code:360,name:"imageDefReactorHandle",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipped",parser:Ut},{code:70,name:"flags",parser:v},{code:340,name:"imageDefHandle",parser:v},{code:13,name:"imageSize",parser:D},{code:12,name:"vPixel",parser:D},{code:11,name:"uPixel",parser:D},{code:10,name:"position",parser:D},{code:90,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class gu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){mu(this,"parser",xt(Yd,Xd))}}function fu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}mu(gu,"ForEntityName","IMAGE");let Kd={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},$d=[{code:210,name:"extrusionDirection",parser:D},{code:45,name:"rowSpacing",parser:v},{code:44,name:"columnSpacing",parser:v},{code:71,name:"rowCount",parser:v},{code:70,name:"columnCount",parser:v},{code:50,name:"rotation",parser:v},{code:43,name:"zScale",parser:v},{code:42,name:"yScale",parser:v},{code:41,name:"xScale",parser:v},{code:10,name:"insertionPoint",parser:D},{code:2,name:"name",parser:v},{code:66,name:"isVariableAttributes",parser:Ut},{code:100,name:"subclassMarker",parser:v},...Gt];class _u{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){fu(this,"parser",xt($d,Kd))}}function yu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}fu(_u,"ForEntityName","INSERT");let Zd={isArrowheadEnabled:!0},Qd=[{code:213,name:"offsetFromAnnotation",parser:D},{code:212,name:"offsetFromBlock",parser:D},{code:211,name:"horizontalDirection",parser:D},{code:210,name:"normal",parser:D},{code:340,name:"associatedAnnotation",parser:v},{code:77,name:"byBlockColor",parser:v},{code:10,name:"vertices",parser:D,isMultiple:!0},{code:76,name:"numberOfVertices",parser:v},{code:41,name:"textWidth",parser:v},{code:40,name:"textHeight",parser:v},{code:75,name:"isHooklineExists",parser:Ut},{code:74,name:"isHooklineSameDirection",parser:Ut},{code:73,name:"leaderCreationFlag",parser:v},{code:72,name:"isSpline",parser:Ut},{code:71,name:"isArrowheadEnabled",parser:Ut},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class vu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){yu(this,"parser",xt(Qd,Zd))}}yu(vu,"ForEntityName","LEADER");(Nr={})[Nr.TextAnnotation=0]="TextAnnotation",Nr[Nr.ToleranceAnnotation=1]="ToleranceAnnotation",Nr[Nr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Nr[Nr.NoAnnotation=3]="NoAnnotation";function bu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Jd={thickness:0,extrusionDirection:{x:0,y:0,z:1}},t0=[{code:210,name:"extrusionDirection",parser:D},{code:11,name:"endPoint",parser:D},{code:10,name:"startPoint",parser:D},{code:39,name:"thickness",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class xu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){bu(this,"parser",xt(t0,Jd))}}bu(xu,"ForEntityName","LINE");(Bs={})[Bs.IS_CLOSED=1]="IS_CLOSED",Bs[Bs.PLINE_GEN=128]="PLINE_GEN";let e0={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},r0={bulge:0},n0=[{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:91,name:"id",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v}],s0=[{code:210,name:"extrusionDirection",parser:D},{code:10,name:"vertices",isMultiple:!0,parser(n,t){let e={};return xt(n0,r0)(n,t,e),e}},{code:39,name:"thickness",parser:v},{code:38,name:"elevation",parser:v},{code:43,name:"constantWidth",parser:v},{code:70,name:"flag",parser:v},{code:90,name:"numberOfVertices",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class fi{parseEntity(t,e){let s={};return xt(s0,e0)(e,t,s),s}}function wu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}xa="LWPOLYLINE",(ba="ForEntityName")in fi?Object.defineProperty(fi,ba,{value:xa,enumerable:!0,configurable:!0,writable:!0}):fi[ba]=xa;let i0=[{code:90,name:"overridenSubEntityCount",parser:v},{code:140,name:"edgeCreaseWeights",parser:v,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:v},{code:94,parser(n,t,e){e.edgeCount=n.value,e.edgeIndices=[];for(let s=0;s<e.edgeCount;++s){let a=[];n=t.next(),a[0]=n.value,n=t.next(),a[1]=n.value,e.edgeIndices.push(a)}}},{code:93,parser(n,t,e){e.totalFaceIndices=n.value,e.faceIndices=[];let s=[];for(let h=0;h<e.totalFaceIndices&&!It(n,0);++h)n=t.next(),s.push(n.value);let a=0;for(;a<s.length;){let h=s[a++],u=[];for(let m=0;m<h;++m)u.push(s[a++]);e.faceIndices.push(u)}}},{code:10,name:"vertices",parser:D,isMultiple:!0},{code:92,name:"verticesCount",parser:v},{code:91,name:"subdivisionLevel",parser:v},{code:40,name:"blendCrease",parser:v},{code:72,name:"isBlendCreased",parser:Ut},{code:71,name:"version",parser:v},{code:100,name:"subclassMarker",parser:function({value:n}){return n.trim()},pushContext:!0},...Gt];class Su{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){wu(this,"parser",xt(i0))}}function Pu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}wu(Su,"ForEntityName","MESH");let a0={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},o0=[{code:50,name:"angle",parser:v},{code:210,name:"extrusionDirection",parser:D},{code:39,name:"thickness",parser:v},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class Iu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Pu(this,"parser",xt(o0,a0))}}Pu(Iu,"ForEntityName","POINT");(me={})[me.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",me[me.CURVE_FIT=2]="CURVE_FIT",me[me.SPLINE_FIT=4]="SPLINE_FIT",me[me.POLYLINE_3D=8]="POLYLINE_3D",me[me.POLYGON_3D=16]="POLYGON_3D",me[me.CLOSED_POLYGON=32]="CLOSED_POLYGON",me[me.POLYFACE=64]="POLYFACE",me[me.CONTINUOUS=128]="CONTINUOUS";var ci=((Lr={})[Lr.NONE=0]="NONE",Lr[Lr.QUADRATIC=5]="QUADRATIC",Lr[Lr.CUBIC=6]="CUBIC",Lr[Lr.BEZIER=8]="BEZIER",Lr),l0=((ge={})[ge.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ge[ge.TANGENT_DEFINED=2]="TANGENT_DEFINED",ge[ge.NOT_USED=4]="NOT_USED",ge[ge.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ge[ge.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ge[ge.FOR_POLYLINE=32]="FOR_POLYLINE",ge[ge.FOR_POLYGON=64]="FOR_POLYGON",ge[ge.POLYFACE=128]="POLYFACE",ge);function Au(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let h0={startWidth:0,endWidth:0,bulge:0},u0=[{code:91,name:"id",parser:v},{code:[...Wi(71,75)],name:"faces",isMultiple:!0,parser:v},{code:50,name:"tangentDirection",parser:v},{code:70,name:"flag",parser:v},{code:42,name:"bulge",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:30,name:"z",parser:v},{code:20,name:"y",parser:v},{code:10,name:"x",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...Gt];class ho{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Au(this,"parser",xt(u0,h0))}}function Eu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Au(ho,"ForEntityName","VERTEX");let c0={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:[]},d0=[{code:0,name:"vertices",isMultiple:!0,parser:(n,t)=>It(n,0,"VERTEX")?(n=t.next(),new ho().parseEntity(t,n)):oo},{code:210,name:"extrusionDirection",parser:D},{code:75,name:"smoothType",parser:v},{code:74,name:"surfaceNDensity",parser:v},{code:73,name:"surfaceMDensity",parser:v},{code:72,name:"meshNVertexCount",parser:v},{code:71,name:"meshMVertexCount",parser:v},{code:41,name:"endWidth",parser:v},{code:40,name:"startWidth",parser:v},{code:70,name:"flag",parser:v},{code:39,name:"thickness",parser:v},{code:30,name:"elevation",parser:v},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:v},...Gt];class Mu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Eu(this,"parser",xt(d0,c0))}}function Tu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Eu(Mu,"ForEntityName","POLYLINE");let p0=[{code:11,name:"direction",parser:D},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class ku{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Tu(this,"parser",xt(p0))}}function Nu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Tu(ku,"ForEntityName","RAY");let m0=[...ra("data"),{code:70,name:"version",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Lu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Nu(this,"parser",xt(m0))}}function Cu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Nu(Lu,"ForEntityName","REGION");let g0={vertices:[],backLineVertices:[]},f0=[{code:360,name:"geometrySettingHardId",parser:v},{code:12,name:"backLineVertices",isMultiple:!0,parser:D},{code:93,name:"numberOfBackLineVertices",parser:v},{code:11,name:"vertices",isMultiple:!0,parser:D},{code:92,name:"verticesCount",parser:v},{code:[63,411],name:"indicatorColor",parser:v},{code:70,name:"indicatorTransparency",parser:v},{code:41,name:"bottomHeight",parser:v},{code:40,name:"topHeight",parser:v},{code:10,name:"verticalDirection",parser:D},{code:1,name:"name",parser:v},{code:91,name:"flag",parser:v},{code:90,name:"state",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Ou{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Cu(this,"parser",xt(f0,g0))}}function Bu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Cu(Ou,"ForEntityName","SECTION");let _0={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},y0=[{code:210,name:"extrusionDirection",parser:D},{code:39,name:"thickness",parser:v},{code:[...Wi(10,14)],name:"points",isMultiple:!0,parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class zu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Bu(this,"parser",xt(y0,_0))}}function Ru(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Bu(zu,"ForEntityName","SOLID");let v0=[{code:350,name:"historyObjectSoftId",parser:v},{code:100,name:"subclassMarker",parser:v},...ra("data"),{code:70,name:"version",parser:v},{code:100},...Gt];class Fu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Ru(this,"parser",xt(v0))}}Ru(Fu,"ForEntityName","3DSOLID");(De={})[De.NONE=0]="NONE",De[De.CLOSED=1]="CLOSED",De[De.PERIODIC=2]="PERIODIC",De[De.RATIONAL=4]="RATIONAL",De[De.PLANAR=8]="PLANAR",De[De.LINEAR=16]="LINEAR";function Vu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let b0={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},x0=[{code:11,name:"fitPoints",isMultiple:!0,parser:D},{code:10,name:"controlPoints",isMultiple:!0,parser:D},{code:41,name:"weights",isMultiple:!0,parser:v},{code:40,name:"knots",isMultiple:!0,parser:v},{code:13,name:"endTangent",parser:D},{code:12,name:"startTangent",parser:D},{code:44,name:"fitTolerance",parser:v},{code:43,name:"controlTolerance",parser:v},{code:42,name:"knotTolerance",parser:v},{code:74,name:"numberOfFitPoints",parser:v},{code:73,name:"numberOfControlPoints",parser:v},{code:72,name:"numberOfKnots",parser:v},{code:71,name:"degree",parser:v},{code:70,name:"flag",parser:v},{code:210,name:"normal",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class Uu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Vu(this,"parser",xt(x0,b0))}}Vu(Uu,"ForEntityName","SPLINE");class _i{parseEntity(t,e){let s={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:s.subclassMarker=e.value,e=t.next();break;case 2:s.name=e.value,e=t.next();break;case 5:s.handle=e.value,e=t.next();break;case 10:s.startPoint=tn(Rt(t)),e=t.lastReadGroup;break;case 11:s.directionVector=tn(Rt(t)),e=t.lastReadGroup;break;case 90:s.tableValue=e.value,e=t.next();break;case 91:s.rowCount=e.value,e=t.next();break;case 92:s.columnCount=e.value,e=t.next();break;case 93:s.overrideFlag=e.value,e=t.next();break;case 94:s.borderColorOverrideFlag=e.value,e=t.next();break;case 95:s.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:s.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(e.value),e=t.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(e.value),e=t.next();break;case 280:s.version=e.value,e=t.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=e.value,e=t.next();break;case 330:s.ownerDictionaryId=e.value,e=t.next();break;case 342:s.tableStyleId=e.value,e=t.next();break;case 343:s.blockRecordHandle=e.value,e=t.next();break;case 170:s.attachmentPoint=e.value,e=t.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(a,h){let u=!1,m=!1,b={};for(;!a.isEOF()&&h.code!==0&&!m;)switch(h.code){case 171:if(u){m=!0;continue}b.cellType=h.value,u=!0,h=a.next();break;case 172:b.flagValue=h.value,h=a.next();break;case 173:b.mergedValue=h.value,h=a.next();break;case 174:b.autoFit=h.value,h=a.next();break;case 175:b.borderWidth=h.value,h=a.next();break;case 176:b.borderHeight=h.value,h=a.next();break;case 91:b.overrideFlag=h.value,h=a.next();break;case 178:b.virtualEdgeFlag=h.value,h=a.next();break;case 145:b.rotation=h.value,h=a.next();break;case 345:b.fieldObjetId=h.value,h=a.next();break;case 340:b.blockTableRecordId=h.value,h=a.next();break;case 146:b.blockScale=h.value,h=a.next();break;case 177:b.blockAttrNum=h.value,h=a.next();break;case 7:b.textStyle=h.value,h=a.next();break;case 140:b.textHeight=h.value,h=a.next();break;case 170:b.attachmentPoint=h.value,h=a.next();break;case 92:b.extendedCellFlags=h.value,h=a.next();break;case 285:b.rightBorderVisibility=!!(h.value??!0),h=a.next();break;case 286:b.bottomBorderVisibility=!!(h.value??!0),h=a.next();break;case 288:b.leftBorderVisibility=!!(h.value??!0),h=a.next();break;case 289:b.topBorderVisibility=!!(h.value??!0),h=a.next();break;case 301:(function(f,w,x){for(;x.code!==304;)switch(x.code){case 301:case 93:case 90:case 94:x=w.next();break;case 1:f.text=x.value,x=w.next();break;case 300:f.attrText=x.value,x=w.next();break;case 302:f.text=x.value?x.value:f.text,x=w.next();break;default:console.log(`Ignore code: ${x.code}, value: ${x.value}`),x=w.next()}})(b,a,h),h=a.next();break;default:return b}return u=!1,m=!1,b}(t,e)),e=t.lastReadGroup;break;default:lo(s,e,t),e=t.next()}}return s}}function ju(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Sa="ACAD_TABLE",(wa="ForEntityName")in _i?Object.defineProperty(_i,wa,{value:Sa,enumerable:!0,configurable:!0,writable:!0}):_i[wa]=Sa;let w0=[{code:11,name:"xAxisDirection",parser:D},{code:210,name:"extrusionDirection",parser:D},{code:1,name:"text",parser:v},{code:10,name:"position",parser:D},{code:3,name:"styleName",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Gu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){ju(this,"parser",xt(w0))}}ju(Gu,"ForEntityName","TOLERANCE");class yi{parseEntity(t,e){let s={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(a,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:a.layer=u.value;break;case 100:a.subclassMarker=u.value;break;case 10:a.viewportCenter=tn(Rt(h));break;case 40:a.width=u.value;break;case 41:a.height=u.value;break;case 68:a.status=u.value;break;case 69:a.viewportId=u.value;break;case 12:a.displayCenter=Rt(h);break;case 13:a.snapBase=Rt(h);break;case 14:a.snapSpacing=Rt(h);break;case 15:a.gridSpacing=Rt(h);break;case 16:a.viewDirection=tn(Rt(h));break;case 17:a.targetPoint=tn(Rt(h));break;case 42:a.perspectiveLensLength=u.value;break;case 43:a.frontClipZ=u.value;break;case 44:a.backClipZ=u.value;break;case 45:a.viewHeight=u.value;break;case 50:a.snapAngle=u.value;break;case 51:a.viewTwistAngle=u.value;break;case 72:a.circleZoomPercent=u.value;break;case 331:a.frozenLayerIds??(a.frozenLayerIds=[]),a.frozenLayerIds.push(u.value);break;case 90:a.statusBitFlags=u.value;break;case 340:a.clippingBoundaryId=u.value;break;case 1:a.sheetName=u.value;break;case 281:a.renderMode=u.value;break;case 71:a.ucsPerViewport=u.value;break;case 110:a.ucsOrigin=tn(Rt(h));break;case 111:a.ucsXAxis=tn(Rt(h));break;case 112:a.ucsYAxis=tn(Rt(h));break;case 345:a.ucsId=u.value;break;case 346:a.ucsBaseId=u.value;break;case 79:a.orthographicType=u.value;break;case 146:a.elevation=u.value;break;case 170:a.shadePlotMode=u.value;break;case 61:a.majorGridFrequency=u.value;break;case 332:a.backgroundId=u.value;break;case 333:a.shadePlotId=u.value;break;case 348:a.visualStyleId=u.value;break;case 292:a.isDefaultLighting=!!u.value;break;case 282:a.defaultLightingType=u.value;break;case 141:a.brightness=u.value;break;case 142:a.contrast=u.value;break;case 63:case 421:case 431:a.ambientLightColor=u.value;break;case 361:a.sunId=u.value;break;case 335:case 343:case 344:case 91:a.softPointer=u.value}return!0}(s,t,e)&&lo(s,e,t),e=t.next()}return s}}Ia="VIEWPORT",(Pa="ForEntityName")in yi?Object.defineProperty(yi,Pa,{value:Ia,enumerable:!0,configurable:!0,writable:!0}):yi[Pa]=Ia;(Cr={})[Cr.ShowImage=1]="ShowImage",Cr[Cr.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Cr[Cr.UseClippingBoundary=4]="UseClippingBoundary",Cr[Cr.Transparency=8]="Transparency";function Wu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let S0={brightness:50,constrast:50,fade:0},P0=[{code:14,name:"boundary",isMultiple:!0,parser:D},{code:91,name:"numberOfVertices",parser:v},{code:71,name:"boundaryType",parser:v},{code:360,name:"imageDefReactorHardId",parser:v},{code:283,name:"fade",parser:v},{code:282,name:"contrast",parser:v},{code:281,name:"brightness",parser:v},{code:280,name:"isClipping",parser:Ut},{code:70,name:"displayFlag",parser:v},{code:340,name:"imageDefHardId",parser:v},{code:13,name:"imageSize",parser:D},{code:12,name:"vDirection",parser:D},{code:11,name:"uDirection",parser:D},{code:10,name:"position",parser:D},{code:90,name:"classVersion",parser:v},{code:100,name:"subclassMarker",parser:v},...Gt];class Du{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Wu(this,"parser",xt(P0,S0))}}function Hu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Wu(Du,"ForEntityName","WIPEOUT");let I0=[{code:11,name:"direction",parser:D},{code:10,name:"position",parser:D},{code:100,name:"subclassMarker",parser:v},...Gt];class qu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Hu(this,"parser",xt(I0))}}function Xu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Hu(qu,"ForEntityName","XLINE");let A0={},E0=[{code:170,name:"multileaderType",parser:v},{code:291,name:"doglegEnabled",parser:Ut},{code:40,name:"doglegLength",parser:v},{code:172,name:"contentType",parser:v},{code:3,name:"textContent",parser:v},{code:12,name:"textAnchor",parser:D},{code:344,name:"blockHandle",parser:v},{code:15,name:"blockPosition",parser:D},{code:302,name:"leaderSections",parser:function(n,t,e){let s,a={leaderLines:[]};for(;t.hasNext()&&(s=t.next()).code!==303;)switch(s.code){case 10:a.landingPoint=(s.value,Rt(t));break;case 11:a.doglegVector=(s.value,Rt(t));break;case 40:a.doglegLength=s.value;break;case 304:a.leaderLines.push(function(h,u,m){let b,f={vertices:[]};for(;u.hasNext()&&(b=u.next()).code!==305;)b.code===10&&f.vertices.push((b.value,Rt(u)));return f}(0,t))}return a},isMultiple:!0},...Gt];class Yu{parseEntity(t,e){let s={};return this.parser(e,t,s),s}constructor(){Xu(this,"parser",xt(E0,A0))}}Xu(Yu,"ForEntityName","MULTILEADER");let M0=Object.fromEntries([qh,Qh,ru,su,au,gi,lu,uu,gu,_u,vu,xu,fi,Su,tu,Yu,Iu,Mu,ku,Lu,Ou,zu,Fu,Uu,_i,$h,Gu,pu,ho,yi,Du,qu].map(n=>[n.ForEntityName,new n]));function Ku(n,t){let e=[];for(;!It(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){t.rewind();break}let s=M0[n.value];if(s){let a=n.value;n=t.next();let h=s.parseEntity(t,n);h.type=a,Wh(h),e.push(h)}else t.debug&&console.warn(`Unsupported ENTITY type: ${n.value}`)}n=t.next()}return e}function T0(n,t){let e={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");){if(It(n,0,"BLOCK")){let s=k0(n=t.next(),t);Wh(s),s.name&&(e[s.name]=s)}n=t.next()}return e}function k0(n,t){let e={};for(;!It(n,0,"EOF");){if(It(n,0,"ENDBLK")){for(n=t.next();!It(n,0,"EOF");){if(It(n,100,"AcDbBlockEnd"))return e;n=t.next()}break}switch(n.code){case 1:e.xrefPath=n.value;break;case 2:e.name=n.value;break;case 3:e.name2=n.value;break;case 5:e.handle=n.value;break;case 8:e.layer=n.value;break;case 10:e.position=Rt(t);break;case 67:e.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(e.type=n.value);break;case 100:break;case 330:e.ownerHandle=n.value;break;case 0:e.entities=Ku(n,t)}n=t.next()}return e}function N0(n,t){let e=null,s={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");)n.code===9?e=n.value:n.code===10?s[e]=Rt(t):s[e]=n.value,n=t.next();return s}(He={})[He.NOT_APPLICABLE=0]="NOT_APPLICABLE",He[He.KEEP_EXISTING=1]="KEEP_EXISTING",He[He.USE_CLONE=2]="USE_CLONE",He[He.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",He[He.VALUE_NAME=4]="VALUE_NAME",He[He.UNMANGLE_NAME=5]="UNMANGLE_NAME";let uo=[{code:330,name:"ownerObjectId",parser:v},{code:102,parser:Pn},{code:102,parser:Pn},{code:102,parser:Pn},{code:5,name:"handle",parser:v}],L0=[{code:3,name:"entries",parser:(n,t)=>{let e={name:n.value};return(n=t.next()).code===350?e.objectSoftId=n.value:n.code===360?e.objectHardId=n.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:v},{code:280,name:"isHardOwned",parser:Ut},{code:100,name:"subclassMarker",parser:v},...uo],C0=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:v},{code:90,name:"version",parser:v},{code:1,name:"fileName",parser:v},{code:10,name:"size",parser:D},{code:11,name:"sizeOfOnePixel",parser:D},{code:280,name:"isLoaded",parser:v},{code:281,name:"resolutionUnits",parser:v},{code:100,name:"subclassMarker",parser:v}];(vn={})[vn.NOUNIT=0]="NOUNIT",vn[vn.CENTIMETERS=2]="CENTIMETERS",vn[vn.INCH=5]="INCH";(zs={})[zs.PSLTSCALE=1]="PSLTSCALE",zs[zs.LIMCHECK=2]="LIMCHECK";(bn={})[bn.INCHES=0]="INCHES",bn[bn.MILLIMETERS=1]="MILLIMETERS",bn[bn.PIXELS=2]="PIXELS";(qe={})[qe.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",qe[qe.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",qe[qe.DRAWING_LIMITS=2]="DRAWING_LIMITS",qe[qe.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",qe[qe.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",qe[qe.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Or={})[Or.AS_DISPLAYED=0]="AS_DISPLAYED",Or[Or.WIREFRAME=1]="WIREFRAME",Or[Or.HIDDEN=2]="HIDDEN",Or[Or.RENDERED=3]="RENDERED";(Xe={})[Xe.DRAFT=0]="DRAFT",Xe[Xe.PREVIEW=1]="PREVIEW",Xe[Xe.NORMAL=2]="NORMAL",Xe[Xe.PRESENTATION=3]="PRESENTATION",Xe[Xe.MAXIMUM=4]="MAXIMUM",Xe[Xe.CUSTOM=5]="CUSTOM";let $u=[{code:333,name:"shadePlotId",parser:v},{code:149,name:"imageOriginY",parser:v},{code:148,name:"imageOriginX",parser:v},{code:147,name:"scaleFactor",parser:v},{code:78,name:"shadePlotCustomDPI",parser:v},{code:77,name:"shadePlotResolution",parser:v},{code:76,name:"shadePlotMode",parser:v},{code:75,name:"standardScaleType",parser:v},{code:7,name:"currentStyleSheet",parser:v},{code:74,name:"plotType",parser:v},{code:73,name:"plotRotation",parser:v},{code:72,name:"plotPaperUnit",parser:v},{code:70,name:"layoutFlag",parser:v},{code:143,name:"printScaleDenominator",parser:v},{code:142,name:"printScaleNumerator",parser:v},{code:141,name:"windowAreaYMax",parser:v},{code:140,name:"windowAreaXMax",parser:v},{code:49,name:"windowAreaYMin",parser:v},{code:48,name:"windowAreaXMin",parser:v},{code:47,name:"plotOriginY",parser:v},{code:46,name:"plotOriginX",parser:v},{code:45,name:"paperHeight",parser:v},{code:44,name:"paperWidth",parser:v},{code:43,name:"marginTop",parser:v},{code:42,name:"marginRight",parser:v},{code:41,name:"marginBottom",parser:v},{code:40,name:"marginLeft",parser:v},{code:6,name:"plotViewName",parser:v},{code:4,name:"paperSize",parser:v},{code:2,name:"configName",parser:v},{code:1,name:"pageSetupName",parser:v},{code:100,name:"subclassMarker",parser:v},...uo],O0=[{code:346,name:"orthographicUcsId",parser:v},{code:345,name:"namedUcsId",parser:v},{code:331,name:"viewportId",parser:v},{code:330,name:"paperSpaceTableId",parser:v},{code:76,name:"orthographicType",parser:v},{code:17,name:"ucsYAxis",parser:D},{code:16,name:"ucsXAxis",parser:D},{code:13,name:"ucsOrigin",parser:D},{code:146,name:"elevation",parser:v},{code:15,name:"maxExtent",parser:D},{code:14,name:"minExtent",parser:D},{code:12,name:"insertionPoint",parser:D},{code:11,name:"maxLimit",parser:D},{code:10,name:"minLimit",parser:D},{code:71,name:"tabOrder",parser:v},{code:70,name:"controlFlag",parser:v},{code:1,name:"layoutName",parser:v},{code:100,name:"subclassMarker",parser:v},...$u],B0=[{code:40,name:"wcsToOCSTransform",parser:Al},{code:40,name:"ocsToWCSTransform",parser:Al},{code:41,name:"backClippingDistance",parser:v},{code:73,name:"isBackClipping",parser:Ut,pushContext:!0},{code:40,name:"frontClippingDistance",parser:v},{code:72,name:"isFrontClipping",parser:Ut,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:Ut},{code:11,name:"position",parser:D},{code:210,name:"normal",parser:D},{code:10,name:"boundaryVertices",parser:D,isMultiple:!0},{code:70,name:"boundaryCount",parser:v},{code:100,name:"subclassMarker",parser:v},{code:100},...uo];function Al(n,t){let e=[];for(let s=0;s<3&&It(n,40);++s){let a=[];for(let h=0;h<4&&It(n,40);++h)a.push(n.value),n=t.next();e.push(a)}return t.rewind(),e}let z0={LAYOUT:O0,PLOTSETTINGS:$u,DICTIONARY:L0,SPATIAL_FILTER:B0,IMAGEDEF:C0};function R0(n,t){let e=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let s=n.value,a=z0[s];if(n.code===0&&(a!=null&&a.length)){let h=xt(a),u={name:s};h(n=t.next(),t,u)?(e.push(u),n=t.peek()):n=t.next()}else n=t.next()}return{byName:Ed(e,({name:s})=>s)}}let ts=[{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102,parser(n,t){for(;!It(n,0,"EOF")&&!It(n,102,"}");)n=t.next()}},{code:5,name:"handle",parser:v}],F0=xt([{code:310,name:"bmpPreview",parser:v},{code:281,name:"scalability",parser:v},{code:280,name:"explodability",parser:v},{code:70,name:"insertionUnits",parser:v},{code:340,name:"layoutObjects",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),V0=[{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:Pl.Above,defaultValueImperial:Pl.Center},{name:"DIMZIN",code:78,defaultValue:Gn.Trailing,defaultValueImperial:Gn.Feet},{name:"DIMAZIN",code:79,defaultValue:dd.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:pd.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:md.Center},{name:"DIMTZIN",code:284,defaultValue:Gn.Trailing,defaultValueImperial:Gn.Feet},{name:"DIMALTZ",code:285,defaultValue:Gn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Gn.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}],U0=xt([...V0.map(n=>({...n,parser:v})),{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},{code:105,name:"handle",parser:v},...ts.filter(n=>n.code!==5)]),j0=xt([{code:347,name:"materialObjectId",parser:v},{code:390,name:"plotStyleNameObjectId",parser:v},{code:370,name:"lineweight",parser:v},{code:290,name:"isPlotting",parser:Ut},{code:6,name:"lineType",parser:v},{code:62,name:"colorIndex",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]);(Br={})[Br.NONE=0]="NONE",Br[Br.AbsoluteRotation=1]="AbsoluteRotation",Br[Br.TextEmbedded=2]="TextEmbedded",Br[Br.ShapeEmbedded=4]="ShapeEmbedded";let G0=xt([{code:9,name:"text",parser:v},{code:45,name:"offsetY",parser:v},{code:44,name:"offsetX",parser:v},{code:50,name:"rotation",parser:v},{code:46,name:"scale",parser:v},{code:340,name:"styleObjectId",parser:v},{code:75,name:"shapeNumber",parser:v},{code:74,name:"elementTypeFlag",parser:v},{code:49,name:"elementLength",parser:v}],{elementTypeFlag:0,elementLength:0}),W0=xt([{code:49,name:"pattern",parser(n,t){let e={};return G0(n,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:v},{code:73,name:"numberOfLineTypes",parser:v},{code:72,parser:v},{code:3,name:"description",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),D0=xt([{code:1e3,name:"extendedFont",parser:v},{code:1001},{code:4,name:"bigFont",parser:v},{code:3,name:"font",parser:v},{code:42,name:"lastHeight",parser:v},{code:71,name:"textGenerationFlag",parser:v},{code:50,name:"obliqueAngle",parser:v},{code:41,name:"widthFactor",parser:v},{code:40,name:"fixedTextHeight",parser:v},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),H0=xt([{code:[63,421,431],name:"ambientColor",parser:v},{code:142,name:"contrast",parser:v},{code:141,name:"brightness",parser:v},{code:282,name:"defaultLightingType",parser:v},{code:292,name:"isDefaultLightingOn",parser:Ut},{code:348,name:"visualStyleObjectId",parser:v},{code:333,name:"shadePlotObjectId",parser:v},{code:332,name:"backgroundObjectId",parser:v},{code:61,name:"majorGridLines",parser:v},{code:170,name:"shadePlotSetting",parser:v},{code:146,name:"elevation",parser:v},{code:79,name:"orthographicType",parser:v},{code:112,name:"ucsYAxis",parser:D},{code:111,name:"ucsXAxis",parser:D},{code:110,name:"ucsOrigin",parser:D},{code:74,name:"ucsIconSetting",parser:v},{code:71,name:"viewMode",parser:v},{code:281,name:"renderMode",parser:v},{code:1,name:"styleSheet",parser:v},{code:[331,441],name:"frozenLayers",parser:v,isMultiple:!0},{code:72,name:"circleSides",parser:v},{code:51,name:"viewTwistAngle",parser:v},{code:50,name:"snapRotationAngle",parser:v},{code:45,name:"viewHeight",parser:v},{code:44,name:"backClippingPlane",parser:v},{code:43,name:"frontClippingPlane",parser:v},{code:42,name:"lensLength",parser:v},{code:17,name:"viewTarget",parser:D},{code:16,name:"viewDirectionFromTarget",parser:D},{code:15,name:"gridSpacing",parser:D},{code:14,name:"snapSpacing",parser:D},{code:13,name:"snapBasePoint",parser:D},{code:12,name:"center",parser:D},{code:11,name:"upperRightCorner",parser:D},{code:10,name:"lowerLeftCorner",parser:D},{code:70,name:"standardFlag",parser:v},{code:2,name:"name",parser:v},{code:100,name:"subclassMarker",parser:v},...ts]),q0={BLOCK_RECORD:F0,DIMSTYLE:U0,LAYER:j0,LTYPE:W0,STYLE:D0,VPORT:H0},X0=xt([{code:70,name:"maxNumberOfEntries",parser:v},{code:100,name:"subclassMarker",parser:v},{code:330,name:"ownerObjectId",parser:v},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:v},{code:2,name:"name",parser:v}]);function Y0(n,t){var s;let e={};for(;!It(n,0,"EOF")&&!It(n,0,"ENDSEC");){if(It(n,0,"TABLE")){n=t.next();let a={entries:[]};X0(n,t,a),e[a.name]=a}if(It(n,0)&&!It(n,0,"ENDTAB")){let a=n.value;n=t.next();let h=q0[a];if(!h){t.debug&&console.warn(`parseTable: Invalid table name '${a}'`),n=t.next();continue}let u={};h(n,t,u),(s=e[a])==null||s.entries.push(u)}n=t.next()}return e}function Rs(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class El{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 t=parseInt(this._data[this._pointer++],10),e=Ml(t,this._data[this._pointer++],this.debug),s={code:t,value:e};return It(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 t={code:parseInt(this._data[this._pointer]),value:0};return t.value=Ml(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){Rs(this,"_data",void 0),Rs(this,"debug",void 0),Rs(this,"_pointer",void 0),Rs(this,"_eof",void 0),Rs(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Ml(n,t,e=!1){return n<=9?t:n>=10&&n<=59?parseFloat(t.trim()):n>=60&&n<=99?parseInt(t.trim()):n>=100&&n<=109?t:n>=110&&n<=149?parseFloat(t.trim()):n>=160&&n<=179?parseInt(t.trim()):n>=210&&n<=239?parseFloat(t.trim()):n>=270&&n<=289?parseInt(t.trim()):n>=290&&n<=299?function(s){if(s==="0")return!1;if(s==="1")return!0;throw TypeError("String '"+s+"' cannot be cast to Boolean type")}(t.trim()):n>=300&&n<=369?t:n>=370&&n<=389?parseInt(t.trim()):n>=390&&n<=399?t:n>=400&&n<=409?parseInt(t.trim()):n>=410&&n<=419?t:n>=420&&n<=429?parseInt(t.trim()):n>=430&&n<=439?t:n>=440&&n<=459?parseInt(t.trim()):n>=460&&n<=469?parseFloat(t.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?t:n>=1010&&n<=1059?parseFloat(t.trim()):n>=1060&&n<=1071?parseInt(t.trim()):(e&&console.warn("WARNING: Group code does not have a defined type: %j",{code:n,value:t}),t)}function Ba(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class K0{constructor(){Ba(this,"encoding","utf-8"),Ba(this,"encodingFailureFatal",!1)}}class $0 extends EventTarget{parseSync(t,e=!1){let s=new El(t.split(/\r\n|\r|\n/g),e);if(!s.hasNext())throw Error("Empty file");return this.parseAll(s)}parseStream(t){let e="",s=this;return new Promise((a,h)=>{t.on("data",u=>{e+=u}),t.on("end",()=>{try{let u=e.split(/\r\n|\r|\n/g),m=new El(u);if(!m.hasNext())throw Error("Empty file");a(s.parseAll(m))}catch(u){h(u)}}),t.on("error",u=>{h(u)})})}async parseFromUrl(t,e){let s=await fetch(t,e);if(!s.body)return null;let a=s.body.getReader(),h="";for(;;){let{done:u,value:m}=await a.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(m,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=t.next();for(;!It(s,0,"EOF");)It(s,0,"SECTION")&&(It(s=t.next(),2,"HEADER")?(s=t.next(),e.header=N0(s,t)):It(s,2,"BLOCKS")?(s=t.next(),e.blocks=T0(s,t)):It(s,2,"ENTITIES")?(s=t.next(),e.entities=Ku(s,t)):It(s,2,"TABLES")?(s=t.next(),e.tables=Y0(s,t)):It(s,2,"OBJECTS")&&(s=t.next(),e.objects=R0(s,t))),s=t.next();return e}constructor(t=new K0){super(),Ba(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}const Tl=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class Dn{constructor(t){if(typeof t=="string"){const e=Tl.find(s=>s.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=Tl.find(s=>s.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Z0{parse(t){const e=new $0,s=this.getDxfInfoFromBuffer(t);let a="";return s.version&&s.version.value<=23&&s.encoding?a=new TextDecoder(s.encoding).decode(t):a=new TextDecoder().decode(t),e.parseSync(a)}getDxfInfoFromBuffer(t){var f,w,x;const s=new TextDecoder("utf-8");let a=0,h="",u=null,m=null,b=!1;for(;a<t.byteLength;){const A=Math.min(a+65536,t.byteLength),M=t.slice(a,A);a=A;const O=(h+s.decode(M,{stream:!0})).split(/\r?\n/);h=O.pop()??"";for(let V=0;V<O.length;V++){const F=O[V].trim();if(F==="SECTION"&&((f=O[V+2])==null?void 0:f.trim())==="HEADER")b=!0;else if(F==="ENDSEC"&&b)return{version:u,encoding:m};if(b&&F==="$ACADVER"){const at=(w=O[V+2])==null?void 0:w.trim();at&&(u=new Dn(at))}else if(b&&F==="$DWGCODEPAGE"){const at=(x=O[V+2])==null?void 0:x.trim();if(at){const ft=ja[at];m=jl(ft)}}if(u&&m)return{version:u,encoding:m}}}return{version:u,encoding:m}}}class kl{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new Mi;return t.vertices.forEach((s,a)=>e.setVertexAt(a,s)),e}convertArc(t){return new Si(t.center,t.radius,Pt.degToRad(t.startAngle),Pt.degToRad(t.endAngle),t.extrusionDirection??Y.Z_AXIS)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&le.Invisible)!==0,e.isConst=(t.attributeFlag&le.Const)!==0,e.isVerifiable=(t.attributeFlag&le.Verifiable)!==0,e.isPreset=(t.attributeFlag&le.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&_r.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&_r.ConstMultiLine)!==0}convertAttribute(t){const e=new Ii;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new Pi;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){return new Ai(t.center,t.radius,t.extrusionDirection??Y.Z_AXIS)}convertEllipse(t){const e=new Y(t.majorAxisEndPoint),s=e.length();return new Ei(t.center,t.extrusionDirection??Y.Z_AXIS,e,s,s*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,s=t.endPoint;return new $s(new W(e.x,e.y,e.z||0),new W(s.x,s.y,s.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new Qs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new Qs(e,"Uniform",t.degree,!!(t.flag&1))}}catch(e){console.log(`Failed to convert spline with error: ${e}`)}return null}convertPoint(t){const e=new Ci;return e.position=t.position,e}convertSolid(t){const e=new Ni;return t.points.forEach((s,a)=>e.setPointAt(a,s)),e.thickness=t.thickness,e}convertPolyline(t){const e=!!(t.flag&1),s=!!(t.flag&8),a=[],h=[];if(t.vertices.map(u=>{u.flag&l0.SPLINE_CONTROL_POINT||(a.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0))}),s){let u=Ds.SimplePoly;return t.flag&4&&(t.smoothType==ci.CUBIC?u=Ds.CubicSplinePoly:t.smoothType==ci.QUADRATIC&&(u=Ds.QuadSplinePoly)),new wi(u,a,e)}else{let u=Wn.SimplePoly;return t.flag&2?u=Wn.FitCurvePoly:t.flag&4&&(t.smoothType==ci.CUBIC?u=Wn.CubicSplinePoly:t.smoothType==ci.QUADRATIC&&(u=Wn.QuadSplinePoly)),new xi(u,a,0,e,t.startWidth,t.endWidth,h)}}convertLWPolyline(t){const e=new Li;return e.closed=!!(t.flag&1),t.vertices.forEach((s,a)=>{e.addVertexAt(a,new kt(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),e}convertHatch(t){var a;const e=new Ks;return(a=t.definitionLines)==null||a.forEach(h=>{e.definitionLines.push({angle:h.angle,base:h.base,offset:h.offset,dashLengths:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.isSolidFill=t.solidFill==gd.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const m=h,b=new An;b.closed=m.isClosed,m.vertices.forEach((f,w)=>{b.addVertexAt(w,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(b)}else{const m=h,b=new Ja;m.edges.forEach(f=>{if(f.type==1){const w=f;b.add(new Ws(w.start,w.end))}else if(f.type==2){const w=f;b.add(new qn(w.center,w.radius,Pt.degToRad(w.startAngle||0),Pt.degToRad(w.endAngle||0),!w.isCCW))}else if(f.type==3){const w=f;new Jt().subVectors(w.end,w.center);const A=Math.sqrt(Math.pow(w.end.x,2)+Math.pow(w.end.y,2)),M=A*w.lengthOfMinorAxis;let L=Pt.degToRad(w.startAngle||0),O=Pt.degToRad(w.endAngle||0);const V=Math.atan2(w.end.y,w.end.x);w.isCCW||(L=Math.PI*2-L,O=Math.PI*2-O),b.add(new Ji({...w.center,z:0},A,M,L,O,!w.isCCW,V))}else if(f.type==4){const w=f;if(w.numberOfControlPoints>0&&w.numberOfKnots>0){const x=w.controlPoints.map(L=>({x:L.x,y:L.y,z:0}));let A=!0;const M=w.controlPoints.map(L=>(L.weight==null&&(A=!1),L.weight||1));b.add(new rn(x,w.knots,A?M:void 0))}else if(w.numberOfFitData>0){const x=w.fitDatum.map(A=>({x:A.x,y:A.y,z:0}));b.add(new rn(x,"Uniform"))}}}),e.add(b)}}),e}convertTable(t){const e=new ki(t.name,t.rowCount,t.columnCount);return e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),t.columnWidthArr.forEach((s,a)=>e.setColumnWidth(a,s)),t.rowHeightArr.forEach((s,a)=>e.setRowHeight(a,s)),t.cells.forEach((s,a)=>{e.setCell(a,s)}),e}convertText(t){const e=new Yn;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=Pt.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Zs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=Pt.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new Y(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new Ti;return t.vertices.forEach(s=>{e.appendVertex(s)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,s=new Vi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(s.dimBlockPosition={...e.insertionPoint,z:0}),s.rotation=Pt.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,s=new Fi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,s=new ji(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,s=new Gi(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,s=new Ui(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,s),s}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(s=>{e.clipBoundary.push(new kt(s))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new Js;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(s=>{e.clipBoundary.push(new kt(s))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new zi;return this.processWipeout(t,e),e}convertViewport(t){const e=new Bi;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Oi;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new Ri;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Kn(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?Pt.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=$i.deserialize(t.transparency))}numberArrayToPointArray(t,e){const s=t.length;let a=0;if(s/2==e?a=2:s/3==e&&(a=3),a==0)return;const h=[];for(let u=0,m=s/a;u<m;++u)h.push({x:t[u*a],y:t[u*a+1],z:a==3?t[u*a+2]:0});return h}}class sn extends jr{constructor(t,e){t=t||{},Zn(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}}const en=class en extends sn{static isModelSapceName(t){return t.toLowerCase()==en.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(en.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new W,this._layoutId="",this._entities=new Map}get isModelSapce(){return en.isModelSapceName(this.name)}get isPaperSapce(){return en.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}appendEntity(t){if(Array.isArray(t))for(let e=0;e<t.length;++e){const s=t[e];s.database=this.database,s.ownerId=this.objectId,s.resolveEffectiveProperties(),this._entities.set(s.objectId,s)}else t.database=this.database,t.ownerId=this.objectId,t.resolveEffectiveProperties(),this._entities.set(t.objectId,t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],s=[];return e.forEach(a=>{const h=this._entities.get(a);h&&s.push(h),this._entities.delete(a)}),s.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:s}),s.length>0}newIterator(){return new ri(this._entities)}getIdAt(t){return this._entities.get(t)}};en.MODEL_SPACE_NAME="*MODEL_SPACE",en.PAPER_SPACE_NAME_PREFIX="*PAPER_SPACE";let he=en;class Q0{convertLayout(t,e){var a,h;const s=new ea;if(s.layoutName=t.layoutName,s.tabOrder=t.tabOrder,t.layoutName==="Model"){const u=he.MODEL_SPACE_NAME;(a=e.tables.BLOCK_RECORD)==null||a.entries.some(m=>m.name.toUpperCase()===u?(s.blockTableRecordId=m.handle,!0):!1)}else(h=e.tables.BLOCK_RECORD)==null||h.entries.some(u=>u.layoutObjects===t.handle?(s.blockTableRecordId=u.handle,!0):!1),s.blockTableRecordId||(s.blockTableRecordId=t.paperSpaceTableId);return s.limits.min.copy(t.minLimit),s.limits.max.copy(t.maxLimit),s.extents.min.copy(t.minExtent),s.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,s),s}convertImageDef(t){const e=new Rh;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Zu{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const s=Date.now(),a=this.generateTaskId();try{return await this.executeInWorker(a,t,e||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(t,e,s){const a=Date.now();return new Promise((h,u)=>{const m=this.getAvailableWorker(s),b=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(m),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:x=>{clearTimeout(b),this.releaseWorker(m),h(x)},reject:x=>{clearTimeout(b),this.releaseWorker(m),u(x)},timeout:b});const f=x=>{const{id:A,success:M,data:L,error:O}=x.data;if(A!==t)return;this.cleanupTask(t);const V=Date.now()-a;h(M?{success:!0,data:L,duration:V}:{success:!1,error:O,duration:V})},w=x=>{this.cleanupTask(t),u(new Error(`Worker error: ${x.message}`))};m.addEventListener("message",f),m.addEventListener("error",w),m.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[s,a]of this.workers)if(!a.isBusy)return a.isBusy=!0,a.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const s=new Worker(t,{type:"module"}),a=this.generateWorkerId(),h={worker:s,isBusy:!0,id:a,createdAt:new Date};return this.workers.set(a,h),s}const e=Array.from(this.workers.values()).sort((s,a)=>s.createdAt.getTime()-a.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,s]of this.workers)if(s.worker===t){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(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Qu{constructor(t){this.framework=new Zu(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Ju(n){return new Qu(n)}class J0{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:s}=t.data;try{const a=await this.executeTask(s);this.sendResponse(e,!0,a)}catch(a){this.sendResponse(e,!1,void 0,a instanceof Error?a.message:String(a))}}}sendResponse(t,e,s,a){const h={id:t,success:e,data:s,error:a};self.postMessage(h)}}class tc extends ao{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t){if(this.config.useWorker&&this.config.parserWorkerUrl){const e=Ju({workerUrl:this.config.parserWorkerUrl,maxConcurrentWorkers:1}),s=await e.execute(t);if(e.destroy(),s.success)return{model:s.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${s.error}'`)}else return{model:new Z0().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var h;const e=new Map,s=u=>{if(u){const m=u.lastIndexOf(".");return m>=0?u.substring(0,m).toLowerCase():u.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(u=>{const m=[];if(u.font){const b=s(u.font);b&&m.push(b)}if(u.bigFont){const b=s(u.bigFont);b&&m.push(b)}if(u.extendedFont){const b=s(u.extendedFont);b&&m.push(b)}e.set(u.name,m)});const a=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,a),Array.from(a)}getFontsInBlock(t,e,s,a){const h=/\\f(.*?)\|/g;t.forEach(u=>{if(u.type=="MTEXT"){const m=u;[...m.text.matchAll(h)].forEach(w=>{a.add(w[1].toLowerCase())});const f=s.get(m.styleName);f==null||f.forEach(w=>a.add(w))}else if(u.type=="TEXT"){const m=u,b=s.get(m.styleName);b==null||b.forEach(f=>a.add(f))}else if(u.type=="INSERT"){const b=e[u.name];b&&b.entities&&this.getFontsInBlock(b.entities,e,s,a)}})}async processEntities(t,e,s,a,h){const u=new kl;let m=t.entities;const b=m.length,f=new Va(b,100-a.value,s);this.config.convertByEntityType&&(m=this.groupAndFlattenByType(m));const w=new Map;for(let A=0;A<b;A++){const M=m[A];if(M.type==="ATTRIB"){const L=u.convert(M);if(L&&L.ownerId&&L.ownerId!=="0"){let O=w.get(L==null?void 0:L.ownerId);O==null&&(O=[],w.set(L.ownerId,O)),O.push(L)}}}const x=e.tables.blockTable.modelSpace;await f.processChunk(async(A,M)=>{let L=[],O=A<M?m[A].type:"";for(let F=A;F<M;F++){const at=m[F];if(at.type!=="ATTRIB"){const ft=u.convert(at);if(ft){if(this.config.convertByEntityType&&at.type!==O&&(x.appendEntity(L),L=[],O=at.type),at.type==="INSERT"){const st=w.get(ft.objectId);st&&st.length>0&&st.forEach(H=>{ft.appendAttributes(H)})}L.push(ft)}}}x.appendEntity(L);let V=a.value+M/b*(100-a.value);V>100&&(V=100),h&&await h(V,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,s=!1){const a=new kl,h=t.length,u=[],m=e.objectId,b=[];for(let f=0;f<h;f++){const w=t[f],x=a.convert(w);x&&(w.type==="ATTRIB"?b.push(x):(!s||w.ownerBlockRecordSoftId===m)&&u.push(x))}b.forEach(f=>{const w=e.getIdAt(f.ownerId);w&&w.appendAttributes(f)}),e.appendEntity(u)}processBlocks(t,e){const s=t.blocks;for(const[a,h]of Object.entries(s)){let u=e.tables.blockTable.getAt(h.name);u||(u=new he,u.objectId=h.handle,u.name=a,u.origin.copy(h.position),e.tables.blockTable.add(u)),h.entities?this.processEntitiesInBlock(h.entities,u):u.isPaperSapce&&this.processEntitiesInBlock(t.entities,u,!0)}}processHeader(t,e){const s=t.header;s.$ACADVER&&(e.version=s.$ACADVER),e.cecolor.colorIndex=s.$CECOLOR||256,e.angBase=s.$ANGBASE||0,e.angDir=s.$ANGDIR||0,s.$AUNITS!=null&&(e.aunits=s.$AUNITS),e.celtscale=s.$CELTSCALE||1,e.ltscale=s.$LTSCALE||1,s.$EXTMAX&&(e.extmax=s.$EXTMAX),s.$EXTMIN&&(e.extmin=s.$EXTMIN),s.$INSUNITS!=null&&(e.insunits=s.$INSUNITS),e.pdmode=s.$PDMODE||0,e.pdsize=s.$PDSIZE||0}processBlockTables(t,e){var a;const s=(a=t.tables.BLOCK_RECORD)==null?void 0:a.entries;s&&s.length>0&&(e.tables.blockTable.removeAll(),s.forEach(h=>{const u=new he;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,e.tables.blockTable.add(u)}))}processObjects(t,e){const s=t.objects.byName,a=new Q0;if("LAYOUT"in s){const h=e.objects.layout;s.LAYOUT.forEach(u=>{const m=a.convertLayout(u,t);h.setAt(m.layoutName,m)})}if("IMAGEDEF"in s){const h=e.objects.imageDefinition;s.IMAGEDEF.forEach(u=>{const m=a.convertImageDef(u);h.setAt(m.objectId,m)})}}processViewports(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.VPORT)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new gc;this.processCommonTableEntryAttrs(u,m),u.circleSides&&(m.circleSides=u.circleSides),m.standardFlag=u.standardFlag,m.center.copy(u.center),m.lowerLeftCorner.copy(u.lowerLeftCorner),m.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&m.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(m.snapAngle=u.snapRotationAngle),u.snapSpacing&&m.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(m.gridMajor=u.majorGridLines),u.gridSpacing&&m.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(m.backgroundObjectId=u.backgroundObjectId),m.gsView.center.copy(u.center),m.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),m.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(m.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(m.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(m.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(m.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(m.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(m.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(m.gsView.styleSheet=u.styleSheet),u.renderMode&&(m.gsView.renderMode=u.renderMode),u.viewMode&&(m.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(m.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&m.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&m.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&m.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(m.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(m.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(m.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(m.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(m.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(m.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(m.gsView.brightness=u.brightness),u.contrast&&(m.gsView.contrast=u.contrast),u.ambientColor&&(m.gsView.ambientColor=u.ambientColor),e.tables.viewportTable.add(m)})}processLayers(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.LAYER)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new fe;m.colorIndex=u.colorIndex;const b=new na({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:m,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,b),e.tables.layerTable.add(b)})}processLineTypes(t,e){var a,h;const s=(h=(a=t.tables)==null?void 0:a.LTYPE)==null?void 0:h.entries;s&&s.length>0&&s.forEach(u=>{const m=new Ys(u);this.processCommonTableEntryAttrs(u,m),m.name=u.name,e.tables.linetypeTable.add(m)})}processTextStyles(t,e){var a;const s=(a=t.tables.STYLE)==null?void 0:a.entries;s&&s.length>0&&s.forEach(h=>{const u=new co(h);this.processCommonTableEntryAttrs(h,u),e.tables.textStyleTable.add(u)})}processDimStyles(t,e){var a;const s=(a=t.tables.DIMSTYLE)==null?void 0:a.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},m=new $n(u);this.processCommonTableEntryAttrs(h,m),e.tables.dimStyleTable.add(m)})}processCommonTableEntryAttrs(t,e){e.name=t.name,t.handle!=null&&(e.objectId=t.handle),e.ownerId=t.ownerObjectId}groupAndFlattenByType(t){const e={},s=[];for(const a of t)e[a.type]||(e[a.type]=[],s.push(a.type)),e[a.type].push(a);return s.flatMap(a=>e[a])}}class ec extends ao{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,s,a,h){let u=t.tables.blockTable.modelSpace.newIterator().toArray();const m=u.length,b=new Va(m,100-a.value,s);this.config.convertByEntityType&&(u=this.groupAndFlattenByType(u));const f=e.tables.blockTable.modelSpace;await b.processChunk(async(w,x)=>{let A=[],M=w<x?u[w].type:"";for(let L=w;L<x;L++){const O=u[L];this.config.convertByEntityType&&O.type!==M&&(this.triggerEvents(f,A),A=[],M=O.type),A.push(O)}if(this.triggerEvents(f,A),h){let L=a.value+x/m*(100-a.value);L>100&&(L=100),await h(L,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const s=e.newIterator().toArray();this.triggerEvents(e,s)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const s of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const s of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:s,key:s.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},s=[];for(const a of t)e[a.type]||(e[a.type]=[],s.push(a.type)),e[a.type].push(a);return s.flatMap(a=>e[a])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}var Xs=(n=>(n.DXF="dxf",n.DWG="dwg",n))(Xs||{});class fr{constructor(){this.events={registered:new oe,unregistered:new oe},this._converters=new Map,this.register("dxf",new tc)}static createInstance(){return fr._instance==null&&(fr._instance=new fr),this._instance}static get instance(){return fr._instance||(fr._instance=new fr),fr._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}class an extends jr{constructor(t){super(),this.database=t,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database;const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),s=this._recordsByName.get(e);return s?(this._recordsById.delete(s.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new ri(this._recordsByName)}normalizeName(t){return t}}class rc extends an{constructor(t){super(t)}get modelSpace(){let t=this.getAt(he.MODEL_SPACE_NAME);return t||(t=new he,t.name=he.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const s=e.getIdAt(t);if(s)return s}}removeEntity(t){let e=!1;for(const s of this.database.tables.blockTable.newIterator())if(s.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(he.isModelSapceName(t))e=he.MODEL_SPACE_NAME;else if(he.isPaperSapceName(t)){const s=he.PAPER_SPACE_NAME_PREFIX,a=t.substring(s.length);e=s+a}return e}}class nc extends an{constructor(t){super(t)}}class na extends sn{constructor(t,e){t=t||{},Zn(t,{color:new fe,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new $i,linetype:"",lineWeight:1,materialId:-1}),super(t,e),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(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}}class sc extends an{constructor(t){super(t);const e=new fe,s=new na({name:"0",standardFlags:0,linetype:vi,lineWeight:nn.ByLineWeightDefault,isOff:!1,color:e,isPlottable:!0});this.add(s)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class ic extends an{constructor(t){super(t)}}class ac extends an{constructor(t){super(t)}get fonts(){const t=new Set,e=a=>{if(a){const h=a.lastIndexOf(".");if(h>=0){const u=a.substring(0,h).toLowerCase();t.add(u)}else t.add(a.toLowerCase())}},s=this.newIterator();for(const a of s)e(a.fileName),e(a.bigFontFileName);return Array.from(t)}}class oc extends an{constructor(t){super(t)}}class lc extends an{constructor(t){super(t)}}class hc extends sn{constructor(t){super(),this.name=t}}const qi=class qi{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new oe},this.registerVar({name:"CECOLOR",type:"color",isDbVar:!0,defaultValue:new fe(ct.ByLayer)}),this.registerVar({name:"CELTSCALE",type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:"CELWEIGHT",type:"number",isDbVar:!0,defaultValue:nn.ByLayer}),this.registerVar({name:"CLAYER",type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:"LWDISPLAY",type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:"PICKBOX",type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:"WHITEBKCOLOR",type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new qi),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const s=this.getDescriptor(t);if(s){if(s.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}}setVar(t,e,s){t=this.normalizeName(t);const a=this.getDescriptor(t);if(a){const h=this.getVar(t,s);if(a.type!=="string"&&(typeof e=="string"||e instanceof String)){if(a.type==="number"){const u=Number(e);if(Number.isNaN(u))throw new Error("Invalid number input!");e=u}else if(a.type==="boolean")e=this.parseBoolean(e);else if(a.type==="color"){const u=fe.fromString(e);if(u==null)throw new Error("Invalid color value!");e=u}}a.isDbVar?s[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(h,e)&&this.events.sysVarChanged.dispatch({database:s,name:t,newVal:e,oldVal:h}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),s=new Set(["true","t","1","yes","y"]),a=new Set(["false","f","0","no","n"]);return s.has(e)?!0:(a.has(e),!1)}hasValueChanged(t,e){return t instanceof fe&&e instanceof fe?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};qi._instance=null;let Di=qi;const Xi=class Xi extends jr{constructor(){super(),this.events={dictObjetSet:new oe,dictObjectErased:new oe,entityAppended:new oe,entityModified:new oe,entityErased:new oe,layerAppended:new oe,layerModified:new oe,layerErased:new oe,openProgress:new oe},this._version=new Dn("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Ua.DecimalDegrees,this._celtscale=1,this._cecolor=new fe,this._celweight=nn.ByLayer,this._clayer="0",this._extents=new Nt,this._insunits=io.Millimeters,this._ltscale=1,this._lwdisplay=!0,this._pdmode=0,this._pdsize=0,this._tables={appIdTable:new lc(this),blockTable:new rc(this),dimStyleTable:new nc(this),linetypeTable:new ic(this),textStyleTable:new ac(this),layerTable:new sc(this),viewportTable:new oc(this)},this._objects={dictionary:new qs(this),imageDefinition:new qs(this),layout:new zh(this),xrecord:new qs(this)},this._tables.appIdTable.add(new hc(Xi.MLIGHTCAD_APPID))}get tables(){return this._tables}get objects(){return this._objects}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar("aunits",this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar("version",this._version,new Dn(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar("insunits",this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar("ltscale",this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar("lwdisplay",this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar("cecolor",this._cecolor,t||0,e=>{this._cecolor=e})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar("celtscale",this._celtscale,t??1,e=>{this._celtscale=e})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar("celweight",this._celweight,t??nn.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar("clayer",this._clayer,t??"0",e=>{this._clayer=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar("angbase",this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar("angdir",this._angDir,t??0,e=>{this._angDir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent("extmax",e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent("extmin",e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar("pdmode",this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar("pdsize",this._pdsize,t??0,e=>{this._pdsize=e})}async read(t,e,s=Xs.DXF){const a=fr.instance.get(s);if(a==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await a.read(t,this,e&&e.minimumChunkSize||10,async(h,u,m,b)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,subStageStatus:m,data:b}),e&&e.fontLoader&&u=="FONT"&&m=="END"){const f=b||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}})}async openUri(t,e){var M;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const s=await fetch(t);if(!s.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${s.status}'!`);const a=s.headers.get("content-length"),h=a?parseInt(a,10):null;let u=0;const m=(M=s.body)==null?void 0:M.getReader();if(!m)throw new Error("Failed to get response reader");const b=[];for(;;){const{done:L,value:O}=await m.read();if(L)break;if(b.push(O),u+=O.length,h!==null){const V=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:V,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let w=0;for(const L of b)f.set(L,w),w+=L.length;const A=this.getFileNameFromUri(t).toLowerCase().split(".").pop();A==="dwg"?await this.read(f.buffer,e,Xs.DWG):A==="dxf"?await this.read(f.buffer,e,Xs.DXF):await this.read(f.buffer,e,A),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}async regen(){await new ec(this).read(null,this,500,async(e,s,a,h)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:s,subStageStatus:a,data:h})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new Vh(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}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._objects.layout.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,s,a){this.hasSysVarValueChanged(e,s)&&(a(s),this.triggerSysVarChangedEvent(t,e,s))}hasSysVarValueChanged(t,e){return t instanceof fe&&e instanceof fe?!t.equals(e):t instanceof Dn&&e instanceof Dn?t.value!==e.value:!Object.is(t,e)}triggerSysVarChangedEvent(t,e,s){const a=Di.instance(),h=t.toLowerCase();a.getDescriptor(h)!=null&&a.events.sysVarChanged.dispatch({database:this,name:h,oldVal:e,newVal:s})}getFileNameFromUri(t){try{const s=new URL(t).pathname.split("/");return s[s.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}};Xi.MLIGHTCAD_APPID="mlightcad";let za=Xi;var uc=(n=>(n[n.Center=0]="Center",n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.OverFirst=3]="OverFirst",n[n.OverSecond=4]="OverSecond",n))(uc||{}),cc=(n=>(n[n.Center=0]="Center",n[n.Above=1]="Above",n[n.Outside=2]="Outside",n[n.JIS=3]="JIS",n[n.Below=4]="Below",n))(cc||{}),dc=(n=>(n[n.Feet=0]="Feet",n[n.None=1]="None",n[n.Inch=2]="Inch",n[n.FeetAndInch=3]="FeetAndInch",n[n.Leading=4]="Leading",n[n.Trailing=8]="Trailing",n[n.LeadingAndTrailing=12]="LeadingAndTrailing",n))(dc||{}),pc=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(pc||{}),mc=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(mc||{});const Yi=class Yi extends sn{constructor(t,e){t=t||{},Zn(t,Yi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}};Yi.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 $n=Yi;class Ys extends sn{constructor(t){super(),this.name=t.name,this._linetype=t}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(t){if(t<0||t>=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[t].elementLength}}class co extends sn{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const s=e.lastIndexOf(".");return s===-1?e:e.substring(0,s)}return t}}const tp={center:new kt,viewDirectionFromTarget:new W(0,0,1),viewTarget:new W(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:eo.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new W(0,0,0),ucsXAxis:new W(1,0,0),ucsYAxis:new W(0,1,0),orthographicType:ro.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:no.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class gc extends sn{constructor(){super(),this._circleSides=100,this._center=new kt,this._lowerLeftCorner=new kt(0,0),this._upperRightCorner=new kt(1,1),this._snapBase=new kt(0,0),this._snapAngle=0,this._snapSpacing=new kt(0,0),this._standardFlag=0,this._gridSpacing=new kt,this._gridMajor=10,this._gsView=tp}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get gsView(){return this._gsView}}class fc{constructor(){this.events={layoutCreated:new oe,layoutRemoved:new oe,layoutRenamed:new oe,layoutSwitched:new oe}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(a,s)}setCurrentLayoutBtrId(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(a,s)}setCurrentLayout(t,e){const s=this.getWorkingDatabase(e),a=s.objects.layout.getAt(t);return this.setCurrentLayoutInternal(a,s)}renameLayout(t,e,s){const h=this.getWorkingDatabase(s).objects.layout.getAt(t);return h?(h.layoutName=e,this.events.layoutRenamed.dispatch({layout:h,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const s=this.getWorkingDatabase(e).objects.layout,a=s.getAt(t);let h=!1;return a&&(h=s.remove(t),h&&this.events.layoutRemoved.dispatch({layout:a})),h}createLayout(t,e){const s=this.getWorkingDatabase(e),a=new ea;a.layoutName=t,a.tabOrder=s.objects.layout.maxTabOrder;const h=new he;return h.name=`*Paper_Space${a.tabOrder}`,s.tables.blockTable.add(h),s.objects.layout.setAt(t,a),this.events.layoutCreated.dispatch({layout:a}),{layout:a,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||po().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}function po(){return Hi.instance}const Ki=class Ki{constructor(){this._workingDatabase=null,this._layoutManager=new fc}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){return this._layoutManager}};Ki.instance=new Ki;let Hi=Ki;var _c=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(_c||{});class mo{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new mo(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}exports.AcCmColor=fe;exports.AcCmColorMethod=ct;exports.AcCmColorUtil=Jr;exports.AcCmEntityColor=Bc;exports.AcCmErrors=Ke;exports.AcCmEventDispatcher=zc;exports.AcCmEventManager=oe;exports.AcCmLoader=Dc;exports.AcCmLoadingManager=Vl;exports.AcCmObject=Bl;exports.AcCmPerformanceCollector=Fa;exports.AcCmTask=Rl;exports.AcCmTaskScheduler=Fl;exports.AcCmTransparency=$i;exports.AcCmTransparencyMethod=Te;exports.AcDb2dPolyline=xi;exports.AcDb2dVertex=La;exports.AcDb2dVertexType=Eh;exports.AcDb3PointAngularDimension=Fi;exports.AcDb3dPolyline=wi;exports.AcDb3dVertex=Ca;exports.AcDb3dVertexType=Mh;exports.AcDbAlignedDimension=Vi;exports.AcDbAngleUnits=Ua;exports.AcDbArc=Si;exports.AcDbArcDimension=Oa;exports.AcDbAttribute=Ii;exports.AcDbAttributeDefinition=Pi;exports.AcDbAttributeFlags=le;exports.AcDbAttributeMTextFlag=_r;exports.AcDbBaseWorker=J0;exports.AcDbBatchProcessing=Va;exports.AcDbBlockReference=Kn;exports.AcDbBlockTable=rc;exports.AcDbBlockTableRecord=he;exports.AcDbCircle=Ai;exports.AcDbCodePage=ja;exports.AcDbCurve=Ne;exports.AcDbDataGenerator=Vh;exports.AcDbDatabase=za;exports.AcDbDatabaseConverter=ao;exports.AcDbDatabaseConverterManager=fr;exports.AcDbDiametricDimension=Ui;exports.AcDbDictionary=qs;exports.AcDbDimArrowType=Uh;exports.AcDbDimStyleTable=nc;exports.AcDbDimStyleTableRecord=$n;exports.AcDbDimTextHorizontal=uc;exports.AcDbDimTextVertical=cc;exports.AcDbDimVerticalJustification=mc;exports.AcDbDimZeroSuppression=dc;exports.AcDbDimZeroSuppressionAngular=pc;exports.AcDbDimension=Ur;exports.AcDbDuplicateRecordCloning=Fh;exports.AcDbDwgVersion=Dn;exports.AcDbDxfCode=Ra;exports.AcDbDxfConverter=tc;exports.AcDbEllipse=Ei;exports.AcDbEntity=ke;exports.AcDbFace=Mi;exports.AcDbFileType=Xs;exports.AcDbHatch=Ks;exports.AcDbHatchPatternType=Hs;exports.AcDbHatchStyle=Nh;exports.AcDbHostApplicationServices=Hi;exports.AcDbLayerTable=sc;exports.AcDbLayerTableRecord=na;exports.AcDbLayout=ea;exports.AcDbLayoutDictionary=zh;exports.AcDbLayoutManager=fc;exports.AcDbLeader=Ti;exports.AcDbLeaderAnnotationType=Lh;exports.AcDbLine=$s;exports.AcDbLineSpacingStyle=Bh;exports.AcDbLinetypeTable=ic;exports.AcDbLinetypeTableRecord=Ys;exports.AcDbMText=Zs;exports.AcDbObject=jr;exports.AcDbObjectIterator=ri;exports.AcDbOpenMode=_c;exports.AcDbOrdinateDimension=ji;exports.AcDbOsnapMode=Ft;exports.AcDbPoint=Ci;exports.AcDbPoly2dType=Wn;exports.AcDbPoly3dType=Ds;exports.AcDbPolyline=Li;exports.AcDbRadialDimension=Gi;exports.AcDbRasterImage=Js;exports.AcDbRasterImageClipBoundaryType=Ch;exports.AcDbRasterImageDef=Rh;exports.AcDbRasterImageImageDisplayOpt=Oh;exports.AcDbRay=Oi;exports.AcDbRegAppTable=lc;exports.AcDbRegAppTableRecord=hc;exports.AcDbRegenerator=ec;exports.AcDbRenderingCache=Qn;exports.AcDbResultBuffer=mo;exports.AcDbSpline=Qs;exports.AcDbSymbolTable=an;exports.AcDbSymbolTableRecord=sn;exports.AcDbSysVarManager=Di;exports.AcDbTable=ki;exports.AcDbText=Yn;exports.AcDbTextHorizontalMode=Th;exports.AcDbTextStyleTable=ac;exports.AcDbTextStyleTableRecord=co;exports.AcDbTextVerticalMode=kh;exports.AcDbTrace=Ni;exports.AcDbUnitsValue=io;exports.AcDbViewport=Bi;exports.AcDbViewportTable=oc;exports.AcDbViewportTableRecord=gc;exports.AcDbWipeout=zi;exports.AcDbWorkerApi=Qu;exports.AcDbWorkerManager=Zu;exports.AcDbXline=Ri;exports.AcDbXrecord=so;exports.AcGeArea2d=Qi;exports.AcGeBox2d=Se;exports.AcGeBox3d=Nt;exports.AcGeCatmullRomCurve3d=Sh;exports.AcGeCircArc2d=qn;exports.AcGeCircArc3d=Qa;exports.AcGeCurve2d=Jn;exports.AcGeEllipseArc2d=Ji;exports.AcGeEllipseArc3d=ta;exports.AcGeEuler=Qc;exports.AcGeGeometryUtil=ch;exports.AcGeLine2d=Ws;exports.AcGeLine3d=Xn;exports.AcGeLoop2d=Ja;exports.AcGeMathUtil=Pt;exports.AcGeMatrix2d=Zi;exports.AcGeMatrix3d=Ye;exports.AcGeNurbsCurve=Sn;exports.AcGePlane=ti;exports.AcGePoint2d=kt;exports.AcGePoint3d=W;exports.AcGePolyline2d=An;exports.AcGeQuaternion=In;exports.AcGeShape2d=Za;exports.AcGeSpline3d=rn;exports.AcGeTol=Ya;exports.AcGeVector2d=Jt;exports.AcGeVector3d=Y;exports.AcGiArrowType=to;exports.AcGiDefaultLightingType=no;exports.AcGiLineWeight=nn;exports.AcGiMTextAttachmentPoint=we;exports.AcGiMTextFlowDirection=Vr;exports.AcGiOrthographicType=ro;exports.AcGiRenderMode=eo;exports.AcGiViewport=Ph;exports.AcTrStringUtil=Wc;exports.ByBlock=Gl;exports.ByLayer=di;exports.DEBUG_MODE=jc;exports.DEFAULT_LINE_TYPE=vi;exports.DEFAULT_TOL=Ka;exports.DEG2RAD=Ga;exports.DefaultLoadingManager=Ul;exports.FLOAT_TOL=xn;exports.ORIGIN_POINT_2D=qc;exports.ORIGIN_POINT_3D=Xa;exports.RAD2DEG=Wa;exports.TAU=Zt;exports.acdbDisableOsnapMode=ld;exports.acdbEnableOsnapMode=od;exports.acdbHasOsnapMode=ad;exports.acdbHostApplicationServices=po;exports.acdbMaskToOsnapModes=sd;exports.acdbOsnapModesToMask=nd;exports.acdbToggleOsnapMode=id;exports.basisFunction=bi;exports.calculateCurveLength=gh;exports.ceilPowerOfTwo=nh;exports.clamp=Fr;exports.clone=Fs;exports.createWorkerApi=Ju;exports.damp=ql;exports.deepClone=Ea;exports.defaults=Zn;exports.degToRad=th;exports.dwgCodePageToEncoding=jl;exports.euclideanModulo=Da;exports.evaluateNurbsPoint=Gs;exports.floorPowerOfTwo=sh;exports.generateChordKnots=ph;exports.generateSqrtChordKnots=mh;exports.generateUUID=Wl;exports.generateUniformKnots=dh;exports.has=Nl;exports.intPartLength=qa;exports.interpolateControlPoints=Xc;exports.inverseLerp=Hl;exports.isBetween=ih;exports.isBetweenAngle=ah;exports.isEmpty=Ll;exports.isEqual=Hn;exports.isImperialUnits=cd;exports.isMetricUnits=ud;exports.isPointInPolygon=$a;exports.isPolygonIntersect=uh;exports.isPowerOfTwo=rh;exports.lerp=Ha;exports.log=Us;exports.mapLinear=Dl;exports.normalizeAngle=js;exports.pingpong=Xl;exports.radToDeg=eh;exports.randFloat=Zl;exports.randFloatSpread=Ql;exports.randInt=$l;exports.relativeEps=oh;exports.seededRandom=Jl;exports.setLogLevel=Gc;exports.smootherstep=Kl;exports.smoothstep=Yl;