@mlightcad/data-model 1.0.4 → 1.0.6

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.
@@ -1,2 +1,2 @@
1
- (function(u,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("@mlightcad/common"),require("lodash-es"),require("@mlightcad/geometry-engine"),require("@mlightcad/graphic-interface")):typeof define=="function"&&define.amd?define(["exports","@mlightcad/common","lodash-es","@mlightcad/geometry-engine","@mlightcad/graphic-interface"],P):(u=typeof globalThis<"u"?globalThis:u||self,P(u["data-model"]={},u.common,u.lodashEs,u.geometryEngine,u.graphicInterface))})(this,function(u,P,je,c,B){"use strict";class vt{constructor(e,t,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(e):setTimeout(e,0)}async processChunk(e){let t=0;const s=async()=>{const i=t,a=Math.min(t+this._chunkSize,this._count);await e(i,a),t=a,t<this._count&&this.scheduleTask(s)};await s()}}var v,Se,T,D,Te,H,N,$,z,le,Ee,Le,he,ue,De,ve,ke,G,Z,x,pe,Oe,g,M,Ce,F,J,Ne,Q,W,Me,me,V,ee,at,ot,te,Fe,Re,re,Be,ct,dt,ge,k,se,O,j,lt,ht,ut,pt,mt,gt;(v={})[v.None=0]="None",v[v.Anonymous=1]="Anonymous",v[v.NonConstant=2]="NonConstant",v[v.Xref=4]="Xref",v[v.XrefOverlay=8]="XrefOverlay",v[v.ExternallyDependent=16]="ExternallyDependent",v[v.ResolvedOrDependent=32]="ResolvedOrDependent",v[v.ReferencedXref=64]="ReferencedXref",(Se={})[Se.BYBLOCK=0]="BYBLOCK",Se[Se.BYLAYER=256]="BYLAYER",(T={})[T.Rotated=0]="Rotated",T[T.Aligned=1]="Aligned",T[T.Angular=2]="Angular",T[T.Diameter=3]="Diameter",T[T.Radius=4]="Radius",T[T.Angular3Point=5]="Angular3Point",T[T.Ordinate=6]="Ordinate",T[T.ReferenceIsExclusive=32]="ReferenceIsExclusive",T[T.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",T[T.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(D={})[D.TopLeft=1]="TopLeft",D[D.TopCenter=2]="TopCenter",D[D.TopRight=3]="TopRight",D[D.MiddleLeft=4]="MiddleLeft",D[D.MiddleCenter=5]="MiddleCenter",D[D.MiddleRight=6]="MiddleRight",D[D.BottomLeft=7]="BottomLeft",D[D.BottomCenter=8]="BottomCenter",D[D.BottomRight=9]="BottomRight",(Te={})[Te.AtLeast=1]="AtLeast",Te[Te.Exact=2]="Exact";var kt=((H={})[H.Center=0]="Center",H[H.Above=1]="Above",H[H.Outside=2]="Outside",H[H.JIS=3]="JIS",H[H.Below=4]="Below",H),Ie=((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),Os=(($={})[$.None=0]="None",$[$.Leading=1]="Leading",$[$.Trailing=2]="Trailing",$[$.LeadingAndTrailing=3]="LeadingAndTrailing",$),Cs=((z={})[z.Center=0]="Center",z[z.Left=1]="Left",z[z.Right=2]="Right",z[z.OverFirst=3]="OverFirst",z[z.OverSecond=4]="OverSecond",z),Ns=((le={})[le.Bottom=0]="Bottom",le[le.Center=1]="Center",le[le.Top=2]="Top",le);(Ee={})[Ee.PatternFill=0]="PatternFill",Ee[Ee.SolidFill=1]="SolidFill",(Le={})[Le.NonAssociative=0]="NonAssociative",Le[Le.Associative=1]="Associative",(he={})[he.Normal=0]="Normal",he[he.Outer=1]="Outer",he[he.Ignore=2]="Ignore",(ue={})[ue.UserDefined=0]="UserDefined",ue[ue.Predefined=1]="Predefined",ue[ue.Custom=2]="Custom",(De={})[De.NotAnnotated=0]="NotAnnotated",De[De.Annotated=1]="Annotated",(ve={})[ve.Solid=0]="Solid",ve[ve.Gradient=1]="Gradient",(ke={})[ke.TwoColor=0]="TwoColor",ke[ke.OneColor=1]="OneColor";var Ms=((G={})[G.Default=0]="Default",G[G.External=1]="External",G[G.Polyline=2]="Polyline",G[G.Derived=4]="Derived",G[G.Textbox=8]="Textbox",G[G.Outermost=16]="Outermost",G),He=((Z={})[Z.Line=1]="Line",Z[Z.Circular=2]="Circular",Z[Z.Elliptic=3]="Elliptic",Z[Z.Spline=4]="Spline",Z),Fs=((x={})[x.Off=0]="Off",x[x.Solid=1]="Solid",x[x.Dashed=2]="Dashed",x[x.Dotted=3]="Dotted",x[x.ShotDash=4]="ShotDash",x[x.MediumDash=5]="MediumDash",x[x.LongDash=6]="LongDash",x[x.DoubleShortDash=7]="DoubleShortDash",x[x.DoubleMediumDash=8]="DoubleMediumDash",x[x.DoubleLongDash=9]="DoubleLongDash",x[x.DoubleMediumLongDash=10]="DoubleMediumLongDash",x[x.SparseDot=11]="SparseDot",x);Fs.Off,(pe={})[pe.Standard=-3]="Standard",pe[pe.ByLayer=-2]="ByLayer",pe[pe.ByBlock=-1]="ByBlock",(Oe={})[Oe.English=0]="English",Oe[Oe.Metric=1]="Metric",(g={})[g.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",g[g.FRONT_CLIPPING=2]="FRONT_CLIPPING",g[g.BACK_CLIPPING=4]="BACK_CLIPPING",g[g.UCS_FOLLOW=8]="UCS_FOLLOW",g[g.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",g[g.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",g[g.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",g[g.FAST_ZOOM=128]="FAST_ZOOM",g[g.SNAP_MODE=256]="SNAP_MODE",g[g.GRID_MODE=512]="GRID_MODE",g[g.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",g[g.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",g[g.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",g[g.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",g[g.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",g[g.UNUSED=32768]="UNUSED",g[g.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",g[g.VIEWPORT_OFF=131072]="VIEWPORT_OFF",g[g.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",g[g.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",g[g.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",g[g.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(M={})[M.OPTIMIZED_2D=0]="OPTIMIZED_2D",M[M.WIREFRAME=1]="WIREFRAME",M[M.HIDDEN_LINE=2]="HIDDEN_LINE",M[M.FLAT_SHADED=3]="FLAT_SHADED",M[M.GOURAUD_SHADED=4]="GOURAUD_SHADED",M[M.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",M[M.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(Ce={})[Ce.UCS_UNCHANGED=0]="UCS_UNCHANGED",Ce[Ce.HAS_OWN_UCS=1]="HAS_OWN_UCS",(F={})[F.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",F[F.TOP=1]="TOP",F[F.BOTTOM=2]="BOTTOM",F[F.FRONT=3]="FRONT",F[F.BACK=4]="BACK",F[F.LEFT=5]="LEFT",F[F.RIGHT=6]="RIGHT",(J={})[J.AS_DISPLAYED=0]="AS_DISPLAYED",J[J.WIREFRAME=1]="WIREFRAME",J[J.HIDDEN=2]="HIDDEN",J[J.RENDERED=3]="RENDERED",(Ne={})[Ne.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",Ne[Ne.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function A(r,e,t){return r.code===e&&(t==null||r.value===t)}function w(r){let e={};r.rewind();let t=r.next(),s=t.code;if(e.x=t.value,(t=r.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=r.next()).code!==s+20?r.rewind():e.z=t.value,e}let ft=Symbol();function b(r,e){return(t,s,i)=>{let a=r.reduce((h,l)=>{l.pushContext&&h.push({});let m=h[h.length-1];for(let _ of typeof l.code=="number"?[l.code]:l.code){let f=m[_]??(m[_]=[]);l.isMultiple&&f.length&&console.warn(`Snippet ${f.at(-1).name} for code(${_}) is shadowed by ${l.name}`),f.push(l)}return h},[{}]),o=!1,d=a.length-1;for(;!A(t,0,"EOF");){let h=function(y,L,C){return y.find((K,de)=>{var q;return de>=C&&((q=K[L])==null?void 0:q.length)})}(a,t.code,d),l=h==null?void 0:h[t.code].at(-1);if(!h||!l){s.rewind();break}l.isMultiple||h[t.code].pop();let{name:m,parser:_,isMultiple:f}=l,I=_==null?void 0:_(t,s,i);if(I===ft){s.rewind();break}if(m){let[y,L]=function(C,K){let de=K.split("."),q=C;for(let xe=0;xe<de.length-1;++xe){let Ve=de[xe];Object.hasOwn(q,Ve)||(q[Ve]={}),q=q[Ve]}return[q,de.at(-1)]}(i,m);f?(Object.hasOwn(y,L)||(y[L]=[]),y[L].push(I)):y[L]=I}l.pushContext&&(d-=1),o=!0,t=s.next()}return e&&Object.setPrototypeOf(i,e),o}}function n({value:r}){return r}function p(r,e){return w(e)}function S({value:r}){return!!r}var Ot=[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 Ct(r,e){var i;if(!A(r,1001))throw Error("XData must starts with code 1001");let t={appName:r.value,value:[]};r=e.next();let s=[t.value];for(;!A(r,0,"EOF")&&r.code>=1e3;){let a=s.at(-1);switch(r.code){case 1002:r.value==="{"?s.push([]):(s.pop(),(i=s.at(-1))==null||i.push(a));break;case 1e3:case 1004:case 1040:case 1070:case 1071:a.push({type:ne(r.code),value:r.value});break;case 1003:a.push({name:"layer",type:ne(r.code),value:r.value});break;case 1005:a.push({name:"handle",type:ne(r.code),value:r.value});break;case 1010:a.push({type:ne(r.code),value:w(e)});break;case 1011:a.push({name:"worldSpacePosition",type:ne(r.code),value:w(e)});break;case 1012:a.push({name:"worldSpaceDisplacement",type:ne(r.code),value:w(e)});break;case 1013:a.push({name:"worldSpaceDirection",type:ne(r.code),value:w(e)});break;case 1041:a.push({name:"distance",type:ne(r.code),value:r.value});break;case 1042:a.push({name:"scale",type:ne(r.code),value:r.value})}r=e.next()}return e.rewind(),t}function ne(r){switch(r){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 _t(r,e,t){if(A(e,102))return ze(e,t),!0;switch(e.code){case 0:r.type=e.value;break;case 5:r.handle=e.value;break;case 330:r.ownerDictionarySoftId?r.ownerBlockRecordSoftId=e.value:r.ownerDictionarySoftId=e.value;break;case 360:r.ownerdictionaryHardId=e.value;break;case 67:r.isInPaperSpace=!!e.value;break;case 8:r.layer=e.value;break;case 6:r.lineType=e.value;break;case 347:r.materialObjectHardId=e.value;break;case 62:r.colorIndex=e.value,r.color=Ot[Math.abs(e.value)];break;case 370:r.lineweight=e.value;break;case 48:r.lineTypeScale=e.value;break;case 60:r.isVisible=!!e.value;break;case 92:r.proxyByte=e.value;break;case 310:r.proxyEntity=e.value;break;case 100:break;case 420:r.color=e.value;break;case 430:r.transparency=e.value;break;case 390:r.plotStyleHardId=e.value;break;case 284:r.shadowMode=e.value;break;case 1001:r.xdata=Ct(e,t);break;default:return!1}return!0}let Rs=0;function Nt(r){if(!r)throw TypeError("entity cannot be undefined or null");r.handle||(r.handle=Rs++)}(Q={})[Q.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Q[Q.CAST=1]="CAST",Q[Q.RECEIVE=2]="RECEIVE",Q[Q.IGNORE=3]="IGNORE";let E=[{code:1001,name:"xdata",parser:Ct},{code:284,name:"shadowMode",parser:n},{code:390,name:"plotStyleHardId",parser:n},{code:440,name:"transparency",parser:n},{code:430,name:"colorName",parser:n},{code:420,name:"color",parser:n},{code:310,name:"proxyEntity",isMultiple:!0,parser:n},{code:92,name:"proxyByte",parser:n},{code:60,name:"isVisible",parser:S},{code:48,name:"lineTypeScale",parser:n},{code:370,name:"lineweight",parser:n},{code:62,name:"colorIndex",parser(r,e,t){let s=r.value;return t.color=Ot[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:n},{code:6,name:"lineType",parser:n},{code:8,name:"layer",parser:n},{code:410,name:"layoutTabName",parser:n},{code:67,name:"isInPaperSpace",parser:S},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:n},{code:102,parser:ze},{code:102,parser:ze},{code:102,parser:ze},{code:5,name:"handle",parser:n}];function ze(r,e){for(r=e.next();!A(r,102)&&!A(r,0,"EOF");)r=e.next()}function Mt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Bs={extrusionDirection:{x:0,y:0,z:1}},Gs=[{code:210,name:"extrusionDirection",parser:p},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:100,name:"subclassMarker",parser:n},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p},{code:39,name:"thickness",parser:n},{code:100},...E];class Ft{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Mt(this,"parser",b(Gs,Bs))}}Mt(Ft,"ForEntityName","ARC"),(W={})[W.NONE=0]="NONE",W[W.INVISIBLE=1]="INVISIBLE",W[W.CONSTANT=2]="CONSTANT",W[W.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",W[W.PRESET=8]="PRESET",(Me={})[Me.MULTILINE=2]="MULTILINE",Me[Me.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(me={})[me.NONE=0]="NONE",me[me.MIRRORED_X=2]="MIRRORED_X",me[me.MIRRORED_Y=4]="MIRRORED_Y";var Vs=((V={})[V.LEFT=0]="LEFT",V[V.CENTER=1]="CENTER",V[V.RIGHT=2]="RIGHT",V[V.ALIGNED=3]="ALIGNED",V[V.MIDDLE=4]="MIDDLE",V[V.FIT=5]="FIT",V),js=((ee={})[ee.BASELINE=0]="BASELINE",ee[ee.BOTTOM=1]="BOTTOM",ee[ee.MIDDLE=2]="MIDDLE",ee[ee.TOP=3]="TOP",ee);function Rt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let Bt={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Vs.LEFT,valign:js.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Gt=[{code:73,name:"valign",parser:n},{code:100},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"endPoint",parser:p},{code:72,name:"valign",parser:n},{code:72,name:"halign",parser:n},{code:71,name:"generationFlag",parser:n},{code:7,name:"styleName",parser:n},{code:51,name:"obliqueAngle",parser:n},{code:41,name:"xScale",parser:n},{code:50,name:"rotation",parser:n},{code:1,name:"text",parser:n},{code:40,name:"textHeight",parser:n},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Vt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Rt(this,"parser",b(Gt,Bt))}}function jt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Rt(Vt,"ForEntityName","TEXT");let Hs={...Bt},zs=[{code:2},{code:40,name:"annotationScale",parser:n},{code:10,name:"alignmentPoint",parser:p},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:n},{code:70,name:"numberOfSecondaryAttributes",parser:n},{code:70,name:"isReallyLocked",parser:S},{code:70,name:"mtextFlag",parser:n},{code:280,name:"isDuplicatedRecord",parser:S},{code:100},{code:280,name:"isLocked",parser:S},{code:74,name:"valign",parser:n},{code:73},{code:70,name:"attributeFlag",parser:n},{code:2,name:"tag",parser:n},{code:3,name:"prompt",parser:n},{code:280},{code:100,name:"subclassMarker",parser:n},...Gt.slice(2)];class Ht{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){jt(this,"parser",b(zs,Hs))}}function zt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}jt(Ht,"ForEntityName","ATTDEF");let Ws={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Ys=[{code:210,name:"extrusionDirection",parser:p},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Wt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){zt(this,"parser",b(Ys,Ws))}}zt(Wt,"ForEntityName","CIRCLE");class We{parseEntity(e,t){let s={};for(;!A(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(i,a,o){switch(a.code){case 100:i.subclassMarker=a.value;break;case 280:i.version=a.value;break;case 2:i.name=a.value;break;case 10:i.definitionPoint=w(o);break;case 11:i.textPoint=w(o);break;case 12:i.insertionPoint=w(o);break;case 13:i.subDefinitionPoint1=w(o);break;case 14:i.subDefinitionPoint2=w(o);break;case 15:i.centerPoint=w(o);break;case 16:i.arcPoint=w(o);break;case 70:i.dimensionType=a.value;break;case 71:i.attachmentPoint=a.value;break;case 72:i.textLineSpacingStyle=a.value;break;case 40:i.leaderLength=a.value;break;case 41:i.textLineSpacingFactor=a.value;break;case 42:i.measurement=a.value;break;case 1:i.text=a.value;break;case 50:i.rotationAngle=a.value;break;case 52:i.obliqueAngle=a.value;break;case 53:i.textRotation=a.value;break;case 51:i.ocsRotation=a.value;break;case 210:i.extrusionDirection=w(o);break;case 3:i.styleName=a.value;break;default:_t(i,a,o)}})(s,t,e),t=e.next()}return s}}function Yt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ot="DIMENSION",(at="ForEntityName")in We?Object.defineProperty(We,at,{value:ot,enumerable:!0,configurable:!0,writable:!0}):We[at]=ot;let Us={extrusionDirection:{x:0,y:0,z:1}},Xs=[{code:42,name:"endAngle",parser:n},{code:41,name:"startAngle",parser:n},{code:40,name:"axisRatio",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"majorAxisEndPoint",parser:p},{code:10,name:"center",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ut{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Yt(this,"parser",b(Xs,Us))}}Yt(Ut,"ForEntityName","ELLIPSE");let Xt=[{code:330,name:"sourceBoundaryObjects",parser:n,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:n}],Ks=[{code:11,name:"end",parser:p},{code:10,name:"start",parser:p}],qs=[{code:73,name:"isCCW",parser:S},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:40,name:"radius",parser:n},{code:10,name:"center",parser:p}],$s=[{code:73,name:"isCCW",parser:S},{code:51,name:"endAngle",parser:n},{code:50,name:"startAngle",parser:n},{code:40,name:"lengthOfMinorAxis",parser:n},{code:11,name:"end",parser:p},{code:10,name:"center",parser:p}],Zs=[{code:13,name:"endTangent",parser:p},{code:12,name:"startTangent",parser:p},{code:11,name:"fitDatum",isMultiple:!0,parser:p},{code:97,name:"numberOfFitData",parser:n},{code:10,name:"controlPoints",isMultiple:!0,parser(r,e){let t={...w(e),weight:1};return(r=e.next()).code===42?t.weight=r.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:n},{code:96,name:"numberOfControlPoints",parser:n},{code:95,name:"numberOfKnots",parser:n},{code:74,name:"isPeriodic",parser:S},{code:73,name:"splineFlag",parser:n},{code:94,name:"degree",parser:n}],Js={[He.Line]:Ks,[He.Circular]:qs,[He.Elliptic]:$s,[He.Spline]:Zs},Qs=[...Xt,{code:72,name:"edges",parser(r,e){let t={type:r.value},s=b(Js[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(r=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:n}],en=[...Xt,{code:10,name:"vertices",parser(r,e){let t={...w(e),bulge:0};return(r=e.next()).code===42?t.bulge=r.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:n},{code:73,name:"isClosed",parser:S},{code:72,name:"hasBulge",parser:S}],tn=[{code:49,name:"dashLengths",parser:n,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:n},{code:45,name:"offset",parser:Kt},{code:43,name:"base",parser:Kt},{code:53,name:"angle",parser:n}];function Kt(r,e){let t=r.code+1,s={x:r.value,y:1};return(r=e.next()).code===t?s.y=r.value:e.rewind(),s}function qt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let rn={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},sn=[{code:470},{code:463},{code:462,name:"colorTint",parser:n},{code:461,name:"gradientDefinition",parser:n},{code:460,name:"gradientRotation",parser:n},{code:453,name:"numberOfColors",parser:n},{code:452,name:"gradientColorFlag",parser:n},{code:451},{code:450,name:"gradientFlag",parser:n},{code:10,name:"seedPoints",parser:p,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:p},{code:98,name:"numberOfSeedPoints",parser:n},{code:47,name:"pixelSize",parser:n},{code:53,name:"definitionLines",parser:function(r,e){let t={};return b(tn)(r,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:n},{code:77,name:"isDouble",parser:S},{code:73,name:"isAnnotated",parser:S},{code:41,name:"patternScale",parser:n},{code:52,name:"patternAngle",parser:n},{code:76,name:"patternType",parser:n},{code:75,name:"hatchStyle",parser:n},{code:92,name:"boundaryPaths",parser:function(r,e){let t={boundaryPathTypeFlag:r.value},s=t.boundaryPathTypeFlag&Ms.Polyline;return r=e.next(),s?b(en)(r,e,t):b(Qs)(r,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:n},{code:71,name:"associativity",parser:n},{code:63,name:"patternFillColor",parser:n},{code:70,name:"solidFill",parser:n},{code:2,name:"patternName",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:10,name:"elevationPoint",parser:p},{code:100,name:"subclassMarker",parser:n,pushContext:!0},...E];class $t{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){qt(this,"parser",b(sn,rn))}}qt($t,"ForEntityName","HATCH"),(te={})[te.ShowImage=1]="ShowImage",te[te.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",te[te.UseClippingBoundary=4]="UseClippingBoundary",te[te.TransparencyIsOn=8]="TransparencyIsOn",(Fe={})[Fe.Rectangular=1]="Rectangular",Fe[Fe.Polygonal=2]="Polygonal",(Re={})[Re.Outside=0]="Outside",Re[Re.Inside=1]="Inside";function Zt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let nn={clippingBoundaryPath:[]},an=[{code:90,name:"version",parser:n},{code:10,name:"position",parser:p},{code:11,name:"uPixel",parser:p},{code:12,name:"vPixel",parser:p},{code:13,name:"imageSize",parser:p},{code:340,name:"imageDefHandle",parser:n},{code:70,name:"flags",parser:n},{code:280,name:"clipping",parser:n},{code:281,name:"brightness",parser:n},{code:282,name:"contrast",parser:n},{code:283,name:"fade",parser:n},{code:360,name:"imageDefReactorHandle",parser:n},{code:71,name:"clippingBoundaryType",parser:n},{code:91,name:"countBoundaryPoints",parser:n},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:p},{code:290,name:"clipMode",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class bt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zt(this,"parser",b(an,nn))}}function Jt(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Zt(bt,"ForEntityName","IMAGE");let on={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},cn=[{code:210,name:"extrusionDirection",parser:p},{code:45,name:"rowSpacing",parser:n},{code:44,name:"columnSpacing",parser:n},{code:71,name:"rowCount",parser:n},{code:70,name:"columnCount",parser:n},{code:50,name:"rotation",parser:n},{code:43,name:"zScale",parser:n},{code:42,name:"yScale",parser:n},{code:41,name:"xScale",parser:n},{code:10,name:"insertionPoint",parser:p},{code:2,name:"name",parser:n},{code:66,name:"isVariableAttributes",parser:S},{code:100,name:"subclassMarker",parser:n},...E];class Qt{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jt(this,"parser",b(cn,on))}}function er(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}Jt(Qt,"ForEntityName","INSERT");let dn={isArrowheadEnabled:!0},ln=[{code:213,name:"offsetFromAnnotation",parser:p},{code:212,name:"offsetFromBlock",parser:p},{code:211,name:"horizontalDirection",parser:p},{code:210,name:"normal",parser:p},{code:340,name:"associatedAnnotation",parser:n},{code:77,name:"byBlockColor",parser:n},{code:10,name:"vertices",parser:p,isMultiple:!0},{code:76,name:"numberOfVertices",parser:n},{code:41,name:"textWidth",parser:n},{code:40,name:"textHeight",parser:n},{code:75,name:"isHooklineExists",parser:S},{code:74,name:"isHooklineSameDirection",parser:S},{code:73,name:"leaderCreationFlag",parser:n},{code:72,name:"isSpline",parser:S},{code:71,name:"isArrowheadEnabled",parser:S},{code:3,name:"styleName",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class tr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){er(this,"parser",b(ln,dn))}}er(tr,"ForEntityName","LEADER"),(re={})[re.TextAnnotation=0]="TextAnnotation",re[re.ToleranceAnnotation=1]="ToleranceAnnotation",re[re.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",re[re.NoAnnotation=3]="NoAnnotation";function rr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let hn={thickness:0,extrusionDirection:{x:0,y:0,z:1}},un=[{code:210,name:"extrusionDirection",parser:p},{code:11,name:"endPoint",parser:p},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class sr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){rr(this,"parser",b(un,hn))}}rr(sr,"ForEntityName","LINE"),(Be={})[Be.IS_CLOSED=1]="IS_CLOSED",Be[Be.PLINE_GEN=128]="PLINE_GEN";let pn={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},mn={bulge:0},gn=[{code:42,name:"bulge",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:91,name:"id",parser:n},{code:20,name:"y",parser:n},{code:10,name:"x",parser:n}],fn=[{code:210,name:"extrusionDirection",parser:p},{code:10,name:"vertices",isMultiple:!0,parser(r,e){let t={};return b(gn,mn)(r,e,t),t}},{code:39,name:"thickness",parser:n},{code:38,name:"elevation",parser:n},{code:43,name:"constantWidth",parser:n},{code:70,name:"flag",parser:n},{code:90,name:"numberOfVertices",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class Ye{parseEntity(e,t){let s={};return b(fn,pn)(t,e,s),s}}dt="LWPOLYLINE",(ct="ForEntityName")in Ye?Object.defineProperty(Ye,ct,{value:dt,enumerable:!0,configurable:!0,writable:!0}):Ye[ct]=dt,(ge={})[ge.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",ge[ge.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",ge[ge.BY_STYLE=5]="BY_STYLE";function _n(r,e){let t={};for(let s of r){let i=e(s);i!=null&&(t[i]??(t[i]=[]),t[i].push(s))}return t}function*Ue(r,e=1/0,t=1){for(let s=r;s!==e;s+=t)yield s}function ae(r){return{x:r.x??0,y:r.y??0,z:r.z??0}}function nr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let bn={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Xe=[{code:46,name:"annotationHeight",parser:n},{code:101,parser(r,e){(function(t){t.rewind();let s=t.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=t.next();while(s.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:n},{code:49,name:"columnGutter",parser:n},{code:48,name:"columnWidth",parser:n},{code:79,name:"columnAutoHeight",parser:n},{code:78,name:"columnFlowReversed",parser:n},{code:76,name:"columnCount",parser:n},{code:75,name:"columnType",parser:n},{code:441,name:"backgroundFillTransparency",parser:n},{code:63,name:"backgroundFillColor",parser:n},{code:45,name:"fillBoxScale",parser:n},{code:[...Ue(430,440)],name:"backgroundColor",parser:n},{code:[...Ue(420,430)],name:"backgroundColor",parser:n},{code:90,name:"backgroundFill",parser:n},{code:44,name:"lineSpacing",parser:n},{code:73,name:"lineSpacingStyle",parser:n},{code:50,name:"rotation",parser:n},{code:43},{code:42},{code:11,name:"direction",parser:p},{code:210,name:"extrusionDirection",parser:p},{code:7,name:"styleName",parser:n},{code:3,name:"text",isMultiple:!0,parser:n},{code:1,name:"text",isMultiple:!0,parser:n},{code:72,name:"drawingDirection",parser:n},{code:71,name:"attachmentPoint",parser:n},{code:41,name:"width",parser:n},{code:40,name:"height",parser:n},{code:10,name:"insertionPoint",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class ir{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nr(this,"parser",b(Xe,bn))}}function ar(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}nr(ir,"ForEntityName","MTEXT");let An={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},yn=[{code:50,name:"angle",parser:n},{code:210,name:"extrusionDirection",parser:p},{code:39,name:"thickness",parser:n},{code:10,name:"position",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class or{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ar(this,"parser",b(yn,An))}}ar(or,"ForEntityName","POINT"),(k={})[k.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",k[k.CURVE_FIT=2]="CURVE_FIT",k[k.SPLINE_FIT=4]="SPLINE_FIT",k[k.POLYLINE_3D=8]="POLYLINE_3D",k[k.POLYGON_3D=16]="POLYGON_3D",k[k.CLOSED_POLYGON=32]="CLOSED_POLYGON",k[k.POLYFACE=64]="POLYFACE",k[k.CONTINUOUS=128]="CONTINUOUS",(se={})[se.NONE=0]="NONE",se[se.QUADRATIC=5]="QUADRATIC",se[se.CUBIC=6]="CUBIC",se[se.BEZIER=8]="BEZIER",(O={})[O.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",O[O.TANGENT_DEFINED=2]="TANGENT_DEFINED",O[O.NOT_USED=4]="NOT_USED",O[O.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",O[O.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",O[O.FOR_POLYLINE=32]="FOR_POLYLINE",O[O.FOR_POLYGON=64]="FOR_POLYGON",O[O.POLYFACE=128]="POLYFACE";function cr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let In={startWidth:0,endWidth:0,bulge:0},wn=[{code:91,name:"id",parser:n},{code:[...Ue(71,75)],name:"faces",isMultiple:!0,parser:n},{code:50,name:"tangentDirection",parser:n},{code:70,name:"flag",parser:n},{code:42,name:"bulge",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:30,name:"z",parser:n},{code:20,name:"y",parser:n},{code:10,name:"x",parser:n},{code:100,name:"subclassMarker",parser:n},{code:100},...E];class dr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){cr(this,"parser",b(wn,In))}}function lr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}cr(dr,"ForEntityName","VERTEX");let Pn={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:[]},xn=[{code:0,name:"vertices",isMultiple:!0,parser:(r,e)=>A(r,0,"VERTEX")?(r=e.next(),new dr().parseEntity(e,r)):ft},{code:210,name:"extrusionDirection",parser:p},{code:75,name:"smoothType",parser:n},{code:74,name:"surfaceNDensity",parser:n},{code:73,name:"surfaceMDensity",parser:n},{code:72,name:"meshNVertexCount",parser:n},{code:71,name:"meshMVertexCount",parser:n},{code:41,name:"endWidth",parser:n},{code:40,name:"startWidth",parser:n},{code:70,name:"flag",parser:n},{code:39,name:"thickness",parser:n},{code:30,name:"elevation",parser:n},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:n},...E];class hr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){lr(this,"parser",b(xn,Pn))}}function ur(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}lr(hr,"ForEntityName","POLYLINE");let Sn={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Tn=[{code:10,name:"firstPoint",parser:p},{code:11,name:"unitDirection",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class pr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ur(this,"parser",b(Tn,Sn))}}function mr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}ur(pr,"ForEntityName","RAY");let En={vertices:[],backLineVertices:[]},Ln=[{code:360,name:"geometrySettingHardId",parser:n},{code:12,name:"backLineVertices",isMultiple:!0,parser:p},{code:93,name:"numberOfBackLineVertices",parser:n},{code:11,name:"vertices",isMultiple:!0,parser:p},{code:92,name:"verticesCount",parser:n},{code:[63,411],name:"indicatorColor",parser:n},{code:70,name:"indicatorTransparency",parser:n},{code:41,name:"bottomHeight",parser:n},{code:40,name:"topHeight",parser:n},{code:10,name:"verticalDirection",parser:p},{code:1,name:"name",parser:n},{code:91,name:"flag",parser:n},{code:90,name:"state",parser:n},{code:100,name:"subclassMarker",parser:n},...E];class gr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){mr(this,"parser",b(Ln,En))}}function fr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}mr(gr,"ForEntityName","SECTION");let Dn={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},vn=[{code:210,name:"extrusionDirection",parser:p},{code:39,name:"thickness",parser:n},{code:[...Ue(10,14)],name:"points",isMultiple:!0,parser:p},{code:100,name:"subclassMarker",parser:n},...E];class _r{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){fr(this,"parser",b(vn,Dn))}}fr(_r,"ForEntityName","SOLID"),(j={})[j.NONE=0]="NONE",j[j.CLOSED=1]="CLOSED",j[j.PERIODIC=2]="PERIODIC",j[j.RATIONAL=4]="RATIONAL",j[j.PLANAR=8]="PLANAR",j[j.LINEAR=16]="LINEAR";function br(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}let kn={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},On=[{code:11,name:"fitPoints",isMultiple:!0,parser:p},{code:10,name:"controlPoints",isMultiple:!0,parser:p},{code:41,name:"weights",isMultiple:!0,parser:n},{code:40,name:"knots",isMultiple:!0,parser:n},{code:13,name:"endTangent",parser:p},{code:12,name:"startTangent",parser:p},{code:44,name:"fitTolerance",parser:n},{code:43,name:"controlTolerance",parser:n},{code:42,name:"knotTolerance",parser:n},{code:74,name:"numberOfFitPoints",parser:n},{code:73,name:"numberOfControlPoints",parser:n},{code:72,name:"numberOfKnots",parser:n},{code:71,name:"degree",parser:n},{code:70,name:"flag",parser:n},{code:210,name:"normal",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ar{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){br(this,"parser",b(On,kn))}}br(Ar,"ForEntityName","SPLINE");class Ke{parseEntity(e,t){let s={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:s.subclassMarker=t.value,t=e.next();break;case 2:s.name=t.value,t=e.next();break;case 5:s.handle=t.value,t=e.next();break;case 10:s.startPoint=ae(w(e)),t=e.lastReadGroup;break;case 11:s.directionVector=ae(w(e)),t=e.lastReadGroup;break;case 90:s.tableValue=t.value,t=e.next();break;case 91:s.rowCount=t.value,t=e.next();break;case 92:s.columnCount=t.value,t=e.next();break;case 93:s.overrideFlag=t.value,t=e.next();break;case 94:s.borderColorOverrideFlag=t.value,t=e.next();break;case 95:s.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:s.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(t.value),t=e.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(t.value),t=e.next();break;case 280:s.version=t.value,t=e.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=t.value,t=e.next();break;case 330:s.ownerDictionaryId=t.value,t=e.next();break;case 342:s.tableStyleId=t.value,t=e.next();break;case 343:s.blockRecordHandle=t.value,t=e.next();break;case 170:s.attachmentPoint=t.value,t=e.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(i,a){let o=!1,d=!1,h={};for(;!i.isEOF()&&a.code!==0&&!d;)switch(a.code){case 171:if(o){d=!0;continue}h.cellType=a.value,o=!0,a=i.next();break;case 172:h.flagValue=a.value,a=i.next();break;case 173:h.mergedValue=a.value,a=i.next();break;case 174:h.autoFit=a.value,a=i.next();break;case 175:h.borderWidth=a.value,a=i.next();break;case 176:h.borderHeight=a.value,a=i.next();break;case 91:h.overrideFlag=a.value,a=i.next();break;case 178:h.virtualEdgeFlag=a.value,a=i.next();break;case 145:h.rotation=a.value,a=i.next();break;case 345:h.fieldObjetId=a.value,a=i.next();break;case 340:h.blockTableRecordId=a.value,a=i.next();break;case 146:h.blockScale=a.value,a=i.next();break;case 177:h.blockAttrNum=a.value,a=i.next();break;case 7:h.textStyle=a.value,a=i.next();break;case 140:h.textHeight=a.value,a=i.next();break;case 170:h.attachmentPoint=a.value,a=i.next();break;case 92:h.extendedCellFlags=a.value,a=i.next();break;case 285:h.rightBorderVisibility=!!(a.value??!0),a=i.next();break;case 286:h.bottomBorderVisibility=!!(a.value??!0),a=i.next();break;case 288:h.leftBorderVisibility=!!(a.value??!0),a=i.next();break;case 289:h.topBorderVisibility=!!(a.value??!0),a=i.next();break;case 301:(function(l,m,_){for(;_.code!==304;)switch(_.code){case 301:case 93:case 90:case 94:_=m.next();break;case 1:l.text=_.value,_=m.next();break;case 300:l.attrText=_.value,_=m.next();break;case 302:l.text=_.value?_.value:l.text,_=m.next();break;default:console.log(`Ignore code: ${_.code}, value: ${_.value}`),_=m.next()}})(h,i,a),a=i.next();break;default:return h}return o=!1,d=!1,h}(e,t)),t=e.lastReadGroup;break;default:_t(s,t,e),t=e.next()}}return s}}ht="ACAD_TABLE",(lt="ForEntityName")in Ke?Object.defineProperty(Ke,lt,{value:ht,enumerable:!0,configurable:!0,writable:!0}):Ke[lt]=ht;class qe{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(i,a,o){if(o==="EOF")return!1;switch(o.code){case 0:default:return!1;case 100:i.subclassMarker=o.value;break;case 10:i.viewportCenter=ae(w(a));break;case 40:i.width=o.value;break;case 41:i.height=o.value;break;case 68:i.status=o.value;break;case 69:i.viewportId=o.value;break;case 12:i.displayCenter=w(a);break;case 13:i.snapBase=w(a);break;case 14:i.snapSpacing=w(a);break;case 15:i.gridSpacing=w(a);break;case 16:i.viewDirection=ae(w(a));break;case 17:i.targetPoint=ae(w(a));break;case 42:i.perspectiveLensLength=o.value;break;case 43:i.frontClipZ=o.value;break;case 44:i.backClipZ=o.value;break;case 45:i.viewHeight=o.value;break;case 50:i.snapAngle=o.value;break;case 51:i.viewTwistAngle=o.value;break;case 72:i.circleZoomPercent=o.value;break;case 331:i.frozenLayerIds??(i.frozenLayerIds=[]),i.frozenLayerIds.push(o.value);break;case 90:i.statusBitFlags=o.value;break;case 330:i.ownerBlockRecordSoftId=o.value;break;case 340:i.clippingBoundaryId=o.value;break;case 1:i.sheetName=o.value;break;case 281:i.renderMode=o.value;break;case 71:i.ucsPerViewport=o.value;break;case 110:i.ucsOrigin=ae(w(a));break;case 111:i.ucsXAxis=ae(w(a));break;case 112:i.ucsYAxis=ae(w(a));break;case 345:i.ucsId=o.value;break;case 346:i.ucsBaseId=o.value;break;case 79:i.orthographicType=o.value;break;case 146:i.elevation=o.value;break;case 170:i.shadePlotMode=o.value;break;case 61:i.majorGridFrequency=o.value;break;case 332:i.backgroundId=o.value;break;case 333:i.shadePlotId=o.value;break;case 348:i.visualStyleId=o.value;break;case 292:i.isDefaultLighting=!!o.value;break;case 282:i.defaultLightingType=o.value;break;case 141:i.brightness=o.value;break;case 142:i.contrast=o.value;break;case 63:case 421:case 431:i.ambientLightColor=o.value;break;case 361:i.sunId=o.value;break;case 335:case 343:case 344:case 91:i.softPointer=o.value}return!0}(s,e,t)&&_t(s,t,e),t=e.next()}return s}}pt="VIEWPORT",(ut="ForEntityName")in qe?Object.defineProperty(qe,ut,{value:pt,enumerable:!0,configurable:!0,writable:!0}):qe[ut]=pt;class $e extends bt{parseEntity(e,t){return super.parseEntity(e,t)}}function yr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}gt="WIPEOUT",(mt="ForEntityName")in $e?Object.defineProperty($e,mt,{value:gt,enumerable:!0,configurable:!0,writable:!0}):$e[mt]=gt;let Cn={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Nn=[{code:10,name:"firstPoint",parser:p},{code:11,name:"unitDirection",parser:p},{code:100,name:"subclassMarker",parser:n},...E];class Ir{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){yr(this,"parser",b(Nn,Cn))}}function wr(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}yr(Ir,"ForEntityName","XLINE");let Mn={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},Fn=[...Xe.slice(Xe.findIndex(({name:r})=>r==="columnType"),Xe.findIndex(({name:r})=>r==="subclassMarker")+1),{code:100},{code:0,parser(r){if(!A(r,0,"MTEXT"))return ft}},{code:2,name:"definitionTag",parser:n},{code:40,name:"annotationScale",parser:n},{code:10,name:"alignmentPoint",parser:p},{code:340,name:"secondaryAttributesHardId",parser:n},{code:70,name:"numberOfSecondaryAttributes",parser:n},{code:70,name:"isReallyLocked",parser:S},{code:70,name:"mtextFlag",parser:n},{code:280,name:"isDuplicatedEntriesKeep",parser:S},{code:100},{code:280,name:"lockPositionFlag",parser:S},{code:210,name:"extrusionDirection",parser:p},{code:11,name:"alignmentPoint",parser:p},{code:74,name:"verticalJustification",parser:n},{code:72,name:"horizontalJustification",parser:n},{code:71,name:"textGenerationFlag",parser:n},{code:7,name:"textStyle",parser:n},{code:51,name:"obliqueAngle",parser:n},{code:41,name:"scale",parser:n},{code:50,name:"rotation",parser:n},{code:73},{code:70,name:"attributeFlag",parser:n},{code:2,name:"tag",parser:n},{code:280},{code:100,name:"subclassMarker",parser:n},{code:1,name:"text",parser:n},{code:40,name:"textHeight",parser:n},{code:10,name:"startPoint",parser:p},{code:39,name:"thickness",parser:n},{code:100},...E];class Pr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){wr(this,"parser",b(Fn,Mn))}}wr(Pr,"ForEntityName","ATTRIB");let Rn=Object.fromEntries([Ft,Ht,Pr,Wt,We,Ut,bt,Qt,tr,sr,Ye,ir,or,hr,pr,gr,_r,Ar,Ke,Vt,$t,qe,$e,Ir].map(r=>[r.ForEntityName,new r]));function xr(r,e){let t=[];for(;!A(r,0,"EOF");){if(r.code===0){if(r.value==="ENDBLK"||r.value==="ENDSEC"){e.rewind();break}let s=Rn[r.value];if(s){let i=r.value;r=e.next();let a=s.parseEntity(e,r);a.type=i,Nt(a),t.push(a)}else console.warn(`Unsupported ENTITY type: ${r.value}`)}r=e.next()}return t}function Bn(r,e){let t={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");){if(A(r,0,"BLOCK")){let s=Gn(r=e.next(),e);Nt(s),s.name&&(t[s.name]=s)}r=e.next()}return t}function Gn(r,e){let t={};for(;!A(r,0,"EOF");){if(A(r,0,"ENDBLK")){for(r=e.next();!A(r,0,"EOF");){if(A(r,100,"AcDbBlockEnd"))return t;r=e.next()}break}switch(r.code){case 1:t.xrefPath=r.value;break;case 2:t.name=r.value;break;case 3:t.name2=r.value;break;case 5:t.handle=r.value;break;case 8:t.layer=r.value;break;case 10:t.position=w(e);break;case 67:t.paperSpace=!!r.value&&r.value==1;break;case 70:r.value!==0&&(t.type=r.value);break;case 100:break;case 330:t.ownerHandle=r.value;break;case 0:t.entities=xr(r,e)}r=e.next()}return t}function Vn(r,e){let t=null,s={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");)r.code===9?t=r.value:r.code===10?s[t]=w(e):s[t]=r.value,r=e.next();return s}let jn=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:n},{code:90,name:"version",parser:n},{code:1,name:"fileName",parser:n},{code:10,name:"size",parser:p},{code:11,name:"sizeOfOnePixel",parser:p},{code:280,name:"isLoaded",parser:n},{code:281,name:"resolutionUnits",parser:n},{code:100,name:"subclassMarker",parser:n}],Sr=[{code:333,name:"shadePlotId",parser:n},{code:149,name:"imageOriginY",parser:n},{code:148,name:"imageOriginX",parser:n},{code:147,name:"scaleFactor",parser:n},{code:78,name:"shadePlotCustomDPI",parser:n},{code:77,name:"shadePlotResolution",parser:n},{code:76,name:"shadePlotMode",parser:n},{code:75,name:"standardScaleType",parser:n},{code:7,name:"currentStyleSheet",parser:n},{code:74,name:"plotType",parser:n},{code:73,name:"plotRotation",parser:n},{code:72,name:"paperUnit",parser:n},{code:70,name:"layoutFlag",parser:n},{code:143,name:"printScaleDenominator",parser:n},{code:142,name:"printScaleNominator",parser:n},{code:141,name:"windowAreaYMax",parser:n},{code:140,name:"windowAreaYMin",parser:n},{code:49,name:"windowAreaXMax",parser:n},{code:48,name:"windowAreaXMin",parser:n},{code:47,name:"plotOriginY",parser:n},{code:46,name:"plotOriginX",parser:n},{code:45,name:"paperHeight",parser:n},{code:44,name:"paperWidth",parser:n},{code:43,name:"marginTop",parser:n},{code:42,name:"marginRight",parser:n},{code:41,name:"marginBottom",parser:n},{code:40,name:"marginLeft",parser:n},{code:6,name:"plotViewName",parser:n},{code:4,name:"paperSize",parser:n},{code:2,name:"configName",parser:n},{code:1,name:"pageSetupName",parser:n},{code:100,name:"subclassMarker",parser:n}],Hn=[{code:333,name:"shadePlotId",parser:n},{code:346,name:"orthographicUcsId",parser:n},{code:345,name:"namedUcsId",parser:n},{code:331,name:"viewportId",parser:n},{code:330,name:"paperSpaceTableId",parser:n},{code:76,name:"orthographicType",parser:n},{code:17,name:"ucsYAxis",parser:p},{code:16,name:"ucsXAxis",parser:p},{code:13,name:"ucsOrigin",parser:p},{code:146,name:"elevation",parser:n},{code:15,name:"maxExtent",parser:p},{code:14,name:"minExtent",parser:p},{code:12,name:"insertionBase",parser:p},{code:11,name:"maxLimit",parser:p},{code:10,name:"minLimit",parser:p},{code:71,name:"tabOrder",parser:n},{code:70,name:"controlFlag",parser:n},{code:1,name:"layoutName",parser:n},{code:100,name:"subclassMarker",parser:n},...Sr],zn=[{code:330,name:"ownerObjectId",parser:n},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:n},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:n},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:n}];function Tr(r){return r.subclassMarker==="AcDbDictionary"}let Wn={LAYOUT:Hn,PLOTSETTINGS:Sr,DICTIONARY:[{code:3,name:"entries",parser:(r,e)=>{let t={name:r.value};return(r=e.next()).code===350?t.objectId=r.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:n},{code:280,name:"isHardOwned",parser:S},{code:100,name:"subclassMarker",parser:n}],IMAGEDEF:jn};function Yn(r,e){let t=[];for(;r.code!==0||!["EOF","ENDSEC"].includes(r.value);){let s=r.value,i=Wn[s];if(r.code===0&&(i!=null&&i.length)){let a=b([...zn,...i]),o={name:s};a(r=e.next(),e,o)?(t.push(o),r=e.peek()):r=e.next()}else r=e.next()}return{byName:_n(t,({name:s})=>s),byTree:function(s){let i=Object.fromEntries(s.map(a=>[a.handle,a]));for(let a of s)(!Tr(a)||a.ownerDictionaryIdSoft!=="0")&&(a.ownerDictionaryIdSoft&&(a.ownerDictionarySoft=i[a.ownerDictionaryIdSoft]),a.ownerDictionaryIdHard&&(a.ownerDictionaryHard=i[a.ownerDictionaryIdHard]),a.ownerObjectId&&(a.ownerObject=i[a.ownerObjectId])),function(o,d){Tr(o)&&o.entries&&(o.entries=Object.fromEntries(o.entries.map(({name:h,objectId:l})=>[h,d[l]])))}(a,i);return s[0]}(t)}}let we=[{code:100,name:"subclassMarker",parser:n},{code:330,name:"ownerObjectId",parser:n},{code:102,parser(r,e){for(;!A(r,0,"EOF")&&!A(r,102,"}");)r=e.next()}},{code:5,name:"handle",parser:n}],Un=b([{code:310,name:"bmpPreview",parser:n},{code:281,name:"scalability",parser:n},{code:280,name:"explodability",parser:n},{code:70,name:"insertionUnits",parser:n},{code:340,name:"layoutObjects",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),Xn=b([...[{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:kt.Above,defaultValueImperial:kt.Center},{name:"DIMZIN",code:78,defaultValue:Ie.Trailing,defaultValueImperial:Ie.Feet},{name:"DIMAZIN",code:79,defaultValue:Os.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:Cs.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Ns.Center},{name:"DIMTZIN",code:284,defaultValue:Ie.Trailing,defaultValueImperial:Ie.Feet},{name:"DIMALTZ",code:285,defaultValue:Ie.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Ie.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}].map(r=>({...r,parser:n})),{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},{code:105,name:"handle",parser:n},...we.filter(r=>r.code!==5)]),Kn=b([{code:347,name:"materialObjectId",parser:n},{code:390,name:"plotStyleNameObjectId",parser:n},{code:370,name:"lineweight",parser:n},{code:290,name:"isPlotting",parser:S},{code:6,name:"lineType",parser:n},{code:62,name:"colorIndex",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),qn=b([{code:9,name:"text",parser:n},{code:45,name:"offsetY",parser:n},{code:44,name:"offsetX",parser:n},{code:50,name:"rotation",parser:n},{code:46,name:"scale",parser:n},{code:340,name:"styleObjectId",parser:n},{code:75,name:"shapeNumber",parser:n},{code:74,name:"elementTypeFlag",parser:n},{code:49,name:"elementLength",parser:n}],{elementTypeFlag:0,elementLength:0}),$n={BLOCK_RECORD:Un,DIMSTYLE:Xn,LAYER:Kn,LTYPE:b([{code:49,name:"pattern",parser(r,e){let t={};return qn(r,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:n},{code:73,name:"numberOfLineTypes",parser:n},{code:72,parser:n},{code:3,name:"description",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),STYLE:b([{code:1e3,name:"extendedFont",parser:n},{code:1001},{code:4,name:"bigFont",parser:n},{code:3,name:"font",parser:n},{code:42,name:"lastHeight",parser:n},{code:71,name:"textGenerationFlag",parser:n},{code:50,name:"obliqueAngle",parser:n},{code:41,name:"widthFactor",parser:n},{code:40,name:"fixedTextHeight",parser:n},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we]),VPORT:b([{code:[63,421,431],name:"ambientColor",parser:n},{code:142,name:"contrast",parser:n},{code:141,name:"brightness",parser:n},{code:282,name:"defaultLightingType",parser:n},{code:292,name:"isDefaultLightingOn",parser:S},{code:348,name:"visualStyleObjectId",parser:n},{code:333,name:"shadePlotObjectId",parser:n},{code:332,name:"backgroundObjectId",parser:n},{code:61,name:"majorGridLines",parser:n},{code:170,name:"shadePlotSetting",parser:n},{code:146,name:"elevation",parser:n},{code:79,name:"orthographicType",parser:n},{code:112,name:"ucsYAxis",parser:p},{code:111,name:"ucsXAxis",parser:p},{code:110,name:"ucsOrigin",parser:p},{code:74,name:"ucsIconSetting",parser:n},{code:71,name:"viewMode",parser:n},{code:281,name:"renderMode",parser:n},{code:1,name:"styleSheet",parser:n},{code:[331,441],name:"frozenLayers",parser:n,isMultiple:!0},{code:72,name:"circleSides",parser:n},{code:51,name:"viewTwistAngle",parser:n},{code:50,name:"snapRotationAngle",parser:n},{code:45,name:"viewHeight",parser:n},{code:44,name:"backClippingPlane",parser:n},{code:43,name:"frontClippingPlane",parser:n},{code:42,name:"lensLength",parser:n},{code:17,name:"viewTarget",parser:p},{code:16,name:"viewDirectionFromTarget",parser:p},{code:15,name:"gridSpacing",parser:p},{code:14,name:"snapSpacing",parser:p},{code:13,name:"snapBasePoint",parser:p},{code:12,name:"center",parser:p},{code:11,name:"upperRightCorner",parser:p},{code:10,name:"lowerLeftCorner",parser:p},{code:70,name:"standardFlag",parser:n},{code:2,name:"name",parser:n},{code:100,name:"subclassMarker",parser:n},...we])},Zn=b([{code:70,name:"maxNumberOfEntries",parser:n},{code:100,name:"subclassMarker",parser:n},{code:330,name:"ownerObjectId",parser:n},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:n},{code:2,name:"name",parser:n}]);function Jn(r,e){var s;let t={};for(;!A(r,0,"EOF")&&!A(r,0,"ENDSEC");){if(A(r,0,"TABLE")){r=e.next();let i={entries:[]};Zn(r,e,i),t[i.name]=i}if(A(r,0)&&!A(r,0,"ENDTAB")){let i=r.value;r=e.next();let a=$n[i];if(!a){console.warn(`parseTable: Invalid table name '${i}'`),r=e.next();continue}let o={};a(r,e,o),(s=t[i])==null||s.entries.push(o)}r=e.next()}return t}function Ze(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class Er{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=Lr(e,this._data[this._pointer++]),s={code:e,value:t};return A(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=Lr(e.code,this._data[this._pointer+1]),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e){Ze(this,"_pointer",void 0),Ze(this,"_data",void 0),Ze(this,"_eof",void 0),Ze(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=e,this._eof=!1}}function Lr(r,e){return r<=9?e:r>=10&&r<=59?parseFloat(e.trim()):r>=60&&r<=99?parseInt(e.trim()):r>=100&&r<=109?e:r>=110&&r<=149?parseFloat(e.trim()):r>=160&&r<=179?parseInt(e.trim()):r>=210&&r<=239?parseFloat(e.trim()):r>=270&&r<=289?parseInt(e.trim()):r>=290&&r<=299?function(t){if(t==="0")return!1;if(t==="1")return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}(e.trim()):r>=300&&r<=369?e:r>=370&&r<=389?parseInt(e.trim()):r>=390&&r<=399?e:r>=400&&r<=409?parseInt(e.trim()):r>=410&&r<=419?e:r>=420&&r<=429?parseInt(e.trim()):r>=430&&r<=439?e:r>=440&&r<=459?parseInt(e.trim()):r>=460&&r<=469?parseFloat(e.trim()):r>=470&&r<=481||r===999||r>=1e3&&r<=1009?e:r>=1010&&r<=1059?parseFloat(e.trim()):r>=1060&&r<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:r,value:e}),e)}function At(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}class Qn{constructor(){At(this,"encoding","utf-8"),At(this,"encodingFailureFatal",!1)}}class ei extends EventTarget{parseSync(e){let t=new Er(e.split(/\r\n|\r|\n/g));if(!t.hasNext())throw Error("Empty file");return this.parseAll(t)}parseStream(e){let t="",s=this;return new Promise((i,a)=>{e.on("data",o=>{t+=o}),e.on("end",()=>{try{let o=t.split(/\r\n|\r|\n/g),d=new Er(o);if(!d.hasNext())throw Error("Empty file");i(s.parseAll(d))}catch(o){a(o)}}),e.on("error",o=>{a(o)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let i=s.body.getReader(),a="";for(;;){let{done:o,value:d}=await i.read();if(o){a+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}a+=this._decoder.decode(d,{stream:!0})}return this.parseSync(a)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!A(s,0,"EOF");)A(s,0,"SECTION")&&(A(s=e.next(),2,"HEADER")?(s=e.next(),t.header=Vn(s,e)):A(s,2,"BLOCKS")?(s=e.next(),t.blocks=Bn(s,e)):A(s,2,"ENTITIES")?(s=e.next(),t.entities=xr(s,e)):A(s,2,"TABLES")?(s=e.next(),t.tables=Jn(s,e)):A(s,2,"OBJECTS")&&(s=e.next(),t.objects=Yn(s,e))),s=e.next();return t}constructor(e=new Qn){super(),At(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var yt=(r=>(r[r.DecimalDegrees=0]="DecimalDegrees",r[r.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",r[r.Gradians=2]="Gradians",r[r.Radians=3]="Radians",r[r.SurveyorsUnits=4]="SurveyorsUnits",r))(yt||{});class oe{static get instance(){return this._instance||(this._instance=new oe),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,s,i=!0,a,o){const d=[];if(t!=null){const h=this.createKey(t.name,s);let l;if(this.has(h))l=this.get(h);else{const m=t.newIterator();for(const _ of m)if(_.color.isByBlock&&s){Dr.copy(_.color),_.color.color=s;const f=_.draw(e);f&&d.push(f),_.color.copy(Dr)}else{const f=_.draw(e);f&&d.push(f)}l=e.group(d),l&&i&&this.set(h,l)}return l&&a&&(l.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),l.applyMatrix(a))),l}else return e.group(d)}}const Dr=new P.AcCmColor,Je="Continuous",Qe="ByLayer",vr="ByBlock";var fe=(r=>(r[r.EndPoint=1]="EndPoint",r[r.MidPoint=2]="MidPoint",r[r.Center=3]="Center",r[r.Node=4]="Node",r[r.Quadrant=5]="Quadrant",r[r.Insertion=7]="Insertion",r[r.Perpendicular=8]="Perpendicular",r[r.Tangent=9]="Tangent",r[r.Nearest=10]="Nearest",r[r.Centroid=11]="Centroid",r))(fe||{}),It=(r=>(r[r.Undefined=0]="Undefined",r[r.Inches=1]="Inches",r[r.Feet=2]="Feet",r[r.Miles=3]="Miles",r[r.Millimeters=4]="Millimeters",r[r.Centimeters=5]="Centimeters",r[r.Meters=6]="Meters",r[r.Kilometers=7]="Kilometers",r[r.Microinches=8]="Microinches",r[r.Mils=9]="Mils",r[r.Yards=10]="Yards",r[r.Angstroms=11]="Angstroms",r[r.Nanometers=12]="Nanometers",r[r.Microns=13]="Microns",r[r.Decimeters=14]="Decimeters",r[r.Dekameters=15]="Dekameters",r[r.Hectometers=16]="Hectometers",r[r.Gigameters=17]="Gigameters",r[r.Astronomical=18]="Astronomical",r[r.LightYears=19]="LightYears",r[r.Parsecs=20]="Parsecs",r[r.USSurveyFeet=21]="USSurveyFeet",r[r.USSurveyInch=22]="USSurveyInch",r[r.USSurveyYard=23]="USSurveyYard",r[r.USSurveyMile=24]="USSurveyMile",r[r.Max=24]="Max",r))(It||{});function ti(r){return r==4||r==5||r==6||r==7||r==12||r==13||r==14||r==15||r==16||r==17}function ri(r){return r==1||r==2||r==3||r==8||r==9||r==10||r==21}var kr=(r=>(r.ClosedFilled="",r.Dot="_DOT",r.DotSmall="_DOTSMALL",r.DotBlank="_DOTBLANK",r.Origin="_ORIGIN",r.Origin2="_ORIGIN2",r.Open="_OPEN",r.Open90="_OPEN90",r.Open30="_OPEN30",r.Closed="_CLOSED",r.Small="_SMALL",r.None="_NONE",r.Oblique="_OBLIQUE",r.BoxFilled="_BOXFILLED",r.Box="_BOXBLANK",r.ClosedBlank="_CLOSEDBLANK",r.DatumBlank="_DATUMBLANK",r.DatumFilled="_DATUMFILLED",r.Integral="_INTEGRAL",r.ArchTick="_ARCHTICK",r))(kr||{});class et{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}const Or="Load Database";class R extends P.AcCmTask{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=P.AcCmPerformanceCollector.getInstance().getEntry(Or),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const i=await this.data.task(e);if(this.progress){const a=i.data;await this.progress(this.data.progress.value,this.data.stage,"END",a),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return t&&(t.data[this.name]=Date.now()-s),i}}class Cr{async read(e,t,s,i){const a={name:Or,data:{total:0},format(){let l="";return Object.keys(this.data).forEach(m=>{m!=="total"&&(l+=`- ${m}: ${this.data[m]} ms
2
- `)}),l+=`- total: ${this.data.total} ms`,l}};P.AcCmPerformanceCollector.getInstance().collect(a),this.progress=i;const o={value:0},d=new P.AcCmTaskScheduler;d.setCompleteCallback(()=>this.onFinished()),d.setErrorCallback(()=>this.onFinished()),d.addTask(new R({stage:"START",step:1,progress:o,task:async l=>l},i)),d.addTask(new R({stage:"PARSE",step:5,progress:o,task:async l=>({model:await this.parse(l)})},i)),d.addTask(new R({stage:"FONT",step:5,progress:o,task:async l=>{const m=this.getFonts(l.model);return{model:l.model,data:m}}},i)),d.addTask(new R({stage:"LTYPE",step:1,progress:o,task:async l=>(this.processLineTypes(l.model,t),l)},i)),d.addTask(new R({stage:"STYLE",step:1,progress:o,task:async l=>(this.processTextStyles(l.model,t),l)},i)),d.addTask(new R({stage:"DIMSTYLE",step:1,progress:o,task:async l=>(this.processDimStyles(l.model,t),l)},i)),d.addTask(new R({stage:"LAYER",step:1,progress:o,task:async l=>(this.processLayers(l.model,t),l)},i)),d.addTask(new R({stage:"VPORT",step:1,progress:o,task:async l=>(this.processViewports(l.model,t),l)},i)),d.addTask(new R({stage:"HEADER",step:1,progress:o,task:async l=>(this.processHeader(l.model,t),l)},i)),d.addTask(new R({stage:"BLOCK_RECORD",step:5,progress:o,task:async l=>(this.processBlockTables(l.model,t),l)},i)),d.addTask(new R({stage:"OBJECT",step:5,progress:o,task:async l=>(this.processObjects(l.model,t),l)},i)),d.addTask(new R({stage:"BLOCK",step:5,progress:o,task:async l=>(await this.processBlocks(l.model,t),l)},i)),d.addTask(new R({stage:"ENTITY",step:100,progress:o,task:async l=>(await this.processEntities(l.model,t,s,o,i),l)},i)),d.addTask(new R({stage:"END",step:0,progress:o,task:async l=>l},i));const h=Date.now();await d.run(e),a.data.total=Date.now()-h}onFinished(){this.progress&&(this.progress(100,"END","END"),oe.instance.clear())}parse(e){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,s,i,a){throw new Error("Not impelemented yet!")}}for(var _e=256,Nr=[],Mr=256,tt;_e--;)Nr[_e]=(_e+256).toString(16).substring(1);function si(r){var e=0,t=11;if(!tt||_e+t>Mr*2)for(tt="",_e=0;e<Mr;e++)tt+=Nr[Math.random()*256|0];return tt.substring(_e,_e+++t)}class ce{constructor(e,t){e=e||{},je.defaults(e,{objectId:si()}),this._attrs=new P.AcCmObject(e,t)}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get database(){return this._database?this._database:Dt().workingDatabase}set database(e){this._database=e}close(){}}class U extends ce{constructor(){super(...arguments),this._layer="0",this._color=new P.AcCmColor,this._lineType=Qe,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.name.substring(4)}get layer(){return this._layer}set layer(e){this._layer=e}get color(){return this._color}set color(e){this._color.copy(e)}get rgbColor(){let e=this.database.cecolor;if(this.color.isByLayer){const t=this.getLayerColor();t&&t.color&&(e=t)}else this.color.isByBlock||this.color.color!=null&&(e=this.color);return e.color==null?16777215:e.color}get lineType(){return this._lineType}set lineType(e){this._lineType=e||Qe}get lineWeight(){return this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,s,i,a){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const e=this.getLineType(),t=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(e);return t?{...t.linetype,color:this.rgbColor}:{name:e,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Qe){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==vr?Je:this.lineType;return Je}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return e.color;return null}}class wt extends U{constructor(e){super(),this._blockName=e,this._position=new c.AcGePoint3d,this._rotation=0,this._normal=new c.AcGeVector3d(0,0,1),this._scaleFactors=new c.AcGePoint3d(1,1,1)}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const e=new c.AcGeBox3d,t=this.blockTableRecord;if(t!=null){const a=t.newIterator();for(const o of a)e.union(o.geometricExtents)}const s=new c.AcGeQuaternion().setFromEuler(new c.AcGeEuler(this.rotation,0,0)),i=new c.AcGeMatrix3d;return i.compose(this.position,s,this.scaleFactors),e.applyMatrix4(i),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const i=this.computeTransformMatrix();return oe.instance.draw(e,s,this.rgbColor,!0,i,this.normal)}else return e.group(t)}computeTransformMatrix(){const e=new c.AcGeQuaternion;return e.setFromAxisAngle(c.AcGeVector3d.Z_AXIS,this.rotation),new c.AcGeMatrix3d().compose(this._position,e,this._scaleFactors)}}class Y extends U{}class Fr extends Y{constructor(e,t,s,i,a,o,d){super(),this._geo=new c.AcGeEllipseArc3d(e,t,s,i,a,o,d)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(e){return e.ellipticalArc(this._geo,this.lineStyle)}}class Rr extends Y{constructor(e,t,s,i){super(),this._geo=new c.AcGeCircArc3d(e,t,s,i,c.AcGeVector3d.Z_AXIS,c.AcGeVector3d.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}}class Br extends Y{constructor(e,t,s=c.AcGeVector3d.Z_AXIS){super(),this._geo=new c.AcGeCircArc3d(e,t,0,c.TAU,s,c.AcGeVector3d.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}}var Gr=(r=>(r[r.UserDefined=0]="UserDefined",r[r.Predefined=1]="Predefined",r[r.Custom=2]="Custom",r))(Gr||{}),Vr=(r=>(r[r.Normal=0]="Normal",r[r.Outer=1]="Outer",r[r.Ignore=2]="Ignore",r))(Vr||{});class jr extends U{constructor(){super(),this._elevation=0,this._geo=new c.AcGeArea2d,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e}get patternType(){return this._patternType}set patternType(e){this._patternType=e}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e}add(e){this._geo.add(e)}get geometricExtents(){const e=this._geo.box;return new c.AcGeBox3d({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){return e.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}}var Hr=(r=>(r[r.MText=0]="MText",r[r.Fcf=1]="Fcf",r[r.BlockReference=2]="BlockReference",r[r.NoAnnotation=3]="NoAnnotation",r))(Hr||{});class zr extends Y{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}appendVertex(e){this._vertices.push(new c.AcGePoint3d().copy(e)),this._updated=!0}setVertexAt(e,t){throw(e<0||e>=this._vertices.length)&&(this._vertices[e].copy(t),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(e){throw(e<0||e>=this._vertices.length)&&this._vertices[e],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new c.AcGeBox3d().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}draw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t,this.lineStyle)}else return e.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new c.AcGeSpline3d(this._vertices,"Uniform"),this._updated=!1)}}class Wr extends Y{constructor(e,t){super(),this._geo=new c.AcGeLine3d(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,s,i,a){const o=this.startPoint,d=this.endPoint;switch(e){case fe.EndPoint:a.push(o),a.push(d);break;case fe.MidPoint:a.push(this.midPoint);break;case fe.Nearest:{const h=this._geo.project(s);a.push(h)}break;case fe.Perpendicular:{const h=this._geo.perpPoint(s);a.push(h)}break;case fe.Tangent:a.push(o);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,i=[new c.AcGePoint3d(t.x,t.y,0),new c.AcGePoint3d(s.x,s.y,0)];return e.lines(i,this.lineStyle)}}class Yr extends U{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 c.AcGePoint3d,this._attachmentPoint=B.AcGiMTextAttachmentPoint.TopLeft,this._direction=new c.AcGeVector3d(1,0,0),this._drawingDirection=B.AcGiMTextFlowDirection.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new c.AcGeBox3d}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e){const t={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},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class Pt extends Y{constructor(e,t,s){super();const i=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(i!=2&&i!=3)throw P.AcCmErrors.ILLEGAL_PARAMETERS;i==2&&!Array.isArray(t)?this._geo=new c.AcGeSpline3d(e,t):this._geo=new c.AcGeSpline3d(e,t,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}draw(e){const t=this._geo.getPoints(100);return e.lines(t,this.lineStyle)}}const ni=new c.AcGeVector3d;class Ur extends wt{constructor(e,t,s){super(e),this._attachmentPoint=B.AcGiMTextAttachmentPoint.TopLeft,this._numColumns=s,this._numRows=t,this._columnWidth=new Array(s),this._rowHeight=new Array(t),this._cells=new Array(t*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,s){return this._cells[e*t].text}setTextString(e,t,s){this._cells[e*t].text=s}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new c.AcGeBox3d}draw(e){let t=0,s=0;const i=new Uint16Array(this.numColumns*this.numRows*8),a=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let o=0;for(let f=0;f<=this.numRows;f++){t-=f>0?this.rowHeight(f-1):0,s=0;for(let I=0;I<=this.numColumns;I++)s+=I>0?this.columnWidth(I-1):0,a[o++]=s,a[o++]=t,a[o++]=0}const d=[],h=new Array(this.numRows*this.numColumns).fill(!1);s=0,o=0;let l=0;for(let f=0;f<this.numColumns;f++){s+=f>0?this.columnWidth(f-1):0,t=0;for(let I=0;I<this.numRows;I++){t+=I>0?this.rowHeight(I-1):0;const y=this.cell(I*this.numColumns+f);if(l=I*this.numColumns+f,y&&!h[l]){const L=y.borderWidth??1,C=y.borderHeight??1;this.fillVisited(h,l,this.numColumns,L,C),i[o++]=f+I*(this.numColumns+1),i[o++]=f+I*(this.numColumns+1)+L;const K=a[i[o-1]*3]-s,de=f+(I+C)*(this.numColumns+1)+L;f+L==this.numColumns&&(i[o++]=f+I*(this.numColumns+1)+L,i[o++]=de);const q=-a[de*3+1]-t;if(I+C==this.numRows&&(i[o++]=f+(I+C)*(this.numColumns+1)+C,i[o++]=f+(I+C)*(this.numColumns+1)),i[o++]=f+(I+C)*(this.numColumns+1),i[o++]=f+I*(this.numColumns+1),y.text){const xe=y.attachmentPoint||this.attachmentPoint||B.AcGiMTextAttachmentPoint.MiddleCenter,Ve=this.getTableTextOffset(xe,K,q),di={text:y.text,height:y.textHeight,width:K,position:ni.set(s,-t,0).clone().add(Ve),rotation:this.rotation,attachmentPoint:xe},li={...this.getTextStyle(y),color:this.color.color};d.push(e.mtext(di,li))}}}}d.push(e.lineSegments(a,3,i,this.lineStyle));const m=e.group(d),_=new c.AcGeQuaternion;return _.setFromAxisAngle(c.AcGeVector3d.Z_AXIS,this.rotation),Xr.compose(this.position,_,this.scaleFactors),m.applyMatrix(Xr),m}fillVisited(e,t,s,i,a){if(a==1&&i==1)e[t]=!0;else for(let o=0;o<i;++o)for(let d=0;d<a;++d)e[t+o+d*s]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let s;return e.textStyle&&(s=t.getAt(e.textStyle)),s||(s=t.getAt("STANDARD")||t.getAt("Standard")),s.textStyle}getTableTextOffset(e,t,s){const i=new c.AcGeVector3d;switch(e){case 1:break;case 2:i.setX(t/2);break;case 3:i.setX(t);break;case 4:i.setY(-s/2);break;case 5:i.set(t/2,-s/2,0);break;case 6:i.set(t,-s/2,0);break;case 7:i.setY(-s);break;case 8:i.set(t/2,-s,0);break;case 9:i.set(t,-s,0);break}return i}}const Xr=new c.AcGeMatrix3d;var Kr=(r=>(r[r.LEFT=0]="LEFT",r[r.CENTER=1]="CENTER",r[r.RIGHT=2]="RIGHT",r[r.ALIGNED=3]="ALIGNED",r[r.MIDDLE=4]="MIDDLE",r[r.FIT=5]="FIT",r))(Kr||{}),qr=(r=>(r[r.BASELINE=0]="BASELINE",r[r.BOTTOM=1]="BOTTOM",r[r.MIDDLE=2]="MIDDLE",r[r.TOP=3]="TOP",r))(qr||{});class $r extends U{constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new c.AcGePoint3d,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new c.AcGeBox3d}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e){const t={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:B.AcGiMTextFlowDirection.BOTTOM_TO_TOP,attachmentPoint:B.AcGiMTextAttachmentPoint.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class Zr extends Y{constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new c.AcGePoint3d,new c.AcGePoint3d,new c.AcGePoint3d,new c.AcGePoint3d]}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new c.AcGeBox3d().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<4;++t)e.push(this.getPointAt(t));return e}draw(e){const t=new c.AcGePolyline2d(this._vertices,!0),s=new c.AcGeArea2d;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class Jr extends Y{constructor(){super(),this._elevation=0,this._geo=new c.AcGePolyline2d}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,s=0,i=-1,a=-1){const o=i<0?void 0:i,d=a<0?void 0:a,h={x:t.x,y:t.y,bulge:s,startWidth:o,endWidth:d};this._geo.addVertexAt(e,h)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new c.AcGePoint3d(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new c.AcGeBox3d({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}draw(e){const t=[];return this._geo.getPoints(100).forEach(i=>t.push(new c.AcGePoint3d().set(i.x,i.y,this.elevation))),e.lines(t,this.lineStyle)}}class Qr extends U{constructor(){super(),this._geo=new c.AcGePoint3d}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new c.AcGeBox3d().expandByPoint(this._geo)}transformBy(e){return this._geo.applyMatrix3d(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}}var es=(r=>(r[r.Invalid=0]="Invalid",r[r.Rect=1]="Rect",r[r.Poly=2]="Poly",r))(es||{}),ts=(r=>(r[r.Show=1]="Show",r[r.ShowUnAligned=2]="ShowUnAligned",r[r.Clip=4]="Clip",r[r.Transparent=8]="Transparent",r))(ts||{});class xt extends U{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new c.AcGePoint3d,this._scale=new c.AcGeVector2d(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new c.AcGeBox3d;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}draw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t,this.lineStyle)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,s=this._height,i=new c.AcGeBox2d;i.setFromPoints(this._clipBoundary);const a=new c.AcGePoint2d;a.setX(this._position.x-i.min.x*t),a.setY(this._position.y-i.min.y*s),this._clipBoundary.forEach(o=>{const d=o.x*t+a.x,h=o.y*s+a.y;e.push(new c.AcGePoint3d(d,h,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){rs.copy(e[1]);for(let t=1;t<4;t++)rt.copy(e[t]),rt.rotateAround(rs,this._rotation),e[t].setX(rt.x),e[t].setY(rt.y)}e.push(e[0])}return e}}const rs=new c.AcGePoint2d,rt=new c.AcGePoint2d;class ss extends Y{constructor(){super(),this._basePoint=new c.AcGePoint3d,this._unitDir=new c.AcGeVector3d}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new c.AcGeBox3d;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}}class ns extends U{constructor(){super(),this._centerPoint=new c.AcGePoint3d,this._height=0,this._width=0,this._viewCenter=new c.AcGePoint3d,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new c.AcGeBox3d}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new B.AcGiViewport;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const s=[];return s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new c.AcGePoint3d(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}}class is extends xt{draw(e){const t=this.boundaryPath(),s=new c.AcGeArea2d;return s.add(new c.AcGePolyline2d(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class as extends Y{constructor(){super(),this._basePoint=new c.AcGePoint3d,this._unitDir=new c.AcGeVector3d}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new c.AcGeBox3d;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}}var os=(r=>(r[r.AtLeast=1]="AtLeast",r[r.Exactly=2]="Exactly",r))(os||{});class be extends U{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new c.AcGePoint3d,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new Ge),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}draw(e){if(this.dimBlockId){const t=this.database.tables.blockTable.getAt(this.dimBlockId);if(t)return oe.instance.draw(e,t,this.rgbColor,!1)}return e.group([])}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return oe.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return oe.instance.draw(e,t,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}getLineArrowStyle(e){}findPointOnLine1(e,t,s){const i=new c.AcGePoint3d().subVectors(t,e).normalize();return new c.AcGePoint3d(t).addScaledVector(i,s)}findPointOnLine2(e,t,s){const i=e.x+s*Math.cos(t),a=e.y+s*Math.sin(t);return{x:i,y:a}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():B.AcGiArrowType.Closed}}class cs extends be{constructor(e,t,s,i,a=null,o=null){super(),this._centerPoint=new c.AcGePoint3d().copy(e),this._xLine1Point=new c.AcGePoint3d().copy(t),this._xLine2Point=new c.AcGePoint3d().copy(s),this._arcPoint=new c.AcGePoint3d().copy(i),this.dimensionText=a,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new c.AcGeBox3d}}class ds extends be{constructor(e,t,s,i=null,a=null){super(),this._dimLinePoint=new c.AcGePoint3d().copy(s),this._xLine1Point=new c.AcGePoint3d().copy(e),this._xLine2Point=new c.AcGePoint3d().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=i,this.dimensionStyleName=a}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get geometricExtents(){return new c.AcGeBox3d}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),i=this.findIntersectionPoint(t,this._dimLinePoint),a=this.findIntersectionPoint(s,this._dimLinePoint),o=new c.AcGeLine3d(i,a);return e.push(o),t.endPoint=i,this.adjustExtensionLine(t),e.push(t),s.endPoint=a,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new c.AcGeLine3d(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,i=e.endPoint,a=new c.AcGeVector3d().subVectors(i,s).normalize(),d=new c.AcGeVector3d().subVectors(t,s).dot(a),h=new c.AcGeVector3d().copy(a).multiplyScalar(d);return new c.AcGeVector3d().addVectors(s,h)}}class ii extends be{constructor(e,t,s,i,a=null,o=null){super(),this._arcPoint=new c.AcGePoint3d().copy(i),this._xLine1Point=new c.AcGePoint3d().copy(t),this._xLine2Point=new c.AcGePoint3d().copy(s),this._centerPoint=new c.AcGePoint3d().copy(e),this.dimensionText=a,this.dimensionStyleName=o}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new c.AcGeBox3d}}class ls extends be{constructor(e,t,s=0,i=null,a=null){super(),this._chordPoint=new c.AcGePoint3d().copy(e),this._farChordPoint=new c.AcGePoint3d().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=i,this.dimensionStyleName=a}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}get geometricExtents(){return new c.AcGeBox3d}drawLines(e,t){const s=[],i=t.length;return i==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):i==3?(this.sortLines(t),s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(e,t[1])),s.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(a=>{s.push(this.drawLine(e,a))}),s}drawLine(e,t,s){if(s){const i=[t.startPoint,t.endPoint];return e.lines(i,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,i)=>s.x!==i.x?s.x-i.x:s.y!==i.y?s.y-i.y:s.z-i.z;e.sort((s,i)=>{const a=t(s.startPoint,i.startPoint);return a!==0?a:t(s.endPoint,i.endPoint)})}}class hs extends be{constructor(e,t,s=null,i=null){super(),this._definingPoint=new c.AcGePoint3d().copy(e),this._leaderEndPoint=new c.AcGePoint3d().copy(t),this.dimensionText=s,this.dimensionStyleName=i}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get geometricExtents(){return new c.AcGeBox3d}get arrowLineCount(){return 0}}class us extends be{constructor(e,t,s,i=null,a=null){super(),this._center=new c.AcGePoint3d().copy(e),this._chordPoint=new c.AcGePoint3d().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=i,this.dimensionStyleName=a}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLenght(e){this._leaderLength=e}get geometricExtents(){return new c.AcGeBox3d}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}}class ps{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="ARC"?this.convertArc(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"||e.type=="LWPOLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertArc(e){return new Rr(e.center,e.radius,c.AcGeMathUtil.degToRad(e.startAngle),c.AcGeMathUtil.degToRad(e.endAngle))}convertCirle(e){return new Br(e.center,e.radius)}convertEllipse(e){const t=new c.AcGeVector3d(e.majorAxisEndPoint),s=t.length();return new Fr(e.center,c.AcGeVector3d.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new Wr(new c.AcGePoint3d(t.x,t.y,t.z||0),new c.AcGePoint3d(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){const t=new Pt(e.controlPoints,e.knots,e.weights);return t.closed=!!(e.flag&1),t}else if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null){const s=new Pt(t,"Uniform");return s.closed=!!(e.flag&1),s}}return null}convertPoint(e){const t=new Qr;return t.position=e.position,t}convertSolid(e){const t=new Zr;return e.points.forEach((s,i)=>t.setPointAt(i,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new Jr;return t.closed=!!(e.flag&1),e.vertices.forEach((s,i)=>{t.addVertexAt(i,new c.AcGePoint2d(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var i;const t=new jr;return(i=e.definitionLines)==null||i.forEach(a=>{t.definitionLines.push({angle:a.angle,origin:a.base,delta:a.offset,dashPattern:a.numberOfDashLengths>0?a.dashLengths:[]})}),t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:e.patternAngle,t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(a=>{if(a.boundaryPathTypeFlag&2){const d=a,h=new c.AcGePolyline2d;h.closed=d.isClosed,d.vertices.forEach((l,m)=>{h.addVertexAt(m,{x:l.x,y:l.y,bulge:l.bulge})}),t.add(h)}else{const d=a,h=new c.AcGeLoop2d;d.edges.forEach(l=>{if(l.type==1){const m=l;h.add(new c.AcGeLine2d(m.start,m.end))}else if(l.type==2){const m=l;h.add(new c.AcGeCircArc2d(m.center,m.radius,c.AcGeMathUtil.degToRad(m.startAngle||0),c.AcGeMathUtil.degToRad(m.endAngle||0),!m.isCCW))}else if(l.type==3){const m=l;new c.AcGeVector2d().subVectors(m.end,m.center);const f=Math.sqrt(Math.pow(m.end.x,2)+Math.pow(m.end.y,2)),I=f*m.lengthOfMinorAxis;let y=c.AcGeMathUtil.degToRad(m.startAngle||0),L=c.AcGeMathUtil.degToRad(m.endAngle||0);const C=Math.atan2(m.end.y,m.end.x);m.isCCW||(y=Math.PI*2-y,L=Math.PI*2-L),h.add(new c.AcGeEllipseArc2d({...m.center,z:0},f,I,y,L,!m.isCCW,C))}else if(l.type==4){const m=l;if(m.numberOfControlPoints>0&&m.numberOfKnots>0){const _=m.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let f=!0;const I=m.controlPoints.map(y=>(y.weight==null&&(f=!1),y.weight||1));h.add(new c.AcGeSpline3d(_,m.knots,f?I:void 0))}else if(m.numberOfFitData>0){const _=m.fitDatum.map(f=>({x:f.x,y:f.y,z:0}));h.add(new c.AcGeSpline3d(_,"Uniform"))}}}),t.add(h)}}),t}convertTable(e){const t=new Ur(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,i)=>t.setColumnWidth(i,s)),e.rowHeightArr.forEach((s,i)=>t.setRowHeight(i,s)),e.cells.forEach((s,i)=>{t.setCell(i,s)}),t}convertText(e){const t=new $r;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=c.AcGeMathUtil.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new Yr;return t.contents=e.text.join(""),e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=c.AcGeMathUtil.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new c.AcGeVector3d(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new zr;return e.vertices.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName,t.annoType=e.leaderCreationFlag,t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"||e.subclassMarker=="AcDbRotatedDimension"){const t=e,s=new ds(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=c.AcGeMathUtil.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new cs(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new hs(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new us(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new ls(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageDefId=e.imageDefHandle,t.isClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,e.clippingBoundaryPath.forEach(s=>{t.clipBoundary.push(new c.AcGePoint2d(s))}),t.clipBoundaryType=e.clippingBoundaryType,t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new xt;return this.processImage(e,t),t}convertWipeout(e){const t=new is;return this.processImage(e,t),t}convertViewport(e){const t=new ns;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new ss;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertXline(e){const t=new as;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertBlockReference(e){const t=new wt(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?c.AcGeMathUtil.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement}processCommonAttrs(e,t){t.layer=e.layer,t.objectId=e.handle,t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&(t.color.color=e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName!=null&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=e.transparency)}numberArrayToPointArray(e,t){const s=e.length;let i=0;if(s/2==t?i=2:s/3==t&&(i=3),i==0)return;const a=[];for(let o=0,d=s/i;o<d;++o)a.push({x:e[o*i],y:e[o*i+1],z:i==3?e[o*i+2]:void 0});return a}}class St extends ce{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new c.AcGeBox2d,this._extents=new c.AcGeBox3d}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}}class Tt extends ce{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(e){return this.getAt(e)?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,i)=>{s===t&&this._recordsByName.delete(i)}),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new et(this._recordsByName)}}class ms extends Tt{getBtrIdAt(e){for(const[t,s]of this._recordsByName)if(s.blockTableRecordId==e)return s}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class gs extends ce{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class ai{convertLayout(e){const t=new St;return t.layoutName=e.layoutName,t.tabOrder=e.tabOrder,t.blockTableRecordId=e.ownerObjectId,t.limits.min.copy(e.minLimit),t.limits.max.copy(e.maxLimit),t.extents.min.copy(e.minExtent),t.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,t),t}convertImageDef(e){const t=new gs;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class fs extends Cr{parse(e){return new ei().parseSync(e)}getFonts(e){var a;const t=new Map,s=o=>{if(o){const d=o.lastIndexOf(".");return d>=0?o.substring(0,d).toLowerCase():o.toLowerCase()}};(a=e.tables.STYLE)==null||a.entries.forEach(o=>{const d=[];let h=s(o.font);h&&d.push(h),h=s(o.bigFont),h&&d.push(h),t.set(o.name,d)});const i=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,i),Array.from(i)}getFontsInBlock(e,t,s,i){const a=/\\f(.*?)\|/g;e.forEach(o=>{if(o.type=="MTEXT"){const d=o;[...d.text.join("").matchAll(a)].forEach(m=>{i.add(m[1].toLowerCase())});const l=s.get(d.styleName);l==null||l.forEach(m=>i.add(m))}else if(o.type=="TEXT"){const d=o,h=s.get(d.styleName);h==null||h.forEach(l=>i.add(l))}else if(o.type=="INSERT"){const h=t[o.name];h&&h.entities&&this.getFontsInBlock(h.entities,t,s,i)}})}async processEntities(e,t,s,i,a){const o=new ps,d=e.entities,h=d.length,l=new vt(h,100-i.value,s),m=t.tables.blockTable.modelSpace,_=t.tables.blockTable;await l.processChunk(async(f,I)=>{for(let y=f;y<I;y++){const L=d[y],C=o.convert(L);if(C){let K=m;L.ownerBlockRecordSoftId!=null&&(K=_.getIdAt(L.ownerBlockRecordSoftId)||K),K.appendEntity(C)}}if(a){let y=i.value+I/h*(100-i.value);y>100&&(y=100),await a(y,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t,s){const i=new ps,a=e.length;for(let o=0;o<a;o++){const d=e[o],h=i.convert(d);if(h){let l=t;d.ownerBlockRecordSoftId!=null&&(l=s.getIdAt(d.ownerBlockRecordSoftId)||l),l.appendEntity(h)}}}processBlocks(e,t){const s=e.blocks;for(const[i,a]of Object.entries(s)){let o=t.tables.blockTable.getAt(a.name);o||(o=new ie,o.objectId=a.handle,o.name=i,o.origin.copy(a.position),t.tables.blockTable.add(o)),a.entities&&this.processEntitiesInBlock(a.entities,o,t.tables.blockTable)}}processHeader(e,t){const s=e.header;t.cecolor.colorIndex=s.$CECOLOR||256,t.angBase=s.$ANGBASE||0,t.angDir=s.$ANGDIR||0,t.aunits=s.$AUNITS,t.insunits=s.$INSUNITS,t.pdmode=s.$PDMODE||0,t.pdsize=s.$PDSIZE||0}processBlockTables(e,t){var i;const s=(i=e.tables.BLOCK_RECORD)==null?void 0:i.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(a=>{const o=new ie;o.objectId=a.handle,o.name=a.name,t.tables.blockTable.add(o)}))}processObjects(e,t){const s=e.objects.byName,i=new ai;if("LAYOUT"in s){const a=t.dictionaries.layouts;s.LAYOUT.forEach(o=>{const d=i.convertLayout(o);a.setAt(d.layoutName,d)})}if("IMAGEDEF"in s){const a=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(o=>{const d=i.convertImageDef(o);a.setAt(d.objectId,d)})}}processViewports(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.VPORT)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new vs;this.processCommonTableEntryAttrs(o,d),o.circleSides&&(d.circleSides=o.circleSides),d.standardFlag=o.standardFlag,d.center.copy(o.center),d.lowerLeftCorner.copy(o.lowerLeftCorner),d.upperRightCorner.copy(o.upperRightCorner),o.snapBasePoint&&d.snapBase.copy(o.snapBasePoint),o.snapRotationAngle&&(d.snapAngle=o.snapRotationAngle),o.snapSpacing&&d.snapIncrements.copy(o.snapSpacing),o.majorGridLines&&(d.gridMajor=o.majorGridLines),o.gridSpacing&&d.gridIncrements.copy(o.gridSpacing),o.backgroundObjectId&&(d.backgroundObjectId=o.backgroundObjectId),d.gsView.center.copy(o.center),d.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget),d.gsView.viewTarget.copy(o.viewTarget),o.lensLength&&(d.gsView.lensLength=o.lensLength),o.frontClippingPlane&&(d.gsView.frontClippingPlane=o.frontClippingPlane),o.backClippingPlane&&(d.gsView.backClippingPlane=o.backClippingPlane),o.viewHeight&&(d.gsView.viewHeight=o.viewHeight),o.viewTwistAngle&&(d.gsView.viewTwistAngle=o.viewTwistAngle),o.frozenLayers&&(d.gsView.frozenLayers=o.frozenLayers),o.styleSheet&&(d.gsView.styleSheet=o.styleSheet),o.renderMode&&(d.gsView.renderMode=o.renderMode),o.viewMode&&(d.gsView.viewMode=o.viewMode),o.ucsIconSetting&&(d.gsView.ucsIconSetting=o.ucsIconSetting),o.ucsOrigin&&d.gsView.ucsOrigin.copy(o.ucsOrigin),o.ucsXAxis&&d.gsView.ucsXAxis.copy(o.ucsXAxis),o.ucsYAxis&&d.gsView.ucsYAxis.copy(o.ucsYAxis),o.orthographicType&&(d.gsView.orthographicType=o.orthographicType),o.shadePlotSetting&&(d.gsView.shadePlotSetting=o.shadePlotSetting),o.shadePlotObjectId&&(d.gsView.shadePlotObjectId=o.shadePlotObjectId),o.visualStyleObjectId&&(d.gsView.visualStyleObjectId=o.visualStyleObjectId),o.isDefaultLightingOn&&(d.gsView.isDefaultLightingOn=o.isDefaultLightingOn),o.defaultLightingType&&(d.gsView.defaultLightingType=o.defaultLightingType),o.brightness&&(d.gsView.brightness=o.brightness),o.contrast&&(d.gsView.contrast=o.contrast),o.ambientColor&&(d.gsView.ambientColor=o.ambientColor),t.tables.viewportTable.add(d)})}processLayers(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.LAYER)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new P.AcCmColor;d.colorIndex=o.colorIndex;const h=new Lt({name:o.name,standardFlags:o.standardFlag,linetype:o.lineType,lineWeight:o.lineweight,isOff:o.colorIndex<0,color:d,isPlottable:o.isPlotting});this.processCommonTableEntryAttrs(o,h),t.tables.layerTable.add(h)})}processLineTypes(e,t){var i,a;const s=(a=(i=e.tables)==null?void 0:i.LTYPE)==null?void 0:a.entries;s&&s.length>0&&s.forEach(o=>{const d=new Ls(o);this.processCommonTableEntryAttrs(o,d),d.name=o.name,t.tables.linetypeTable.add(d)})}processTextStyles(e,t){var i;const s=(i=e.tables.STYLE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new Ds(a);this.processCommonTableEntryAttrs(a,o),t.tables.textStyleTable.add(o)})}processDimStyles(e,t){var i;const s=(i=e.tables.DIMSTYLE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o={name:a.name,ownerId:a.ownerObjectId,dimpost:a.DIMPOST||"",dimapost:a.DIMAPOST||"",dimscale:a.DIMSCALE,dimasz:a.DIMASZ,dimexo:a.DIMEXO,dimdli:a.DIMDLI,dimexe:a.DIMEXE,dimrnd:a.DIMRND,dimdle:a.DIMDLE,dimtp:a.DIMTP,dimtm:a.DIMTM,dimtxt:a.DIMTXT,dimcen:a.DIMCEN,dimtsz:a.DIMTSZ,dimaltf:a.DIMALTF,dimlfac:a.DIMLFAC,dimtvp:a.DIMTVP,dimtfac:a.DIMTFAC,dimgap:a.DIMGAP,dimaltrnd:a.DIMALTRND,dimtol:a.DIMTOL==null||a.DIMTOL==0?0:1,dimlim:a.DIMLIM==null||a.DIMLIM==0?0:1,dimtih:a.DIMTIH==null||a.DIMTIH==0?0:1,dimtoh:a.DIMTOH==null||a.DIMTOH==0?0:1,dimse1:a.DIMSE1==null||a.DIMSE1==0?0:1,dimse2:a.DIMSE2==null||a.DIMSE2==0?0:1,dimtad:a.DIMTAD,dimzin:a.DIMZIN,dimazin:a.DIMAZIN,dimalt:a.DIMALT,dimaltd:a.DIMALTD,dimtofl:a.DIMTOFL,dimsah:a.DIMSAH,dimtix:a.DIMTIX,dimsoxd:a.DIMSOXD,dimclrd:a.DIMCLRD,dimclre:a.DIMCLRE,dimclrt:a.DIMCLRT,dimadec:a.DIMADEC||0,dimunit:a.DIMUNIT||2,dimdec:a.DIMDEC,dimtdec:a.DIMTDEC,dimaltu:a.DIMALTU,dimalttd:a.DIMALTTD,dimaunit:a.DIMAUNIT,dimfrac:a.DIMFRAC,dimlunit:a.DIMLUNIT,dimdsep:a.DIMDSEP,dimtmove:a.DIMTMOVE||0,dimjust:a.DIMJUST,dimsd1:a.DIMSD1,dimsd2:a.DIMSD2,dimtolj:a.DIMTOLJ,dimtzin:a.DIMTZIN,dimaltz:a.DIMALTZ,dimalttz:a.DIMALTTZ,dimfit:a.DIMFIT||0,dimupt:a.DIMUPT,dimatfit:a.DIMATFIT,dimtxsty:a.DIMTXSTY||"Standard",dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},d=new Ge(o);this.processCommonTableEntryAttrs(a,d),t.tables.dimStyleTable.add(d)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}}var Et=(r=>(r.DXF="dxf",r.DWG="dwg",r))(Et||{});class X{constructor(){this.events={registered:new P.AcCmEventManager,unregistered:new P.AcCmEventManager},this._converters=new Map,this.register("dxf",new fs)}static createInstance(){return X._instance==null&&(X._instance=new X),this._instance}static get instance(){return X._instance||(X._instance=new X),X._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}class Ae extends ce{constructor(e,t){e=e||{},je.defaults(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const Pe=class Pe extends Ae{constructor(){super(),this._origin=new c.AcGePoint3d,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==Pe.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(Pe.PAPER_SPACE_NAME_PREFIX.toLowerCase())}get origin(){return this._origin}set origin(e){this._origin.copy(e)}appendEntity(e){e.database=this.database,e.ownerId=this.objectId,this._entities.set(e.objectId,e),(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}newIterator(){return new et(this._entities)}getIdAt(e){return this._entities.get(e)}};Pe.MODEL_SPACE_NAME="*Model_Space",Pe.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let ie=Pe;class ye extends ce{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}add(e){e.database=this.database,this._recordsByName.set(e.name,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this._recordsByName.get(e);return t?(this._recordsById.delete(t.objectId),this._recordsByName.delete(e),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(t.name),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e)}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){let t;return this._recordsById.forEach((s,i)=>{s.ownerId==e&&(t=this._recordsById.get(i))}),t}newIterator(){return new et(this._recordsByName)}}class _s extends ye{constructor(e){super(e)}get modelSpace(){let e=this.getAt(ie.MODEL_SPACE_NAME);return e||(e=new ie,e.name=ie.MODEL_SPACE_NAME,this.add(e)),e}}class bs extends ye{constructor(e){super(e)}}class Lt extends Ae{constructor(e,t){e=e||{},je.defaults(e,{color:new P.AcCmColor,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==1}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e)}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}}class As extends ye{constructor(e){super(e);const t=new P.AcCmColor;t.color=16777215;const s=new Lt({name:"0",standardFlags:0,linetype:Je,lineWeight:1,isOff:!1,color:t,isPlottable:!0});this.add(s)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class ys extends ye{constructor(e){super(e)}}class Is extends ye{constructor(e){super(e)}get fonts(){const e=new Set,t=i=>{if(i){const a=i.lastIndexOf(".");if(a>=0){const o=i.substring(0,a).toLowerCase();e.add(o)}else e.add(i.toLowerCase())}},s=this.newIterator();for(const i of s)t(i.fileName),t(i.bigFontFileName);return Array.from(e)}}class ws extends ye{constructor(e){super(e)}}class oi extends ce{constructor(){super(),this.events={entityAppended:new P.AcCmEventManager,entityModified:new P.AcCmEventManager,layerAppended:new P.AcCmEventManager,layerModified:new P.AcCmEventManager,layerErased:new P.AcCmEventManager,openProgress:new P.AcCmEventManager,headerSysVarChanged:new P.AcCmEventManager},this._angBase=0,this._angDir=0,this._aunits=yt.DecimalDegrees,this._celtscale=1,this._cecolor=new P.AcCmColor,this._insunits=It.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new _s(this),dimStyleTable:new bs(this),linetypeTable:new ys(this),textStyleTable:new Is(this),layerTable:new As(this),viewportTable:new ws(this)},this._dictionaries={layouts:new ms(this),imageDefs:new Tt(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this._aunits=e||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(e){this._insunits=e||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(e){this._ltscale=e||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(e){this._cecolor=e||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(e){this._celtscale=e||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(e){this._angBase=e||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(e){this._angDir=e||0,this.triggerHeaderSysVarChangedEvent("angdir")}get pdmode(){return this._pdmode}set pdmode(e){this._pdmode=e||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(e){this._pdsize=e||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(e,t,s=Et.DXF){const i=X.instance.get(s);if(i==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await i.read(e,this,t&&t.minimumChunkSize||10,async(a,o,d,h)=>{if(this.events.openProgress.dispatch({database:this,percentage:a,stage:o,stageStatus:d}),t&&t.fontLoader&&o=="FONT"&&d=="END"){const l=h||this.tables.textStyleTable.fonts;await t.fontLoader.load(l)}})}async openUri(e,t){const i=await(await fetch(e)).blob(),a=new FileReader;a.onload=o=>{var h;const d=(h=o.target)==null?void 0:h.result;d&&this.read(d,t)},a.readAsText(i)}clear(){this.tables.blockTable.removeAll(),this.tables.dimStyleTable.removeAll(),this.tables.layerTable.removeAll(),this.tables.linetypeTable.removeAll(),this.tables.textStyleTable.removeAll(),this.tables.viewportTable.removeAll(),this.dictionaries.layouts.removeAll(),this._currentSpace=void 0}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}}var Ps=(r=>(r[r.Center=0]="Center",r[r.Left=1]="Left",r[r.Right=2]="Right",r[r.OverFirst=3]="OverFirst",r[r.OverSecond=4]="OverSecond",r))(Ps||{}),xs=(r=>(r[r.Center=0]="Center",r[r.Above=1]="Above",r[r.Outside=2]="Outside",r[r.JIS=3]="JIS",r[r.Below=4]="Below",r))(xs||{}),Ss=(r=>(r[r.Feet=0]="Feet",r[r.None=1]="None",r[r.Inch=2]="Inch",r[r.FeetAndInch=3]="FeetAndInch",r[r.Leading=4]="Leading",r[r.Trailing=8]="Trailing",r[r.LeadingAndTrailing=12]="LeadingAndTrailing",r))(Ss||{}),Ts=(r=>(r[r.None=0]="None",r[r.Leading=1]="Leading",r[r.Trailing=2]="Trailing",r[r.LeadingAndTrailing=3]="LeadingAndTrailing",r))(Ts||{}),Es=(r=>(r[r.Bottom=0]="Bottom",r[r.Middle=1]="Middle",r[r.Top=2]="Top",r))(Es||{});const nt=class nt extends Ae{constructor(e,t){e=e||{},je.defaults(e,nt.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}};nt.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 Ge=nt;class Ls extends Ae{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}}class Ds extends Ae{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const s=t.lastIndexOf(".");return s===-1?t:t.substring(0,s)}return e}}const ci={center:new c.AcGePoint2d,viewDirectionFromTarget:new c.AcGePoint3d(0,0,1),viewTarget:new c.AcGePoint3d(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:B.AcGiRenderMode.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new c.AcGePoint3d(0,0,0),ucsXAxis:new c.AcGePoint3d(1,0,0),ucsYAxis:new c.AcGePoint3d(0,1,0),orthographicType:B.AcGiOrthographicType.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:B.AcGiDefaultLightingType.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class vs extends Ae{constructor(){super(),this._circleSides=100,this._center=new c.AcGePoint2d,this._lowerLeftCorner=new c.AcGePoint2d(0,0),this._upperRightCorner=new c.AcGePoint2d(1,1),this._snapBase=new c.AcGePoint2d(0,0),this._snapAngle=0,this._snapSpacing=new c.AcGePoint2d(0,0),this._standardFlag=0,this._gridSpacing=new c.AcGePoint2d,this._gridMajor=10,this._gsView=ci}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get gsView(){return this._gsView}}class ks{constructor(){this.events={layoutSwitched:new P.AcCmEventManager}}countLayouts(e){return this.getWorkingDatabase(e).dictionaries.layouts.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const s=this.getWorkingDatabase(t),i=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(i,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),i=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(i,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),i=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(i,s)}renameLayout(e,t,s){const a=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return a?(a.layoutName=t,!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.remove(e)}createLayout(e,t){const s=this.getWorkingDatabase(t),i=new St;i.layoutName=e,i.tabOrder=s.dictionaries.layouts.maxTabOrder;const a=new ie;return a.name=`*Paper_Space${i.tabOrder}`,s.tables.blockTable.add(a),s.dictionaries.layouts.setAt(e,i),{layout:i,btr:a}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||Dt().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function Dt(){return st.instance}const it=class it{constructor(){this._workingDatabase=null,this._layoutManager=new ks}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager}};it.instance=new it;let st=it;u.AcDb3PointAngularDimension=cs,u.AcDbAlignedDimension=ds,u.AcDbAngleUnits=yt,u.AcDbArc=Rr,u.AcDbArcDimension=ii,u.AcDbBatchProcessing=vt,u.AcDbBlockReference=wt,u.AcDbBlockTable=_s,u.AcDbBlockTableRecord=ie,u.AcDbCircle=Br,u.AcDbCurve=Y,u.AcDbDatabase=oi,u.AcDbDatabaseConverter=Cr,u.AcDbDatabaseConverterManager=X,u.AcDbDiametricDimension=ls,u.AcDbDictionary=Tt,u.AcDbDimArrowType=kr,u.AcDbDimStyleTable=bs,u.AcDbDimStyleTableRecord=Ge,u.AcDbDimTextHorizontal=Ps,u.AcDbDimTextVertical=xs,u.AcDbDimVerticalJustification=Es,u.AcDbDimZeroSuppression=Ss,u.AcDbDimZeroSuppressionAngular=Ts,u.AcDbDimension=be,u.AcDbDxfConverter=fs,u.AcDbEllipse=Fr,u.AcDbEntity=U,u.AcDbFileType=Et,u.AcDbHatch=jr,u.AcDbHatchPatternType=Gr,u.AcDbHatchStyle=Vr,u.AcDbHostApplicationServices=st,u.AcDbLayerTable=As,u.AcDbLayerTableRecord=Lt,u.AcDbLayout=St,u.AcDbLayoutDictionary=ms,u.AcDbLayoutManager=ks,u.AcDbLeader=zr,u.AcDbLeaderAnnotationType=Hr,u.AcDbLine=Wr,u.AcDbLineSpacingStyle=os,u.AcDbLinetypeTable=ys,u.AcDbLinetypeTableRecord=Ls,u.AcDbMText=Yr,u.AcDbObject=ce,u.AcDbObjectIterator=et,u.AcDbOrdinateDimension=hs,u.AcDbOsnapMode=fe,u.AcDbPoint=Qr,u.AcDbPolyline=Jr,u.AcDbRadialDimension=us,u.AcDbRasterImage=xt,u.AcDbRasterImageClipBoundaryType=es,u.AcDbRasterImageDef=gs,u.AcDbRasterImageImageDisplayOpt=ts,u.AcDbRay=ss,u.AcDbRenderingCache=oe,u.AcDbSpline=Pt,u.AcDbSymbolTable=ye,u.AcDbSymbolTableRecord=Ae,u.AcDbTable=Ur,u.AcDbText=$r,u.AcDbTextHorizontalMode=Kr,u.AcDbTextStyleTable=Is,u.AcDbTextStyleTableRecord=Ds,u.AcDbTextVerticalMode=qr,u.AcDbTrace=Zr,u.AcDbUnitsValue=It,u.AcDbViewport=ns,u.AcDbViewportTable=ws,u.AcDbViewportTableRecord=vs,u.AcDbWipeout=is,u.AcDbXline=as,u.ByBlock=vr,u.ByLayer=Qe,u.DEFAULT_LINE_TYPE=Je,u.acdbHostApplicationServices=Dt,u.isImperialUnits=ri,u.isMetricUnits=ti,Object.keys(P).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>P[r]})}),Object.keys(c).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>c[r]})}),Object.keys(B).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(u,r)&&Object.defineProperty(u,r,{enumerable:!0,get:()=>B[r]})}),Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(g,ht){typeof exports=="object"&&typeof module<"u"?ht(exports):typeof define=="function"&&define.amd?define(["exports"],ht):(g=typeof globalThis<"u"?globalThis:g||self,ht(g["data-model"]={}))})(this,function(g){"use strict";function ht(n,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in n)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}const Ct={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_s=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function ct(n,e,t){return Math.max(e,Math.min(t,n))}const dn=class oa{constructor(){this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(e){e==null?this._color=null:(this._color=Math.round(ct(e,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let e=this._color.toString(16).toUpperCase();for(;e.length<6;)e="0"+e;return`0x${e}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color?this.color>>16&255:null}get green(){return this.color?this.color>>8&255:null}get blue(){return this.color?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(e){e==null?this._colorIndex=null:(this._colorIndex=ct(e,0,256),this._color=_s[e],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(e){if(e){const t=Ct[e.toLowerCase()];t!==void 0?(this._colorName=e,this._color=t,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+e)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(e){return this.setRGB(e,e,e),this}setRGB(e,t,s){const r=Math.round(ct(e,0,255)),i=Math.round(ct(t,0,255)),a=Math.round(ct(s,0,255));return this.color=(r<<16)+(i<<8)+a,this}setColorName(e){const t=Ct[e.toLowerCase()];return t!==void 0?this.color=t:console.warn("Unknown color "+e),this}clone(){const e=new oa;return e.colorIndex=this.colorIndex,e.color=this.color,e._colorName=this._colorName,this}copy(e){return this.colorIndex=e.colorIndex,this.color=e.color,this._colorName=e._colorName,this}equals(e){return e.color==this.color&&e.colorIndex==this.colorIndex&&e._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(e){for(const[t,s]of Object.entries(Ct))if(s===e)return t;return null}getColorIndexByValue(e){const t=_s.length-1;for(let s=1;s<t;++s)if(_s[s]===e)return s;return null}};dn.NAMES=Ct;let Ne=dn;const te={get ILLEGAL_PARAMETERS(){return new ReferenceError("Illegal Parameters")},get ZERO_DIVISION(){return new Error("Zero division")},get UNRESOLVED_BOUNDARY_CONFLICT(){return new Error("Unresolved boundary conflict in boolean operation")},get INFINITE_LOOP(){return new Error("Infinite loop")},get CANNOT_INVOKE_ABSTRACT_METHOD(){return new Error("Abstract method cannot be invoked")},get OPERATION_IS_NOT_SUPPORTED(){return new Error("Operation is not supported")},get NOT_IMPLEMENTED(){return new Error("Not implemented yet")}};class ma{constructor(){this._listeners={}}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const t=this._listeners[e.type];if(t!==void 0){e.target=this;const s=t.slice(0);for(let r=0,i=s.length;r<i;r++)s[r].call(this,e)}}}let se=class{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}removeEventListener(e){this.listeners=this.listeners.filter(t=>t!==e)}replaceEventListener(e){this.removeEventListener(e),this.addEventListener(e)}dispatch(e,...t){for(const s of this.listeners)s.call(null,e,...t)}};var ga=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pa(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var un={exports:{}};(function(n){(function(e,t){n.exports?n.exports=t():e.log=t()})(ga,function(){var e=function(){},t="undefined",s=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),r=["trace","debug","info","warn","error"],i={},a=null;function o(_,x){var f=_[x];if(typeof f.bind=="function")return f.bind(_);try{return Function.prototype.bind.call(f,_)}catch{return function(){return Function.prototype.apply.apply(f,[_,arguments])}}}function c(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function h(_){return _==="debug"&&(_="log"),typeof console===t?!1:_==="trace"&&s?c:console[_]!==void 0?o(console,_):console.log!==void 0?o(console,"log"):e}function d(){for(var _=this.getLevel(),x=0;x<r.length;x++){var f=r[x];this[f]=x<_?e:this.methodFactory(f,_,this.name)}if(this.log=this.debug,typeof console===t&&_<this.levels.SILENT)return"No console available for logging"}function u(_){return function(){typeof console!==t&&(d.call(this),this[_].apply(this,arguments))}}function m(_,x,f){return h(_)||u.apply(this,arguments)}function p(_,x){var f=this,k,T,S,I="loglevel";typeof _=="string"?I+=":"+_:typeof _=="symbol"&&(I=void 0);function z(C){var V=(r[C]||"silent").toUpperCase();if(!(typeof window===t||!I)){try{window.localStorage[I]=V;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+V+";"}catch{}}}function P(){var C;if(!(typeof window===t||!I)){try{C=window.localStorage[I]}catch{}if(typeof C===t)try{var V=window.document.cookie,Ze=encodeURIComponent(I),Qe=V.indexOf(Ze+"=");Qe!==-1&&(C=/^([^;]+)/.exec(V.slice(Qe+Ze.length+1))[1])}catch{}return f.levels[C]===void 0&&(C=void 0),C}}function W(){if(!(typeof window===t||!I)){try{window.localStorage.removeItem(I)}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function le(C){var V=C;if(typeof V=="string"&&f.levels[V.toUpperCase()]!==void 0&&(V=f.levels[V.toUpperCase()]),typeof V=="number"&&V>=0&&V<=f.levels.SILENT)return V;throw new TypeError("log.setLevel() called with invalid level: "+C)}f.name=_,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=x||m,f.getLevel=function(){return S??T??k},f.setLevel=function(C,V){return S=le(C),V!==!1&&z(S),d.call(f)},f.setDefaultLevel=function(C){T=le(C),P()||f.setLevel(C,!1)},f.resetLevel=function(){S=null,W(),d.call(f)},f.enableAll=function(C){f.setLevel(f.levels.TRACE,C)},f.disableAll=function(C){f.setLevel(f.levels.SILENT,C)},f.rebuild=function(){if(a!==f&&(k=le(a.getLevel())),d.call(f),a===f)for(var C in i)i[C].rebuild()},k=le(a?a.getLevel():"WARN");var Me=P();Me!=null&&(S=le(Me)),d.call(f)}a=new p,a.getLogger=function(_){if(typeof _!="symbol"&&typeof _!="string"||_==="")throw new TypeError("You must supply a name when creating a logger.");var x=i[_];return x||(x=i[_]=new p(_,a.methodFactory)),x};var y=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=y),a},a.getLoggers=function(){return i},a.default=a,a})})(un);var mn=un.exports;const ya=pa(mn),_a=ht({__proto__:null,default:ya},[mn]),fa=!0,dt=_a;dt.setLevel("debug");const xa=n=>{try{dt.setLevel(n)}catch(e){dt.setLevel("error"),dt.error(e)}};function ut(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function Je(n,...e){for(const t of e)if(t)for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n[s]===void 0&&(n[s]=t[s]);return n}function gn(n,e){return n!=null&&Object.prototype.hasOwnProperty.call(n,e)}function pn(n){return n==null?!0:Array.isArray(n)||typeof n=="string"?n.length===0:n instanceof Map||n instanceof Set?n.size===0:typeof n=="object"?Object.keys(n).length===0:!1}function et(n,e){if(n===e)return!0;if(n==null||e==null)return n===e;if(typeof n!=typeof e)return!1;if(typeof n!="object")return n===e;if(Array.isArray(n)!==Array.isArray(e))return!1;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(let r=0;r<n.length;r++)if(!et(n[r],e[r]))return!1;return!0}const t=Object.keys(n),s=Object.keys(e);if(t.length!==s.length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(e,r)||!et(n[r],e[r]))return!1;return!0}let yn=class la{constructor(e,t){this.events={attrChanged:new se,modelChanged:new se},this._changing=!1,this._previousAttributes={},this._pending=!1;const s=e||{};t&&Je(s,t),this.attributes=s,this.changed={}}get(e){return this.attributes[e]}set(e,t,s){if(e==null)return this;let r;typeof e=="object"?(r=e,s=t):(r={},r[e]=t),s||(s={});const i=s.unset,a=s.silent,o=[],c=this._changing;this._changing=!0,c||(this._previousAttributes=ut(this.attributes),this.changed={});const h=this.attributes,d=this.changed,u=this._previousAttributes;for(const m in r)t=r[m],et(h[m],t)||o.push(m),et(u[m],t)?delete d[m]:d[m]=t,i?delete h[m]:h[m]=t;if(!a){o.length&&(this._pending=s);for(let m=0;m<o.length;m++)this.events.attrChanged.dispatch({object:this,attrName:o[m],attrValue:h[o[m]],options:s})}if(c)return this;if(!a)for(;this._pending;)s=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:s});return this._pending=!1,this._changing=!1,this}has(e){return this.get(e)!=null}hasChanged(e){return e==null?!pn(this.changed):gn(this.changed,e)}changedAttributes(e){if(!e)return this.hasChanged()?ut(this.changed):{};const t=this._changing?this._previousAttributes:this.attributes,s={};for(const r in e){const i=e[r];et(t[r],i)||(s[r]=i)}return s}previous(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]}previousAttributes(){return ut(this._previousAttributes)}clone(){const e=ut(this.attributes);return new la(e)}},fs=class Ot{constructor(){this.entries=new Map}static getInstance(){return Ot.instance||(Ot.instance=new Ot),Ot.instance}collect(e){this.entries.set(e.name,e)}printAll(){for(const[e,t]of this.entries)console.log(`${e}:`),console.log(t.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(e){return this.entries.get(e)}remove(e){return this.entries.delete(e)}};class ba{static formatBytes(e,t=2){if(e===0)return"0 B";const s=1024,r=Math.max(0,t),i=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(e)/Math.log(s)),o=e/Math.pow(s,a);return`${parseFloat(o.toFixed(r))} ${i[a]}`}}class _n{constructor(e){this.name=e}run(e){throw new Error("run() must be implemented by subclass")}}class fn{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>{}}addTask(e){this.tasks.push(e)}setProgressCallback(e){this.onProgress=e}setCompleteCallback(e){this.onComplete=e}setErrorCallback(e){this.onError=e}async run(e){const t=this.tasks.length;let s=e;for(let r=0;r<t;r++){const i=this.tasks[r];try{s=await new Promise((a,o)=>{setTimeout(async()=>{try{const c=await i.run(s);this.onProgress((r+1)/t,i),a(c)}catch(c){o(c)}},0)})}catch(a){this.onError(a,r,i);return}}this.onComplete(s)}}let xn=class{constructor(e,t,s){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=s}itemStart(e){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(e,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(e){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(e,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(e){this.onError!==void 0&&this.onError(e)}resolveURL(e){return this.urlModifier?this.urlModifier(e):e}setURLModifier(e){return this.urlModifier=e,this}addHandler(e,t){return this.handlers.push(e,t),this}removeHandler(e){const t=this.handlers.indexOf(e);return t!==-1&&this.handlers.splice(t,2),this}getHandler(e){for(let t=0,s=this.handlers.length;t<s;t+=2){const r=this.handlers[t],i=this.handlers[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}};const bn=new xn;let Aa=class{constructor(e){this.manager=e!==void 0?e:bn,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(e,t){return new Promise((s,r)=>{this.load(e,s,t,r)})}parse(e){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};class An{constructor(e,t,s){this._chunkSize=-1,this._minimumChunkSize=50,this._count=e,this._numerOfChunk=t<1?1:t,this._minimumChunkSize=s,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(e){this._minimumChunkSize=e,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let e=this._count/this._numerOfChunk;e<this._minimumChunkSize&&(e=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=e<1?this._count:Math.floor(e)}scheduleTask(e){typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(e):setTimeout(e,0)}async processChunk(e){let t=0;const s=async()=>{const r=t,i=Math.min(t+this._chunkSize,this._count);await e(r,i),t=i,t<this._count&&this.scheduleTask(s)};await s()}}var Y,mt,j,U,gt,he,Z,ye,ce,Re,pt,yt,ze,Fe,_t,ft,xt,ne,_e,R,Be,bt,E,Q,At,J,fe,wt,xe,de,It,Ve,re,be,xs,bs,Ae,Pt,Et,we,Tt,As,ws,je,q,Ie,X,ie,Is,Ps,Es,Ts,Ss,Ms;(Y={})[Y.None=0]="None",Y[Y.Anonymous=1]="Anonymous",Y[Y.NonConstant=2]="NonConstant",Y[Y.Xref=4]="Xref",Y[Y.XrefOverlay=8]="XrefOverlay",Y[Y.ExternallyDependent=16]="ExternallyDependent",Y[Y.ResolvedOrDependent=32]="ResolvedOrDependent",Y[Y.ReferencedXref=64]="ReferencedXref",(mt={})[mt.BYBLOCK=0]="BYBLOCK",mt[mt.BYLAYER=256]="BYLAYER",(j={})[j.Rotated=0]="Rotated",j[j.Aligned=1]="Aligned",j[j.Angular=2]="Angular",j[j.Diameter=3]="Diameter",j[j.Radius=4]="Radius",j[j.Angular3Point=5]="Angular3Point",j[j.Ordinate=6]="Ordinate",j[j.ReferenceIsExclusive=32]="ReferenceIsExclusive",j[j.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",j[j.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag",(U={})[U.TopLeft=1]="TopLeft",U[U.TopCenter=2]="TopCenter",U[U.TopRight=3]="TopRight",U[U.MiddleLeft=4]="MiddleLeft",U[U.MiddleCenter=5]="MiddleCenter",U[U.MiddleRight=6]="MiddleRight",U[U.BottomLeft=7]="BottomLeft",U[U.BottomCenter=8]="BottomCenter",U[U.BottomRight=9]="BottomRight",(gt={})[gt.AtLeast=1]="AtLeast",gt[gt.Exact=2]="Exact";var wn=((he={})[he.Center=0]="Center",he[he.Above=1]="Above",he[he.Outside=2]="Outside",he[he.JIS=3]="JIS",he[he.Below=4]="Below",he),tt=((Z={})[Z.Feet=0]="Feet",Z[Z.None=1]="None",Z[Z.Inch=2]="Inch",Z[Z.FeetAndInch=3]="FeetAndInch",Z[Z.Leading=4]="Leading",Z[Z.Trailing=8]="Trailing",Z[Z.LeadingAndTrailing=12]="LeadingAndTrailing",Z),wa=((ye={})[ye.None=0]="None",ye[ye.Leading=1]="Leading",ye[ye.Trailing=2]="Trailing",ye[ye.LeadingAndTrailing=3]="LeadingAndTrailing",ye),Ia=((ce={})[ce.Center=0]="Center",ce[ce.Left=1]="Left",ce[ce.Right=2]="Right",ce[ce.OverFirst=3]="OverFirst",ce[ce.OverSecond=4]="OverSecond",ce),Pa=((Re={})[Re.Bottom=0]="Bottom",Re[Re.Center=1]="Center",Re[Re.Top=2]="Top",Re);(pt={})[pt.PatternFill=0]="PatternFill",pt[pt.SolidFill=1]="SolidFill",(yt={})[yt.NonAssociative=0]="NonAssociative",yt[yt.Associative=1]="Associative",(ze={})[ze.Normal=0]="Normal",ze[ze.Outer=1]="Outer",ze[ze.Ignore=2]="Ignore",(Fe={})[Fe.UserDefined=0]="UserDefined",Fe[Fe.Predefined=1]="Predefined",Fe[Fe.Custom=2]="Custom",(_t={})[_t.NotAnnotated=0]="NotAnnotated",_t[_t.Annotated=1]="Annotated",(ft={})[ft.Solid=0]="Solid",ft[ft.Gradient=1]="Gradient",(xt={})[xt.TwoColor=0]="TwoColor",xt[xt.OneColor=1]="OneColor";var Ea=((ne={})[ne.Default=0]="Default",ne[ne.External=1]="External",ne[ne.Polyline=2]="Polyline",ne[ne.Derived=4]="Derived",ne[ne.Textbox=8]="Textbox",ne[ne.Outermost=16]="Outermost",ne),Dt=((_e={})[_e.Line=1]="Line",_e[_e.Circular=2]="Circular",_e[_e.Elliptic=3]="Elliptic",_e[_e.Spline=4]="Spline",_e),Ta=((R={})[R.Off=0]="Off",R[R.Solid=1]="Solid",R[R.Dashed=2]="Dashed",R[R.Dotted=3]="Dotted",R[R.ShotDash=4]="ShotDash",R[R.MediumDash=5]="MediumDash",R[R.LongDash=6]="LongDash",R[R.DoubleShortDash=7]="DoubleShortDash",R[R.DoubleMediumDash=8]="DoubleMediumDash",R[R.DoubleLongDash=9]="DoubleLongDash",R[R.DoubleMediumLongDash=10]="DoubleMediumLongDash",R[R.SparseDot=11]="SparseDot",R);Ta.Off,(Be={})[Be.Standard=-3]="Standard",Be[Be.ByLayer=-2]="ByLayer",Be[Be.ByBlock=-1]="ByBlock",(bt={})[bt.English=0]="English",bt[bt.Metric=1]="Metric",(E={})[E.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",E[E.FRONT_CLIPPING=2]="FRONT_CLIPPING",E[E.BACK_CLIPPING=4]="BACK_CLIPPING",E[E.UCS_FOLLOW=8]="UCS_FOLLOW",E[E.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",E[E.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",E[E.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",E[E.FAST_ZOOM=128]="FAST_ZOOM",E[E.SNAP_MODE=256]="SNAP_MODE",E[E.GRID_MODE=512]="GRID_MODE",E[E.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",E[E.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",E[E.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",E[E.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",E[E.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",E[E.UNUSED=32768]="UNUSED",E[E.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",E[E.VIEWPORT_OFF=131072]="VIEWPORT_OFF",E[E.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",E[E.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",E[E.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",E[E.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE",(Q={})[Q.OPTIMIZED_2D=0]="OPTIMIZED_2D",Q[Q.WIREFRAME=1]="WIREFRAME",Q[Q.HIDDEN_LINE=2]="HIDDEN_LINE",Q[Q.FLAT_SHADED=3]="FLAT_SHADED",Q[Q.GOURAUD_SHADED=4]="GOURAUD_SHADED",Q[Q.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",Q[Q.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",(At={})[At.UCS_UNCHANGED=0]="UCS_UNCHANGED",At[At.HAS_OWN_UCS=1]="HAS_OWN_UCS",(J={})[J.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",J[J.TOP=1]="TOP",J[J.BOTTOM=2]="BOTTOM",J[J.FRONT=3]="FRONT",J[J.BACK=4]="BACK",J[J.LEFT=5]="LEFT",J[J.RIGHT=6]="RIGHT",(fe={})[fe.AS_DISPLAYED=0]="AS_DISPLAYED",fe[fe.WIREFRAME=1]="WIREFRAME",fe[fe.HIDDEN=2]="HIDDEN",fe[fe.RENDERED=3]="RENDERED",(wt={})[wt.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",wt[wt.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";function L(n,e,t){return n.code===e&&(t==null||n.value===t)}function D(n){let e={};n.rewind();let t=n.next(),s=t.code;if(e.x=t.value,(t=n.next()).code!==s+10)throw Error("Expected code for point value to be 20 but got "+t.code+".");return e.y=t.value,(t=n.next()).code!==s+20?n.rewind():e.z=t.value,e}let vs=Symbol();function M(n,e){return(t,s,r)=>{let i=n.reduce((c,h)=>{h.pushContext&&c.push({});let d=c[c.length-1];for(let u of typeof h.code=="number"?[h.code]:h.code){let m=d[u]??(d[u]=[]);h.isMultiple&&m.length&&console.warn(`Snippet ${m.at(-1).name} for code(${u}) is shadowed by ${h.name}`),m.push(h)}return c},[{}]),a=!1,o=i.length-1;for(;!L(t,0,"EOF");){let c=function(y,_,x){return y.find((f,k)=>{var T;return k>=x&&((T=f[_])==null?void 0:T.length)})}(i,t.code,o),h=c==null?void 0:c[t.code].at(-1);if(!c||!h){s.rewind();break}h.isMultiple||c[t.code].pop();let{name:d,parser:u,isMultiple:m}=h,p=u==null?void 0:u(t,s,r);if(p===vs){s.rewind();break}if(d){let[y,_]=function(x,f){let k=f.split("."),T=x;for(let S=0;S<k.length-1;++S){let I=k[S];Object.hasOwn(T,I)||(T[I]={}),T=T[I]}return[T,k.at(-1)]}(r,d);m?(Object.hasOwn(y,_)||(y[_]=[]),y[_].push(p)):y[_]=p}h.pushContext&&(o-=1),a=!0,t=s.next()}return e&&Object.setPrototypeOf(r,e),a}}function l({value:n}){return n}function b(n,e){return D(e)}function F({value:n}){return!!n}var In=[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 Pn(n,e){var r;if(!L(n,1001))throw Error("XData must starts with code 1001");let t={appName:n.value,value:[]};n=e.next();let s=[t.value];for(;!L(n,0,"EOF")&&n.code>=1e3;){let i=s.at(-1);switch(n.code){case 1002:n.value==="{"?s.push([]):(s.pop(),(r=s.at(-1))==null||r.push(i));break;case 1e3:case 1004:case 1040:case 1070:case 1071:i.push({type:Pe(n.code),value:n.value});break;case 1003:i.push({name:"layer",type:Pe(n.code),value:n.value});break;case 1005:i.push({name:"handle",type:Pe(n.code),value:n.value});break;case 1010:i.push({type:Pe(n.code),value:D(e)});break;case 1011:i.push({name:"worldSpacePosition",type:Pe(n.code),value:D(e)});break;case 1012:i.push({name:"worldSpaceDisplacement",type:Pe(n.code),value:D(e)});break;case 1013:i.push({name:"worldSpaceDirection",type:Pe(n.code),value:D(e)});break;case 1041:i.push({name:"distance",type:Pe(n.code),value:n.value});break;case 1042:i.push({name:"scale",type:Pe(n.code),value:n.value})}n=e.next()}return e.rewind(),t}function Pe(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 Ls(n,e,t){if(L(e,102))return Nt(e,t),!0;switch(e.code){case 0:n.type=e.value;break;case 5:n.handle=e.value;break;case 330:n.ownerDictionarySoftId?n.ownerBlockRecordSoftId=e.value:n.ownerDictionarySoftId=e.value;break;case 360:n.ownerdictionaryHardId=e.value;break;case 67:n.isInPaperSpace=!!e.value;break;case 8:n.layer=e.value;break;case 6:n.lineType=e.value;break;case 347:n.materialObjectHardId=e.value;break;case 62:n.colorIndex=e.value,n.color=In[Math.abs(e.value)];break;case 370:n.lineweight=e.value;break;case 48:n.lineTypeScale=e.value;break;case 60:n.isVisible=!!e.value;break;case 92:n.proxyByte=e.value;break;case 310:n.proxyEntity=e.value;break;case 100:break;case 420:n.color=e.value;break;case 430:n.transparency=e.value;break;case 390:n.plotStyleHardId=e.value;break;case 284:n.shadowMode=e.value;break;case 1001:n.xdata=Pn(e,t);break;default:return!1}return!0}let Sa=0;function En(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=Sa++)}(xe={})[xe.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",xe[xe.CAST=1]="CAST",xe[xe.RECEIVE=2]="RECEIVE",xe[xe.IGNORE=3]="IGNORE";let G=[{code:1001,name:"xdata",parser:Pn},{code:284,name:"shadowMode",parser:l},{code:390,name:"plotStyleHardId",parser:l},{code:440,name:"transparency",parser:l},{code:430,name:"colorName",parser:l},{code:420,name:"color",parser:l},{code:310,name:"proxyEntity",isMultiple:!0,parser:l},{code:92,name:"proxyByte",parser:l},{code:60,name:"isVisible",parser:F},{code:48,name:"lineTypeScale",parser:l},{code:370,name:"lineweight",parser:l},{code:62,name:"colorIndex",parser(n,e,t){let s=n.value;return t.color=In[Math.abs(s)],s}},{code:347,name:"materialObjectHardId",parser:l},{code:6,name:"lineType",parser:l},{code:8,name:"layer",parser:l},{code:410,name:"layoutTabName",parser:l},{code:67,name:"isInPaperSpace",parser:F},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:l},{code:102,parser:Nt},{code:102,parser:Nt},{code:102,parser:Nt},{code:5,name:"handle",parser:l}];function Nt(n,e){for(n=e.next();!L(n,102)&&!L(n,0,"EOF");)n=e.next()}function Tn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ma={extrusionDirection:{x:0,y:0,z:1}},va=[{code:210,name:"extrusionDirection",parser:b},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:100,name:"subclassMarker",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100},...G];class Sn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Tn(this,"parser",M(va,Ma))}}Tn(Sn,"ForEntityName","ARC"),(de={})[de.NONE=0]="NONE",de[de.INVISIBLE=1]="INVISIBLE",de[de.CONSTANT=2]="CONSTANT",de[de.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",de[de.PRESET=8]="PRESET",(It={})[It.MULTILINE=2]="MULTILINE",It[It.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE",(Ve={})[Ve.NONE=0]="NONE",Ve[Ve.MIRRORED_X=2]="MIRRORED_X",Ve[Ve.MIRRORED_Y=4]="MIRRORED_Y";var La=((re={})[re.LEFT=0]="LEFT",re[re.CENTER=1]="CENTER",re[re.RIGHT=2]="RIGHT",re[re.ALIGNED=3]="ALIGNED",re[re.MIDDLE=4]="MIDDLE",re[re.FIT=5]="FIT",re),ka=((be={})[be.BASELINE=0]="BASELINE",be[be.BOTTOM=1]="BOTTOM",be[be.MIDDLE=2]="MIDDLE",be[be.TOP=3]="TOP",be);function Mn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let vn={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:La.LEFT,valign:ka.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Ln=[{code:73,name:"valign",parser:l},{code:100},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:72,name:"valign",parser:l},{code:72,name:"halign",parser:l},{code:71,name:"generationFlag",parser:l},{code:7,name:"styleName",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"xScale",parser:l},{code:50,name:"rotation",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class kn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Mn(this,"parser",M(Ln,vn))}}function On(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Mn(kn,"ForEntityName","TEXT");let Oa={...vn},Ca=[{code:2},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedRecord",parser:F},{code:100},{code:280,name:"isLocked",parser:F},{code:74,name:"valign",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:3,name:"prompt",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},...Ln.slice(2)];class Cn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){On(this,"parser",M(Ca,Oa))}}function Dn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}On(Cn,"ForEntityName","ATTDEF");let Da={thickness:0,extrusionDirection:{x:0,y:0,z:1}},Na=[{code:210,name:"extrusionDirection",parser:b},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Nn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Dn(this,"parser",M(Na,Da))}}Dn(Nn,"ForEntityName","CIRCLE");let Rt=class{parseEntity(e,t){let s={};for(;!L(t,0,"EOF");){if(t.code===0){e.rewind();break}(function(r,i,a){switch(i.code){case 100:r.subclassMarker=i.value;break;case 280:r.version=i.value;break;case 2:r.name=i.value;break;case 10:r.definitionPoint=D(a);break;case 11:r.textPoint=D(a);break;case 12:r.insertionPoint=D(a);break;case 13:r.subDefinitionPoint1=D(a);break;case 14:r.subDefinitionPoint2=D(a);break;case 15:r.centerPoint=D(a);break;case 16:r.arcPoint=D(a);break;case 70:r.dimensionType=i.value;break;case 71:r.attachmentPoint=i.value;break;case 72:r.textLineSpacingStyle=i.value;break;case 40:r.leaderLength=i.value;break;case 41:r.textLineSpacingFactor=i.value;break;case 42:r.measurement=i.value;break;case 1:r.text=i.value;break;case 50:r.rotationAngle=i.value;break;case 52:r.obliqueAngle=i.value;break;case 53:r.textRotation=i.value;break;case 51:r.ocsRotation=i.value;break;case 210:r.extrusionDirection=D(a);break;case 3:r.styleName=i.value;break;default:Ls(r,i,a)}})(s,t,e),t=e.next()}return s}};function Rn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}bs="DIMENSION",(xs="ForEntityName")in Rt?Object.defineProperty(Rt,xs,{value:bs,enumerable:!0,configurable:!0,writable:!0}):Rt[xs]=bs;let Ra={extrusionDirection:{x:0,y:0,z:1}},za=[{code:42,name:"endAngle",parser:l},{code:41,name:"startAngle",parser:l},{code:40,name:"axisRatio",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"majorAxisEndPoint",parser:b},{code:10,name:"center",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class zn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Rn(this,"parser",M(za,Ra))}}Rn(zn,"ForEntityName","ELLIPSE");let Fn=[{code:330,name:"sourceBoundaryObjects",parser:l,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:l}],Fa=[{code:11,name:"end",parser:b},{code:10,name:"start",parser:b}],Ba=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"radius",parser:l},{code:10,name:"center",parser:b}],Va=[{code:73,name:"isCCW",parser:F},{code:51,name:"endAngle",parser:l},{code:50,name:"startAngle",parser:l},{code:40,name:"lengthOfMinorAxis",parser:l},{code:11,name:"end",parser:b},{code:10,name:"center",parser:b}],ja=[{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:11,name:"fitDatum",isMultiple:!0,parser:b},{code:97,name:"numberOfFitData",parser:l},{code:10,name:"controlPoints",isMultiple:!0,parser(n,e){let t={...D(e),weight:1};return(n=e.next()).code===42?t.weight=n.value:e.rewind(),t}},{code:40,name:"knots",isMultiple:!0,parser:l},{code:96,name:"numberOfControlPoints",parser:l},{code:95,name:"numberOfKnots",parser:l},{code:74,name:"isPeriodic",parser:F},{code:73,name:"splineFlag",parser:l},{code:94,name:"degree",parser:l}],Ga={[Dt.Line]:Fa,[Dt.Circular]:Ba,[Dt.Elliptic]:Va,[Dt.Spline]:ja},Ha=[...Fn,{code:72,name:"edges",parser(n,e){let t={type:n.value},s=M(Ga[t.type]);if(!s)throw Error(`Invalid edge type ${t.type}`);return s(n=e.next(),e,t),t},isMultiple:!0},{code:93,name:"numberOfEdges",parser:l}],Ua=[...Fn,{code:10,name:"vertices",parser(n,e){let t={...D(e),bulge:0};return(n=e.next()).code===42?t.bulge=n.value:e.rewind(),t},isMultiple:!0},{code:93,name:"numberOfVertices",parser:l},{code:73,name:"isClosed",parser:F},{code:72,name:"hasBulge",parser:F}],Wa=[{code:49,name:"dashLengths",parser:l,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:l},{code:45,name:"offset",parser:Bn},{code:43,name:"base",parser:Bn},{code:53,name:"angle",parser:l}];function Bn(n,e){let t=n.code+1,s={x:n.value,y:1};return(n=e.next()).code===t?s.y=n.value:e.rewind(),s}function Vn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ya={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},qa=[{code:470},{code:463},{code:462,name:"colorTint",parser:l},{code:461,name:"gradientDefinition",parser:l},{code:460,name:"gradientRotation",parser:l},{code:453,name:"numberOfColors",parser:l},{code:452,name:"gradientColorFlag",parser:l},{code:451},{code:450,name:"gradientFlag",parser:l},{code:10,name:"seedPoints",parser:b,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:b},{code:98,name:"numberOfSeedPoints",parser:l},{code:47,name:"pixelSize",parser:l},{code:53,name:"definitionLines",parser:function(n,e){let t={};return M(Wa)(n,e,t),t},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:l},{code:77,name:"isDouble",parser:F},{code:73,name:"isAnnotated",parser:F},{code:41,name:"patternScale",parser:l},{code:52,name:"patternAngle",parser:l},{code:76,name:"patternType",parser:l},{code:75,name:"hatchStyle",parser:l},{code:92,name:"boundaryPaths",parser:function(n,e){let t={boundaryPathTypeFlag:n.value},s=t.boundaryPathTypeFlag&Ea.Polyline;return n=e.next(),s?M(Ua)(n,e,t):M(Ha)(n,e,t),t},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:l},{code:71,name:"associativity",parser:l},{code:63,name:"patternFillColor",parser:l},{code:70,name:"solidFill",parser:l},{code:2,name:"patternName",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:10,name:"elevationPoint",parser:b},{code:100,name:"subclassMarker",parser:l,pushContext:!0},...G];class jn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Vn(this,"parser",M(qa,Ya))}}Vn(jn,"ForEntityName","HATCH"),(Ae={})[Ae.ShowImage=1]="ShowImage",Ae[Ae.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Ae[Ae.UseClippingBoundary=4]="UseClippingBoundary",Ae[Ae.TransparencyIsOn=8]="TransparencyIsOn",(Pt={})[Pt.Rectangular=1]="Rectangular",Pt[Pt.Polygonal=2]="Polygonal",(Et={})[Et.Outside=0]="Outside",Et[Et.Inside=1]="Inside";function Gn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Xa={clippingBoundaryPath:[]},$a=[{code:90,name:"version",parser:l},{code:10,name:"position",parser:b},{code:11,name:"uPixel",parser:b},{code:12,name:"vPixel",parser:b},{code:13,name:"imageSize",parser:b},{code:340,name:"imageDefHandle",parser:l},{code:70,name:"flags",parser:l},{code:280,name:"clipping",parser:l},{code:281,name:"brightness",parser:l},{code:282,name:"contrast",parser:l},{code:283,name:"fade",parser:l},{code:360,name:"imageDefReactorHandle",parser:l},{code:71,name:"clippingBoundaryType",parser:l},{code:91,name:"countBoundaryPoints",parser:l},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:b},{code:290,name:"clipMode",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class ks{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Gn(this,"parser",M($a,Xa))}}function Hn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Gn(ks,"ForEntityName","IMAGE");let Ka={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Za=[{code:210,name:"extrusionDirection",parser:b},{code:45,name:"rowSpacing",parser:l},{code:44,name:"columnSpacing",parser:l},{code:71,name:"rowCount",parser:l},{code:70,name:"columnCount",parser:l},{code:50,name:"rotation",parser:l},{code:43,name:"zScale",parser:l},{code:42,name:"yScale",parser:l},{code:41,name:"xScale",parser:l},{code:10,name:"insertionPoint",parser:b},{code:2,name:"name",parser:l},{code:66,name:"isVariableAttributes",parser:F},{code:100,name:"subclassMarker",parser:l},...G];class Un{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Hn(this,"parser",M(Za,Ka))}}function Wn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Hn(Un,"ForEntityName","INSERT");let Qa={isArrowheadEnabled:!0},Ja=[{code:213,name:"offsetFromAnnotation",parser:b},{code:212,name:"offsetFromBlock",parser:b},{code:211,name:"horizontalDirection",parser:b},{code:210,name:"normal",parser:b},{code:340,name:"associatedAnnotation",parser:l},{code:77,name:"byBlockColor",parser:l},{code:10,name:"vertices",parser:b,isMultiple:!0},{code:76,name:"numberOfVertices",parser:l},{code:41,name:"textWidth",parser:l},{code:40,name:"textHeight",parser:l},{code:75,name:"isHooklineExists",parser:F},{code:74,name:"isHooklineSameDirection",parser:F},{code:73,name:"leaderCreationFlag",parser:l},{code:72,name:"isSpline",parser:F},{code:71,name:"isArrowheadEnabled",parser:F},{code:3,name:"styleName",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Yn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Wn(this,"parser",M(Ja,Qa))}}Wn(Yn,"ForEntityName","LEADER"),(we={})[we.TextAnnotation=0]="TextAnnotation",we[we.ToleranceAnnotation=1]="ToleranceAnnotation",we[we.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",we[we.NoAnnotation=3]="NoAnnotation";function qn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let eo={thickness:0,extrusionDirection:{x:0,y:0,z:1}},to=[{code:210,name:"extrusionDirection",parser:b},{code:11,name:"endPoint",parser:b},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class Xn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){qn(this,"parser",M(to,eo))}}qn(Xn,"ForEntityName","LINE"),(Tt={})[Tt.IS_CLOSED=1]="IS_CLOSED",Tt[Tt.PLINE_GEN=128]="PLINE_GEN";let so={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},no={bulge:0},ro=[{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:91,name:"id",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l}],io=[{code:210,name:"extrusionDirection",parser:b},{code:10,name:"vertices",isMultiple:!0,parser(n,e){let t={};return M(ro,no)(n,e,t),t}},{code:39,name:"thickness",parser:l},{code:38,name:"elevation",parser:l},{code:43,name:"constantWidth",parser:l},{code:70,name:"flag",parser:l},{code:90,name:"numberOfVertices",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class zt{parseEntity(e,t){let s={};return M(io,so)(t,e,s),s}}ws="LWPOLYLINE",(As="ForEntityName")in zt?Object.defineProperty(zt,As,{value:ws,enumerable:!0,configurable:!0,writable:!0}):zt[As]=ws,(je={})[je.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",je[je.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",je[je.BY_STYLE=5]="BY_STYLE";function ao(n,e){let t={};for(let s of n){let r=e(s);r!=null&&(t[r]??(t[r]=[]),t[r].push(s))}return t}function*Ft(n,e=1/0,t=1){for(let s=n;s!==e;s+=t)yield s}function ve(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function $n(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let oo={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},Bt=[{code:46,name:"annotationHeight",parser:l},{code:101,parser(n,e){(function(t){t.rewind();let s=t.next();if(s.code!==101)throw Error("Bad call for skipEmbeddedObject()");do s=t.next();while(s.code!==0);t.rewind()})(e)}},{code:50,name:"columnHeight",parser:l},{code:49,name:"columnGutter",parser:l},{code:48,name:"columnWidth",parser:l},{code:79,name:"columnAutoHeight",parser:l},{code:78,name:"columnFlowReversed",parser:l},{code:76,name:"columnCount",parser:l},{code:75,name:"columnType",parser:l},{code:441,name:"backgroundFillTransparency",parser:l},{code:63,name:"backgroundFillColor",parser:l},{code:45,name:"fillBoxScale",parser:l},{code:[...Ft(430,440)],name:"backgroundColor",parser:l},{code:[...Ft(420,430)],name:"backgroundColor",parser:l},{code:90,name:"backgroundFill",parser:l},{code:44,name:"lineSpacing",parser:l},{code:73,name:"lineSpacingStyle",parser:l},{code:50,name:"rotation",parser:l},{code:43},{code:42},{code:11,name:"direction",parser:b},{code:210,name:"extrusionDirection",parser:b},{code:7,name:"styleName",parser:l},{code:3,name:"text",isMultiple:!0,parser:l},{code:1,name:"text",isMultiple:!0,parser:l},{code:72,name:"drawingDirection",parser:l},{code:71,name:"attachmentPoint",parser:l},{code:41,name:"width",parser:l},{code:40,name:"height",parser:l},{code:10,name:"insertionPoint",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class Kn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){$n(this,"parser",M(Bt,oo))}}function Zn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}$n(Kn,"ForEntityName","MTEXT");let lo={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},ho=[{code:50,name:"angle",parser:l},{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:10,name:"position",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class Qn{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Zn(this,"parser",M(ho,lo))}}Zn(Qn,"ForEntityName","POINT"),(q={})[q.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",q[q.CURVE_FIT=2]="CURVE_FIT",q[q.SPLINE_FIT=4]="SPLINE_FIT",q[q.POLYLINE_3D=8]="POLYLINE_3D",q[q.POLYGON_3D=16]="POLYGON_3D",q[q.CLOSED_POLYGON=32]="CLOSED_POLYGON",q[q.POLYFACE=64]="POLYFACE",q[q.CONTINUOUS=128]="CONTINUOUS",(Ie={})[Ie.NONE=0]="NONE",Ie[Ie.QUADRATIC=5]="QUADRATIC",Ie[Ie.CUBIC=6]="CUBIC",Ie[Ie.BEZIER=8]="BEZIER",(X={})[X.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",X[X.TANGENT_DEFINED=2]="TANGENT_DEFINED",X[X.NOT_USED=4]="NOT_USED",X[X.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",X[X.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",X[X.FOR_POLYLINE=32]="FOR_POLYLINE",X[X.FOR_POLYGON=64]="FOR_POLYGON",X[X.POLYFACE=128]="POLYFACE";function Jn(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let co={startWidth:0,endWidth:0,bulge:0},uo=[{code:91,name:"id",parser:l},{code:[...Ft(71,75)],name:"faces",isMultiple:!0,parser:l},{code:50,name:"tangentDirection",parser:l},{code:70,name:"flag",parser:l},{code:42,name:"bulge",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:30,name:"z",parser:l},{code:20,name:"y",parser:l},{code:10,name:"x",parser:l},{code:100,name:"subclassMarker",parser:l},{code:100},...G],er=class{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){Jn(this,"parser",M(uo,co))}};function tr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Jn(er,"ForEntityName","VERTEX");let mo={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:[]},go=[{code:0,name:"vertices",isMultiple:!0,parser:(n,e)=>L(n,0,"VERTEX")?(n=e.next(),new er().parseEntity(e,n)):vs},{code:210,name:"extrusionDirection",parser:b},{code:75,name:"smoothType",parser:l},{code:74,name:"surfaceNDensity",parser:l},{code:73,name:"surfaceMDensity",parser:l},{code:72,name:"meshNVertexCount",parser:l},{code:71,name:"meshMVertexCount",parser:l},{code:41,name:"endWidth",parser:l},{code:40,name:"startWidth",parser:l},{code:70,name:"flag",parser:l},{code:39,name:"thickness",parser:l},{code:30,name:"elevation",parser:l},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:l},...G];class sr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){tr(this,"parser",M(go,mo))}}function nr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}tr(sr,"ForEntityName","POLYLINE");let po={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},yo=[{code:10,name:"firstPoint",parser:b},{code:11,name:"unitDirection",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class rr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){nr(this,"parser",M(yo,po))}}function ir(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}nr(rr,"ForEntityName","RAY");let _o={vertices:[],backLineVertices:[]},fo=[{code:360,name:"geometrySettingHardId",parser:l},{code:12,name:"backLineVertices",isMultiple:!0,parser:b},{code:93,name:"numberOfBackLineVertices",parser:l},{code:11,name:"vertices",isMultiple:!0,parser:b},{code:92,name:"verticesCount",parser:l},{code:[63,411],name:"indicatorColor",parser:l},{code:70,name:"indicatorTransparency",parser:l},{code:41,name:"bottomHeight",parser:l},{code:40,name:"topHeight",parser:l},{code:10,name:"verticalDirection",parser:b},{code:1,name:"name",parser:l},{code:91,name:"flag",parser:l},{code:90,name:"state",parser:l},{code:100,name:"subclassMarker",parser:l},...G];class ar{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){ir(this,"parser",M(fo,_o))}}function or(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}ir(ar,"ForEntityName","SECTION");let xo={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},bo=[{code:210,name:"extrusionDirection",parser:b},{code:39,name:"thickness",parser:l},{code:[...Ft(10,14)],name:"points",isMultiple:!0,parser:b},{code:100,name:"subclassMarker",parser:l},...G];class lr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){or(this,"parser",M(bo,xo))}}or(lr,"ForEntityName","SOLID"),(ie={})[ie.NONE=0]="NONE",ie[ie.CLOSED=1]="CLOSED",ie[ie.PERIODIC=2]="PERIODIC",ie[ie.RATIONAL=4]="RATIONAL",ie[ie.PLANAR=8]="PLANAR",ie[ie.LINEAR=16]="LINEAR";function hr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ao={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},wo=[{code:11,name:"fitPoints",isMultiple:!0,parser:b},{code:10,name:"controlPoints",isMultiple:!0,parser:b},{code:41,name:"weights",isMultiple:!0,parser:l},{code:40,name:"knots",isMultiple:!0,parser:l},{code:13,name:"endTangent",parser:b},{code:12,name:"startTangent",parser:b},{code:44,name:"fitTolerance",parser:l},{code:43,name:"controlTolerance",parser:l},{code:42,name:"knotTolerance",parser:l},{code:74,name:"numberOfFitPoints",parser:l},{code:73,name:"numberOfControlPoints",parser:l},{code:72,name:"numberOfKnots",parser:l},{code:71,name:"degree",parser:l},{code:70,name:"flag",parser:l},{code:210,name:"normal",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class cr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){hr(this,"parser",M(wo,Ao))}}hr(cr,"ForEntityName","SPLINE");class Vt{parseEntity(e,t){let s={};for(;!e.isEOF();){if(t.code===0){e.rewind();break}switch(t.code){case 100:s.subclassMarker=t.value,t=e.next();break;case 2:s.name=t.value,t=e.next();break;case 5:s.handle=t.value,t=e.next();break;case 10:s.startPoint=ve(D(e)),t=e.lastReadGroup;break;case 11:s.directionVector=ve(D(e)),t=e.lastReadGroup;break;case 90:s.tableValue=t.value,t=e.next();break;case 91:s.rowCount=t.value,t=e.next();break;case 92:s.columnCount=t.value,t=e.next();break;case 93:s.overrideFlag=t.value,t=e.next();break;case 94:s.borderColorOverrideFlag=t.value,t=e.next();break;case 95:s.borderLineWeightOverrideFlag=t.value,t=e.next();break;case 96:s.borderVisibilityOverrideFlag=t.value,t=e.next();break;case 141:s.rowHeightArr??(s.rowHeightArr=[]),s.rowHeightArr.push(t.value),t=e.next();break;case 142:s.columnWidthArr??(s.columnWidthArr=[]),s.columnWidthArr.push(t.value),t=e.next();break;case 280:s.version=t.value,t=e.next();break;case 310:s.bmpPreview??(s.bmpPreview=""),s.bmpPreview+=t.value,t=e.next();break;case 330:s.ownerDictionaryId=t.value,t=e.next();break;case 342:s.tableStyleId=t.value,t=e.next();break;case 343:s.blockRecordHandle=t.value,t=e.next();break;case 170:s.attachmentPoint=t.value,t=e.next();break;case 171:s.cells??(s.cells=[]),s.cells.push(function(r,i){let a=!1,o=!1,c={};for(;!r.isEOF()&&i.code!==0&&!o;)switch(i.code){case 171:if(a){o=!0;continue}c.cellType=i.value,a=!0,i=r.next();break;case 172:c.flagValue=i.value,i=r.next();break;case 173:c.mergedValue=i.value,i=r.next();break;case 174:c.autoFit=i.value,i=r.next();break;case 175:c.borderWidth=i.value,i=r.next();break;case 176:c.borderHeight=i.value,i=r.next();break;case 91:c.overrideFlag=i.value,i=r.next();break;case 178:c.virtualEdgeFlag=i.value,i=r.next();break;case 145:c.rotation=i.value,i=r.next();break;case 345:c.fieldObjetId=i.value,i=r.next();break;case 340:c.blockTableRecordId=i.value,i=r.next();break;case 146:c.blockScale=i.value,i=r.next();break;case 177:c.blockAttrNum=i.value,i=r.next();break;case 7:c.textStyle=i.value,i=r.next();break;case 140:c.textHeight=i.value,i=r.next();break;case 170:c.attachmentPoint=i.value,i=r.next();break;case 92:c.extendedCellFlags=i.value,i=r.next();break;case 285:c.rightBorderVisibility=!!(i.value??!0),i=r.next();break;case 286:c.bottomBorderVisibility=!!(i.value??!0),i=r.next();break;case 288:c.leftBorderVisibility=!!(i.value??!0),i=r.next();break;case 289:c.topBorderVisibility=!!(i.value??!0),i=r.next();break;case 301:(function(h,d,u){for(;u.code!==304;)switch(u.code){case 301:case 93:case 90:case 94:u=d.next();break;case 1:h.text=u.value,u=d.next();break;case 300:h.attrText=u.value,u=d.next();break;case 302:h.text=u.value?u.value:h.text,u=d.next();break;default:console.log(`Ignore code: ${u.code}, value: ${u.value}`),u=d.next()}})(c,r,i),i=r.next();break;default:return c}return a=!1,o=!1,c}(e,t)),t=e.lastReadGroup;break;default:Ls(s,t,e),t=e.next()}}return s}}Ps="ACAD_TABLE",(Is="ForEntityName")in Vt?Object.defineProperty(Vt,Is,{value:Ps,enumerable:!0,configurable:!0,writable:!0}):Vt[Is]=Ps;class jt{parseEntity(e,t){let s={};for(;t!=="EOF";){if(t.code===0){e.rewind();break}!function(r,i,a){if(a==="EOF")return!1;switch(a.code){case 0:default:return!1;case 100:r.subclassMarker=a.value;break;case 10:r.viewportCenter=ve(D(i));break;case 40:r.width=a.value;break;case 41:r.height=a.value;break;case 68:r.status=a.value;break;case 69:r.viewportId=a.value;break;case 12:r.displayCenter=D(i);break;case 13:r.snapBase=D(i);break;case 14:r.snapSpacing=D(i);break;case 15:r.gridSpacing=D(i);break;case 16:r.viewDirection=ve(D(i));break;case 17:r.targetPoint=ve(D(i));break;case 42:r.perspectiveLensLength=a.value;break;case 43:r.frontClipZ=a.value;break;case 44:r.backClipZ=a.value;break;case 45:r.viewHeight=a.value;break;case 50:r.snapAngle=a.value;break;case 51:r.viewTwistAngle=a.value;break;case 72:r.circleZoomPercent=a.value;break;case 331:r.frozenLayerIds??(r.frozenLayerIds=[]),r.frozenLayerIds.push(a.value);break;case 90:r.statusBitFlags=a.value;break;case 330:r.ownerBlockRecordSoftId=a.value;break;case 340:r.clippingBoundaryId=a.value;break;case 1:r.sheetName=a.value;break;case 281:r.renderMode=a.value;break;case 71:r.ucsPerViewport=a.value;break;case 110:r.ucsOrigin=ve(D(i));break;case 111:r.ucsXAxis=ve(D(i));break;case 112:r.ucsYAxis=ve(D(i));break;case 345:r.ucsId=a.value;break;case 346:r.ucsBaseId=a.value;break;case 79:r.orthographicType=a.value;break;case 146:r.elevation=a.value;break;case 170:r.shadePlotMode=a.value;break;case 61:r.majorGridFrequency=a.value;break;case 332:r.backgroundId=a.value;break;case 333:r.shadePlotId=a.value;break;case 348:r.visualStyleId=a.value;break;case 292:r.isDefaultLighting=!!a.value;break;case 282:r.defaultLightingType=a.value;break;case 141:r.brightness=a.value;break;case 142:r.contrast=a.value;break;case 63:case 421:case 431:r.ambientLightColor=a.value;break;case 361:r.sunId=a.value;break;case 335:case 343:case 344:case 91:r.softPointer=a.value}return!0}(s,e,t)&&Ls(s,t,e),t=e.next()}return s}}Ts="VIEWPORT",(Es="ForEntityName")in jt?Object.defineProperty(jt,Es,{value:Ts,enumerable:!0,configurable:!0,writable:!0}):jt[Es]=Ts;class Gt extends ks{parseEntity(e,t){return super.parseEntity(e,t)}}function dr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}Ms="WIPEOUT",(Ss="ForEntityName")in Gt?Object.defineProperty(Gt,Ss,{value:Ms,enumerable:!0,configurable:!0,writable:!0}):Gt[Ss]=Ms;let Io={firstPoint:{x:0,y:0,z:1},extrusionDirection:{x:0,y:0,z:1}},Po=[{code:10,name:"firstPoint",parser:b},{code:11,name:"unitDirection",parser:b},{code:100,name:"subclassMarker",parser:l},...G];class ur{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){dr(this,"parser",M(Po,Io))}}function mr(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}dr(ur,"ForEntityName","XLINE");let Eo={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},To=[...Bt.slice(Bt.findIndex(({name:n})=>n==="columnType"),Bt.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!L(n,0,"MTEXT"))return vs}},{code:2,name:"definitionTag",parser:l},{code:40,name:"annotationScale",parser:l},{code:10,name:"alignmentPoint",parser:b},{code:340,name:"secondaryAttributesHardId",parser:l},{code:70,name:"numberOfSecondaryAttributes",parser:l},{code:70,name:"isReallyLocked",parser:F},{code:70,name:"mtextFlag",parser:l},{code:280,name:"isDuplicatedEntriesKeep",parser:F},{code:100},{code:280,name:"lockPositionFlag",parser:F},{code:210,name:"extrusionDirection",parser:b},{code:11,name:"alignmentPoint",parser:b},{code:74,name:"verticalJustification",parser:l},{code:72,name:"horizontalJustification",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:7,name:"textStyle",parser:l},{code:51,name:"obliqueAngle",parser:l},{code:41,name:"scale",parser:l},{code:50,name:"rotation",parser:l},{code:73},{code:70,name:"attributeFlag",parser:l},{code:2,name:"tag",parser:l},{code:280},{code:100,name:"subclassMarker",parser:l},{code:1,name:"text",parser:l},{code:40,name:"textHeight",parser:l},{code:10,name:"startPoint",parser:b},{code:39,name:"thickness",parser:l},{code:100},...G];class gr{parseEntity(e,t){let s={};return this.parser(t,e,s),s}constructor(){mr(this,"parser",M(To,Eo))}}mr(gr,"ForEntityName","ATTRIB");let So=Object.fromEntries([Sn,Cn,gr,Nn,Rt,zn,ks,Un,Yn,Xn,zt,Kn,Qn,sr,rr,ar,lr,cr,Vt,kn,jn,jt,Gt,ur].map(n=>[n.ForEntityName,new n]));function pr(n,e){let t=[];for(;!L(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){e.rewind();break}let s=So[n.value];if(s){let r=n.value;n=e.next();let i=s.parseEntity(e,n);i.type=r,En(i),t.push(i)}else console.warn(`Unsupported ENTITY type: ${n.value}`)}n=e.next()}return t}function Mo(n,e){let t={};for(;!L(n,0,"EOF")&&!L(n,0,"ENDSEC");){if(L(n,0,"BLOCK")){let s=vo(n=e.next(),e);En(s),s.name&&(t[s.name]=s)}n=e.next()}return t}function vo(n,e){let t={};for(;!L(n,0,"EOF");){if(L(n,0,"ENDBLK")){for(n=e.next();!L(n,0,"EOF");){if(L(n,100,"AcDbBlockEnd"))return t;n=e.next()}break}switch(n.code){case 1:t.xrefPath=n.value;break;case 2:t.name=n.value;break;case 3:t.name2=n.value;break;case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 10:t.position=D(e);break;case 67:t.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(t.type=n.value);break;case 100:break;case 330:t.ownerHandle=n.value;break;case 0:t.entities=pr(n,e)}n=e.next()}return t}function Lo(n,e){let t=null,s={};for(;!L(n,0,"EOF")&&!L(n,0,"ENDSEC");)n.code===9?t=n.value:n.code===10?s[t]=D(e):s[t]=n.value,n=e.next();return s}let ko=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:l},{code:90,name:"version",parser:l},{code:1,name:"fileName",parser:l},{code:10,name:"size",parser:b},{code:11,name:"sizeOfOnePixel",parser:b},{code:280,name:"isLoaded",parser:l},{code:281,name:"resolutionUnits",parser:l},{code:100,name:"subclassMarker",parser:l}],yr=[{code:333,name:"shadePlotId",parser:l},{code:149,name:"imageOriginY",parser:l},{code:148,name:"imageOriginX",parser:l},{code:147,name:"scaleFactor",parser:l},{code:78,name:"shadePlotCustomDPI",parser:l},{code:77,name:"shadePlotResolution",parser:l},{code:76,name:"shadePlotMode",parser:l},{code:75,name:"standardScaleType",parser:l},{code:7,name:"currentStyleSheet",parser:l},{code:74,name:"plotType",parser:l},{code:73,name:"plotRotation",parser:l},{code:72,name:"paperUnit",parser:l},{code:70,name:"layoutFlag",parser:l},{code:143,name:"printScaleDenominator",parser:l},{code:142,name:"printScaleNominator",parser:l},{code:141,name:"windowAreaYMax",parser:l},{code:140,name:"windowAreaYMin",parser:l},{code:49,name:"windowAreaXMax",parser:l},{code:48,name:"windowAreaXMin",parser:l},{code:47,name:"plotOriginY",parser:l},{code:46,name:"plotOriginX",parser:l},{code:45,name:"paperHeight",parser:l},{code:44,name:"paperWidth",parser:l},{code:43,name:"marginTop",parser:l},{code:42,name:"marginRight",parser:l},{code:41,name:"marginBottom",parser:l},{code:40,name:"marginLeft",parser:l},{code:6,name:"plotViewName",parser:l},{code:4,name:"paperSize",parser:l},{code:2,name:"configName",parser:l},{code:1,name:"pageSetupName",parser:l},{code:100,name:"subclassMarker",parser:l}],Oo=[{code:333,name:"shadePlotId",parser:l},{code:346,name:"orthographicUcsId",parser:l},{code:345,name:"namedUcsId",parser:l},{code:331,name:"viewportId",parser:l},{code:330,name:"paperSpaceTableId",parser:l},{code:76,name:"orthographicType",parser:l},{code:17,name:"ucsYAxis",parser:b},{code:16,name:"ucsXAxis",parser:b},{code:13,name:"ucsOrigin",parser:b},{code:146,name:"elevation",parser:l},{code:15,name:"maxExtent",parser:b},{code:14,name:"minExtent",parser:b},{code:12,name:"insertionBase",parser:b},{code:11,name:"maxLimit",parser:b},{code:10,name:"minLimit",parser:b},{code:71,name:"tabOrder",parser:l},{code:70,name:"controlFlag",parser:l},{code:1,name:"layoutName",parser:l},{code:100,name:"subclassMarker",parser:l},...yr],Co=[{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,name:"ownerDictionaryIdHard",parser:l},{code:102},{code:102},{code:330,name:"ownerDictionaryIdSoft",parser:l},{code:102},{code:102},{code:102},{code:5,name:"handle",parser:l}];function _r(n){return n.subclassMarker==="AcDbDictionary"}let Do={LAYOUT:Oo,PLOTSETTINGS:yr,DICTIONARY:[{code:3,name:"entries",parser:(n,e)=>{let t={name:n.value};return(n=e.next()).code===350?t.objectId=n.value:e.rewind(),t},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:l},{code:280,name:"isHardOwned",parser:F},{code:100,name:"subclassMarker",parser:l}],IMAGEDEF:ko};function No(n,e){let t=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let s=n.value,r=Do[s];if(n.code===0&&(r!=null&&r.length)){let i=M([...Co,...r]),a={name:s};i(n=e.next(),e,a)?(t.push(a),n=e.peek()):n=e.next()}else n=e.next()}return{byName:ao(t,({name:s})=>s),byTree:function(s){let r=Object.fromEntries(s.map(i=>[i.handle,i]));for(let i of s)(!_r(i)||i.ownerDictionaryIdSoft!=="0")&&(i.ownerDictionaryIdSoft&&(i.ownerDictionarySoft=r[i.ownerDictionaryIdSoft]),i.ownerDictionaryIdHard&&(i.ownerDictionaryHard=r[i.ownerDictionaryIdHard]),i.ownerObjectId&&(i.ownerObject=r[i.ownerObjectId])),function(a,o){_r(a)&&a.entries&&(a.entries=Object.fromEntries(a.entries.map(({name:c,objectId:h})=>[c,o[h]])))}(i,r);return s[0]}(t)}}let st=[{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102,parser(n,e){for(;!L(n,0,"EOF")&&!L(n,102,"}");)n=e.next()}},{code:5,name:"handle",parser:l}],Ro=M([{code:310,name:"bmpPreview",parser:l},{code:281,name:"scalability",parser:l},{code:280,name:"explodability",parser:l},{code:70,name:"insertionUnits",parser:l},{code:340,name:"layoutObjects",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...st]),zo=M([...[{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:wn.Above,defaultValueImperial:wn.Center},{name:"DIMZIN",code:78,defaultValue:tt.Trailing,defaultValueImperial:tt.Feet},{name:"DIMAZIN",code:79,defaultValue:wa.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:Ia.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Pa.Center},{name:"DIMTZIN",code:284,defaultValue:tt.Trailing,defaultValueImperial:tt.Feet},{name:"DIMALTZ",code:285,defaultValue:tt.Trailing},{name:"DIMALTTZ",code:286,defaultValue:tt.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}].map(n=>({...n,parser:l})),{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},{code:105,name:"handle",parser:l},...st.filter(n=>n.code!==5)]),Fo=M([{code:347,name:"materialObjectId",parser:l},{code:390,name:"plotStyleNameObjectId",parser:l},{code:370,name:"lineweight",parser:l},{code:290,name:"isPlotting",parser:F},{code:6,name:"lineType",parser:l},{code:62,name:"colorIndex",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...st]),Bo=M([{code:9,name:"text",parser:l},{code:45,name:"offsetY",parser:l},{code:44,name:"offsetX",parser:l},{code:50,name:"rotation",parser:l},{code:46,name:"scale",parser:l},{code:340,name:"styleObjectId",parser:l},{code:75,name:"shapeNumber",parser:l},{code:74,name:"elementTypeFlag",parser:l},{code:49,name:"elementLength",parser:l}],{elementTypeFlag:0,elementLength:0}),Vo={BLOCK_RECORD:Ro,DIMSTYLE:zo,LAYER:Fo,LTYPE:M([{code:49,name:"pattern",parser(n,e){let t={};return Bo(n,e,t),t},isMultiple:!0},{code:40,name:"totalPatternLength",parser:l},{code:73,name:"numberOfLineTypes",parser:l},{code:72,parser:l},{code:3,name:"description",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...st]),STYLE:M([{code:1e3,name:"extendedFont",parser:l},{code:1001},{code:4,name:"bigFont",parser:l},{code:3,name:"font",parser:l},{code:42,name:"lastHeight",parser:l},{code:71,name:"textGenerationFlag",parser:l},{code:50,name:"obliqueAngle",parser:l},{code:41,name:"widthFactor",parser:l},{code:40,name:"fixedTextHeight",parser:l},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...st]),VPORT:M([{code:[63,421,431],name:"ambientColor",parser:l},{code:142,name:"contrast",parser:l},{code:141,name:"brightness",parser:l},{code:282,name:"defaultLightingType",parser:l},{code:292,name:"isDefaultLightingOn",parser:F},{code:348,name:"visualStyleObjectId",parser:l},{code:333,name:"shadePlotObjectId",parser:l},{code:332,name:"backgroundObjectId",parser:l},{code:61,name:"majorGridLines",parser:l},{code:170,name:"shadePlotSetting",parser:l},{code:146,name:"elevation",parser:l},{code:79,name:"orthographicType",parser:l},{code:112,name:"ucsYAxis",parser:b},{code:111,name:"ucsXAxis",parser:b},{code:110,name:"ucsOrigin",parser:b},{code:74,name:"ucsIconSetting",parser:l},{code:71,name:"viewMode",parser:l},{code:281,name:"renderMode",parser:l},{code:1,name:"styleSheet",parser:l},{code:[331,441],name:"frozenLayers",parser:l,isMultiple:!0},{code:72,name:"circleSides",parser:l},{code:51,name:"viewTwistAngle",parser:l},{code:50,name:"snapRotationAngle",parser:l},{code:45,name:"viewHeight",parser:l},{code:44,name:"backClippingPlane",parser:l},{code:43,name:"frontClippingPlane",parser:l},{code:42,name:"lensLength",parser:l},{code:17,name:"viewTarget",parser:b},{code:16,name:"viewDirectionFromTarget",parser:b},{code:15,name:"gridSpacing",parser:b},{code:14,name:"snapSpacing",parser:b},{code:13,name:"snapBasePoint",parser:b},{code:12,name:"center",parser:b},{code:11,name:"upperRightCorner",parser:b},{code:10,name:"lowerLeftCorner",parser:b},{code:70,name:"standardFlag",parser:l},{code:2,name:"name",parser:l},{code:100,name:"subclassMarker",parser:l},...st])},jo=M([{code:70,name:"maxNumberOfEntries",parser:l},{code:100,name:"subclassMarker",parser:l},{code:330,name:"ownerObjectId",parser:l},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:l},{code:2,name:"name",parser:l}]);function Go(n,e){var s;let t={};for(;!L(n,0,"EOF")&&!L(n,0,"ENDSEC");){if(L(n,0,"TABLE")){n=e.next();let r={entries:[]};jo(n,e,r),t[r.name]=r}if(L(n,0)&&!L(n,0,"ENDTAB")){let r=n.value;n=e.next();let i=Vo[r];if(!i){console.warn(`parseTable: Invalid table name '${r}'`),n=e.next();continue}let a={};i(n,e,a),(s=t[r])==null||s.entries.push(a)}n=e.next()}return t}function Ht(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}class fr{next(){if(!this.hasNext())return this._eof?console.warn("Cannot call 'next' after EOF group has been read"):console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let e=parseInt(this._data[this._pointer++],10),t=xr(e,this._data[this._pointer++]),s={code:e,value:t};return L(s,0,"EOF")&&(this._eof=!0),this.lastReadGroup=s,s}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let e={code:parseInt(this._data[this._pointer]),value:0};return e.value=xr(e.code,this._data[this._pointer+1]),e}rewind(e){e=e||1,this._pointer=this._pointer-2*e}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(e){Ht(this,"_pointer",void 0),Ht(this,"_data",void 0),Ht(this,"_eof",void 0),Ht(this,"lastReadGroup",{code:0,value:0}),this._pointer=0,this._data=e,this._eof=!1}}function xr(n,e){return n<=9?e:n>=10&&n<=59?parseFloat(e.trim()):n>=60&&n<=99?parseInt(e.trim()):n>=100&&n<=109?e:n>=110&&n<=149?parseFloat(e.trim()):n>=160&&n<=179?parseInt(e.trim()):n>=210&&n<=239?parseFloat(e.trim()):n>=270&&n<=289?parseInt(e.trim()):n>=290&&n<=299?function(t){if(t==="0")return!1;if(t==="1")return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}(e.trim()):n>=300&&n<=369?e:n>=370&&n<=389?parseInt(e.trim()):n>=390&&n<=399?e:n>=400&&n<=409?parseInt(e.trim()):n>=410&&n<=419?e:n>=420&&n<=429?parseInt(e.trim()):n>=430&&n<=439?e:n>=440&&n<=459?parseInt(e.trim()):n>=460&&n<=469?parseFloat(e.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?e:n>=1010&&n<=1059?parseFloat(e.trim()):n>=1060&&n<=1071?parseInt(e.trim()):(console.log("WARNING: Group code does not have a defined type: %j",{code:n,value:e}),e)}function Os(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}let Ho=class{constructor(){Os(this,"encoding","utf-8"),Os(this,"encodingFailureFatal",!1)}};class Uo extends EventTarget{parseSync(e){let t=new fr(e.split(/\r\n|\r|\n/g));if(!t.hasNext())throw Error("Empty file");return this.parseAll(t)}parseStream(e){let t="",s=this;return new Promise((r,i)=>{e.on("data",a=>{t+=a}),e.on("end",()=>{try{let a=t.split(/\r\n|\r|\n/g),o=new fr(a);if(!o.hasNext())throw Error("Empty file");r(s.parseAll(o))}catch(a){i(a)}}),e.on("error",a=>{i(a)})})}async parseFromUrl(e,t){let s=await fetch(e,t);if(!s.body)return null;let r=s.body.getReader(),i="";for(;;){let{done:a,value:o}=await r.read();if(a){i+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}i+=this._decoder.decode(o,{stream:!0})}return this.parseSync(i)}parseAll(e){let t={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},s=e.next();for(;!L(s,0,"EOF");)L(s,0,"SECTION")&&(L(s=e.next(),2,"HEADER")?(s=e.next(),t.header=Lo(s,e)):L(s,2,"BLOCKS")?(s=e.next(),t.blocks=Mo(s,e)):L(s,2,"ENTITIES")?(s=e.next(),t.entities=pr(s,e)):L(s,2,"TABLES")?(s=e.next(),t.tables=Go(s,e)):L(s,2,"OBJECTS")&&(s=e.next(),t.objects=No(s,e))),s=e.next();return t}constructor(e=new Ho){super(),Os(this,"_decoder",void 0),this._decoder=new TextDecoder(e.encoding,{fatal:e.encodingFailureFatal})}}var Cs=(n=>(n[n.DecimalDegrees=0]="DecimalDegrees",n[n.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",n[n.Gradians=2]="Gradians",n[n.Radians=3]="Radians",n[n.SurveyorsUnits=4]="SurveyorsUnits",n))(Cs||{});class Le{static get instance(){return this._instance||(this._instance=new Le),this._instance}constructor(){this._blocks=new Map}createKey(e,t){return`${e}_${t}`}set(e,t){return t=t.fastDeepClone(),this._blocks.set(e,t),t}get(e){let t=this._blocks.get(e);return t&&(t=t.fastDeepClone()),t}has(e){return this._blocks.has(e)}clear(){this._blocks.clear()}draw(e,t,s,r=!0,i,a){const o=[];if(t!=null){const c=this.createKey(t.name,s);let h;if(this.has(c))h=this.get(c);else{const d=t.newIterator();for(const u of d)if(u.color.isByBlock&&s){br.copy(u.color),u.color.color=s;const m=u.draw(e);m&&o.push(m),u.color.copy(br)}else{const m=u.draw(e);m&&o.push(m)}h=e.group(o),h&&r&&this.set(c,h)}return h&&i&&(h.applyMatrix(i),a&&(a.x!=0||a.y!=0||a.z!=1)&&(i.setFromExtrusionDirection(a),h.applyMatrix(i))),h}else return e.group(o)}}const br=new Ne,Ut="Continuous",Wt="ByLayer",Ar="ByBlock";var Ge=(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))(Ge||{}),Ds=(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))(Ds||{});function Wo(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Yo(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}var wr=(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))(wr||{});class Yt{constructor(e){this.i=0,this._records=e,this._keys=Array.from(e.keys())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const e=this._records.get(this._keys[this.i]);return this.i+=1,{value:e,done:!1}}return{value:null,done:!0}}}const Ir="Load Database";class ee extends _n{constructor(e,t){super(e.stage),this.data=e,this.progress=t}async run(e){const t=fs.getInstance().getEntry(Ir),s=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const r=await this.data.task(e);if(this.progress){const i=r.data;await this.progress(this.data.progress.value,this.data.stage,"END",i),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)}return t&&(t.data[this.name]=Date.now()-s),r}}class Pr{async read(e,t,s,r){const i={name:Ir,data:{total:0},format(){let h="";return Object.keys(this.data).forEach(d=>{d!=="total"&&(h+=`- ${d}: ${this.data[d]} ms
2
+ `)}),h+=`- total: ${this.data.total} ms`,h}};fs.getInstance().collect(i),this.progress=r;const a={value:0},o=new fn;o.setCompleteCallback(()=>this.onFinished()),o.setErrorCallback(()=>this.onFinished()),o.addTask(new ee({stage:"START",step:1,progress:a,task:async h=>h},r)),o.addTask(new ee({stage:"PARSE",step:5,progress:a,task:async h=>({model:await this.parse(h)})},r)),o.addTask(new ee({stage:"FONT",step:5,progress:a,task:async h=>{const d=this.getFonts(h.model);return{model:h.model,data:d}}},r)),o.addTask(new ee({stage:"LTYPE",step:1,progress:a,task:async h=>(this.processLineTypes(h.model,t),h)},r)),o.addTask(new ee({stage:"STYLE",step:1,progress:a,task:async h=>(this.processTextStyles(h.model,t),h)},r)),o.addTask(new ee({stage:"DIMSTYLE",step:1,progress:a,task:async h=>(this.processDimStyles(h.model,t),h)},r)),o.addTask(new ee({stage:"LAYER",step:1,progress:a,task:async h=>(this.processLayers(h.model,t),h)},r)),o.addTask(new ee({stage:"VPORT",step:1,progress:a,task:async h=>(this.processViewports(h.model,t),h)},r)),o.addTask(new ee({stage:"HEADER",step:1,progress:a,task:async h=>(this.processHeader(h.model,t),h)},r)),o.addTask(new ee({stage:"BLOCK_RECORD",step:5,progress:a,task:async h=>(this.processBlockTables(h.model,t),h)},r)),o.addTask(new ee({stage:"OBJECT",step:5,progress:a,task:async h=>(this.processObjects(h.model,t),h)},r)),o.addTask(new ee({stage:"BLOCK",step:5,progress:a,task:async h=>(await this.processBlocks(h.model,t),h)},r)),o.addTask(new ee({stage:"ENTITY",step:100,progress:a,task:async h=>(await this.processEntities(h.model,t,s,a,r),h)},r)),o.addTask(new ee({stage:"END",step:0,progress:a,task:async h=>h},r));const c=Date.now();await o.run(e),i.data.total=Date.now()-c}onFinished(){this.progress&&(this.progress(100,"END","END"),Le.instance.clear())}parse(e){throw new Error("Not impelemented yet!")}getFonts(e){throw new Error("Not impelemented yet!")}processLineTypes(e,t){throw new Error("Not impelemented yet!")}processTextStyles(e,t){throw new Error("Not impelemented yet!")}processDimStyles(e,t){throw new Error("Not impelemented yet!")}processLayers(e,t){throw new Error("Not impelemented yet!")}processViewports(e,t){throw new Error("Not impelemented yet!")}processHeader(e,t){throw new Error("Not impelemented yet!")}processBlockTables(e,t){throw new Error("Not impelemented yet!")}processObjects(e,t){throw new Error("Not impelemented yet!")}processBlocks(e,t){throw new Error("Not impelemented yet!")}processEntities(e,t,s,r,i){throw new Error("Not impelemented yet!")}}const $=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Er=1234567;const Ns=Math.PI/180,Rs=180/Math.PI;function Tr(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,s=Math.random()*4294967295|0;return($[n&255]+$[n>>8&255]+$[n>>16&255]+$[n>>24&255]+"-"+$[e&255]+$[e>>8&255]+"-"+$[e>>16&15|64]+$[e>>24&255]+"-"+$[t&63|128]+$[t>>8&255]+"-"+$[t>>16&255]+$[t>>24&255]+$[s&255]+$[s>>8&255]+$[s>>16&255]+$[s>>24&255]).toLowerCase()}function Ee(n,e,t){return Math.max(e,Math.min(t,n))}function zs(n,e){return(n%e+e)%e}function Sr(n,e,t,s,r){return s+(n-e)*(r-s)/(t-e)}function Mr(n,e,t){return n!==e?(t-n)/(e-n):0}function Fs(n,e,t){return(1-t)*n+t*e}function vr(n,e,t,s){return Fs(n,e,1-Math.exp(-t*s))}function Lr(n,e=1){return e-Math.abs(zs(n,e*2)-e)}function kr(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Or(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Cr(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Dr(n,e){return n+Math.random()*(e-n)}function Nr(n){return n*(.5-Math.random())}function Rr(n){n!==void 0&&(Er=n);let e=Er+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function zr(n){return n*Ns}function Fr(n){return n*Rs}function Br(n){return(n&n-1)===0&&n!==0}function Vr(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function jr(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function St(n){const e=Math.PI*2;return(n%e+e)%e}function Gr(n,e,t){return n>e&&n<t||n>t&&n<e}function Hr(n,e,t,s=!1){return n=St(n),e=St(e),t=St(t),s?e>t?n<=e&&n>=t:n<=e||n>=t:e<t?n>=e&&n<=t:n>=e||n<=t}function Bs(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Ur(n,e=1e-7){const t=Bs(n);return Math.max(Math.pow(10,t)*e,e)}const O={DEG2RAD:Ns,RAD2DEG:Rs,generateUUID:Tr,clamp:Ee,euclideanModulo:zs,mapLinear:Sr,inverseLerp:Mr,lerp:Fs,damp:vr,pingpong:Lr,smoothstep:kr,smootherstep:Or,randInt:Cr,randFloat:Dr,randFloatSpread:Nr,seededRandom:Rr,degToRad:zr,radToDeg:Fr,isPowerOfTwo:Br,ceilPowerOfTwo:Vr,floorPowerOfTwo:jr,normalizeAngle:St,isBetween:Gr,isBetweenAngle:Hr,intPartLength:Bs,relativeEps:Ur},Vs=class ha{constructor(e,t){this.x=0,this.y=0;const s=+(e!==void 0)+ +(t!==void 0);if(s!==0){if(s===1&&e instanceof Array){this.x=e[0],this.y=e[1];return}if(s===1){const{x:r,y:i}=e;this.x=r,this.y=i;return}if(s===2){this.x=e,this.y=t;return}throw te.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new ha(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix2d(e){const t=this.x,s=this.y,r=e.elements;return this.x=r[0]*t+r[3]*s+r[6],this.y=r[1]*t+r[4]*s+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const s=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*s-a*r+e.x,this.y=i*r+a*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(e=1e-7){return Math.min(O.relativeEps(this.x,e),O.relativeEps(this.y,e))}*[Symbol.iterator](){yield this.x,yield this.y}};Vs.EMPTY=Object.freeze(new Vs(0,0));let B=Vs;const js=class ca{constructor(e,t,s,r,i,a,o,c,h){this.elements=[1,0,0,0,1,0,0,0,1],e!=null&&t!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&this.set(e,t,s,r,i,a,o,c,h)}set(e,t,s,r,i,a,o,c,h){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=i,d[5]=c,d[6]=s,d[7]=a,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,r=t.elements,i=this.elements,a=s[0],o=s[3],c=s[6],h=s[1],d=s[4],u=s[7],m=s[2],p=s[5],y=s[8],_=r[0],x=r[3],f=r[6],k=r[1],T=r[4],S=r[7],I=r[2],z=r[5],P=r[8];return i[0]=a*_+o*k+c*I,i[3]=a*x+o*T+c*z,i[6]=a*f+o*S+c*P,i[1]=h*_+d*k+u*I,i[4]=h*x+d*T+u*z,i[7]=h*f+d*S+u*P,i[2]=m*_+p*k+y*I,i[5]=m*x+p*T+y*z,i[8]=m*f+p*S+y*P,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8];return t*a*d-t*o*h-s*i*d+s*o*c+r*i*h-r*a*c}invert(){const e=this.elements,t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8],u=d*a-o*h,m=o*c-d*i,p=h*i-a*c,y=t*u+s*m+r*p;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/y;return e[0]=u*_,e[1]=(r*h-d*s)*_,e[2]=(o*s-r*a)*_,e[3]=m*_,e[4]=(d*t-r*c)*_,e[5]=(r*i-o*t)*_,e[6]=p*_,e[7]=(s*c-h*t)*_,e[8]=(a*t-s*i)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e.elements[0]=t[0],e.elements[1]=t[3],e.elements[2]=t[6],e.elements[3]=t[1],e.elements[4]=t[4],e.elements[5]=t[7],e.elements[6]=t[2],e.elements[7]=t[5],e.elements[8]=t[8],this}setUvTransform(e,t,s,r,i,a,o){const c=Math.cos(i),h=Math.sin(i);return this.set(s*c,s*h,-s*(c*a+h*o)+a+e,-r*h,r*c,-r*(-h*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Gs.makeScale(e,t)),this}rotate(e){return this.premultiply(Gs.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gs.makeTranslation(e,t)),this}makeTranslation(e,t){return e instanceof B?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let r=0;r<9;r++)if(t[r]!==s[r])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new ca().fromArray(this.elements)}};js.IDENTITY=Object.freeze(new js);let qt=js;const Gs=new qt,He=1e-6,H=2*Math.PI,qo={x:0,y:0},Hs={x:0,y:0,z:0};class Wr{constructor(){this.equalPointTol=He,this.equalVectorTol=He}equalPoint2d(e,t){return new B(e).sub(t).length()<this.equalPointTol}equalPoint3d(e,t){return new A(e).sub(t).length()<this.equalPointTol}static equalToZero(e,t=He){return e<t&&e>-t}static equal(e,t,s=He){return Math.abs(e-t)<s}static great(e,t,s=He){return e-t>s}static less(e,t,s=He){return e-t<s}}const Us=new Wr;function Ws(n,e,t=!1){const s=n.x,r=n.y;let i=!1;const a=e.length;for(let o=0,c=a-1;o<a;c=o++){const h=e[o].x,d=e[o].y,u=e[c].x,m=e[c].y;let p=d>r!=m>r;t&&(p=d>=r!=m>=r),p&&s<(u-h)*(r-d)/(m-d)+h&&(i=!i)}return i}function Yr(n,e){if(n.length===0||e.length===0)return!1;const t=new K().setFromPoints(n),s=new K().setFromPoints(e);if(!t.intersectsBox(s))return!1;for(let r=0;r<n.length;){if(Ws(n[r],e,!0))return!0;r<n.length-1&&Us.equalPoint2d(n[r+1],n[r])&&++r,++r}return!1}const qr={isPointInPolygon:Ws,isPolygonIntersect:Yr};function Xr(n,e){const t=[],s=e-1,r=n;for(let i=0;i<=r;i++)t.push(0);for(let i=1;i<=s-r;i++)t.push(i);for(let i=0;i<=r;i++)t.push(s-r+1);return t}function $r(n,e){const t=e.length-1,s=n,r=[0];let i=0;for(let o=1;o<=t;o++){const c=e[o][0]-e[o-1][0],h=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(c*c+h*h+d*d);i+=u,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=t-s;o++){const c=r[o]/i;a.push(c*(t-s+1))}for(let o=0;o<=s;o++)a.push(t-s+1);return a}function Kr(n,e){const t=e.length-1,s=n,r=[0];let i=0;for(let o=1;o<=t;o++){const c=e[o][0]-e[o-1][0],h=e[o][1]-e[o-1][1],d=e[o][2]-e[o-1][2],u=Math.sqrt(c*c+h*h+d*d),m=Math.sqrt(u);i+=m,r.push(i)}const a=[];for(let o=0;o<=s;o++)a.push(0);for(let o=1;o<=t-s;o++){const c=r[o]/i;a.push(c*(t-s+1))}for(let o=0;o<=s;o++)a.push(t-s+1);return a}function Xt(n,e,t,s){if(e===0)return t>=s[n]&&t<s[n+1]?1:0;const r=s[n+e]-s[n],i=s[n+e+1]-s[n+1],a=r>1e-10?(t-s[n])/r:0,o=i>1e-10?(s[n+e+1]-t)/i:0;return a*Xt(n,e-1,t,s)+o*Xt(n+1,e-1,t,s)}function $t(n,e,t,s,r){const i=s.length-1,a=e;n=Math.max(t[a],Math.min(t[i+1],n));const o=[0,0,0];let c=0;for(let h=0;h<=i;h++){const d=Xt(h,a,n,t),u=r[h]*d;o[0]+=s[h][0]*u,o[1]+=s[h][1]*u,o[2]+=s[h][2]*u,c+=u}return c>1e-10&&(o[0]/=c,o[1]/=c,o[2]/=c),o}function Zr(n,e,t,s){const r=n,i=e[r],a=e[e.length-r-1];let o=0;const c=1e3,h=(a-i)/c;let d=$t(i,n,e,t,s);for(let u=1;u<=c;u++){const m=i+u*h,p=$t(m,n,e,t,s),y=p[0]-d[0],_=p[1]-d[1],x=p[2]-d[2];o+=Math.sqrt(y*y+_*_+x*x),d=p}return o}function Qr(n){return n.map(e=>[...e])}class ke{constructor(e=0,t=0,s=0,r=1){this._x=e,this._y=t,this._z=s,this._w=r}static slerpFlat(e,t,s,r,i,a,o){let c=s[r+0],h=s[r+1],d=s[r+2],u=s[r+3];const m=i[a+0],p=i[a+1],y=i[a+2],_=i[a+3];if(o===0){e[t+0]=c,e[t+1]=h,e[t+2]=d,e[t+3]=u;return}if(o===1){e[t+0]=m,e[t+1]=p,e[t+2]=y,e[t+3]=_;return}if(u!==_||c!==m||h!==p||d!==y){let x=1-o;const f=c*m+h*p+d*y+u*_,k=f>=0?1:-1,T=1-f*f;if(T>Number.EPSILON){const I=Math.sqrt(T),z=Math.atan2(I,f*k);x=Math.sin(x*z)/I,o=Math.sin(o*z)/I}const S=o*k;if(c=c*x+m*S,h=h*x+p*S,d=d*x+y*S,u=u*x+_*S,x===1-o){const I=1/Math.sqrt(c*c+h*h+d*d+u*u);c*=I,h*=I,d*=I,u*=I}}e[t]=c,e[t+1]=h,e[t+2]=d,e[t+3]=u}static multiplyQuaternionsFlat(e,t,s,r,i,a){const o=s[r],c=s[r+1],h=s[r+2],d=s[r+3],u=i[a],m=i[a+1],p=i[a+2],y=i[a+3];return e[t]=o*y+d*u+c*p-h*m,e[t+1]=c*y+d*m+h*u-o*p,e[t+2]=h*y+d*p+o*m-c*u,e[t+3]=d*y-o*u-c*m-h*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,s,r){return this._x=e,this._y=t,this._z=s,this._w=r,this._onChangeCallback(),this}clone(){return new ke(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const s=e.x,r=e.y,i=e.z,a=e.order,o=Math.cos,c=Math.sin,h=o(s/2),d=o(r/2),u=o(i/2),m=c(s/2),p=c(r/2),y=c(i/2);switch(a){case"XYZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"YXZ":this._x=m*d*u+h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"ZXY":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u-m*p*y;break;case"ZYX":this._x=m*d*u-h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u+m*p*y;break;case"YZX":this._x=m*d*u+h*p*y,this._y=h*p*u+m*d*y,this._z=h*d*y-m*p*u,this._w=h*d*u-m*p*y;break;case"XZY":this._x=m*d*u-h*p*y,this._y=h*p*u-m*d*y,this._z=h*d*y+m*p*u,this._w=h*d*u+m*p*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const s=t/2,r=Math.sin(s);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,s=t[0],r=t[4],i=t[8],a=t[1],o=t[5],c=t[9],h=t[2],d=t[6],u=t[10],m=s+o+u;if(m>0){const p=.5/Math.sqrt(m+1);this._w=.25/p,this._x=(d-c)*p,this._y=(i-h)*p,this._z=(a-r)*p}else if(s>o&&s>u){const p=2*Math.sqrt(1+s-o-u);this._w=(d-c)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+h)/p}else if(o>u){const p=2*Math.sqrt(1+o-s-u);this._w=(i-h)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(c+d)/p}else{const p=2*Math.sqrt(1+u-s-o);this._w=(a-r)/p,this._x=(i+h)/p,this._y=(c+d)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let s=e.dot(t)+1;return s<Number.EPSILON?(s=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=s):(this._x=0,this._y=-e.z,this._z=e.y,this._w=s)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=s),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ee(this.dot(e),-1,1)))}rotateTowards(e,t){const s=this.angleTo(e);if(s===0)return this;const r=Math.min(1,t/s);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const s=e._x,r=e._y,i=e._z,a=e._w,o=t._x,c=t._y,h=t._z,d=t._w;return this._x=s*d+a*o+r*h-i*c,this._y=r*d+a*c+i*o-s*h,this._z=i*d+a*h+s*c-r*o,this._w=a*d-s*o-r*c-i*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const s=this._x,r=this._y,i=this._z,a=this._w;let o=a*e._w+s*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=s,this._y=r,this._z=i,this;const c=1-o*o;if(c<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*s+t*this._x,this._y=p*r+t*this._y,this._z=p*i+t*this._z,this.normalize(),this}const h=Math.sqrt(c),d=Math.atan2(h,o),u=Math.sin((1-t)*d)/h,m=Math.sin(t*d)/h;return this._w=a*u+this._w*m,this._x=s*u+this._x*m,this._y=r*u+this._y*m,this._z=i*u+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,s){return this.copy(e).slerp(t,s)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),s=Math.random(),r=Math.sqrt(1-s),i=Math.sqrt(s);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const ae=class da{constructor(e,t,s){this.x=0,this.y=0,this.z=0;const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!==0){if(r===1&&e instanceof Array){this.x=e[0],this.y=e[1],this.z=e[2];return}if(r===1){const{x:i,y:a,z:o}=e;this.x=i,this.y=a,this.z=o||0;return}if(r===3){this.x=e,this.y=t,this.z=s;return}throw te.ILLEGAL_PARAMETERS}}set(e,t,s){return s===void 0&&(s=this.z),this.x=e,this.y=t,this.z=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new da(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z||0,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z||0,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Jr.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Jr.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,s=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*s+i[6]*r,this.y=i[1]*t+i[4]*s+i[7]*r,this.z=i[2]*t+i[5]*s+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix3d(e){const t=this.x,s=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*s+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*s+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*s+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*s+i[10]*r+i[14])*a,this}applyQuaternion(e){const t=this.x,s=this.y,r=this.z,i=e.x,a=e.y,o=e.z,c=e.w,h=2*(a*r-o*s),d=2*(o*t-i*r),u=2*(i*s-a*t);return this.x=t+c*h+a*u-o*d,this.y=s+c*d+o*h-i*u,this.z=r+c*u+i*d-a*h,this}transformDirection(e){const t=this.x,s=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*s+i[8]*r,this.y=i[1]*t+i[5]*s+i[9]*r,this.z=i[2]*t+i[6]*s+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}isParallelTo(e){const t=this.dot(e),s=this.length(),r=e.length();return Math.abs(t)===s*r}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this.z=e.z+(t.z-e.z)*s,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const s=e.x,r=e.y,i=e.z,a=t.x,o=t.y,c=t.z;return this.x=r*c-i*o,this.y=i*a-s*c,this.z=s*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const s=e.dot(this)/t;return this.copy(e).multiplyScalar(s)}projectOnPlane(e){return Ys.copy(this).projectOnVector(e),this.sub(Ys)}reflect(e){return this.sub(Ys.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Math.max(-1,Math.min(1,s)))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y,r=this.z-e.z;return t*t+s*s+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),s=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=s,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,s=Math.sqrt(1-t*t);return this.x=s*Math.cos(e),this.y=t,this.z=s*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ae.X_AXIS=Object.freeze(new ae(1,0,0)),ae.NEGATIVE_X_AXIS=Object.freeze(new ae(-1,0,0)),ae.Y_AXIS=Object.freeze(new ae(0,1,0)),ae.NEGATIVE_Y_AXIS=Object.freeze(new ae(0,-1,0)),ae.Z_AXIS=Object.freeze(new ae(0,0,1)),ae.NEGATIVE_Z_AXIS=Object.freeze(new ae(0,0,-1));let A=ae;const Ys=new A,Jr=new ke,qs=class ua{constructor(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!=null&&t!=null&&s!=null&&r!=null&&i!=null&&a!=null&&o!=null&&c!=null&&h!=null&&d!=null&&u!=null&&m!=null&&p!=null&&y!=null&&_!=null&&x!=null&&this.set(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x)}set(e,t,s,r,i,a,o,c,h,d,u,m,p,y,_,x){const f=this.elements;return f[0]=e,f[4]=t,f[8]=s,f[12]=r,f[1]=i,f[5]=a,f[9]=o,f[13]=c,f[2]=h,f[6]=d,f[10]=u,f[14]=m,f[3]=p,f[7]=y,f[11]=_,f[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ua().fromArray(this.elements)}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],this}copyPosition(e){const t=this.elements,s=e.elements;return t[12]=s[12],t[13]=s[13],t[14]=s[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}setFromExtrusionDirection(e){if(Us.equalPoint3d(e,A.Z_AXIS))this.identity();else{const t=new A(1,0,0);Math.abs(e.x)<1/64&&Math.abs(e.y)<1/64?t.crossVectors(A.Y_AXIS,e).normalize():t.crossVectors(A.Z_AXIS,e).normalize();const s=e.clone().cross(t).normalize();this.set(t.x,t.y,t.z,0,s.x,s.y,s.z,0,e.x,e.y,e.z,0,0,0,0,1)}return this}extractBasis(e,t,s){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(e,t,s){return this.set(e.x,t.x,s.x,0,e.y,t.y,s.y,0,e.z,t.z,s.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,s=e.elements,r=1/nt.setFromMatrixColumn(e,0).length(),i=1/nt.setFromMatrixColumn(e,1).length(),a=1/nt.setFromMatrixColumn(e,2).length();return t[0]=s[0]*r,t[1]=s[1]*r,t[2]=s[2]*r,t[3]=0,t[4]=s[4]*i,t[5]=s[5]*i,t[6]=s[6]*i,t[7]=0,t[8]=s[8]*a,t[9]=s[9]*a,t[10]=s[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Xo,e,$o)}lookAt(e,t,s){const r=this.elements;return oe.subVectors(e,t),oe.lengthSq()===0&&(oe.z=1),oe.normalize(),Oe.crossVectors(s,oe),Oe.lengthSq()===0&&(Math.abs(s.z)===1?oe.x+=1e-4:oe.z+=1e-4,oe.normalize(),Oe.crossVectors(s,oe)),Oe.normalize(),Kt.crossVectors(oe,Oe),r[0]=Oe.x,r[4]=Kt.x,r[8]=oe.x,r[1]=Oe.y,r[5]=Kt.y,r[9]=oe.y,r[2]=Oe.z,r[6]=Kt.z,r[10]=oe.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,r=t.elements,i=this.elements,a=s[0],o=s[4],c=s[8],h=s[12],d=s[1],u=s[5],m=s[9],p=s[13],y=s[2],_=s[6],x=s[10],f=s[14],k=s[3],T=s[7],S=s[11],I=s[15],z=r[0],P=r[4],W=r[8],le=r[12],Me=r[1],C=r[5],V=r[9],Ze=r[13],Qe=r[2],cs=r[6],ds=r[10],us=r[14],ms=r[3],gs=r[7],ps=r[11],ys=r[15];return i[0]=a*z+o*Me+c*Qe+h*ms,i[4]=a*P+o*C+c*cs+h*gs,i[8]=a*W+o*V+c*ds+h*ps,i[12]=a*le+o*Ze+c*us+h*ys,i[1]=d*z+u*Me+m*Qe+p*ms,i[5]=d*P+u*C+m*cs+p*gs,i[9]=d*W+u*V+m*ds+p*ps,i[13]=d*le+u*Ze+m*us+p*ys,i[2]=y*z+_*Me+x*Qe+f*ms,i[6]=y*P+_*C+x*cs+f*gs,i[10]=y*W+_*V+x*ds+f*ps,i[14]=y*le+_*Ze+x*us+f*ys,i[3]=k*z+T*Me+S*Qe+I*ms,i[7]=k*P+T*C+S*cs+I*gs,i[11]=k*W+T*V+S*ds+I*ps,i[15]=k*le+T*Ze+S*us+I*ys,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[4],r=e[8],i=e[12],a=e[1],o=e[5],c=e[9],h=e[13],d=e[2],u=e[6],m=e[10],p=e[14],y=e[3],_=e[7],x=e[11],f=e[15];return y*(+i*c*u-r*h*u-i*o*m+s*h*m+r*o*p-s*c*p)+_*(+t*c*p-t*h*m+i*a*m-r*a*p+r*h*d-i*c*d)+x*(+t*h*u-t*o*p-i*a*u+s*a*p+i*o*d-s*h*d)+f*(-r*o*d-t*c*u+t*o*m+r*a*u-s*a*m+s*c*d)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,s){const r=this.elements;return e instanceof A?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=s),this}invert(){const e=this.elements,t=e[0],s=e[1],r=e[2],i=e[3],a=e[4],o=e[5],c=e[6],h=e[7],d=e[8],u=e[9],m=e[10],p=e[11],y=e[12],_=e[13],x=e[14],f=e[15],k=u*x*h-_*m*h+_*c*p-o*x*p-u*c*f+o*m*f,T=y*m*h-d*x*h-y*c*p+a*x*p+d*c*f-a*m*f,S=d*_*h-y*u*h+y*o*p-a*_*p-d*o*f+a*u*f,I=y*u*c-d*_*c-y*o*m+a*_*m+d*o*x-a*u*x,z=t*k+s*T+r*S+i*I;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/z;return e[0]=k*P,e[1]=(_*m*i-u*x*i-_*r*p+s*x*p+u*r*f-s*m*f)*P,e[2]=(o*x*i-_*c*i+_*r*h-s*x*h-o*r*f+s*c*f)*P,e[3]=(u*c*i-o*m*i-u*r*h+s*m*h+o*r*p-s*c*p)*P,e[4]=T*P,e[5]=(d*x*i-y*m*i+y*r*p-t*x*p-d*r*f+t*m*f)*P,e[6]=(y*c*i-a*x*i-y*r*h+t*x*h+a*r*f-t*c*f)*P,e[7]=(a*m*i-d*c*i+d*r*h-t*m*h-a*r*p+t*c*p)*P,e[8]=S*P,e[9]=(y*u*i-d*_*i-y*s*p+t*_*p+d*s*f-t*u*f)*P,e[10]=(a*_*i-y*o*i+y*s*h-t*_*h-a*s*f+t*o*f)*P,e[11]=(d*o*i-a*u*i-d*s*h+t*u*h+a*s*p-t*o*p)*P,e[12]=I*P,e[13]=(d*_*r-y*u*r+y*s*m-t*_*m-d*s*x+t*u*x)*P,e[14]=(y*o*r-a*_*r-y*s*c+t*_*c+a*s*x-t*o*x)*P,e[15]=(a*u*r-d*o*r+d*s*c-t*u*c-a*s*m+t*o*m)*P,this}scale(e){const t=this.elements,s=e.x,r=e.y,i=e.z;return t[0]*=s,t[4]*=r,t[8]*=i,t[1]*=s,t[5]*=r,t[9]*=i,t[2]*=s,t[6]*=r,t[10]*=i,t[3]*=s,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],s=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,s,r))}makeTranslation(e,t,s){return e instanceof A?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,s,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),s=Math.sin(e);return this.set(1,0,0,0,0,t,-s,0,0,s,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,0,s,0,0,1,0,0,-s,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,0,s,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const s=Math.cos(t),r=Math.sin(t),i=1-s,a=e.x,o=e.y,c=e.z,h=i*a,d=i*o;return this.set(h*a+s,h*o-r*c,h*c+r*o,0,h*o+r*c,d*o+s,d*c-r*a,0,h*c-r*o,d*c+r*a,i*c*c+s,0,0,0,0,1),this}makeScale(e,t,s){return this.set(e,0,0,0,0,t,0,0,0,0,s,0,0,0,0,1),this}makeShear(e,t,s,r,i,a){return this.set(1,s,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,s){const r=this.elements,i=t.x,a=t.y,o=t.z,c=t.w,h=i+i,d=a+a,u=o+o,m=i*h,p=i*d,y=i*u,_=a*d,x=a*u,f=o*u,k=c*h,T=c*d,S=c*u,I=s.x,z=s.y,P=s.z;return r[0]=(1-(_+f))*I,r[1]=(p+S)*I,r[2]=(y-T)*I,r[3]=0,r[4]=(p-S)*z,r[5]=(1-(m+f))*z,r[6]=(x+k)*z,r[7]=0,r[8]=(y+T)*P,r[9]=(x-k)*P,r[10]=(1-(m+_))*P,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,s){const r=this.elements;let i=nt.set(r[0],r[1],r[2]).length();const a=nt.set(r[4],r[5],r[6]).length(),o=nt.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],ue.copy(this);const c=1/i,h=1/a,d=1/o;return ue.elements[0]*=c,ue.elements[1]*=c,ue.elements[2]*=c,ue.elements[4]*=h,ue.elements[5]*=h,ue.elements[6]*=h,ue.elements[8]*=d,ue.elements[9]*=d,ue.elements[10]*=d,t.setFromRotationMatrix(ue),s.x=i,s.y=a,s.z=o,this}equals(e){const t=this.elements,s=e.elements;for(let r=0;r<16;r++)if(t[r]!==s[r])return!1;return!0}fromArray(e,t=0){for(let s=0;s<16;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e[t+9]=s[9],e[t+10]=s[10],e[t+11]=s[11],e[t+12]=s[12],e[t+13]=s[13],e[t+14]=s[14],e[t+15]=s[15],e}};qs.IDENTITY=Object.freeze(new qs);let Ue=qs;const nt=new A,ue=new Ue,Xo=new A(0,0,0),$o=new A(1,1,1),Oe=new A,Kt=new A,oe=new A;class N{constructor(e=void 0,t=void 0){this.min=e==null?new A(1/0,1/0,1/0):new A(e.x,e.y,e.z),this.max=t==null?new A(-1/0,-1/0,-1/0):new A(t.x,t.y,t.z)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t+=3)this.expandByPoint(Xs.fromArray(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=Xs.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new N().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new A(0,0,0):new A(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new A(0,0,0):new A(0,0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsPlane(e){let t,s;return e.normal.x>0?(t=e.normal.x*this.min.x,s=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,s=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,s+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,s+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,s+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,s+=e.normal.z*this.min.z),t<=-e.constant&&s>=-e.constant}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xs).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Te[0].set(this.min.x,this.min.y,this.min.z).applyMatrix3d(e),Te[1].set(this.min.x,this.min.y,this.max.z).applyMatrix3d(e),Te[2].set(this.min.x,this.max.y,this.min.z).applyMatrix3d(e),Te[3].set(this.min.x,this.max.y,this.max.z).applyMatrix3d(e),Te[4].set(this.max.x,this.min.y,this.min.z).applyMatrix3d(e),Te[5].set(this.max.x,this.min.y,this.max.z).applyMatrix3d(e),Te[6].set(this.max.x,this.max.y,this.min.z).applyMatrix3d(e),Te[7].set(this.max.x,this.max.y,this.max.z).applyMatrix3d(e),this.setFromPoints(Te),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Te=[new A,new A,new A,new A,new A,new A,new A,new A],Xs=new A,ei=new B;class K{constructor(e=void 0,t=void 0){this.min=e==null?new B(1/0,1/0):new B(e.x,e.y),this.max=t==null?new B(-1/0,-1/0):new B(t.x,t.y)}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,s=e.length;t<s;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const s=ei.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(s),this.max.copy(e).add(s),this}clone(){return new K().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new B(0,0):new B(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new B(0,0):new B(0,0).subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ei).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ti=new A,Ko=new A,Zo=new qt;class Mt{constructor(e=new A(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,s,r){return this.normal.set(e,t,s),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,s){const r=ti.subVectors(s,t).cross(Ko.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectsBox(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const s=t||Zo.getNormalMatrix(e),r=this.coplanarPoint(ti).applyMatrix3d(e),i=this.normal.applyMatrix3(s).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new Mt().copy(this)}}class v extends B{static pointArrayToNumberArray(e){const t=new Array(e.length*2);return e.forEach((s,r)=>{s.toArray(t,r*2)}),t}}let w=class extends A{static pointArrayToNumberArray(e,t=!0){const s=t?3:2,r=new Array(e.length*s);return e.forEach((i,a)=>{i.toArray(r,a*s)}),r}};const si=new Ue,ni=new ke,ri=class cn{constructor(e=0,t=0,s=0,r=cn.DEFAULT_ORDER){this._x=e,this._y=t,this._z=s,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,s,r=this._order){return this._x=e,this._y=t,this._z=s,this._order=r,this._onChangeCallback(),this}clone(){return new cn(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,s=!0){const r=e.elements,i=r[0],a=r[4],o=r[8],c=r[1],h=r[5],d=r[9],u=r[2],m=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Ee(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,p),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ee(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,i),this._z=0);break;case"ZXY":this._x=Math.asin(Ee(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,i));break;case"ZYX":this._y=Math.asin(-Ee(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(m,p),this._z=Math.atan2(c,i)):(this._x=0,this._z=Math.atan2(-a,h));break;case"YZX":this._z=Math.asin(Ee(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ee(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-d,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,s===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,s=!0){return si.makeRotationFromQuaternion(e),this.setFromRotationMatrix(si,t,s)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ni.setFromEuler(this),this.setFromQuaternion(ni,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};ri.DEFAULT_ORDER="XYZ";let ii=ri;class ai{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class $s extends ai{translate(e){return this.transform(new qt().makeTranslation(e.x,e.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Zt extends $s{constructor(){super(),this._loops=[]}add(e){this._loops.push(e),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const e=this.outter;return e?e.box:new K}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints(e){const t=[];for(let s=0;s<this.loops.length;++s){const r=this.loops[s].getPoints(e);t.push(r)}return t}buildHierarchy(){var e;const t=this.getPoints(100),s=this.calculateBoundaryBoxes(t),r=this.sortBoundaryBoxesByAreas(s),i=new Map,a=r.length;for(let c=0;c<a;c++)i.set(r[c],{index:r[c],children:[]});const o={index:-1,children:[]};for(let c=0;c<a;c++){const h=r[c],d=t[h],u=s[h];let m=c+1;for(;m<a;m++){const p=r[m],y=t[p];if(s[p].containsBox(u)&&qr.isPointInPolygon(d[O.randInt(0,d.length-1)],y)){(e=i.get(p))==null||e.children.push(i.get(h));break}}m===a&&o.children.push(i.get(h))}return o}calculateBoundaryBoxes(e){const t=[];return e.forEach(s=>{t.push(new K().setFromPoints(s))}),t}sortBoundaryBoxesByAreas(e){const t=[];e.forEach((r,i)=>{const a=r.size,o=a.width*a.height;t.push({area:o,index:i})}),t.sort((r,i)=>r.area-i.area);const s=[];return t.forEach(r=>{s.push(r.index)}),s}}class rt extends $s{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(e){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(e){const t=this.getUtoTmapping(e);return this.getPoint(t)}getPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPoint(s/e));return t}getSpacedPoints(e=5){const t=[];for(let s=0;s<=e;s++)t.push(this.getPointAt(s/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){const t=[];let s,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)s=this.getPoint(a/e),i+=s.distanceTo(r),t.push(i),r=s;return t}getUtoTmapping(e,t){const s=this.getLengths();let r=0;const i=s.length;let a;t?a=t:a=e*s[i-1];let o=0,c=i-1,h;for(;o<=c;)if(r=Math.floor(o+(c-o)/2),h=s[r]-a,h<0)o=r+1;else if(h>0)c=r-1;else{c=r;break}if(r=c,s[r]===a)return r/(i-1);const d=s[r],u=s[r+1]-d,m=(a-d)/u;return(r+m)/(i-1)}getTangent(e){let t=e-1e-4,s=e+1e-4;t<0&&(t=0),s>1&&(s=1);const r=this.getPoint(t),i=this.getPoint(s),a=new v;return a.copy(i).sub(r).normalize(),a}getTangentAt(e){const t=this.getUtoTmapping(e);return this.getTangent(t)}}class it extends rt{constructor(e,t,s,r,i){super();const a=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0)+ +(r!==void 0)+ +(i!==void 0);if(a==3)typeof e=="object"&&typeof t=="object"&&typeof s=="object"?this.createByThreePoints(e,t,s):this.createByStartEndPointsAndBulge(e,t,s);else if(a==5){const o=e;this.center=new v(o.x,o.y),this.radius=t,this.startAngle=s,this.endAngle=r,this.clockwise=i}else throw te.ILLEGAL_PARAMETERS}createByThreePoints(e,t,s){const r=(P,W)=>({x:(P.x+W.x)/2,y:(P.y+W.y)/2}),i=(P,W)=>(W.y-P.y)/(W.x-P.x),a=P=>-1/P,o=r(e,t),c=r(t,s),h=i(e,t),d=i(t,s),u=a(h),m=a(d),p=(P,W,le,Me)=>{const C=(Me-W)/(P-le),V=P*C+W;return{x:C,y:V}},y=o.y-u*o.x,_=c.y-m*c.x,x=p(u,y,m,_),f=Math.sqrt(Math.pow(e.x-x.x,2)+Math.pow(e.y-x.y,2)),k=(P,W)=>Math.atan2(P.y-W.y,P.x-W.x),T=k(e,x),S=k(t,x),I=k(s,x),z=I>T&&I<S||T>I&&T<S||S>I&&S<T;this.center=x,this.radius=f,this.startAngle=T,this.endAngle=I,this.clockwise=!z}createByStartEndPointsAndBulge(e,t,s){let r,i,a;s<0?(r=Math.atan(-s)*4,i=new B(e),a=new B(t)):(r=Math.atan(s)*4,i=new B(t),a=new B(e));const o=new B().subVectors(a,i),c=o.length(),h=new B().addVectors(i,o.multiplyScalar(.5)),d=Math.abs(c/2/Math.tan(r/2)),u=o.normalize();let m;if(r<Math.PI){const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(-d))}else{const p=new B(u.x*Math.cos(Math.PI/2)-u.y*Math.sin(Math.PI/2),u.y*Math.cos(Math.PI/2)+u.x*Math.sin(Math.PI/2));m=h.add(p.multiplyScalar(d))}s<0?(this.startAngle=Math.atan2(i.y-m.y,i.x-m.x),this.endAngle=Math.atan2(a.y-m.y,a.x-m.x)):(this.startAngle=Math.atan2(a.y-m.y,a.x-m.x),this.endAngle=Math.atan2(i.y-m.y,i.x-m.x)),this.clockwise=s<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(e){this._center=new v(e.x,e.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return this.clockwise?O.normalizeAngle(this.startAngle-this.endAngle):O.normalizeAngle(this.endAngle-this.startAngle)}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const e=O.normalizeAngle((this.startAngle+this.endAngle)/2);return this.getPointAtAngle(e)}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}calculateBoundingBox(){const e=[this.startPoint,this.endPoint],t=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const i of t)O.isBetweenAngle(i,this.startAngle,this.endAngle,this.clockwise)&&e.push(this.getPointAtAngle(i));const s=e.map(i=>i.x),r=e.map(i=>i.y);return new K(new v(Math.min(...s),Math.min(...r)),new v(Math.max(...s),Math.max(...r)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new it(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.clockwise)}getPointAtAngle(e){const t=this.center.x+this.radius*Math.cos(e),s=this.center.y+this.radius*Math.sin(e);return new v(t,s)}getPoints(e=100){const t=[];let s=this.deltaAngle,r=this.startAngle;if(this.closed&&(s=H,r=0),this.clockwise)for(let i=0;i<=e;i++){const a=r-s*(i/e),o=this.getPointAtAngle(a);t.push(new v(o.x,o.y))}else for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(new v(o.x,o.y))}return t}}class Qo extends ai{translate(e){return this.transform(new Ue().makeTranslation(e.x,e.y,e.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class Qt extends Qo{}class Ce extends Qt{constructor(e,t){super(),this._start=new w(e),this._end=new w(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}get direction(){return new A().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new w((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(e){return this.project(e).distanceTo(e)<1e-6}at(e,t){return this.delta(t).multiplyScalar(e).add(this._start)}atLength(e,t=!1){if(t){const s=this.delta(We).normalize();return new w(this._start).addScaledVector(s,e)}else{const s=this.delta(We).normalize();return new w(this._end).addScaledVector(s,e)}}extend(e,t=!1){if(t){const s=We.subVectors(this._start,this._end).normalize();this._start=new w(this._start).addScaledVector(s,e)}else{const s=this.delta(We).normalize();this._end=new w(this._end).addScaledVector(s,e)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(e,t){oi.subVectors(e,this._start),Jt.subVectors(this.endPoint,this.startPoint);const s=Jt.dot(Jt);let r=Jt.dot(oi)/s;return t&&(r=O.clamp(r,0,1)),r}closestPointToPoint(e,t,s){const r=this.closestPointToPointParameter(e,t);return this.delta(s).multiplyScalar(r).add(this._start)}delta(e){return e.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(e){const t=this.direction,s=We.subVectors(e,this.startPoint).dot(t);return new w().copy(t).multiplyScalar(s).add(this.startPoint)}perpPoint(e){const t=this.direction,s=this.startPoint,r=We.subVectors(e,s).dot(t),i=We.copy(t).multiplyScalar(r);return new w().addVectors(s,i)}calculateBoundingBox(){const e=new w(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),t=new w(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y),Math.max(this._start.z,this._end.z));return new N(e,t)}transform(e){return this._start.applyMatrix3d(e),this._end.applyMatrix3d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ce(this._start.clone(),this._end.clone())}}const We=new A,oi=new A,Jt=new A;class Ye extends Qt{static computeCenterPoint(e,t,s){const r=new A().addVectors(e,t).multiplyScalar(.5),i=new A().addVectors(e,s).multiplyScalar(.5),a=new A().subVectors(t,e),o=new A().subVectors(s,e),c=new A().crossVectors(a,o).normalize();if(c.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const h=new A().crossVectors(a,c).normalize(),d=new A().crossVectors(o,c).normalize(),u=h.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),p=new Ce(r,r.clone().add(u)),y=new Ce(i,i.clone().add(m)),_=new A;return p.closestPointToPoint(y.startPoint,!0,_)?_:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(e,t,s){const r=Ye.computeCenterPoint(e,t,s);if(r){const i=r.distanceTo(e),a=new A().subVectors(e,r),o=new A().subVectors(t,r),c=Math.atan2(a.y,a.x),h=Math.atan2(o.y,o.x);return new Ye(r,i,c,h,A.Z_AXIS)}}constructor(e,t,s,r,i,a=A.X_AXIS){super(),this.center=e,this.radius=t,this.startAngle=s,this.endAngle=r,this.normal=i,this.refVec=a,(r-s)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=s,this.endAngle=r)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._radius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return O.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new A(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(e){this._refVec=new A(e.x,e.y,e.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){return Math.abs(this.deltaAngle*this.radius)}calculateBoundingBox(){const e=[this.startAngle,this.endAngle];for(let c=0;c<2*Math.PI;c+=Math.PI/2)O.isBetweenAngle(c,this.startAngle,this.endAngle)&&e.push(c);let t=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of e){const h=this.getPointAtAngle(c);h.x<t&&(t=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new N({x:t,y:s,z:r},{x:i,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(e){const t=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(o)}return t}transform(e){const t=Ks.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),s=Ks.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix3d(e),t.applyMatrix3d(e),s.applyMatrix3d(e),this.normal.applyMatrix3d(e).normalize(),this.refVec.applyMatrix3d(e).normalize(),this.startAngle=this.getAngle(t),this.endAngle=this.getAngle(s),this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.radius=e.radius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.normal=e.normal,this.refVec=e.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ye(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(e){return e.sub(this.center),Math.atan2(e.dot(Ks.crossVectors(this.refVec,this.normal)),e.dot(this.refVec))}getPointAtAngle(e){const t=this.normal,s=this.refVec,r={x:t.y*s.z-t.z*s.y,y:t.z*s.x-t.x*s.z,z:t.x*s.y-t.y*s.x},i=this.center,a=this.radius;return new w(i.x+a*(s.x*Math.cos(e)+r.x*Math.sin(e)),i.y+a*(s.y*Math.cos(e)+r.y*Math.sin(e)),i.z+a*(s.z*Math.cos(e)+r.z*Math.sin(e)))}get plane(){const e=new A(this.center).distanceTo(Hs);return new Mt(this.normal,e)}}const Ks=new A;class es extends rt{constructor(e,t,s,r=0,i=H,a=!1,o=0){super(),this.center=e,this.majorAxisRadius=t,this.minorAxisRadius=s,(i-r)%H==0?(this.startAngle=0,this.endAngle=H):(this.startAngle=r,this.endAngle=i),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(e){this._clockwise=e,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(e){this._rotation=e,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return O.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let e=1/0,t=1/0,s=-1/0,r=-1/0;for(let i=0;i<=100;i++){const a=this.getPoint(i/100);e=Math.min(e,a.x),t=Math.min(t,a.y),s=Math.max(s,a.x),r=Math.max(r,a.y)}return new K({x:e,y:t},{x:s,y:r})}get closed(){return this.deltaAngle==0}getPoint(e){const t=Math.PI*2;let s=this.endAngle-this.startAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=t;for(;s>t;)s-=t;s<Number.EPSILON&&(r?s=0:s=t),this.clockwise===!0&&!r&&(s===t?s=-t:s=s-t);const i=this.startAngle+e*s;let a=this.center.x+this.majorAxisRadius*Math.cos(i),o=this.center.y+this.minorAxisRadius*Math.sin(i);if(this.rotation!==0){const c=Math.cos(this.rotation),h=Math.sin(this.rotation),d=a-this.center.x,u=o-this.center.y;a=d*c-u*h+this.center.x,o=d*h+u*c+this.center.y}return new v(a,o)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this.clockwise=e.clockwise,this.rotation=e.rotation,this}clone(){return new es(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class ts extends Qt{constructor(e,t,s,r,i,a=0,o=H){super(),this.center=e,this.normal=t,this.majorAxis=s,this.majorAxisRadius=r,this.minorAxisRadius=i;const c=Math.abs(o-a);Math.abs(c-H)<1e-10||Math.abs(c-2*H)<1e-10?(this.startAngle=0,this.endAngle=H):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(e){this._center=new w(e.x,e.y,e.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._majorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(e){if(e<0)throw te.ILLEGAL_PARAMETERS;this._minorAxisRadius=e,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(e){this._startAngle=O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(e){this._endAngle=this.startAngle==0&&e==H?e:O.normalizeAngle(e),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const e=this.endAngle-this.startAngle;return Math.abs(e-H)<1e-10?H:O.normalizeAngle(e)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(e){this._normal=new A(e.x,e.y,e.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(e){this._majorAxis=new A(e.x,e.y,e.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new A().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get length(){const e=this.deltaAngle/1e3;let t=0,s=this.getPointAtAngle(this.startAngle);for(let r=1;r<=1e3;r++){const i=this.startAngle+r*e,a=this.getPointAtAngle(i),o=a.x-s.x,c=a.y-s.y,h=a.z-s.z;t+=Math.sqrt(o*o+c*c+h*h),s=a}return t}calculateBoundingBox(){if(this.majorAxis.equals(A.X_AXIS)||this.majorAxis.equals(A.Y_AXIS)||this.majorAxis.isParallelTo(A.X_AXIS)||this.majorAxis.isParallelTo(A.Y_AXIS)){const e=[this.startAngle,this.endAngle];for(let c=0;c<2*Math.PI;c+=Math.PI/2)O.isBetweenAngle(c,this.startAngle,this.endAngle)&&e.push(c);let t=1/0,s=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0;for(const c of e){const h=this.getPointAtAngle(c);h.x<t&&(t=h.x),h.y<s&&(s=h.y),h.z<r&&(r=h.z),h.x>i&&(i=h.x),h.y>a&&(a=h.y),h.z>o&&(o=h.z)}return new N({x:t,y:s,z:r},{x:i,y:a,z:o})}else{let e=1/0,t=1/0,s=1/0,r=-1/0,i=-1/0,a=-1/0;for(let o=0;o<=100;o++){const c=this.startAngle+this.deltaAngle*(o/100),h=this.getPointAtAngle(c);e=Math.min(e,h.x),t=Math.min(t,h.y),s=Math.min(s,h.z),r=Math.max(r,h.x),i=Math.max(i,h.y),a=Math.max(a,h.z)}return new N({x:e,y:t,z:s},{x:r,y:i,z:a})}}get closed(){return this.deltaAngle==0}getPoints(e=100){const t=[];let s=this.deltaAngle,r=this.startAngle;this.closed&&(s=H,r=0);for(let i=0;i<=e;i++){const a=r+s*(i/e),o=this.getPointAtAngle(a);t.push(o)}return t}getPointAtAngle(e){const t=Math.cos(e),s=Math.sin(e),r=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(s),i=this.majorAxis.clone().multiplyScalar(t*this.majorAxisRadius).add(r);return new w(this.center.x+i.x,this.center.y+i.y,this.center.z+i.z)}contains(e){const t=new A(e).sub(this.center),s=t.dot(this.majorAxis),r=t.dot(this.minorAxis),i=s/this.majorAxisRadius,a=r/this.minorAxisRadius;return i*i+a*a<=1}transform(e){return this._boundingBoxNeedsUpdate=!0,this}copy(e){return this.center=e.center,this.normal=e.normal,this.majorAxis=e.majorAxis,this.majorAxisRadius=e.majorAxisRadius,this.minorAxisRadius=e.minorAxisRadius,this.startAngle=e.startAngle,this.endAngle=e.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ts(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const e=new A(this.center).distanceTo(Hs);return new Mt(this.normal,e)}}class vt extends rt{constructor(e=null,t=!1){super(),this._vertices=e||new Array,this._closed=t}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const e=this._vertices[0];return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const e=this.numberOfVertices;if(e>0)if(this.closed){const t=this._vertices[0];return new v(t.x,t.y)}else{const t=this._vertices[e-1];return new v(t.x,t.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let e=0;const t=this._vertices.length;for(let s=0;s<t;++s){const r=this._vertices[s];let i=null;if(s<t-1?i=this._vertices[s+1]:s==t-1&&this.closed&&(i=this._vertices[0]),i)if(r.bulge){const a=new it(r,i,r.bulge);e+=a.length}else e+=new v(r.x,r.y).distanceTo(i)}return e}set closed(e){this._closed=e,this._boundingBoxNeedsUpdate=!0}addVertexAt(e,t){e<=0?this._vertices.unshift(t):this._vertices.splice(e,0,t),this._boundingBoxNeedsUpdate=!0}getPointAt(e){const t=this._vertices[e];return new v(t.x,t.y)}calculateBoundingBox(){const e=this.getPoints(100);return new K().setFromPoints(e)}transform(e){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(e,t){const s=[];return this.getPoints(e).forEach(r=>s.push(new w().set(r.x,r.y,t))),s}getPoints(e){const t=[],s=this._vertices.length;for(let r=0;r<s;++r){const i=this._vertices[r];if(i.bulge){let a=null;if(r<s-1?a=this._vertices[r+1]:r==s-1&&this.closed&&(a=this._vertices[0]),a){const o=new it(i,a,i.bulge).getPoints(e),c=o.length;for(let h=0;h<c;++h){const d=o[h];t.push(new v(d.x,d.y))}}}else t.push(new v(i.x,i.y)),r==s-1&&this.closed&&t.push(t[0])}return t}}class ss extends rt{constructor(e,t){super(),this._start=new v(e),this._end=new v(t)}get startPoint(){return this._start}set startPoint(e){this._start.copy(e),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(e){this._end.copy(e),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const e=new v(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),t=new v(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new K(e,t)}transform(e){return this._start.applyMatrix2d(e),this._end.applyMatrix2d(e),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(e){return this.startPoint=e.startPoint,this.endPoint=e.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ss(this._start.clone(),this._end.clone())}}class li extends rt{constructor(e=[]){super(),this._curves=e}get curves(){return this._curves}add(e){this._curves.push(e),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const e=this._curves[0].startPoint;return new v(e.x,e.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let e=0;return this._curves.forEach(t=>{e+=t.length}),e}calculateBoundingBox(){const e=this.getPoints(100),t=new K;return t.setFromPoints(e),t}transform(e){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(e){const t=[];return this.curves.forEach(s=>{s.getPoints(e).forEach(r=>{t.push(new v(r.x,r.y))})}),t}}class Lt{constructor(e,t,s,r){this._degree=e,this._knots=[...t],this._controlPoints=s.map(i=>[...i]),this._weights=r?[...r]:new Array(s.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(e=>[...e])}weights(){return[...this._weights]}point(e){return $t(e,this._degree,this._knots,this._controlPoints,this._weights)}length(){return Zr(this._degree,this._knots,this._controlPoints,this._weights)}static byKnotsControlPointsWeights(e,t,s,r){return new Lt(e,t,s,r)}static byPoints(e,t,s="Uniform"){let r;switch(s){case"Chord":r=$r(t,e);break;case"SqrtChord":r=Kr(t,e);break;case"Uniform":default:r=Xr(t,e.length);break}const i=Qr(e),a=new Array(i.length).fill(1);return new Lt(t,r,i,a)}}class at extends Qt{constructor(e,t,s){super();const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!=2&&r!=3)throw te.ILLEGAL_PARAMETERS;const i=3;if(this._closed=!1,r==2&&!Array.isArray(t)){if(this._fitPoints=e,this._knotParameterization=t,this._fitPoints.length<4)throw te.ILLEGAL_PARAMETERS;const a=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Lt.byPoints(a,i,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{if(this._controlPoints=e,this._controlPoints.length<4)throw te.ILLEGAL_PARAMETERS;const a=this.toNurbsPoints(this._controlPoints);this._nurbsCurve=Lt.byKnotsControlPointsWeights(i,t,a,s)}}get degree(){return this._nurbsCurve.degree()}get knotParameterization(){return this._knotParameterization}get startPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[t],r=this._nurbsCurve.point(s);return new w(r[0],r[1],r[2])}get endPoint(){const e=this._nurbsCurve.knots(),t=this._nurbsCurve.degree(),s=e[e.length-t-1],r=this._nurbsCurve.point(s);return new w(r[0],r[1],r[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(e){if(!this._fitPoints)throw new Error("No fit points in this spline");const t=this._fitPoints.length,s=e<0||e>=t?t-1:e,r=this._fitPoints[s];return{x:r.x,y:r.y,z:r.z||0}}getControlPointAt(e){const t=this._controlPoints.length,s=e<0||e>=t?t-1:e;return this._controlPoints[s]}getPoints(e=100){const t=this._nurbsCurve,s=[],r=t.knots(),i=this._nurbsCurve.degree(),a=r[i],o=r[r.length-i-1],c=(o-a)/(e-1);for(let h=0;h<e;h++){let d;h===e-1?d=o:d=a+h*c;const u=t.point(d);s.push(new w(u[0],u[1],u[2]))}return s}getCurvePoints(e,t){const s=[],r=e.knots(),i=r[3],a=(r[r.length-4]-i)/(t-1);for(let o=0;o<t;o++){const c=i+o*a;s.push(e.point(c))}return s}calculateBoundingBox(){const e=this.getPoints(100);return new N().setFromPoints(e)}get closed(){return this._closed}set closed(e){this._boundingBoxNeedsUpdate=!0,this._closed=e}transform(e){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(e){const t=new Array(e.length);return e.forEach((s,r)=>{t[r]=[s.x,s.y,s.z||0]}),t}toGePoints(e){const t=new Array(e.length);return e.forEach((s,r)=>{t[r]={x:s[0],y:s[1],z:s[2]}}),t}}for(var qe=256,hi=[],ci=256,ns;qe--;)hi[qe]=(qe+256).toString(16).substring(1);function Jo(n){var e=0,t=11;if(!ns||qe+t>ci*2)for(ns="",qe=0;e<ci;e++)ns+=hi[Math.random()*256|0];return ns.substring(qe,qe+++t)}class De{constructor(e,t){e=e||{},Je(e,{objectId:Jo()}),this._attrs=new yn(e,t)}get attrs(){return this._attrs}getAttr(e){const t=this._attrs.get(e);if(t===void 0)throw new Error(`[AcDbObject] Attribute name '${e}' does't exist in this object!`);return t}getAttrWithoutException(e){return this._attrs.get(e)}setAttr(e,t){this._attrs.set(e,t)}get objectId(){return this.getAttr("objectId")}set objectId(e){this._attrs.set("objectId",e)}get ownerId(){return this.getAttr("ownerId")}set ownerId(e){this._attrs.set("ownerId",e)}get database(){return this._database?this._database:hn().workingDatabase}set database(e){this._database=e}close(){}}class ge extends De{constructor(){super(...arguments),this._layer="0",this._color=new Ne,this._lineType=Wt,this._lineWeight=1,this._linetypeScale=-1,this._visibility=!0,this._transparency=0}get type(){return this.constructor.name.substring(4)}get layer(){return this._layer}set layer(e){this._layer=e}get color(){return this._color}set color(e){this._color.copy(e)}get rgbColor(){let e=this.database.cecolor;if(this.color.isByLayer){const t=this.getLayerColor();t&&t.color&&(e=t)}else this.color.isByBlock||this.color.color!=null&&(e=this.color);return e.color==null?16777215:e.color}get lineType(){return this._lineType}set lineType(e){this._lineType=e||Wt}get lineWeight(){return this._lineWeight}set lineWeight(e){this._lineWeight=e}get linetypeScale(){return this._linetypeScale}set linetypeScale(e){this._linetypeScale=e}get visibility(){return this._visibility}set visibility(e){this._visibility=e}get transparency(){return this._transparency}set transparency(e){this._transparency=e}subGetGripPoints(){return new Array}subGetOsnapPoints(e,t,s,r,i){}transformBy(e){return this}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}get lineStyle(){var s;const e=this.getLineType(),t=(s=this.database)==null?void 0:s.tables.linetypeTable.getAt(e);return t?{...t.linetype,color:this.rgbColor}:{name:e,standardFlag:0,color:this.rgbColor,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Wt){const e=this.database.tables.layerTable.getAt(this.layer);if(e&&e.linetype)return e.linetype}else return this.lineType==Ar?Ut:this.lineType;return Ut}getLayerColor(){const e=this.database.tables.layerTable.getAt(this.layer);if(e==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return e.color;return null}}class Zs extends ge{constructor(e){super(),this._blockName=e,this._position=new w,this._rotation=0,this._normal=new A(0,0,1),this._scaleFactors=new w(1,1,1)}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scaleFactors(){return this._scaleFactors}set scaleFactors(e){this._scaleFactors.copy(e)}get normal(){return this._normal}set normal(e){this._normal.copy(e).normalize()}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}get geometricExtents(){const e=new N,t=this.blockTableRecord;if(t!=null){const i=t.newIterator();for(const a of i)e.union(a.geometricExtents)}const s=new ke().setFromEuler(new ii(this.rotation,0,0)),r=new Ue;return r.compose(this.position,s,this.scaleFactors),e.applyMatrix4(r),e}draw(e){const t=[],s=this.blockTableRecord;if(s!=null){const r=this.computeTransformMatrix();return Le.instance.draw(e,s,this.rgbColor,!0,r,this.normal)}else return e.group(t)}computeTransformMatrix(){const e=new ke;return e.setFromAxisAngle(A.Z_AXIS,this.rotation),new Ue().compose(this._position,e,this._scaleFactors)}}class me extends ge{}class di extends me{constructor(e,t,s,r,i,a,o){super(),this._geo=new ts(e,t,s,r,i,a,o)}get center(){return this._geo.center}set center(e){this._geo.center=e}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(e){this._geo.majorAxisRadius=e}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(e){this._geo.minorAxisRadius=e}get normal(){return this._geo.normal}set normal(e){this._geo.normal=e}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}draw(e){return e.ellipticalArc(this._geo,this.lineStyle)}}class ui extends me{constructor(e,t,s,r){super(),this._geo=new Ye(e,t,s,r,A.Z_AXIS,A.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get startAngle(){return this._geo.startAngle}set startAngle(e){this._geo.startAngle=e}get endAngle(){return this._geo.endAngle}set endAngle(e){this._geo.endAngle=e}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e.push(this.startPoint),e.push(this.endPoint),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}}class mi extends me{constructor(e,t,s=A.Z_AXIS){super(),this._geo=new Ye(e,t,0,H,s,A.X_AXIS)}get center(){return this._geo.center}set center(e){this._geo.center=e}get radius(){return this._geo.radius}set radius(e){this._geo.radius=e}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetGripPoints(){const e=new Array;return e.push(this.center),e}transformBy(e){return this._geo.transform(e),this}draw(e){return e.circularArc(this._geo,this.lineStyle)}}var gi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(gi||{}),pi=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(pi||{});class yi extends ge{constructor(){super(),this._elevation=0,this._geo=new Zt,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(e){this._patternName=e}get patternType(){return this._patternType}set patternType(e){this._patternType=e}get patternAngle(){return this._patternAngle}set patternAngle(e){this._patternAngle=e}get patternScale(){return this._patternScale}set patternScale(e){this._patternScale=e}get hatchStyle(){return this._hatchStyle}set hatchStyle(e){this._hatchStyle=e}add(e){this._geo.add(e)}get geometricExtents(){const e=this._geo.box;return new N({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}draw(e){return e.area(this._geo,{color:this.rgbColor,solidFill:!1,patternAngle:this.patternAngle,patternLines:this.definitionLines})}}var _i=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(_i||{});class fi extends me{constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(e){this._isSplined=e}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(e){this._hasArrowHead=e}get hasHookLine(){return this._hasHookLine}set hasHookLine(e){this._hasHookLine=e}get numVertices(){return this._vertices.length}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(e){this._dimensionStyle=e}get annoType(){return this._annoType}set annoType(e){this._annoType=e}appendVertex(e){this._vertices.push(new w().copy(e)),this._updated=!0}setVertexAt(e,t){throw(e<0||e>=this._vertices.length)&&(this._vertices[e].copy(t),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(e){throw(e<0||e>=this._vertices.length)&&this._vertices[e],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new N().setFromPoints(this._vertices)}get closed(){return!1}set closed(e){}draw(e){if(this.isSplined&&this.splineGeo){const t=this.splineGeo.getPoints(100);return e.lines(t,this.lineStyle)}else return e.lines(this._vertices,this.lineStyle)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new at(this._vertices,"Uniform"),this._updated=!1)}}class xi extends me{constructor(e,t){super(),this._geo=new Ce(e,t)}get startPoint(){return this._geo.startPoint}set startPoint(e){this._geo.startPoint=e}get endPoint(){return this._geo.endPoint}set endPoint(e){this._geo.endPoint=e}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}subGetGripPoints(){const e=new Array;return e.push(this.midPoint),e.push(this.startPoint),e.push(this.endPoint),e}subGetOsnapPoints(e,t,s,r,i){const a=this.startPoint,o=this.endPoint;switch(e){case Ge.EndPoint:i.push(a),i.push(o);break;case Ge.MidPoint:i.push(this.midPoint);break;case Ge.Nearest:{const c=this._geo.project(s);i.push(c)}break;case Ge.Perpendicular:{const c=this._geo.perpPoint(s);i.push(c)}break;case Ge.Tangent:i.push(a);break}}transformBy(e){return this._geo.transform(e),this}draw(e){const t=this.startPoint,s=this.endPoint,r=[new w(t.x,t.y,0),new w(s.x,s.y,0)];return e.lines(r,this.lineStyle)}}var Qs=(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))(Qs||{}),rs=(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))(rs||{}),ot=(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))(ot||{}),Js=(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))(Js||{}),en=(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))(en||{}),tn=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(tn||{});class is{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(e){this._number=e}get id(){return this._id}set id(e){this._id=e}get groupId(){return this._groupId}set groupId(e){this._groupId=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get box(){const e=new K;return e.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter.copy(e)}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const e=new K;return e.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),e}clone(){const e=new is;return e.id=this.id,e.groupId=this.groupId,e.number=this.number,e.centerPoint.copy(this.centerPoint),e.height=this.height,e.width=this.width,e.viewCenter.copy(this.viewCenter),e.viewHeight=this.viewHeight,e}copy(e){return this.id=e.id,this.groupId=e.groupId,this.number=e.number,this.centerPoint.copy(e.centerPoint),this.height=e.height,this.width=e.width,this.viewCenter.copy(e.viewCenter),this.viewHeight=e.viewHeight,this}}class bi extends ge{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=ot.TopLeft,this._direction=new A(1,0,0),this._drawingDirection=rs.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(e){this._contents=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(e){this._lineSpacingFactor=e}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(e){this._lineSpacingStyle=e}get backgroundFill(){return this._backgroundFill}set backgroundFill(e){this._backgroundFill=e,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(e){this._backgroundFillColor=e}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(e){this._backgroundFillTransparency=e}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(e){this._backgroundScaleFactor=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get location(){return this._location}set location(e){this._location.copy(e)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get direction(){return this._direction}set direction(e){this._direction.copy(e)}get drawingDirection(){return this._drawingDirection}set drawingDirection(e){this._drawingDirection=e}get geometricExtents(){return new N}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e){const t={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},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class sn extends me{constructor(e,t,s){super();const r=+(e!==void 0)+ +(t!==void 0)+ +(s!==void 0);if(r!=2&&r!=3)throw te.ILLEGAL_PARAMETERS;r==2&&!Array.isArray(t)?this._geo=new at(e,t):this._geo=new at(e,t,s)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}draw(e){const t=this._geo.getPoints(100);return e.lines(t,this.lineStyle)}}const el=new A;class Ai extends Zs{constructor(e,t,s){super(e),this._attachmentPoint=ot.TopLeft,this._numColumns=s,this._numRows=t,this._columnWidth=new Array(s),this._rowHeight=new Array(t),this._cells=new Array(t*s)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(e){this._attachmentPoint=e}get numRows(){return this._numRows}set numRows(e){this._numRows=e}get numColumns(){return this._numColumns}set numColumns(e){this._numColumns=e}numContents(e,t){return 1}rowHeight(e){return this._rowHeight[e]}setRowHeight(e,t){this._rowHeight[e]=t}setUniformRowHeight(e){this._rowHeight.fill(e)}columnWidth(e){return this._columnWidth[e]}setUniformColumnWidth(e){this._columnWidth.fill(e)}setColumnWidth(e,t){this._columnWidth[e]=t}cell(e){if(!(e<0||e>=this._cells.length))return this._cells[e]}setCell(e,t){this._cells[e]=t}textString(e,t,s){return this._cells[e*t].text}setTextString(e,t,s){this._cells[e*t].text=s}isEmpty(e,t){return!this._cells[e*t].text}get geometricExtents(){return new N}draw(e){let t=0,s=0;const r=new Uint16Array(this.numColumns*this.numRows*8),i=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let m=0;m<=this.numRows;m++){t-=m>0?this.rowHeight(m-1):0,s=0;for(let p=0;p<=this.numColumns;p++)s+=p>0?this.columnWidth(p-1):0,i[a++]=s,i[a++]=t,i[a++]=0}const o=[],c=new Array(this.numRows*this.numColumns).fill(!1);s=0,a=0;let h=0;for(let m=0;m<this.numColumns;m++){s+=m>0?this.columnWidth(m-1):0,t=0;for(let p=0;p<this.numRows;p++){t+=p>0?this.rowHeight(p-1):0;const y=this.cell(p*this.numColumns+m);if(h=p*this.numColumns+m,y&&!c[h]){const _=y.borderWidth??1,x=y.borderHeight??1;this.fillVisited(c,h,this.numColumns,_,x),r[a++]=m+p*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1)+_;const f=i[r[a-1]*3]-s,k=m+(p+x)*(this.numColumns+1)+_;m+_==this.numColumns&&(r[a++]=m+p*(this.numColumns+1)+_,r[a++]=k);const T=-i[k*3+1]-t;if(p+x==this.numRows&&(r[a++]=m+(p+x)*(this.numColumns+1)+x,r[a++]=m+(p+x)*(this.numColumns+1)),r[a++]=m+(p+x)*(this.numColumns+1),r[a++]=m+p*(this.numColumns+1),y.text){const S=y.attachmentPoint||this.attachmentPoint||ot.MiddleCenter,I=this.getTableTextOffset(S,f,T),z={text:y.text,height:y.textHeight,width:f,position:el.set(s,-t,0).clone().add(I),rotation:this.rotation,attachmentPoint:S},P={...this.getTextStyle(y),color:this.color.color};o.push(e.mtext(z,P))}}}}o.push(e.lineSegments(i,3,r,this.lineStyle));const d=e.group(o),u=new ke;return u.setFromAxisAngle(A.Z_AXIS,this.rotation),wi.compose(this.position,u,this.scaleFactors),d.applyMatrix(wi),d}fillVisited(e,t,s,r,i){if(i==1&&r==1)e[t]=!0;else for(let a=0;a<r;++a)for(let o=0;o<i;++o)e[t+a+o*s]=!0}getTextStyle(e){const t=this.database.tables.textStyleTable;let s;return e.textStyle&&(s=t.getAt(e.textStyle)),s||(s=t.getAt("STANDARD")||t.getAt("Standard")),s.textStyle}getTableTextOffset(e,t,s){const r=new A;switch(e){case 1:break;case 2:r.setX(t/2);break;case 3:r.setX(t);break;case 4:r.setY(-s/2);break;case 5:r.set(t/2,-s/2,0);break;case 6:r.set(t,-s/2,0);break;case 7:r.setY(-s);break;case 8:r.set(t/2,-s,0);break;case 9:r.set(t,-s,0);break}return r}}const wi=new Ue;var Ii=(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))(Ii||{}),Pi=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Pi||{});class Ei extends ge{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(e){this._textString=e}get thickness(){return this._thickness}set thickness(e){this._thickness=e}get height(){return this._height}set height(e){this._height=e}get position(){return this._position}set position(e){this._position.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get horizontalMode(){return this._horizontalMode}set horizontalMode(e){this._horizontalMode=e}get verticalMode(){return this._verticalModel}set verticalMode(e){this._verticalModel=e}get styleName(){return this._styleName}set styleName(e){this._styleName=e}get widthFactor(){return this._widthFactor}set widthFactor(e){this._widthFactor=e}get geometricExtents(){return new N}getTextStyle(){const e=this.database.tables.textStyleTable;let t=e.getAt(this.styleName);return t||(t=e.getAt("STANDARD")||e.getAt("Standard")),t.textStyle}draw(e){const t={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:rs.BOTTOM_TO_TOP,attachmentPoint:ot.BottomLeft},s={...this.getTextStyle(),color:this.rgbColor};return e.mtext(t,s)}}class Ti extends me{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(e){this._elevation=e}get closed(){return!0}get thickness(){return this._thickness}set thickness(e){this._thickness=e}getPointAt(e){return e<0?this._vertices[0]:e>3?this._vertices[3]:this._vertices[e]}setPointAt(e,t){if(e<0&&this._vertices[0].copy(t),e>3)return this._vertices[3].copy(t);this._vertices[e].copy(t)}get geometricExtents(){return new N().setFromPoints(this._vertices)}subGetGripPoints(){const e=new Array;for(let t=0;t<4;++t)e.push(this.getPointAt(t));return e}draw(e){const t=new vt(this._vertices,!0),s=new Zt;return s.add(t),e.area(s,{color:this.rgbColor,solidFill:!0,patternAngle:0,patternLines:[]})}}class Si extends me{constructor(){super(),this._elevation=0,this._geo=new vt}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(e){this._elevation=e}get closed(){return this._geo.closed}set closed(e){this._geo.closed=e}addVertexAt(e,t,s=0,r=-1,i=-1){const a=r<0?void 0:r,o=i<0?void 0:i,c={x:t.x,y:t.y,bulge:s,startWidth:a,endWidth:o};this._geo.addVertexAt(e,c)}getPoint2dAt(e){return this._geo.getPointAt(e)}getPoint3dAt(e){const t=this.getPoint2dAt(e);return new w(t.x,t.y,this._elevation)}get geometricExtents(){const e=this._geo.box;return new N({x:e.min.x,y:e.min.y,z:this._elevation},{x:e.max.x,y:e.max.y,z:this._elevation})}subGetGripPoints(){const e=new Array;for(let t=0;t<this.numberOfVertices;++t)e.push(this.getPoint3dAt(t));return e}draw(e){const t=[];return this._geo.getPoints(100).forEach(r=>t.push(new w().set(r.x,r.y,this.elevation))),e.lines(t,this.lineStyle)}}class Mi extends ge{constructor(){super(),this._geo=new w}get position(){return this._geo}set position(e){this._geo.set(e.x,e.y,e.z||0)}get geometricExtents(){return new N().expandByPoint(this._geo)}transformBy(e){return this._geo.applyMatrix3d(e),this}draw(e){return e.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize,color:this.rgbColor})}}var vi=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(vi||{}),Li=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Li||{});class nn extends ge{constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new w,this._scale=new B(1,1),this._rotation=0,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(e){this._brightness=e}get contrast(){return this._contrast}set contrast(e){this._contrast=e}get fade(){return this._fade}set fade(e){this._fade=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get position(){return this._position}set position(e){this._position=e}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get scale(){return this._scale}set scale(e){this._scale.copy(e)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(e){this._clipBoundaryType=e}get clipBoundary(){return this._clipBoundary}set clipBoundary(e){this._clipBoundary=[],this._clipBoundary.push(...e)}get isClipped(){return this._isClipped}set isClipped(e){this._isClipped=e}get isImageShown(){return this._isImageShown}set isImageShown(e){this._isImageShown=e}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(e){this._isImageTransparent=e}get image(){return this._image}set image(e){this._image=e}get imageDefId(){return this._imageDefId}set imageDefId(e){this._imageDefId=e}get imageFileName(){if(this._imageDefId){const e=this.database.dictionaries.imageDefs.getIdAt(this._imageDefId);if(e)return e.sourceFileName}return""}get geometricExtents(){const e=new N;return e.min.copy(this._position),e.max.set(this._position.x+this._width,this._position.y+this._height,0),e}subGetGripPoints(){return this.boundaryPath()}draw(e){const t=this.boundaryPath();return this._image?e.image(this._image,{boundary:t,roation:this._rotation}):e.lines(t,this.lineStyle)}boundaryPath(){const e=[];if(this.isClipped&&this._clipBoundary.length>3){const t=this._width,s=this._height,r=new K;r.setFromPoints(this._clipBoundary);const i=new v;i.setX(this._position.x-r.min.x*t),i.setY(this._position.y-r.min.y*s),this._clipBoundary.forEach(a=>{const o=a.x*t+i.x,c=a.y*s+i.y;e.push(new w(o,c,this._position.z))})}else{if(e.push(this._position),e.push(this._position.clone().setX(this._position.x+this._width)),e.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),e.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){ki.copy(e[1]);for(let t=1;t<4;t++)as.copy(e[t]),as.rotateAround(ki,this._rotation),e[t].setX(as.x),e[t].setY(as.y)}e.push(e[0])}return e}}const ki=new v,as=new v;class Oi extends me{constructor(){super(),this._basePoint=new w,this._unitDir=new A}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new N;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this.basePoint),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}}class Ci extends ge{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(e){this._number=e}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint=e}get height(){return this._height}set height(e){this._height=e}get width(){return this._width}set width(e){this._width=e}get viewCenter(){return this._viewCenter}set viewCenter(e){this._viewCenter=e}get viewHeight(){return this._viewHeight}set viewHeight(e){this._viewHeight=e}get geometricExtents(){return new N}draw(e){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const t=this.toGiViewport();return e.group(this.createViewportRect(t,e))}}toGiViewport(){const e=new is;return e.id=this.objectId,e.groupId=this.ownerId,e.number=this.number,e.centerPoint=this.centerPoint,e.width=this.width,e.height=this.height,e.viewHeight=this.viewHeight,e.viewCenter=this.viewCenter,e}createViewportRect(e,t){const s=[];return s.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y-e.height/2,0),new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x+e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0)],this.lineStyle)),s.push(t.lines([new w(e.centerPoint.x-e.width/2,e.centerPoint.y+e.height/2,0),new w(e.centerPoint.x-e.width/2,e.centerPoint.y-e.height/2,0)],this.lineStyle)),s}}class Di extends nn{draw(e){const t=this.boundaryPath(),s=new Zt;return s.add(new vt(t)),e.area(s,{color:0,solidFill:!0,patternAngle:0,patternLines:[]})}}class Ni extends me{constructor(){super(),this._basePoint=new w,this._unitDir=new A}get basePoint(){return this._basePoint}set basePoint(e){this._basePoint.copy(e)}get unitDir(){return this._unitDir}set unitDir(e){this._unitDir.copy(e)}get closed(){return!1}get geometricExtents(){const e=new N;return e.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),e.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),e}subGetGripPoints(){const e=new Array;return e.push(this.basePoint),e}draw(e){const t=[];return t.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),t.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),e.lines(t,this.lineStyle)}}var Ri=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))(Ri||{});class Xe extends ge{constructor(){super(),this._dimBlockId=null,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new w,this._textRotation=0}get dimBlockId(){return this._dimBlockId}set dimBlockId(e){this._dimBlockId=e}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(e){this._dimensionStyleName=e}get dimensionStyle(){if(this._dimStyle==null){let e;this.dimensionStyleName&&(e=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),e==null&&(e=new kt),this._dimStyle=e}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(e){this._dimensionText=e}get measurement(){return this._measurement}set measurement(e){this._measurement=e}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(e){this._textLineSpacingFactor=e}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(e){this._textLineSpacingStyle=e}get textPosition(){return this._textPosition}set textPosition(e){this._textPosition.copy(e)}get textRotation(){return this._textRotation}set textRotation(e){this._textRotation=e}draw(e){if(this.dimBlockId){const t=this.database.tables.blockTable.getAt(this.dimBlockId);if(t)return Le.instance.draw(e,t,this.rgbColor,!1)}return e.group([])}drawFirstArrow(e){const t=this.database.tables.blockTable.getAt(this.firstArrowType);if(t)return Le.instance.draw(e,t,this.rgbColor,!1)}drawSecondArrow(e){const t=this.database.tables.blockTable.getAt(this.secondArrowType);if(t)return Le.instance.draw(e,t,this.rgbColor,!1)}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk1}get firstArrowType(){const e=this.firstArrowTypeBtrId;return this.getArrowName(e)}get secondArrowTypeBtrId(){const e=this.dimensionStyle;return e.dimsah==0?e.dimblk:e.dimblk2}get secondArrowType(){const e=this.secondArrowTypeBtrId;return this.getArrowName(e)}get arrowLineCount(){return 1}getLineArrowStyle(e){}findPointOnLine1(e,t,s){const r=new w().subVectors(t,e).normalize();return new w(t).addScaledVector(r,s)}findPointOnLine2(e,t,s){const r=e.x+s*Math.cos(t),i=e.y+s*Math.sin(t);return{x:r,y:i}}adjustExtensionLine(e){const t=this.dimensionStyle;e.extend(t.dimexe),e.extend(-t.dimexo,!0)}getArrowName(e){const t=this.database.tables.blockTable.getIdAt(e);return t?t.name.toUpperCase():Qs.Closed}}class zi extends Xe{constructor(e,t,s,r,i=null,a=null){super(),this._centerPoint=new w().copy(e),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(s),this._arcPoint=new w().copy(r),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new N}}class Fi extends Xe{constructor(e,t,s,r=null,i=null){super(),this._dimLinePoint=new w().copy(s),this._xLine1Point=new w().copy(e),this._xLine2Point=new w().copy(t),this._oblique=0,this._rotation=0,this.dimensionText=r,this.dimensionStyleName=i}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(e){this._dimLinePoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get rotation(){return this._rotation}set rotation(e){this._rotation=e}get oblique(){return this._oblique}set oblique(e){this._oblique=e}get geometricExtents(){return new N}get isAppendArrow(){return!1}calculateLines(){const e=[],t=this.createExtensionLine(this._xLine1Point),s=this.createExtensionLine(this._xLine2Point),r=this.findIntersectionPoint(t,this._dimLinePoint),i=this.findIntersectionPoint(s,this._dimLinePoint),a=new Ce(r,i);return e.push(a),t.endPoint=r,this.adjustExtensionLine(t),e.push(t),s.endPoint=i,this.adjustExtensionLine(s),e.push(s),e}createExtensionLine(e){const t=this.rotation+Math.PI/2,s=this.findPointOnLine2(e,t,100);return new Ce(e,{...s,z:e.z})}findIntersectionPoint(e,t){const s=e.startPoint,r=e.endPoint,i=new A().subVectors(r,s).normalize(),o=new A().subVectors(t,s).dot(i),c=new A().copy(i).multiplyScalar(o);return new A().addVectors(s,c)}}class tl extends Xe{constructor(e,t,s,r,i=null,a=null){super(),this._arcPoint=new w().copy(r),this._xLine1Point=new w().copy(t),this._xLine2Point=new w().copy(s),this._centerPoint=new w().copy(e),this.dimensionText=i,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(e){this._arcPoint.copy(e)}get centerPoint(){return this._centerPoint}set centerPoint(e){this._centerPoint.copy(e)}get xLine1Point(){return this._xLine1Point}set xLine1Point(e){this._xLine1Point.copy(e)}get xLine2Point(){return this._xLine2Point}set xLine2Point(e){this._xLine2Point.copy(e)}get geometricExtents(){return new N}}class Bi extends Xe{constructor(e,t,s=0,r=null,i=null){super(),this._chordPoint=new w().copy(e),this._farChordPoint=new w().copy(t),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=s,this.dimensionText=r,this.dimensionStyleName=i}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get farChordPoint(){return this._farChordPoint}set farChordPoint(e){this._farChordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}get geometricExtents(){return new N}drawLines(e,t){const s=[],r=t.length;return r==1?s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})):r==3?(this.sortLines(t),s.push(this.drawLine(e,t[0],{firstArrow:this.firstArrowStyle})),s.push(this.drawLine(e,t[1])),s.push(this.drawLine(e,t[2],{firstArrow:this.firstArrowStyle}))):t.forEach(i=>{s.push(this.drawLine(e,i))}),s}drawLine(e,t,s){if(s){const r=[t.startPoint,t.endPoint];return e.lines(r,{...this.lineStyle,arrows:s})}else return t.draw(e)}sortLines(e){const t=(s,r)=>s.x!==r.x?s.x-r.x:s.y!==r.y?s.y-r.y:s.z-r.z;e.sort((s,r)=>{const i=t(s.startPoint,r.startPoint);return i!==0?i:t(s.endPoint,r.endPoint)})}}class Vi extends Xe{constructor(e,t,s=null,r=null){super(),this._definingPoint=new w().copy(e),this._leaderEndPoint=new w().copy(t),this.dimensionText=s,this.dimensionStyleName=r}get definingPoint(){return this._definingPoint}set definingPoint(e){this._definingPoint.copy(e)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(e){this._leaderEndPoint.copy(e)}get geometricExtents(){return new N}get arrowLineCount(){return 0}}class ji extends Xe{constructor(e,t,s,r=null,i=null){super(),this._center=new w().copy(e),this._chordPoint=new w().copy(t),this._leaderLength=s,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=r,this.dimensionStyleName=i}get center(){return this._center}set center(e){this._center.copy(e)}get chordPoint(){return this._chordPoint}set chordPoint(e){this._chordPoint.copy(e)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(e){this._extArcStartAngle=e}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(e){this._extArcEndAngle=e}get leaderLength(){return this._leaderLength}set leaderLenght(e){this._leaderLength=e}get geometricExtents(){return new N}getLineArrowStyle(e){return{secondArrow:this.secondArrowStyle}}}class Gi{convert(e){const t=this.createEntity(e);return t&&this.processCommonAttrs(e,t),t}createEntity(e){return e.type=="ARC"?this.convertArc(e):e.type=="CIRCLE"?this.convertCirle(e):e.type=="DIMENSION"?this.convertDimension(e):e.type=="ELLIPSE"?this.convertEllipse(e):e.type=="HATCH"?this.convertHatch(e):e.type=="IMAGE"?this.convertImage(e):e.type=="LEADER"?this.convertLeader(e):e.type=="LINE"?this.convertLine(e):e.type=="MTEXT"?this.convertMText(e):e.type=="POLYLINE"||e.type=="LWPOLYLINE"?this.convertPolyline(e):e.type=="POINT"?this.convertPoint(e):e.type=="RAY"?this.convertRay(e):e.type=="SPLINE"?this.convertSpline(e):e.type=="ACAD_TABLE"?this.convertTable(e):e.type=="TEXT"?this.convertText(e):e.type=="SOLID"?this.convertSolid(e):e.type=="VIEWPORT"?this.convertViewport(e):e.type=="WIPEOUT"?this.convertWipeout(e):e.type=="XLINE"?this.convertXline(e):e.type=="INSERT"?this.convertBlockReference(e):null}convertArc(e){return new ui(e.center,e.radius,O.degToRad(e.startAngle),O.degToRad(e.endAngle))}convertCirle(e){return new mi(e.center,e.radius)}convertEllipse(e){const t=new A(e.majorAxisEndPoint),s=t.length();return new di(e.center,A.Z_AXIS,t,s,s*e.axisRatio,e.startAngle,e.endAngle)}convertLine(e){const t=e.startPoint,s=e.endPoint;return new xi(new w(t.x,t.y,t.z||0),new w(s.x,s.y,s.z||0))}convertSpline(e){if(e.numberOfControlPoints>0&&e.numberOfKnots>0){const t=new sn(e.controlPoints,e.knots,e.weights);return t.closed=!!(e.flag&1),t}else if(e.numberOfFitPoints>0){const t=this.numberArrayToPointArray(e.fitPoints,e.numberOfFitPoints);if(t!=null){const s=new sn(t,"Uniform");return s.closed=!!(e.flag&1),s}}return null}convertPoint(e){const t=new Mi;return t.position=e.position,t}convertSolid(e){const t=new Ti;return e.points.forEach((s,r)=>t.setPointAt(r,s)),t.thickness=e.thickness,t}convertPolyline(e){const t=new Si;return t.closed=!!(e.flag&1),e.vertices.forEach((s,r)=>{t.addVertexAt(r,new v(s.x,s.y),s.bulge,s.startWidth,s.endWidth)}),t}convertHatch(e){var r;const t=new yi;return(r=e.definitionLines)==null||r.forEach(i=>{t.definitionLines.push({angle:i.angle,origin:i.base,delta:i.offset,dashPattern:i.numberOfDashLengths>0?i.dashLengths:[]})}),t.hatchStyle=e.hatchStyle,t.patternName=e.patternName,t.patternType=e.patternType,t.patternAngle=e.patternAngle==null?0:e.patternAngle,t.patternScale=e.patternScale==null?0:e.patternScale,e.boundaryPaths.forEach(i=>{if(i.boundaryPathTypeFlag&2){const o=i,c=new vt;c.closed=o.isClosed,o.vertices.forEach((h,d)=>{c.addVertexAt(d,{x:h.x,y:h.y,bulge:h.bulge})}),t.add(c)}else{const o=i,c=new li;o.edges.forEach(h=>{if(h.type==1){const d=h;c.add(new ss(d.start,d.end))}else if(h.type==2){const d=h;c.add(new it(d.center,d.radius,O.degToRad(d.startAngle||0),O.degToRad(d.endAngle||0),!d.isCCW))}else if(h.type==3){const d=h;new B().subVectors(d.end,d.center);const m=Math.sqrt(Math.pow(d.end.x,2)+Math.pow(d.end.y,2)),p=m*d.lengthOfMinorAxis;let y=O.degToRad(d.startAngle||0),_=O.degToRad(d.endAngle||0);const x=Math.atan2(d.end.y,d.end.x);d.isCCW||(y=Math.PI*2-y,_=Math.PI*2-_),c.add(new es({...d.center,z:0},m,p,y,_,!d.isCCW,x))}else if(h.type==4){const d=h;if(d.numberOfControlPoints>0&&d.numberOfKnots>0){const u=d.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let m=!0;const p=d.controlPoints.map(y=>(y.weight==null&&(m=!1),y.weight||1));c.add(new at(u,d.knots,m?p:void 0))}else if(d.numberOfFitData>0){const u=d.fitDatum.map(m=>({x:m.x,y:m.y,z:0}));c.add(new at(u,"Uniform"))}}}),t.add(c)}}),t}convertTable(e){const t=new Ai(e.name,e.rowCount,e.columnCount);return t.attachmentPoint=e.attachmentPoint,t.position.copy(e.startPoint),e.columnWidthArr.forEach((s,r)=>t.setColumnWidth(r,s)),e.rowHeightArr.forEach((s,r)=>t.setRowHeight(r,s)),e.cells.forEach((s,r)=>{t.setCell(r,s)}),t}convertText(e){const t=new Ei;return t.textString=e.text,t.styleName=e.styleName,t.height=e.textHeight,t.position.copy(e.startPoint),t.rotation=O.degToRad(e.rotation||0),t.oblique=e.obliqueAngle??0,t.thickness=e.thickness,t.horizontalMode=e.halign,t.verticalMode=e.valign,t.widthFactor=e.xScale??1,t}convertMText(e){const t=new bi;return t.contents=e.text.join(""),e.styleName!=null&&(t.styleName=e.styleName),t.height=e.height,t.width=e.width,t.rotation=O.degToRad(e.rotation||0),t.location=e.insertionPoint,t.attachmentPoint=e.attachmentPoint,e.direction&&(t.direction=new A(e.direction)),t.drawingDirection=e.drawingDirection,t}convertLeader(e){const t=new fi;return e.vertices.forEach(s=>{t.appendVertex(s)}),t.hasArrowHead=e.isArrowheadEnabled,t.hasHookLine=e.isHooklineExists,t.isSplined=e.isSpline,t.dimensionStyle=e.styleName,t.annoType=e.leaderCreationFlag,t}convertDimension(e){if(e.subclassMarker=="AcDbAlignedDimension"||e.subclassMarker=="AcDbRotatedDimension"){const t=e,s=new Fi(t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return s.rotation=O.degToRad(t.rotationAngle||0),this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDb3PointAngularDimension"){const t=e,s=new zi(t.centerPoint,t.subDefinitionPoint1,t.subDefinitionPoint2,t.definitionPoint);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbOrdinateDimension"){const t=e,s=new Vi(t.subDefinitionPoint1,t.subDefinitionPoint2);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbRadialDimension"){const t=e,s=new ji(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}else if(e.subclassMarker=="AcDbDiametricDimension"){const t=e,s=new Bi(t.definitionPoint,t.centerPoint,t.leaderLength);return this.processDimensionCommonAttrs(e,s),s}return null}processImage(e,t){t.position.copy(e.position),t.brightness=e.brightness,t.contrast=e.contrast,t.fade=e.fade,t.imageDefId=e.imageDefHandle,t.isClipped=(e.flags|4)>0,t.isImageShown=(e.flags|3)>0,t.isImageTransparent=(e.flags|8)>0,e.clippingBoundaryPath.forEach(s=>{t.clipBoundary.push(new v(s))}),t.clipBoundaryType=e.clippingBoundaryType,t.width=Math.sqrt(e.uPixel.x**2+e.uPixel.y**2+e.uPixel.z**2)*e.imageSize.x,t.height=Math.sqrt(e.vPixel.x**2+e.vPixel.y**2+e.vPixel.z**2)*e.imageSize.y,t.rotation=Math.atan2(e.uPixel.y,e.uPixel.x)}convertImage(e){const t=new nn;return this.processImage(e,t),t}convertWipeout(e){const t=new Di;return this.processImage(e,t),t}convertViewport(e){const t=new Ci;return t.number=e.viewportId,t.centerPoint.copy(e.viewportCenter),t.height=e.height,t.width=e.width,t.viewCenter.copy(e.displayCenter),t.viewHeight=e.viewHeight,t}convertRay(e){const t=new Oi;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertXline(e){const t=new Ni;return t.basePoint.copy(e.firstPoint),t.unitDir.copy(e.unitDirection),t}convertBlockReference(e){const t=new Zs(e.name);return e.insertionPoint&&t.position.copy(e.insertionPoint),t.scaleFactors.x=e.xScale||1,t.scaleFactors.y=e.yScale||1,t.scaleFactors.z=e.zScale||1,t.rotation=e.rotation!=null?O.degToRad(e.rotation):0,t.normal.copy(e.extrusionDirection),t}processDimensionCommonAttrs(e,t){t.dimBlockId=e.name,t.textPosition.copy(e.textPoint),t.textRotation=e.textRotation||0,e.textLineSpacingFactor&&(t.textLineSpacingFactor=e.textLineSpacingFactor),e.textLineSpacingStyle&&(t.textLineSpacingStyle=e.textLineSpacingStyle),t.dimensionStyleName=e.styleName,t.dimensionText=e.text||"",t.measurement=e.measurement}processCommonAttrs(e,t){t.layer=e.layer,t.objectId=e.handle,t.ownerId=e.ownerBlockRecordSoftId||"",e.lineType!=null&&(t.lineType=e.lineType),e.lineweight!=null&&(t.lineWeight=e.lineweight),e.lineTypeScale!=null&&(t.linetypeScale=e.lineTypeScale),e.color!=null&&(t.color.color=e.color),e.colorIndex!=null&&(t.color.colorIndex=e.colorIndex),e.colorName!=null&&(t.color.colorName=e.colorName),e.isVisible!=null&&(t.visibility=e.isVisible),e.transparency!=null&&(t.transparency=e.transparency)}numberArrayToPointArray(e,t){const s=e.length;let r=0;if(s/2==t?r=2:s/3==t&&(r=3),r==0)return;const i=[];for(let a=0,o=s/r;a<o;++a)i.push({x:e[a*r],y:e[a*r+1],z:r==3?e[a*r+2]:void 0});return i}}class rn extends De{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new K,this._extents=new N}get layoutName(){return this._layoutName}set layoutName(e){this._layoutName=e.length>256?e.slice(0,256):e}get tabOrder(){return this._tabOrder}set tabOrder(e){this._tabOrder=e}get tabSelected(){return this._tabSelected}set tabSelected(e){this._tabSelected=e}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(e){this._blockTableRecordId=e}get limits(){return this._limits}set limits(e){this._limits.copy(e)}get extents(){return this._extents}set extents(e){this._extents.copy(e)}}class an extends De{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(e,t){t.database=this.database,this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(e){return this.getAt(e)?(this._recordsByName.delete(e.toUpperCase()),this._recordsById.delete(this.objectId),!0):!1}removeId(e){const t=this.getIdAt(e);return t?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((s,r)=>{s===t&&this._recordsByName.delete(r)}),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e.toUpperCase())}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}newIterator(){return new Yt(this._recordsByName)}}class Hi extends an{getBtrIdAt(e){for(const[t,s]of this._recordsByName)if(s.blockTableRecordId==e)return s}get maxTabOrder(){let e=-1;return this._recordsByName.forEach(t=>{t.tabOrder>e&&(e=t.tabOrder)}),e}}class Ui extends De{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(e){this._sourceFileName=e}}class sl{convertLayout(e){const t=new rn;return t.layoutName=e.layoutName,t.tabOrder=e.tabOrder,t.blockTableRecordId=e.ownerObjectId,t.limits.min.copy(e.minLimit),t.limits.max.copy(e.maxLimit),t.extents.min.copy(e.minExtent),t.extents.max.copy(e.maxExtent),this.processCommonAttrs(e,t),t}convertImageDef(e){const t=new Ui;return t.sourceFileName=e.fileName,this.processCommonAttrs(e,t),t}processCommonAttrs(e,t){t.objectId=e.handle,t.ownerId=e.ownerObjectId}}class Wi extends Pr{parse(e){return new Uo().parseSync(e)}getFonts(e){var i;const t=new Map,s=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(i=e.tables.STYLE)==null||i.entries.forEach(a=>{const o=[];let c=s(a.font);c&&o.push(c),c=s(a.bigFont),c&&o.push(c),t.set(a.name,o)});const r=new Set;return this.getFontsInBlock(e.entities,e.blocks,t,r),Array.from(r)}getFontsInBlock(e,t,s,r){const i=/\\f(.*?)\|/g;e.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.join("").matchAll(i)].forEach(d=>{r.add(d[1].toLowerCase())});const h=s.get(o.styleName);h==null||h.forEach(d=>r.add(d))}else if(a.type=="TEXT"){const o=a,c=s.get(o.styleName);c==null||c.forEach(h=>r.add(h))}else if(a.type=="INSERT"){const c=t[a.name];c&&c.entities&&this.getFontsInBlock(c.entities,t,s,r)}})}async processEntities(e,t,s,r,i){const a=new Gi,o=e.entities,c=o.length,h=new An(c,100-r.value,s),d=t.tables.blockTable.modelSpace,u=t.tables.blockTable;await h.processChunk(async(m,p)=>{for(let y=m;y<p;y++){const _=o[y],x=a.convert(_);if(x){let f=d;_.ownerBlockRecordSoftId!=null&&(f=u.getIdAt(_.ownerBlockRecordSoftId)||f),f.appendEntity(x)}}if(i){let y=r.value+p/c*(100-r.value);y>100&&(y=100),await i(y,"ENTITY","IN-PROGRESS")}})}async processEntitiesInBlock(e,t,s){const r=new Gi,i=e.length;for(let a=0;a<i;a++){const o=e[a],c=r.convert(o);if(c){let h=t;o.ownerBlockRecordSoftId!=null&&(h=s.getIdAt(o.ownerBlockRecordSoftId)||h),h.appendEntity(c)}}}processBlocks(e,t){const s=e.blocks;for(const[r,i]of Object.entries(s)){let a=t.tables.blockTable.getAt(i.name);a||(a=new Se,a.objectId=i.handle,a.name=r,a.origin.copy(i.position),t.tables.blockTable.add(a)),i.entities&&this.processEntitiesInBlock(i.entities,a,t.tables.blockTable)}}processHeader(e,t){const s=e.header;t.cecolor.colorIndex=s.$CECOLOR||256,t.angBase=s.$ANGBASE||0,t.angDir=s.$ANGDIR||0,t.aunits=s.$AUNITS,t.insunits=s.$INSUNITS,t.pdmode=s.$PDMODE||0,t.pdsize=s.$PDSIZE||0}processBlockTables(e,t){var r;const s=(r=e.tables.BLOCK_RECORD)==null?void 0:r.entries;s&&s.length>0&&(t.tables.blockTable.removeAll(),s.forEach(i=>{const a=new Se;a.objectId=i.handle,a.name=i.name,t.tables.blockTable.add(a)}))}processObjects(e,t){const s=e.objects.byName,r=new sl;if("LAYOUT"in s){const i=t.dictionaries.layouts;s.LAYOUT.forEach(a=>{const o=r.convertLayout(a);i.setAt(o.layoutName,o)})}if("IMAGEDEF"in s){const i=t.dictionaries.imageDefs;s.IMAGEDEF.forEach(a=>{const o=r.convertImageDef(a);i.setAt(o.objectId,o)})}}processViewports(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.VPORT)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new ia;this.processCommonTableEntryAttrs(a,o),a.circleSides&&(o.circleSides=a.circleSides),o.standardFlag=a.standardFlag,o.center.copy(a.center),o.lowerLeftCorner.copy(a.lowerLeftCorner),o.upperRightCorner.copy(a.upperRightCorner),a.snapBasePoint&&o.snapBase.copy(a.snapBasePoint),a.snapRotationAngle&&(o.snapAngle=a.snapRotationAngle),a.snapSpacing&&o.snapIncrements.copy(a.snapSpacing),a.majorGridLines&&(o.gridMajor=a.majorGridLines),a.gridSpacing&&o.gridIncrements.copy(a.gridSpacing),a.backgroundObjectId&&(o.backgroundObjectId=a.backgroundObjectId),o.gsView.center.copy(a.center),o.gsView.viewDirectionFromTarget.copy(a.viewDirectionFromTarget),o.gsView.viewTarget.copy(a.viewTarget),a.lensLength&&(o.gsView.lensLength=a.lensLength),a.frontClippingPlane&&(o.gsView.frontClippingPlane=a.frontClippingPlane),a.backClippingPlane&&(o.gsView.backClippingPlane=a.backClippingPlane),a.viewHeight&&(o.gsView.viewHeight=a.viewHeight),a.viewTwistAngle&&(o.gsView.viewTwistAngle=a.viewTwistAngle),a.frozenLayers&&(o.gsView.frozenLayers=a.frozenLayers),a.styleSheet&&(o.gsView.styleSheet=a.styleSheet),a.renderMode&&(o.gsView.renderMode=a.renderMode),a.viewMode&&(o.gsView.viewMode=a.viewMode),a.ucsIconSetting&&(o.gsView.ucsIconSetting=a.ucsIconSetting),a.ucsOrigin&&o.gsView.ucsOrigin.copy(a.ucsOrigin),a.ucsXAxis&&o.gsView.ucsXAxis.copy(a.ucsXAxis),a.ucsYAxis&&o.gsView.ucsYAxis.copy(a.ucsYAxis),a.orthographicType&&(o.gsView.orthographicType=a.orthographicType),a.shadePlotSetting&&(o.gsView.shadePlotSetting=a.shadePlotSetting),a.shadePlotObjectId&&(o.gsView.shadePlotObjectId=a.shadePlotObjectId),a.visualStyleObjectId&&(o.gsView.visualStyleObjectId=a.visualStyleObjectId),a.isDefaultLightingOn&&(o.gsView.isDefaultLightingOn=a.isDefaultLightingOn),a.defaultLightingType&&(o.gsView.defaultLightingType=a.defaultLightingType),a.brightness&&(o.gsView.brightness=a.brightness),a.contrast&&(o.gsView.contrast=a.contrast),a.ambientColor&&(o.gsView.ambientColor=a.ambientColor),t.tables.viewportTable.add(o)})}processLayers(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.LAYER)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new Ne;o.colorIndex=a.colorIndex;const c=new ln({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,c),t.tables.layerTable.add(c)})}processLineTypes(e,t){var r,i;const s=(i=(r=e.tables)==null?void 0:r.LTYPE)==null?void 0:i.entries;s&&s.length>0&&s.forEach(a=>{const o=new na(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,t.tables.linetypeTable.add(o)})}processTextStyles(e,t){var r;const s=(r=e.tables.STYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a=new ra(i);this.processCommonTableEntryAttrs(i,a),t.tables.textStyleTable.add(a)})}processDimStyles(e,t){var r;const s=(r=e.tables.DIMSTYLE)==null?void 0:r.entries;s&&s.length>0&&s.forEach(i=>{const a={name:i.name,ownerId:i.ownerObjectId,dimpost:i.DIMPOST||"",dimapost:i.DIMAPOST||"",dimscale:i.DIMSCALE,dimasz:i.DIMASZ,dimexo:i.DIMEXO,dimdli:i.DIMDLI,dimexe:i.DIMEXE,dimrnd:i.DIMRND,dimdle:i.DIMDLE,dimtp:i.DIMTP,dimtm:i.DIMTM,dimtxt:i.DIMTXT,dimcen:i.DIMCEN,dimtsz:i.DIMTSZ,dimaltf:i.DIMALTF,dimlfac:i.DIMLFAC,dimtvp:i.DIMTVP,dimtfac:i.DIMTFAC,dimgap:i.DIMGAP,dimaltrnd:i.DIMALTRND,dimtol:i.DIMTOL==null||i.DIMTOL==0?0:1,dimlim:i.DIMLIM==null||i.DIMLIM==0?0:1,dimtih:i.DIMTIH==null||i.DIMTIH==0?0:1,dimtoh:i.DIMTOH==null||i.DIMTOH==0?0:1,dimse1:i.DIMSE1==null||i.DIMSE1==0?0:1,dimse2:i.DIMSE2==null||i.DIMSE2==0?0:1,dimtad:i.DIMTAD,dimzin:i.DIMZIN,dimazin:i.DIMAZIN,dimalt:i.DIMALT,dimaltd:i.DIMALTD,dimtofl:i.DIMTOFL,dimsah:i.DIMSAH,dimtix:i.DIMTIX,dimsoxd:i.DIMSOXD,dimclrd:i.DIMCLRD,dimclre:i.DIMCLRE,dimclrt:i.DIMCLRT,dimadec:i.DIMADEC||0,dimunit:i.DIMUNIT||2,dimdec:i.DIMDEC,dimtdec:i.DIMTDEC,dimaltu:i.DIMALTU,dimalttd:i.DIMALTTD,dimaunit:i.DIMAUNIT,dimfrac:i.DIMFRAC,dimlunit:i.DIMLUNIT,dimdsep:i.DIMDSEP,dimtmove:i.DIMTMOVE||0,dimjust:i.DIMJUST,dimsd1:i.DIMSD1,dimsd2:i.DIMSD2,dimtolj:i.DIMTOLJ,dimtzin:i.DIMTZIN,dimaltz:i.DIMALTZ,dimalttz:i.DIMALTTZ,dimfit:i.DIMFIT||0,dimupt:i.DIMUPT,dimatfit:i.DIMATFIT,dimtxsty:i.DIMTXSTY||"Standard",dimldrblk:i.DIMLDRBLK||"",dimblk:i.DIMBLK||"",dimblk1:i.DIMBLK1||"",dimblk2:i.DIMBLK2||"",dimlwd:i.DIMLWD,dimlwe:i.DIMLWE},o=new kt(a);this.processCommonTableEntryAttrs(i,o),t.tables.dimStyleTable.add(o)})}processCommonTableEntryAttrs(e,t){t.name=e.name,t.objectId=e.handle,t.ownerId=e.ownerObjectId}}var on=(n=>(n.DXF="dxf",n.DWG="dwg",n))(on||{});class pe{constructor(){this.events={registered:new se,unregistered:new se},this._converters=new Map,this.register("dxf",new Wi)}static createInstance(){return pe._instance==null&&(pe._instance=new pe),this._instance}static get instance(){return pe._instance||(pe._instance=new pe),pe._instance}get fileTypes(){return this._converters.keys()}register(e,t){this._converters.set(e,t),this.events.registered.dispatch({fileType:e,converter:t})}get(e){return this._converters.get(e)}unregister(e){const t=this._converters.get(e);t&&(this._converters.delete(e),this.events.unregistered.dispatch({fileType:e,converter:t}))}}class $e extends De{constructor(e,t){e=e||{},Je(e,{name:""}),super(e,t)}get name(){return this.getAttr("name")}set name(e){this.setAttr("name",e)}}const lt=class lt extends $e{constructor(){super(),this._origin=new w,this._entities=new Map}get isModelSapce(){return this.name.toLowerCase()==lt.MODEL_SPACE_NAME.toLowerCase()}get isPaperSapce(){return this.name.toLowerCase().startsWith(lt.PAPER_SPACE_NAME_PREFIX.toLowerCase())}get origin(){return this._origin}set origin(e){this._origin.copy(e)}appendEntity(e){e.database=this.database,e.ownerId=this.objectId,this._entities.set(e.objectId,e),(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:e})}newIterator(){return new Yt(this._entities)}getIdAt(e){return this._entities.get(e)}};lt.MODEL_SPACE_NAME="*Model_Space",lt.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let Se=lt;class Ke extends De{constructor(e){super(),this.database=e,this._recordsByName=new Map,this._recordsById=new Map}add(e){e.database=this.database,this._recordsByName.set(e.name,e),this._recordsById.set(e.objectId,e)}remove(e){const t=this._recordsByName.get(e);return t?(this._recordsById.delete(t.objectId),this._recordsByName.delete(e),!0):!1}removeId(e){const t=this._recordsById.get(e);return t?(this._recordsByName.delete(t.name),this._recordsById.delete(e),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(e){return this._recordsByName.has(e)}hasId(e){return this._recordsById.has(e)}getAt(e){return this._recordsByName.get(e)}getIdAt(e){return this._recordsById.get(e)}getOwnerIdAt(e){let t;return this._recordsById.forEach((s,r)=>{s.ownerId==e&&(t=this._recordsById.get(r))}),t}newIterator(){return new Yt(this._recordsByName)}}class Yi extends Ke{constructor(e){super(e)}get modelSpace(){let e=this.getAt(Se.MODEL_SPACE_NAME);return e||(e=new Se,e.name=Se.MODEL_SPACE_NAME,this.add(e)),e}}class qi extends Ke{constructor(e){super(e)}}class ln extends $e{constructor(e,t){e=e||{},Je(e,{color:new Ne,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:0,linetype:"",lineWeight:1,materialId:-1}),super(e,t),this.attrs.events.attrChanged.addEventListener(s=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:s.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(e){this.setAttr("color",e.clone())}get description(){return this.getAttr("description")}set description(e){this.setAttr("description",e)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(e){this.setAttr("standardFlags",e)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(e){const t=e?1:0;this.standardFlags=this.standardFlags|t}get isHidden(){return this.getAttr("isHidden")}set isHidden(e){this.setAttr("isHidden",e)}get isInUse(){return this.getAttr("isInUse")}set isInUse(e){this.setAttr("isInUse",e)}get isLocked(){return(this.standardFlags&4)==1}set isLocked(e){const t=e?4:0;this.standardFlags=this.standardFlags|t}get isOff(){return this.getAttr("isOff")}set isOff(e){this.setAttr("isOff",e)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(e){this.setAttr("isPlottable",e)}get transparency(){return this.getAttr("transparency")}set transparency(e){this.setAttr("transparency",e)}get linetype(){return this.getAttr("linetype")}set linetype(e){this.setAttr("linetype",e)}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(e){this.setAttr("lineWeight",e)}get materialId(){return this.getAttr("materialId")}set materialId(e){this.setAttr("materialId",e)}}class Xi extends Ke{constructor(e){super(e);const t=new Ne;t.color=16777215;const s=new ln({name:"0",standardFlags:0,linetype:Ut,lineWeight:1,isOff:!1,color:t,isPlottable:!0});this.add(s)}add(e){super.add(e),this.database.events.layerAppended.dispatch({database:this.database,layer:e})}}class $i extends Ke{constructor(e){super(e)}}class Ki extends Ke{constructor(e){super(e)}get fonts(){const e=new Set,t=r=>{if(r){const i=r.lastIndexOf(".");if(i>=0){const a=r.substring(0,i).toLowerCase();e.add(a)}else e.add(r.toLowerCase())}},s=this.newIterator();for(const r of s)t(r.fileName),t(r.bigFontFileName);return Array.from(e)}}class Zi extends Ke{constructor(e){super(e)}}class nl extends De{constructor(){super(),this.events={entityAppended:new se,entityModified:new se,layerAppended:new se,layerModified:new se,layerErased:new se,openProgress:new se,headerSysVarChanged:new se},this._angBase=0,this._angDir=0,this._aunits=Cs.DecimalDegrees,this._celtscale=1,this._cecolor=new Ne,this._insunits=Ds.Millimeters,this._ltscale=1,this._pdmode=0,this._pdsize=0,this._tables={blockTable:new Yi(this),dimStyleTable:new qi(this),linetypeTable:new $i(this),textStyleTable:new Ki(this),layerTable:new Xi(this),viewportTable:new Zi(this)},this._dictionaries={layouts:new Hi(this),imageDefs:new an(this)}}get tables(){return this._tables}get dictionaries(){return this._dictionaries}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(e){const t=this.tables.blockTable.getIdAt(e);if(t==null)throw new Error(`[AcDbDatabase] The specified block table record id '${e}' doesn't exist in the drawing database!`);this._currentSpace=t}get aunits(){return this._aunits}set aunits(e){this._aunits=e||0,this.triggerHeaderSysVarChangedEvent("aunits")}get insunits(){return this._insunits}set insunits(e){this._insunits=e||4,this.triggerHeaderSysVarChangedEvent("insunits")}get ltscale(){return this._ltscale}set ltscale(e){this._ltscale=e||1,this.triggerHeaderSysVarChangedEvent("ltscale")}get cecolor(){return this._cecolor}set cecolor(e){this._cecolor=e||0,this.triggerHeaderSysVarChangedEvent("cecolor")}get celtscale(){return this._celtscale}set celtscale(e){this._celtscale=e||1,this.triggerHeaderSysVarChangedEvent("celtscale")}get angBase(){return this._angBase}set angBase(e){this._angBase=e||0,this.triggerHeaderSysVarChangedEvent("angbase")}get angDir(){return this._angDir}set angDir(e){this._angDir=e||0,this.triggerHeaderSysVarChangedEvent("angdir")}get pdmode(){return this._pdmode}set pdmode(e){this._pdmode=e||0,this.triggerHeaderSysVarChangedEvent("pdmode")}get pdsize(){return this._pdsize}set pdsize(e){this._pdsize=e||0,this.triggerHeaderSysVarChangedEvent("pdsize")}async read(e,t,s=on.DXF){const r=pe.instance.get(s);if(r==null)throw new Error(`Database converter for file type '${s}' isn't registered and can can't read this file!`);this.clear(),await r.read(e,this,t&&t.minimumChunkSize||10,async(i,a,o,c)=>{if(this.events.openProgress.dispatch({database:this,percentage:i,stage:a,stageStatus:o}),t&&t.fontLoader&&a=="FONT"&&o=="END"){const h=c||this.tables.textStyleTable.fonts;await t.fontLoader.load(h)}})}async openUri(e,t){const r=await(await fetch(e)).blob(),i=new FileReader;i.onload=a=>{var c;const o=(c=a.target)==null?void 0:c.result;o&&this.read(o,t)},i.readAsText(r)}clear(){this.tables.blockTable.removeAll(),this.tables.dimStyleTable.removeAll(),this.tables.layerTable.removeAll(),this.tables.linetypeTable.removeAll(),this.tables.textStyleTable.removeAll(),this.tables.viewportTable.removeAll(),this.dictionaries.layouts.removeAll(),this._currentSpace=void 0}triggerHeaderSysVarChangedEvent(e){this.events.headerSysVarChanged.dispatch({database:this,name:e})}}var Qi=(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))(Qi||{}),Ji=(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))(Ji||{}),ea=(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))(ea||{}),ta=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(ta||{}),sa=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(sa||{});const ls=class ls extends $e{constructor(e,t){e=e||{},Je(e,ls.DEFAULT_DIM_VALUES),super(e,t)}get dimpost(){return this.getAttr("dimpost")}set dimpost(e){this.setAttr("dimpost",e)}get dimapost(){return this.getAttr("dimapost")}set dimapost(e){this.setAttr("dimapost",e)}get dimscale(){return this.getAttr("dimscale")}set dimscale(e){this.setAttr("dimscale",e)}get dimasz(){return this.getAttr("dimasz")}set dimasz(e){this.setAttr("dimasz",e)}get dimexo(){return this.getAttr("dimexo")}set dimexo(e){this.setAttr("dimexo",e)}get dimdli(){return this.getAttr("dimdli")}set dimdli(e){this.setAttr("dimdli",e)}get dimexe(){return this.getAttr("dimexe")}set dimexe(e){this.setAttr("dimexe",e)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(e){this.setAttr("dimrnd",e)}get dimdle(){return this.getAttr("dimdle")}set dimdle(e){this.setAttr("dimdle",e)}get dimtp(){return this.getAttr("dimtp")}set dimtp(e){this.setAttr("dimtp",e)}get dimtm(){return this.getAttr("dimtm")}set dimtm(e){this.setAttr("dimtm",e)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(e){this.setAttr("dimtxt",e)}get dimcen(){return this.getAttr("dimcen")}set dimcen(e){this.setAttr("dimcen",e)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(e){this.setAttr("dimtsz",e)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(e){this.setAttr("dimaltf",e)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(e){this.setAttr("dimlfac",e)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(e){this.setAttr("dimtvp",e)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(e){this.setAttr("dimtfac",e)}get dimgap(){return this.getAttr("dimgap")}set dimgap(e){this.setAttr("dimgap",e)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(e){this.setAttr("dimaltrnd",e)}get dimtol(){return this.getAttr("dimtol")}set dimtol(e){this.setAttr("dimtol",e)}get dimlim(){return this.getAttr("dimlim")}set dimlim(e){this.setAttr("dimlim",e)}get dimtih(){return this.getAttr("dimtih")}set dimtih(e){this.setAttr("dimtih",e)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(e){this.setAttr("dimtoh",e)}get dimse1(){return this.getAttr("dimse1")}set dimse1(e){this.setAttr("dimse1",e)}get dimse2(){return this.getAttr("dimse2")}set dimse2(e){this.setAttr("dimse2",e)}get dimtad(){return this.getAttr("dimtad")}set dimtad(e){this.setAttr("dimtad",e)}get dimzin(){return this.getAttr("dimzin")}set dimzin(e){this.setAttr("dimzin",e)}get dimazin(){return this.getAttr("dimazin")}set dimazin(e){this.setAttr("dimazin",e)}get dimalt(){return this.getAttr("dimalt")}set dimalt(e){this.setAttr("dimalt",e)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(e){this.setAttr("dimaltd",e)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(e){this.setAttr("dimtofl",e)}get dimsah(){return this.getAttr("dimsah")}set dimsah(e){this.setAttr("dimsah",e)}get dimtix(){return this.getAttr("dimtix")}set dimtix(e){this.setAttr("dimtix",e)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(e){this.setAttr("dimsoxd",e)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(e){this.setAttr("dimclrd",e)}get dimclre(){return this.getAttr("dimclre")}set dimclre(e){this.setAttr("dimclre",e)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(e){this.setAttr("dimclrt",e)}get dimadec(){return this.getAttr("dimadec")}set dimadec(e){this.setAttr("dimadec",e)}get dimunit(){return this.getAttr("dimunit")}set dimunit(e){this.setAttr("dimunit",e)}get dimdec(){return this.getAttr("dimdec")}set dimdec(e){this.setAttr("dimdec",e)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(e){this.setAttr("dimtdec",e)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(e){this.setAttr("dimaltu",e)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(e){this.setAttr("dimalttd",e)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(e){this.setAttr("dimaunit",e)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(e){this.setAttr("dimfrac",e)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(e){this.setAttr("dimlunit",e)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(e){this.setAttr("dimdsep",e)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(e){this.setAttr("dimtmove",e)}get dimjust(){return this.getAttr("dimjust")}set dimjust(e){this.setAttr("dimjust",e)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(e){this.setAttr("dimsd1",e)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(e){this.setAttr("dimsd2",e)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(e){this.setAttr("dimtolj",e)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(e){this.setAttr("dimtzin",e)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(e){this.setAttr("dimaltz",e)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(e){this.setAttr("dimalttz",e)}get dimfit(){return this.getAttr("dimfit")}set dimfit(e){this.setAttr("dimfit",e)}get dimupt(){return this.getAttr("dimupt")}set dimupt(e){this.setAttr("dimupt",e)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(e){this.setAttr("dimatfit",e)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(e){this.setAttr("dimtxsty",e)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(e){this.setAttr("dimldrblk",e)}get dimblk(){return this.getAttr("dimblk")}set dimblk(e){this.setAttr("dimblk",e)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(e){this.setAttr("dimblk1",e)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(e){this.setAttr("dimblk2",e)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(e){this.setAttr("dimlwd",e)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(e){this.setAttr("dimlwe",e)}};ls.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 kt=ls;class na extends $e{constructor(e){super(),this.name=e.name,this._linetype=e}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(e){if(e<0||e>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[e].elementLength}}class ra extends $e{constructor(e){super(),this.name=e.name,this._textStyle=e,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(e){this._textStyle.obliqueAngle=e}get priorSize(){return this._textStyle.lastHeight}set priorSize(e){this._textStyle.lastHeight=e}get textSize(){return this._textStyle.fixedTextHeight}set textSize(e){this._textStyle.fixedTextHeight=e}get xScale(){return this._textStyle.widthFactor}set xScale(e){this._textStyle.widthFactor=e}get isVertical(){return this._isVertical}set isVertical(e){this._isVertical=e}get fileName(){return this._textStyle.font}set fileName(e){this._textStyle.font=e}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(e){this._textStyle.bigFont=e}get textStyle(){return this._textStyle}getFileNameWithoutExtension(e){const t=e.split("/").pop();if(t){const s=t.lastIndexOf(".");return s===-1?t:t.substring(0,s)}return e}}const rl={center:new v,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:Js.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:en.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:tn.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0};class ia extends $e{constructor(){super(),this._circleSides=100,this._center=new v,this._lowerLeftCorner=new v(0,0),this._upperRightCorner=new v(1,1),this._snapBase=new v(0,0),this._snapAngle=0,this._snapSpacing=new v(0,0),this._standardFlag=0,this._gridSpacing=new v,this._gridMajor=10,this._gsView=rl}get circleSides(){return this._circleSides}set circleSides(e){this._circleSides=e}get center(){return this._center}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(e){this._lowerLeftCorner.copy(e)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(e){this._upperRightCorner.copy(e)}get snapBase(){return this._snapBase}set snapBase(e){this._snapBase.copy(e)}get snapAngle(){return this._snapAngle}set snapAngle(e){this._snapAngle=e}get snapIncrements(){return this._snapSpacing}set snapIncrements(e){this._snapSpacing.copy(e)}get gridMajor(){return this._gridMajor}set gridMajor(e){this._gridMajor=e}get gridIncrements(){return this._gridSpacing}set gridIncrements(e){this._gridSpacing.copy(e)}get standardFlag(){return this._standardFlag}set standardFlag(e){this._standardFlag=e}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(e){this._backgroundObjectId=e}get gsView(){return this._gsView}}class aa{constructor(){this.events={layoutSwitched:new se}}countLayouts(e){return this.getWorkingDatabase(e).dictionaries.layouts.numEntries}findLayoutNamed(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.getAt(e)}findActiveLayout(){const e=this.getActiveLayout();return e?e.layoutName:"Model"}setCurrentLayoutId(e,t){const s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getIdAt(e);return this.setCurrentLayoutInternal(r,s)}setCurrentLayoutBtrId(e,t){const s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getBtrIdAt(e);return this.setCurrentLayoutInternal(r,s)}setCurrentLayout(e,t){const s=this.getWorkingDatabase(t),r=s.dictionaries.layouts.getAt(e);return this.setCurrentLayoutInternal(r,s)}renameLayout(e,t,s){const i=this.getWorkingDatabase(s).dictionaries.layouts.getAt(e);return i?(i.layoutName=t,!0):!1}layoutExists(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.has(e)}deleteLayout(e,t){return this.getWorkingDatabase(t).dictionaries.layouts.remove(e)}createLayout(e,t){const s=this.getWorkingDatabase(t),r=new rn;r.layoutName=e,r.tabOrder=s.dictionaries.layouts.maxTabOrder;const i=new Se;return i.name=`*Paper_Space${r.tabOrder}`,s.tables.blockTable.add(i),s.dictionaries.layouts.setAt(e,r),{layout:r,btr:i}}getActiveLayout(e){const t=this.getWorkingDatabase(e);return t.dictionaries.layouts.getBtrIdAt(t.currentSpaceId)}getWorkingDatabase(e){return e||hn().workingDatabase}setCurrentLayoutInternal(e,t){return e?(this.events.layoutSwitched.dispatch({oldLayout:this.getActiveLayout(),newLayout:e}),t.currentSpaceId=e.blockTableRecordId,!0):!1}}function hn(){return os.instance}const hs=class hs{constructor(){this._workingDatabase=null,this._layoutManager=new aa}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(e){this._workingDatabase=e}get layoutManager(){return this._layoutManager}};hs.instance=new hs;let os=hs;g.AcCmColor=Ne,g.AcCmErrors=te,g.AcCmEventDispatcher=ma,g.AcCmEventManager=se,g.AcCmLoader=Aa,g.AcCmLoadingManager=xn,g.AcCmObject=yn,g.AcCmPerformanceCollector=fs,g.AcCmTask=_n,g.AcCmTaskScheduler=fn,g.AcDb3PointAngularDimension=zi,g.AcDbAlignedDimension=Fi,g.AcDbAngleUnits=Cs,g.AcDbArc=ui,g.AcDbArcDimension=tl,g.AcDbBatchProcessing=An,g.AcDbBlockReference=Zs,g.AcDbBlockTable=Yi,g.AcDbBlockTableRecord=Se,g.AcDbCircle=mi,g.AcDbCurve=me,g.AcDbDatabase=nl,g.AcDbDatabaseConverter=Pr,g.AcDbDatabaseConverterManager=pe,g.AcDbDiametricDimension=Bi,g.AcDbDictionary=an,g.AcDbDimArrowType=wr,g.AcDbDimStyleTable=qi,g.AcDbDimStyleTableRecord=kt,g.AcDbDimTextHorizontal=Qi,g.AcDbDimTextVertical=Ji,g.AcDbDimVerticalJustification=sa,g.AcDbDimZeroSuppression=ea,g.AcDbDimZeroSuppressionAngular=ta,g.AcDbDimension=Xe,g.AcDbDxfConverter=Wi,g.AcDbEllipse=di,g.AcDbEntity=ge,g.AcDbFileType=on,g.AcDbHatch=yi,g.AcDbHatchPatternType=gi,g.AcDbHatchStyle=pi,g.AcDbHostApplicationServices=os,g.AcDbLayerTable=Xi,g.AcDbLayerTableRecord=ln,g.AcDbLayout=rn,g.AcDbLayoutDictionary=Hi,g.AcDbLayoutManager=aa,g.AcDbLeader=fi,g.AcDbLeaderAnnotationType=_i,g.AcDbLine=xi,g.AcDbLineSpacingStyle=Ri,g.AcDbLinetypeTable=$i,g.AcDbLinetypeTableRecord=na,g.AcDbMText=bi,g.AcDbObject=De,g.AcDbObjectIterator=Yt,g.AcDbOrdinateDimension=Vi,g.AcDbOsnapMode=Ge,g.AcDbPoint=Mi,g.AcDbPolyline=Si,g.AcDbRadialDimension=ji,g.AcDbRasterImage=nn,g.AcDbRasterImageClipBoundaryType=vi,g.AcDbRasterImageDef=Ui,g.AcDbRasterImageImageDisplayOpt=Li,g.AcDbRay=Oi,g.AcDbRenderingCache=Le,g.AcDbSpline=sn,g.AcDbSymbolTable=Ke,g.AcDbSymbolTableRecord=$e,g.AcDbTable=Ai,g.AcDbText=Ei,g.AcDbTextHorizontalMode=Ii,g.AcDbTextStyleTable=Ki,g.AcDbTextStyleTableRecord=ra,g.AcDbTextVerticalMode=Pi,g.AcDbTrace=Ti,g.AcDbUnitsValue=Ds,g.AcDbViewport=Ci,g.AcDbViewportTable=Zi,g.AcDbViewportTableRecord=ia,g.AcDbWipeout=Di,g.AcDbXline=Ni,g.AcGeArea2d=Zt,g.AcGeBox2d=K,g.AcGeBox3d=N,g.AcGeCircArc2d=it,g.AcGeCircArc3d=Ye,g.AcGeCurve2d=rt,g.AcGeEllipseArc2d=es,g.AcGeEllipseArc3d=ts,g.AcGeEuler=ii,g.AcGeGeometryUtil=qr,g.AcGeLine2d=ss,g.AcGeLine3d=Ce,g.AcGeLoop2d=li,g.AcGeMathUtil=O,g.AcGeMatrix2d=qt,g.AcGeMatrix3d=Ue,g.AcGePlane=Mt,g.AcGePoint2d=v,g.AcGePoint3d=w,g.AcGePolyline2d=vt,g.AcGeQuaternion=ke,g.AcGeShape2d=$s,g.AcGeSpline3d=at,g.AcGeTol=Wr,g.AcGeVector2d=B,g.AcGeVector3d=A,g.AcGiArrowType=Qs,g.AcGiDefaultLightingType=tn,g.AcGiMTextAttachmentPoint=ot,g.AcGiMTextFlowDirection=rs,g.AcGiOrthographicType=en,g.AcGiRenderMode=Js,g.AcGiViewport=is,g.AcTrStringUtil=ba,g.ByBlock=Ar,g.ByLayer=Wt,g.DEBUG_MODE=fa,g.DEFAULT_LINE_TYPE=Ut,g.DEFAULT_TOL=Us,g.DEG2RAD=Ns,g.DefaultLoadingManager=bn,g.FLOAT_TOL=He,g.ORIGIN_POINT_2D=qo,g.ORIGIN_POINT_3D=Hs,g.RAD2DEG=Rs,g.TAU=H,g.acdbHostApplicationServices=hn,g.basisFunction=Xt,g.calculateCurveLength=Zr,g.ceilPowerOfTwo=Vr,g.clamp=Ee,g.clone=ut,g.damp=vr,g.defaults=Je,g.degToRad=zr,g.euclideanModulo=zs,g.evaluateNurbsPoint=$t,g.floorPowerOfTwo=jr,g.generateChordKnots=$r,g.generateSqrtChordKnots=Kr,g.generateUUID=Tr,g.generateUniformKnots=Xr,g.has=gn,g.intPartLength=Bs,g.interpolateControlPoints=Qr,g.inverseLerp=Mr,g.isBetween=Gr,g.isBetweenAngle=Hr,g.isEmpty=pn,g.isEqual=et,g.isImperialUnits=Yo,g.isMetricUnits=Wo,g.isPointInPolygon=Ws,g.isPolygonIntersect=Yr,g.isPowerOfTwo=Br,g.lerp=Fs,g.log=dt,g.mapLinear=Sr,g.normalizeAngle=St,g.pingpong=Lr,g.radToDeg=Fr,g.randFloat=Dr,g.randFloatSpread=Nr,g.randInt=Cr,g.relativeEps=Ur,g.seededRandom=Rr,g.setLogLevel=xa,g.smootherstep=Or,g.smoothstep=kr,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});