@mlightcad/data-model 1.7.9 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +224 -224
- package/dist/data-model.cjs +3 -6
- package/dist/data-model.js +4581 -8981
- package/dist/dxf-parser-worker.js +676 -849
- package/lib/converter/AcDbDxfConverter.js +1 -1
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/converter/AcDbEntitiyConverter.js +16 -9
- package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
- package/lib/entity/AcDbHatch.d.ts +2 -0
- package/lib/entity/AcDbHatch.d.ts.map +1 -1
- package/lib/entity/AcDbHatch.js +51 -4
- package/lib/entity/AcDbHatch.js.map +1 -1
- package/lib/object/layout/AcDbLayout.d.ts.map +1 -1
- package/lib/object/layout/AcDbLayout.js.map +1 -1
- package/package.json +5 -5
package/dist/data-model.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var wn=(s=>(s[s.Invalid=-9999]="Invalid",s[s.Start=0]="Start",s[s.Text=1]="Text",s[s.AttributeTag=2]="AttributeTag",s[s.BlockName=2]="BlockName",s[s.ShapeName=2]="ShapeName",s[s.SymbolTableName=2]="SymbolTableName",s[s.SymbolTableRecordName=2]="SymbolTableRecordName",s[s.MlineStyleName=2]="MlineStyleName",s[s.AttributePrompt=3]="AttributePrompt",s[s.Description=3]="Description",s[s.DimPostString=3]="DimPostString",s[s.DimStyleName=3]="DimStyleName",s[s.LinetypeProse=3]="LinetypeProse",s[s.TextFontFile=3]="TextFontFile",s[s.CLShapeName=4]="CLShapeName",s[s.DimensionAlternativePrefixSuffix=4]="DimensionAlternativePrefixSuffix",s[s.SymbolTableRecordComments=4]="SymbolTableRecordComments",s[s.TextBigFontFile=4]="TextBigFontFile",s[s.Handle=5]="Handle",s[s.DimensionBlock=5]="DimensionBlock",s[s.LinetypeName=6]="LinetypeName",s[s.DimBlk1=6]="DimBlk1",s[s.TextStyleName=7]="TextStyleName",s[s.DimBlk2=7]="DimBlk2",s[s.LayerName=8]="LayerName",s[s.CLShapeText=9]="CLShapeText",s[s.XCoordinate=10]="XCoordinate",s[s.YCoordinate=20]="YCoordinate",s[s.ZCoordinate=30]="ZCoordinate",s[s.Real=40]="Real",s[s.TxtSize=40]="TxtSize",s[s.ViewportHeight=40]="ViewportHeight",s[s.Angle=50]="Angle",s[s.ViewportSnapAngle=50]="ViewportSnapAngle",s[s.Visibility=60]="Visibility",s[s.Int16=70]="Int16",s[s.Int32=90]="Int32",s[s.Int64=160]="Int64",s[s.Int8=280]="Int8",s[s.Thickness=39]="Thickness",s[s.Elevation=38]="Elevation",s[s.LinetypeScale=48]="LinetypeScale",s[s.DashLength=49]="DashLength",s[s.MlineOffset=49]="MlineOffset",s[s.LinetypeElement=49]="LinetypeElement",s[s.NormalX=210]="NormalX",s[s.NormalY=220]="NormalY",s[s.NormalZ=230]="NormalZ",s[s.UcsOrg=110]="UcsOrg",s[s.UcsOrientationX=111]="UcsOrientationX",s[s.UcsOrientationY=112]="UcsOrientationY",s[s.ViewHeight=45]="ViewHeight",s[s.ViewWidth=41]="ViewWidth",s[s.ViewLensLength=42]="ViewLensLength",s[s.ViewFrontClip=43]="ViewFrontClip",s[s.ViewBackClip=44]="ViewBackClip",s[s.ViewBrightness=141]="ViewBrightness",s[s.ViewContrast=142]="ViewContrast",s[s.ViewMode=71]="ViewMode",s[s.ViewportActive=68]="ViewportActive",s[s.ViewportAspect=41]="ViewportAspect",s[s.ViewportGrid=76]="ViewportGrid",s[s.ViewportIcon=74]="ViewportIcon",s[s.ViewportNumber=69]="ViewportNumber",s[s.ViewportSnap=75]="ViewportSnap",s[s.ViewportSnapPair=78]="ViewportSnapPair",s[s.ViewportSnapStyle=77]="ViewportSnapStyle",s[s.ViewportTwist=51]="ViewportTwist",s[s.ViewportVisibility=67]="ViewportVisibility",s[s.ViewportZoom=73]="ViewportZoom",s[s.Color=62]="Color",s[s.ColorRgb=420]="ColorRgb",s[s.ColorName=430]="ColorName",s[s.LineWeight=370]="LineWeight",s[s.PlotStyleNameType=380]="PlotStyleNameType",s[s.PlotStyleNameId=390]="PlotStyleNameId",s[s.GradientObjType=450]="GradientObjType",s[s.GradientAngle=460]="GradientAngle",s[s.GradientName=470]="GradientName",s[s.GradientColCount=453]="GradientColCount",s[s.GradientPatType=451]="GradientPatType",s[s.GradientTintType=452]="GradientTintType",s[s.GradientShift=461]="GradientShift",s[s.GradientColVal=463]="GradientColVal",s[s.GradientTintVal=462]="GradientTintVal",s[s.SoftPointerId=330]="SoftPointerId",s[s.HardPointerId=340]="HardPointerId",s[s.SoftOwnershipId=350]="SoftOwnershipId",s[s.HardOwnershipId=360]="HardOwnershipId",s[s.ArbitraryHandle=320]="ArbitraryHandle",s[s.ExtendedDataAsciiString=1e3]="ExtendedDataAsciiString",s[s.ExtendedDataRegAppName=1001]="ExtendedDataRegAppName",s[s.ExtendedDataControlString=1002]="ExtendedDataControlString",s[s.ExtendedDataLayerName=1003]="ExtendedDataLayerName",s[s.ExtendedDataBinaryChunk=1004]="ExtendedDataBinaryChunk",s[s.ExtendedDataHandle=1005]="ExtendedDataHandle",s[s.ExtendedDataXCoordinate=1010]="ExtendedDataXCoordinate",s[s.ExtendedDataWorldXCoordinate=1011]="ExtendedDataWorldXCoordinate",s[s.ExtendedDataWorldXDisp=1012]="ExtendedDataWorldXDisp",s[s.ExtendedDataWorldXDir=1013]="ExtendedDataWorldXDir",s[s.ExtendedDataYCoordinate=1020]="ExtendedDataYCoordinate",s[s.ExtendedDataWorldYCoordinate=1021]="ExtendedDataWorldYCoordinate",s[s.ExtendedDataWorldYDisp=1022]="ExtendedDataWorldYDisp",s[s.ExtendedDataWorldYDir=1023]="ExtendedDataWorldYDir",s[s.ExtendedDataZCoordinate=1030]="ExtendedDataZCoordinate",s[s.ExtendedDataWorldZCoordinate=1031]="ExtendedDataWorldZCoordinate",s[s.ExtendedDataWorldZDisp=1032]="ExtendedDataWorldZDisp",s[s.ExtendedDataWorldZDir=1033]="ExtendedDataWorldZDir",s[s.ExtendedDataReal=1040]="ExtendedDataReal",s[s.ExtendedDataDist=1041]="ExtendedDataDist",s[s.ExtendedDataScale=1042]="ExtendedDataScale",s[s.ExtendedDataInteger16=1070]="ExtendedDataInteger16",s[s.ExtendedDataInteger32=1071]="ExtendedDataInteger32",s[s.XTextString=300]="XTextString",s[s.XReal=140]="XReal",s[s.XInt16=170]="XInt16",s[s.XXInt16=270]="XXInt16",s[s.Subclass=100]="Subclass",s[s.ControlString=102]="ControlString",s[s.EmbeddedObjectStart=101]="EmbeddedObjectStart",s[s.End=-1]="End",s[s.FirstEntityId=-2]="FirstEntityId",s[s.HeaderId=-2]="HeaderId",s[s.XDataStart=-3]="XDataStart",s[s.Operator=-4]="Operator",s[s.PReactors=-5]="PReactors",s[s.XDictionary=-6]="XDictionary",s))(wn||{});const vr=[{name:"AC1.2",value:1},{name:"AC1.40",value:2},{name:"AC1.50",value:3},{name:"AC2.20",value:4},{name:"AC2.10",value:5},{name:"AC2.21",value:6},{name:"AC2.22",value:7},{name:"AC1001",value:8},{name:"AC1002",value:9},{name:"AC1003",value:10},{name:"AC1004",value:11},{name:"AC1005",value:12},{name:"AC1006",value:13},{name:"AC1007",value:14},{name:"AC1008",value:15},{name:"AC1009",value:16},{name:"AC1010",value:17},{name:"AC1011",value:18},{name:"AC1012",value:19},{name:"AC1013",value:20},{name:"AC1014",value:21},{name:"AC1500",value:22},{name:"AC1015",value:23},{name:"AC1800a",value:24},{name:"AC1018",value:25},{name:"AC2100a",value:26},{name:"AC1021",value:27},{name:"AC2400a",value:28},{name:"AC1024",value:29},{name:"AC1027",value:31},{name:"AC3200a",value:32},{name:"AC1032",value:33}];class At{constructor(t){if(typeof t=="string"){const e=vr.find(i=>i.name===t);if(!e)throw new Error(`Unknown DWG version name: ${t}`);this.name=e.name,this.value=e.value;return}if(typeof t=="number"){const e=vr.find(i=>i.value===t);if(!e)throw new Error(`Unknown DWG version value: ${t}`);this.name=e.name,this.value=e.value;return}throw new Error("Invalid constructor argument for AcDbDwgVersion")}}class Kr{constructor(t={}){this._database=t.database,this._precision=Math.max(0,Math.min(16,t.precision??16)),this._version=t.version instanceof At?t.version:t.version!=null?new At(t.version):void 0,this._lines=[],this._handleMap=new Map,this._nextHandle=1}get database(){return this._database}set database(t){this._database=t}get precision(){return this._precision}setPrecision(t){return this._precision=Math.max(0,Math.min(16,t)),this}get version(){return this._version}setVersion(t){return this._version=t instanceof At?t:new At(t),this}toString(){return this._lines.join(`
|
|
2
2
|
`)+`
|
|
3
|
-
`}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1,console.log(`Registered handle ${t} as ${this._handleMap.get(t)}`))),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){return e==null?this:(this._lines.push(String(Math.trunc(t))),this._lines.push(this.formatValue(e)),this)}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const i=this.resolveHandle(e);return i?this.writeString(t,i):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,i=420){if(!t)return this;const a=t.colorIndex;a!=null&&this.writeInt16(e,a);const h=t.RGB;return h!=null&&t.colorIndex==null&&this.writeInt32(i,h),this}writeTransparency(t,e=440){return t?this.writeInt32(e,t.serialize()):this}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){return typeof t=="string"?t:typeof t=="boolean"?t?"1":"0":typeof t=="number"?Number.isFinite(t)?Number.isInteger(t)?String(t):t.toFixed(this._precision).replace(/\.?0+$/,""):"0":String(t)}}function Jc(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in n)){const h=Object.getOwnPropertyDescriptor(i,a);h&&Object.defineProperty(n,a,h.get?h:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var lt=(n=>(n[n.ByColor=1]="ByColor",n[n.ByACI=2]="ByACI",n[n.ByLayer=3]="ByLayer",n[n.ByBlock=4]="ByBlock",n[n.None=0]="None",n))(lt||{});const Sl={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},va=[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];let sn=class{static getColorByIndex(t){return va[t]}static getIndexByColor(t){const e=va.length-1;for(let i=1;i<e;++i)if(va[i]===t)return i}static getColorByName(t){return Sl[t.toLowerCase()]}static getNameByColor(t){for(const[e,i]of Object.entries(Sl))if(i===t)return e}static getNameByIndex(t){const e=this.getColorByIndex(t);return this.getNameByColor(e)}},de=class Dr{constructor(t=lt.ByLayer,e){this._colorMethod=t,this._colorMethod==lt.ByColor&&e==null?this._value=16777215:this._colorMethod==lt.ByACI?e==null?this._value=8:e===0?this._colorMethod=lt.ByBlock:e===256?this._colorMethod=lt.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}get colorMethod(){return this._colorMethod}set colorMethod(t){this._colorMethod=t}get red(){const t=this.RGB;return t!=null?t>>16&255:void 0}get green(){const t=this.RGB;return t!=null?t>>8&255:void 0}get blue(){const t=this.RGB;return t!=null?t&255:void 0}get RGB(){switch(this._colorMethod){case lt.ByColor:case lt.ByBlock:case lt.ByLayer:return this._value;case lt.ByACI:return this._value?sn.getColorByIndex(this._value):this._value;default:return}}setRGB(t,e,i){const a=Math.max(0,Math.min(255,Math.round(t))),h=Math.max(0,Math.min(255,Math.round(e))),u=Math.max(0,Math.min(255,Math.round(i)));return this._value=a<<16|h<<8|u,this._colorMethod=lt.ByColor,this}setRGBValue(t){return t==null||!Number.isFinite(t)?(console.warn("Invalid RGB value:",t),this):(this._value=t&16777215,this._colorMethod=lt.ByColor,this)}setRGBFromCss(t){if(!t)return this;const e=t.trim().toLowerCase();if(e.startsWith("#")){let h=0,u=0,p=0;if(e.length===7)h=parseInt(e.substr(1,2),16),u=parseInt(e.substr(3,2),16),p=parseInt(e.substr(5,2),16);else if(e.length===4)h=parseInt(e[1]+e[1],16),u=parseInt(e[2]+e[2],16),p=parseInt(e[3]+e[3],16);else return console.warn("Invalid hex color:",t),this;return this.setRGB(h,u,p)}const i=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(i){const h=parseInt(i[1],10),u=parseInt(i[2],10),p=parseInt(i[3],10);return this.setRGB(h,u,p)}const a=sn.getColorByName(t);return a!==void 0?this.setRGBValue(a):(console.warn("Unknown CSS color string:",t),this)}setScalar(t){return this.setRGB(t,t,t)}get hexColor(){const t=this.RGB;return t==null?void 0:"0x"+t.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const t=this.RGB;if(t!=null)return`rgb(${t>>16&255},${t>>8&255},${t&255})`}cssColorAlpha(t){const e=this.RGB;if(e!=null)return`rgba(${e>>16&255},${e>>8&255},${e&255},${t})`}get colorIndex(){return this._colorMethod===lt.ByACI?this._value:this._colorMethod===lt.ByLayer?256:this._colorMethod===lt.ByBlock?0:void 0}set colorIndex(t){if(t==null)return;const e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=lt.ByBlock,this._value=void 0):e===256?(this._colorMethod=lt.ByLayer,this._value=void 0):(this._colorMethod=lt.ByACI,this._value=e)}get isByColor(){return this._colorMethod===lt.ByColor}get isByACI(){return this._colorMethod===lt.ByACI}get isForeground(){return this._colorMethod===lt.ByACI&&this._value===7}setForeground(){return this._colorMethod=lt.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===lt.ByLayer}setByLayer(t){return this._colorMethod=lt.ByLayer,t==null?this._value=256:this._value=t,this}get isByBlock(){return this._colorMethod===lt.ByBlock}setByBlock(t){return this._colorMethod=lt.ByBlock,t==null?this._value=0:this._value=t,this}get colorName(){switch(this._colorMethod){case lt.ByLayer:return"ByLayer";case lt.ByBlock:return"ByBlock";case lt.ByColor:return this._value?sn.getNameByColor(this._value):"";case lt.ByACI:return this._value?sn.getNameByIndex(this._value):"";default:return}}set colorName(t){if(!t)return;const e=sn.getColorByName(t);e!==void 0?(this._value=e,this._colorMethod=lt.ByColor):console.warn("Unknown color name:",t)}clone(){const t=new Dr;return t._colorMethod=this._colorMethod,t._value=this._value,t}copy(t){return this._colorMethod=t._colorMethod,this._value=t._value,this}equals(t){return this._colorMethod===t._colorMethod&&this._value===t._value}toString(){switch(this._colorMethod){case lt.ByLayer:return"ByLayer";case lt.ByBlock:return"ByBlock";case lt.ByACI:return this._value!==void 0?String(this._value):"";case lt.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(t){if(!t)return;const e=t.trim();if(/^bylayer$/i.test(e))return new Dr(lt.ByLayer);if(/^byblock$/i.test(e))return new Dr(lt.ByBlock);const i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){const h=Number(i[1]),u=Number(i[2]),p=Number(i[3]),y=new Dr(lt.ByColor);return y.setRGB(h,u,p),y}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){const[h,u,p]=e.split(",").map(Number),y=new Dr(lt.ByColor);return y.setRGB(h,u,p),y}if(/^\d+$/.test(e)){const h=parseInt(e,10);return new Dr(lt.ByACI,h)}if(/^book\$/i.test(e)){const h=e.substring(e.indexOf("$")+1),u=sn.getColorByName(h);if(u!=null)return new Dr(lt.ByColor,u);console.warn("Unknown color book entry:",t);return}const a=sn.getColorByName(e);if(a!=null)return new Dr(lt.ByColor,a);console.warn("Unknown color name:",t)}};class td{constructor(t=lt.ByColor,e=0){this._colorMethod=t,this._value=e}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(t){this._colorMethod=lt.ByColor,this._value=this._value&65535|(t&255)<<16}get green(){return this._value>>8&255}set green(t){this._colorMethod=lt.ByColor,this._value=this._value&16711935|(t&255)<<8}get blue(){return this._value&255}set blue(t){this._colorMethod=lt.ByColor,this._value=this._value&16776960|t&255}setRGB(t,e,i){this._colorMethod=lt.ByColor,this._value=(t&255)<<16|(e&255)<<8|i&255}get colorIndex(){return this._value}set colorIndex(t){this._colorMethod=lt.ByACI,this._value=t}get layerIndex(){return this._value}set layerIndex(t){this._colorMethod=lt.ByLayer,this._value=t}isByColor(){return this._colorMethod===lt.ByColor}isByLayer(){return this._colorMethod===lt.ByLayer}isByBlock(){return this._colorMethod===lt.ByBlock}isByACI(){return this._colorMethod===lt.ByACI}isNone(){return this._colorMethod===lt.None}get rawValue(){return this._value}set rawValue(t){this._value=t}}const Ze={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 ed{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const a=i.indexOf(e);a!==-1&&i.splice(a,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const i=e.slice(0);for(let a=0,h=i.length;a<h;a++)i[a].call(this,t)}}}let he=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const i of this.listeners)i.call(null,t,...e)}};function Hi(n){return n===null||typeof n!="object"?n:Array.isArray(n)?[...n]:{...n}}function Ca(n){if(n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(Array.isArray(n))return n.map(Ca);const t={};for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=Ca(n[e]));return t}function ss(n,...t){for(const e of t)if(e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&n[i]===void 0&&(n[i]=e[i]);return n}function Gl(n,t){return n!=null&&Object.prototype.hasOwnProperty.call(n,t)}function Hl(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 Qn(n,t){if(n===t)return!0;if(n==null||t==null)return n===t;if(typeof n!=typeof t)return!1;if(typeof n!="object")return n===t;if(Array.isArray(n)!==Array.isArray(t))return!1;if(Array.isArray(n)){if(n.length!==t.length)return!1;for(let a=0;a<n.length;a++)if(!Qn(n[a],t[a]))return!1;return!0}const e=Object.keys(n),i=Object.keys(t);if(e.length!==i.length)return!1;for(const a of e)if(!Object.prototype.hasOwnProperty.call(t,a)||!Qn(n[a],t[a]))return!1;return!0}var rd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Xl={exports:{}};(function(n){(function(t,e){n.exports?n.exports=e():t.log=e()})(rd,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],h={},u=null;function p(O,V){var z=O[V];if(typeof z.bind=="function")return z.bind(O);try{return Function.prototype.bind.call(z,O)}catch{return function(){return Function.prototype.apply.apply(z,[O,arguments])}}}function y(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(O){return O==="debug"&&(O="log"),typeof console===e?!1:O==="trace"&&i?y:console[O]!==void 0?p(console,O):console.log!==void 0?p(console,"log"):t}function x(){for(var O=this.getLevel(),V=0;V<a.length;V++){var z=a[V];this[z]=V<O?t:this.methodFactory(z,O,this.name)}if(this.log=this.debug,typeof console===e&&O<this.levels.SILENT)return"No console available for logging"}function b(O){return function(){typeof console!==e&&(x.call(this),this[O].apply(this,arguments))}}function E(O,V,z){return f(O)||b.apply(this,arguments)}function I(O,V){var z=this,it,_t,st,H="loglevel";typeof O=="string"?H+=":"+O:typeof O=="symbol"&&(H=void 0);function dt(xt){var Bt=(a[xt]||"silent").toUpperCase();if(!(typeof window===e||!H)){try{window.localStorage[H]=Bt;return}catch{}try{window.document.cookie=encodeURIComponent(H)+"="+Bt+";"}catch{}}}function at(){var xt;if(!(typeof window===e||!H)){try{xt=window.localStorage[H]}catch{}if(typeof xt===e)try{var Bt=window.document.cookie,we=encodeURIComponent(H),be=Bt.indexOf(we+"=");be!==-1&&(xt=/^([^;]+)/.exec(Bt.slice(be+we.length+1))[1])}catch{}return z.levels[xt]===void 0&&(xt=void 0),xt}}function Gt(){if(!(typeof window===e||!H)){try{window.localStorage.removeItem(H)}catch{}try{window.document.cookie=encodeURIComponent(H)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function $t(xt){var Bt=xt;if(typeof Bt=="string"&&z.levels[Bt.toUpperCase()]!==void 0&&(Bt=z.levels[Bt.toUpperCase()]),typeof Bt=="number"&&Bt>=0&&Bt<=z.levels.SILENT)return Bt;throw new TypeError("log.setLevel() called with invalid level: "+xt)}z.name=O,z.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},z.methodFactory=V||E,z.getLevel=function(){return st??_t??it},z.setLevel=function(xt,Bt){return st=$t(xt),Bt!==!1&&dt(st),x.call(z)},z.setDefaultLevel=function(xt){_t=$t(xt),at()||z.setLevel(xt,!1)},z.resetLevel=function(){st=null,Gt(),x.call(z)},z.enableAll=function(xt){z.setLevel(z.levels.TRACE,xt)},z.disableAll=function(xt){z.setLevel(z.levels.SILENT,xt)},z.rebuild=function(){if(u!==z&&(it=$t(u.getLevel())),x.call(z),u===z)for(var xt in h)h[xt].rebuild()},it=$t(u?u.getLevel():"WARN");var Yt=at();Yt!=null&&(st=$t(Yt)),x.call(z)}u=new I,u.getLogger=function(O){if(typeof O!="symbol"&&typeof O!="string"||O==="")throw new TypeError("You must supply a name when creating a logger.");var V=h[O];return V||(V=h[O]=new I(O,u.methodFactory)),V};var L=typeof window!==e?window.log:void 0;return u.noConflict=function(){return typeof window!==e&&window.log===u&&(window.log=L),u},u.getLoggers=function(){return h},u.default=u,u})})(Xl);var Yl=Xl.exports;const id=nd(Yl),sd=Jc({__proto__:null,default:id},[Yl]),ad=!0,Yi=sd;Yi.setLevel("debug");const od=n=>{try{Yi.setLevel(n)}catch(t){Yi.setLevel("error"),Yi.error(t)}};let ql=class Kl{constructor(t,e){this.events={attrChanged:new he,modelChanged:new he},this._changing=!1,this._previousAttributes={},this._pending=!1;const i=t||{};e&&ss(i,e),this.attributes=i,this.changed={}}get(t){return this.attributes[t]}set(t,e,i){if(t==null)return this;let a;typeof t=="object"?(a=t,i=e):(a={},a[t]=e),i||(i={});const h=i.unset,u=i.silent,p=[],y=this._changing;this._changing=!0,y||(this._previousAttributes=Hi(this.attributes),this.changed={});const f=this.attributes,x=this.changed,b=this._previousAttributes;for(const E in a)e=a[E],Qn(f[E],e)||p.push(E),Qn(b[E],e)?delete x[E]:x[E]=e,h?delete f[E]:f[E]=e;if(!u){p.length&&(this._pending=i);for(let E=0;E<p.length;E++)this.events.attrChanged.dispatch({object:this,attrName:p[E],attrValue:f[p[E]],options:i})}if(y)return this;if(!u)for(;this._pending;)i=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!Hl(this.changed):Gl(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?Hi(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,i={};for(const a in t){const h=t[a];Qn(e[a],h)||(i[a]=h)}return i}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return Hi(this._previousAttributes)}clone(){const t=Hi(this.attributes);return new Kl(t)}},Ka=class Xi{constructor(){this.entries=new Map}static getInstance(){return Xi.instance||(Xi.instance=new Xi),Xi.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries)console.log(`${t}:`),console.log(e.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class ld{static formatBytes(t,e=2){if(t===0)return"0 B";const i=1024,a=Math.max(0,e),h=["B","KB","MB","GB","TB"],u=Math.floor(Math.log(t)/Math.log(i)),p=t/Math.pow(i,u);return`${parseFloat(p.toFixed(a))} ${h[u]}`}}var Ne=(n=>(n[n.ByLayer=0]="ByLayer",n[n.ByBlock=1]="ByBlock",n[n.ByAlpha=2]="ByAlpha",n[n.ErrorValue=3]="ErrorValue",n))(Ne||{});let na=class yr{constructor(t){t!==void 0?(this._method=Ne.ByAlpha,this._alpha=yr.clampAlpha(t)):(this._method=Ne.ByLayer,this._alpha=255)}get method(){return this._method}set method(t){this._method=t}get alpha(){return this._alpha}set alpha(t){this._alpha=yr.clampAlpha(t),this._method=Ne.ByAlpha}get percentage(){if(this._method===Ne.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(t){const e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i}static clampAlpha(t){return Math.max(0,Math.min(255,Math.floor(t)))}get isByAlpha(){return this._method===Ne.ByAlpha}get isByBlock(){return this._method===Ne.ByBlock}get isByLayer(){return this._method===Ne.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===Ne.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const t=new yr;return t._method=this._method,t._alpha=this._alpha,t}equals(t){return this._method===t._method&&this._alpha===t._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(t){const e=t.trim();if(/^bylayer$/i.test(e)){const h=new yr;return h._method=Ne.ByLayer,h}if(/^byblock$/i.test(e)){const h=new yr;return h._method=Ne.ByBlock,h}const i=Number(e);if(Number.isInteger(i)&&i>=0&&i<=255)return new yr(i);const a=new yr;return a._method=Ne.ErrorValue,a}static deserialize(t){const e=t>>>24&255,i=t&255,a=Object.values(Ne)[e]??Ne.ErrorValue,h=new yr;return h._method=a,h._alpha=yr.clampAlpha(i),h}};class $l{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}let Zl=class{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(t){return new Promise((e,i)=>{const a=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(a):setTimeout(a,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let i=t;for(let a=0;a<e;a++){const h=this.tasks[a];try{i=await this.scheduleTask(async()=>{const u=await h.run(i);return this.onProgress((a+1)/e,h),u})}catch(u){if(this.onError({error:u,taskIndex:a,task:h}))return Promise.reject(u)}}this.onComplete(i)}},Ql=class{constructor(t,e,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,i=this.handlers.length;e<i;e+=2){const a=this.handlers[e],h=this.handlers[e+1];if(a.global&&(a.lastIndex=0),a.test(t))return h}return null}};const Jl=new Ql;class hd{constructor(t){this.manager=t!==void 0?t:Jl,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((i,a)=>{this.load(t,i,e,a)})}parse(t){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}var En=256,th=[],Pl=256,gs;for(;En--;)th[En]=(En+256).toString(16).substring(1);function ud(n){var t=0,e=11;if(!gs||En+e>Pl*2)for(gs="",En=0;t<Pl;t++)gs+=th[Math.random()*256|0];return gs.substring(En,En+++e)}const ws="TEMP_";let Ba;function eh(n){Ba=n}class Hr{constructor(t,e){if(t=t||{},this._attrs=new ql(t,e),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return ws+ud()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(ws)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ws)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(Ba)return Ba().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===qa.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}dxfOut(...t){const[e,i=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),i)for(const a of this._xDataMap.values())e.writeResultBuffer(a);return this}dxfOutFields(t){return this}}let Ra;function rh(n){Ra=n}function $a(){return Es.instance}const ta=class ta{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){if(!this._layoutManager){if(!Ra)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=Ra()}return this._layoutManager}};ta.instance=new ta;let Es=ta;eh($a);var nh=(n=>(n.kForRead="kForRead",n.kForWrite="kForWrite",n))(nh||{});class Za{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new Za(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class Qa{constructor(t,e,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,i)=>{const a=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(a):setTimeout(a,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let i=0;const a=async()=>{const h=i,u=Math.min(i+this._chunkSize,this._count);await t(h,u),i=u,i<this._count&&await this.scheduleTask(a)};await a(),await(e==null?void 0:e())}}var qi=(n=>(n.DXF="dxf",n.DWG="dwg",n))(qi||{});class vr{constructor(){this.events={registered:new he,unregistered:new he},this._converters=new Map,this.register("dxf",new Bc)}static createInstance(){return vr._instance==null&&(vr._instance=new vr),this._instance}static get instance(){return vr._instance||(vr._instance=new vr),vr._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var Ja=(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))(Ja||{});class si{static get instance(){return this._instance||(this._instance=new si),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,i,a=[],h=!0,u,p){var f;const y=[];if(e!=null){const x=this.createKey(e.name,i);let b;if(this.has(x))b=this.get(x);else{const E=(f=t.basePoint)==null?void 0:f.clone();t.basePoint=void 0;const I=e.newIterator();let L=!0;for(const O of I)if(O.color.isByBlock&&i?(Al.copy(O.color),O.color.setRGBValue(i),this.addEntity(O,y,t),O.color.copy(Al)):this.addEntity(O,y,t),L&&y.length>0){const V=y[0];t.basePoint=V.basePoint,L=!1}b=t.group(y),b&&h&&ue.name&&!ue.name.startsWith("*U")&&this.set(x,b),t.basePoint=E}return b&&u&&(b.applyMatrix(u),p&&(p.x!=0||p.y!=0||p.z!=1)&&(u.setFromExtrusionDirection(p),b.applyMatrix(u))),b&&a&&a.length>0&&(b.bakeTransformToChildren(),a.forEach(E=>b.addChild(E))),b}else return t.group(y)}addEntity(t,e,i){const a=t.worldDraw(i);a&&(this.attachEntityInfo(a,t),e.push(a))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const Al=new de;var to=(n=>(n[n.UTF8=0]="UTF8",n[n.US_ASCII=1]="US_ASCII",n[n.ISO_8859_1=2]="ISO_8859_1",n[n.ISO_8859_2=3]="ISO_8859_2",n[n.ISO_8859_3=4]="ISO_8859_3",n[n.ISO_8859_4=5]="ISO_8859_4",n[n.ISO_8859_5=6]="ISO_8859_5",n[n.ISO_8859_6=7]="ISO_8859_6",n[n.ISO_8859_7=8]="ISO_8859_7",n[n.ISO_8859_8=9]="ISO_8859_8",n[n.ISO_8859_9=10]="ISO_8859_9",n[n.CP437=11]="CP437",n[n.CP850=12]="CP850",n[n.CP852=13]="CP852",n[n.CP855=14]="CP855",n[n.CP857=15]="CP857",n[n.CP860=16]="CP860",n[n.CP861=17]="CP861",n[n.CP863=18]="CP863",n[n.CP864=19]="CP864",n[n.CP865=20]="CP865",n[n.CP869=21]="CP869",n[n.CP932=22]="CP932",n[n.MACINTOSH=23]="MACINTOSH",n[n.BIG5=24]="BIG5",n[n.CP949=25]="CP949",n[n.JOHAB=26]="JOHAB",n[n.CP866=27]="CP866",n[n.ANSI_1250=28]="ANSI_1250",n[n.ANSI_1251=29]="ANSI_1251",n[n.ANSI_1252=30]="ANSI_1252",n[n.GB2312=31]="GB2312",n[n.ANSI_1253=32]="ANSI_1253",n[n.ANSI_1254=33]="ANSI_1254",n[n.ANSI_1255=34]="ANSI_1255",n[n.ANSI_1256=35]="ANSI_1256",n[n.ANSI_1257=36]="ANSI_1257",n[n.ANSI_874=37]="ANSI_874",n[n.ANSI_932=38]="ANSI_932",n[n.ANSI_936=39]="ANSI_936",n[n.ANSI_949=40]="ANSI_949",n[n.ANSI_950=41]="ANSI_950",n[n.ANSI_1361=42]="ANSI_1361",n[n.UTF16=43]="UTF16",n[n.ANSI_1258=44]="ANSI_1258",n[n.UNDEFINED=255]="UNDEFINED",n))(to||{});const cd=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],ih=n=>cd[n],Jn="Continuous",ne="Standard",ti="ByLayer",ks="ByBlock",Fa="mlightcad",za="ACAD",Se=["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 El=1234567;const eo=Math.PI/180,ro=180/Math.PI;function sh(){const n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Se[n&255]+Se[n>>8&255]+Se[n>>16&255]+Se[n>>24&255]+"-"+Se[t&255]+Se[t>>8&255]+"-"+Se[t>>16&15|64]+Se[t>>24&255]+"-"+Se[e&63|128]+Se[e>>8&255]+"-"+Se[e>>16&255]+Se[e>>24&255]+Se[i&255]+Se[i>>8&255]+Se[i>>16&255]+Se[i>>24&255]).toLowerCase()}function jr(n,t,e){return Math.max(t,Math.min(e,n))}function no(n,t){return(n%t+t)%t}function ah(n,t,e,i,a){return i+(n-t)*(a-i)/(e-t)}function oh(n,t,e){return n!==t?(e-n)/(t-n):0}function io(n,t,e){return(1-e)*n+e*t}function lh(n,t,e,i){return io(n,t,1-Math.exp(-e*i))}function hh(n,t=1){return t-Math.abs(no(n,t*2)-t)}function uh(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*(3-2*n))}function ch(n,t,e){return n<=t?0:n>=e?1:(n=(n-t)/(e-t),n*n*n*(n*(n*6-15)+10))}function dh(n,t){return n+Math.floor(Math.random()*(t-n+1))}function ph(n,t){return n+Math.random()*(t-n)}function gh(n){return n*(.5-Math.random())}function mh(n){n!==void 0&&(El=n);let t=El+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function _h(n){return n*eo}function fh(n){return n*ro}function yh(n){return(n&n-1)===0&&n!==0}function vh(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function wh(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ki(n){const t=Math.PI*2;return(n%t+t)%t}function bh(n,t,e){return n>t&&n<e||n>e&&n<t}function xh(n,t,e,i=!1){return n=Ki(n),t=Ki(t),e=Ki(e),i?t>e?n<=t&&n>=e:n<=t||n>=e:t<e?n>=t&&n<=e:n>=t||n<=e}function so(n){return n=Math.abs(n),n<1?0:Math.ceil(Math.log10(Math.abs(n)+1))}function Ih(n,t=1e-7){const e=so(n);return Math.max(Math.pow(10,e)*t,t)}const St={DEG2RAD:eo,RAD2DEG:ro,generateUUID:sh,clamp:jr,euclideanModulo:no,mapLinear:ah,inverseLerp:oh,lerp:io,damp:lh,pingpong:hh,smoothstep:uh,smootherstep:ch,randInt:dh,randFloat:ph,randFloatSpread:gh,seededRandom:mh,degToRad:_h,radToDeg:fh,isPowerOfTwo:yh,ceilPowerOfTwo:vh,floorPowerOfTwo:wh,normalizeAngle:Ki,isBetween:bh,isBetweenAngle:xh,intPartLength:so,relativeEps:Ih},Va=class Sh{constructor(t,e){this.x=0,this.y=0;const i=+(t!==void 0)+ +(e!==void 0);if(i!==0){if(i===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(i===1){const{x:a,y:h}=t;this.x=a,this.y=h;return}if(i===2){this.x=t,this.y=e;return}throw Ze.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new Sh(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,i=this.y,a=t.elements;return this.x=a[0]*e+a[3]*i+a[6],this.y=a[1]*e+a[4]*i+a[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const i=Math.cos(e),a=Math.sin(e),h=this.x-t.x,u=this.y-t.y;return this.x=h*i-u*a+t.x,this.y=h*a+u*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(St.relativeEps(this.x,t),St.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};Va.EMPTY=Object.freeze(new Va(0,0));let te=Va;const Da=class Ph{constructor(t,e,i,a,h,u,p,y,f){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&a!=null&&h!=null&&u!=null&&p!=null&&y!=null&&f!=null&&this.set(t,e,i,a,h,u,p,y,f)}set(t,e,i,a,h,u,p,y,f){const x=this.elements;return x[0]=t,x[1]=a,x[2]=p,x[3]=e,x[4]=h,x[5]=y,x[6]=i,x[7]=u,x[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,a=e.elements,h=this.elements,u=i[0],p=i[3],y=i[6],f=i[1],x=i[4],b=i[7],E=i[2],I=i[5],L=i[8],O=a[0],V=a[3],z=a[6],it=a[1],_t=a[4],st=a[7],H=a[2],dt=a[5],at=a[8];return h[0]=u*O+p*it+y*H,h[3]=u*V+p*_t+y*dt,h[6]=u*z+p*st+y*at,h[1]=f*O+x*it+b*H,h[4]=f*V+x*_t+b*dt,h[7]=f*z+x*st+b*at,h[2]=E*O+I*it+L*H,h[5]=E*V+I*_t+L*dt,h[8]=E*z+I*st+L*at,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],a=t[2],h=t[3],u=t[4],p=t[5],y=t[6],f=t[7],x=t[8];return e*u*x-e*p*f-i*h*x+i*p*y+a*h*f-a*u*y}invert(){const t=this.elements,e=t[0],i=t[1],a=t[2],h=t[3],u=t[4],p=t[5],y=t[6],f=t[7],x=t[8],b=x*u-p*f,E=p*y-x*h,I=f*h-u*y,L=e*b+i*E+a*I;if(L===0)return this.set(0,0,0,0,0,0,0,0,0);const O=1/L;return t[0]=b*O,t[1]=(a*f-x*i)*O,t[2]=(p*i-a*u)*O,t[3]=E*O,t[4]=(x*e-a*y)*O,t[5]=(a*h-p*e)*O,t[6]=I*O,t[7]=(i*y-f*e)*O,t[8]=(u*e-i*h)*O,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,i,a,h,u,p){const y=Math.cos(h),f=Math.sin(h);return this.set(i*y,i*f,-i*(y*u+f*p)+u+t,-a*f,a*y,-a*(-f*u+y*p)+p+e,0,0,1),this}scale(t,e){return this.premultiply(wa.makeScale(t,e)),this}rotate(t){return this.premultiply(wa.makeRotation(-t)),this}translate(t,e){return this.premultiply(wa.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof te?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let a=0;a<9;a++)if(e[a]!==i[a])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new Ph().fromArray(this.elements)}};Da.IDENTITY=Object.freeze(new Da);let ia=Da;const wa=new ia,An=1e-6,Qt=2*Math.PI,dd={x:0,y:0},ao={x:0,y:0,z:0};class oo{constructor(){this.equalPointTol=An,this.equalVectorTol=An}equalPoint2d(t,e){return new te(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new q(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=An){return t<e&&t>-e}static equal(t,e,i=An){return Math.abs(t-e)<i}static great(t,e,i=An){return t-e>i}static less(t,e,i=An){return t-e<i}}const lo=new oo;function ho(n,t,e=!1){const i=n.x,a=n.y;let h=!1;const u=t.length;for(let p=0,y=u-1;p<u;y=p++){const f=t[p].x,x=t[p].y,b=t[y].x,E=t[y].y;let I=x>a!=E>a;e&&(I=x>=a!=E>=a),I&&i<(b-f)*(a-x)/(E-x)+f&&(h=!h)}return h}function Ah(n,t){if(n.length===0||t.length===0)return!1;const e=new ve().setFromPoints(n),i=new ve().setFromPoints(t);if(!e.intersectsBox(i))return!1;for(let a=0;a<n.length;){if(ho(n[a],t,!0))return!0;a<n.length-1&&lo.equalPoint2d(n[a+1],n[a])&&++a,++a}return!1}const Eh={isPointInPolygon:ho,isPolygonIntersect:Ah};function kh(n,t){const e=[],i=t-1,a=n;for(let h=0;h<=a;h++)e.push(0);for(let h=1;h<=i-a;h++)e.push(h);for(let h=0;h<=a;h++)e.push(i-a+1);return e}function Th(n,t){const e=t.length-1,i=n,a=[0];let h=0;for(let p=1;p<=e;p++){const y=t[p][0]-t[p-1][0],f=t[p][1]-t[p-1][1],x=t[p][2]-t[p-1][2],b=Math.sqrt(y*y+f*f+x*x);h+=b,a.push(h)}const u=[];for(let p=0;p<=i;p++)u.push(0);for(let p=1;p<=e-i;p++){const y=a[p]/h;u.push(y*(e-i+1))}for(let p=0;p<=i;p++)u.push(e-i+1);return u}function Mh(n,t){const e=t.length-1,i=n,a=[0];let h=0;for(let p=1;p<=e;p++){const y=t[p][0]-t[p-1][0],f=t[p][1]-t[p-1][1],x=t[p][2]-t[p-1][2],b=Math.sqrt(y*y+f*f+x*x),E=Math.sqrt(b);h+=E,a.push(h)}const u=[];for(let p=0;p<=i;p++)u.push(0);for(let p=1;p<=e-i;p++){const y=a[p]/h;u.push(y*(e-i+1))}for(let p=0;p<=i;p++)u.push(e-i+1);return u}function Ts(n,t,e,i){if(t===0)return e>=i[n]&&e<i[n+1]?1:0;const a=i[n+t]-i[n],h=i[n+t+1]-i[n+1],u=a>1e-10?(e-i[n])/a:0,p=h>1e-10?(i[n+t+1]-e)/h:0;return u*Ts(n,t-1,e,i)+p*Ts(n+1,t-1,e,i)}function $i(n,t,e,i,a){const h=i.length-1,u=t;if(n=Math.max(e[u],Math.min(e[h+1],n)),Math.abs(n-e[h+1])<1e-8)return[...i[h]];if(Math.abs(n-e[u])<1e-8)return[...i[0]];const p=[0,0,0];let y=0;for(let f=0;f<=h;f++){const x=Ts(f,u,n,e),b=a[f]*x;p[0]+=i[f][0]*b,p[1]+=i[f][1]*b,p[2]+=i[f][2]*b,y+=b}if(y<1e-10){const f=e[e.length-u-1];if(Math.abs(n-f)<1e-8)return[...i[h]];if(Math.abs(n-e[u])<1e-8)return[...i[0]]}return y>1e-10&&(p[0]/=y,p[1]/=y,p[2]/=y),p}function Nh(n,t,e,i){const a=n,h=t[a],u=t[t.length-a-1];let p=0;const y=1e3,f=(u-h)/y;let x=$i(h,n,t,e,i);for(let O=1;O<=y;O++){const V=h+O*f,z=$i(V,n,t,e,i),it=z[0]-x[0],_t=z[1]-x[1],st=z[2]-x[2];p+=Math.sqrt(it*it+_t*_t+st*st),x=z}const b=$i(u,n,t,e,i),E=b[0]-x[0],I=b[1]-x[1],L=b[2]-x[2];return p+=Math.sqrt(E*E+I*I+L*L),p}function pd(n){return n.map(t=>[...t])}class On{constructor(t=0,e=0,i=0,a=1){this._x=t,this._y=e,this._z=i,this._w=a}static slerpFlat(t,e,i,a,h,u,p){let y=i[a+0],f=i[a+1],x=i[a+2],b=i[a+3];const E=h[u+0],I=h[u+1],L=h[u+2],O=h[u+3];if(p===0){t[e+0]=y,t[e+1]=f,t[e+2]=x,t[e+3]=b;return}if(p===1){t[e+0]=E,t[e+1]=I,t[e+2]=L,t[e+3]=O;return}if(b!==O||y!==E||f!==I||x!==L){let V=1-p;const z=y*E+f*I+x*L+b*O,it=z>=0?1:-1,_t=1-z*z;if(_t>Number.EPSILON){const H=Math.sqrt(_t),dt=Math.atan2(H,z*it);V=Math.sin(V*dt)/H,p=Math.sin(p*dt)/H}const st=p*it;if(y=y*V+E*st,f=f*V+I*st,x=x*V+L*st,b=b*V+O*st,V===1-p){const H=1/Math.sqrt(y*y+f*f+x*x+b*b);y*=H,f*=H,x*=H,b*=H}}t[e]=y,t[e+1]=f,t[e+2]=x,t[e+3]=b}static multiplyQuaternionsFlat(t,e,i,a,h,u){const p=i[a],y=i[a+1],f=i[a+2],x=i[a+3],b=h[u],E=h[u+1],I=h[u+2],L=h[u+3];return t[e]=p*L+x*b+y*I-f*E,t[e+1]=y*L+x*E+f*b-p*I,t[e+2]=f*L+x*I+p*E-y*b,t[e+3]=x*L-p*b-y*E-f*I,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,a){return this._x=t,this._y=e,this._z=i,this._w=a,this._onChangeCallback(),this}clone(){return new On(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t.x,a=t.y,h=t.z,u=t.order,p=Math.cos,y=Math.sin,f=p(i/2),x=p(a/2),b=p(h/2),E=y(i/2),I=y(a/2),L=y(h/2);switch(u){case"XYZ":this._x=E*x*b+f*I*L,this._y=f*I*b-E*x*L,this._z=f*x*L+E*I*b,this._w=f*x*b-E*I*L;break;case"YXZ":this._x=E*x*b+f*I*L,this._y=f*I*b-E*x*L,this._z=f*x*L-E*I*b,this._w=f*x*b+E*I*L;break;case"ZXY":this._x=E*x*b-f*I*L,this._y=f*I*b+E*x*L,this._z=f*x*L+E*I*b,this._w=f*x*b-E*I*L;break;case"ZYX":this._x=E*x*b-f*I*L,this._y=f*I*b+E*x*L,this._z=f*x*L-E*I*b,this._w=f*x*b+E*I*L;break;case"YZX":this._x=E*x*b+f*I*L,this._y=f*I*b+E*x*L,this._z=f*x*L-E*I*b,this._w=f*x*b-E*I*L;break;case"XZY":this._x=E*x*b-f*I*L,this._y=f*I*b-E*x*L,this._z=f*x*L+E*I*b,this._w=f*x*b+E*I*L;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+u)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,a=Math.sin(i);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],a=e[4],h=e[8],u=e[1],p=e[5],y=e[9],f=e[2],x=e[6],b=e[10],E=i+p+b;if(E>0){const I=.5/Math.sqrt(E+1);this._w=.25/I,this._x=(x-y)*I,this._y=(h-f)*I,this._z=(u-a)*I}else if(i>p&&i>b){const I=2*Math.sqrt(1+i-p-b);this._w=(x-y)/I,this._x=.25*I,this._y=(a+u)/I,this._z=(h+f)/I}else if(p>b){const I=2*Math.sqrt(1+p-i-b);this._w=(h-f)/I,this._x=(a+u)/I,this._y=.25*I,this._z=(y+x)/I}else{const I=2*Math.sqrt(1+b-i-p);this._w=(u-a)/I,this._x=(h+f)/I,this._y=(y+x)/I,this._z=.25*I}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(jr(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const a=Math.min(1,e/i);return this.slerp(t,a),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,a=t._y,h=t._z,u=t._w,p=e._x,y=e._y,f=e._z,x=e._w;return this._x=i*x+u*p+a*f-h*y,this._y=a*x+u*y+h*p-i*f,this._z=h*x+u*f+i*y-a*p,this._w=u*x-i*p-a*y-h*f,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const i=this._x,a=this._y,h=this._z,u=this._w;let p=u*t._w+i*t._x+a*t._y+h*t._z;if(p<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,p=-p):this.copy(t),p>=1)return this._w=u,this._x=i,this._y=a,this._z=h,this;const y=1-p*p;if(y<=Number.EPSILON){const I=1-e;return this._w=I*u+e*this._w,this._x=I*i+e*this._x,this._y=I*a+e*this._y,this._z=I*h+e*this._z,this.normalize(),this}const f=Math.sqrt(y),x=Math.atan2(f,p),b=Math.sin((1-e)*x)/f,E=Math.sin(e*x)/f;return this._w=u*b+this._w*E,this._x=i*b+this._x*E,this._y=a*b+this._y*E,this._z=h*b+this._z*E,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),a=Math.sqrt(1-i),h=Math.sqrt(i);return this.set(a*Math.sin(t),a*Math.cos(t),h*Math.sin(e),h*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const Me=class Lh{constructor(t,e,i){this.x=0,this.y=0,this.z=0;const a=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(a!==0){if(a===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(a===1){const{x:h,y:u,z:p}=t;this.x=h,this.y=u,this.z=p||0;return}if(a===3){this.x=t,this.y=e,this.z=i;return}throw Ze.ILLEGAL_PARAMETERS}}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new Lh(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(kl.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(kl.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,a=this.z,h=t.elements;return this.x=h[0]*e+h[3]*i+h[6]*a,this.y=h[1]*e+h[4]*i+h[7]*a,this.z=h[2]*e+h[5]*i+h[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,a=this.z,h=t.elements,u=1/(h[3]*e+h[7]*i+h[11]*a+h[15]);return this.x=(h[0]*e+h[4]*i+h[8]*a+h[12])*u,this.y=(h[1]*e+h[5]*i+h[9]*a+h[13])*u,this.z=(h[2]*e+h[6]*i+h[10]*a+h[14])*u,this}applyQuaternion(t){const e=this.x,i=this.y,a=this.z,h=t.x,u=t.y,p=t.z,y=t.w,f=2*(u*a-p*i),x=2*(p*e-h*a),b=2*(h*i-u*e);return this.x=e+y*f+u*b-p*x,this.y=i+y*x+p*f-h*b,this.z=a+y*b+h*x-u*f,this}transformDirection(t){const e=this.x,i=this.y,a=this.z,h=t.elements;return this.x=h[0]*e+h[4]*i+h[8]*a,this.y=h[1]*e+h[5]*i+h[9]*a,this.z=h[2]*e+h[6]*i+h[10]*a,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),i=this.length(),a=t.length();return Math.abs(e)===i*a}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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,a=t.y,h=t.z,u=e.x,p=e.y,y=e.z;return this.x=a*y-h*p,this.y=h*u-i*y,this.z=i*p-a*u,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ba.copy(this).projectOnVector(t),this.sub(ba)}reflect(t){return this.sub(ba.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,a=this.z-t.z;return e*e+i*i+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=a,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};Me.ORIGIN=Object.freeze(new Me(0,0,0)),Me.X_AXIS=Object.freeze(new Me(1,0,0)),Me.NEGATIVE_X_AXIS=Object.freeze(new Me(-1,0,0)),Me.Y_AXIS=Object.freeze(new Me(0,1,0)),Me.NEGATIVE_Y_AXIS=Object.freeze(new Me(0,-1,0)),Me.Z_AXIS=Object.freeze(new Me(0,0,1)),Me.NEGATIVE_Z_AXIS=Object.freeze(new Me(0,0,-1));let q=Me;const ba=new q,kl=new On,ja=class Oh{constructor(t,e,i,a,h,u,p,y,f,x,b,E,I,L,O,V){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&a!=null&&h!=null&&u!=null&&p!=null&&y!=null&&f!=null&&x!=null&&b!=null&&E!=null&&I!=null&&L!=null&&O!=null&&V!=null&&this.set(t,e,i,a,h,u,p,y,f,x,b,E,I,L,O,V)}set(t,e,i,a,h,u,p,y,f,x,b,E,I,L,O,V){const z=this.elements;return z[0]=t,z[4]=e,z[8]=i,z[12]=a,z[1]=h,z[5]=u,z[9]=p,z[13]=y,z[2]=f,z[6]=x,z[10]=b,z[14]=E,z[3]=I,z[7]=L,z[11]=O,z[15]=V,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 Oh().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(lo.equalPoint3d(t,q.Z_AXIS))this.identity();else{const e=new q(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(q.Y_AXIS,t).normalize():e.crossVectors(q.Z_AXIS,t).normalize();const i=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,i.x,i.y,i.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,a=1/Yn.setFromMatrixColumn(t,0).length(),h=1/Yn.setFromMatrixColumn(t,1).length(),u=1/Yn.setFromMatrixColumn(t,2).length();return e[0]=i[0]*a,e[1]=i[1]*a,e[2]=i[2]*a,e[3]=0,e[4]=i[4]*h,e[5]=i[5]*h,e[6]=i[6]*h,e[7]=0,e[8]=i[8]*u,e[9]=i[9]*u,e[10]=i[10]*u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(gd,t,md)}lookAt(t,e,i){const a=this.elements;return We.subVectors(t,e),We.lengthSq()===0&&(We.z=1),We.normalize(),nn.crossVectors(i,We),nn.lengthSq()===0&&(Math.abs(i.z)===1?We.x+=1e-4:We.z+=1e-4,We.normalize(),nn.crossVectors(i,We)),nn.normalize(),ms.crossVectors(We,nn),a[0]=nn.x,a[4]=ms.x,a[8]=We.x,a[1]=nn.y,a[5]=ms.y,a[9]=We.y,a[2]=nn.z,a[6]=ms.z,a[10]=We.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,a=e.elements,h=this.elements,u=i[0],p=i[4],y=i[8],f=i[12],x=i[1],b=i[5],E=i[9],I=i[13],L=i[2],O=i[6],V=i[10],z=i[14],it=i[3],_t=i[7],st=i[11],H=i[15],dt=a[0],at=a[4],Gt=a[8],$t=a[12],Yt=a[1],xt=a[5],Bt=a[9],we=a[13],be=a[2],ze=a[6],ie=a[10],pe=a[14],Q=a[3],Lt=a[7],ge=a[11],br=a[15];return h[0]=u*dt+p*Yt+y*be+f*Q,h[4]=u*at+p*xt+y*ze+f*Lt,h[8]=u*Gt+p*Bt+y*ie+f*ge,h[12]=u*$t+p*we+y*pe+f*br,h[1]=x*dt+b*Yt+E*be+I*Q,h[5]=x*at+b*xt+E*ze+I*Lt,h[9]=x*Gt+b*Bt+E*ie+I*ge,h[13]=x*$t+b*we+E*pe+I*br,h[2]=L*dt+O*Yt+V*be+z*Q,h[6]=L*at+O*xt+V*ze+z*Lt,h[10]=L*Gt+O*Bt+V*ie+z*ge,h[14]=L*$t+O*we+V*pe+z*br,h[3]=it*dt+_t*Yt+st*be+H*Q,h[7]=it*at+_t*xt+st*ze+H*Lt,h[11]=it*Gt+_t*Bt+st*ie+H*ge,h[15]=it*$t+_t*we+st*pe+H*br,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],a=t[8],h=t[12],u=t[1],p=t[5],y=t[9],f=t[13],x=t[2],b=t[6],E=t[10],I=t[14],L=t[3],O=t[7],V=t[11],z=t[15];return L*(+h*y*b-a*f*b-h*p*E+i*f*E+a*p*I-i*y*I)+O*(+e*y*I-e*f*E+h*u*E-a*u*I+a*f*x-h*y*x)+V*(+e*f*b-e*p*I-h*u*b+i*u*I+h*p*x-i*f*x)+z*(-a*p*x-e*y*b+e*p*E+a*u*b-i*u*E+i*y*x)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const a=this.elements;return t instanceof q?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],a=t[2],h=t[3],u=t[4],p=t[5],y=t[6],f=t[7],x=t[8],b=t[9],E=t[10],I=t[11],L=t[12],O=t[13],V=t[14],z=t[15],it=b*V*f-O*E*f+O*y*I-p*V*I-b*y*z+p*E*z,_t=L*E*f-x*V*f-L*y*I+u*V*I+x*y*z-u*E*z,st=x*O*f-L*b*f+L*p*I-u*O*I-x*p*z+u*b*z,H=L*b*y-x*O*y-L*p*E+u*O*E+x*p*V-u*b*V,dt=e*it+i*_t+a*st+h*H;if(dt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const at=1/dt;return t[0]=it*at,t[1]=(O*E*h-b*V*h-O*a*I+i*V*I+b*a*z-i*E*z)*at,t[2]=(p*V*h-O*y*h+O*a*f-i*V*f-p*a*z+i*y*z)*at,t[3]=(b*y*h-p*E*h-b*a*f+i*E*f+p*a*I-i*y*I)*at,t[4]=_t*at,t[5]=(x*V*h-L*E*h+L*a*I-e*V*I-x*a*z+e*E*z)*at,t[6]=(L*y*h-u*V*h-L*a*f+e*V*f+u*a*z-e*y*z)*at,t[7]=(u*E*h-x*y*h+x*a*f-e*E*f-u*a*I+e*y*I)*at,t[8]=st*at,t[9]=(L*b*h-x*O*h-L*i*I+e*O*I+x*i*z-e*b*z)*at,t[10]=(u*O*h-L*p*h+L*i*f-e*O*f-u*i*z+e*p*z)*at,t[11]=(x*p*h-u*b*h-x*i*f+e*b*f+u*i*I-e*p*I)*at,t[12]=H*at,t[13]=(x*O*a-L*b*a+L*i*E-e*O*E-x*i*V+e*b*V)*at,t[14]=(L*p*a-u*O*a-L*i*y+e*O*y+u*i*V-e*p*V)*at,t[15]=(u*b*a-x*p*a+x*i*y-e*b*y-u*i*E+e*p*E)*at,this}scale(t){const e=this.elements,i=t.x,a=t.y,h=t.z;return e[0]*=i,e[4]*=a,e[8]*=h,e[1]*=i,e[5]*=a,e[9]*=h,e[2]*=i,e[6]*=a,e[10]*=h,e[3]*=i,e[7]*=a,e[11]*=h,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,a))}makeTranslation(t,e,i){return t instanceof q?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),a=Math.sin(e),h=1-i,u=t.x,p=t.y,y=t.z,f=h*u,x=h*p;return this.set(f*u+i,f*p-a*y,f*y+a*p,0,f*p+a*y,x*p+i,x*y-a*u,0,f*y-a*p,x*y+a*u,h*y*y+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,a,h,u){return this.set(1,i,h,0,t,1,u,0,e,a,1,0,0,0,0,1),this}compose(t,e,i){const a=this.elements,h=e.x,u=e.y,p=e.z,y=e.w,f=h+h,x=u+u,b=p+p,E=h*f,I=h*x,L=h*b,O=u*x,V=u*b,z=p*b,it=y*f,_t=y*x,st=y*b,H=i.x,dt=i.y,at=i.z;return a[0]=(1-(O+z))*H,a[1]=(I+st)*H,a[2]=(L-_t)*H,a[3]=0,a[4]=(I-st)*dt,a[5]=(1-(E+z))*dt,a[6]=(V+it)*dt,a[7]=0,a[8]=(L+_t)*at,a[9]=(V-it)*at,a[10]=(1-(E+O))*at,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,i){const a=this.elements;let h=Yn.set(a[0],a[1],a[2]).length();const u=Yn.set(a[4],a[5],a[6]).length(),p=Yn.set(a[8],a[9],a[10]).length();this.determinant()<0&&(h=-h),t.x=a[12],t.y=a[13],t.z=a[14],hr.copy(this);const y=1/h,f=1/u,x=1/p;return hr.elements[0]*=y,hr.elements[1]*=y,hr.elements[2]*=y,hr.elements[4]*=f,hr.elements[5]*=f,hr.elements[6]*=f,hr.elements[8]*=x,hr.elements[9]*=x,hr.elements[10]*=x,e.setFromRotationMatrix(hr),i.x=h,i.y=u,i.z=p,this}equals(t){const e=this.elements,i=t.elements;for(let a=0;a<16;a++)if(e[a]!==i[a])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};ja.IDENTITY=Object.freeze(new ja);let $e=ja;const Yn=new q,hr=new $e,gd=new q(0,0,0),md=new q(1,1,1),nn=new q,ms=new q,We=new q;class Nt{constructor(t=void 0,e=void 0){this.min=t==null?new q(1/0,1/0,1/0):new q(t.x,t.y,t.z),this.max=e==null?new q(-1/0,-1/0,-1/0):new q(e.x,e.y,e.z)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(xa.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=xa.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new Nt().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new q(0,0,0):new q(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new q(0,0,0):new q(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,xa).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Ar[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ar[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ar[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ar[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ar[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ar[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ar[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ar[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ar),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ar=[new q,new q,new q,new q,new q,new q,new q,new q],xa=new q,Tl=new te;class ve{constructor(t=void 0,e=void 0){this.min=t==null?new te(1/0,1/0):new te(t.x,t.y),this.max=e==null?new te(-1/0,-1/0):new te(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Tl.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new ve().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new te(0,0):new te(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new te(0,0):new te(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Tl).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ml=new q,_d=new q,fd=new ia;class as{constructor(t=new q(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,a){return this.normal.set(t,e,i),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const a=Ml.subVectors(i,e).cross(_d.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||fd.getNormalMatrix(t),a=this.coplanarPoint(Ml).applyMatrix4(t),h=this.normal.applyMatrix3(i).normalize();return this.constant=-a.dot(h),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new as().copy(this)}}class Et extends te{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((i,a)=>{i.toArray(e,a*2)}),e}}class W extends q{static pointArrayToNumberArray(t,e=!0){const i=e?3:2,a=new Array(t.length*i);return t.forEach((h,u)=>{h.toArray(a,u*i)}),a}}const Nl=new $e,Ll=new On,Ch=class Ua{constructor(t=0,e=0,i=0,a=Ua.DEFAULT_ORDER){this._x=t,this._y=e,this._z=i,this._order=a}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,a=this._order){return this._x=t,this._y=e,this._z=i,this._order=a,this._onChangeCallback(),this}clone(){return new Ua(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const a=t.elements,h=a[0],u=a[4],p=a[8],y=a[1],f=a[5],x=a[9],b=a[2],E=a[6],I=a[10];switch(e){case"XYZ":this._y=Math.asin(jr(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-x,I),this._z=Math.atan2(-u,h)):(this._x=Math.atan2(E,f),this._z=0);break;case"YXZ":this._x=Math.asin(-jr(x,-1,1)),Math.abs(x)<.9999999?(this._y=Math.atan2(p,I),this._z=Math.atan2(y,f)):(this._y=Math.atan2(-b,h),this._z=0);break;case"ZXY":this._x=Math.asin(jr(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(-b,I),this._z=Math.atan2(-u,f)):(this._y=0,this._z=Math.atan2(y,h));break;case"ZYX":this._y=Math.asin(-jr(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(E,I),this._z=Math.atan2(y,h)):(this._x=0,this._z=Math.atan2(-u,f));break;case"YZX":this._z=Math.asin(jr(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(-x,f),this._y=Math.atan2(-b,h)):(this._x=0,this._y=Math.atan2(p,I));break;case"XZY":this._z=Math.asin(-jr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(E,f),this._y=Math.atan2(p,h)):(this._x=Math.atan2(-x,I),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i=!0){return Nl.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Nl,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ll.setFromEuler(this),this.setFromQuaternion(Ll,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ch.DEFAULT_ORDER="XYZ";let yd=Ch;class Bh{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}let uo=class extends Bh{translate(t){return this.transform(new ia().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}};class sa extends uo{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new ve}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let i=0;i<this.loops.length;++i){const a=this.loops[i].getPoints(t);e.push(a)}return e}buildHierarchy(){var t;const e=this.getPoints(100),i=this.calculateBoundaryBoxes(e),a=this.sortBoundaryBoxesByAreas(i),h=new Map,u=a.length;for(let y=0;y<u;y++)h.set(a[y],{index:a[y],children:[]});const p={index:-1,children:[]};for(let y=0;y<u;y++){const f=a[y],x=e[f],b=i[f];let E=y+1;for(;E<u;E++){const I=a[E],L=e[I];if(i[I].containsBox(b)&&Eh.isPointInPolygon(x[St.randInt(0,x.length-1)],L)){(t=h.get(I))==null||t.children.push(h.get(f));break}}E===u&&p.children.push(h.get(f))}return p}get area(){if(this._loops.length===0)return 0;let t=0;for(let e=0;e<this._loops.length;e++){const i=this._loops[e].getPoints(128),a=this.polygonArea(i);e===0?t+=Math.abs(a):t-=Math.abs(a)}return t}polygonArea(t){const e=t.length;if(e<3)return 0;let i=0;for(let a=0,h=e-1;a<e;h=a++){const u=t[h],p=t[a];i+=u.x*p.y-p.x*u.y}return i*.5}calculateBoundaryBoxes(t){const e=[];return t.forEach(i=>{e.push(new ve().setFromPoints(i))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((a,h)=>{const u=a.size,p=u.width*u.height;e.push({area:p,index:h})}),e.sort((a,h)=>a.area-h.area);const i=[];return e.forEach(a=>{i.push(a.index)}),i}}class ai extends uo{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let i,a=this.getPoint(0),h=0;e.push(0);for(let u=1;u<=t;u++)i=this.getPoint(u/t),h+=i.distanceTo(a),e.push(h),a=i;return e}getUtoTmapping(t,e){const i=this.getLengths();let a=0;const h=i.length;let u;e?u=e:u=t*i[h-1];let p=0,y=h-1,f;for(;p<=y;)if(a=Math.floor(p+(y-p)/2),f=i[a]-u,f<0)p=a+1;else if(f>0)y=a-1;else{y=a;break}if(a=y,i[a]===u)return a/(h-1);const x=i[a],b=i[a+1]-x,E=(u-x)/b;return(a+E)/(h-1)}getTangent(t){let e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);const a=this.getPoint(e),h=this.getPoint(i),u=new Et;return u.copy(h).sub(a).normalize(),u}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}class Mn extends ai{constructor(t,e,i,a,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(a!==void 0)+ +(h!==void 0);if(u==3)typeof t=="object"&&typeof e=="object"&&typeof i=="object"?this.createByThreePoints(t,e,i):this.createByStartEndPointsAndBulge(t,e,i);else if(u==5){const p=t;this.center=new Et(p.x,p.y),this.radius=e,this._clockwise=h,this._startAngle=this._clockwise?this._mirrorAngle(St.normalizeAngle(i)):St.normalizeAngle(i),this._endAngle=this._clockwise?this._mirrorAngle(St.normalizeAngle(a)):St.normalizeAngle(a)}else throw Ze.ILLEGAL_PARAMETERS}createByThreePoints(t,e,i){const a=(at,Gt)=>({x:(at.x+Gt.x)/2,y:(at.y+Gt.y)/2}),h=(at,Gt)=>(Gt.y-at.y)/(Gt.x-at.x),u=at=>-1/at,p=a(t,e),y=a(e,i),f=h(t,e),x=h(e,i),b=u(f),E=u(x),I=(at,Gt,$t,Yt)=>{const xt=(Yt-Gt)/(at-$t),Bt=at*xt+Gt;return{x:xt,y:Bt}},L=p.y-b*p.x,O=y.y-E*y.x,V=I(b,L,E,O),z=Math.sqrt(Math.pow(t.x-V.x,2)+Math.pow(t.y-V.y,2)),it=(at,Gt)=>Math.atan2(at.y-Gt.y,at.x-Gt.x),_t=it(t,V),st=it(e,V),H=it(i,V),dt=H>_t&&H<st||_t>H&&_t<st||st>H&&st<_t;this.center=V,this.radius=z,this._clockwise=!dt,this._startAngle=_t,this._endAngle=H}createByStartEndPointsAndBulge(t,e,i){let a,h,u;i<0?(a=Math.atan(-i)*4,h=new te(t),u=new te(e)):(a=Math.atan(i)*4,h=new te(e),u=new te(t));const p=new te().subVectors(u,h),y=p.length(),f=new te().addVectors(h,p.multiplyScalar(.5)),x=Math.abs(y/2/Math.tan(a/2)),b=p.normalize();let E;if(a<Math.PI){const I=new te(b.x*Math.cos(Math.PI/2)-b.y*Math.sin(Math.PI/2),b.y*Math.cos(Math.PI/2)+b.x*Math.sin(Math.PI/2));E=f.add(I.multiplyScalar(-x))}else{const I=new te(b.x*Math.cos(Math.PI/2)-b.y*Math.sin(Math.PI/2),b.y*Math.cos(Math.PI/2)+b.x*Math.sin(Math.PI/2));E=f.add(I.multiplyScalar(x))}i<0?(this._startAngle=Math.atan2(h.y-E.y,h.x-E.x),this._endAngle=Math.atan2(u.y-E.y,u.x-E.x)):(this._startAngle=Math.atan2(u.y-E.y,u.x-E.x),this._endAngle=Math.atan2(h.y-E.y,h.x-E.x)),this._clockwise=i<0,this.center=E,this.radius=u.sub(E).length()}get center(){return this._center}set center(t){this._center=new Et(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(St.normalizeAngle(t)):St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const e=this.startAngle==0&&t==Qt?t:St.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(e):e,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return this.clockwise?St.normalizeAngle(t-e):St.normalizeAngle(e-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle),i=St.normalizeAngle((t+e)/2),a=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(a)}get closed(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return Math.abs(e-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const h of e){const u=this._getInternalAngle(h);St.isBetweenAngle(u,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(h))}const i=t.map(h=>h.x),a=t.map(h=>h.y);return new ve(new Et(Math.min(...i),Math.min(...a)),new Et(Math.max(...i),Math.max(...a)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new Mn(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const e=this._getInternalAngle(t),i=this.center.x+this.radius*Math.cos(e),a=this.center.y+this.radius*Math.sin(e);return new Et(i,a)}getPoints(t=100){const e=[];let i=this.deltaAngle,a=this._getInternalAngle(this.startAngle);if(this.closed&&(i=Qt,a=0),this.clockwise)for(let h=0;h<=t;h++){const u=a-i*(h/t),p=this._clockwise?this._mirrorAngle(u):u,y=this.getPointAtAngle(p);e.push(new Et(y.x,y.y))}else for(let h=0;h<=t;h++){const u=a+i*(h/t),p=this._clockwise?this._mirrorAngle(u):u,y=this.getPointAtAngle(p);e.push(new Et(y.x,y.y))}return e}}class vd extends Bh{translate(t){return this.transform(new $e().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class os extends vd{}let ri=class Rh extends os{constructor(t,e){super(),this._start=new W(t),this._end=new W(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new q().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)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const i=this.delta(fn).normalize();return new W(this._start).addScaledVector(i,t)}else{const i=this.delta(fn).normalize();return new W(this._end).addScaledVector(i,t)}}extend(t,e=!1){if(e){const i=fn.subVectors(this._start,this._end).normalize();this._start=new W(this._start).addScaledVector(i,t)}else{const i=this.delta(fn).normalize();this._end=new W(this._end).addScaledVector(i,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){Ol.subVectors(t,this._start),_s.subVectors(this.endPoint,this.startPoint);const i=_s.dot(_s);let a=_s.dot(Ol)/i;return e&&(a=St.clamp(a,0,1)),a}closestPointToPoint(t,e,i){const a=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(a).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,i=fn.subVectors(t,this.startPoint).dot(e);return new W().copy(e).multiplyScalar(i).add(this.startPoint)}perpPoint(t){const e=this.direction,i=this.startPoint,a=fn.subVectors(t,i).dot(e),h=fn.copy(e).multiplyScalar(a);return new W().addVectors(i,h)}calculateBoundingBox(){const t=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)),e=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 Nt(t,e)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Rh(this._start.clone(),this._end.clone())}};const fn=new q,Ol=new q,_s=new q;let co=class bs extends os{static computeCenterPoint(t,e,i){const a=new q().addVectors(t,e).multiplyScalar(.5),h=new q().addVectors(t,i).multiplyScalar(.5),u=new q().subVectors(e,t),p=new q().subVectors(i,t),y=new q().crossVectors(u,p).normalize();if(y.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const f=new q().crossVectors(u,y).normalize(),x=new q().crossVectors(p,y).normalize(),b=f.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),E=x.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),I=new ri(a,a.clone().add(b)),L=new ri(h,h.clone().add(E)),O=new q;return I.closestPointToPoint(L.startPoint,!0,O)?O:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,i){const a=bs.computeCenterPoint(t,e,i);if(a){const h=a.distanceTo(t),u=new q().subVectors(t,a),p=new q().subVectors(e,a),y=Math.atan2(u.y,u.x),f=Math.atan2(p.y,p.x);return new bs(a,h,y,f,q.Z_AXIS)}}constructor(t,e,i,a,h,u=q.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=i,this.endAngle=a,this.normal=h,this.refVec=u,(a-i)%Qt==0?(this.startAngle=0,this.endAngle=Qt):(this.startAngle=i,this.endAngle=a)}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw Ze.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Qt?t:St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return St.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(t){this._normal=new q(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new q(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;this.closed&&(t=0,e=Qt);const i=t+e*.5;return this.getPointAtAngle(i)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const e=new q(t.x,t.y,t.z||0),i=this.center,a=this.normal,h=e.clone().sub(i).dot(a),u=e.clone().sub(a.clone().multiplyScalar(h)).clone().sub(i);if(u.lengthSq()===0)return this.startPoint.clone();u.normalize().multiplyScalar(this.radius);const p=i.clone().add(u),y=this.getAngle(p.clone()),f=this.startAngle,x=this.deltaAngle;let b=St.normalizeAngle(y-f);b<0&&(b=0),b>x&&(b=x);const E=this.getPointAtAngle(f+b),I=E.distanceTo(e),L=this.startPoint.distanceTo(e),O=this.endPoint.distanceTo(e);return L<I&&L<=O?this.startPoint.clone():O<I&&O<L?this.endPoint.clone():E}tangentPoints(t){const e=[],i=new q(t.x,t.y,t.z||0),a=this.center,h=this.normal,u=this.radius,p=i.clone().sub(a).dot(h),y=i.clone().sub(h.clone().multiplyScalar(p)),f=a.clone(),x=y.clone().sub(f).length();if(x<u)return e;const b=Math.acos(u/x),E=this.getAngle(y.clone()),I=[E+b,E-b];for(const L of I){const O=St.normalizeAngle(L-this.startAngle);O>=0&&O<=this.deltaAngle&&e.push(this.getPointAtAngle(this.startAngle+O))}return e}nearestTangentPoint(t){const e=this.tangentPoints(t);if(e.length===0)return null;const i=new W(t.x,t.y,t.z||0);return e.length===1||e[0].distanceTo(i)<e[1].distanceTo(i)?e[0]:e[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let y=0;y<2*Math.PI;y+=Math.PI/2)St.isBetweenAngle(y,this.startAngle,this.endAngle)&&t.push(y);let e=1/0,i=1/0,a=1/0,h=-1/0,u=-1/0,p=-1/0;for(const y of t){const f=this.getPointAtAngle(y);f.x<e&&(e=f.x),f.y<i&&(i=f.y),f.z<a&&(a=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>p&&(p=f.z)}return new Nt({x:e,y:i,z:a},{x:h,y:u,z:p})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let i=this.deltaAngle,a=this.startAngle;this.closed&&(i=Qt,a=0);for(let h=0;h<=t;h++){const u=a+i*(h/t),p=this.getPointAtAngle(u);e.push(p)}return e}transform(t){const e=Ia.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),i=Ia.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix4(t),e.applyMatrix4(t),i.applyMatrix4(t),this.normal.applyMatrix4(t).normalize(),this.refVec.applyMatrix4(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(i),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new bs(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(Ia.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,i=this.refVec,a={x:e.y*i.z-e.z*i.y,y:e.z*i.x-e.x*i.z,z:e.x*i.y-e.y*i.x},h=this.center,u=this.radius;return new W(h.x+u*(i.x*Math.cos(t)+a.x*Math.sin(t)),h.y+u*(i.y*Math.cos(t)+a.y*Math.sin(t)),h.z+u*(i.z*Math.cos(t)+a.z*Math.sin(t)))}get plane(){const t=new q(this.center).distanceTo(ao);return new as(this.normal,t)}};const Ia=new q;class ls extends ai{constructor(t,e,i,a=0,h=Qt,u=!1,p=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=i,(h-a)%Qt==0?(this.startAngle=0,this.endAngle=Qt):(this.startAngle=a,this.endAngle=h),this.clockwise=u,this.rotation=p}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Ze.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Ze.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Qt?t:St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return St.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,i=-1/0,a=-1/0;for(let h=0;h<=100;h++){const u=this.getPoint(h/100);t=Math.min(t,u.x),e=Math.min(e,u.y),i=Math.max(i,u.x),a=Math.max(a,u.y)}return new ve({x:t,y:e},{x:i,y:a})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let i=this.endAngle-this.startAngle;const a=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=e;for(;i>e;)i-=e;i<Number.EPSILON&&(a?i=0:i=e),this.clockwise===!0&&!a&&(i===e?i=-e:i=i-e);const h=this.startAngle+t*i;let u=this.center.x+this.majorAxisRadius*Math.cos(h),p=this.center.y+this.minorAxisRadius*Math.sin(h);if(this.rotation!==0){const y=Math.cos(this.rotation),f=Math.sin(this.rotation),x=u-this.center.x,b=p-this.center.y;u=x*y-b*f+this.center.x,p=x*f+b*y+this.center.y}return new Et(u,p)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new ls(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class aa extends os{constructor(t,e,i,a,h,u=0,p=Qt){super(),this.center=t,this.normal=e,this.majorAxis=i,this.majorAxisRadius=a,this.minorAxisRadius=h;const y=Math.abs(p-u);Math.abs(y-Qt)<1e-10||Math.abs(y-2*Qt)<1e-10?(this.startAngle=0,this.endAngle=Qt):(this.startAngle=u,this.endAngle=p)}get center(){return this._center}set center(t){this._center=new W(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw Ze.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw Ze.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==Qt?t:St.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-Qt)<1e-10?Qt:St.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new q(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new q(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new q().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;(this.closed||Math.abs(e-Qt)<1e-10)&&(t=0,e=Qt);const i=t+e/2;return this.getPointAtAngle(i)}get isCircular(){return oo.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let i=0,a=this.getPointAtAngle(this.startAngle);for(let h=1;h<=t;h++){const u=this.startAngle+h*e,p=this.getPointAtAngle(u),y=p.x-a.x,f=p.y-a.y,x=p.z-a.z;i+=Math.sqrt(y*y+f*f+x*x),a=p}return i}get area(){const t=this.majorAxisRadius,e=this.minorAxisRadius,i=this.startAngle,a=i+this.deltaAngle;if(Math.abs(this.deltaAngle-Qt)<1e-10)return Math.PI*t*e;const h=t*e/2*(a-i-(Math.sin(a)*Math.cos(a)-Math.sin(i)*Math.cos(i)));return Math.abs(h)}calculateBoundingBox(){if(this.majorAxis.equals(q.X_AXIS)||this.majorAxis.equals(q.Y_AXIS)||this.majorAxis.isParallelTo(q.X_AXIS)||this.majorAxis.isParallelTo(q.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let y=0;y<2*Math.PI;y+=Math.PI/2)St.isBetweenAngle(y,this.startAngle,this.endAngle)&&t.push(y);let e=1/0,i=1/0,a=1/0,h=-1/0,u=-1/0,p=-1/0;for(const y of t){const f=this.getPointAtAngle(y);f.x<e&&(e=f.x),f.y<i&&(i=f.y),f.z<a&&(a=f.z),f.x>h&&(h=f.x),f.y>u&&(u=f.y),f.z>p&&(p=f.z)}return new Nt({x:e,y:i,z:a},{x:h,y:u,z:p})}else{let t=1/0,e=1/0,i=1/0,a=-1/0,h=-1/0,u=-1/0;for(let p=0;p<=100;p++){const y=this.startAngle+this.deltaAngle*(p/100),f=this.getPointAtAngle(y);t=Math.min(t,f.x),e=Math.min(e,f.y),i=Math.min(i,f.z),a=Math.max(a,f.x),h=Math.max(h,f.y),u=Math.max(u,f.z)}return new Nt({x:t,y:e,z:i},{x:a,y:h,z:u})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let i=this.deltaAngle,a=this.startAngle;this.closed&&(i=Qt,a=0);for(let h=0;h<=t;h++){const u=a+i*(h/t),p=this.getPointAtAngle(u);e.push(p)}return e}getPointAtAngle(t){const e=Math.cos(t),i=Math.sin(t),a=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),h=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(a);return new W(this.center.x+h.x,this.center.y+h.y,this.center.z+h.z)}contains(t){const e=new q(t).sub(this.center),i=e.dot(this.majorAxis),a=e.dot(this.minorAxis),h=i/this.majorAxisRadius,u=a/this.minorAxisRadius;return h*h+u*u<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new aa(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new q(this.center).distanceTo(ao);return new as(this.normal,t)}}class un extends ai{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new Et(e.x,e.y)}else{const e=this._vertices[t-1];return new Et(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let i=0;i<e;++i){const a=this._vertices[i];let h=null;if(i<e-1?h=this._vertices[i+1]:i==e-1&&this.closed&&(h=this._vertices[0]),h)if(a.bulge){const u=new Mn(a,h,a.bulge);t+=u.length}else t+=new Et(a.x,a.y).distanceTo(h)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,e){t?e!==void 0&&e>=0&&e<this._vertices.length&&(this._vertices=this._vertices.slice(0,e),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const e=this._vertices[t];return new Et(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new ve().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const i=[];return this.getPoints(t).forEach(a=>i.push(new W().set(a.x,a.y,e))),i}getPoints(t){const e=[],i=this._vertices.length;for(let a=0;a<i;++a){const h=this._vertices[a];if(h.bulge){let u=null;if(a<i-1?u=this._vertices[a+1]:a==i-1&&this.closed&&(u=this._vertices[0]),u){const p=new Mn(h,u,h.bulge).getPoints(t),y=p.length;for(let f=0;f<y;++f){const x=p[f];e.push(new Et(x.x,x.y))}}}else e.push(new Et(h.x,h.y)),a==i-1&&this.closed&&e.push(e[0])}return e}}let ei=class Fh extends ai{constructor(t,e){super(),this._start=new Et(t),this._end=new Et(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new Et(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new Et(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new ve(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Fh(this._start.clone(),this._end.clone())}},oa=class extends ai{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new Et(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new ve;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(i=>{i.getPoints(t).forEach(a=>{e.push(new Et(a.x,a.y))})}),e}};function wd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var zh={exports:{}};(function(n,t){(function(e){n.exports=e()})(function(){var e={},i=this;new Function("try {return this===window;}catch(e){ return false;}");var a=new Function("try {return this===global;}catch(e){return false;}"),h=new Function("try {return typeof importScripts === 'function';}catch(e){return false;}");if(a()&&h(),a()||h()){var u=i;if(h()){var p=function(y,f){var x=i;return y.split(".").forEach(function(b){x&&(x=x[b])}),x?x[f]:null};onmessage=function(y){if(!(!y.data.className||!y.data.methodName)){var f=p(y.data.className,y.data.methodName);if(!f)return console.error("could not find "+y.data.className+"."+y.data.methodName);postMessage({result:f.apply(null,y.data.args),id:y.data.id})}}}}return function(y,f,x){f.geom=f.geom||{},f.exe=f.exe||{},f.eval=f.eval||{},f.core=f.core||{},f.promhx=f.promhx||{};var b={},E=function(){return Lt.__string_rec(this,"")};function I(r,s){function o(){}o.prototype=r;var l=new o;for(var c in s)l[c]=s[c];return s.toString!==Object.prototype.toString&&(l.toString=s.toString),l}var L=function(){};b.HxOverrides=L,L.__name__=["HxOverrides"],L.strDate=function(r){var s=r.length;switch(s){case 8:var o=r.split(":"),l=new Date;return l.setTime(0),l.setUTCHours(o[0]),l.setUTCMinutes(o[1]),l.setUTCSeconds(o[2]),l;case 10:var c=r.split("-");return new Date(c[0],c[1]-1,c[2],0,0,0);case 19:var d=r.split(" "),m=d[0].split("-"),_=d[1].split(":");return new Date(m[0],m[1]-1,m[2],_[0],_[1],_[2]);default:throw new Q("Invalid date format : "+r)}},L.cca=function(r,s){var o=r.charCodeAt(s);if(o==o)return o},L.substr=function(r,s,o){return s!=null&&s!=0&&o!=null&&o<0?"":(o==null&&(o=r.length),s<0?(s=r.length+s,s<0&&(s=0)):o<0&&(o=r.length+o-s),r.substr(s,o))},L.iter=function(r){return{cur:0,arr:r,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var O=function(){};b.Lambda=O,O.__name__=["Lambda"],O.fold=function(r,s,o){for(var l=ir(r)();l.hasNext();){var c=l.next();o=s(c,o)}return o};var V=function(){this.length=0};b.List=V,V.__name__=["List"],V.prototype={add:function(r){var s=[r];this.h==null?this.h=s:this.q[1]=s,this.q=s,this.length++},pop:function(){if(this.h==null)return null;var r=this.h[0];return this.h=this.h[1],this.h==null&&(this.q=null),this.length--,r},isEmpty:function(){return this.h==null},__class__:V},Math.__name__=["Math"];var z=function(){};b.Reflect=z,z.__name__=["Reflect"],z.field=function(r,s){try{return r[s]}catch(o){return o instanceof Q&&(o=o.val),null}},z.callMethod=function(r,s,o){return s.apply(r,o)},z.fields=function(r){var s=[];if(r!=null){var o=Object.prototype.hasOwnProperty;for(var l in r)l!="__id__"&&l!="hx__closures__"&&o.call(r,l)&&s.push(l)}return s},z.isFunction=function(r){return typeof r=="function"&&!(r.__name__||r.__ename__)},z.deleteField=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)?(delete r[s],!0):!1};var it=function(){};b.Std=it,it.__name__=["Std"],it.string=function(r){return Lt.__string_rec(r,"")},it.parseFloat=function(r){return parseFloat(r)};var _t=function(){this.b=""};b.StringBuf=_t,_t.__name__=["StringBuf"],_t.prototype={add:function(r){this.b+=it.string(r)},__class__:_t};var st=function(){};b.StringTools=st,st.__name__=["StringTools"],st.fastCodeAt=function(r,s){return r.charCodeAt(s)};var H=b.ValueType={__ename__:["ValueType"],__constructs__:["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]};H.TNull=["TNull",0],H.TNull.toString=E,H.TNull.__enum__=H,H.TInt=["TInt",1],H.TInt.toString=E,H.TInt.__enum__=H,H.TFloat=["TFloat",2],H.TFloat.toString=E,H.TFloat.__enum__=H,H.TBool=["TBool",3],H.TBool.toString=E,H.TBool.__enum__=H,H.TObject=["TObject",4],H.TObject.toString=E,H.TObject.__enum__=H,H.TFunction=["TFunction",5],H.TFunction.toString=E,H.TFunction.__enum__=H,H.TClass=function(r){var s=["TClass",6,r];return s.__enum__=H,s.toString=E,s},H.TEnum=function(r){var s=["TEnum",7,r];return s.__enum__=H,s.toString=E,s},H.TUnknown=["TUnknown",8],H.TUnknown.toString=E,H.TUnknown.__enum__=H;var dt=function(){};b.Type=dt,dt.__name__=["Type"],dt.getClassName=function(r){var s=r.__name__;return s==null?null:s.join(".")},dt.getEnumName=function(r){var s=r.__ename__;return s.join(".")},dt.resolveClass=function(r){var s=b[r];return s==null||!s.__name__?null:s},dt.resolveEnum=function(r){var s=b[r];return s==null||!s.__ename__?null:s},dt.createEmptyInstance=function(r){function s(){}return s.prototype=r.prototype,new s},dt.createEnum=function(r,s,o){var l=z.field(r,s);if(l==null)throw new Q("No such constructor "+s);if(z.isFunction(l)){if(o==null)throw new Q("Constructor "+s+" need parameters");return z.callMethod(r,l,o)}if(o!=null&&o.length!=0)throw new Q("Constructor "+s+" does not need parameters");return l},dt.getEnumConstructs=function(r){var s=r.__constructs__;return s.slice()},dt.typeof=function(r){var s=typeof r;switch(s){case"boolean":return H.TBool;case"string":return H.TClass(String);case"number":return Math.ceil(r)==r%2147483648?H.TInt:H.TFloat;case"object":if(r==null)return H.TNull;var o=r.__enum__;if(o!=null)return H.TEnum(o);var l=Lt.getClass(r);return l!=null?H.TClass(l):H.TObject;case"function":return r.__name__||r.__ename__?H.TObject:H.TFunction;case"undefined":return H.TNull;default:return H.TUnknown}};var at=function(){};b["haxe.IMap"]=at,at.__name__=["haxe","IMap"];var Gt=function(r,s){this.high=r,this.low=s};b["haxe._Int64.___Int64"]=Gt,Gt.__name__=["haxe","_Int64","___Int64"],Gt.prototype={__class__:Gt};var $t=function(){this.buf=new _t,this.cache=[],this.useCache=$t.USE_CACHE,this.useEnumIndex=$t.USE_ENUM_INDEX,this.shash=new be,this.scount=0};b["haxe.Serializer"]=$t,$t.__name__=["haxe","Serializer"],$t.prototype={toString:function(){return this.buf.b},serializeString:function(r){var s=this.shash.get(r);if(s!=null){this.buf.b+="R",s==null?this.buf.b+="null":this.buf.b+=""+s;return}this.shash.set(r,this.scount++),this.buf.b+="y",r=encodeURIComponent(r),r.length==null?this.buf.b+="null":this.buf.b+=""+r.length,this.buf.b+=":",r==null?this.buf.b+="null":this.buf.b+=""+r},serializeRef:function(r){for(var s=typeof r,o=0,l=this.cache.length;o<l;){var c=o++,d=this.cache[c];if(typeof d==s&&d==r)return this.buf.b+="r",c==null?this.buf.b+="null":this.buf.b+=""+c,!0}return this.cache.push(r),!1},serializeFields:function(r){for(var s=0,o=z.fields(r);s<o.length;){var l=o[s];++s,this.serializeString(l),this.serialize(z.field(r,l))}this.buf.b+="g"},serialize:function(r){{var s=dt.typeof(r);switch(s[1]){case 0:this.buf.b+="n";break;case 1:var o=r;if(o==0){this.buf.b+="z";return}this.buf.b+="i",o==null?this.buf.b+="null":this.buf.b+=""+o;break;case 2:var l=r;isNaN(l)?this.buf.b+="k":isFinite(l)?(this.buf.b+="d",l==null?this.buf.b+="null":this.buf.b+=""+l):l<0?this.buf.b+="m":this.buf.b+="p";break;case 3:r?this.buf.b+="t":this.buf.b+="f";break;case 6:var c=s[2];if(c==String){this.serializeString(r);return}if(this.useCache&&this.serializeRef(r))return;switch(c){case Array:var d=0;this.buf.b+="a";for(var m=r.length,_=0;_<m;){var v=_++;r[v]==null?d++:(d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d),d=0),this.serialize(r[v]))}d>0&&(d==1?this.buf.b+="n":(this.buf.b+="u",d==null?this.buf.b+="null":this.buf.b+=""+d)),this.buf.b+="h";break;case V:this.buf.b+="l";for(var S=r,A=S.h,P=null;A!=null;){var k;P=A[0],A=A[1],k=P,this.serialize(k)}this.buf.b+="h";break;case Date:var T=r;this.buf.b+="v",this.buf.add(T.getTime());break;case be:this.buf.b+="b";for(var M=r,B=M.keys();B.hasNext();){var C=B.next();this.serializeString(C),this.serialize(pa[C]!=null?M.getReserved(C):M.h[C])}this.buf.b+="h";break;case xt:this.buf.b+="q";for(var F=r,R=F.keys();R.hasNext();){var D=R.next();this.buf.b+=":",D==null?this.buf.b+="null":this.buf.b+=""+D,this.serialize(F.h[D])}this.buf.b+="h";break;case Bt:this.buf.b+="M";for(var j=r,Y=j.keys();Y.hasNext();){var J=Y.next(),X=z.field(J,"__id__");z.deleteField(J,"__id__"),this.serialize(J),J.__id__=X,this.serialize(j.h[J.__id__])}this.buf.b+="h";break;case ze:for(var U=r,$=0,tt=U.length-2,et=new _t,ot=$t.BASE64;$<tt;){var ct=U.get($++),ht=U.get($++),pt=U.get($++);et.add(ot.charAt(ct>>2)),et.add(ot.charAt((ct<<4|ht>>4)&63)),et.add(ot.charAt((ht<<2|pt>>6)&63)),et.add(ot.charAt(pt&63))}if($==tt){var nt=U.get($++),gt=U.get($++);et.add(ot.charAt(nt>>2)),et.add(ot.charAt((nt<<4|gt>>4)&63)),et.add(ot.charAt(gt<<2&63))}else if($==tt+1){var K=U.get($++);et.add(ot.charAt(K>>2)),et.add(ot.charAt(K<<4&63))}var ft=et.b;this.buf.b+="s",ft.length==null?this.buf.b+="null":this.buf.b+=""+ft.length,this.buf.b+=":",ft==null?this.buf.b+="null":this.buf.b+=""+ft;break;default:this.useCache&&this.cache.pop(),r.hxSerialize!=null?(this.buf.b+="C",this.serializeString(dt.getClassName(c)),this.useCache&&this.cache.push(r),r.hxSerialize(this),this.buf.b+="g"):(this.buf.b+="c",this.serializeString(dt.getClassName(c)),this.useCache&&this.cache.push(r),this.serializeFields(r))}break;case 4:if(Lt.__instanceof(r,hl)){var kt=dt.getClassName(r);this.buf.b+="A",this.serializeString(kt)}else if(Lt.__instanceof(r,ul))this.buf.b+="B",this.serializeString(dt.getEnumName(r));else{if(this.useCache&&this.serializeRef(r))return;this.buf.b+="o",this.serializeFields(r)}break;case 7:var Xt=s[2];if(this.useCache){if(this.serializeRef(r))return;this.cache.pop()}this.useEnumIndex?this.buf.b+="j":this.buf.b+="w",this.serializeString(dt.getEnumName(Xt)),this.useEnumIndex?(this.buf.b+=":",this.buf.b+=it.string(r[1])):this.serializeString(r[0]),this.buf.b+=":";var Zt=r.length;this.buf.b+=it.string(Zt-2);for(var Ut=2;Ut<Zt;){var Jt=Ut++;this.serialize(r[Jt])}this.useCache&&this.cache.push(r);break;case 5:throw new Q("Cannot serialize function");default:throw new Q("Cannot serialize "+it.string(r))}}},__class__:$t};var Yt=function(r){this.buf=r,this.length=r.length,this.pos=0,this.scache=[],this.cache=[];var s=Yt.DEFAULT_RESOLVER;s==null&&(s=dt,Yt.DEFAULT_RESOLVER=s),this.setResolver(s)};b["haxe.Unserializer"]=Yt,Yt.__name__=["haxe","Unserializer"],Yt.initCodes=function(){for(var r=[],s=0,o=Yt.BASE64.length;s<o;){var l=s++;r[Yt.BASE64.charCodeAt(l)]=l}return r},Yt.prototype={setResolver:function(r){r==null?this.resolver={resolveClass:function(s){return null},resolveEnum:function(s){return null}}:this.resolver=r},get:function(r){return this.buf.charCodeAt(r)},readDigits:function(){for(var r=0,s=!1,o=this.pos;;){var l=this.buf.charCodeAt(this.pos);if(l!=l)break;if(l==45){if(this.pos!=o)break;s=!0,this.pos++;continue}if(l<48||l>57)break;r=r*10+(l-48),this.pos++}return s&&(r*=-1),r},readFloat:function(){for(var r=this.pos;;){var s=this.buf.charCodeAt(this.pos);if(s>=43&&s<58||s==101||s==69)this.pos++;else break}return it.parseFloat(L.substr(this.buf,r,this.pos-r))},unserializeObject:function(r){for(;;){if(this.pos>=this.length)throw new Q("Invalid object");if(this.buf.charCodeAt(this.pos)==103)break;var s=this.unserialize();if(typeof s!="string")throw new Q("Invalid object key");var o=this.unserialize();r[s]=o}this.pos++},unserializeEnum:function(r,s){if(this.get(this.pos++)!=58)throw new Q("Invalid enum format");var o=this.readDigits();if(o==0)return dt.createEnum(r,s);for(var l=[];o-- >0;)l.push(this.unserialize());return dt.createEnum(r,s,l)},unserialize:function(){var r=this.get(this.pos++);switch(r){case 110:return null;case 116:return!0;case 102:return!1;case 122:return 0;case 105:return this.readDigits();case 100:return this.readFloat();case 121:var s=this.readDigits();if(this.get(this.pos++)!=58||this.length-this.pos<s)throw new Q("Invalid string length");var o=L.substr(this.buf,this.pos,s);return this.pos+=s,o=decodeURIComponent(o.split("+").join(" ")),this.scache.push(o),o;case 107:return NaN;case 109:return-1/0;case 112:return 1/0;case 97:this.buf;var l=[];for(this.cache.push(l);;){var c=this.buf.charCodeAt(this.pos);if(c==104){this.pos++;break}if(c==117){this.pos++;var d=this.readDigits();l[l.length+d-1]=null}else l.push(this.unserialize())}return l;case 111:var m={};return this.cache.push(m),this.unserializeObject(m),m;case 114:var _=this.readDigits();if(_<0||_>=this.cache.length)throw new Q("Invalid reference");return this.cache[_];case 82:var v=this.readDigits();if(v<0||v>=this.scache.length)throw new Q("Invalid string reference");return this.scache[v];case 120:throw new Q(this.unserialize());case 99:var S=this.unserialize(),A=this.resolver.resolveClass(S);if(A==null)throw new Q("Class not found "+S);var P=dt.createEmptyInstance(A);return this.cache.push(P),this.unserializeObject(P),P;case 119:var k=this.unserialize(),T=this.resolver.resolveEnum(k);if(T==null)throw new Q("Enum not found "+k);var M=this.unserializeEnum(T,this.unserialize());return this.cache.push(M),M;case 106:var B=this.unserialize(),C=this.resolver.resolveEnum(B);if(C==null)throw new Q("Enum not found "+B);this.pos++;var F=this.readDigits(),R=dt.getEnumConstructs(C)[F];if(R==null)throw new Q("Unknown enum index "+B+"@"+F);var D=this.unserializeEnum(C,R);return this.cache.push(D),D;case 108:var j=new V;for(this.cache.push(j),this.buf;this.buf.charCodeAt(this.pos)!=104;)j.add(this.unserialize());return this.pos++,j;case 98:var Y=new be;for(this.cache.push(Y),this.buf;this.buf.charCodeAt(this.pos)!=104;){var J=this.unserialize();Y.set(J,this.unserialize())}return this.pos++,Y;case 113:var X=new xt;this.cache.push(X),this.buf;for(var U=this.get(this.pos++);U==58;){var $=this.readDigits();X.set($,this.unserialize()),U=this.get(this.pos++)}if(U!=104)throw new Q("Invalid IntMap format");return X;case 77:var tt=new Bt;for(this.cache.push(tt),this.buf;this.buf.charCodeAt(this.pos)!=104;){var et=this.unserialize();tt.set(et,this.unserialize())}return this.pos++,tt;case 118:var ot;if(this.buf.charCodeAt(this.pos)>=48&&this.buf.charCodeAt(this.pos)<=57&&this.buf.charCodeAt(this.pos+1)>=48&&this.buf.charCodeAt(this.pos+1)<=57&&this.buf.charCodeAt(this.pos+2)>=48&&this.buf.charCodeAt(this.pos+2)<=57&&this.buf.charCodeAt(this.pos+3)>=48&&this.buf.charCodeAt(this.pos+3)<=57&&this.buf.charCodeAt(this.pos+4)==45){var ct=L.substr(this.buf,this.pos,19);ot=L.strDate(ct),this.pos+=19}else{var ht=this.readFloat(),pt=new Date;pt.setTime(ht),ot=pt}return this.cache.push(ot),ot;case 115:var nt=this.readDigits(),gt=this.buf;if(this.get(this.pos++)!=58||this.length-this.pos<nt)throw new Q("Invalid bytes length");var K=Yt.CODES;K==null&&(K=Yt.initCodes(),Yt.CODES=K);var ft=this.pos,kt=nt&3,Xt;Xt=(nt>>2)*3+(kt>=2?kt-1:0);for(var Zt=ft+(nt-kt),Ut=ze.alloc(Xt),Jt=0;ft<Zt;){var Be=K[st.fastCodeAt(gt,ft++)],tr=K[st.fastCodeAt(gt,ft++)];Ut.set(Jt++,Be<<2|tr>>4);var Ae=K[st.fastCodeAt(gt,ft++)];Ut.set(Jt++,tr<<4|Ae>>2);var Ie=K[st.fastCodeAt(gt,ft++)];Ut.set(Jt++,Ae<<6|Ie)}if(kt>=2){var Re=K[st.fastCodeAt(gt,ft++)],Ue=K[st.fastCodeAt(gt,ft++)];if(Ut.set(Jt++,Re<<2|Ue>>4),kt==3){var sr=K[st.fastCodeAt(gt,ft++)];Ut.set(Jt++,Ue<<4|sr>>2)}}return this.pos+=nt,this.cache.push(Ut),Ut;case 67:var fr=this.unserialize(),ar=this.resolver.resolveClass(fr);if(ar==null)throw new Q("Class not found "+fr);var or=dt.createEmptyInstance(ar);if(this.cache.push(or),or.hxUnserialize(this),this.get(this.pos++)!=103)throw new Q("Invalid custom data");return or;case 65:var lr=this.unserialize(),Sr=this.resolver.resolveClass(lr);if(Sr==null)throw new Q("Class not found "+lr);return Sr;case 66:var Hn=this.unserialize(),gn=this.resolver.resolveEnum(Hn);if(gn==null)throw new Q("Enum not found "+Hn);return gn}throw this.pos--,new Q("Invalid char "+this.buf.charAt(this.pos)+" at position "+this.pos)},__class__:Yt};var xt=function(){this.h={}};b["haxe.ds.IntMap"]=xt,xt.__name__=["haxe","ds","IntMap"],xt.__interfaces__=[at],xt.prototype={set:function(r,s){this.h[r]=s},remove:function(r){return this.h.hasOwnProperty(r)?(delete this.h[r],!0):!1},keys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s|0);return L.iter(r)},__class__:xt};var Bt=function(){this.h={},this.h.__keys__={}};b["haxe.ds.ObjectMap"]=Bt,Bt.__name__=["haxe","ds","ObjectMap"],Bt.__interfaces__=[at],Bt.prototype={set:function(r,s){var o=r.__id__||(r.__id__=++Bt.count);this.h[o]=s,this.h.__keys__[o]=r},keys:function(){var r=[];for(var s in this.h.__keys__)this.h.hasOwnProperty(s)&&r.push(this.h.__keys__[s]);return L.iter(r)},__class__:Bt};var we=b["haxe.ds.Option"]={__ename__:["haxe","ds","Option"],__constructs__:["Some","None"]};we.Some=function(r){var s=["Some",0,r];return s.__enum__=we,s.toString=E,s},we.None=["None",1],we.None.toString=E,we.None.__enum__=we;var be=function(){this.h={}};b["haxe.ds.StringMap"]=be,be.__name__=["haxe","ds","StringMap"],be.__interfaces__=[at],be.prototype={set:function(r,s){pa[r]!=null?this.setReserved(r,s):this.h[r]=s},get:function(r){return pa[r]!=null?this.getReserved(r):this.h[r]},setReserved:function(r,s){this.rh==null&&(this.rh={}),this.rh["$"+r]=s},getReserved:function(r){return this.rh==null?null:this.rh["$"+r]},keys:function(){var r=this.arrayKeys();return L.iter(r)},arrayKeys:function(){var r=[];for(var s in this.h)this.h.hasOwnProperty(s)&&r.push(s);if(this.rh!=null)for(var s in this.rh)s.charCodeAt(0)==36&&r.push(s.substr(1));return r},__class__:be};var ze=function(r){this.length=r.byteLength,this.b=new ga(r),this.b.bufferValue=r,r.hxBytes=this,r.bytes=this.b};b["haxe.io.Bytes"]=ze,ze.__name__=["haxe","io","Bytes"],ze.alloc=function(r){return new ze(new ps(r))},ze.prototype={get:function(r){return this.b[r]},set:function(r,s){this.b[r]=s&255},__class__:ze};var ie=b["haxe.io.Error"]={__ename__:["haxe","io","Error"],__constructs__:["Blocked","Overflow","OutsideBounds","Custom"]};ie.Blocked=["Blocked",0],ie.Blocked.toString=E,ie.Blocked.__enum__=ie,ie.Overflow=["Overflow",1],ie.Overflow.toString=E,ie.Overflow.__enum__=ie,ie.OutsideBounds=["OutsideBounds",2],ie.OutsideBounds.toString=E,ie.OutsideBounds.__enum__=ie,ie.Custom=function(r){var s=["Custom",3,r];return s.__enum__=ie,s.toString=E,s};var pe=function(){};b["haxe.io.FPHelper"]=pe,pe.__name__=["haxe","io","FPHelper"],pe.i32ToFloat=function(r){var s=1-(r>>>31<<1),o=r>>>23&255,l=r&8388607;return l==0&&o==0?0:s*(1+Math.pow(2,-23)*l)*Math.pow(2,o-127)},pe.floatToI32=function(r){if(r==0)return 0;var s;r<0?s=-r:s=r;var o=Math.floor(Math.log(s)/.6931471805599453);o<-127?o=-127:o>128&&(o=128);var l=Math.round((s/Math.pow(2,o)-1)*8388608)&8388607;return(r<0?-2147483648:0)|o+127<<23|l},pe.i64ToDouble=function(r,s){var o=1-(s>>>31<<1),l=(s>>20&2047)-1023,c=(s&1048575)*4294967296+(r>>>31)*2147483648+(r&2147483647);return c==0&&l==-1023?0:o*(1+Math.pow(2,-52)*c)*Math.pow(2,l)},pe.doubleToI64=function(r){var s=pe.i64tmp;if(r==0)s.low=0,s.high=0;else{var o;r<0?o=-r:o=r;var l=Math.floor(Math.log(o)/.6931471805599453),c,d=(o/Math.pow(2,l)-1)*4503599627370496;c=Math.round(d);var m=c|0,_=c/4294967296|0;s.low=m,s.high=(r<0?-2147483648:0)|l+1023<<20|_}return s};var Q=function(r){Error.call(this),this.val=r,this.message=String(r),Error.captureStackTrace&&Error.captureStackTrace(this,Q)};b["js._Boot.HaxeError"]=Q,Q.__name__=["js","_Boot","HaxeError"],Q.__super__=Error,Q.prototype=I(Error.prototype,{__class__:Q});var Lt=function(){};b["js.Boot"]=Lt,Lt.__name__=["js","Boot"],Lt.getClass=function(r){if(r instanceof Array&&r.__enum__==null)return Array;var s=r.__class__;if(s!=null)return s;var o=Lt.__nativeClassName(r);return o!=null?Lt.__resolveNativeClass(o):null},Lt.__string_rec=function(r,s){if(r==null)return"null";if(s.length>=5)return"<...>";var o=typeof r;switch(o=="function"&&(r.__name__||r.__ename__)&&(o="object"),o){case"object":if(r instanceof Array){if(r.__enum__){if(r.length==2)return r[0];var l=r[0]+"(";s+=" ";for(var c=2,d=r.length;c<d;){var m=c++;m!=2?l+=","+Lt.__string_rec(r[m],s):l+=Lt.__string_rec(r[m],s)}return l+")"}var _=r.length,v="[";s+=" ";for(var S=0;S<_;){var A=S++;v+=(A>0?",":"")+Lt.__string_rec(r[A],s)}return v+="]",v}var P;try{P=r.toString}catch(C){return C instanceof Q&&(C=C.val),"???"}if(P!=null&&P!=Object.toString&&typeof P=="function"){var k=r.toString();if(k!="[object Object]")return k}var T=null,M=`{
|
|
4
|
-
`;s+=" ";var B=r.hasOwnProperty!=null;for(var T in r)B&&!r.hasOwnProperty(T)||T=="prototype"||T=="__class__"||T=="__super__"||T=="__interfaces__"||T=="__properties__"||(M.length!=2&&(M+=`,
|
|
5
|
-
`),M+=s+T+" : "+Lt.__string_rec(r[T],s));return s=s.substring(1),M+=`
|
|
6
|
-
`+s+"}",M;case"function":return"<function>";case"string":return r;default:return String(r)}},Lt.__interfLoop=function(r,s){if(r==null)return!1;if(r==s)return!0;var o=r.__interfaces__;if(o!=null)for(var l=0,c=o.length;l<c;){var d=l++,m=o[d];if(m==s||Lt.__interfLoop(m,s))return!0}return Lt.__interfLoop(r.__super__,s)},Lt.__instanceof=function(r,s){if(s==null)return!1;switch(s){case zc:return(r|0)===r;case ol:return typeof r=="number";case ll:return typeof r=="boolean";case String:return typeof r=="string";case Array:return r instanceof Array&&r.__enum__==null;case Vc:return!0;default:if(r!=null){if(typeof s=="function"){if(r instanceof s||Lt.__interfLoop(Lt.getClass(r),s))return!0}else if(typeof s=="object"&&Lt.__isNativeObj(s)&&r instanceof s)return!0}else return!1;return s==hl&&r.__name__!=null||s==ul&&r.__ename__!=null?!0:r.__enum__==s}},Lt.__nativeClassName=function(r){var s=Lt.__toStr.call(r).slice(8,-1);return s=="Object"||s=="Function"||s=="Math"||s=="JSON"?null:s},Lt.__isNativeObj=function(r){return Lt.__nativeClassName(r)!=null},Lt.__resolveNativeClass=function(r){return x[r]};var ge=function(r){if(r instanceof Array&&r.__enum__==null)this.a=r,this.byteLength=r.length;else{var s=r;this.a=[];for(var o=0;o<s;){var l=o++;this.a[l]=0}this.byteLength=s}};b["js.html.compat.ArrayBuffer"]=ge,ge.__name__=["js","html","compat","ArrayBuffer"],ge.sliceImpl=function(r,s){var o=new ga(this,r,s==null?null:s-r),l=new ps(o.byteLength),c=new ga(l);return c.set(o),l},ge.prototype={slice:function(r,s){return new ge(this.a.slice(r,s))},__class__:ge};var br=function(r,s,o){if(this.buf=r,s==null?this.offset=0:this.offset=s,o==null?this.length=r.byteLength-this.offset:this.length=o,this.offset<0||this.length<0||this.offset+this.length>r.byteLength)throw new Q(ie.OutsideBounds)};b["js.html.compat.DataView"]=br,br.__name__=["js","html","compat","DataView"],br.prototype={getInt8:function(r){var s=this.buf.a[this.offset+r];return s>=128?s-256:s},getUint8:function(r){return this.buf.a[this.offset+r]},getInt16:function(r,s){var o=this.getUint16(r,s);return o>=32768?o-65536:o},getUint16:function(r,s){return s?this.buf.a[this.offset+r]|this.buf.a[this.offset+r+1]<<8:this.buf.a[this.offset+r]<<8|this.buf.a[this.offset+r+1]},getInt32:function(r,s){var o=this.offset+r,l=this.buf.a[o++],c=this.buf.a[o++],d=this.buf.a[o++],m=this.buf.a[o++];return s?l|c<<8|d<<16|m<<24:m|d<<8|c<<16|l<<24},getUint32:function(r,s){var o=this.getInt32(r,s);return o<0?o+4294967296:o},getFloat32:function(r,s){return pe.i32ToFloat(this.getInt32(r,s))},getFloat64:function(r,s){var o=this.getInt32(r,s),l=this.getInt32(r+4,s);return pe.i64ToDouble(s?o:l,s?l:o)},setInt8:function(r,s){s<0?this.buf.a[r+this.offset]=s+128&255:this.buf.a[r+this.offset]=s&255},setUint8:function(r,s){this.buf.a[r+this.offset]=s&255},setInt16:function(r,s,o){this.setUint16(r,s<0?s+65536:s,o)},setUint16:function(r,s,o){var l=r+this.offset;o?(this.buf.a[l]=s&255,this.buf.a[l++]=s>>8&255):(this.buf.a[l++]=s>>8&255,this.buf.a[l]=s&255)},setInt32:function(r,s,o){this.setUint32(r,s,o)},setUint32:function(r,s,o){var l=r+this.offset;o?(this.buf.a[l++]=s&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>>24):(this.buf.a[l++]=s>>>24,this.buf.a[l++]=s>>16&255,this.buf.a[l++]=s>>8&255,this.buf.a[l++]=s&255)},setFloat32:function(r,s,o){this.setUint32(r,pe.floatToI32(s),o)},setFloat64:function(r,s,o){var l=pe.doubleToI64(s);o?(this.setUint32(r,l.low),this.setUint32(r,l.high)):(this.setUint32(r,l.high),this.setUint32(r,l.low))},__class__:br};var pr=function(){};b["js.html.compat.Uint8Array"]=pr,pr.__name__=["js","html","compat","Uint8Array"],pr._new=function(r,s,o){var l;if(typeof r=="number"){l=[];for(var c=0;c<r;){var d=c++;l[d]=0}l.byteLength=l.length,l.byteOffset=0,l.buffer=new ge(l)}else if(Lt.__instanceof(r,ge)){var m=r;s==null&&(s=0),o==null&&(o=m.byteLength-s),s==0?l=m.a:l=m.a.slice(s,s+o),l.byteLength=l.length,l.byteOffset=s,l.buffer=m}else if(r instanceof Array&&r.__enum__==null)l=r.slice(),l.byteLength=l.length,l.byteOffset=0,l.buffer=new ge(l);else throw new Q("TODO "+it.string(r));return l.subarray=pr._subarray,l.set=pr._set,l},pr._set=function(r,s){var o=this;if(Lt.__instanceof(r.buffer,ge)){var l=r;if(r.byteLength+s>o.byteLength)throw new Q("set() outside of range");for(var c=0,d=r.byteLength;c<d;){var m=c++;o[m+s]=l[m]}}else if(r instanceof Array&&r.__enum__==null){var _=r;if(_.length+s>o.byteLength)throw new Q("set() outside of range");for(var v=0,S=_.length;v<S;){var A=v++;o[A+s]=_[A]}}else throw new Q("TODO")},pr._subarray=function(r,s){var o=this,l=pr._new(o.slice(r,s));return l.byteOffset=r,l};var Mt=function(r){this._resolved=!1,this._pending=!1,this._errorPending=!1,this._fulfilled=!1,this._update=[],this._error=[],this._errored=!1,r!=null&&Mt.link(r,this,function(s){return s})};b["promhx.base.AsyncBase"]=Mt,Mt.__name__=["promhx","base","AsyncBase"],Mt.link=function(r,s,o){r._update.push({async:s,linkf:function(l){s.handleResolve(o(l))}}),Mt.immediateLinkUpdate(r,s,o)},Mt.immediateLinkUpdate=function(r,s,o){if(r._errored&&!r._errorPending&&!(r._error.length>0)&&s.handleError(r._errorVal),r._resolved&&!r._pending)try{s.handleResolve(o(r._val))}catch(l){l instanceof Q&&(l=l.val),s.handleError(l)}},Mt.linkAll=function(r,s){for(var o=function(d,m,_){if(d.length==0||Mt.allFulfilled(d)){for(var v,S=[],A=ir(r)();A.hasNext();){var P=A.next();S.push(P==m?_:P._val)}v=S,s.handleResolve(v)}},l=ir(r)();l.hasNext();){var c=l.next();c._update.push({async:s,linkf:function(d,m,_){return function(v){d(m,_,v)}}(o,function(d){for(var m,_=[],v=ir(r)();v.hasNext();){var S=v.next();S!=c&&_.push(S)}return m=_,m}(),c)})}Mt.allFulfilled(r)&&s.handleResolve(function(d){for(var m,_=[],v=ir(r)();v.hasNext();){var S=v.next();_.push(S._val)}return m=_,m}())},Mt.pipeLink=function(r,s,o){var l=!1,c=function(d){if(!l){l=!0;var m=o(d);m._update.push({async:s,linkf:je(s,s.handleResolve)}),Mt.immediateLinkUpdate(m,s,function(_){return _})}};if(r._update.push({async:s,linkf:c}),r._resolved&&!r._pending)try{c(r._val)}catch(d){d instanceof Q&&(d=d.val),s.handleError(d)}},Mt.allResolved=function(r){for(var s=ir(r)();s.hasNext();){var o=s.next();if(!o._resolved)return!1}return!0},Mt.allFulfilled=function(r){for(var s=ir(r)();s.hasNext();){var o=s.next();if(!o._fulfilled)return!1}return!0},Mt.prototype={catchError:function(r){return this._error.push(r),this},errorThen:function(r){return this._errorMap=r,this},isResolved:function(){return this._resolved},isErrored:function(){return this._errored},isErrorHandled:function(){return this._error.length>0},isErrorPending:function(){return this._errorPending},isFulfilled:function(){return this._fulfilled},isPending:function(){return this._pending},handleResolve:function(r){this._resolve(r)},_resolve:function(r){var s=this;this._pending?At.enqueue(function(o,l){return function(){o(l)}}(je(this,this._resolve),r)):(this._resolved=!0,this._pending=!0,At.queue.add(function(){s._val=r;for(var o=0,l=s._update;o<l.length;){var c=l[o];++o;try{c.linkf(r)}catch(d){d instanceof Q&&(d=d.val),c.async.handleError(d)}}s._fulfilled=!0,s._pending=!1}),At.continueOnNextLoop())},handleError:function(r){this._handleError(r)},_handleError:function(r){var s=this,o=function(l){if(s._error.length>0)for(var c=0,d=s._error;c<d.length;){var m=d[c];++c,m(l)}else if(s._update.length>0)for(var _=0,v=s._update;_<v.length;){var S=v[_];++_,S.async.handleError(l)}else throw new Q(l);s._errorPending=!1};this._errorPending||(this._errorPending=!0,this._errored=!0,this._errorVal=r,At.queue.add(function(){if(s._errorMap!=null)try{s._resolve(s._errorMap(r))}catch(l){l instanceof Q&&(l=l.val),o(l)}else o(r)}),At.continueOnNextLoop())},then:function(r){var s=new Mt(null);return Mt.link(this,s,r),s},unlink:function(r){var s=this;At.queue.add(function(){s._update=s._update.filter(function(o){return o.async!=r})}),At.continueOnNextLoop()},isLinked:function(r){for(var s=!1,o=0,l=this._update;o<l.length;){var c=l[o];if(++o,c.async==r)return!0}return s},__class__:Mt};var Cn=f.promhx.Deferred=function(){Mt.call(this)};b["promhx.Deferred"]=Cn,Cn.__name__=["promhx","Deferred"],Cn.__super__=Mt,Cn.prototype=I(Mt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},promise:function(){return new xe(this)},stream:function(){return new qt(this)},publicStream:function(){return new Yr(this)},__class__:Cn});var xe=f.promhx.Promise=function(r){Mt.call(this,r),this._rejected=!1};b["promhx.Promise"]=xe,xe.__name__=["promhx","Promise"],xe.whenAll=function(r){var s=new xe(null);return Mt.linkAll(r,s),s},xe.promise=function(r){var s=new xe;return s.handleResolve(r),s},xe.__super__=Mt,xe.prototype=I(Mt.prototype,{isRejected:function(){return this._rejected},reject:function(r){this._rejected=!0,this.handleError(r)},handleResolve:function(r){if(this._resolved){var s="Promise has already been resolved";throw new Q(Bn.AlreadyResolved(s))}this._resolve(r)},then:function(r){var s=new xe(null);return Mt.link(this,s,r),s},unlink:function(r){var s=this;At.queue.add(function(){if(s._fulfilled)s._update=s._update.filter(function(l){return l.async!=r});else{var o="Downstream Promise is not fullfilled";s.handleError(Bn.DownstreamNotFullfilled(o))}}),At.continueOnNextLoop()},handleError:function(r){this._rejected=!0,this._handleError(r)},pipe:function(r){var s=new xe(null);return Mt.pipeLink(this,s,r),s},errorPipe:function(r){var s=new xe;return this.catchError(function(o){var l=r(o);l.then(je(s,s._resolve))}),this.then(je(s,s._resolve)),s},__class__:xe});var qt=f.promhx.Stream=function(r){Mt.call(this,r),this._end_promise=new xe};b["promhx.Stream"]=qt,qt.__name__=["promhx","Stream"],qt.foreach=function(r){for(var s=new qt(null),o=ir(r)();o.hasNext();){var l=o.next();s.handleResolve(l)}return s.end(),s},qt.wheneverAll=function(r){var s=new qt(null);return Mt.linkAll(r,s),s},qt.concatAll=function(r){for(var s=new qt(null),o=ir(r)();o.hasNext();){var l=o.next();s.concat(l)}return s},qt.mergeAll=function(r){for(var s=new qt(null),o=ir(r)();o.hasNext();){var l=o.next();s.merge(l)}return s},qt.stream=function(r){var s=new qt(null);return s.handleResolve(r),s},qt.__super__=Mt,qt.prototype=I(Mt.prototype,{then:function(r){var s=new qt(null);return Mt.link(this,s,r),this._end_promise._update.push({async:s._end_promise,linkf:function(o){s.end()}}),s},detachStream:function(r){for(var s=[],o=!1,l=0,c=this._update;l<c.length;){var d=c[l];++l,d.async==r?(this._end_promise._update=this._end_promise._update.filter(function(m){return m.async!=r._end_promise}),o=!0):s.push(d)}return this._update=s,o},first:function(){var r=new xe(null);return this.then(function(s){r._resolved||r.handleResolve(s)}),r},handleResolve:function(r){!this._end&&!this._pause&&this._resolve(r)},pause:function(r){r==null&&(r=!this._pause),this._pause=r},pipe:function(r){var s=new qt(null);return Mt.pipeLink(this,s,r),this._end_promise.then(function(o){s.end()}),s},errorPipe:function(r){var s=new qt(null);return this.catchError(function(o){var l=r(o);l.then(je(s,s._resolve)),l._end_promise.then((da=s._end_promise,je(da,da._resolve)))}),this.then(je(s,s._resolve)),this._end_promise.then(function(o){s.end()}),s},handleEnd:function(){if(this._pending)At.queue.add(je(this,this.handleEnd)),At.continueOnNextLoop();else{if(this._end_promise._resolved)return;this._end=!0;var r;this._resolved?r=we.Some(this._val):r=we.None,this._end_promise.handleResolve(r),this._update=[],this._error=[]}},end:function(){return At.queue.add(je(this,this.handleEnd)),At.continueOnNextLoop(),this},endThen:function(r){return this._end_promise.then(r)},filter:function(r){var s=new qt(null);return this._update.push({async:s,linkf:function(o){r(o)&&s.handleResolve(o)}}),Mt.immediateLinkUpdate(this,s,function(o){return o}),s},concat:function(r){var s=new qt(null);return this._update.push({async:s,linkf:je(s,s.handleResolve)}),Mt.immediateLinkUpdate(this,s,function(o){return o}),this._end_promise.then(function(o){r.pipe(function(l){return s.handleResolve(l),s}),r._end_promise.then(function(l){s.end()})}),s},merge:function(r){var s=new qt(null);return this._update.push({async:s,linkf:je(s,s.handleResolve)}),r._update.push({async:s,linkf:je(s,s.handleResolve)}),Mt.immediateLinkUpdate(this,s,function(o){return o}),Mt.immediateLinkUpdate(r,s,function(o){return o}),s},__class__:qt});var Yr=f.promhx.PublicStream=function(r){qt.call(this,r)};b["promhx.PublicStream"]=Yr,Yr.__name__=["promhx","PublicStream"],Yr.publicstream=function(r){var s=new Yr(null);return s.handleResolve(r),s},Yr.__super__=qt,Yr.prototype=I(qt.prototype,{resolve:function(r){this.handleResolve(r)},throwError:function(r){this.handleError(r)},update:function(r){this.handleResolve(r)},__class__:Yr});var At=function(){};b["promhx.base.EventLoop"]=At,At.__name__=["promhx","base","EventLoop"],At.enqueue=function(r){At.queue.add(r),At.continueOnNextLoop()},At.set_nextLoop=function(r){if(At.nextLoop!=null)throw new Q("nextLoop has already been set");return At.nextLoop=r,At.nextLoop},At.queueEmpty=function(){return At.queue.isEmpty()},At.finish=function(r){r==null&&(r=1e3);for(var s=null;r-- >0&&(s=At.queue.pop())!=null;)s();return At.queue.isEmpty()},At.clear=function(){At.queue=new V},At.f=function(){var r=At.queue.pop();r!=null&&r(),At.queue.isEmpty()||At.continueOnNextLoop()},At.continueOnNextLoop=function(){At.nextLoop!=null?At.nextLoop(At.f):setImmediate(At.f)};var Bn=b["promhx.error.PromiseError"]={__ename__:["promhx","error","PromiseError"],__constructs__:["AlreadyResolved","DownstreamNotFullfilled"]};Bn.AlreadyResolved=function(r){var s=["AlreadyResolved",0,r];return s.__enum__=Bn,s.toString=E,s},Bn.DownstreamNotFullfilled=function(r){var s=["DownstreamNotFullfilled",1,r];return s.__enum__=Bn,s.toString=E,s};var cs=function(){};b["verb.Verb"]=cs,cs.__name__=["verb","Verb"],cs.main=function(){y.log("verb 2.1.0")};var Z=function(){};b["verb.core.ArrayExtensions"]=Z,Z.__name__=["verb","core","ArrayExtensions"],Z.alloc=function(r,s){if(!(s<0))for(;r.length<s;)r.push(null)},Z.reversed=function(r){var s=r.slice();return s.reverse(),s},Z.last=function(r){return r[r.length-1]},Z.first=function(r){return r[0]},Z.spliceAndInsert=function(r,s,o,l){r.splice(s,o),r.splice(s,0,l)},Z.left=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(0,s)},Z.right=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s)},Z.rightWithPivot=function(r){if(r.length==0)return[];var s=Math.ceil(r.length/2);return r.slice(s-1)},Z.unique=function(r,s){if(r.length==0)return[];for(var o=[r.pop()];r.length>0;){for(var l=r.pop(),c=!0,d=0;d<o.length;){var m=o[d];if(++d,s(l,m)){c=!1;break}}c&&o.push(l)}return o};var Vt=function(){};b["verb.core.Binomial"]=Vt,Vt.__name__=["verb","core","Binomial"],Vt.get=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;if(s>r-s&&(s=r-s),Vt.memo_exists(r,s))return Vt.get_memo(r,s);for(var o=1,l=r,c=1,d=s+1;c<d;){var m=c++;if(Vt.memo_exists(l,m)){r--,o=Vt.get_memo(l,m);continue}o*=r--,o/=m,Vt.memoize(l,m,o)}return o},Vt.get_no_memo=function(r,s){if(s==0)return 1;if(r==0||s>r)return 0;s>r-s&&(s=r-s);for(var o=1,l=1,c=s+1;l<c;){var d=l++;o*=r--,o/=d}return o},Vt.memo_exists=function(r,s){return Vt.memo.h.hasOwnProperty(r)&&Vt.memo.h[r].h.hasOwnProperty(s)},Vt.get_memo=function(r,s){return Vt.memo.h[r].h[s]},Vt.memoize=function(r,s,o){Vt.memo.h.hasOwnProperty(r)||Vt.memo.set(r,new xt),Vt.memo.h[r].h[s]=o};var Ve=f.core.BoundingBox=function(r){this.max=null,this.min=null,this.dim=3,this.initialized=!1,r!=null&&this.addRange(r)};b["verb.core.BoundingBox"]=Ve,Ve.__name__=["verb","core","BoundingBox"],Ve.intervalsOverlap=function(r,s,o,l,c){c==null&&(c=-1);var d;c<-.5?d=rt.TOLERANCE:d=c;var m=Math.min(r,s)-d,_=Math.max(r,s)+d,v=Math.min(o,l)-d,S=Math.max(o,l)+d;return m>=v&&m<=S||_>=v&&_<=S||v>=m&&v<=_||S>=m&&S<=_},Ve.prototype={fromPoint:function(r){return new Ve([r])},add:function(r){if(!this.initialized)return this.dim=r.length,this.min=r.slice(0),this.max=r.slice(0),this.initialized=!0,this;for(var s=0,o=this.dim;s<o;){var l=s++;r[l]>this.max[l]&&(this.max[l]=r[l]),r[l]<this.min[l]&&(this.min[l]=r[l])}return this},addRange:function(r){for(var s=r.length,o=0;o<s;){var l=o++;this.add(r[l])}return this},contains:function(r,s){return s==null&&(s=-1),this.initialized?this.intersects(new Ve([r]),s):!1},intersects:function(r,s){if(s==null&&(s=-1),!this.initialized||!r.initialized)return!1;for(var o=this.min,l=this.max,c=r.min,d=r.max,m=0,_=this.dim;m<_;){var v=m++;if(!Ve.intervalsOverlap(o[v],l[v],c[v],d[v],s))return!1}return!0},clear:function(){return this.initialized=!1,this},getLongestAxis:function(){for(var r=0,s=0,o=0,l=this.dim;o<l;){var c=o++,d=this.getAxisLength(c);d>r&&(r=d,s=c)}return s},getAxisLength:function(r){return r<0||r>this.dim-1?0:Math.abs(this.min[r]-this.max[r])},intersect:function(r,s){if(!this.initialized)return null;var o=this.min,l=this.max,c=r.min,d=r.max;if(!this.intersects(r,s))return null;for(var m=[],_=[],v=0,S=this.dim;v<S;){var A=v++;m.push(Math.min(l[A],d[A])),_.push(Math.max(o[A],c[A]))}return new Ve([_,m])},__class__:Ve};var rt=f.core.Constants=function(){};b["verb.core.Constants"]=rt,rt.__name__=["verb","core","Constants"];var ee=f.core.SerializableBase=function(){};b["verb.core.SerializableBase"]=ee,ee.__name__=["verb","core","SerializableBase"],ee.prototype={serialize:function(){var r=new $t;return r.serialize(this),r.toString()},__class__:ee};var li=f.core.Plane=function(r,s){this.origin=r,this.normal=s};b["verb.core.Plane"]=li,li.__name__=["verb","core","Plane"],li.__super__=ee,li.prototype=I(ee.prototype,{__class__:li});var Rn=f.core.Ray=function(r,s){this.origin=r,this.dir=s};b["verb.core.Ray"]=Rn,Rn.__name__=["verb","core","Ray"],Rn.__super__=ee,Rn.prototype=I(ee.prototype,{__class__:Rn});var Ht=f.core.NurbsCurveData=function(r,s,o){this.degree=r,this.controlPoints=o,this.knots=s};b["verb.core.NurbsCurveData"]=Ht,Ht.__name__=["verb","core","NurbsCurveData"],Ht.__super__=ee,Ht.prototype=I(ee.prototype,{__class__:Ht});var se=f.core.NurbsSurfaceData=function(r,s,o,l,c){this.degreeU=r,this.degreeV=s,this.knotsU=o,this.knotsV=l,this.controlPoints=c};b["verb.core.NurbsSurfaceData"]=se,se.__name__=["verb","core","NurbsSurfaceData"],se.__super__=ee,se.prototype=I(ee.prototype,{__class__:se});var rr=f.core.MeshData=function(r,s,o,l){this.faces=r,this.points=s,this.normals=o,this.uvs=l};b["verb.core.MeshData"]=rr,rr.__name__=["verb","core","MeshData"],rr.empty=function(){return new rr([],[],[],[])},rr.__super__=ee,rr.prototype=I(ee.prototype,{__class__:rr});var hi=f.core.PolylineData=function(r,s){this.points=r,this.params=s};b["verb.core.PolylineData"]=hi,hi.__name__=["verb","core","PolylineData"],hi.__super__=ee,hi.prototype=I(ee.prototype,{__class__:hi});var ui=f.core.VolumeData=function(r,s,o,l,c,d,m){this.degreeU=r,this.degreeV=s,this.degreeW=o,this.knotsU=l,this.knotsV=c,this.knotsW=d,this.controlPoints=m};b["verb.core.VolumeData"]=ui,ui.__name__=["verb","core","VolumeData"],ui.__super__=ee,ui.prototype=I(ee.prototype,{__class__:ui});var ae=f.core.Pair=function(r,s){this.item0=r,this.item1=s};b["verb.core.Pair"]=ae,ae.__name__=["verb","core","Pair"],ae.prototype={__class__:ae};var Ce=f.core.Interval=function(r,s){this.min=r,this.max=s};b["verb.core.Interval"]=Ce,Ce.__name__=["verb","core","Interval"],Ce.prototype={__class__:Ce};var dn=f.core.CurveCurveIntersection=function(r,s,o,l){this.point0=r,this.point1=s,this.u0=o,this.u1=l};b["verb.core.CurveCurveIntersection"]=dn,dn.__name__=["verb","core","CurveCurveIntersection"],dn.prototype={__class__:dn};var ci=f.core.CurveSurfaceIntersection=function(r,s,o,l){this.u=r,this.uv=s,this.curvePoint=o,this.surfacePoint=l};b["verb.core.CurveSurfaceIntersection"]=ci,ci.__name__=["verb","core","CurveSurfaceIntersection"],ci.prototype={__class__:ci};var qr=f.core.MeshIntersectionPoint=function(r,s,o,l,c){this.visited=!1,this.adj=null,this.opp=null,this.uv0=r,this.uv1=s,this.point=o,this.faceIndex0,this.faceIndex1};b["verb.core.MeshIntersectionPoint"]=qr,qr.__name__=["verb","core","MeshIntersectionPoint"],qr.prototype={__class__:qr};var di=f.core.PolylineMeshIntersection=function(r,s,o,l,c){this.point=r,this.u=s,this.uv=o,this.polylineIndex=l,this.faceIndex=c};b["verb.core.PolylineMeshIntersection"]=di,di.__name__=["verb","core","PolylineMeshIntersection"],di.prototype={__class__:di};var pi=f.core.SurfaceSurfaceIntersectionPoint=function(r,s,o,l){this.uv0=r,this.uv1=s,this.point=o,this.dist=l};b["verb.core.SurfaceSurfaceIntersectionPoint"]=pi,pi.__name__=["verb","core","SurfaceSurfaceIntersectionPoint"],pi.prototype={__class__:pi};var gi=f.core.TriSegmentIntersection=function(r,s,o,l){this.point=r,this.s=s,this.t=o,this.p=l};b["verb.core.TriSegmentIntersection"]=gi,gi.__name__=["verb","core","TriSegmentIntersection"],gi.prototype={__class__:gi};var Fn=f.core.CurveTriPoint=function(r,s,o){this.u=r,this.point=s,this.uv=o};b["verb.core.CurveTriPoint"]=Fn,Fn.__name__=["verb","core","CurveTriPoint"],Fn.prototype={__class__:Fn};var Qe=function(r,s,o,l,c){c==null&&(c=!1),l==null&&(l=-1),this.uv=o,this.point=r,this.normal=s,this.id=l,this.degen=c};b["verb.core.SurfacePoint"]=Qe,Qe.__name__=["verb","core","SurfacePoint"],Qe.fromUv=function(r,s){return new Qe(null,null,[r,s])},Qe.prototype={__class__:Qe};var ds=f.core.CurvePoint=function(r,s){this.u=r,this.pt=s};b["verb.core.CurvePoint"]=ds,ds.__name__=["verb","core","CurvePoint"],ds.prototype={__class__:ds};var mi=f.core.KdTree=function(r,s){this.dim=3,this.points=r,this.distanceFunction=s,this.dim=r[0].point.length,this.root=this.buildTree(r,0,null)};b["verb.core.KdTree"]=mi,mi.__name__=["verb","core","KdTree"],mi.prototype={buildTree:function(r,s,o){var l=s%this.dim,c,d;return r.length==0?null:r.length==1?new Vn(r[0],l,o):(r.sort(function(m,_){var v=m.point[l]-_.point[l];return v==0?0:v>0?1:-1}),c=Math.floor(r.length/2),d=new Vn(r[c],l,o),d.left=this.buildTree(r.slice(0,c),s+1,d),d.right=this.buildTree(r.slice(c+1),s+1,d),d)},nearest:function(r,s,o){var l=this,c=new _i(function(P){return-P.item1}),d,m=null;m=function(P){for(var k,T=P.dimension,M=l.distanceFunction(r,P.kdPoint.point),B,C=[],F=0,R=l.dim;F<R;)F++,C.push(0);B=C;for(var D,j,Y=function($,tt){c.push(new ae($,tt)),c.size()>s&&c.pop()},J=0,X=l.dim;J<X;){var U=J++;U==P.dimension?B[U]=r[U]:B[U]=P.kdPoint.point[U]}if(D=l.distanceFunction(B,P.kdPoint.point),P.right==null&&P.left==null){(c.size()<s||M<c.peek().item1)&&Y(P,M);return}P.right==null?k=P.left:P.left==null?k=P.right:r[T]<P.kdPoint.point[T]?k=P.left:k=P.right,m(k),(c.size()<s||M<c.peek().item1)&&Y(P,M),(c.size()<s||Math.abs(D)<c.peek().item1)&&(k==P.left?j=P.right:j=P.left,j!=null&&m(j))},d=m;for(var _=0;_<s;)_++,c.push(new ae(null,o));d(this.root);for(var v=[],S=0;S<s;){var A=S++;c.content[A].item0!=null&&v.push(new ae(c.content[A].item0.kdPoint,c.content[A].item1))}return v},__class__:mi};var _i=function(r){this.content=[],this.scoreFunction=r};b["verb.core.BinaryHeap"]=_i,_i.__name__=["verb","core","BinaryHeap"],_i.prototype={push:function(r){this.content.push(r),this.bubbleUp(this.content.length-1)},pop:function(){var r=this.content[0],s=this.content.pop();return this.content.length>0&&(this.content[0]=s,this.sinkDown(0)),r},peek:function(){return this.content[0]},remove:function(r){for(var s=this.content.length,o=0;o<s;){var l=o++;if(this.content[l]==r){var c=this.content.pop();l!=s-1&&(this.content[l]=c,this.scoreFunction(c)<this.scoreFunction(r)?this.bubbleUp(l):this.sinkDown(l));return}}throw new Q("Node not found.")},size:function(){return this.content.length},bubbleUp:function(r){for(var s=this.content[r];r>0;){var o=Math.floor((r+1)/2)-1,l=this.content[o];if(this.scoreFunction(s)<this.scoreFunction(l))this.content[o]=s,this.content[r]=l,r=o;else break}},sinkDown:function(r){for(var s=this.content.length,o=this.content[r],l=this.scoreFunction(o);;){var c=(r+1)*2,d=c-1,m=-1,_=0;if(d<s){var v=this.content[d];_=this.scoreFunction(v),_<l&&(m=d)}if(c<s){var S=this.content[c],A=this.scoreFunction(S);A<(m==-1?l:_)&&(m=c)}if(m!=-1)this.content[r]=this.content[m],this.content[m]=o,r=m;else break}},__class__:_i};var zn=f.core.KdPoint=function(r,s){this.point=r,this.obj=s};b["verb.core.KdPoint"]=zn,zn.__name__=["verb","core","KdPoint"],zn.prototype={__class__:zn};var Vn=f.core.KdNode=function(r,s,o){this.kdPoint=r,this.left=null,this.right=null,this.parent=o,this.dimension=s};b["verb.core.KdNode"]=Vn,Vn.__name__=["verb","core","KdNode"],Vn.prototype={__class__:Vn};var xr=function(){};b["verb.eval.IBoundingBoxTree"]=xr,xr.__name__=["verb","eval","IBoundingBoxTree"],xr.prototype={__class__:xr};var gr=function(r,s){this._boundingBox=null,this._curve=r,s==null&&(s=g.domain(this._curve.knots)/64),this._knotTol=s};b["verb.core.LazyCurveBoundingBoxTree"]=gr,gr.__name__=["verb","core","LazyCurveBoundingBoxTree"],gr.__interfaces__=[xr],gr.prototype={split:function(){var r=Z.first(this._curve.knots),s=Z.last(this._curve.knots),o=s-r,l=me.curveSplit(this._curve,(s+r)/2+o*.1*Math.random());return new ae(new gr(l[0],this._knotTol),new gr(l[1],this._knotTol))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Ve(N.dehomogenize1d(this._curve.controlPoints))),this._boundingBox},yield:function(){return this._curve},indivisible:function(r){return g.domain(this._curve.knots)<this._knotTol},empty:function(){return!1},__class__:gr};var mr=function(r,s){if(this._boundingBox=null,this._mesh=r,s==null){for(var o=[],l=0,c=r.faces.length;l<c;){var d=l++;o.push(d)}s=o}this._faceIndices=s};b["verb.core.LazyMeshBoundingBoxTree"]=mr,mr.__name__=["verb","core","LazyMeshBoundingBoxTree"],mr.__interfaces__=[xr],mr.prototype={split:function(){var r=oe.sortTrianglesOnLongestAxis(this.boundingBox(),this._mesh,this._faceIndices),s=Z.left(r),o=Z.right(r);return new ae(new mr(this._mesh,s),new mr(this._mesh,o))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=oe.makeMeshAabb(this._mesh,this._faceIndices)),this._boundingBox},yield:function(){return this._faceIndices[0]},indivisible:function(r){return this._faceIndices.length==1},empty:function(){return this._faceIndices.length==0},__class__:mr};var _r=function(r,s){this._boundingBox=null,this._polyline=r,s==null&&(s=new Ce(0,r.points.length!=0?r.points.length-1:0)),this._interval=s};b["verb.core.LazyPolylineBoundingBoxTree"]=_r,_r.__name__=["verb","core","LazyPolylineBoundingBoxTree"],_r.__interfaces__=[xr],_r.prototype={split:function(){var r=this._interval.min,s=this._interval.max,o=r+Math.ceil((s-r)/2),l=new Ce(r,o),c=new Ce(o,s);return new ae(new _r(this._polyline,l),new _r(this._polyline,c))},boundingBox:function(){return this._boundingBox==null&&(this._boundingBox=new Ve(this._polyline.points)),this._boundingBox},yield:function(){return this._interval.min},indivisible:function(r){return this._interval.max-this._interval.min==1},empty:function(){return this._interval.max-this._interval.min==0},__class__:_r};var Kr=function(r,s,o,l){s==null&&(s=!1),this._boundingBox=null,this._surface=r,this._splitV=s,o==null&&(o=g.domain(r.knotsU)/16),l==null&&(l=g.domain(r.knotsV)/16),this._knotTolU=o,this._knotTolV=l};b["verb.core.LazySurfaceBoundingBoxTree"]=Kr,Kr.__name__=["verb","core","LazySurfaceBoundingBoxTree"],Kr.__interfaces__=[xr],Kr.prototype={split:function(){var r,s;this._splitV?(r=Z.first(this._surface.knotsV),s=Z.last(this._surface.knotsV)):(r=Z.first(this._surface.knotsU),s=Z.last(this._surface.knotsU));var o=(r+s)/2,l=me.surfaceSplit(this._surface,o,this._splitV);return new ae(new Kr(l[0],!this._splitV,this._knotTolU,this._knotTolV),new Kr(l[1],!this._splitV,this._knotTolU,this._knotTolV))},boundingBox:function(){if(this._boundingBox==null){this._boundingBox=new Ve;for(var r=0,s=this._surface.controlPoints;r<s.length;){var o=s[r];++r,this._boundingBox.addRange(N.dehomogenize1d(o))}}return this._boundingBox},yield:function(){return this._surface},indivisible:function(r){return g.domain(this._surface.knotsV)<this._knotTolV&&g.domain(this._surface.knotsU)<this._knotTolU},empty:function(){return!1},__class__:Kr};var Ct=f.core.Mat=function(){};b["verb.core.Mat"]=Ct,Ct.__name__=["verb","core","Mat"],Ct.mul=function(r,s){for(var o=[],l=0,c=s.length;l<c;){var d=l++;o.push(g.mul(r,s[d]))}return o},Ct.mult=function(r,s){var o,l,c,d,m,_,v,S;o=r.length,l=s.length,c=s[0].length,d=[];for(var A=o-1,P=0,k=0;A>=0;){for(m=[],_=r[A],k=c-1;k>=0;){for(v=_[l-1]*s[l-1][k],P=l-2;P>=1;)S=P-1,v+=_[P]*s[P][k]+_[S]*s[S][k],P-=2;P==0&&(v+=_[0]*s[0][k]),m[k]=v,k--}d[A]=m,A--}return d},Ct.add=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(g.add(r[d],s[d]))}return o},Ct.div=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(g.div(r[d],s))}return o},Ct.sub=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(g.sub(r[d],s[d]))}return o},Ct.dot=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(g.dot(r[d],s))}return o},Ct.identity=function(r){for(var s=g.zeros2d(r,r),o=0;o<r;){var l=o++;s[l][l]=1}return s},Ct.transpose=function(r){if(r.length==0)return[];for(var s=[],o=0,l=r[0].length;o<l;){var c=o++;s.push(function(d){for(var m,_=[],v=0,S=r.length;v<S;){var A=v++;_.push(r[A][c])}return m=_,m}())}return s},Ct.solve=function(r,s){return Ct.LUsolve(Ct.LU(r),s)},Ct.LUsolve=function(r,s){var o,l,c=r.LU,d=c.length,m=s.slice(),_=r.P,v,S,A;for(o=d-1;o!=-1;)m[o]=s[o],--o;for(o=0;o<d;){for(v=_[o],_[o]!=o&&(A=m[o],m[o]=m[v],m[v]=A),S=c[o],l=0;l<o;)m[o]-=m[l]*S[l],++l;++o}for(o=d-1;o>=0;){for(S=c[o],l=o+1;l<d;)m[o]-=m[l]*S[l],++l;m[o]/=S[o],--o}return m},Ct.LU=function(r){for(var s,o,l,c,d,m,_,v,S,A=[],P=0,k=r.length;P<k;){var T=P++;A.push(r[T].slice())}r=A;var M=r.length,B=M-1,C=[];for(l=0;l<M;){for(_=l,m=r[l],S=Math.abs(m[l]),o=l+1;o<M;)c=Math.abs(r[o][l]),S<c&&(S=c,_=o),++o;for(C[l]=_,_!=l&&(r[l]=r[_],r[_]=m,m=r[l]),d=m[l],s=l+1;s<M;)r[s][l]/=d,++s;for(s=l+1;s<M;){for(v=r[s],o=l+1;o<B;)v[o]-=v[l]*m[o],++o,v[o]-=v[l]*m[o],++o;o==B&&(v[o]-=v[l]*m[o]),++s}++l}return new fi(r,C)};var fi=function(r,s){this.LU=r,this.P=s};b["verb.core._Mat.LUDecomp"]=fi,fi.__name__=["verb","core","_Mat","LUDecomp"],fi.prototype={__class__:fi};var oe=f.core.Mesh=function(){};b["verb.core.Mesh"]=oe,oe.__name__=["verb","core","Mesh"],oe.getTriangleNorm=function(r,s){var o=r[s[0]],l=r[s[1]],c=r[s[2]],d=g.sub(l,o),m=g.sub(c,o),_=g.cross(d,m);return g.mul(1/g.norm(_),_)},oe.makeMeshAabb=function(r,s){for(var o=new Ve,l=0;l<s.length;){var c=s[l];++l,o.add(r.points[r.faces[c][0]]),o.add(r.points[r.faces[c][1]]),o.add(r.points[r.faces[c][2]])}return o},oe.sortTrianglesOnLongestAxis=function(r,s,o){for(var l=r.getLongestAxis(),c=[],d=0;d<o.length;){var m=o[d];++d;var _=oe.getMinCoordOnAxis(s.points,s.faces[m],l);c.push(new ae(_,m))}c.sort(function(k,T){var M=k.item0,B=T.item0;return M==B?0:M>B?1:-1});for(var v=[],S=0,A=c.length;S<A;){var P=S++;v.push(c[P].item1)}return v},oe.getMinCoordOnAxis=function(r,s,o){for(var l=1/0,c=0;c<3;){var d=c++,m=r[s[d]][o];m<l&&(l=m)}return l},oe.getTriangleCentroid=function(r,s){for(var o=[0,0,0],l=0;l<3;)for(var c=l++,d=0;d<3;){var m=d++;o[m]+=r[s[c]][m]}for(var _=0;_<3;){var v=_++;o[v]/=3}return o},oe.triangleUVFromPoint=function(r,s,o){var l=r.faces[s],c=r.points[l[0]],d=r.points[l[1]],m=r.points[l[2]],_=r.uvs[l[0]],v=r.uvs[l[1]],S=r.uvs[l[2]],A=g.sub(c,o),P=g.sub(d,o),k=g.sub(m,o),T=g.norm(g.cross(g.sub(c,d),g.sub(c,m))),M=g.norm(g.cross(P,k))/T,B=g.norm(g.cross(k,A))/T,C=g.norm(g.cross(A,P))/T;return g.add(g.mul(M,_),g.add(g.mul(B,v),g.mul(C,S)))};var $r=function(r,s){if(this._empty=!1,this._face=-1,s==null){for(var o=[],l=0,c=r.faces.length;l<c;){var d=l++;o.push(d)}s=o}if(this._boundingBox=oe.makeMeshAabb(r,s),s.length<1){this._empty=!0;return}else if(s.length<2){this._face=s[0];return}var m=oe.sortTrianglesOnLongestAxis(this._boundingBox,r,s),_=Z.left(m),v=Z.right(m);this._children=new ae(new $r(r,_),new $r(r,v))};b["verb.core.MeshBoundingBoxTree"]=$r,$r.__name__=["verb","core","MeshBoundingBoxTree"],$r.__interfaces__=[xr],$r.prototype={split:function(){return this._children},boundingBox:function(){return this._boundingBox},yield:function(){return this._face},indivisible:function(r){return this._children==null},empty:function(){return this._empty},__class__:$r};var nr=f.core.Minimizer=function(){};b["verb.core.Minimizer"]=nr,nr.__name__=["verb","core","Minimizer"],nr.uncmin=function(r,s,o,l,c){o==null&&(o=1e-8),l==null&&(l=function(J){return nr.numericalGradient(r,J)}),c==null&&(c=1e3),s=s.slice(0);var d=s.length,m=r(s),_=m,v;if(isNaN(m))throw new Q("uncmin: f(x0) is a NaN!");o=Math.max(o,rt.EPSILON);var S,A,P,k=Ct.identity(d),T=0,M=[],B,C,F,R,D,j,Y="";for(A=l(s);T<c;){if(!g.all(g.finite(A))){Y="Gradient has Infinity or NaN";break}if(S=g.neg(Ct.dot(k,A)),!g.all(g.finite(S))){Y="Search direction has Infinity or NaN";break}if(j=g.norm(S),j<o){Y="Newton step smaller than tol";break}for(D=1,v=g.dot(A,S),B=s;T<c&&!(D*j<o);){if(M=g.mul(D,S),B=g.add(s,M),_=r(B),_-m>=.1*D*v||isNaN(_)){D*=.5,++T;continue}break}if(D*j<o){Y="Line search step size smaller than tol";break}if(T==c){Y="maxit reached during line search";break}P=l(B),C=g.sub(P,A),R=g.dot(C,M),F=Ct.dot(k,C),k=Ct.sub(Ct.add(k,Ct.mul((R+g.dot(C,F))/(R*R),nr.tensor(M,M))),Ct.div(Ct.add(nr.tensor(F,M),nr.tensor(M,F)),R)),s=B,m=_,A=P,++T}return new yi(s,m,A,k,T,Y)},nr.numericalGradient=function(r,s){var o=s.length,l=r(s);if(l==NaN)throw new Q("gradient: f(x) is a NaN!");for(var c=s.slice(0),d,m,_=[],v,S=.001,A,P,k,T=0,M,B,C,F=0;F<o;)for(var R=F++,D=Math.max(1e-6*l,1e-8);;){if(++T,T>20)throw new Q("Numerical gradient fails");if(c[R]=s[R]+D,d=r(c),c[R]=s[R]-D,m=r(c),c[R]=s[R],isNaN(d)||isNaN(m)){D/=16;continue}if(_[R]=(d-m)/(2*D),A=s[R]-D,P=s[R],k=s[R]+D,M=(d-l)/D,B=(l-m)/D,C=g.max([Math.abs(_[R]),Math.abs(l),Math.abs(d),Math.abs(m),Math.abs(A),Math.abs(P),Math.abs(k),1e-8]),v=Math.min(g.max([Math.abs(M-_[R]),Math.abs(B-_[R]),Math.abs(M-B)])/C,D/C),v>S)D/=16;else break}return _},nr.tensor=function(r,s){for(var o=r.length,l=s.length,c=[],d,m,_=o-1;_>=0;){d=[],m=r[_];for(var v=l-1;v>=3;)d[v]=m*s[v],--v,d[v]=m*s[v],--v,d[v]=m*s[v],--v,d[v]=m*s[v],--v;for(;v>=0;)d[v]=m*s[v],--v;c[_]=d,_--}return c};var yi=function(r,s,o,l,c,d){this.solution=r,this.value=s,this.gradient=o,this.invHessian=l,this.iterations=c,this.message=d};b["verb.core.MinimizationResult"]=yi,yi.__name__=["verb","core","MinimizationResult"],yi.prototype={__class__:yi};var Dn=function(){};b["verb.core.ISerializable"]=Dn,Dn.__name__=["verb","core","ISerializable"],Dn.prototype={__class__:Dn};var ca=f.core.Deserializer=function(){};b["verb.core.Deserializer"]=ca,ca.__name__=["verb","core","Deserializer"],ca.deserialize=function(r){var s=new Yt(r),o=s.unserialize();return o};var De=f.core.Trig=function(){};b["verb.core.Trig"]=De,De.__name__=["verb","core","Trig"],De.isPointInPlane=function(r,s,o){return Math.abs(g.dot(g.sub(r,s.origin),s.normal))<o},De.distToSegment=function(r,s,o){var l=De.segmentClosestPoint(s,r,o,0,1);return g.dist(s,l.pt)},De.rayClosestPoint=function(r,s,o){var l=g.sub(r,s),c=g.dot(l,o),d=g.add(s,g.mul(c,o));return d},De.distToRay=function(r,s,o){var l=De.rayClosestPoint(r,s,o),c=g.sub(l,r);return g.norm(c)},De.threePointsAreFlat=function(r,s,o,l){var c=g.sub(s,r),d=g.sub(o,r),m=g.cross(c,d),_=g.dot(m,m);return _<l},De.segmentClosestPoint=function(r,s,o,l,c){var d=g.sub(o,s),m=g.norm(d);if(m<rt.EPSILON)return{u:l,pt:s};var _=s,v=g.mul(1/m,d),S=g.sub(r,_),A=g.dot(S,v);return A<0?{u:l,pt:s}:A>m?{u:c,pt:o}:{u:l+(c-l)*A/m,pt:g.add(_,g.mul(A,v))}};var g=f.core.Vec=function(){};b["verb.core.Vec"]=g,g.__name__=["verb","core","Vec"],g.angleBetween=function(r,s){return Math.acos(g.dot(r,s)/(g.norm(r)*g.norm(s)))},g.positiveAngleBetween=function(r,s,o){var l=g.cross(r,s),c=g.norm(r),d=g.norm(s),m=c*d,_=g.dot(r,s),v=g.norm(l)/m,S=_/m,A=Math.atan2(v,S),P=g.dot(o,l);return Math.abs(P)<rt.EPSILON||P>0?A:-A},g.signedAngleBetween=function(r,s,o){var l=g.cross(r,s),c=g.norm(r),d=g.norm(s),m=c*d,_=g.dot(r,s),v=g.norm(l)/m,S=_/m,A=Math.atan2(v,S),P=g.dot(o,l);return P>0?A:2*Math.PI-A},g.angleBetweenNormalized2d=function(r,s){var o=r[0]*s[1]-r[1]*s[0];return Math.atan2(o,g.dot(r,s))},g.domain=function(r){return Z.last(r)-Z.first(r)},g.range=function(r){for(var s=[],o=0,l=0;l<r;)l++,s.push(o),o+=1;return s},g.span=function(r,s,o){if(o==null)return[];if(o<rt.EPSILON)return[];if(r>s&&o>0)return[];if(s>r&&o<0)return[];for(var l=[],c=r;c<=s;)l.push(c),c+=o;return l},g.neg=function(r){return r.map(function(s){return-s})},g.min=function(r){return O.fold(r,function(s,o){return Math.min(s,o)},1/0)},g.max=function(r){return O.fold(r,function(s,o){return Math.max(s,o)},-1/0)},g.all=function(r){return O.fold(r,function(s,o){return o&&s},!0)},g.finite=function(r){return r.map(function(s){return isFinite(s)})},g.onRay=function(r,s,o){return g.add(r,g.mul(o,s))},g.lerp=function(r,s,o){return g.add(g.mul(r,s),g.mul(1-r,o))},g.normalized=function(r){return g.div(r,g.norm(r))},g.cross=function(r,s){return[r[1]*s[2]-r[2]*s[1],r[2]*s[0]-r[0]*s[2],r[0]*s[1]-r[1]*s[0]]},g.dist=function(r,s){return g.norm(g.sub(r,s))},g.distSquared=function(r,s){return g.normSquared(g.sub(r,s))},g.sum=function(r){return O.fold(r,function(s,o){return o+s},0)},g.addAll=function(r){var s=ir(r)();if(!s.hasNext())return null;var o=s.next().length;return O.fold(r,function(l,c){return g.add(c,l)},g.rep(o,0))},g.addAllMutate=function(r){for(var s=r[0],o=1,l=r.length;o<l;){var c=o++;g.addMutate(s,r[c])}},g.addMulMutate=function(r,s,o){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]+s*o[d]}},g.subMulMutate=function(r,s,o){for(var l=0,c=r.length;l<c;){var d=l++;r[d]=r[d]-s*o[d]}},g.addMutate=function(r,s){for(var o=0,l=r.length;o<l;){var c=o++;r[c]=r[c]+s[c]}},g.subMutate=function(r,s){for(var o=0,l=r.length;o<l;){var c=o++;r[c]=r[c]-s[c]}},g.mulMutate=function(r,s){for(var o=0,l=s.length;o<l;){var c=o++;s[c]=s[c]*r}},g.norm=function(r){var s=g.normSquared(r);return s!=0?Math.sqrt(s):s},g.normSquared=function(r){return O.fold(r,function(s,o){return o+s*s},0)},g.rep=function(r,s){for(var o=[],l=0;l<r;)l++,o.push(s);return o},g.zeros1d=function(r){for(var s=[],o=0;o<r;)o++,s.push(0);return s},g.zeros2d=function(r,s){for(var o=[],l=0;l<r;)l++,o.push(g.zeros1d(s));return o},g.zeros3d=function(r,s,o){for(var l=[],c=0;c<r;)c++,l.push(g.zeros2d(s,o));return l},g.dot=function(r,s){for(var o=0,l=0,c=r.length;l<c;){var d=l++;o+=r[d]*s[d]}return o},g.add=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]+s[d])}return o},g.mul=function(r,s){for(var o=[],l=0,c=s.length;l<c;){var d=l++;o.push(r*s[d])}return o},g.div=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]/s)}return o},g.sub=function(r,s){for(var o=[],l=0,c=r.length;l<c;){var d=l++;o.push(r[d]-s[d])}return o},g.isZero=function(r){for(var s=0,o=r.length;s<o;){var l=s++;if(Math.abs(r[l])>rt.TOLERANCE)return!1}return!0},g.sortedSetUnion=function(r,s){for(var o=[],l=0,c=0;l<r.length||c<s.length;){if(l>=r.length){o.push(s[c]),c++;continue}else if(c>=s.length){o.push(r[l]),l++;continue}var d=r[l]-s[c];if(Math.abs(d)<rt.EPSILON){o.push(r[l]),l++,c++;continue}if(d>0){o.push(s[c]),c++;continue}o.push(r[l]),l++}return o},g.sortedSetSub=function(r,s){for(var o=[],l=0,c=0;l<r.length;){if(c>=s.length){o.push(r[l]),l++;continue}if(Math.abs(r[l]-s[c])<rt.EPSILON){l++,c++;continue}o.push(r[l]),l++}return o};var wt=f.eval.Analyze=function(){};b["verb.eval.Analyze"]=wt,wt.__name__=["verb","eval","Analyze"],wt.knotMultiplicities=function(r){for(var s=[new jn(r[0],0)],o=s[0],l=0;l<r.length;){var c=r[l];++l,Math.abs(c-o.knot)>rt.EPSILON&&(o=new jn(c,0),s.push(o)),o.inc()}return s},wt.isRationalSurfaceClosed=function(r,s){s==null&&(s=!0);var o;s?o=r.controlPoints:o=Ct.transpose(r.controlPoints);for(var l=0,c=o[0].length;l<c;){var d=l++,m=g.dist(Z.first(o)[d],Z.last(o)[d])<rt.EPSILON;if(!m)return!1}return!0},wt.rationalSurfaceClosestPoint=function(r,s){var o=wt.rationalSurfaceClosestParam(r,s);return N.rationalSurfacePoint(r,o[0],o[1])},wt.rationalSurfaceClosestParam=function(r,s){for(var o=5,l=0,c,d=1e-4,m=5e-4,_,v=r.knotsU[0],S=Z.last(r.knotsU),A=r.knotsV[0],P=Z.last(r.knotsV),k=wt.isRationalSurfaceClosed(r),T=wt.isRationalSurfaceClosed(r,!1),M,B=Rt.rationalSurfaceAdaptive(r,new Zr),C=1/0,F=0,R=B.points.length;F<R;){var D=F++,j=B.points[D],Y=g.normSquared(g.sub(s,j));Y<C&&(C=Y,M=B.uvs[D])}for(var J=function(Xt){return N.rationalSurfaceDerivatives(r,Xt[0],Xt[1],2)},X=function(Xt,Zt,Ut){var Jt=Zt[1][0],Be=Zt[0][1],tr=Zt[2][0],Ae=Zt[0][2],Ie=Zt[1][1],Re=Zt[1][1],Ue=g.dot(Jt,Ut),sr=g.dot(Be,Ut),fr=[-Ue,-sr],ar=g.dot(Jt,Jt)+g.dot(tr,Ut),or=g.dot(Jt,Be)+g.dot(Ie,Ut),lr=g.dot(Jt,Be)+g.dot(Re,Ut),Sr=g.dot(Be,Be)+g.dot(Ae,Ut),Hn=[[ar,or],[lr,Sr]],gn=Ct.solve(Hn,fr);return g.add(gn,Xt)};l<o;){c=J(M),_=g.sub(c[0][0],s);var U=g.norm(_),$=g.dot(c[1][0],_),tt=g.norm(c[1][0])*U,et=g.dot(c[0][1],_),ot=g.norm(c[0][1])*U,ct=$/tt,ht=et/ot,pt=U<d,nt=ct<m,gt=ht<m;if(pt&&nt&>)return M;var K=X(M,c,_);K[0]<v?k?K=[S-(K[0]-v),K[1]]:K=[v+rt.EPSILON,K[1]]:K[0]>S&&(k?K=[v+(K[0]-S),K[1]]:K=[S-rt.EPSILON,K[1]]),K[1]<A?T?K=[K[0],P-(K[1]-A)]:K=[K[0],A+rt.EPSILON]:K[1]>P&&(T?K=[K[0],A+(K[0]-P)]:K=[K[0],P-rt.EPSILON]);var ft=g.norm(g.mul(K[0]-M[0],c[1][0])),kt=g.norm(g.mul(K[1]-M[1],c[0][1]));if(ft+kt<d)return M;M=K,l++}return M},wt.rationalCurveClosestPoint=function(r,s){return N.rationalCurvePoint(r,wt.rationalCurveClosestParam(r,s))},wt.rationalCurveClosestParam=function(r,s){for(var o=1/0,l=0,c=Rt.rationalCurveRegularSample(r,r.controlPoints.length*r.degree,!0),d=0,m=c.length-1;d<m;){var _=d++,v=c[_][0],S=c[_+1][0],A=c[_].slice(1),P=c[_+1].slice(1),k=De.segmentClosestPoint(s,A,P,v,S),T=g.norm(g.sub(s,k.pt));T<o&&(o=T,l=k.u)}for(var M=5,B=0,C,F=1e-4,R=5e-4,D,j=r.knots[0],Y=Z.last(r.knots),J=g.normSquared(g.sub(r.controlPoints[0],Z.last(r.controlPoints)))<rt.EPSILON,X=l,U=function(K){return N.rationalCurveDerivatives(r,K,2)},$=function(K,ft,kt){var Xt=g.dot(ft[1],kt),Zt=g.dot(ft[2],kt),Ut=g.dot(ft[1],ft[1]),Jt=Zt+Ut;return K-Xt/Jt};B<M;){C=U(X),D=g.sub(C[0],s);var tt=g.norm(D),et=g.dot(C[1],D),ot=g.norm(C[1])*tt,ct=et/ot,ht=tt<F,pt=Math.abs(ct)<R;if(ht&&pt)return X;var nt=$(X,C,D);nt<j?J?nt=Y-(nt-j):nt=j:nt>Y&&(J?nt=j+(nt-Y):nt=Y);var gt=g.norm(g.mul(nt-X,C[1]));if(gt<F)return X;X=nt,B++}return X},wt.rationalCurveParamAtArcLength=function(r,s,o,l,c){if(o==null&&(o=.001),s<rt.EPSILON)return r.knots[0];var d;l!=null?d=l:d=yt.decomposeCurveIntoBeziers(r);var m=0;d[m];var _=-rt.EPSILON,v;for(c!=null?v=c:v=[];_<s&&m<d.length;){if(m<v.length?v[m]=v[m]:v[m]=wt.rationalBezierCurveArcLength(r),_+=v[m],s<_+rt.EPSILON)return wt.rationalBezierCurveParamAtArcLength(r,s,o,v[m]);m++}return-1},wt.rationalBezierCurveParamAtArcLength=function(r,s,o,l){if(s<0)return r.knots[0];var c;if(l!=null?c=l:c=wt.rationalBezierCurveArcLength(r),s>c)return Z.last(r.knots);var d=r.knots[0],m=0,_=Z.last(r.knots),v=c,S=0,A=0,P;for(o!=null?P=o:P=rt.TOLERANCE*2;v-m>P;)S=(d+_)/2,A=wt.rationalBezierCurveArcLength(r,S),A>s?(_=S,v=A):(d=S,m=A);return(d+_)/2},wt.rationalCurveArcLength=function(r,s,o){o==null&&(o=16),s==null?s=Z.last(r.knots):s=s;for(var l=yt.decomposeCurveIntoBeziers(r),c=0,d=l[0],m=0;c<l.length&&d.knots[0]+rt.EPSILON<s;){var _=Math.min(Z.last(d.knots),s);m+=wt.rationalBezierCurveArcLength(d,_,o),d=l[++c]}return m},wt.rationalBezierCurveArcLength=function(r,s,o){o==null&&(o=16);var l;s==null?l=Z.last(r.knots):l=s;for(var c=(l-r.knots[0])/2,d=0,m=r.degree+o,_,v,S=0;S<m;){var A=S++;_=c*wt.Tvalues[m][A]+c+r.knots[0],v=N.rationalCurveDerivatives(r,_,1),d+=wt.Cvalues[m][A]*g.norm(v[1])}return c*d};var jn=f.eval.KnotMultiplicity=function(r,s){this.knot=r,this.mult=s};b["verb.eval.KnotMultiplicity"]=jn,jn.__name__=["verb","eval","KnotMultiplicity"],jn.prototype={inc:function(){this.mult++},__class__:jn};var Je=f.eval.Check=function(){};b["verb.eval.Check"]=Je,Je.__name__=["verb","eval","Check"],Je.isValidKnotVector=function(r,s){if(r.length==0||r.length<(s+1)*2)return!1;for(var o=Z.first(r),l=0,c=s+1;l<c;){var d=l++;if(Math.abs(r[d]-o)>rt.EPSILON)return!1}o=Z.last(r);for(var m=r.length-s-1,_=r.length;m<_;){var v=m++;if(Math.abs(r[v]-o)>rt.EPSILON)return!1}return Je.isNonDecreasing(r)},Je.isNonDecreasing=function(r){for(var s=Z.first(r),o=0,l=r.length;o<l;){var c=o++;if(r[c]<s-rt.EPSILON)return!1;s=r[c]}return!0},Je.isValidNurbsCurveData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degree==null)throw new Q("Degree cannot be null!");if(r.degree<1)throw new Q("Degree must be greater than 1!");if(r.knots==null)throw new Q("Knots cannot be null!");if(r.knots.length!=r.controlPoints.length+r.degree+1)throw new Q("controlPoints.length + degree + 1 must equal knots.length!");if(!Je.isValidKnotVector(r.knots,r.degree))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r},Je.isValidNurbsSurfaceData=function(r){if(r.controlPoints==null)throw new Q("Control points array cannot be null!");if(r.degreeU==null)throw new Q("DegreeU cannot be null!");if(r.degreeV==null)throw new Q("DegreeV cannot be null!");if(r.degreeU<1)throw new Q("DegreeU must be greater than 1!");if(r.degreeV<1)throw new Q("DegreeV must be greater than 1!");if(r.knotsU==null)throw new Q("KnotsU cannot be null!");if(r.knotsV==null)throw new Q("KnotsV cannot be null!");if(r.knotsU.length!=r.controlPoints.length+r.degreeU+1)throw new Q("controlPointsU.length + degreeU + 1 must equal knotsU.length!");if(r.knotsV.length!=r.controlPoints[0].length+r.degreeV+1)throw new Q("controlPointsV.length + degreeV + 1 must equal knotsV.length!");if(!Je.isValidKnotVector(r.knotsU,r.degreeU)||!Je.isValidKnotVector(r.knotsV,r.degreeV))throw new Q("Invalid knot vector format! Should begin with degree + 1 repeats and end with degree + 1 repeats!");return r};var me=f.eval.Divide=function(){};b["verb.eval.Divide"]=me,me.__name__=["verb","eval","Divide"],me.surfaceSplit=function(r,s,o){o==null&&(o=!1);var l,c,d;o?(d=r.controlPoints,l=r.knotsV,c=r.degreeV):(d=Ct.transpose(r.controlPoints),l=r.knotsU,c=r.degreeU);for(var m,_=[],v=0,S=c+1;v<S;)v++,_.push(s);m=_;for(var A=[],P=[],k=N.knotSpan(c,s,l),T=null,M=0;M<d.length;){var B=d[M];++M,T=yt.curveKnotRefine(new Ht(c,l,B),m),A.push(T.controlPoints.slice(0,k+1)),P.push(T.controlPoints.slice(k+1))}var C=T.knots.slice(0,k+c+2),F=T.knots.slice(k+1);return o?[new se(r.degreeU,c,r.knotsU.slice(),C,A),new se(r.degreeU,c,r.knotsU.slice(),F,P)]:(A=Ct.transpose(A),P=Ct.transpose(P),[new se(c,r.degreeV,C,r.knotsV.slice(),A),new se(c,r.degreeV,F,r.knotsV.slice(),P)])},me.curveSplit=function(r,s){var o=r.degree;r.controlPoints;for(var l=r.knots,c,d=[],m=0,_=o+1;m<_;)m++,d.push(s);c=d;var v=yt.curveKnotRefine(r,c),S=N.knotSpan(o,s,l),A=v.knots.slice(0,S+o+2),P=v.knots.slice(S+1),k=v.controlPoints.slice(0,S+1),T=v.controlPoints.slice(S+1);return[new Ht(o,A,k),new Ht(o,P,T)]},me.rationalCurveByEqualArcLength=function(r,s){var o=wt.rationalCurveArcLength(r),l=o/s;return me.rationalCurveByArcLength(r,l)},me.rationalCurveByArcLength=function(r,s){var o=yt.decomposeCurveIntoBeziers(r),l=o.map(function(k){return wt.rationalBezierCurveArcLength(k)}),c=g.sum(l),d=[new Un(r.knots[0],0)];if(s>c)return d;for(var m=s,_=0,v=m,S=0,A=0,P;_<o.length;){for(S+=l[_];v<S+rt.EPSILON;)P=wt.rationalBezierCurveParamAtArcLength(o[_],v-A,rt.TOLERANCE,l[_]),d.push(new Un(P,v)),v+=m;A+=l[_],_++}return d};var Un=f.eval.CurveLengthSample=function(r,s){this.u=r,this.len=s};b["verb.eval.CurveLengthSample"]=Un,Un.__name__=["verb","eval","CurveLengthSample"],Un.prototype={__class__:Un};var N=f.eval.Eval=function(){};b["verb.eval.Eval"]=N,N.__name__=["verb","eval","Eval"],N.rationalCurveTangent=function(r,s){var o=N.rationalCurveDerivatives(r,s,1);return o[1]},N.rationalSurfaceNormal=function(r,s,o){var l=N.rationalSurfaceDerivatives(r,s,o,1);return g.cross(l[1][0],l[0][1])},N.rationalSurfaceDerivatives=function(r,s,o,l){l==null&&(l=1);for(var c=N.surfaceDerivatives(r,s,o,l),d=N.rational2d(c),m=N.weight2d(c),_=[],v=d[0][0].length,S=0,A=l+1;S<A;){var P=S++;_.push([]);for(var k=0,T=l-P+1;k<T;){for(var M=k++,B=d[P][M],C=1,F=M+1;C<F;){var R=C++;g.subMulMutate(B,Vt.get(M,R)*m[0][R],_[P][M-R])}for(var D=1,j=P+1;D<j;){var Y=D++;g.subMulMutate(B,Vt.get(P,Y)*m[Y][0],_[P-Y][M]);for(var J=g.zeros1d(v),X=1,U=M+1;X<U;){var $=X++;g.addMulMutate(J,Vt.get(M,$)*m[Y][$],_[P-Y][M-$])}g.subMulMutate(B,Vt.get(P,Y),J)}g.mulMutate(1/m[0][0],B),_[P].push(B)}}return _},N.rationalSurfacePoint=function(r,s,o){return N.dehomogenize(N.surfacePoint(r,s,o))},N.rationalCurveDerivatives=function(r,s,o){o==null&&(o=1);for(var l=N.curveDerivatives(r,s,o),c=N.rational1d(l),d=N.weight1d(l),m=[],_=0,v=o+1;_<v;){for(var S=_++,A=c[S],P=1,k=S+1;P<k;){var T=P++;g.subMulMutate(A,Vt.get(S,T)*d[T],m[S-T])}g.mulMutate(1/d[0],A),m.push(A)}return m},N.rationalCurvePoint=function(r,s){return N.dehomogenize(N.curvePoint(r,s))},N.surfaceDerivatives=function(r,s,o,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2;return N.surfaceDerivativesGivenNM(c,d,r,s,o,l)},N.surfaceDerivativesGivenNM=function(r,s,o,l,c,d){var m=o.degreeU,_=o.degreeV,v=o.controlPoints,S=o.knotsU,A=o.knotsV;if(!N.areValidRelations(m,v.length,S.length)||!N.areValidRelations(_,v[0].length,A.length))throw new Q("Invalid relations between control points, knot vector, and n");var P=v[0][0].length,k;d<m?k=d:k=m;var T;d<_?T=d:T=_;for(var M=g.zeros3d(d+1,d+1,P),B=N.knotSpanGivenN(r,m,l,S),C=N.knotSpanGivenN(s,_,c,A),F=N.derivativeBasisFunctionsGivenNI(B,l,m,r,S),R=N.derivativeBasisFunctionsGivenNI(C,c,_,s,A),D=g.zeros2d(_+1,P),j=0,Y=0,J=k+1;Y<J;){for(var X=Y++,U=0,$=_+1;U<$;){var tt=U++;D[tt]=g.zeros1d(P);for(var et=0,ot=m+1;et<ot;){var ct=et++;g.addMulMutate(D[tt],F[X][ct],v[B-m+ct][C-_+tt])}}var ht=d-X;ht<T?j=ht:j=T;for(var pt=0,nt=j+1;pt<nt;){var gt=pt++;M[X][gt]=g.zeros1d(P);for(var K=0,ft=_+1;K<ft;){var kt=K++;g.addMulMutate(M[X][gt],R[gt][kt],D[kt])}}}return M},N.surfacePoint=function(r,s,o){var l=r.knotsU.length-r.degreeU-2,c=r.knotsV.length-r.degreeV-2;return N.surfacePointGivenNM(l,c,r,s,o)},N.surfacePointGivenNM=function(r,s,o,l,c){var d=o.degreeU,m=o.degreeV,_=o.controlPoints,v=o.knotsU,S=o.knotsV;if(!N.areValidRelations(d,_.length,v.length)||!N.areValidRelations(m,_[0].length,S.length))throw new Q("Invalid relations between control points, knot vector, and n");for(var A=_[0][0].length,P=N.knotSpanGivenN(r,d,l,v),k=N.knotSpanGivenN(s,m,c,S),T=N.basisFunctionsGivenKnotSpanIndex(P,l,d,v),M=N.basisFunctionsGivenKnotSpanIndex(k,c,m,S),B=P-d,C=k,F=g.zeros1d(A),R=g.zeros1d(A),D=0,j=m+1;D<j;){var Y=D++;R=g.zeros1d(A),C=k-m+Y;for(var J=0,X=d+1;J<X;){var U=J++;g.addMulMutate(R,T[U],_[B+U][C])}g.addMulMutate(F,M[Y],R)}return F},N.curveRegularSamplePoints=function(r,s){for(var o=N.curveDerivatives(r,r.knots[0],r.degree),l=1/s,c=l*l,d=o[0],m=g.mul(l,o[1]),_=g.mul(c*.5,o[2]),v=g.mul(c*l*.5,o[3]),S=g.add(_,_),A=g.add(v,v),P=g.mul(.3333333333333333,v),k=[],T=0,M=s+1;T<M;)T++,k.push(N.dehomogenize(d)),g.addAllMutate([d,m,_,P]),g.addAllMutate([m,S,v]),g.addAllMutate([S,A]),g.addAllMutate([_,v]);return k},N.curveRegularSamplePoints2=function(r,s){for(var o=N.curveDerivatives(r,r.knots[0],r.degree),l=1/s,c=l*l,d=o[0],m=g.mul(l,o[1]),_=g.mul(c*.5,o[2]),v=g.mul(c*l*.5,o[3]),S=g.add(_,_),A=g.add(v,v),P=g.mul(.3333333333333333,v),k=[],T=0,M=s+1;T<M;)T++,k.push(N.dehomogenize(d)),g.addAllMutate([d,m,_,P]),g.addAllMutate([m,S,v]),g.addAllMutate([S,A]),g.addAllMutate([_,v]);return k},N.rationalSurfaceRegularSampleDerivatives=function(r,s,o,l){for(var c=N.surfaceRegularSampleDerivatives(r,s,o,l),d=[],m=s+1,_=o+1,v=l+1,S=0;S<m;){var A=S++,P=[];d.push(P);for(var k=0;k<_;){for(var T=k++,M=c[A][T],B=N.rational2d(M),C=N.weight2d(M),F=[],R=B[0][0].length,D=0;D<v;){var j=D++;F.push([]);for(var Y=0,J=v-j;Y<J;){for(var X=Y++,U=B[j][X],$=1,tt=X+1;$<tt;){var et=$++;g.subMulMutate(U,Vt.get(X,et)*C[0][et],F[j][X-et])}for(var ot=1,ct=j+1;ot<ct;){var ht=ot++;g.subMulMutate(U,Vt.get(j,ht)*C[ht][0],F[j-ht][X]);for(var pt=g.zeros1d(R),nt=1,gt=X+1;nt<gt;){var K=nt++;g.addMulMutate(pt,Vt.get(X,K)*C[ht][K],F[j-ht][X-K])}g.subMulMutate(U,Vt.get(j,ht),pt)}g.mulMutate(1/C[0][0],U),F[j].push(U)}}P.push(F)}}return d},N.surfaceRegularSampleDerivatives=function(r,s,o,l){var c=r.degreeU,d=r.degreeV,m=r.controlPoints,_=r.knotsU,v=r.knotsV,S=m[0][0].length;(Z.last(_)-_[0])/s,(Z.last(v)-v[0])/o;for(var A=N.regularlySpacedDerivativeBasisFunctions(c,_,s),P=A.item0,k=A.item1,T=N.regularlySpacedDerivativeBasisFunctions(d,v,o),M=T.item0,B=T.item1,C=[],F=s+1,R=o+1,D=0;D<F;){var j=D++,Y=[];C.push(Y);for(var J=0;J<R;){var X=J++;Y.push(N.surfaceDerivativesGivenBasesKnotSpans(c,d,m,P[j],M[X],k[j],B[X],S,l))}}return C},N.rationalSurfaceRegularSamplePoints=function(r,s,o){return N.dehomogenize2d(N.surfaceRegularSamplePoints(r,s,o))},N.surfaceRegularSamplePoints=function(r,s,o){var l=r.degreeU,c=r.degreeV,d=r.controlPoints,m=r.knotsU,_=r.knotsV,v=d[0][0].length;(Z.last(m)-m[0])/s,(Z.last(_)-_[0])/o;for(var S=N.regularlySpacedBasisFunctions(l,m,s),A=S.item0,P=S.item1,k=N.regularlySpacedBasisFunctions(c,_,o),T=k.item0,M=k.item1,B=[],C=s+1,F=o+1,R=0;R<C;){var D=R++,j=[];B.push(j);for(var Y=0;Y<F;){var J=Y++;j.push(N.surfacePointGivenBasesKnotSpans(l,c,d,A[D],T[J],P[D],M[J],v))}}return B},N.regularlySpacedBasisFunctions=function(r,s,o){for(var l=s.length-r-2,c=(Z.last(s)-s[0])/o,d=[],m=[],_=s[0],v=N.knotSpanGivenN(l,r,_,s),S=o+1,A=0;A<S;){for(A++;_>=s[v+1];)v++;m.push(v),d.push(N.basisFunctionsGivenKnotSpanIndex(v,_,r,s)),_+=c}return new ae(m,d)},N.regularlySpacedDerivativeBasisFunctions=function(r,s,o){for(var l=s.length-r-2,c=(Z.last(s)-s[0])/o,d=[],m=[],_=s[0],v=N.knotSpanGivenN(l,r,_,s),S=o+1,A=0;A<S;){for(A++;_>=s[v+1];)v++;m.push(v),d.push(N.derivativeBasisFunctionsGivenNI(v,_,r,l,s)),_+=c}return new ae(m,d)},N.surfacePointGivenBasesKnotSpans=function(r,s,o,l,c,d,m,_){for(var v=g.zeros1d(_),S,A=l-r,P=c-s,k=0,T=s+1;k<T;){var M=k++;S=g.zeros1d(_);for(var B=0,C=r+1;B<C;){var F=B++;g.addMulMutate(S,d[F],o[A+F][P])}P++,g.addMulMutate(v,m[M],S)}return v},N.surfaceDerivativesGivenBasesKnotSpans=function(r,s,o,l,c,d,m,_,v){var S=o[0][0].length,A;v<r?A=v:A=r;var P;v<s?P=v:P=s;for(var k=g.zeros3d(A+1,P+1,S),T=g.zeros2d(s+1,S),M=0,B=0,C=A+1;B<C;){for(var F=B++,R=0,D=s+1;R<D;){var j=R++;T[j]=g.zeros1d(S);for(var Y=0,J=r+1;Y<J;){var X=Y++;g.addMulMutate(T[j],d[F][X],o[l-r+X][c-s+j])}}var U=v-F;U<P?M=U:M=P;for(var $=0,tt=M+1;$<tt;){var et=$++;k[F][et]=g.zeros1d(S);for(var ot=0,ct=s+1;ot<ct;){var ht=ot++;g.addMulMutate(k[F][et],m[et][ht],T[ht])}}}return k},N.curveDerivatives=function(r,s,o){var l=r.knots.length-r.degree-2;return N.curveDerivativesGivenN(l,r,s,o)},N.curveDerivativesGivenN=function(r,s,o,l){var c=s.degree,d=s.controlPoints,m=s.knots;if(!N.areValidRelations(c,d.length,m.length))throw new Q("Invalid relations between control points, knot vector, and n");var _=d[0].length,v;l<c?v=l:v=c;for(var S=g.zeros2d(l+1,_),A=N.knotSpanGivenN(r,c,o,m),P=N.derivativeBasisFunctionsGivenNI(A,o,c,v,m),k=0,T=v+1;k<T;)for(var M=k++,B=0,C=c+1;B<C;){var F=B++;g.addMulMutate(S[M],P[M][F],d[A-c+F])}return S},N.curvePoint=function(r,s){var o=r.knots.length-r.degree-2;return N.curvePointGivenN(o,r,s)},N.areValidRelations=function(r,s,o){return s+r+1-o==0},N.curvePointGivenN=function(r,s,o){var l=s.degree,c=s.controlPoints,d=s.knots;if(!N.areValidRelations(l,c.length,d.length))throw new Q("Invalid relations between control points, knot Array, and n");for(var m=N.knotSpanGivenN(r,l,o,d),_=N.basisFunctionsGivenKnotSpanIndex(m,o,l,d),v=g.zeros1d(c[0].length),S=0,A=l+1;S<A;){var P=S++;g.addMulMutate(v,_[P],c[m-l+P])}return v},N.volumePoint=function(r,s,o,l){var c=r.knotsU.length-r.degreeU-2,d=r.knotsV.length-r.degreeV-2,m=r.knotsW.length-r.degreeW-2;return N.volumePointGivenNML(r,c,d,m,s,o,l)},N.volumePointGivenNML=function(r,s,o,l,c,d,m){if(!N.areValidRelations(r.degreeU,r.controlPoints.length,r.knotsU.length)||!N.areValidRelations(r.degreeV,r.controlPoints[0].length,r.knotsV.length)||!N.areValidRelations(r.degreeW,r.controlPoints[0][0].length,r.knotsW.length))throw new Q("Invalid relations between control points and knot vector");for(var _=r.controlPoints,v=r.degreeU,S=r.degreeV,A=r.degreeW,P=r.knotsU,k=r.knotsV,T=r.knotsW,M=_[0][0][0].length,B=N.knotSpanGivenN(s,v,c,P),C=N.knotSpanGivenN(o,S,d,k),F=N.knotSpanGivenN(l,A,m,T),R=N.basisFunctionsGivenKnotSpanIndex(B,c,v,P),D=N.basisFunctionsGivenKnotSpanIndex(C,d,S,k),j=N.basisFunctionsGivenKnotSpanIndex(F,m,A,T),Y=B-v,J=g.zeros1d(M),X=g.zeros1d(M),U=g.zeros1d(M),$=0,tt=A+1;$<tt;){var et=$++;U=g.zeros1d(M);for(var ot=F-A+et,ct=0,ht=S+1;ct<ht;){var pt=ct++;X=g.zeros1d(M);for(var nt=C-S+pt,gt=0,K=v+1;gt<K;){var ft=gt++;g.addMulMutate(X,R[ft],_[Y+ft][nt][ot])}g.addMulMutate(U,D[pt],X)}g.addMulMutate(J,j[et],U)}return J},N.derivativeBasisFunctions=function(r,s,o){var l=N.knotSpan(s,r,o),c=o.length-1,d=c-s-1;return N.derivativeBasisFunctionsGivenNI(l,r,s,d,o)},N.derivativeBasisFunctionsGivenNI=function(r,s,o,l,c){var d=g.zeros2d(o+1,o+1),m=g.zeros1d(o+1),_=g.zeros1d(o+1),v=0,S=0;d[0][0]=1;for(var A=1,P=o+1;A<P;){var k=A++;m[k]=s-c[r+1-k],_[k]=c[r+k]-s,v=0;for(var T=0;T<k;){var M=T++;d[k][M]=_[M+1]+m[k-M],S=d[M][k-1]/d[k][M],d[M][k]=v+_[M+1]*S,v=m[k-M]*S}d[k][k]=v}for(var B=g.zeros2d(l+1,o+1),C=g.zeros2d(2,o+1),F=0,R=1,D=0,j=0,Y=0,J=0,X=0,U=0,$=o+1;U<$;){var tt=U++;B[0][tt]=d[tt][o]}for(var et=0,ot=o+1;et<ot;){var ct=et++;F=0,R=1,C[0][0]=1;for(var ht=1,pt=l+1;ht<pt;){var nt=ht++;D=0,j=ct-nt,Y=o-nt,ct>=nt&&(C[R][0]=C[F][0]/d[Y+1][j],D=C[R][0]*d[j][Y]),j>=-1?J=1:J=-j,ct-1<=Y?X=nt-1:X=o-ct;for(var gt=J,K=X+1;gt<K;){var ft=gt++;C[R][ft]=(C[F][ft]-C[F][ft-1])/d[Y+1][j+ft],D+=C[R][ft]*d[j+ft][Y]}ct<=Y&&(C[R][nt]=-C[F][nt-1]/d[Y+1][ct],D+=C[R][nt]*d[ct][Y]),B[nt][ct]=D;var kt=F;F=R,R=kt}}for(var Xt=o,Zt=1,Ut=l+1;Zt<Ut;){for(var Jt=Zt++,Be=0,tr=o+1;Be<tr;){var Ae=Be++;B[Jt][Ae]*=Xt}Xt*=o-Jt}return B},N.basisFunctions=function(r,s,o){var l=N.knotSpan(s,r,o);return N.basisFunctionsGivenKnotSpanIndex(l,r,s,o)},N.basisFunctionsGivenKnotSpanIndex=function(r,s,o,l){var c=g.zeros1d(o+1),d=g.zeros1d(o+1),m=g.zeros1d(o+1),_=0,v=0;c[0]=1;for(var S=1,A=o+1;S<A;){var P=S++;d[P]=s-l[r+1-P],m[P]=l[r+P]-s,_=0;for(var k=0;k<P;){var T=k++;v=c[T]/(m[T+1]+d[P-T]),c[T]=_+m[T+1]*v,_=d[P-T]*v}c[P]=_}return c},N.knotSpan=function(r,s,o){return N.knotSpanGivenN(o.length-r-2,r,s,o)},N.knotSpanGivenN=function(r,s,o,l){if(o>l[r+1]-rt.EPSILON)return r;if(o<l[s]+rt.EPSILON)return s;for(var c=s,d=r+1,m=Math.floor((c+d)/2);o<l[m]||o>=l[m+1];)o<l[m]?d=m:c=m,m=Math.floor((c+d)/2);return m},N.dehomogenize=function(r){for(var s=r.length,o=[],l=r[s-1],c=r.length-1,d=0;d<c;){var m=d++;o.push(r[m]/l)}return o},N.rational1d=function(r){var s=r[0].length-1;return r.map(function(o){return o.slice(0,s)})},N.rational2d=function(r){return r.map(N.rational1d)},N.weight1d=function(r){var s=r[0].length-1;return r.map(function(o){return o[s]})},N.weight2d=function(r){return r.map(N.weight1d)},N.dehomogenize1d=function(r){return r.map(N.dehomogenize)},N.dehomogenize2d=function(r){return r.map(N.dehomogenize1d)},N.homogenize1d=function(r,s){var o=r.length,l=r[0].length,c=[],d=0,m=[],_;s!=null?_=s:_=g.rep(r.length,1);for(var v=0;v<o;){var S=v++,A=[];m=r[S],d=_[S];for(var P=0;P<l;){var k=P++;A.push(m[k]*d)}A.push(d),c.push(A)}return c},N.homogenize2d=function(r,s){var o=r.length,l=[],c;if(s!=null)c=s;else{for(var d=[],m=0;m<o;)m++,d.push(g.rep(r[0].length,1));c=d}for(var _=0;_<o;){var v=_++;l.push(N.homogenize1d(r[v],c[v]))}return l};var ut=f.eval.Intersect=function(){};b["verb.eval.Intersect"]=ut,ut.__name__=["verb","eval","Intersect"],ut.surfaces=function(r,s,o){var l=Rt.rationalSurfaceAdaptive(r),c=Rt.rationalSurfaceAdaptive(s),d=ut.meshes(l,c),m=d.map(function(_){return _.map(function(v){return ut.surfacesAtPointWithEstimate(r,s,v.uv0,v.uv1,o)})});return m.map(function(_){return mt.rationalInterpCurve(_.map(function(v){return v.point}),3)})},ut.surfacesAtPointWithEstimate=function(r,s,o,l,c){var d,m,_,v,S,A,P,k,T,M,B,C,F,R=5,D=0;do{if(d=N.rationalSurfaceDerivatives(r,o[0],o[1],1),m=d[0][0],v=d[1][0],S=d[0][1],_=g.normalized(g.cross(v,S)),A=g.dot(_,m),P=N.rationalSurfaceDerivatives(s,l[0],l[1],1),k=P[0][0],M=P[1][0],B=P[0][1],T=g.normalized(g.cross(M,B)),C=g.dot(T,k),F=g.distSquared(m,k),F<c*c)break;var j=g.normalized(g.cross(_,T)),Y=g.dot(j,m),J=ut.threePlanes(_,A,T,C,j,Y);if(J==null)throw new Q("panic!");var X=g.sub(J,m),U=g.sub(J,k),$=g.cross(v,_),tt=g.cross(S,_),et=g.cross(M,T),ot=g.cross(B,T),ct=g.dot(tt,X)/g.dot(tt,v),ht=g.dot($,X)/g.dot($,S),pt=g.dot(ot,U)/g.dot(ot,M),nt=g.dot(et,U)/g.dot(et,B);o=g.add([ct,ht],o),l=g.add([pt,nt],l),D++}while(D<R);return new pi(o,l,m,F)},ut.meshes=function(r,s,o,l){o==null&&(o=new mr(r)),l==null&&(l=new mr(s));var c=ut.boundingBoxTrees(o,l,0),d=Z.unique(c.map(function(m){return ut.triangles(r,m.item0,s,m.item1)}).filter(function(m){return m!=null}).filter(function(m){return g.distSquared(m.min.point,m.max.point)>rt.EPSILON}),function(m,_){var v=g.sub(m.min.uv0,_.min.uv0),S=g.dot(v,v),A=g.sub(m.max.uv0,_.max.uv0),P=g.dot(A,A),k=g.sub(m.min.uv0,_.max.uv0),T=g.dot(k,k),M=g.sub(m.max.uv0,_.min.uv0),B=g.dot(M,M);return S<rt.EPSILON&&P<rt.EPSILON||T<rt.EPSILON&&B<rt.EPSILON});return ut.makeMeshIntersectionPolylines(d)},ut.meshSlices=function(r,s,o,l){for(var c=new $r(r),d=c.boundingBox(),m=d.min[0],_=d.min[1],v=d.max[0],S=d.max[1],A=g.span(s,o,l),P=[],k=0;k<A.length;){var T=A[k];++k;var M=[[m,_,T],[v,_,T],[v,S,T],[m,S,T]],B=[[0,0],[1,0],[1,1],[0,1]],C=[[0,1,2],[0,2,3]],F=new rr(C,M,null,B);P.push(ut.meshes(r,F,c))}return P},ut.makeMeshIntersectionPolylines=function(r){if(r.length==0)return[];for(var s=0;s<r.length;){var o=r[s];++s,o.max.opp=o.min,o.min.opp=o.max}for(var l=ut.kdTreeFromSegments(r),c=[],d=0;d<r.length;){var m=r[d];++d,c.push(m.min),c.push(m.max)}for(var _=0;_<c.length;){var v=c[_];if(++_,v.adj==null){var S=ut.lookupAdjacentSegment(v,l,r.length);S!=null&&S.adj==null&&(v.adj=S,S.adj=v)}}var A=c.filter(function(R){return R.adj==null});A.length==0&&(A=c);for(var P=[],k=0,T=!1;A.length!=0;){var M=A.pop();if(!M.visited){for(var B=[],C=M;C!=null&&!(C.visited||(C.visited=!0,C.opp.visited=!0,B.push(C),k+=2,C=C.opp.adj,C==M)););B.length>0&&(B.push(B[B.length-1].opp),P.push(B))}if(A.length==0&&c.length>0&&(T||k<c.length)){T=!0;var F=c.pop();A.push(F)}}return P},ut.kdTreeFromSegments=function(r){for(var s=[],o=0;o<r.length;){var l=r[o];++o,s.push(new zn(l.min.point,l.min)),s.push(new zn(l.max.point,l.max))}return new mi(s,g.distSquared)},ut.lookupAdjacentSegment=function(r,s,o){var l=s.nearest(r.point,o,rt.EPSILON).filter(function(c){return r!=c.item0.obj}).map(function(c){return c.item0.obj});return l.length==1?l[0]:null},ut.curveAndSurface=function(r,s,o,l,c){o==null&&(o=.001),l!=null?l=l:l=new gr(r),c!=null?c=c:c=new Kr(s);var d=ut.boundingBoxTrees(l,c,o);return Z.unique(d.map(function(m){var _=m.item0,v=m.item1,S=Z.first(_.knots),A=Z.last(_.knots),P=(S+A)/2,k=Z.first(v.knotsU),T=Z.last(v.knotsU),M=Z.first(v.knotsV),B=Z.last(v.knotsV),C=[(k+T)/2,(M+B)/2];return ut.curveAndSurfaceWithEstimate(_,v,[P].concat(C),o)}).filter(function(m){return g.distSquared(m.curvePoint,m.surfacePoint)<o*o}),function(m,_){return Math.abs(m.u-_.u)<.5*o})},ut.curveAndSurfaceWithEstimate=function(r,s,o,l){l==null&&(l=.001);var c=function(v){var S=N.rationalCurvePoint(r,v[0]),A=N.rationalSurfacePoint(s,v[1],v[2]),P=g.sub(S,A);return g.dot(P,P)},d=function(v){var S=N.rationalCurveDerivatives(r,v[0],1),A=N.rationalSurfaceDerivatives(s,v[1],v[2],1),P=g.sub(A[0][0],S[0]),k=g.mul(-1,S[1]),T=A[1][0],M=A[0][1];return[2*g.dot(k,P),2*g.dot(T,P),2*g.dot(M,P)]},m=nr.uncmin(c,o,l*l,d),_=m.solution;return new ci(_[0],[_[1],_[2]],N.rationalCurvePoint(r,_[0]),N.rationalSurfacePoint(s,_[1],_[2]))},ut.polylineAndMesh=function(r,s,o){for(var l=ut.boundingBoxTrees(new _r(r),new mr(s),o),c=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,v=m.item1,S=ut.segmentWithTriangle(r.points[_],r.points[_+1],s.points,s.faces[v]);if(S!=null){var A=S.point,P=g.lerp(S.p,[r.params[_]],[r.params[_+1]])[0],k=oe.triangleUVFromPoint(s,v,A);c.push(new di(A,P,k,_,v))}}return c},ut.boundingBoxTrees=function(r,s,o){o==null&&(o=1e-9);var l=[],c=[];l.push(r),c.push(s);for(var d=[];l.length>0;){var m=l.pop(),_=c.pop();if(!(m.empty()||_.empty())&&m.boundingBox().intersects(_.boundingBox(),o)){var v=m.indivisible(o),S=_.indivisible(o);if(v&&S){d.push(new ae(m.yield(),_.yield()));continue}else if(v&&!S){var A=_.split();l.push(m),c.push(A.item1),l.push(m),c.push(A.item0);continue}else if(!v&&S){var P=m.split();l.push(P.item1),c.push(_),l.push(P.item0),c.push(_);continue}var k=m.split(),T=_.split();l.push(k.item1),c.push(T.item1),l.push(k.item1),c.push(T.item0),l.push(k.item0),c.push(T.item1),l.push(k.item0),c.push(T.item0)}}return d},ut.curves=function(r,s,o){var l=ut.boundingBoxTrees(new gr(r),new gr(s),0);return Z.unique(l.map(function(c){return ut.curvesWithEstimate(r,s,Z.first(c.item0.knots),Z.first(c.item1.knots),o)}).filter(function(c){return g.distSquared(c.point0,c.point1)<o}),function(c,d){return Math.abs(c.u0-d.u0)<o*5})},ut.curvesWithEstimate=function(r,s,o,l,c){var d=function(k){var T=N.rationalCurvePoint(r,k[0]),M=N.rationalCurvePoint(s,k[1]),B=g.sub(T,M);return g.dot(B,B)},m=function(k){var T=N.rationalCurveDerivatives(r,k[0],1),M=N.rationalCurveDerivatives(s,k[1],1),B=g.sub(T[0],M[0]),C=T[1],F=g.mul(-1,M[1]);return[2*g.dot(C,B),2*g.dot(F,B)]},_=nr.uncmin(d,[o,l],c*c,m),v=_.solution[0],S=_.solution[1],A=N.rationalCurvePoint(r,v),P=N.rationalCurvePoint(s,S);return new dn(A,P,v,S)},ut.triangles=function(r,s,o,l){var c=r.faces[s],d=o.faces[l],m=oe.getTriangleNorm(r.points,c),_=oe.getTriangleNorm(o.points,d),v=r.points[c[0]],S=o.points[d[0]],A=ut.planes(v,m,S,_);if(A==null)return null;var P=ut.clipRayInCoplanarTriangle(A,r,s);if(P==null)return null;var k=ut.clipRayInCoplanarTriangle(A,o,l);if(k==null)return null;var T=ut.mergeTriangleClipIntervals(P,k,r,s,o,l);return T==null?null:new Ce(new qr(T.min.uv0,T.min.uv1,T.min.point,s,l),new qr(T.max.uv0,T.max.uv1,T.max.point,s,l))},ut.clipRayInCoplanarTriangle=function(r,s,o){for(var l=s.faces[o],c=[s.points[l[0]],s.points[l[1]],s.points[l[2]]],d=[s.uvs[l[0]],s.uvs[l[1]],s.uvs[l[2]]],m=[g.sub(d[1],d[0]),g.sub(d[2],d[1]),g.sub(d[0],d[2])],_=[g.sub(c[1],c[0]),g.sub(c[2],c[1]),g.sub(c[0],c[2])],v=_.map(g.normalized),S=_.map(g.norm),A=null,P=null,k=0;k<3;){var T=k++,M=c[T],B=v[T],C=ut.rays(M,B,r.origin,r.dir);if(C!=null){var F=C.u0,R=C.u1;F<-rt.EPSILON||F>S[T]+rt.EPSILON||((A==null||R<A.u)&&(A=new Fn(R,g.onRay(r.origin,r.dir,R),g.onRay(d[T],m[T],F/S[T]))),(P==null||R>P.u)&&(P=new Fn(R,g.onRay(r.origin,r.dir,R),g.onRay(d[T],m[T],F/S[T]))))}}return P==null||A==null?null:new Ce(A,P)},ut.mergeTriangleClipIntervals=function(r,s,o,l,c,d){if(s.min.u>r.max.u+rt.EPSILON||r.min.u>s.max.u+rt.EPSILON)return null;var m;r.min.u>s.min.u?m=new ae(r.min,0):m=new ae(s.min,1);var _;r.max.u<s.max.u?_=new ae(r.max,0):_=new ae(s.max,1);var v=new Ce(new qr(null,null,m.item0.point,l,d),new qr(null,null,_.item0.point,l,d));return m.item1==0?(v.min.uv0=m.item0.uv,v.min.uv1=oe.triangleUVFromPoint(c,d,m.item0.point)):(v.min.uv0=oe.triangleUVFromPoint(o,l,m.item0.point),v.min.uv1=m.item0.uv),_.item1==0?(v.max.uv0=_.item0.uv,v.max.uv1=oe.triangleUVFromPoint(c,d,_.item0.point)):(v.max.uv0=oe.triangleUVFromPoint(o,l,_.item0.point),v.max.uv1=_.item0.uv),v},ut.planes=function(r,s,o,l){var c=g.cross(s,l);if(g.dot(c,c)<rt.EPSILON)return null;var d=0,m=Math.abs(c[0]),_=Math.abs(c[1]),v=Math.abs(c[2]);_>m&&(d=1,m=_),v>m&&(d=2,m=v);var S,A,P,k;d==0?(S=s[1],A=s[2],P=l[1],k=l[2]):d==1?(S=s[0],A=s[2],P=l[0],k=l[2]):(S=s[0],A=s[1],P=l[0],k=l[1]);var T=-g.dot(r,s),M=-g.dot(o,l),B=S*k-A*P,C=(A*M-T*k)/B,F=(T*P-S*M)/B,R;return d==0?R=[0,C,F]:d==1?R=[C,0,F]:R=[C,F,0],new Rn(R,g.normalized(c))},ut.threePlanes=function(r,s,o,l,c,d){var m=g.cross(o,c),_=g.dot(r,m);if(Math.abs(_)<rt.EPSILON)return null;var v=g.sub(g.mul(d,o),g.mul(l,c)),S=g.add(g.mul(s,m),g.cross(r,v));return g.mul(1/_,S)},ut.polylines=function(r,s,o){for(var l=ut.boundingBoxTrees(new _r(r),new _r(s),o),c=[],d=0;d<l.length;){var m=l[d];++d;var _=m.item0,v=m.item1,S=ut.segments(r.points[_],r.points[_+1],s.points[v],s.points[v+1],o);S!=null&&(S.u0=g.lerp(S.u0,[r.params[_]],[r.params[_+1]])[0],S.u1=g.lerp(S.u1,[s.params[v]],[s.params[v+1]])[0],c.push(S))}return c},ut.segments=function(r,s,o,l,c){var d=g.sub(s,r),m=Math.sqrt(g.dot(d,d)),_=g.mul(1/m,d),v=g.sub(l,o),S=Math.sqrt(g.dot(v,v)),A=g.mul(1/S,v),P=ut.rays(r,_,o,A);if(P!=null){var k=Math.min(Math.max(0,P.u0/m),1),T=Math.min(Math.max(0,P.u1/S),1),M=g.onRay(r,d,k),B=g.onRay(o,v,T),C=g.distSquared(M,B);if(C<c*c)return new dn(M,B,k,T)}return null},ut.rays=function(r,s,o,l){var c=g.dot(s,l),d=g.dot(s,o),m=g.dot(s,r),_=g.dot(l,o),v=g.dot(l,r),S=g.dot(s,s),A=g.dot(l,l),P=S*A-c*c;if(Math.abs(P)<rt.EPSILON)return null;var k=c*(d-m)-S*(_-v),T=k/P,M=(d-m+T*c)/S,B=g.onRay(r,s,M),C=g.onRay(o,l,T);return new dn(B,C,M,T)},ut.segmentWithTriangle=function(r,s,o,l){var c=o[l[0]],d=o[l[1]],m=o[l[2]],_=g.sub(d,c),v=g.sub(m,c),S=g.cross(_,v),A=g.sub(s,r),P=g.sub(r,c),k=-g.dot(S,P),T=g.dot(S,A);if(Math.abs(T)<rt.EPSILON)return null;var M=k/T;if(M<0||M>1)return null;var B=g.add(r,g.mul(M,A)),C=g.dot(_,v),F=g.dot(_,_),R=g.dot(v,v),D=g.sub(B,c),j=g.dot(D,_),Y=g.dot(D,v),J=C*C-F*R;if(Math.abs(J)<rt.EPSILON)return null;var X=(C*Y-R*j)/J,U=(C*j-F*Y)/J;return X>1+rt.EPSILON||U>1+rt.EPSILON||U<-rt.EPSILON||X<-rt.EPSILON||X+U>1+rt.EPSILON?null:new gi(B,X,U,M)},ut.segmentAndPlane=function(r,s,o,l){var c=g.dot(l,g.sub(s,r));if(Math.abs(c)<rt.EPSILON)return null;var d=g.dot(l,g.sub(o,r)),m=d/c;return m>1+rt.EPSILON||m<-rt.EPSILON?null:{p:m}};var mt=f.eval.Make=function(){};b["verb.eval.Make"]=mt,mt.__name__=["verb","eval","Make"],mt.rationalTranslationalSurface=function(r,s){for(var o=N.rationalCurvePoint(s,Z.first(s.knots)),l=Z.first(s.knots),c=Z.last(s.knots),d=2*s.controlPoints.length,m=(c-l)/(d-1),_=[],v=0;v<d;){var S=v++,A=g.sub(N.rationalCurvePoint(s,l+S*m),o),P=yt.rationalCurveTransform(r,[[1,0,0,A[0]],[0,1,0,A[1]],[0,0,1,A[2]],[0,0,0,1]]);_.push(P)}return mt.loftedSurface(_)},mt.surfaceBoundaryCurves=function(r){var s=mt.surfaceIsocurve(r,Z.first(r.knotsU),!1),o=mt.surfaceIsocurve(r,Z.last(r.knotsU),!1),l=mt.surfaceIsocurve(r,Z.first(r.knotsV),!0),c=mt.surfaceIsocurve(r,Z.last(r.knotsV),!0);return[s,o,l,c]},mt.surfaceIsocurve=function(r,s,o){o==null&&(o=!1);var l;o?l=r.knotsV:l=r.knotsU;var c;o?c=r.degreeV:c=r.degreeU;for(var d=wt.knotMultiplicities(l),m=-1,_=0,v=d.length;_<v;){var S=_++;if(Math.abs(s-d[S].knot)<rt.EPSILON){m=S;break}}var A=c+1;m>=0&&(A=A-d[m].mult);var P;A>0?P=yt.surfaceKnotRefine(r,g.rep(A,s),o):P=r;var k=N.knotSpan(c,s,l);return Math.abs(s-Z.first(l))<rt.EPSILON?k=0:Math.abs(s-Z.last(l))<rt.EPSILON&&(k=(o?P.controlPoints[0].length:P.controlPoints.length)-1),o?new Ht(P.degreeU,P.knotsU,function(T){for(var M,B=[],C=0,F=P.controlPoints;C<F.length;){var R=F[C];++C,B.push(R[k])}return M=B,M}()):new Ht(P.degreeV,P.knotsV,P.controlPoints[k])},mt.loftedSurface=function(r,s){r=yt.unifyCurveKnotVectors(r);var o=r[0].degree;s==null&&(s=3),s>r.length-1&&(s=r.length-1);for(var l=r[0].knots,c=[],d=[],m=0,_=r[0].controlPoints.length;m<_;){var v=[m++],S=r.map(function(P){return function(k){return k.controlPoints[P[0]]}}(v)),A=mt.rationalInterpCurve(S,s,!0);d.push(A.controlPoints),c=A.knots}return new se(o,s,l,c,d)},mt.clonedCurve=function(r){return new Ht(r.degree,r.knots.slice(),r.controlPoints.map(function(s){return s.slice()}))},mt.rationalBezierCurve=function(r,s){for(var o=r.length-1,l=[],c=0,d=o+1;c<d;)c++,l.push(0);for(var m=0,_=o+1;m<_;)m++,l.push(1);return s==null&&(s=g.rep(r.length,1)),new Ht(o,l,N.homogenize1d(r,s))},mt.fourPointSurface=function(r,s,o,l,c){c==null&&(c=3);for(var d=c,m=[],_=0,v=c+1;_<v;){for(var S=_++,A=[],P=0,k=c+1;P<k;){var T=P++,M=1-S/d,B=g.lerp(M,r,s),C=g.lerp(M,l,o),F=g.lerp(1-T/d,B,C);F.push(1),A.push(F)}m.push(A)}var R=g.rep(c+1,0),D=g.rep(c+1,1);return new se(c,c,R.concat(D),R.concat(D),m)},mt.ellipseArc=function(r,s,o,l,c){var d=g.norm(s),m=g.norm(o);s=g.normalized(s),o=g.normalized(o),c<l&&(c=2*Math.PI+l);var _=c-l,v=0;_<=Math.PI/2?v=1:_<=Math.PI?v=2:_<=3*Math.PI/2?v=3:v=4;var S=_/v,A=Math.cos(S/2),P=g.add(r,g.add(g.mul(d*Math.cos(l),s),g.mul(m*Math.sin(l),o))),k=g.sub(g.mul(Math.cos(l),o),g.mul(Math.sin(l),s)),T=[],M=g.zeros1d(2*v+3),B=0,C=l,F=g.zeros1d(v*2);T[0]=P,F[0]=1;for(var R=1,D=v+1;R<D;){var j=R++;C+=S;var Y=g.add(r,g.add(g.mul(d*Math.cos(C),s),g.mul(m*Math.sin(C),o)));F[B+2]=1,T[B+2]=Y;var J=g.sub(g.mul(Math.cos(C),o),g.mul(Math.sin(C),s)),X=ut.rays(P,g.mul(1/g.norm(k),k),Y,g.mul(1/g.norm(J),J)),U=g.add(P,g.mul(X.u0,k));F[B+1]=A,T[B+1]=U,B+=2,j<v&&(P=Y,k=J)}for(var $=2*v+1,tt=0;tt<3;){var et=tt++;M[et]=0,M[et+$]=1}switch(v){case 2:M[3]=M[4]=.5;break;case 3:M[3]=M[4]=.3333333333333333,M[5]=M[6]=.6666666666666666;break;case 4:M[3]=M[4]=.25,M[5]=M[6]=.5,M[7]=M[8]=.75;break}return new Ht(2,M,N.homogenize1d(T,F))},mt.arc=function(r,s,o,l,c,d){return mt.ellipseArc(r,g.mul(l,g.normalized(s)),g.mul(l,g.normalized(o)),c,d)},mt.polyline=function(r){for(var s=[0,0],o=0,l=0,c=r.length-1;l<c;){var d=l++;o+=g.dist(r[d],r[d+1]),s.push(o)}s.push(o),s=g.mul(1/o,s);for(var m,_=[],v=0,S=r.length;v<S;)v++,_.push(1);return m=_,new Ht(1,s,N.homogenize1d(r.slice(0),m))},mt.extrudedSurface=function(r,s,o){for(var l=[[],[],[]],c=[[],[],[]],d=N.dehomogenize1d(o.controlPoints),m=N.weight1d(o.controlPoints),_=g.mul(s,r),v=g.mul(.5*s,r),S=0,A=d.length;S<A;){var P=S++;l[2][P]=d[P],l[1][P]=g.add(v,d[P]),l[0][P]=g.add(_,d[P]),c[0][P]=m[P],c[1][P]=m[P],c[2][P]=m[P]}return new se(2,o.degree,[0,0,0,1,1,1],o.knots,N.homogenize2d(l,c))},mt.cylindricalSurface=function(r,s,o,l,c){var d=g.cross(r,s),m=mt.arc(o,s,d,c,0,2*Math.PI);return mt.extrudedSurface(r,l,m)},mt.revolvedSurface=function(r,s,o,l){var c=N.dehomogenize1d(r.controlPoints),d=N.weight1d(r.controlPoints),m,_;l<=Math.PI/2?(m=1,_=g.zeros1d(6+2*(m-1))):l<=Math.PI?(m=2,_=g.zeros1d(6+2*(m-1)),_[3]=_[4]=.5):l<=3*Math.PI/2?(m=3,_=g.zeros1d(6+2*(m-1)),_[3]=_[4]=.3333333333333333,_[5]=_[6]=.6666666666666666):(m=4,_=g.zeros1d(6+2*(m-1)),_[3]=_[4]=.25,_[5]=_[6]=.5,_[7]=_[8]=.75);for(var v=l/m,S=3+2*(m-1),A=0;A<3;){var P=A++;_[P]=0,_[S+P]=1}for(var k=Math.cos(v/2),T=0,M=g.zeros1d(m+1),B=g.zeros1d(m+1),C=g.zeros3d(2*m+1,c.length,3),F=g.zeros2d(2*m+1,c.length),R=1,D=m+1;R<D;){var j=R++;T+=v,B[j]=Math.cos(T),M[j]=Math.sin(T)}for(var Y=0,J=c.length;Y<J;){var X=Y++,U=De.rayClosestPoint(c[X],s,o),$=g.sub(c[X],U),tt=g.norm($),et=g.cross(o,$);tt>rt.EPSILON&&($=g.mul(1/tt,$),et=g.mul(1/tt,et)),C[0][X]=c[X];var ot=c[X];F[0][X]=d[X];for(var ct=et,ht=0,pt=1,nt=m+1;pt<nt;){var gt=pt++,K;tt==0?K=U:K=g.add(U,g.add(g.mul(tt*B[gt],$),g.mul(tt*M[gt],et))),C[ht+2][X]=K,F[ht+2][X]=d[X];var ft=g.sub(g.mul(B[gt],et),g.mul(M[gt],$));if(tt==0)C[ht+1][X]=U;else{var kt=ut.rays(ot,g.mul(1/g.norm(ct),ct),K,g.mul(1/g.norm(ft),ft)),Xt=g.add(ot,g.mul(kt.u0,ct));C[ht+1][X]=Xt}F[ht+1][X]=k*d[X],ht+=2,gt<m&&(ot=K,ct=ft)}}return new se(2,r.degree,_,r.knots,N.homogenize2d(C,F))},mt.sphericalSurface=function(r,s,o,l){var c=mt.arc(r,g.mul(-1,s),o,l,0,Math.PI);return mt.revolvedSurface(c,r,s,2*Math.PI)},mt.conicalSurface=function(r,s,o,l,c){var d=2*Math.PI,m=1,_=[g.add(o,g.mul(l,r)),g.add(o,g.mul(c,s))],v=[0,0,1,1],S=[1,1],A=new Ht(m,v,N.homogenize1d(_,S));return mt.revolvedSurface(A,o,r,d)},mt.rationalInterpCurve=function(r,s,o,l,c){if(o==null&&(o=!1),s==null&&(s=3),r.length<s+1)throw new Q("You need to supply at least degree + 1 points! You only supplied "+r.length+" points.");for(var d=[0],m=1,_=r.length;m<_;){var v=m++,S=g.norm(g.sub(r[v],r[v-1])),A=d[d.length-1];d.push(A+S)}for(var P=d[d.length-1],k=0,T=d.length;k<T;){var M=k++;d[M]=d[M]/P}var B=g.rep(s+1,0),C=l!=null&&c!=null,F;C?F=0:F=1;var R;C?R=d.length-s+1:R=d.length-s;for(var D=F;D<R;){for(var j=D++,Y=0,J=0;J<s;){var X=J++;Y+=d[j+X]}B.push(1/s*Y)}var U=B.concat(g.rep(s+1,1)),$=[],tt;C?tt=r.length+1:tt=r.length-1;var et;C?et=r.length-(s-1):et=r.length-(s+1);for(var ot=0;ot<d.length;){var ct=d[ot];++ot;var ht=N.knotSpanGivenN(tt,s,ct,U),pt=N.basisFunctionsGivenKnotSpanIndex(ht,ct,s,U),nt=ht-s,gt=g.zeros1d(nt),K=g.zeros1d(et-nt);$.push(gt.concat(pt).concat(K))}if(C){var ft=$[0].length-2,kt=[-1,1].concat(g.zeros1d(ft)),Xt=g.zeros1d(ft).concat([-1,1]);Z.spliceAndInsert($,1,0,kt),Z.spliceAndInsert($,$.length-1,0,Xt)}for(var Zt=r[0].length,Ut=[],Jt=(1-U[U.length-s-2])/s,Be=U[s+1]/s,tr=0;tr<Zt;){var Ae=[tr++],Ie;if(!C)Ie=r.map(function(lr){return function(Sr){return Sr[lr[0]]}}(Ae));else{Ie=[r[0][Ae[0]]],Ie.push(Be*l[Ae[0]]);for(var Re=1,Ue=r.length-1;Re<Ue;){var sr=Re++;Ie.push(r[sr][Ae[0]])}Ie.push(Jt*c[Ae[0]]),Ie.push(Z.last(r)[Ae[0]])}var fr=Ct.solve($,Ie);Ut.push(fr)}var ar=Ct.transpose(Ut);if(!o){var or=g.rep(ar.length,1);ar=N.homogenize1d(ar,or)}return new Ht(s,U,ar)};var yt=f.eval.Modify=function(){};b["verb.eval.Modify"]=yt,yt.__name__=["verb","eval","Modify"],yt.curveReverse=function(r){return new Ht(r.degree,yt.knotsReverse(r.knots),Z.reversed(r.controlPoints))},yt.surfaceReverse=function(r,s){return s==null&&(s=!1),s?new se(r.degreeU,r.degreeV,r.knotsU,yt.knotsReverse(r.knotsV),function(o){for(var l,c=[],d=0,m=r.controlPoints;d<m.length;){var _=m[d];++d,c.push(Z.reversed(_))}return l=c,l}()):new se(r.degreeU,r.degreeV,yt.knotsReverse(r.knotsU),r.knotsV,Z.reversed(r.controlPoints))},yt.knotsReverse=function(r){var s=Z.first(r);Z.last(r);for(var o=[s],l=r.length,c=1;c<l;){var d=c++;o.push(o[d-1]+(r[l-d]-r[l-d-1]))}return o},yt.unifyCurveKnotVectors=function(r){r=r.map(mt.clonedCurve);for(var s=O.fold(r,function(U,$){return yt.imax(U.degree,$)},0),o=0,l=r.length;o<l;){var c=o++;r[c].degree<s&&(r[c]=yt.curveElevateDegree(r[c],s))}for(var d,m=[],_=0;_<r.length;){var v=r[_];++_,m.push(new Ce(Z.first(v.knots),Z.last(v.knots)))}d=m;for(var S=0,A=r.length;S<A;){var P=S++,k=[d[P].min];r[P].knots=r[P].knots.map(function(U){return function($){return $-U[0]}}(k))}for(var T=d.map(function(U){return U.max-U.min}),M=O.fold(T,function(U,$){return Math.max(U,$)},0),B=0,C=r.length;B<C;){var F=B++,R=[M/T[F]];r[F].knots=r[F].knots.map(function(U){return function($){return $*U[0]}}(R))}for(var D=O.fold(r,function(U,$){return g.sortedSetUnion(U.knots,$)},[]),j=0,Y=r.length;j<Y;){var J=j++,X=g.sortedSetSub(D,r[J].knots);X.length==0&&(r[J]=r[J]),r[J]=yt.curveKnotRefine(r[J],X)}return r},yt.imin=function(r,s){return r<s?r:s},yt.imax=function(r,s){return r>s?r:s},yt.curveElevateDegree=function(r,s){if(s<=r.degree)return r;var o=r.knots.length-r.degree-2,l=r.degree,c=r.knots,d=r.controlPoints,m=s-r.degree,_=r.controlPoints[0].length,v=g.zeros2d(l+m+1,l+1),S=[],A=[],P=[],k=o+l+1,T=s,M=Math.floor(T/2),B=[],C=[];v[0][0]=1,v[T][l]=1;for(var F=1,R=M+1;F<R;)for(var D=F++,j=1/Vt.get(T,D),Y=yt.imin(l,D),J=yt.imax(0,D-m),X=Y+1;J<X;){var U=J++;v[D][U]=j*Vt.get(l,U)*Vt.get(m,D-U)}for(var $=M+1;$<T;)for(var tt=$++,et=yt.imin(l,tt),ot=yt.imax(0,tt-m),ct=et+1;ot<ct;){var ht=ot++;v[tt][ht]=v[T-tt][l-ht]}var pt=T+1,nt=-1,gt=l,K=l+1,ft=1,kt=c[0];B[0]=d[0];for(var Xt=0,Zt=T+1;Xt<Zt;){var Ut=Xt++;C[Ut]=kt}for(var Jt=0,Be=l+1;Jt<Be;){var tr=Jt++;S[tr]=d[tr]}for(;K<k;){for(var Ae=K;K<k&&c[K]==c[K+1];)K=K+1;var Ie=K-Ae+1,Re=c[K],Ue=nt;nt=l-Ie;var sr;Ue>0?sr=Math.floor((Ue+2)/2):sr=1;var fr;if(nt>0?fr=Math.floor(T-(nt+1)/2):fr=T,nt>0){for(var ar=Re-kt,or=[],lr=l;lr>Ie;)or[lr-Ie-1]=ar/(c[gt+lr]-kt),lr--;for(var Sr=1,Hn=nt+1;Sr<Hn;){for(var gn=Sr++,Dc=nt-gn,ma=Ie+gn,mn=l;mn>=ma;)S[mn]=g.add(g.mul(or[mn-ma],S[mn]),g.mul(1-or[mn-ma],S[mn-1])),mn--;P[Dc]=S[l]}}for(var cl=sr,jc=T+1;cl<jc;){var Xn=cl++;A[Xn]=g.zeros1d(_);for(var Uc=yt.imin(l,Xn),dl=yt.imax(0,Xn-m),Wc=Uc+1;dl<Wc;){var pl=dl++;A[Xn]=g.add(A[Xn],g.mul(v[Xn][pl],S[pl]))}}if(Ue>1)for(var _a=pt-2,fa=pt,gl=Re-kt,Gc=(Re-C[pt-1])/gl,ml=1;ml<Ue;){for(var ya=ml++,Pr=_a,_n=fa,rn=_n-pt+1;_n-Pr>ya;){if(Pr<ft){var Hc=(Re-C[Pr])/(kt-C[Pr]);B[Pr]=g.lerp(Hc,B[Pr],B[Pr-1])}if(_n>=sr){if(_n-ya<=pt-T+Ue){var Xc=(Re-C[_n-ya])/gl;A[rn]=g.lerp(Xc,A[rn],A[rn+1])}}else A[rn]=g.lerp(Gc,A[rn],A[rn+1]);Pr=Pr+1,_n=_n-1,rn=rn-1}_a=_a-1,fa=fa+1}if(gt!=l)for(var _l=0,Yc=T-Ue;_l<Yc;)_l++,C[pt]=kt,pt=pt+1;for(var fl=sr,qc=fr+1;fl<qc;){var Kc=fl++;B[ft]=A[Kc],ft=ft+1}if(K<k){for(var yl=0;yl<nt;){var vl=yl++;S[vl]=P[vl]}for(var wl=nt,$c=l+1;wl<$c;){var bl=wl++;S[bl]=d[K-l+bl]}gt=K,K=K+1,kt=Re}else for(var xl=0,Zc=T+1;xl<Zc;){var Qc=xl++;C[pt+Qc]=Re}}return new Ht(s,C,B)},yt.rationalSurfaceTransform=function(r,s){for(var o=N.dehomogenize2d(r.controlPoints),l=0,c=o.length;l<c;)for(var d=l++,m=0,_=o[d].length;m<_;){var v=m++,S=o[d][v];S.push(1),o[d][v]=Ct.dot(s,S).slice(0,S.length-1)}return new se(r.degreeU,r.degreeV,r.knotsU.slice(),r.knotsV.slice(),N.homogenize2d(o,N.weight2d(r.controlPoints)))},yt.rationalCurveTransform=function(r,s){for(var o=N.dehomogenize1d(r.controlPoints),l=0,c=o.length;l<c;){var d=l++,m=o[d];m.push(1),o[d]=Ct.dot(s,m).slice(0,m.length-1)}return new Ht(r.degree,r.knots.slice(),N.homogenize1d(o,N.weight1d(r.controlPoints)))},yt.surfaceKnotRefine=function(r,s,o){var l=[],c,d,m;o?(m=r.controlPoints,c=r.knotsV,d=r.degreeV):(m=Ct.transpose(r.controlPoints),c=r.knotsU,d=r.degreeU);for(var _=null,v=0;v<m.length;){var S=m[v];++v,_=yt.curveKnotRefine(new Ht(d,c,S),s),l.push(_.controlPoints)}var A=_.knots;return o?new se(r.degreeU,r.degreeV,r.knotsU.slice(),A,l):(l=Ct.transpose(l),new se(r.degreeU,r.degreeV,A,r.knotsV.slice(),l))},yt.decomposeCurveIntoBeziers=function(r){for(var s=r.degree,o=r.controlPoints,l=r.knots,c=wt.knotMultiplicities(l),d=s+1,m=0;m<c.length;){var _=c[m];if(++m,_.mult<d){var v=g.rep(d-_.mult,_.knot),S=yt.curveKnotRefine(new Ht(s,l,o),v);l=S.knots,o=S.controlPoints}}l.length/d-1;for(var A=d*2,P=[],k=0;k<o.length;){var T=l.slice(k,k+A),M=o.slice(k,k+d);P.push(new Ht(s,T,M)),k+=d}return P},yt.curveKnotRefine=function(r,s){if(s.length==0)return mt.clonedCurve(r);for(var o=r.degree,l=r.controlPoints,c=r.knots,d=l.length-1,m=d+o+1,_=s.length-1,v=N.knotSpan(o,s[0],c),S=N.knotSpan(o,s[_],c),A=[],P=[],k=0,T=v-o+1;k<T;){var M=k++;A[M]=l[M]}for(var B=S-1,C=d+1;B<C;){var F=B++;A[F+_+1]=l[F]}for(var R=0,D=v+1;R<D;){var j=R++;P[j]=c[j]}for(var Y=S+o,J=m+1;Y<J;){var X=Y++;P[X+_+1]=c[X]}for(var U=S+o-1,$=S+o+_,tt=_;tt>=0;){for(;s[tt]<=c[U]&&U>v;)A[$-o-1]=l[U-o-1],P[$]=c[U],$=$-1,U=U-1;A[$-o-1]=A[$-o];for(var et=1,ot=o+1;et<ot;){var ct=et++,ht=$-o+ct,pt=P[$+ct]-s[tt];Math.abs(pt)<rt.EPSILON?A[ht-1]=A[ht]:(pt=pt/(P[$+ct]-c[U-o+ct]),A[ht-1]=g.add(g.mul(pt,A[ht-1]),g.mul(1-pt,A[ht])))}P[$]=s[tt],$=$-1,tt--}return new Ht(o,P,A)},yt.curveKnotInsert=function(r,s,o){for(var l=r.degree,c=r.controlPoints,d=r.knots,m=0,_=c.length,v=N.knotSpan(l,s,d),S=[],A=[],P=[],k=1,T=v+1;k<T;){var M=k++;A[M]=d[M]}for(var B=1,C=o+1;B<C;){var F=B++;A[v+F]=s}for(var R=v+1,D=d.length;R<D;){var j=R++;A[j+o]=d[j]}for(var Y=0,J=v-l+1;Y<J;){var X=Y++;P[X]=c[X]}for(var U=v-m;U<_;){var $=U++;P[$+o]=c[$]}for(var tt=0,et=l-m+1;tt<et;){var ot=tt++;S[ot]=c[v-l+ot]}for(var ct=0,ht=0,pt=1,nt=o+1;pt<nt;){var gt=pt++;ct=v-l+gt;for(var K=0,ft=l-gt-m+1;K<ft;){var kt=K++;ht=(s-d[ct+kt])/(d[kt+v+1]-d[ct+kt]),S[kt]=g.add(g.mul(ht,S[kt+1]),g.mul(1-ht,S[kt]))}P[ct]=S[0],P[v+o-gt-m]=S[l-gt-m]}for(var Xt=ct+1,Zt=v-m;Xt<Zt;){var Ut=Xt++;P[Ut]=S[Ut-ct]}return new Ht(l,A,P)};var Rt=f.eval.Tess=function(){};b["verb.eval.Tess"]=Rt,Rt.__name__=["verb","eval","Tess"],Rt.rationalCurveRegularSample=function(r,s,o){return Rt.rationalCurveRegularSampleRange(r,r.knots[0],Z.last(r.knots),s,o)},Rt.rationalCurveRegularSampleRange=function(r,s,o,l,c){l<1&&(l=2);for(var d=[],m=(o-s)/(l-1),_=0,v=0;v<l;){var S=v++;_=s+m*S,c?d.push([_].concat(N.rationalCurvePoint(r,_))):d.push(N.rationalCurvePoint(r,_))}return d},Rt.rationalCurveAdaptiveSample=function(r,s,o){if(o==null&&(o=!1),s==null&&(s=1e-6),r.degree==1)if(o){for(var l=[],c=0,d=r.controlPoints.length;c<d;){var m=c++;l.push([r.knots[m+1]].concat(N.dehomogenize(r.controlPoints[m])))}return l}else return r.controlPoints.map(N.dehomogenize);return Rt.rationalCurveAdaptiveSampleRange(r,r.knots[0],Z.last(r.knots),s,o)},Rt.rationalCurveAdaptiveSampleRange=function(r,s,o,l,c){var d=N.rationalCurvePoint(r,s),m=N.rationalCurvePoint(r,o),_=.5+.2*Math.random(),v=s+(o-s)*_,S=N.rationalCurvePoint(r,v),A=g.sub(d,m),P=g.sub(d,S);if(g.dot(A,A)<l&&g.dot(P,P)>l||!De.threePointsAreFlat(d,S,m,l)){var k=s+(o-s)*.5,T=Rt.rationalCurveAdaptiveSampleRange(r,s,k,l,c),M=Rt.rationalCurveAdaptiveSampleRange(r,k,o,l,c);return T.slice(0,-1).concat(M)}else return c?[[s].concat(d),[o].concat(m)]:[d,m]},Rt.rationalSurfaceNaive=function(r,s,o){s<1&&(s=1),o<1&&(o=1),r.degreeU,r.degreeV,r.controlPoints;for(var l=r.knotsU,c=r.knotsV,d=Z.last(l)-l[0],m=Z.last(c)-c[0],_=d/s,v=m/o,S=[],A=[],P=[],k=0,T=s+1;k<T;)for(var M=k++,B=0,C=o+1;B<C;){var F=B++,R=M*_,D=F*v;A.push([R,D]);var j=N.rationalSurfaceDerivatives(r,R,D,1),Y=j[0][0];S.push(Y);var J=g.normalized(g.cross(j[1][0],j[0][1]));P.push(J)}for(var X=[],U=0;U<s;)for(var $=U++,tt=0;tt<o;){var et=tt++,ot=$*(o+1)+et,ct=($+1)*(o+1)+et,ht=ct+1,pt=ot+1,nt=[ot,ct,ht],gt=[ot,ht,pt];X.push(nt),X.push(gt)}return new rr(X,S,P,A)},Rt.divideRationalSurfaceAdaptive=function(r,s){s==null&&(s=new Zr),s.minDivsU!=null?s.minDivsU=s.minDivsU:s.minDivsU=1,s.minDivsV!=null?s.minDivsU=s.minDivsV:s.minDivsU=1,s.refine!=null?s.refine=s.refine:s.refine=!0;var o=(r.controlPoints.length-1)*2,l=(r.controlPoints[0].length-1)*2,c;s.minDivsU>o?c=s.minDivsU=s.minDivsU:c=s.minDivsU=o;var d;s.minDivsV>l?d=s.minDivsV=s.minDivsV:d=s.minDivsV=l;for(var m=Z.last(r.knotsU),_=r.knotsU[0],v=Z.last(r.knotsV),S=r.knotsV[0],A=(m-_)/c,P=(v-S)/d,k=[],T=[],M=0,B=d+1;M<B;){for(var C=M++,F=[],R=0,D=c+1;R<D;){var j=R++,Y=_+A*j,J=S+P*C,X=N.rationalSurfaceDerivatives(r,Y,J,1),U=g.normalized(g.cross(X[0][1],X[1][0]));F.push(new Qe(X[0][0],U,[Y,J],-1,g.isZero(U)))}T.push(F)}for(var $=0;$<d;)for(var tt=$++,et=0;et<c;){var ot=et++,ct=[T[d-tt-1][ot],T[d-tt-1][ot+1],T[d-tt][ot+1],T[d-tt][ot]];k.push(new Ir(r,ct))}if(!s.refine)return k;for(var ht=0;ht<d;)for(var pt=ht++,nt=0;nt<c;){var gt=nt++,K=pt*c+gt,ft=Rt.north(K,pt,gt,c,d,k),kt=Rt.east(K,pt,gt,c,d,k),Xt=Rt.south(K,pt,gt,c,d,k),Zt=Rt.west(K,pt,gt,c,d,k);k[K].neighbors=[Xt,kt,ft,Zt],k[K].divide(s)}return k},Rt.north=function(r,s,o,l,c,d){return s==0?null:d[r-l]},Rt.south=function(r,s,o,l,c,d){return s==c-1?null:d[r+l]},Rt.east=function(r,s,o,l,c,d){return o==l-1?null:d[r+1]},Rt.west=function(r,s,o,l,c,d){return o==0?null:d[r-1]},Rt.triangulateAdaptiveRefinementNodeTree=function(r){for(var s=rr.empty(),o=0;o<r.length;){var l=r[o];++o,l.triangulate(s)}return s},Rt.rationalSurfaceAdaptive=function(r,s){s!=null?s=s:s=new Zr;var o=Rt.divideRationalSurfaceAdaptive(r,s);return Rt.triangulateAdaptiveRefinementNodeTree(o)};var Zr=f.core.AdaptiveRefinementOptions=function(){this.minDivsV=1,this.minDivsU=1,this.refine=!0,this.maxDepth=10,this.minDepth=0,this.normTol=.025};b["verb.eval.AdaptiveRefinementOptions"]=Zr,Zr.__name__=["verb","eval","AdaptiveRefinementOptions"],Zr.prototype={__class__:Zr};var Ir=f.core.AdaptiveRefinementNode=function(r,s,o){if(this.srf=r,o==null?this.neighbors=[null,null,null,null]:this.neighbors=o,this.corners=s,this.corners==null){var l=r.knotsU[0],c=Z.last(r.knotsU),d=r.knotsV[0],m=Z.last(r.knotsV);this.corners=[Qe.fromUv(l,d),Qe.fromUv(c,d),Qe.fromUv(c,m),Qe.fromUv(l,m)]}};b["verb.eval.AdaptiveRefinementNode"]=Ir,Ir.__name__=["verb","eval","AdaptiveRefinementNode"],Ir.prototype={isLeaf:function(){return this.children==null},center:function(){return this.centerPoint!=null?this.centerPoint:this.evalSrf(this.u05,this.v05)},evalCorners:function(){this.u05=(this.corners[0].uv[0]+this.corners[2].uv[0])/2,this.v05=(this.corners[0].uv[1]+this.corners[2].uv[1])/2;for(var r=0;r<4;){var s=r++;if(this.corners[s].point==null){var o=this.corners[s];this.evalSrf(o.uv[0],o.uv[1],o)}}},evalSrf:function(r,s,o){var l=N.rationalSurfaceDerivatives(this.srf,r,s,1),c=l[0][0],d=g.cross(l[0][1],l[1][0]),m=g.isZero(d);return m||(d=g.normalized(d)),o!=null?(o.degen=m,o.point=c,o.normal=d,o):new Qe(c,d,[r,s],-1,m)},getEdgeCorners:function(r){if(this.isLeaf())return[this.corners[r]];if(this.horizontal)switch(r){case 0:return this.children[0].getEdgeCorners(0);case 1:return this.children[0].getEdgeCorners(1).concat(this.children[1].getEdgeCorners(1));case 2:return this.children[1].getEdgeCorners(2);case 3:return this.children[1].getEdgeCorners(3).concat(this.children[0].getEdgeCorners(3))}switch(r){case 0:return this.children[0].getEdgeCorners(0).concat(this.children[1].getEdgeCorners(0));case 1:return this.children[1].getEdgeCorners(1);case 2:return this.children[1].getEdgeCorners(2).concat(this.children[0].getEdgeCorners(2));case 3:return this.children[0].getEdgeCorners(3)}return null},getAllCorners:function(r){var s=[this.corners[r]];if(this.neighbors[r]==null)return s;var o=this.neighbors[r].getEdgeCorners((r+2)%4),l=r%2,c=rt.EPSILON,d=this,m=[function(v){return v.uv[0]>d.corners[0].uv[0]+c&&v.uv[0]<d.corners[2].uv[0]-c},function(v){return v.uv[1]>d.corners[0].uv[1]+c&&v.uv[1]<d.corners[2].uv[1]-c}],_=o.filter(m[l]);return _.reverse(),s.concat(_)},midpoint:function(r){if(this.midPoints==null&&(this.midPoints=[null,null,null,null]),this.midPoints[r]!=null)return this.midPoints[r];switch(r){case 0:this.midPoints[0]=this.evalSrf(this.u05,this.corners[0].uv[1]);break;case 1:this.midPoints[1]=this.evalSrf(this.corners[1].uv[0],this.v05);break;case 2:this.midPoints[2]=this.evalSrf(this.u05,this.corners[2].uv[1]);break;case 3:this.midPoints[3]=this.evalSrf(this.corners[0].uv[0],this.v05);break}return this.midPoints[r]},hasBadNormals:function(){return this.corners[0].degen||this.corners[1].degen||this.corners[2].degen||this.corners[3].degen},fixNormals:function(){for(var r=this.corners.length,s=0;s<r;){var o=s++;if(this.corners[o],this.corners[o].degen){var l=this.corners[(o+1)%r],c=this.corners[(o+3)%r];l.degen?this.corners[o].normal=c.normal:this.corners[o].normal=l.normal}}},shouldDivide:function(r,s){if(s<r.minDepth)return!0;if(s>=r.maxDepth)return!1;if(this.hasBadNormals())return this.fixNormals(),!1;if(this.splitVert=g.normSquared(g.sub(this.corners[0].normal,this.corners[1].normal))>r.normTol||g.normSquared(g.sub(this.corners[2].normal,this.corners[3].normal))>r.normTol,this.splitHoriz=g.normSquared(g.sub(this.corners[1].normal,this.corners[2].normal))>r.normTol||g.normSquared(g.sub(this.corners[3].normal,this.corners[0].normal))>r.normTol,this.splitVert||this.splitHoriz)return!0;var o=this.center();return g.normSquared(g.sub(o.normal,this.corners[0].normal))>r.normTol||g.normSquared(g.sub(o.normal,this.corners[1].normal))>r.normTol||g.normSquared(g.sub(o.normal,this.corners[2].normal))>r.normTol||g.normSquared(g.sub(o.normal,this.corners[3].normal))>r.normTol},divide:function(r){r==null&&(r=new Zr),r.normTol==null&&(r.normTol=.085),r.minDepth==null&&(r.minDepth=0),r.maxDepth==null&&(r.maxDepth=10),this._divide(r,0,!0)},_divide:function(r,s,o){if(this.evalCorners(),!!this.shouldDivide(r,s)){if(s++,this.splitVert&&!this.splitHoriz?o=!1:!this.splitVert&&this.splitHoriz&&(o=!0),this.horizontal=o,this.horizontal){var l=[this.corners[0],this.corners[1],this.midpoint(1),this.midpoint(3)],c=[this.midpoint(3),this.midpoint(1),this.corners[2],this.corners[3]];this.children=[new Ir(this.srf,l),new Ir(this.srf,c)],this.children[0].neighbors=[this.neighbors[0],this.neighbors[1],this.children[1],this.neighbors[3]],this.children[1].neighbors=[this.children[0],this.neighbors[1],this.neighbors[2],this.neighbors[3]]}else{var d=[this.corners[0],this.midpoint(0),this.midpoint(2),this.corners[3]],m=[this.midpoint(0),this.corners[1],this.corners[2],this.midpoint(2)];this.children=[new Ir(this.srf,d),new Ir(this.srf,m)],this.children[0].neighbors=[this.neighbors[0],this.children[1],this.neighbors[2],this.neighbors[3]],this.children[1].neighbors=[this.neighbors[0],this.neighbors[1],this.neighbors[2],this.children[0]]}for(var _=0,v=this.children;_<v.length;){var S=v[_];++_,S._divide(r,s,!o)}}},triangulate:function(r){if(r==null&&(r=rr.empty()),this.isLeaf())return this.triangulateLeaf(r);for(var s=0,o=this.children;s<o.length;){var l=o[s];if(++s,l==null)break;l.triangulate(r)}return r},triangulateLeaf:function(r){for(var s=r.points.length,o=[],l=[],c=0,d=0;d<4;){var m=d++,_=this.getAllCorners(m);_.length==2&&(c=m+1);for(var v=0,S=_.length;v<S;){var A=v++;o.push(_[A])}}for(var P=0;P<o.length;){var k=o[P];if(++P,k.id!=-1){l.push(k.id);continue}r.uvs.push(k.uv),r.points.push(k.point),r.normals.push(k.normal),k.id=s,l.push(s),s++}if(o.length==4)return r.faces.push([l[0],l[3],l[1]]),r.faces.push([l[3],l[2],l[1]]),r;if(o.length==5){var T=l.length;return r.faces.push([l[c],l[(c+2)%T],l[(c+1)%T]]),r.faces.push([l[(c+4)%T],l[(c+3)%T],l[c]]),r.faces.push([l[c],l[(c+3)%T],l[(c+2)%T]]),r}var M=this.center();r.uvs.push(M.uv),r.points.push(M.point),r.normals.push(M.normal);for(var B=r.points.length-1,C=0,F=o.length-1;C<o.length;)r.faces.push([B,l[C],l[F]]),F=C++;return r},__class__:Ir};var It=f.exe.Dispatcher=function(){};b["verb.exe.Dispatcher"]=It,It.__name__=["verb","exe","Dispatcher"],It.init=function(){It._init||(It._workerPool=new Qr(It.THREADS),It._init=!0)},It.dispatchMethod=function(r,s,o){It.init();var l=new Cn,c=function(d){l.resolve(d)};return It._workerPool.addWork(dt.getClassName(r),s,o,c),new xe(l)};var Qr=f.exe.WorkerPool=function(r,s){s==null&&(s="verb.js"),r==null&&(r=1),this._callbacks=new xt,this._working=new xt,this._pool=[],this._queue=[];for(var o=0;o<r;){o++;var l;try{l=new Worker(Qr.basePath+s)}catch(c){c instanceof Q&&(c=c.val),l=new Worker(Qr.basePath+s.substring(0,-3)+".min.js")}this._pool.push(l)}};b["verb.exe.WorkerPool"]=Qr,Qr.__name__=["verb","exe","WorkerPool"],Qr.prototype={addWork:function(r,s,o,l){var c=new pn(r,s,o);this._callbacks.set(c.id,l),this._queue.push(c),this.processQueue()},processQueue:function(){for(var r=this;this._queue.length>0&&this._pool.length>0;){var s=this._queue.shift(),o=[s.id],l=[this._pool.shift()];this._working.h[o[0]]=l[0],l[0].onmessage=function(c,d){return function(m){r._working.remove(d[0]),r._pool.push(c[0]);try{r._callbacks.h.hasOwnProperty(d[0])&&(r._callbacks.h[d[0]](m.data.result),r._callbacks.remove(d[0]))}catch(_){_ instanceof Q&&(_=_.val),y.log(_)}r.processQueue()}}(l,o),l[0].postMessage(s)}},__class__:Qr};var pn=function(r,s,o){this.className=r,this.methodName=s,this.args=o,this.id=pn.uuid++};b["verb.exe._WorkerPool.Work"]=pn,pn.__name__=["verb","exe","_WorkerPool","Work"],pn.prototype={__class__:pn};var Wn=function(){};b["verb.geom.ICurve"]=Wn,Wn.__name__=["verb","geom","ICurve"],Wn.__interfaces__=[Dn],Wn.prototype={__class__:Wn};var Ot=f.geom.NurbsCurve=function(r){this._data=Je.isValidNurbsCurveData(r)};b["verb.geom.NurbsCurve"]=Ot,Ot.__name__=["verb","geom","NurbsCurve"],Ot.__interfaces__=[Wn],Ot.byKnotsControlPointsWeights=function(r,s,o,l){return new Ot(new Ht(r,s.slice(),N.homogenize1d(o,l)))},Ot.byPoints=function(r,s){return s==null&&(s=3),new Ot(mt.rationalInterpCurve(r,s))},Ot.__super__=ee,Ot.prototype=I(ee.prototype,{degree:function(){return this._data.degree},knots:function(){return this._data.knots.slice(0)},controlPoints:function(){return N.dehomogenize1d(this._data.controlPoints)},weights:function(){return N.weight1d(this._data.controlPoints)},asNurbs:function(){return new Ht(this.degree(),this.knots(),N.homogenize1d(this.controlPoints(),this.weights()))},clone:function(){return new Ot(this._data)},domain:function(){return new Ce(Z.first(this._data.knots),Z.last(this._data.knots))},transform:function(r){return new Ot(yt.rationalCurveTransform(this._data,r))},transformAsync:function(r){return It.dispatchMethod(yt,"rationalCurveTransform",[this._data,r]).then(function(s){return new Ot(s)})},point:function(r){return N.rationalCurvePoint(this._data,r)},pointAsync:function(r){return It.dispatchMethod(N,"rationalCurvePoint",[this._data,r])},tangent:function(r){return N.rationalCurveTangent(this._data,r)},tangentAsync:function(r){return It.dispatchMethod(N,"rationalCurveTangent",[this._data,r])},derivatives:function(r,s){return s==null&&(s=1),N.rationalCurveDerivatives(this._data,r,s)},derivativesAsync:function(r,s){return s==null&&(s=1),It.dispatchMethod(N,"rationalCurveDerivatives",[this._data,r,s])},closestPoint:function(r){return wt.rationalCurveClosestPoint(this._data,r)},closestPointAsync:function(r){return It.dispatchMethod(wt,"rationalCurveClosestPoint",[this._data,r])},closestParam:function(r){return wt.rationalCurveClosestParam(this._data,r)},closestParamAsync:function(r){return It.dispatchMethod(wt,"rationalCurveClosestParam",[this._data,r])},length:function(){return wt.rationalCurveArcLength(this._data)},lengthAsync:function(){return It.dispatchMethod(wt,"rationalCurveArcLength",[this._data])},lengthAtParam:function(r){return wt.rationalCurveArcLength(this._data,r)},lengthAtParamAsync:function(){return It.dispatchMethod(wt,"rationalCurveArcLength",[this._data])},paramAtLength:function(r,s){return wt.rationalCurveParamAtArcLength(this._data,r,s)},paramAtLengthAsync:function(r,s){return It.dispatchMethod(wt,"rationalCurveParamAtArcLength",[this._data,r,s])},divideByEqualArcLength:function(r){return me.rationalCurveByEqualArcLength(this._data,r)},divideByEqualArcLengthAsync:function(r){return It.dispatchMethod(me,"rationalCurveByEqualArcLength",[this._data,r])},divideByArcLength:function(r){return me.rationalCurveByArcLength(this._data,r)},divideByArcLengthAsync:function(r){return It.dispatchMethod(me,"rationalCurveByArcLength",[this._data,r])},split:function(r){return me.curveSplit(this._data,r).map(function(s){return new Ot(s)})},splitAsync:function(r){return It.dispatchMethod(me,"curveSplit",[this._data,r]).then(function(s){return s.map(function(o){return new Ot(o)})})},reverse:function(){return new Ot(yt.curveReverse(this._data))},reverseAsync:function(){return It.dispatchMethod(yt,"curveReverse",[this._data]).then(function(r){return new Ot(r)})},tessellate:function(r){return Rt.rationalCurveAdaptiveSample(this._data,r,!1)},tessellateAsync:function(r){return It.dispatchMethod(Rt,"rationalCurveAdaptiveSample",[this._data,r,!1])},__class__:Ot});var Jr=f.geom.Arc=function(r,s,o,l,c,d){Ot.call(this,mt.arc(r,s,o,l,c,d)),this._center=r,this._xaxis=s,this._yaxis=o,this._radius=l,this._minAngle=c,this._maxAngle=d};b["verb.geom.Arc"]=Jr,Jr.__name__=["verb","geom","Arc"],Jr.__super__=Ot,Jr.prototype=I(Ot.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},radius:function(){return this._radius},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:Jr});var vi=f.geom.BezierCurve=function(r,s){Ot.call(this,mt.rationalBezierCurve(r,s))};b["verb.geom.BezierCurve"]=vi,vi.__name__=["verb","geom","BezierCurve"],vi.__super__=Ot,vi.prototype=I(Ot.prototype,{__class__:vi});var wi=f.geom.Circle=function(r,s,o,l){Jr.call(this,r,s,o,l,0,Math.PI*2)};b["verb.geom.Circle"]=wi,wi.__name__=["verb","geom","Circle"],wi.__super__=Jr,wi.prototype=I(Jr.prototype,{__class__:wi});var Gn=function(){};b["verb.geom.ISurface"]=Gn,Gn.__name__=["verb","geom","ISurface"],Gn.__interfaces__=[Dn],Gn.prototype={__class__:Gn};var Tt=f.geom.NurbsSurface=function(r){this._data=Je.isValidNurbsSurfaceData(r)};b["verb.geom.NurbsSurface"]=Tt,Tt.__name__=["verb","geom","NurbsSurface"],Tt.__interfaces__=[Gn],Tt.byKnotsControlPointsWeights=function(r,s,o,l,c,d){return new Tt(new se(r,s,o,l,N.homogenize2d(c,d)))},Tt.byCorners=function(r,s,o,l){return new Tt(mt.fourPointSurface(r,s,o,l))},Tt.byLoftingCurves=function(r,s){return new Tt(mt.loftedSurface(function(o){for(var l,c=[],d=0;d<r.length;){var m=r[d];++d,c.push(m.asNurbs())}return l=c,l}(),s))},Tt.__super__=ee,Tt.prototype=I(ee.prototype,{degreeU:function(){return this._data.degreeU},degreeV:function(){return this._data.degreeV},knotsU:function(){return this._data.knotsU.slice(0)},knotsV:function(){return this._data.knotsV.slice(0)},controlPoints:function(){return N.dehomogenize2d(this._data.controlPoints)},weights:function(){return N.weight2d(this._data.controlPoints)},asNurbs:function(){return new se(this.degreeU(),this.degreeV(),this.knotsU(),this.knotsV(),N.homogenize2d(this.controlPoints(),this.weights()))},clone:function(){return new Tt(this.asNurbs())},domainU:function(){return new Ce(Z.first(this._data.knotsU),Z.last(this._data.knotsU))},domainV:function(){return new Ce(Z.first(this._data.knotsV),Z.last(this._data.knotsV))},point:function(r,s){return N.rationalSurfacePoint(this._data,r,s)},pointAsync:function(r,s){return It.dispatchMethod(N,"rationalSurfacePoint",[this._data,r,s])},normal:function(r,s){return N.rationalSurfaceNormal(this._data,r,s)},normalAsync:function(r,s){return It.dispatchMethod(N,"rationalSurfaceNormal",[this._data,r,s])},derivatives:function(r,s,o){return o==null&&(o=1),N.rationalSurfaceDerivatives(this._data,r,s,o)},derivativesAsync:function(r,s,o){return o==null&&(o=1),It.dispatchMethod(N,"rationalSurfaceDerivatives",[this._data,r,s,o])},closestParam:function(r){return wt.rationalSurfaceClosestParam(this._data,r)},closestParamAsync:function(r){return It.dispatchMethod(wt,"rationalSurfaceClosestParam",[this._data,r])},closestPoint:function(r){return wt.rationalSurfaceClosestPoint(this._data,r)},closestPointAsync:function(r){return It.dispatchMethod(wt,"rationalSurfaceClosestPoint",[this._data,r])},split:function(r,s){return s==null&&(s=!1),me.surfaceSplit(this._data,r,s).map(function(o){return new Tt(o)})},splitAsync:function(r,s){return s==null&&(s=!1),It.dispatchMethod(me,"surfaceSplit",[this._data,r,s]).then(function(o){return o.map(function(l){return new Tt(l)})})},reverse:function(r){return r==null&&(r=!1),new Tt(yt.surfaceReverse(this._data,r))},reverseAsync:function(r){return r==null&&(r=!1),It.dispatchMethod(yt,"surfaceReverse",[this._data,r]).then(function(s){return new Tt(s)})},isocurve:function(r,s){return s==null&&(s=!1),new Ot(mt.surfaceIsocurve(this._data,r,s))},isocurveAsync:function(r,s){return s==null&&(s=!1),It.dispatchMethod(mt,"surfaceIsocurve",[this._data,r,s]).then(function(o){return new Ot(o)})},boundaries:function(r){return mt.surfaceBoundaryCurves(this._data).map(function(s){return new Ot(s)})},boundariesAsync:function(r){return It.dispatchMethod(mt,"surfaceBoundaryCurves",[this._data]).then(function(s){return s.map(function(o){return new Ot(o)})})},tessellate:function(r){return Rt.rationalSurfaceAdaptive(this._data,r)},tessellateAsync:function(r){return It.dispatchMethod(Rt,"rationalSurfaceAdaptive",[this._data,r])},transform:function(r){return new Tt(yt.rationalSurfaceTransform(this._data,r))},transformAsync:function(r){return It.dispatchMethod(yt,"rationalSurfaceTransform",[this._data,r]).then(function(s){return new Tt(s)})},__class__:Tt});var bi=f.geom.ConicalSurface=function(r,s,o,l,c){Tt.call(this,mt.conicalSurface(r,s,o,l,c)),this._axis=r,this._xaxis=s,this._base=o,this._height=l,this._radius=c};b["verb.geom.ConicalSurface"]=bi,bi.__name__=["verb","geom","ConicalSurface"],bi.__super__=Tt,bi.prototype=I(Tt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:bi});var xi=f.geom.CylindricalSurface=function(r,s,o,l,c){Tt.call(this,mt.cylindricalSurface(r,s,o,l,c)),this._axis=r,this._xaxis=s,this._base=o,this._height=l,this._radius=c};b["verb.geom.CylindricalSurface"]=xi,xi.__name__=["verb","geom","CylindricalSurface"],xi.__super__=Tt,xi.prototype=I(Tt.prototype,{axis:function(){return this._axis},xaxis:function(){return this._xaxis},base:function(){return this._base},height:function(){return this._height},radius:function(){return this._radius},__class__:xi});var tn=f.geom.EllipseArc=function(r,s,o,l,c){Ot.call(this,mt.ellipseArc(r,s,o,l,c)),this._center=r,this._xaxis=s,this._yaxis=o,this._minAngle=l,this._maxAngle=c};b["verb.geom.EllipseArc"]=tn,tn.__name__=["verb","geom","EllipseArc"],tn.__super__=Ot,tn.prototype=I(Ot.prototype,{center:function(){return this._center},xaxis:function(){return this._xaxis},yaxis:function(){return this._yaxis},minAngle:function(){return this._minAngle},maxAngle:function(){return this._maxAngle},__class__:tn});var Ii=f.geom.Ellipse=function(r,s,o){tn.call(this,r,s,o,0,Math.PI*2)};b["verb.geom.Ellipse"]=Ii,Ii.__name__=["verb","geom","Ellipse"],Ii.__super__=tn,Ii.prototype=I(tn.prototype,{__class__:Ii});var Si=f.geom.ExtrudedSurface=function(r,s){Tt.call(this,mt.extrudedSurface(g.normalized(s),g.norm(s),r.asNurbs())),this._profile=r,this._direction=s};b["verb.geom.ExtrudedSurface"]=Si,Si.__name__=["verb","geom","ExtrudedSurface"],Si.__super__=Tt,Si.prototype=I(Tt.prototype,{profile:function(){return this._profile},direction:function(){return this._direction},__class__:Si});var en=f.geom.Intersect=function(){};b["verb.geom.Intersect"]=en,en.__name__=["verb","geom","Intersect"],en.curves=function(r,s,o){return o==null&&(o=.001),ut.curves(r.asNurbs(),s.asNurbs(),o)},en.curvesAsync=function(r,s,o){return o==null&&(o=.001),It.dispatchMethod(ut,"curves",[r.asNurbs(),s.asNurbs(),o])},en.curveAndSurface=function(r,s,o){return o==null&&(o=.001),ut.curveAndSurface(r.asNurbs(),s.asNurbs(),o)},en.curveAndSurfaceAsync=function(r,s,o){return o==null&&(o=.001),It.dispatchMethod(ut,"curveAndSurface",[r.asNurbs(),s.asNurbs(),o])},en.surfaces=function(r,s,o){return o==null&&(o=.001),ut.surfaces(r.asNurbs(),s.asNurbs(),o).map(function(l){return new Ot(l)})},en.surfacesAsync=function(r,s,o){return o==null&&(o=.001),It.dispatchMethod(ut,"surfaces",[r.asNurbs(),s.asNurbs(),o]).then(function(l){return l.map(function(c){return new Ot(c)})})};var Pi=f.geom.Line=function(r,s){Ot.call(this,mt.polyline([r,s])),this._start=r,this._end=s};b["verb.geom.Line"]=Pi,Pi.__name__=["verb","geom","Line"],Pi.__super__=Ot,Pi.prototype=I(Ot.prototype,{start:function(){return this._start},end:function(){return this._end},__class__:Pi});var Ai=f.geom.RevolvedSurface=function(r,s,o,l){Tt.call(this,mt.revolvedSurface(r.asNurbs(),s,o,l)),this._profile=r,this._center=s,this._axis=o,this._angle=l};b["verb.geom.RevolvedSurface"]=Ai,Ai.__name__=["verb","geom","RevolvedSurface"],Ai.__super__=Tt,Ai.prototype=I(Tt.prototype,{profile:function(){return this._profile},center:function(){return this._center},axis:function(){return this._center},angle:function(){return this._angle},__class__:Ai});var Ei=f.geom.SphericalSurface=function(r,s){Tt.call(this,mt.sphericalSurface(r,[0,0,1],[1,0,0],s)),this._center=r,this._radius=s};b["verb.geom.SphericalSurface"]=Ei,Ei.__name__=["verb","geom","SphericalSurface"],Ei.__super__=Tt,Ei.prototype=I(Tt.prototype,{center:function(){return this._center},radius:function(){return this._radius},__class__:Ei});var ki=f.geom.SweptSurface=function(r,s){Tt.call(this,mt.rationalTranslationalSurface(r.asNurbs(),s.asNurbs())),this._profile=r,this._rail=s};b["verb.geom.SweptSurface"]=ki,ki.__name__=["verb","geom","SweptSurface"],ki.__super__=Tt,ki.prototype=I(Tt.prototype,{profile:function(){return this._profile},rail:function(){return this._rail},__class__:ki});function ir(r){return r instanceof Array?function(){return L.iter(r)}:typeof r.iterator=="function"?je(r,r.iterator):r.iterator}var da,Fc=0;function je(r,s){if(s==null)return null;s.__id__==null&&(s.__id__=Fc++);var o;return r.hx__closures__==null?r.hx__closures__={}:o=r.hx__closures__[s.__id__],o==null&&(o=function(){return o.method.apply(o.scope,arguments)},o.scope=r,o.method=s,r.hx__closures__[s.__id__]=o),o}b.Math=Math,String.prototype.__class__=b.String=String,String.__name__=["String"],b.Array=Array,Array.__name__=["Array"],Date.prototype.__class__=b.Date=Date,Date.__name__=["Date"];var zc=b.Int={__name__:["Int"]},Vc=b.Dynamic={__name__:["Dynamic"]},ol=b.Float=Number;ol.__name__=["Float"];var ll=b.Bool=Boolean;ll.__ename__=["Bool"];var hl=b.Class={__name__:["Class"]},ul={};Array.prototype.map==null&&(Array.prototype.map=function(r){for(var s=[],o=0,l=this.length;o<l;){var c=o++;s[c]=r(this[c])}return s}),Array.prototype.filter==null&&(Array.prototype.filter=function(r){for(var s=[],o=0,l=this.length;o<l;){var c=o++,d=this[c];r(d)&&s.push(d)}return s});var pa={},ps=x.ArrayBuffer||ge;ps.prototype.slice==null&&(ps.prototype.slice=ge.sliceImpl),x.DataView;var ga=x.Uint8Array||pr._new;(function(r,s){if(r.setImmediate)return;var o=1,l={},c=!1,d=r.document,m;function _(R){return l[o]=v.apply(s,R),o++}function v(R){var D=[].slice.call(arguments,1);return function(){typeof R=="function"?R.apply(s,D):new Function(""+R)()}}function S(R){if(c)setTimeout(v(S,R),0);else{var D=l[R];if(D){c=!0;try{D()}finally{A(R),c=!1}}}}function A(R){delete l[R]}function P(){m=function(){var R=_(arguments);return process.nextTick(v(S,R)),R}}function k(){if(r.postMessage&&!r.importScripts){var R=!0,D=r.onmessage;return r.onmessage=function(){R=!1},r.postMessage("","*"),r.onmessage=D,R}}function T(){var R="setImmediate$"+Math.random()+"$",D=function(j){j.source===r&&typeof j.data=="string"&&j.data.indexOf(R)===0&&S(+j.data.slice(R.length))};r.addEventListener?r.addEventListener("message",D,!1):r.attachEvent("onmessage",D),m=function(){var j=_(arguments);return r.postMessage(R+j,"*"),j}}function M(){var R=new MessageChannel;R.port1.onmessage=function(D){var j=D.data;S(j)},m=function(){var D=_(arguments);return R.port2.postMessage(D),D}}function B(){var R=d.documentElement;m=function(){var D=_(arguments),j=d.createElement("script");return j.onreadystatechange=function(){S(D),j.onreadystatechange=null,R.removeChild(j),j=null},R.appendChild(j),D}}function C(){m=function(){var R=_(arguments);return setTimeout(v(S,R),0),R}}var F=Object.getPrototypeOf&&Object.getPrototypeOf(r);F=F&&F.setTimeout?F:r,{}.toString.call(r.process)==="[object process]"?P():k()?T():r.MessageChannel?M():d&&"onreadystatechange"in d.createElement("script")?B():C(),F.setImmediate=m,F.clearImmediate=A})(new Function("return this")()),$t.USE_CACHE=!1,$t.USE_ENUM_INDEX=!1,$t.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Yt.DEFAULT_RESOLVER=dt,Yt.BASE64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%:",Bt.count=0,pe.i64tmp=function(r){var s,o=new Gt(0,0);return s=o,s}(),Lt.__toStr={}.toString,pr.BYTES_PER_ELEMENT=1,At.queue=new V,Vt.memo=new xt,rt.TOLERANCE=1e-6,rt.EPSILON=1e-10,rt.VERSION="2.0.0",wt.Tvalues=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],wt.Cvalues=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],It.THREADS=1,It._init=!1,Qr.basePath="",pn.uuid=0,cs.main()}(typeof console<"u"?console:{log:function(){}},e,typeof u<"u"?u:typeof i<"u"?i:typeof self<"u"?self:this),e})})(zh);var bd=zh.exports;const qn=wd(bd);class Sa{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,i,a){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-a,this.c3=2*t-2*e+i+a}initCatmullRom(t,e,i,a,h){this.init(e,i,h*(i-t),h*(a-e))}initNonuniformCatmullRom(t,e,i,a,h,u,p){let y=(e-t)/h-(i-t)/(h+u)+(i-e)/u,f=(i-e)/u-(a-e)/(u+p)+(a-i)/p;y*=u,f*=u,this.init(e,i,y,f)}calc(t){const e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i}}let Vh=class extends os{constructor(t=[],e=!1,i="centripetal",a=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new q,this._px=new Sa,this._py=new Sa,this._pz=new Sa,this._points=t.map(h=>new W(h)),this._closed=e,this._curveType=i,this._tension=a}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new W}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new W}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new W){const i=e,a=this._points,h=a.length;if(h===0)return i.set(0,0,0);if(h===1)return i.copy(a[0]);const u=(h-(this._closed?0:1))*t;let p=Math.floor(u),y=u-p;this._closed?p+=p>0?0:(Math.floor(Math.abs(p)/h)+1)*h:y===0&&p===h-1&&(p=h-2,y=1);let f,x;this._closed||p>0?f=a[(p-1)%h]:(this._tmp.subVectors(a[0],a[1]).add(a[0]),f=new W(this._tmp.x,this._tmp.y,this._tmp.z));const b=a[p%h],E=a[(p+1)%h];if(this._closed||p+2<h?x=a[(p+2)%h]:(this._tmp.subVectors(a[h-1],a[h-2]).add(a[h-1]),x=new W(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const I=this._curveType==="chordal"?.5:.25;let L=Math.pow(f.distanceToSquared(b),I),O=Math.pow(b.distanceToSquared(E),I),V=Math.pow(E.distanceToSquared(x),I);O<1e-4&&(O=1),L<1e-4&&(L=O),V<1e-4&&(V=O),this._px.initNonuniformCatmullRom(f.x,b.x,E.x,x.x,L,O,V),this._py.initNonuniformCatmullRom(f.y,b.y,E.y,x.y,L,O,V),this._pz.initNonuniformCatmullRom(f.z,b.z,E.z,x.z,L,O,V)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(f.x,b.x,E.x,x.x,this._tension),this._py.initCatmullRom(f.y,b.y,E.y,x.y,this._tension),this._pz.initCatmullRom(f.z,b.z,E.z,x.z,this._tension));return i.set(this._px.calc(y),this._py.calc(y),this._pz.calc(y)),i}getPoints(t){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}setPoints(t){this._points=t.map(e=>new W(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const i=new W;return i.copy(e),i.applyMatrix4(t),i}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new Nt;const t=new Nt;return this._points.forEach(e=>{t.expandByPoint(e)}),t}};class kn{constructor(t,e,i,a){this._degree=t,this._knots=[...e],this._controlPoints=i.map(h=>({x:h.x,y:h.y,z:h.z})),this._weights=a?[...a]:new Array(i.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(i=>[i.x,i.y,i.z]);return $i(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return Nh(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,i,a){return new kn(t,e,i,a)}static byPoints(t,e,i="Uniform"){let a;switch(i){case"Chord":a=Th(e,t);break;case"SqrtChord":a=Mh(e,t);break;case"Uniform":default:a=kh(e,t.length);break}const h=t.map(p=>({x:p[0],y:p[1],z:p[2]})),u=new Array(h.length).fill(1);return new kn(e,a,h,u)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:i,end:a}=this.getParameterRange();for(let h=0;h<=t;h++){const u=i+(a-i)*(h/t);e.push(this.point(u))}return e}isClosed(t=1e-6){const{start:e,end:i}=this.getParameterRange(),a=this.point(e),h=this.point(i),u=a[0]-h[0],p=a[1]-h[1],y=a[2]-h[2];return Math.sqrt(u*u+p*p+y*y)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Vh(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)}static createClosedCurve(t,e,i="Chord"){const a=this.createFitPointsForClosedCurve(t).map(h=>[h.x,h.y,h.z]);return kn.byPoints(a,e,i)}}class Wr extends os{constructor(t,e,i,a,h){super();const u=arguments.length;if(u<2||u>5)throw Ze.ILLEGAL_PARAMETERS;if(this._degree=3,this._closed=!1,Array.isArray(e)){this._controlPoints=t;let p,y=3,f=!1;if(u>=3&&(Array.isArray(i)?(p=i,u>=4&&(y=a||3),u>=5&&(f=h)):i!==void 0&&(y=i||3,u>=4&&(f=a))),i===void 0&&u>=4&&(y=a||3,u>=5&&(f=h)),this._degree=y,this._closed=f,this._controlPoints.length<this._degree+1)throw Ze.ILLEGAL_PARAMETERS;const x=this.toVerbPoints(this._controlPoints);this._nurbsCurve=qn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,e,x,p)}else{if(this._fitPoints=t,this._knotParameterization=e,u>=3&&(this._degree=i||3),u>=4&&(this._closed=a),this._fitPoints.length<this._degree+1)throw Ze.ILLEGAL_PARAMETERS;const p=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=qn.geom.NurbsCurve.byPoints(p,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=kn.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=qn.geom.NurbsCurve.byPoints(e,this._degree)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=qn.geom.NurbsCurve.byPoints(t,this._degree)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else if(this._controlPoints)if(this._closed){const t=kn.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=qn.geom.NurbsCurve.byPoints(e,this._degree),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints())}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights(),i=this.toVerbPoints(this._controlPoints);this._nurbsCurve=qn.geom.NurbsCurve.byKnotsControlPointsWeights(this._degree,t,i,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),i=t[e],a=this._nurbsCurve.point(i);return new W(a[0],a[1],a[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),i=t[t.length-e-1],a=this._nurbsCurve.point(i);return new W(a[0],a[1],a[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,i=t<0||t>=e?e-1:t,a=this._fitPoints[i];return{x:a.x,y:a.y,z:a.z||0}}getControlPointAt(t){const e=this._controlPoints.length,i=t<0||t>=e?e-1:t;return this._controlPoints[i]}getPoints(t=100){const e=this._nurbsCurve,i=[],a=e.knots(),h=this._nurbsCurve.degree(),u=a[h],p=a[a.length-h-1],y=(p-u)/(t-1);for(let f=0;f<t;f++){const x=f===t-1?p:u+f*y,b=e.point(x);i.push(new W(b[0],b[1],b[2]))}return i}getCurvePoints(t,e){const i=[],a=t.knots(),h=a[3],u=(a[a.length-4]-h)/(e-1);for(let p=0;p<e;p++){const y=h+p*u;i.push(t.point(y))}return i}calculateBoundingBox(){const t=this.getPoints(100);return new Nt().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((i,a)=>{e[a]=[i.x,i.y,i.z||0]}),e}toVerbPoints(t){const e=new Array(t.length);return t.forEach((i,a)=>{e[a]=[i.x,i.y,i.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((i,a)=>{e[a]={x:i[0],y:i[1],z:i[2]}}),e}static createClosedSpline(t,e="Uniform",i=3){if(t.length<i+1)throw new Error(`At least ${i+1} points are required for a degree ${i} closed spline`);return new Wr(t,e,i,!0)}}var po=(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))(po||{}),Nn=(n=>(n[n.ByBlock=-2]="ByBlock",n[n.ByDIPs=-4]="ByDIPs",n[n.ByLayer=-1]="ByLayer",n[n.ByLineWeightDefault=-3]="ByLineWeightDefault",n[n.LineWeight000=0]="LineWeight000",n[n.LineWeight005=5]="LineWeight005",n[n.LineWeight009=9]="LineWeight009",n[n.LineWeight013=13]="LineWeight013",n[n.LineWeight015=15]="LineWeight015",n[n.LineWeight018=18]="LineWeight018",n[n.LineWeight020=20]="LineWeight020",n[n.LineWeight025=25]="LineWeight025",n[n.LineWeight030=30]="LineWeight030",n[n.LineWeight035=35]="LineWeight035",n[n.LineWeight040=40]="LineWeight040",n[n.LineWeight050=50]="LineWeight050",n[n.LineWeight053=53]="LineWeight053",n[n.LineWeight060=60]="LineWeight060",n[n.LineWeight070=70]="LineWeight070",n[n.LineWeight080=80]="LineWeight080",n[n.LineWeight090=90]="LineWeight090",n[n.LineWeight100=100]="LineWeight100",n[n.LineWeight106=106]="LineWeight106",n[n.LineWeight120=120]="LineWeight120",n[n.LineWeight140=140]="LineWeight140",n[n.LineWeight158=158]="LineWeight158",n[n.LineWeight200=200]="LineWeight200",n[n.LineWeight211=211]="LineWeight211",n))(Nn||{}),Ur=(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))(Ur||{}),Pe=(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))(Pe||{}),go=(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))(go||{}),mo=(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))(mo||{}),_o=(n=>(n[n.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",n[n.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",n))(_o||{});let Dh=class jh{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new ve;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new ve;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new jh;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}};const Ao=class Ao extends Hr{constructor(){super(...arguments),this._lineType=ti,this._visibility=!0,this._transparency=new na}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this._color==null&&(this._color=new de,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}set color(t){this._color==null&&(this._color=new de),this._color.copy(t)}get resolvedColor(){let t=this.color;if(t.isByLayer){const e=this.getLayerColor();e&&e.RGB!=null&&(t=e)}else t.isByBlock;return t}get rgbColor(){const e=this.resolvedColor.RGB;return e??16777215}get lineType(){return this._lineType}set lineType(t){this._lineType=t||ti}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??Nn.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone()}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&(this._color=new de,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??Nn.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,i,a,h){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){const i=t.subEntityTraits;i.color=this.resolvedColor,i.rgbColor=this.rgbColor,i.lineType=this.lineStyle,i.lineTypeScale=this.linetypeScale,i.lineWeight=this.lineWeight,i.transparency=this.transparency,i.layer=this.layer,"thickness"in this&&(i.thickness=this.thickness);const a=this.subWorldDraw(t,e);return this.attachEntityInfo(a),a}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color.copy(t)}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var a;const{type:t,name:e}=this.getLineType(),i=(a=this.database)==null?void 0:a.tables.linetypeTable.getAt(e);return i?{type:t,...i.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==ti){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==ks?{type:"ByBlock",name:Jn}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:Jn}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};Ao.typeName="Entity";let Le=Ao;const Eo=class Eo extends Le{};Eo.typeName="Curve";let Oe=Eo;var $n=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.FitCurvePoly=1]="FitCurvePoly",n[n.QuadSplinePoly=2]="QuadSplinePoly",n[n.CubicSplinePoly=3]="CubicSplinePoly",n))($n||{});const ko=class ko extends Oe{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=0,a=!1,h=0,u=0,p=null){super(),this._polyType=t,this._elevation=i;const y=p&&(p==null?void 0:p.length)===e.length,f=e.map((x,b)=>({x:x.x,y:x.y,bulge:y?p[b]:void 0}));this._geo=new un(f,a)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new W(i.x,i.y,0))}return t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const u=this._geo.getPointAt(h);a.push(new W(u.x,u.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(i)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}};ko.typeName="2dPolyline";let Ms=ko;var Uh=(n=>(n[n.Vertex=0]="Vertex",n[n.CurveFitVertex=1]="CurveFitVertex",n[n.SplineFitVertex=8]="SplineFitVertex",n[n.SplineCtlVertex=9]="SplineCtlVertex",n))(Uh||{});const To=class To extends Le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new W,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Nt().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,i,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};To.typeName="2dVertex";let Wa=To;var Zi=(n=>(n[n.SimplePoly=0]="SimplePoly",n[n.QuadSplinePoly=1]="QuadSplinePoly",n[n.CubicSplinePoly=2]="CubicSplinePoly",n))(Zi||{});const Mo=class Mo extends Oe{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=!1){super(),this._polyType=t,this._geo=new un(e,i)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:0},{x:t.max.x,y:t.max.y,z:0})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new W(i.x,i.y,0))}return t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:for(let h=0;h<this._geo.numberOfVertices;++h){const u=this._geo.getPointAt(h);a.push(new W(u.x,u.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,0))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i){const a=this.getPointAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:a.x,y:a.y,z:0}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}};Mo.typeName="3dPolyline";let Ns=Mo;var Wh=(n=>(n[n.SimpleVertex=0]="SimpleVertex",n[n.ControlVertex=1]="ControlVertex",n[n.FitVertex=2]="FitVertex",n))(Wh||{});const No=class No extends Le{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new W,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new Nt().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,i,a){a.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,this.position),t.writeInt16(70,this.vertexType|32),this}};No.typeName="3dVertex";let Ga=No;const Lo=class Lo extends Oe{get dxfTypeName(){return"ARC"}constructor(t,e,i,a,h=q.Z_AXIS){super(),this._geo=new co(t,e,i,a,h,q.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>St.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,i,a){const h=this.startPoint,u=this.endPoint;switch(t){case zt.EndPoint:a.push(h),a.push(u);break;case zt.MidPoint:a.push(this.midPoint);break;case zt.Nearest:{const p=this._geo.nearestPoint(e);a.push(p)}break;case zt.Perpendicular:break;case zt.Tangent:{const p=this._geo.tangentPoints(e);a.push(...p);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,this.center),t.writeDouble(40,this.radius),t.writeAngle(50,this.startAngle),t.writeAngle(51,this.endAngle),t.writeVector3d(210,this.normal),this}};Lo.typeName="Arc";let Ls=Lo;var Gh=(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))(Gh||{}),Hh=(n=>(n[n.BASELINE=0]="BASELINE",n[n.BOTTOM=1]="BOTTOM",n[n.MIDDLE=2]="MIDDLE",n[n.TOP=3]="TOP",n))(Hh||{});const Oo=class Oo extends Le{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new W,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new Nt}subGetOsnapPoints(t,e,i,a){zt.Insertion===t&&a.push(this._position)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt(ne)||t.getAt(ne)),e.textStyle}subWorldDraw(t,e){const i={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:Ur.BOTTOM_TO_TOP,attachmentPoint:Pe.BottomLeft};return t.mtext(i,this.getTextStyle(),e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.position),this}};Oo.typeName="Text";let ni=Oo;var ce=(n=>(n[n.Invisible=1]="Invisible",n[n.Const=2]="Const",n[n.Verifiable=4]="Verifiable",n[n.Preset=8]="Preset",n))(ce||{}),wr=(n=>(n[n.MultiLine=2]="MultiLine",n[n.ConstMultiLine=4]="ConstMultiLine",n))(wr||{});const Co=class Co extends ni{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};Co.typeName="AttDef";let Os=Co;const Bo=class Bo extends ni{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&ce.Invisible)!==0}set isInvisible(t){t?this._flags|=ce.Invisible:this._flags&=~ce.Invisible}get isConst(){return(this._flags&ce.Const)!==0}set isConst(t){t?this._flags|=ce.Const:this._flags&=~ce.Const}get isVerifiable(){return(this._flags&ce.Verifiable)!==0}set isVerifiable(t){t?this._flags|=ce.Verifiable:this._flags&=~ce.Verifiable}get isPreset(){return(this._flags&ce.Preset)!==0}set isPreset(t){t?this._flags|=ce.Preset:this._flags&=~ce.Preset}get isMTextAttribute(){return(this._mtextFlag&wr.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=wr.MultiLine:this._mtextFlag&=~wr.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&wr.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=wr.ConstMultiLine:this._mtextFlag&=~wr.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};Bo.typeName="Attrib";let Cs=Bo;const Ro=class Ro extends Le{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new W,this._rotation=0,this._normal=new q(0,0,1),this._scaleFactors=new W(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId}attributeIterator(){return new us(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??W.ORIGIN,i=new $e().makeTranslation(-e.x,-e.y,-e.z),a=new $e().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),h=new On().setFromAxisAngle(q.Z_AXIS,this._rotation),u=new $e().makeRotationFromQuaternion(h),p=new $e().makeTranslation(this._position.x,this._position.y,this._position.z);return new $e().multiplyMatrices(p,u).multiply(a).multiply(i)}subGetOsnapPoints(t,e,i,a,h){zt.Insertion===t?a.push(this._position):h&&this.subEntityGetOsnapPoints(t,e,i,a,h)}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(i=>{e.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:a=>{i.textString=a}}})})}return t}get geometricExtents(){const t=new Nt,e=this.blockTableRecord;if(e!=null){const a=e.newIterator();for(const h of a)t.union(h.geometricExtents)}const i=this.blockTransform;return t.applyMatrix4(i),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const i=this.blockTransform,a=[];return this._attribs.forEach(u=>{if(!u.isInvisible){const p=u.worldDraw(t);p&&a.push(p)}}),si.instance.draw(t,e,this.rgbColor,a,!0,i,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let i=!1;for(const a of this.attributeIterator())i=!0,t.writeStart("ATTRIB"),a.dxfOut(t);return i&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(t,e,i,a,h){var p;if(h===this.objectId)return;const u=(p=this.database)==null?void 0:p.tables.blockTable;if(u!=null){const y=u.getEntityById(h);if(y){const f=[];y.subGetOsnapPoints(t,e,i,f,h);const x=this.blockTransform;f.forEach(b=>{const E=b.clone().applyMatrix4(x);a.push(E)})}}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};Ro.typeName="BlockReference";let ii=Ro;const Fo=class Fo extends Oe{get dxfTypeName(){return"CIRCLE"}constructor(t,e,i=q.Z_AXIS){super(),this._geo=new co(t,e,0,Qt,i,q.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,i,a){switch(t){case zt.Center:case zt.Centroid:a.push(this._geo.center);break;case zt.Quadrant:a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case zt.Nearest:{const h=this._geo.nearestPoint(e);a.push(h)}break;case zt.Tangent:{const h=this._geo.tangentPoints(e);a.push(...h);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,this.center),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}};Fo.typeName="Circle";let Bs=Fo;const zo=class zo extends Oe{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,i,a,h,u,p){super(),this._geo=new aa(t,e,i,a,h,u,p)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:this.closed||(a.push(this._geo.startPoint),a.push(this._geo.endPoint));break;case zt.MidPoint:this.closed||a.push(this._geo.midPoint);break;case zt.Quadrant:this.closed&&(a.push(this._geo.getPointAtAngle(0)),a.push(this._geo.getPointAtAngle(Math.PI/2)),a.push(this._geo.getPointAtAngle(Math.PI)),a.push(this._geo.getPointAtAngle(Math.PI/2*3)));break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center),t.writePoint3d(11,{x:this.majorAxisRadius,y:0,z:0}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}};zo.typeName="Ellipse";let Rs=zo;const Vo=class Vo extends Le{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new W,new W,new W],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new W),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new Nt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=this._vertices.length,i=new Float32Array(e*3),a=new Uint16Array(e*2);for(let h=0;h<e;h++)i[h*3]=this._vertices[h].x,i[h*3+1]=this._vertices[h].y,i[h*3+2]=this._vertices[h].z,this.isEdgeVisibleAt(h)&&(a[h*2]=h,a[h*2+1]=(h+1)%4);return t.lineSegments(i,3,a)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),i=this.getVertexAt(1),a=this.getVertexAt(2),h=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,i),t.writePoint3d(12,a),t.writePoint3d(13,h);let u=0;for(let p=0;p<4;++p)this.isEdgeVisibleAt(p)||(u|=1<<p);return t.writeInt16(70,u),this}};Vo.typeName="Face";let Fs=Vo;var Qi=(n=>(n[n.UserDefined=0]="UserDefined",n[n.Predefined=1]="Predefined",n[n.Custom=2]="Custom",n))(Qi||{}),Xh=(n=>(n[n.Normal=0]="Normal",n[n.Outer=1]="Outer",n[n.Ignore=2]="Ignore",n))(Xh||{});const Do=class Do extends Le{get dxfTypeName(){return"HATCH"}constructor(){super(),this._elevation=0,this._geo=new sa,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}add(t){this._geo.add(t)}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Qi[0],value:0},{label:Qi[1],value:1},{label:Qi[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;return e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,definitionLines:this.definitionLines},t.area(this._geo)}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops;return t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,this.patternName||(this.isSolidFill?"SOLID":"USER")),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,0),t.writeInt16(91,e.length),e.forEach((i,a)=>{const h=a===0;if(i instanceof un){const u=i.vertices,p=u.some(f=>(f.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,p?1:0),t.writeInt16(73,i.closed?1:0),t.writeInt16(93,u.length);for(const f of u)t.writePoint2d(10,f),p&&t.writeDouble(42,f.bulge??0);t.writeInt16(97,0);return}if(i instanceof oa){const u=h?1:0;t.writeInt16(92,u),t.writeInt16(93,i.numberOfEdges);for(const p of i.curves){if(p instanceof ei){t.writeInt16(72,1),t.writePoint2d(10,p.startPoint),t.writePoint2d(11,p.endPoint);continue}if(p instanceof Mn){t.writeInt16(72,2),t.writePoint2d(10,p.center),t.writeDouble(40,p.radius),t.writeAngle(50,p.startAngle),t.writeAngle(51,p.endAngle),t.writeInt16(73,p.clockwise?0:1);continue}if(p instanceof ls){t.writeInt16(72,3),t.writePoint2d(10,p.center);const y=new Et(p.majorAxisRadius*Math.cos(p.rotation),p.majorAxisRadius*Math.sin(p.rotation));t.writePoint2d(11,y);const f=p.majorAxisRadius===0?0:p.minorAxisRadius/p.majorAxisRadius;t.writeDouble(40,f),t.writeAngle(50,p.startAngle),t.writeAngle(51,p.endAngle),t.writeInt16(73,p.clockwise?0:1);continue}if(p instanceof Wr){const y=p.knots,f=p.controlPoints,x=p.weights,b=p.fitPoints,E=x.some(I=>I!==1);t.writeInt16(72,4),t.writeInt16(94,p.degree),t.writeInt16(73,E?1:0),t.writeInt16(74,p.closed?1:0),t.writeInt16(95,y.length),t.writeInt16(96,f.length),y.forEach(I=>t.writeDouble(40,I)),f.forEach((I,L)=>{t.writePoint2d(10,I),E&&t.writeDouble(42,x[L]??1)}),t.writeInt16(97,(b==null?void 0:b.length)??0),b==null||b.forEach(I=>t.writePoint2d(11,I))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,this.patternAngle),t.writeDouble(41,this.patternScale),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(i=>{t.writeAngle(53,i.angle),t.writePoint2d(43,i.base),t.writePoint2d(45,i.offset),t.writeInt16(79,i.dashLengths.length),i.dashLengths.forEach(a=>t.writeDouble(49,a))}),t.writeInt16(98,0),this}};Do.typeName="Hatch";let ts=Do;var Yh=(n=>(n[n.MText=0]="MText",n[n.Fcf=1]="Fcf",n[n.BlockReference=2]="BlockReference",n[n.NoAnnotation=3]="NoAnnotation",n))(Yh||{});const jo=class jo extends Oe{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new W().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new Nt().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Wr(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.annoType),t.writeInt16(73,this.hasHookLine?1:0),t.writeInt16(74,this.isSplined?1:0),t.writeInt16(76,this.numVertices);for(const e of this.vertices)t.writePoint3d(10,e);return this}};jo.typeName="Leader";let zs=jo;var zt=(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))(zt||{});function xd(n){let t=0;for(const e of n)t|=1<<e-1;return t}function Id(n){const t=[];for(const e of Object.values(zt)){if(typeof e!="number")continue;const i=1<<e-1;n&i&&t.push(e)}return t}function Sd(n,t){return n^1<<t-1}function Pd(n,t){return(n&1<<t-1)!==0}function Ad(n,t){return n|1<<t-1}function Ed(n,t){return n&~(1<<t-1)}const Uo=class Uo extends Oe{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new ri(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,i,a){const h=this.startPoint,u=this.endPoint;switch(t){case zt.EndPoint:a.push(h),a.push(u);break;case zt.MidPoint:a.push(this.midPoint);break;case zt.Nearest:{const p=this._geo.project(e);a.push(p)}break;case zt.Perpendicular:{const p=this._geo.perpPoint(e);a.push(p)}break;case zt.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,i=this.endPoint,a=[new W(e.x,e.y,0),new W(i.x,i.y,0)];return t.lines(a)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}};Uo.typeName="Line";let es=Uo;const Wo=class Wo extends Le{get dxfTypeName(){return"MTEXT"}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=Pe.TopLeft,this._direction=new q(1,0,0),this._drawingDirection=Ur.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new Nt}subGetOsnapPoints(t,e,i,a){zt.Insertion===t&&a.push(this._location)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:Pe[1],value:1},{label:Pe[2],value:2},{label:Pe[3],value:3},{label:Pe[4],value:4},{label:Pe[5],value:5},{label:Pe[6],value:6},{label:Pe[7],value:7},{label:Pe[8],value:8},{label:Pe[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:Ur[1],value:1},{label:Ur[2],value:2},{label:Ur[3],value:3},{label:Ur[4],value:4},{label:Ur[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt(ne)||t.getAt(ne)),e.textStyle}subWorldDraw(t,e){const i={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return t.mtext(i,this.getTextStyle(),e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writeString(1,this.contents),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};Wo.typeName="MText";let rs=Wo;const Go=class Go extends Oe{get dxfTypeName(){return"SPLINE"}constructor(t,e,i,a,h){super();const u=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(a!==void 0)+ +(h!==void 0);if(u<2||u>5)throw Ze.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Wr(t,e,i,a):this._geo=new Wr(t,e,i,a,h)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:a.push(this._geo.startPoint),a.push(this._geo.endPoint);break}}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var i;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((i=e.fitPoints)==null?void 0:i.length)??0);for(const a of e.knots)t.writeDouble(40,a);for(const a of e.weights)t.writeDouble(41,a);for(const a of e.controlPoints)t.writePoint3d(10,a);for(const a of e.fitPoints??[])t.writePoint3d(11,a);return this}};Go.typeName="Spline";let ns=Go;const kd=new q,Ho=class Ho extends ii{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,i){super(t),this._attachmentPoint=Pe.TopLeft,this._numColumns=i,this._numRows=e,this._columnWidth=new Array(i),this._rowHeight=new Array(e),this._cells=new Array(e*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,i){var h;const a=t*this._numColumns+e;return(h=this._cells[a])==null?void 0:h.text}setTextString(t,e,i){const a=t*this._numColumns+e;if(!this._cells[a]){this._cells[a]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[a].text=i}isEmpty(t,e){var a;const i=t*this._numColumns+e;return!((a=this._cells[i])!=null&&a.text)}get geometricExtents(){return new Nt}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){let e=0,i=0;const a=new Uint16Array(this.numColumns*this.numRows*8),h=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let u=0;for(let E=0;E<=this.numRows;E++){e-=E>0?this.rowHeight(E-1):0,i=0;for(let I=0;I<=this.numColumns;I++)i+=I>0?this.columnWidth(I-1):0,h[u++]=i,h[u++]=e,h[u++]=0}const p=[],y=new Array(this.numRows*this.numColumns).fill(!1);i=0,u=0;let f=0;for(let E=0;E<this.numColumns;E++){i+=E>0?this.columnWidth(E-1):0,e=0;for(let I=0;I<this.numRows;I++){e+=I>0?this.rowHeight(I-1):0;const L=this.cell(I*this.numColumns+E);if(f=I*this.numColumns+E,L&&!y[f]){const O=L.borderWidth??1,V=L.borderHeight??1;this.fillVisited(y,f,this.numColumns,O,V),a[u++]=E+I*(this.numColumns+1),a[u++]=E+I*(this.numColumns+1)+O;const z=h[a[u-1]*3]-i,it=E+(I+V)*(this.numColumns+1)+O;E+O==this.numColumns&&(a[u++]=E+I*(this.numColumns+1)+O,a[u++]=it);const _t=-h[it*3+1]-e;if(I+V==this.numRows&&(a[u++]=E+(I+V)*(this.numColumns+1)+V,a[u++]=E+(I+V)*(this.numColumns+1)),a[u++]=E+(I+V)*(this.numColumns+1),a[u++]=E+I*(this.numColumns+1),L.text){const st=L.attachmentPoint||this.attachmentPoint||Pe.MiddleCenter,H=this.getTableTextOffset(st,z,_t),dt={text:L.text,height:L.textHeight,width:z,position:kd.set(i,-e,0).clone().add(H),rotation:this.rotation,attachmentPoint:st},at=this.getTextStyle(L);p.push(t.mtext(dt,at))}}}}p.push(t.lineSegments(h,3,a));const x=t.group(p),b=new On;return b.setFromAxisAngle(q.Z_AXIS,this.rotation),Cl.compose(this.position,b,this.scaleFactors),x.applyMatrix(Cl),x}fillVisited(t,e,i,a,h){if(h==1&&a==1)t[e]=!0;else for(let u=0;u<a;++u)for(let p=0;p<h;++p)t[e+u+p*i]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let i;return t.textStyle&&(i=e.getAt(t.textStyle)),i||(i=e.getAt(ne)||e.getAt(ne)),i.textStyle}getTableTextOffset(t,e,i){const a=new q;switch(t){case 1:break;case 2:a.setX(e/2);break;case 3:a.setX(e);break;case 4:a.setY(-i/2);break;case 5:a.set(e/2,-i/2,0);break;case 6:a.set(e,-i/2,0);break;case 7:a.setY(-i);break;case 8:a.set(e/2,-i,0);break;case 9:a.set(e,-i,0);break}return a}dxfOutFields(t){var h,u,p,y,f,x,b;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((h=t.database)==null?void 0:h.version)??((u=this.database)==null?void 0:u.version),i=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let E=0;E<this.numRows;++E)t.writeDouble(141,this.rowHeight(E));for(let E=0;E<this.numColumns;++E)t.writeDouble(142,this.columnWidth(E));const a=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let E=0;E<a;E++){const I=this._cells[E],L=(I==null?void 0:I.cellType)??(I!=null&&I.blockTableRecordId?2:1);if(t.writeInt16(171,L),t.writeInt16(172,(I==null?void 0:I.flagValue)??0),t.writeInt16(173,(I==null?void 0:I.mergedValue)??0),t.writeBoolean(174,I==null?void 0:I.autoFit),t.writeInt16(175,I==null?void 0:I.borderWidth),t.writeInt16(176,I==null?void 0:I.borderHeight),(I==null?void 0:I.overrideFlag)!=null&&(i?t.writeInt32(91,I.overrideFlag):t.writeInt16(177,I.overrideFlag)),t.writeInt16(178,I==null?void 0:I.virtualEdgeFlag),t.writeAngle(145,I==null?void 0:I.rotation),i&&t.writeInt16(92,I==null?void 0:I.extendedCellFlags),L===1)I!=null&&I.fieldObjetId?t.writeObjectId(344,I.fieldObjetId):this.writeCellText(t,(I==null?void 0:I.text)??"",i,I==null?void 0:I.cellValueBlockBegin);else if(L===2){if(t.writeObjectId(340,I==null?void 0:I.blockTableRecordId),t.writeDouble(144,I==null?void 0:I.blockScale),t.writeInt16(179,I==null?void 0:I.blockAttrNum),(p=I==null?void 0:I.attrDefineId)!=null&&p.length)for(const O of I.attrDefineId)t.writeObjectId(331,O);if((I==null?void 0:I.attrText)!=null)if(Array.isArray(I.attrText))for(const O of I.attrText)t.writeString(300,O);else t.writeString(300,I.attrText)}I!=null&&I.textStyle&&t.writeString(7,I.textStyle),(I==null?void 0:I.textHeight)!=null&&t.writeDouble(140,I.textHeight),(I==null?void 0:I.attachmentPoint)!=null&&t.writeInt16(170,I.attachmentPoint),(I==null?void 0:I.topBorderVisibility)!=null&&t.writeInt16(289,I.topBorderVisibility?1:0),(I==null?void 0:I.rightBorderVisibility)!=null&&t.writeInt16(285,I.rightBorderVisibility?1:0),(I==null?void 0:I.bottomBorderVisibility)!=null&&t.writeInt16(286,I.bottomBorderVisibility?1:0),(I==null?void 0:I.leftBorderVisibility)!=null&&t.writeInt16(288,I.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(y=this.cellTypeOverrides)!=null&&y.length)for(const E of this.cellTypeOverrides){t.writeString(7,E.textStyle),t.writeDouble(140,E.textHeight),t.writeInt16(170,E.alignment),t.writeInt16(63,E.backgroundColor),t.writeInt16(64,E.contentColor),E.backgroundColorEnabled!=null&&t.writeInt16(283,E.backgroundColorEnabled?1:0);const I=E.borderLineweights;I&&(t.writeInt16(274,I.top),t.writeInt16(275,I.right),t.writeInt16(276,I.bottom),t.writeInt16(277,I.left),t.writeInt16(278,I.insideHorizontal),t.writeInt16(279,I.insideVertical));const L=E.borderVisibility;L&&(t.writeInt16(284,L.top?1:0),t.writeInt16(285,L.right?1:0),t.writeInt16(286,L.bottom?1:0),t.writeInt16(287,L.left?1:0),t.writeInt16(288,L.insideHorizontal?1:0),t.writeInt16(289,L.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(f=this.rowDataTypes)!=null&&f.length)for(const E of this.rowDataTypes)t.writeInt16(97,E);if((x=this.rowUnitTypes)!=null&&x.length)for(const E of this.rowUnitTypes)t.writeInt16(98,E);if((b=this.rowFormats)!=null&&b.length)for(const E of this.rowFormats)t.writeString(4,E);return this}writeCellText(t,e,i,a){if(!i){if(e.length<=250){t.writeString(1,e);return}const p=Math.ceil(e.length/250);for(let y=0;y<p;y++){const f=y*250,x=f+250,b=e.slice(f,x);y===p-1?t.writeString(1,b):t.writeString(2,b)}return}if(t.writeString(301,a??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const u=Math.ceil(e.length/250);for(let p=0;p<u;p++){const y=p*250,f=y+250,x=e.slice(y,f);p===u-1?t.writeString(302,x):t.writeString(303,x)}t.writeString(304,"ACVALUE_END")}};Ho.typeName="Table";let Vs=Ho;const Cl=new $e,Xo=class Xo extends Oe{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new W,new W,new W,new W]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new Nt().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:a.push(...this._vertices);break}}subWorldDraw(t){const e=new un(this._vertices,!0),i=new sa;i.add(e);const a=t.subEntityTraits;return a.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}};Xo.typeName="Trace";let Ds=Xo;const Yo=class Yo extends Oe{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new un}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,i=0,a=-1,h=-1){const u=a<0?void 0:a,p=h<0?void 0:h,y={x:e.x,y:e.y,bulge:i,startWidth:u,endWidth:p};this._geo.addVertexAt(t,y)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new W(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new Nt({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subGetOsnapPoints(t,e,i,a){const h=new Array;for(let u=0;u<this.numberOfVertices;++u)h.push(this.getPoint3dAt(u));switch(t){case zt.EndPoint:a.push(...h);break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(a=>e.push(new W().set(a.x,a.y,this.elevation))),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}};Yo.typeName="Polyline";let js=Yo;const qo=class qo extends Le{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new W}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new Nt().expandByPoint(this._geo)}subGetOsnapPoints(t,e,i,a){zt.Node===t&&a.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};qo.typeName="Point";let Us=qo;var qh=(n=>(n[n.Invalid=0]="Invalid",n[n.Rect=1]="Rect",n[n.Poly=2]="Poly",n))(qh||{}),Kh=(n=>(n[n.Show=1]="Show",n[n.ShowUnAligned=2]="ShowUnAligned",n[n.Clip=4]="Clip",n[n.Transparent=8]="Transparent",n))(Kh||{});const Ko=class Ko extends Le{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new W,this._scale=new te(1,1),this._rotation=0,this._imageSize=new Et,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new Nt;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,i=this._height,a=new ve;a.setFromPoints(this._clipBoundary);const h=new Et;h.setX(this._position.x-a.min.x*e),h.setY(this._position.y-a.min.y*i),this._clipBoundary.forEach(u=>{const p=u.x*e+h.x,y=u.y*i+h.y;t.push(new W(p,y,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){Bl.copy(t[1]);for(let e=1;e<4;e++)fs.copy(t[e]),fs.rotateAround(Bl,this._rotation),t[e].setX(fs.x),t[e].setY(fs.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,i=this.height*this.scale.y,a=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:i},h=a.x>0?e/a.x:e,u=a.y>0?i/a.y:i,p=Math.cos(this._rotation),y=Math.sin(this._rotation);t.writePoint3d(11,{x:h*p,y:h*y,z:0}),t.writePoint3d(12,{x:-u*y,y:u*p,z:0}),t.writePoint2d(13,a),t.writeObjectId(340,this.imageDefId);const f=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,f),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const x of this.clipBoundary)t.writePoint2d(14,x)}return this}};Ko.typeName="RasterImage";let is=Ko;const Bl=new Et,fs=new Et,$o=class $o extends Oe{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new W,this._unitDir=new q}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Nt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subGetOsnapPoints(t,e,i,a){switch(t){case zt.EndPoint:a.push(this.basePoint);break}}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}};$o.typeName="Ray";let Ws=$o;const Zo=class Zo extends Le{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new W,this._height=0,this._width=0,this._viewCenter=new W,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new Nt}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Dh;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const i=[];return i.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),i.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new W(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new W(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new W(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),i}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}};Zo.typeName="Viewport";let Gs=Zo;const Qo=class Qo extends is{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),i=new sa;return i.add(new un(e)),t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),this}};Qo.typeName="Wipeout";let Hs=Qo;const Jo=class Jo extends Oe{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new W,this._unitDir=new q}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new Nt;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}};Jo.typeName="Xline";let Xs=Jo;var $h=(n=>(n[n.AtLeast=1]="AtLeast",n[n.Exactly=2]="Exactly",n))($h||{});const tl=class tl extends Le{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new W,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new W,this._textRotation=0,this._normal=new q(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new Ln),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}subWorldDraw(t){if(this.dimBlockId){const i=this.database.tables.blockTable.getAt(this.dimBlockId);if(i){const a=this.computeDimBlockTransform();return si.instance.draw(t,i,this.rgbColor,[],!1,a,this._normal)}}return t.group([])}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,i){const a=new W().subVectors(e,t).normalize();return new W(e).addScaledVector(a,i)}findPointOnLine2(t,e,i){const a=t.x+i*Math.cos(e),h=t.y+i*Math.sin(e);return{x:a,y:h}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():po.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??W.ORIGIN,i=new $e().makeTranslation(-e.x,-e.y,-e.z),a=new $e().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new $e().multiplyMatrices(a,i)}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};tl.typeName="Dimension";let Gr=tl;const el=class el extends Gr{constructor(t,e,i,a,h=null,u=null){super(),this._centerPoint=new W().copy(t),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(i),this._arcPoint=new W().copy(a),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Nt}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};el.typeName="3PointAngularDimension";let Ys=el;const rl=class rl extends Gr{constructor(t,e,i,a=null,h=null){super(),this._dimLinePoint=new W().copy(i),this._xLine1Point=new W().copy(t),this._xLine2Point=new W().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),a?this.dimensionText=a:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=h}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get geometricExtents(){return new Nt}get isAppendArrow(){return!1}createDimBlock(t){const e=new ue;e.name=t;const i=this.createLines();i.forEach(p=>e.appendEntity(new es(p.startPoint,p.endPoint))),this.createArrows(i[0]).forEach(p=>e.appendEntity(p));const h=i[0].midPoint,u=this.createMText(h,this._rotation);return u&&e.appendEntity(u),e}createMText(t,e){const i=a=>({x:Math.cos(a),y:Math.sin(a),z:0});if(this.dimensionText){const a=new rs;return a.attachmentPoint=Pe.MiddleLeft,a.layer="0",a.color=new de(lt.ByBlock),a.location=t,a.contents=this.dimensionText??"",a.height=10,a.direction=i(e),a.styleName=this.dimensionStyle.dimtxsty,a}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,i){const a="_CAXARROW",h=new ii(a);return h.position=t,h.rotation=e,h.scaleFactors={x:i,y:i,z:i},h}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),a=this.findIntersectionPoint(e,this._dimLinePoint),h=this.findIntersectionPoint(i,this._dimLinePoint),u=new ri(a,h);return t.push(u),e.endPoint=a,this.adjustExtensionLine(e),t.push(e),i.endPoint=h,this.adjustExtensionLine(i),t.push(i),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,i=this.findPointOnLine2(t,e,100);return new ri(t,{...i,z:t.z})}findIntersectionPoint(t,e){const i=t.startPoint,a=t.endPoint,h=new q().subVectors(a,i).normalize(),p=new q().subVectors(e,i).dot(h),y=new q().copy(h).multiplyScalar(p);return new q().addVectors(i,y)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,i=e.x-t.x,a=e.y-t.y;this._rotation=Math.atan2(a,i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAlignedDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};rl.typeName="AlignedDimension";let qs=rl;const nl=class nl extends Gr{constructor(t,e,i,a,h=null,u=null){super(),this._arcPoint=new W().copy(a),this._xLine1Point=new W().copy(e),this._xLine2Point=new W().copy(i),this._centerPoint=new W().copy(t),this.dimensionText=h,this.dimensionStyleName=u}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new Nt}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};nl.typeName="ArcDimension";let Ha=nl;const il=class il extends Gr{constructor(t,e,i=0,a=null,h=null){super(),this._chordPoint=new W().copy(t),this._farChordPoint=new W().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=a,this.dimensionStyleName=h}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}get geometricExtents(){return new Nt}drawLines(t,e){const i=[],a=e.length;return a==1?i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):a==3?(this.sortLines(e),i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),i.push(this.drawLine(t,e[1])),i.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(h=>{i.push(this.drawLine(t,h))}),i}drawLine(t,e,i){if(i){const a=[e.startPoint,e.endPoint];return t.lines(a)}else return e.worldDraw(t)}sortLines(t){const e=(i,a)=>i.x!==a.x?i.x-a.x:i.y!==a.y?i.y-a.y:i.z-a.z;t.sort((i,a)=>{const h=e(i.startPoint,a.startPoint);return h!==0?h:e(i.endPoint,a.endPoint)})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};il.typeName="DiametricDimension";let Ks=il;const sl=class sl extends Gr{constructor(t,e,i=null,a=null){super(),this._definingPoint=new W().copy(t),this._leaderEndPoint=new W().copy(e),this.dimensionText=i,this.dimensionStyleName=a}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new Nt}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};sl.typeName="OrdinateDimension";let $s=sl;const al=class al extends Gr{constructor(t,e,i,a=null,h=null){super(),this._center=new W().copy(t),this._chordPoint=new W().copy(e),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=a,this.dimensionStyleName=h}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new Nt}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};al.typeName="RadialDimension";let Zs=al;var Zh=(n=>(n[n.kInches=0]="kInches",n[n.kMillimeters=1]="kMillimeters",n[n.kPixels=2]="kPixels",n))(Zh||{}),Qh=(n=>(n[n.k0degrees=0]="k0degrees",n[n.k90degrees=1]="k90degrees",n[n.k180degrees=2]="k180degrees",n[n.k270degrees=3]="k270degrees",n))(Qh||{}),Jh=(n=>(n[n.kDisplay=0]="kDisplay",n[n.kExtents=1]="kExtents",n[n.kLimits=2]="kLimits",n[n.kView=3]="kView",n[n.kWindow=4]="kWindow",n[n.kLayout=5]="kLayout",n))(Jh||{}),an=(n=>(n[n.kDraft=0]="kDraft",n[n.kPreview=1]="kPreview",n[n.kNormal=2]="kNormal",n[n.kPresentation=3]="kPresentation",n[n.kMaximum=4]="kMaximum",n[n.kCustom=5]="kCustom",n))(an||{}),Zn=(n=>(n[n.kAsDisplayed=0]="kAsDisplayed",n[n.kWireframe=1]="kWireframe",n[n.kHidden=2]="kHidden",n[n.kRendered=3]="kRendered",n[n.kVisualStyle=4]="kVisualStyle",n[n.kRenderPreset=5]="kRenderPreset",n))(Zn||{}),tu=(n=>(n[n.kScaleToFit=0]="kScaleToFit",n[n.k1_128in_1ft=1]="k1_128in_1ft",n[n.k1_64in_1ft=2]="k1_64in_1ft",n[n.k1_32in_1ft=3]="k1_32in_1ft",n[n.k1_16in_1ft=4]="k1_16in_1ft",n[n.k3_32in_1ft=5]="k3_32in_1ft",n[n.k1_8in_1ft=6]="k1_8in_1ft",n[n.k3_16in_1ft=7]="k3_16in_1ft",n[n.k1_4in_1ft=8]="k1_4in_1ft",n[n.k3_8in_1ft=9]="k3_8in_1ft",n[n.k1_2in_1ft=10]="k1_2in_1ft",n[n.k3_4in_1ft=11]="k3_4in_1ft",n[n.k1in_1ft=12]="k1in_1ft",n[n.k3in_1ft=13]="k3in_1ft",n[n.k6in_1ft=14]="k6in_1ft",n[n.k1ft_1ft=15]="k1ft_1ft",n[n.k1_1=16]="k1_1",n[n.k1_2=17]="k1_2",n[n.k1_4=18]="k1_4",n[n.k1_5=19]="k1_5",n[n.k1_8=20]="k1_8",n[n.k1_10=21]="k1_10",n[n.k1_16=22]="k1_16",n[n.k1_20=23]="k1_20",n[n.k1_30=24]="k1_30",n[n.k1_40=25]="k1_40",n[n.k1_50=26]="k1_50",n[n.k1_100=27]="k1_100",n[n.k2_1=28]="k2_1",n[n.k4_1=29]="k4_1",n[n.k8_1=30]="k8_1",n[n.k10_1=31]="k10_1",n[n.k100_1=32]="k100_1",n[n.k1000_1=33]="k1000_1",n[n.k1and1_2in_1ft=34]="k1and1_2in_1ft",n))(tu||{});const Td={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class eu extends Hr{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new Et,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new Et,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new ve,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return Td[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class hs extends eu{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new ve,this._extents=new Nt,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class us{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class Ji extends Hr{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,a)=>{i===e&&(this._recordsByName.delete(a),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:a}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new us(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,i]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,i.objectId);return this}}class ru extends Ji{getBtrIdAt(t){for(const[e,i]of this._recordsByName)if(i.blockTableRecordId==t)return i}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class cn extends Hr{constructor(t,e){t=t||{},ss(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var nu=(n=>(n[n.Any=0]="Any",n[n.Uniform=1]="Uniform",n))(nu||{});const ln=class ln extends cn{static isModelSapceName(t){return t.toLowerCase()==ln.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(ln.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new W,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return ln.isModelSapceName(this.name)}get isPaperSapce(){return ln.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.commitObjectHandle(i,a=>this._entities.has(a)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i)};if(Array.isArray(t))for(let i=0;i<t.length;++i)e(t[i]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],i=[];return e.forEach(a=>{const h=this._entities.get(a);h&&i.push(h),this._entities.delete(a)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new us(this._entities)}getIdAt(t){return this._entities.get(t)}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};ln.MODEL_SPACE_NAME="*Model_Space",ln.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let ue=ln;class iu{constructor(){this.events={layoutCreated:new he,layoutRemoved:new he,layoutRenamed:new he,layoutSwitched:new he}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const i=this.getWorkingDatabase(e),a=i.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(a,i)}setCurrentLayoutBtrId(t,e){const i=this.getWorkingDatabase(e),a=i.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(a,i)}setCurrentLayout(t,e){const i=this.getWorkingDatabase(e),a=i.objects.layout.getAt(t);return this.setCurrentLayoutInternal(a,i)}renameLayout(t,e,i){const h=this.getWorkingDatabase(i).objects.layout.getAt(t);return h?(h.layoutName=e,this.events.layoutRenamed.dispatch({layout:h,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const i=this.getWorkingDatabase(e).objects.layout,a=i.getAt(t);let h=!1;return a&&(h=i.remove(t),h&&this.events.layoutRemoved.dispatch({layout:a})),h}createLayout(t,e){const i=this.getWorkingDatabase(e),a=new hs;a.layoutName=t,a.tabOrder=i.objects.layout.maxTabOrder;const h=new ue;return h.name=`*Paper_Space${a.tabOrder}`,i.tables.blockTable.add(h),i.objects.layout.setAt(t,a),this.events.layoutCreated.dispatch({layout:a}),{layout:a,btr:h}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||$a().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}rh(()=>new iu);class su extends Hr{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}var au=(n=>(n[n.NotApplicable=0]="NotApplicable",n[n.Ignore=1]="Ignore",n[n.Replace=2]="Replace",n[n.XrefMangleName=3]="XrefMangleName",n[n.MangleName=4]="MangleName",n))(au||{});class fo extends Hr{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){var e;const t=new fo;return t._data=((e=this._data)==null?void 0:e.clone())??null,t}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}class ou{constructor(t){this.db=t}createDefaultLayer(){const t=new de;return t.colorIndex=7,this.db.tables.layerTable.add(new la({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new hn({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new hn({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new hn({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new ha({name:ne,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new Ln({name:ne,dimtxsty:ne}))}createDefaultLayout(){const t=new hs;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new ts;e.patternName="SOLID";const i=new oa;i.add(new ei({x:0,y:0},{x:-1,y:.125})),i.add(new ei({x:-1,y:.125},{x:-1,y:-.125})),i.add(new ei({x:-1,y:-.125},{x:0,y:0})),e.add(i);const a=new ue;a.name="_CAXARROW",a.appendEntity(e),this.db.tables.blockTable.add(a)}}}var lu=(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))(lu||{}),yo=(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))(yo||{});function Md(n){return n==4||n==5||n==6||n==7||n==12||n==13||n==14||n==15||n==16||n==17}function Nd(n){return n==1||n==2||n==3||n==8||n==9||n==10||n==21}class Xr extends Hr{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i));const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),i=this._recordsByName.get(e);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new us(this._recordsByName)}normalizeName(t){return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.numEntries),this}}class hu extends Xr{constructor(t){super(t)}get modelSpace(){let t=this.getAt(ue.MODEL_SPACE_NAME);return t||(t=new ue,t.name=ue.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const i=e.getIdAt(t);if(i)return i}}removeEntity(t){let e=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(ue.isModelSapceName(t))e=ue.MODEL_SPACE_NAME;else if(ue.isPaperSapceName(t)){const i=ue.PAPER_SPACE_NAME_PREFIX,a=t.substring(i.length);e=i+a}return e}}class uu extends Xr{constructor(t){super(t)}}var cu=(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))(cu||{}),du=(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))(du||{}),pu=(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))(pu||{}),gu=(n=>(n[n.None=0]="None",n[n.Leading=1]="Leading",n[n.Trailing=2]="Trailing",n[n.LeadingAndTrailing=3]="LeadingAndTrailing",n))(gu||{}),mu=(n=>(n[n.Bottom=0]="Bottom",n[n.Middle=1]="Middle",n[n.Top=2]="Top",n))(mu||{});const ea=class ea extends cn{constructor(t,e){t=t||{},ss(t,ea.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),a=this.database.tables.blockTable.getAt(this.dimblk),h=this.database.tables.blockTable.getAt(this.dimblk1),u=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,i==null?void 0:i.objectId),t.writeObjectId(342,a==null?void 0:a.objectId),t.writeObjectId(343,h==null?void 0:h.objectId),t.writeObjectId(344,u==null?void 0:u.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};ea.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:ne,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let Ln=ea;class _u extends Xr{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class la extends cn{constructor(t,e){t=t||{},ss(t,{color:new de,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new na,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(i=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:i.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class fu extends Xr{constructor(t){super(t)}}class hn extends cn{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.linetype.standardFlag),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class yu extends Xr{constructor(t){super(t)}get fonts(){const t=new Set,e=a=>{if(a){const h=a.lastIndexOf(".");if(h>=0){const u=a.substring(0,h).toLowerCase();t.add(u)}else t.add(a.toLowerCase())}},i=this.newIterator();for(const a of i)e(a.fileName),e(a.bigFontFileName);return Array.from(t)}}class ha extends cn{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const i=e.lastIndexOf(".");return i===-1?e:e.substring(0,i)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}class vu extends Xr{constructor(t){super(t)}}class wu extends Xr{constructor(t){super(t)}}const Ld=()=>({center:new Et,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:go.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:mo.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:_o.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class vo extends cn{constructor(){super(),this._gsView=Ld(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this._gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(t){this._gsView.viewTarget.copy(t)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(t){this._gsView.viewHeight=t}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(t){this._gsView.viewTwistAngle=t}get lensLength(){return this._gsView.lensLength}set lensLength(t){this._gsView.lensLength=t}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(t){this._gsView.frontClippingPlane=t}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(t){this._gsView.backClippingPlane=t}get renderMode(){return this._gsView.renderMode}set renderMode(t){this._gsView.renderMode=t}get viewMode(){return this._gsView.viewMode}set viewMode(t){this._gsView.viewMode=t}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(t){this._gsView.ucsIconSetting=t}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(t){this._gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(t){this._gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(t){this._gsView.ucsYAxis.copy(t)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(t){this._gsView.orthographicType=t}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(t){this._gsView.shadePlotSetting=t}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(t){this._gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(t){this._gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this._gsView.isDefaultLightingOn=t}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(t){this._gsView.defaultLightingType=t}get brightness(){return this._gsView.brightness}set brightness(t){this._gsView.brightness=t}get contrast(){return this._gsView.contrast}set contrast(t){this._gsView.contrast=t}get ambientColor(){return this._gsView.ambientColor}set ambientColor(t){this._gsView.ambientColor=t}}class wo extends vo{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new Et(0,0),this._upperRightCorner=new Et(1,1),this._snapBase=new Et(0,0),this._snapAngle=0,this._snapSpacing=new Et(0,0),this._standardFlag=0,this._gridSpacing=new Et,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class bu extends Xr{constructor(t){super(t)}}class Xa extends cn{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}const Dt={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CLAYER:"CLAYER",COLORTHEME:"COLORTHEME",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},Od=Object.freeze(Object.values(Dt)),ra=class ra{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new he},this.registerVar({name:Dt.CECOLOR,type:"color",isDbVar:!0,defaultValue:new de(lt.ByLayer)}),this.registerVar({name:Dt.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:Dt.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:Nn.ByLayer}),this.registerVar({name:Dt.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:Dt.COLORTHEME,type:"number",isDbVar:!1,defaultValue:"0"}),this.registerVar({name:Dt.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:Dt.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new de(lt.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:Dt.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:Dt.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:Dt.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:ne}),this.registerVar({name:Dt.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new ra),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const i=this.getDescriptor(t);if(i){if(i.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}}setVar(t,e,i){t=this.normalizeName(t);const a=this.getDescriptor(t);if(a){const h=this.getVar(t,i);if(a.type!=="string"&&(typeof e=="string"||e instanceof String)){if(a.type==="number"){const u=Number(e);if(Number.isNaN(u))throw new Error("Invalid number input!");e=u}else if(a.type==="boolean")e=this.parseBoolean(e);else if(a.type==="color"){const u=de.fromString(e);if(u==null)throw new Error("Invalid color value!");e=u}}a.isDbVar?i[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(h,e)&&this.events.sysVarChanged.dispatch({database:i,name:t,newVal:e,oldVal:h}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),a=new Set(["false","f","0","no","n"]);return i.has(e)?!0:(a.has(e),!1)}hasValueChanged(t,e){return t instanceof de&&e instanceof de?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};ra._instance=null;let Qs=ra;class Cd extends Hr{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new he,dictObjectErased:new he,entityAppended:new he,entityModified:new he,entityErased:new he,layerAppended:new he,layerModified:new he,layerErased:new he,openProgress:new he},this._version=new er("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Ja.DecimalDegrees,this._celtscale=1,this._cecolor=new de,this._celweight=Nn.ByLayer,this._clayer="0",this._textstyle=ne,this._extents=new Nt,this._insunits=yo.Millimeters,this._ltscale=1,this._lwdisplay=!0,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new bu(this),blockTable:new hu(this),dimStyleTable:new uu(this),linetypeTable:new fu(this),textStyleTable:new yu(this),viewTable:new vu(this),layerTable:new _u(this),viewportTable:new wu(this)},this._objects={dictionary:new Ji(this),imageDefinition:new Ji(this),layout:new ru(this),xrecord:new Ji(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const i=t.getAttrWithoutException("objectId");!i||t.isTemp||e&&e(i)?t.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(Dt.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar(Dt.ACADVER,this._version,new er(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(Dt.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(Dt.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar(Dt.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(Dt.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(Dt.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(Dt.CELWEIGHT,this._celweight,t??Nn.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(Dt.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(Dt.TEXTSTYLE,this._textstyle,t??ne,e=>{this._textstyle=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar(Dt.ANGBASE,this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar(Dt.ANGDIR,this._angDir,t??0,e=>{this._angDir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(Dt.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(Dt.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(Dt.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(Dt.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(Dt.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}async read(t,e,i=qi.DXF){const a=vr.instance.get(i);if(a==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),await a.read(t,this,e&&e.minimumChunkSize||10,async(h,u,p,y)=>{if(this.events.openProgress.dispatch({database:this,percentage:h,stage:"CONVERSION",subStage:u,subStageStatus:p,data:y}),e&&e.fontLoader&&u=="FONT"&&p=="END"){const f=y||this.tables.textStyleTable.fonts;await e.fontLoader.load(f)}},e==null?void 0:e.timeout),this.ensureDatabaseDefaults()}async openUri(t,e){var I;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(t);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${i.status}'!`);const a=i.headers.get("content-length"),h=a?parseInt(a,10):null;let u=0;const p=(I=i.body)==null?void 0:I.getReader();if(!p)throw new Error("Failed to get response reader");const y=[];for(;;){const{done:L,value:O}=await p.read();if(L)break;if(y.push(O),u+=O.length,h!==null){const V=Math.round(u/h*100);this.events.openProgress.dispatch({database:this,percentage:V,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const f=new Uint8Array(u);let x=0;for(const L of y)f.set(L,x),x+=L.length;const E=this.getFileNameFromUri(t).toLowerCase().split(".").pop();E==="dwg"?await this.read(f.buffer,e,qi.DWG):E==="dxf"?await this.read(f.buffer,e,qi.DXF):await this.read(f.buffer,e,E),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,i=this.version.name,a=!1){this.ensureDatabaseDefaults();const h=i instanceof er?i:new er(i),u=new Wl({database:this,precision:e,version:h});return this.writeDxfHeaderSection(u),this.writeDxfTablesSection(u,h),this.writeDxfBlocksSection(u),this.writeDxfEntitiesSection(u),this.writeDxfObjectsSection(u),u.writeStart("EOF"),u.toString()}async regen(){await new Rc(this).read(null,this,500,async(e,i,a,h)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:i,subStageStatus:a,data:h})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new ou(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new de;e.colorIndex=7,this.tables.layerTable.add(new la({name:"0",standardFlags:0,linetype:Jn,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(ks)||this.tables.linetypeTable.add(new hn({name:ks,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(ti)||this.tables.linetypeTable.add(new hn({name:ti,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Jn)||this.tables.linetypeTable.add(new hn({name:Jn,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(ne)||this.tables.textStyleTable.add(new ha({name:ne,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(ne)||this.tables.dimStyleTable.add(new Ln({name:ne,dimtxsty:ne})),!this.tables.viewportTable.has("*Active")){const e=new wo;e.name="*Active",this.tables.viewportTable.add(e)}const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new hs;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(za)||this.tables.appIdTable.add(new Xa(za)),this.tables.appIdTable.has(Fa)||this.tables.appIdTable.add(new Xa(Fa))}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angBase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angDir),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.endSection()}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const i of e.newIterator())this.writeDxfEntity(t,i);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const i of e.newIterator())this.writeDxfEntity(t,i);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const i=u=>{t.writeStart("DICTIONARY"),u.dxfOut(t)},a=(u,p)=>{e.getAt(u)!==p&&e.setAt(u,p)},h=u=>{e.getAt(u)&&e.remove(u)};a("ACAD_LAYOUT",this.objects.layout),this.objects.imageDefinition.numEntries>0?a("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):h("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?a("MLIGHT_XRECORD",this.objects.xrecord):h("MLIGHT_XRECORD"),i(e),i(this.objects.layout),this.objects.imageDefinition.numEntries>0&&i(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&i(this.objects.xrecord);for(const[u,p]of this.objects.layout.entries())t.writeStart("LAYOUT"),p.dxfOut(t);for(const[u,p]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),p.dxfOut(t);for(const[u,p]of this.objects.xrecord.entries())t.writeStart("XRECORD"),p.dxfOut(t);t.endSection()}writeDxfTable(t,e,i,a,h){const u=[...a];t.startTable(e),i.dxfOut(t);for(const p of u){if(h==="BLOCK_RECORD"&&p instanceof ue){p.dxfOutBlockRecord(t);continue}t.writeStart(h),p.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,i,a){this.hasSysVarValueChanged(e,i)&&(a(i),this.triggerSysVarChangedEvent(t,e,i))}hasSysVarValueChanged(t,e){return t instanceof de&&e instanceof de?!t.equals(e):t instanceof er&&e instanceof er?t.value!==e.value:!Object.is(t,e)}triggerSysVarChangedEvent(t,e,i){const a=Qs.instance(),h=t.toLowerCase();a.getDescriptor(h)!=null&&a.events.sysVarChanged.dispatch({database:this,name:h,oldVal:e,newVal:i})}getFileNameFromUri(t){try{const i=new URL(t).pathname.split("/");return i[i.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}}const xu="Load Database",Rl=3e4,Bd=12e4,Rd=1024*1024;class Fe extends $l{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=Ka.getInstance().getEntry(xu),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const a=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",a?a.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-i),a}}class bo{constructor(t={}){this.config=t}async read(t,e,i,a,h){const u={name:xu,data:{total:0},format(){let x="";return Object.keys(this.data).forEach(b=>{b!=="total"&&(x+=`- ${b}: ${this.data[b]} ms
|
|
7
|
-
`)}),x+=`- total: ${this.data.total} ms`,x}};Ka.getInstance().collect(u),this.progress=a;const p={value:0},y=new Zl;y.setCompleteCallback(()=>this.onFinished()),y.setErrorCallback(x=>this.onError(x)),y.addTask(new Fe({stage:"START",step:1,progress:p,task:async x=>x},a)),y.addTask(new Fe({stage:"PARSE",step:5,progress:p,task:async x=>await this.parse(x,h)},a)),y.addTask(new Fe({stage:"FONT",step:5,progress:p,task:async x=>{const b=this.getFonts(x.model);return{model:x.model,data:b}}},a)),y.addTask(new Fe({stage:"LTYPE",step:1,progress:p,task:async x=>(this.processLineTypes(x.model,e),x)},a)),y.addTask(new Fe({stage:"STYLE",step:1,progress:p,task:async x=>(this.processTextStyles(x.model,e),x)},a)),y.addTask(new Fe({stage:"DIMSTYLE",step:1,progress:p,task:async x=>(this.processDimStyles(x.model,e),x)},a)),y.addTask(new Fe({stage:"LAYER",step:1,progress:p,task:async x=>(this.processLayers(x.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),x)},a)),y.addTask(new Fe({stage:"VPORT",step:1,progress:p,task:async x=>(this.processViewports(x.model,e),x)},a)),y.addTask(new Fe({stage:"HEADER",step:1,progress:p,task:async x=>(this.processHeader(x.model,e),x)},a)),y.addTask(new Fe({stage:"BLOCK_RECORD",step:5,progress:p,task:async x=>(this.processBlockTables(x.model,e),x)},a)),y.addTask(new Fe({stage:"OBJECT",step:5,progress:p,task:async x=>(this.processObjects(x.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),x)},a)),y.addTask(new Fe({stage:"BLOCK",step:5,progress:p,task:async x=>(await this.processBlocks(x.model,e),x)},a)),y.addTask(new Fe({stage:"ENTITY",step:100,progress:p,task:async x=>(await this.processEntities(x.model,e,i,p,a),x)},a)),y.addTask(new Fe({stage:"END",step:0,progress:p,task:async x=>x},a));const f=Date.now();await y.run(t),u.data.total=Date.now()-f}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),si.instance.clear())}getParserWorkerTimeout(t,e){const i=e??this.config.timeout;if(i!=null)return i;const a=Math.ceil(t.byteLength/Rd),h=Rl+a*1e3;return Math.min(Bd,Math.max(Rl,h))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,i,a,h){throw new Error("Not impelemented yet!")}}class Fd extends vo{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._liveSectionObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}var _e,Ti,re,le,Mi,ur,Ee,Er,cr,yn,Ni,Li,vn,wn,Oi,Ci,Bi,Ge,kr,Kt,bn,Ri,vt,ke,Fi,Te,zi,Tr,Mr,dr,Vi,xn,He,Nr,In,Pa,Aa,Lr,Or,Di,ji,Cr,Ui,Ea,ka,fe,Br,ye,Xe,Ta,Ma,Na,La,Rr,Ye,Sn,Wi,Pn,qe,Fr,Ke,zr;(_e={})[_e.None=0]="None",_e[_e.Anonymous=1]="Anonymous",_e[_e.NonConstant=2]="NonConstant",_e[_e.Xref=4]="Xref",_e[_e.XrefOverlay=8]="XrefOverlay",_e[_e.ExternallyDependent=16]="ExternallyDependent",_e[_e.ResolvedOrDependent=32]="ResolvedOrDependent",_e[_e.ReferencedXref=64]="ReferencedXref";(Ti={})[Ti.BYBLOCK=0]="BYBLOCK",Ti[Ti.BYLAYER=256]="BYLAYER";(re={})[re.Rotated=0]="Rotated",re[re.Aligned=1]="Aligned",re[re.Angular=2]="Angular",re[re.Diameter=3]="Diameter",re[re.Radius=4]="Radius",re[re.Angular3Point=5]="Angular3Point",re[re.Ordinate=6]="Ordinate",re[re.ReferenceIsExclusive=32]="ReferenceIsExclusive",re[re.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",re[re.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(le={})[le.TopLeft=1]="TopLeft",le[le.TopCenter=2]="TopCenter",le[le.TopRight=3]="TopRight",le[le.MiddleLeft=4]="MiddleLeft",le[le.MiddleCenter=5]="MiddleCenter",le[le.MiddleRight=6]="MiddleRight",le[le.BottomLeft=7]="BottomLeft",le[le.BottomCenter=8]="BottomCenter",le[le.BottomRight=9]="BottomRight";(Mi={})[Mi.AtLeast=1]="AtLeast",Mi[Mi.Exact=2]="Exact";var Fl=((ur={})[ur.Center=0]="Center",ur[ur.Above=1]="Above",ur[ur.Outside=2]="Outside",ur[ur.JIS=3]="JIS",ur[ur.Below=4]="Below",ur),Kn=((Ee={})[Ee.Feet=0]="Feet",Ee[Ee.None=1]="None",Ee[Ee.Inch=2]="Inch",Ee[Ee.FeetAndInch=3]="FeetAndInch",Ee[Ee.Leading=4]="Leading",Ee[Ee.Trailing=8]="Trailing",Ee[Ee.LeadingAndTrailing=12]="LeadingAndTrailing",Ee),zd=((Er={})[Er.None=0]="None",Er[Er.Leading=1]="Leading",Er[Er.Trailing=2]="Trailing",Er[Er.LeadingAndTrailing=3]="LeadingAndTrailing",Er),Vd=((cr={})[cr.Center=0]="Center",cr[cr.Left=1]="Left",cr[cr.Right=2]="Right",cr[cr.OverFirst=3]="OverFirst",cr[cr.OverSecond=4]="OverSecond",cr),Dd=((yn={})[yn.Bottom=0]="Bottom",yn[yn.Center=1]="Center",yn[yn.Top=2]="Top",yn),jd=((Ni={})[Ni.PatternFill=0]="PatternFill",Ni[Ni.SolidFill=1]="SolidFill",Ni);(Li={})[Li.NonAssociative=0]="NonAssociative",Li[Li.Associative=1]="Associative";(vn={})[vn.Normal=0]="Normal",vn[vn.Outer=1]="Outer",vn[vn.Ignore=2]="Ignore";(wn={})[wn.UserDefined=0]="UserDefined",wn[wn.Predefined=1]="Predefined",wn[wn.Custom=2]="Custom";(Oi={})[Oi.NotAnnotated=0]="NotAnnotated",Oi[Oi.Annotated=1]="Annotated";(Ci={})[Ci.Solid=0]="Solid",Ci[Ci.Gradient=1]="Gradient";(Bi={})[Bi.TwoColor=0]="TwoColor",Bi[Bi.OneColor=1]="OneColor";var Ud=((Ge={})[Ge.Default=0]="Default",Ge[Ge.External=1]="External",Ge[Ge.Polyline=2]="Polyline",Ge[Ge.Derived=4]="Derived",Ge[Ge.Textbox=8]="Textbox",Ge[Ge.Outermost=16]="Outermost",Ge),ys=((kr={})[kr.Line=1]="Line",kr[kr.Circular=2]="Circular",kr[kr.Elliptic=3]="Elliptic",kr[kr.Spline=4]="Spline",kr),Wd=((Kt={})[Kt.Off=0]="Off",Kt[Kt.Solid=1]="Solid",Kt[Kt.Dashed=2]="Dashed",Kt[Kt.Dotted=3]="Dotted",Kt[Kt.ShotDash=4]="ShotDash",Kt[Kt.MediumDash=5]="MediumDash",Kt[Kt.LongDash=6]="LongDash",Kt[Kt.DoubleShortDash=7]="DoubleShortDash",Kt[Kt.DoubleMediumDash=8]="DoubleMediumDash",Kt[Kt.DoubleLongDash=9]="DoubleLongDash",Kt[Kt.DoubleMediumLongDash=10]="DoubleMediumLongDash",Kt[Kt.SparseDot=11]="SparseDot",Kt);Wd.Off;(bn={})[bn.Standard=-3]="Standard",bn[bn.ByLayer=-2]="ByLayer",bn[bn.ByBlock=-1]="ByBlock";(Ri={})[Ri.English=0]="English",Ri[Ri.Metric=1]="Metric";(vt={})[vt.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",vt[vt.FRONT_CLIPPING=2]="FRONT_CLIPPING",vt[vt.BACK_CLIPPING=4]="BACK_CLIPPING",vt[vt.UCS_FOLLOW=8]="UCS_FOLLOW",vt[vt.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",vt[vt.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",vt[vt.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",vt[vt.FAST_ZOOM=128]="FAST_ZOOM",vt[vt.SNAP_MODE=256]="SNAP_MODE",vt[vt.GRID_MODE=512]="GRID_MODE",vt[vt.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",vt[vt.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",vt[vt.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",vt[vt.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",vt[vt.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",vt[vt.UNUSED=32768]="UNUSED",vt[vt.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",vt[vt.VIEWPORT_OFF=131072]="VIEWPORT_OFF",vt[vt.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",vt[vt.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",vt[vt.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",vt[vt.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(ke={})[ke.OPTIMIZED_2D=0]="OPTIMIZED_2D",ke[ke.WIREFRAME=1]="WIREFRAME",ke[ke.HIDDEN_LINE=2]="HIDDEN_LINE",ke[ke.FLAT_SHADED=3]="FLAT_SHADED",ke[ke.GOURAUD_SHADED=4]="GOURAUD_SHADED",ke[ke.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",ke[ke.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(Fi={})[Fi.UCS_UNCHANGED=0]="UCS_UNCHANGED",Fi[Fi.HAS_OWN_UCS=1]="HAS_OWN_UCS";(Te={})[Te.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",Te[Te.TOP=1]="TOP",Te[Te.BOTTOM=2]="BOTTOM",Te[Te.FRONT=3]="FRONT",Te[Te.BACK=4]="BACK",Te[Te.LEFT=5]="LEFT",Te[Te.RIGHT=6]="RIGHT";(zi={})[zi.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",zi[zi.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Tr={})[Tr.ByLayer=0]="ByLayer",Tr[Tr.ByBlock=1]="ByBlock",Tr[Tr.ByDictionaryDefault=2]="ByDictionaryDefault",Tr[Tr.ByObject=3]="ByObject";function Pt(n,t,e){return n.code===t&&(e==null||n.value===e)}function Ft(n){let t={};n.rewind();let e=n.next(),i=e.code;if(t.x=e.value,(e=n.next()).code!==i+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=n.next()).code!==i+20?n.rewind():t.z=e.value,t}let xo=Symbol();function bt(n,t){return(e,i,a)=>{let h=function(y,f=!1){return y.reduce((x,b)=>{b.pushContext&&x.push({});let E=x[x.length-1];for(let I of typeof b.code=="number"?[b.code]:b.code){let L=E[I]??(E[I]=[]);b.isMultiple&&L.length&&f&&console.warn(`Snippet ${L[L.length-1].name} for code(${I}) is shadowed by ${b.name}`),L.push(b)}return x},[{}])}(n,i.debug),u=!1,p=h.length-1;for(;!Pt(e,0,"EOF");){let y=function(V,z,it){return V.find((_t,st)=>{var H;return st>=it&&((H=_t[z])==null?void 0:H.length)})}(h,e.code,p),f=y==null?void 0:y[e.code],x=f==null?void 0:f[f.length-1];if(!y||!x){i.rewind();break}x.isMultiple||y[e.code].pop();let{name:b,parser:E,isMultiple:I,isReducible:L}=x,O=E==null?void 0:E(e,i,a);if(O===xo){i.rewind();break}if(b){let[V,z]=function(it,_t){let st=_t.split(".");if(!st.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let H=it;for(let dt=0;dt<st.length-1;++dt){let at=Oa(st[dt]),Gt=Oa(st[dt+1]);Object.prototype.hasOwnProperty.call(H,at)||(typeof Gt=="number"?H[at]=[]:H[at]={}),H=H[at]}return[H,Oa(st[st.length-1])]}(a,b);I&&!L?(Object.prototype.hasOwnProperty.call(V,z)||(V[z]=[]),V[z].push(O)):V[z]=O}x.pushContext&&(p-=1),u=!0,e=i.next()}return t&&Object.setPrototypeOf(a,t),u}}function Oa(n){let t=Number.parseInt(n);return Number.isNaN(t)?n:t}function w({value:n}){return n}function G(n,t){return Ft(t)}function jt({value:n}){return!!n}let Gd=[{code:1001,name:"xdata",parser:Iu}];function Iu(n,t){var a;if(!Pt(n,1001))throw Error("XData must starts with code 1001");let e={appName:n.value,value:[]};n=t.next();let i=[e.value];for(;!Pt(n,0,"EOF")&&n.code>=1e3;){let h=i[i.length-1];switch(n.code){case 1002:n.value==="{"?i.push([]):(i.pop(),(a=i[i.length-1])==null||a.push(h));break;case 1e3:case 1004:case 1040:case 1070:case 1071:h.push({type:Vr(n.code),value:n.value});break;case 1003:h.push({name:"layer",type:Vr(n.code),value:n.value});break;case 1005:h.push({name:"handle",type:Vr(n.code),value:n.value});break;case 1010:h.push({type:Vr(n.code),value:Ft(t)});break;case 1011:h.push({name:"worldSpacePosition",type:Vr(n.code),value:Ft(t)});break;case 1012:h.push({name:"worldSpaceDisplacement",type:Vr(n.code),value:Ft(t)});break;case 1013:h.push({name:"worldSpaceDirection",type:Vr(n.code),value:Ft(t)});break;case 1041:h.push({name:"distance",type:Vr(n.code),value:n.value});break;case 1042:h.push({name:"scale",type:Vr(n.code),value:n.value})}n=t.next()}return t.rewind(),e}function Vr(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 Tn(n,t,e){for(;Pt(n,102);){var i;let a=n.value;if(n=t.next(),!a.startsWith("{")){t.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${a}`),function(u,p){for(;!Pt(u,102)&&!Pt(u,0,"EOF");)u=p.next()}(n,t),n=t.next();continue}let h=a.slice(1).trim();e.extensions??(e.extensions={}),(i=e.extensions)[h]??(i[h]=[]),function(u,p,y){for(;!Pt(u,102,"}")&&!Pt(u,0,"EOF");)y.push(u),u=p.next()}(n,t,e.extensions[h]),n=t.next()}t.rewind()}let Hd=0;function Su(n){if(!n)throw TypeError("entity cannot be undefined or null");n.handle||(n.handle=Hd++)}var Xd=[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 Pu(n){return Xd[n]}(Mr={})[Mr.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Mr[Mr.CAST=1]="CAST",Mr[Mr.RECEIVE=2]="RECEIVE",Mr[Mr.IGNORE=3]="IGNORE";let Wt=[...Gd,{code:284,name:"shadowMode",parser:w},{code:390,name:"plotStyleHardId",parser:w},{code:380,name:"plotStyleType",parser:w},{code:440,name:"transparency",parser:w},{code:430,name:"colorName",parser:w},{code:420,name:"color",parser:w},{code:310,name:"proxyEntity",isMultiple:!0,parser:w},{code:92,name:"proxyByte",parser:w},{code:60,name:"isVisible",parser:jt},{code:48,name:"lineTypeScale",parser:w},{code:370,name:"lineweight",parser:w},{code:62,name:"colorIndex",parser(n,t,e){let i=n.value;return i>0&&i<256&&(e.color=Pu(Math.abs(i))),i}},{code:347,name:"materialObjectHardId",parser:w},{code:6,name:"lineType",parser:w},{code:8,name:"layer",parser:w},{code:410,name:"layoutTabName",parser:w},{code:67,name:"isInPaperSpace",parser:jt},{code:100},{code:160},{code:330,name:"ownerBlockRecordSoftId",parser:w},{code:102,parser:Tn},{code:102,parser:Tn},{code:102,parser:Tn},{code:5,name:"handle",parser:w}];function ua(n){return[{code:3,name:n,parser:(t,e,i)=>(i._code3text=(i._code3text??"")+t.value,i._code3text+(i._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:n,parser:(t,e,i)=>(i._code1text=t.value,(i._code3text??"")+i._code1text)}]}function Au(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Yd={extrusionDirection:{x:0,y:0,z:1}},qd=[{code:210,name:"extrusionDirection",parser:G},{code:51,name:"endAngle",parser:w},{code:50,name:"startAngle",parser:w},{code:100,name:"subclassMarker",parser:w},{code:40,name:"radius",parser:w},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:w},{code:100},...Wt];class Eu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Au(this,"parser",bt(qd,Yd))}}Au(Eu,"ForEntityName","ARC");(dr={})[dr.NONE=0]="NONE",dr[dr.INVISIBLE=1]="INVISIBLE",dr[dr.CONSTANT=2]="CONSTANT",dr[dr.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",dr[dr.PRESET=8]="PRESET";(Vi={})[Vi.MULTILINE=2]="MULTILINE",Vi[Vi.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(xn={})[xn.NONE=0]="NONE",xn[xn.MIRRORED_X=2]="MIRRORED_X",xn[xn.MIRRORED_Y=4]="MIRRORED_Y";var Kd=((He={})[He.LEFT=0]="LEFT",He[He.CENTER=1]="CENTER",He[He.RIGHT=2]="RIGHT",He[He.ALIGNED=3]="ALIGNED",He[He.MIDDLE=4]="MIDDLE",He[He.FIT=5]="FIT",He),$d=((Nr={})[Nr.BASELINE=0]="BASELINE",Nr[Nr.BOTTOM=1]="BOTTOM",Nr[Nr.MIDDLE=2]="MIDDLE",Nr[Nr.TOP=3]="TOP",Nr);function ku(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let Tu={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:Kd.LEFT,valign:$d.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Mu=[{code:73,name:"valign",parser:w},{code:100},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:72,name:"valign",parser:w},{code:72,name:"halign",parser:w},{code:71,name:"generationFlag",parser:w},{code:7,name:"styleName",parser:w},{code:51,name:"obliqueAngle",parser:w},{code:41,name:"xScale",parser:w},{code:50,name:"rotation",parser:w},{code:1,name:"text",parser:w},{code:40,name:"textHeight",parser:w},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class Nu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){ku(this,"parser",bt(Mu,Tu))}}function Lu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}ku(Nu,"ForEntityName","TEXT");let Zd={...Tu},Qd=[{code:2},{code:40,name:"annotationScale",parser:w},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:w},{code:70,name:"numberOfSecondaryAttributes",parser:w},{code:70,name:"isReallyLocked",parser:jt},{code:70,name:"mtextFlag",parser:w},{code:280,name:"isDuplicatedRecord",parser:jt},{code:100},{code:280,name:"isLocked",parser:jt},{code:74,name:"valign",parser:w},{code:73},{code:70,name:"attributeFlag",parser:w},{code:2,name:"tag",parser:w},{code:3,name:"prompt",parser:w},{code:280},{code:100,name:"subclassMarker",parser:w},...Mu.slice(2)];class Ou{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Lu(this,"parser",bt(Qd,Zd))}}Lu(Ou,"ForEntityName","ATTDEF");(In={})[In.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",In[In.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",In[In.BY_STYLE=5]="BY_STYLE";function Jd(n,t){let e={};for(let i of n){let a=t(i);a!=null&&(e[a]??(e[a]=[]),e[a].push(i))}return e}function*Js(n,t=1/0,e=1){for(let i=n;i!==t;i+=e)yield i}function on(n){return{x:n.x??0,y:n.y??0,z:n.z??0}}function Io(n,t,e){if(Pt(t,102))return Tn(t,e,n),!0;switch(t.code){case 0:n.type=t.value;break;case 5:n.handle=t.value;break;case 330:n.ownerBlockRecordSoftId=t.value;break;case 67:n.isInPaperSpace=!!t.value;break;case 8:n.layer=t.value;break;case 6:n.lineType=t.value;break;case 347:n.materialObjectHardId=t.value;break;case 62:n.colorIndex=t.value,n.color=Pu(Math.abs(t.value));break;case 370:n.lineweight=t.value;break;case 48:n.lineTypeScale=t.value;break;case 60:n.isVisible=!!t.value;break;case 92:n.proxyByte=t.value;break;case 310:n.proxyEntity=t.value;break;case 100:break;case 420:n.color=t.value;break;case 430:n.transparency=t.value;break;case 390:n.plotStyleHardId=t.value;break;case 284:n.shadowMode=t.value;break;case 1001:n.xdata=Iu(t,e);break;default:return!1}return!0}function Cu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let t0={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},xs=[{code:46,name:"annotationHeight",parser:w},{code:101,parser(n,t){(function(e){e.rewind();let i=e.next();if(i.code!==101)throw Error("Bad call for skipEmbeddedObject()");do i=e.next();while(i.code!==0);e.rewind()})(t)}},{code:50,name:"columnHeight",parser:w},{code:49,name:"columnGutter",parser:w},{code:48,name:"columnWidth",parser:w},{code:79,name:"columnAutoHeight",parser:w},{code:78,name:"columnFlowReversed",parser:w},{code:76,name:"columnCount",parser:w},{code:75,name:"columnType",parser:w},{code:441,name:"backgroundFillTransparency",parser:w},{code:63,name:"backgroundFillColor",parser:w},{code:45,name:"fillBoxScale",parser:w},{code:[...Js(430,440)],name:"backgroundColor",parser:w},{code:[...Js(420,430)],name:"backgroundColor",parser:w},{code:90,name:"backgroundFill",parser:w},{code:44,name:"lineSpacing",parser:w},{code:73,name:"lineSpacingStyle",parser:w},{code:50,name:"rotation",parser:w},{code:43},{code:42},{code:11,name:"direction",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:7,name:"styleName",parser:w},...ua("text"),{code:72,name:"drawingDirection",parser:w},{code:71,name:"attachmentPoint",parser:w},{code:41,name:"width",parser:w},{code:40,name:"height",parser:w},{code:10,name:"insertionPoint",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class Bu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Cu(this,"parser",bt(xs,t0))}}function Ru(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Cu(Bu,"ForEntityName","MTEXT");let e0={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},r0=[...xs.slice(xs.findIndex(({name:n})=>n==="columnType"),xs.findIndex(({name:n})=>n==="subclassMarker")+1),{code:100},{code:0,parser(n){if(!Pt(n,0,"MTEXT"))return xo}},{code:2,name:"definitionTag",parser:w},{code:40,name:"annotationScale",parser:w},{code:10,name:"alignmentPoint",parser:G},{code:340,name:"secondaryAttributesHardId",parser:w},{code:70,name:"numberOfSecondaryAttributes",parser:w},{code:70,name:"isReallyLocked",parser:jt},{code:70,name:"mtextFlag",parser:w},{code:280,name:"isDuplicatedEntriesKeep",parser:jt},{code:100},{code:280,name:"lockPositionFlag",parser:jt},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"alignmentPoint",parser:G},{code:74,name:"verticalJustification",parser:w},{code:72,name:"horizontalJustification",parser:w},{code:71,name:"textGenerationFlag",parser:w},{code:7,name:"textStyle",parser:w},{code:51,name:"obliqueAngle",parser:w},{code:41,name:"scale",parser:w},{code:50,name:"rotation",parser:w},{code:73},{code:70,name:"attributeFlag",parser:w},{code:2,name:"tag",parser:w},{code:280},{code:100,name:"subclassMarker",parser:w},{code:1,name:"text",parser:w},{code:40,name:"textHeight",parser:w},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:w},{code:100},...Wt];class Fu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ru(this,"parser",bt(r0,e0))}}function zu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ru(Fu,"ForEntityName","ATTRIB");let n0=[...ua("data"),{code:70,name:"version",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class Vu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){zu(this,"parser",bt(n0))}}function Du(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}zu(Vu,"ForEntityName","BODY");let i0={thickness:0,extrusionDirection:{x:0,y:0,z:1}},s0=[{code:210,name:"extrusionDirection",parser:G},{code:40,name:"radius",parser:w},{code:10,name:"center",parser:G},{code:39,name:"thickness",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class ju{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Du(this,"parser",bt(s0,i0))}}Du(ju,"ForEntityName","CIRCLE");class Is{parseEntity(t,e){let i={};for(;!Pt(e,0,"EOF");){if(e.code===0){t.rewind();break}(function(a,h,u){switch(h.code){case 100:a.subclassMarker=h.value;break;case 280:a.version=h.value;break;case 2:a.name=h.value;break;case 10:a.definitionPoint=Ft(u);break;case 11:a.textPoint=Ft(u);break;case 12:a.insertionPoint=Ft(u);break;case 13:a.subDefinitionPoint1=Ft(u);break;case 14:a.subDefinitionPoint2=Ft(u);break;case 15:a.centerPoint=Ft(u);break;case 16:a.arcPoint=Ft(u);break;case 70:a.dimensionType=h.value;break;case 71:a.attachmentPoint=h.value;break;case 72:a.textLineSpacingStyle=h.value;break;case 40:a.leaderLength=h.value;break;case 41:a.textLineSpacingFactor=h.value;break;case 42:a.measurement=h.value;break;case 1:a.text=h.value;break;case 50:a.rotationAngle=h.value;break;case 52:a.obliqueAngle=h.value;break;case 53:a.textRotation=h.value;break;case 51:a.ocsRotation=h.value;break;case 210:a.extrusionDirection=Ft(u);break;case 3:a.styleName=h.value;break;default:Io(a,h,u)}})(i,e,t),e=t.next()}return i}}function Uu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Aa="DIMENSION",(Pa="ForEntityName")in Is?Object.defineProperty(Is,Pa,{value:Aa,enumerable:!0,configurable:!0,writable:!0}):Is[Pa]=Aa;let a0={extrusionDirection:{x:0,y:0,z:1}},o0=[{code:42,name:"endAngle",parser:w},{code:41,name:"startAngle",parser:w},{code:40,name:"axisRatio",parser:w},{code:210,name:"extrusionDirection",parser:G},{code:11,name:"majorAxisEndPoint",parser:G},{code:10,name:"center",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class Wu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Uu(this,"parser",bt(o0,a0))}}Uu(Wu,"ForEntityName","ELLIPSE");(Lr={})[Lr.First=1]="First",Lr[Lr.Second=2]="Second",Lr[Lr.Third=4]="Third",Lr[Lr.Fourth=8]="Fourth";function Gu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let l0=[{code:13,name:"vertices.3",parser:G},{code:12,name:"vertices.2",parser:G},{code:11,name:"vertices.1",parser:G},{code:10,name:"vertices.0",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class Hu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Gu(this,"parser",bt(l0))}}Gu(Hu,"ForEntityName","3DFACE");let Xu=[{code:330,name:"sourceBoundaryObjects",parser:w,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:w}],h0=[{code:11,name:"end",parser:G},{code:10,name:"start",parser:G}],u0=[{code:73,name:"isCCW",parser:jt},{code:51,name:"endAngle",parser:w},{code:50,name:"startAngle",parser:w},{code:40,name:"radius",parser:w},{code:10,name:"center",parser:G}],c0=[{code:73,name:"isCCW",parser:jt},{code:51,name:"endAngle",parser:w},{code:50,name:"startAngle",parser:w},{code:40,name:"lengthOfMinorAxis",parser:w},{code:11,name:"end",parser:G},{code:10,name:"center",parser:G}],d0=[{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:11,name:"fitDatum",isMultiple:!0,parser:G},{code:97,name:"numberOfFitData",parser:w},{code:10,name:"controlPoints",isMultiple:!0,parser(n,t){let e={...Ft(t),weight:1};return(n=t.next()).code===42?e.weight=n.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:w},{code:96,name:"numberOfControlPoints",parser:w},{code:95,name:"numberOfKnots",parser:w},{code:74,name:"isPeriodic",parser:jt},{code:73,name:"splineFlag",parser:w},{code:94,name:"degree",parser:w}],p0={[ys.Line]:h0,[ys.Circular]:u0,[ys.Elliptic]:c0,[ys.Spline]:d0},g0=[...Xu,{code:72,name:"edges",parser(n,t){let e={type:n.value},i=bt(p0[e.type]);if(!i)throw Error(`Invalid edge type ${e.type}`);return i(n=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:w}],m0=[...Xu,{code:10,name:"vertices",parser(n,t){let e={...Ft(t),bulge:0};return(n=t.next()).code===42?e.bulge=n.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:w},{code:73,name:"isClosed",parser:jt},{code:72,name:"hasBulge",parser:jt}],_0=[{code:49,name:"dashLengths",parser:w,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:w},{code:45,name:"offset",parser:zl},{code:43,name:"base",parser:zl},{code:53,name:"angle",parser:w}];function zl(n,t){let e=n.code+1,i={x:n.value,y:1};return(n=t.next()).code===e?i.y=n.value:t.rewind(),i}function Yu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let f0={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},y0=[{code:470},{code:463},{code:462,name:"colorTint",parser:w},{code:461,name:"gradientDefinition",parser:w},{code:460,name:"gradientRotation",parser:w},{code:453,name:"numberOfColors",parser:w},{code:452,name:"gradientColorFlag",parser:w},{code:451},{code:450,name:"gradientFlag",parser:w},{code:10,name:"seedPoints",parser:G,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:G},{code:98,name:"numberOfSeedPoints",parser:w},{code:47,name:"pixelSize",parser:w},{code:53,name:"definitionLines",parser:function(n,t){let e={};return bt(_0)(n,t,e),e},isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:w},{code:77,name:"isDouble",parser:jt},{code:73,name:"isAnnotated",parser:jt},{code:41,name:"patternScale",parser:w},{code:52,name:"patternAngle",parser:w},{code:76,name:"patternType",parser:w},{code:75,name:"hatchStyle",parser:w},{code:92,name:"boundaryPaths",parser:function(n,t){let e={boundaryPathTypeFlag:n.value},i=e.boundaryPathTypeFlag&Ud.Polyline;return n=t.next(),i?bt(m0)(n,t,e):bt(g0)(n,t,e),e},isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:w},{code:71,name:"associativity",parser:w},{code:63,name:"patternFillColor",parser:w},{code:70,name:"solidFill",parser:w},{code:2,name:"patternName",parser:w},{code:210,name:"extrusionDirection",parser:G},{code:10,name:"elevationPoint",parser:G},{code:100,name:"subclassMarker",parser:w,pushContext:!0},...Wt];class qu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Yu(this,"parser",bt(y0,f0))}}Yu(qu,"ForEntityName","HATCH");(Or={})[Or.ShowImage=1]="ShowImage",Or[Or.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Or[Or.UseClippingBoundary=4]="UseClippingBoundary",Or[Or.TransparencyIsOn=8]="TransparencyIsOn";(Di={})[Di.Rectangular=1]="Rectangular",Di[Di.Polygonal=2]="Polygonal";(ji={})[ji.Outside=0]="Outside",ji[ji.Inside=1]="Inside";function Ku(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let v0={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},w0=[{code:290,name:"clipMode",parser:w},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:G},{code:91,name:"countBoundaryPoints",parser:w},{code:71,name:"clippingBoundaryType",parser:w},{code:360,name:"imageDefReactorHandle",parser:w},{code:283,name:"fade",parser:w},{code:282,name:"contrast",parser:w},{code:281,name:"brightness",parser:w},{code:280,name:"isClipped",parser:jt},{code:70,name:"flags",parser:w},{code:340,name:"imageDefHandle",parser:w},{code:13,name:"imageSize",parser:G},{code:12,name:"vPixel",parser:G},{code:11,name:"uPixel",parser:G},{code:10,name:"position",parser:G},{code:90,name:"version",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class $u{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ku(this,"parser",bt(w0,v0))}}function Zu(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ku($u,"ForEntityName","IMAGE");let b0={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},x0=[{code:210,name:"extrusionDirection",parser:G},{code:45,name:"rowSpacing",parser:w},{code:44,name:"columnSpacing",parser:w},{code:71,name:"rowCount",parser:w},{code:70,name:"columnCount",parser:w},{code:50,name:"rotation",parser:w},{code:43,name:"zScale",parser:w},{code:42,name:"yScale",parser:w},{code:41,name:"xScale",parser:w},{code:10,name:"insertionPoint",parser:G},{code:2,name:"name",parser:w},{code:66,name:"isVariableAttributes",parser:jt},{code:100,name:"subclassMarker",parser:w},...Wt];class Qu{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Zu(this,"parser",bt(x0,b0))}}function Ju(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Zu(Qu,"ForEntityName","INSERT");let I0={isArrowheadEnabled:!0},S0=[{code:213,name:"offsetFromAnnotation",parser:G},{code:212,name:"offsetFromBlock",parser:G},{code:211,name:"horizontalDirection",parser:G},{code:210,name:"normal",parser:G},{code:340,name:"associatedAnnotation",parser:w},{code:77,name:"byBlockColor",parser:w},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:76,name:"numberOfVertices",parser:w},{code:41,name:"textWidth",parser:w},{code:40,name:"textHeight",parser:w},{code:75,name:"isHooklineExists",parser:jt},{code:74,name:"isHooklineSameDirection",parser:jt},{code:73,name:"leaderCreationFlag",parser:w},{code:72,name:"isSpline",parser:jt},{code:71,name:"isArrowheadEnabled",parser:jt},{code:3,name:"styleName",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class tc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ju(this,"parser",bt(S0,I0))}}Ju(tc,"ForEntityName","LEADER");(Cr={})[Cr.TextAnnotation=0]="TextAnnotation",Cr[Cr.ToleranceAnnotation=1]="ToleranceAnnotation",Cr[Cr.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",Cr[Cr.NoAnnotation=3]="NoAnnotation";function ec(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let P0={thickness:0,extrusionDirection:{x:0,y:0,z:1}},A0=[{code:210,name:"extrusionDirection",parser:G},{code:11,name:"endPoint",parser:G},{code:10,name:"startPoint",parser:G},{code:39,name:"thickness",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class rc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){ec(this,"parser",bt(A0,P0))}}ec(rc,"ForEntityName","LINE");(Ui={})[Ui.IS_CLOSED=1]="IS_CLOSED",Ui[Ui.PLINE_GEN=128]="PLINE_GEN";let E0={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},k0={bulge:0},T0=[{code:42,name:"bulge",parser:w},{code:41,name:"endWidth",parser:w},{code:40,name:"startWidth",parser:w},{code:91,name:"id",parser:w},{code:20,name:"y",parser:w},{code:10,name:"x",parser:w}],M0=[{code:210,name:"extrusionDirection",parser:G},{code:10,name:"vertices",isMultiple:!0,parser(n,t){let e={};return bt(T0,k0)(n,t,e),e}},{code:39,name:"thickness",parser:w},{code:38,name:"elevation",parser:w},{code:43,name:"constantWidth",parser:w},{code:70,name:"flag",parser:w},{code:90,name:"numberOfVertices",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class Ss{parseEntity(t,e){let i={};return bt(M0,E0)(e,t,i),i}}function nc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}ka="LWPOLYLINE",(Ea="ForEntityName")in Ss?Object.defineProperty(Ss,Ea,{value:ka,enumerable:!0,configurable:!0,writable:!0}):Ss[Ea]=ka;let N0=[{code:90,name:"overridenSubEntityCount",parser:w},{code:140,name:"edgeCreaseWeights",parser:w,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:w},{code:94,parser(n,t,e){e.edgeCount=n.value,e.edgeIndices=[];for(let i=0;i<e.edgeCount;++i){let a=[];n=t.next(),a[0]=n.value,n=t.next(),a[1]=n.value,e.edgeIndices.push(a)}}},{code:93,parser(n,t,e){e.totalFaceIndices=n.value,e.faceIndices=[];let i=[];for(let h=0;h<e.totalFaceIndices&&!Pt(n,0);++h)n=t.next(),i.push(n.value);let a=0;for(;a<i.length;){let h=i[a++],u=[];for(let p=0;p<h;++p)u.push(i[a++]);e.faceIndices.push(u)}}},{code:10,name:"vertices",parser:G,isMultiple:!0},{code:92,name:"verticesCount",parser:w},{code:91,name:"subdivisionLevel",parser:w},{code:40,name:"blendCrease",parser:w},{code:72,name:"isBlendCreased",parser:jt},{code:71,name:"version",parser:w},{code:100,name:"subclassMarker",parser:function({value:n}){return n.trim()},pushContext:!0},...Wt];class ic{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){nc(this,"parser",bt(N0))}}function sc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}nc(ic,"ForEntityName","MESH");let L0={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},O0=[{code:50,name:"angle",parser:w},{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:w},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class ac{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){sc(this,"parser",bt(O0,L0))}}sc(ac,"ForEntityName","POINT");(fe={})[fe.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",fe[fe.CURVE_FIT=2]="CURVE_FIT",fe[fe.SPLINE_FIT=4]="SPLINE_FIT",fe[fe.POLYLINE_3D=8]="POLYLINE_3D",fe[fe.POLYGON_3D=16]="POLYGON_3D",fe[fe.CLOSED_POLYGON=32]="CLOSED_POLYGON",fe[fe.POLYFACE=64]="POLYFACE",fe[fe.CONTINUOUS=128]="CONTINUOUS";var vs=((Br={})[Br.NONE=0]="NONE",Br[Br.QUADRATIC=5]="QUADRATIC",Br[Br.CUBIC=6]="CUBIC",Br[Br.BEZIER=8]="BEZIER",Br),C0=((ye={})[ye.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",ye[ye.TANGENT_DEFINED=2]="TANGENT_DEFINED",ye[ye.NOT_USED=4]="NOT_USED",ye[ye.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",ye[ye.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",ye[ye.FOR_POLYLINE=32]="FOR_POLYLINE",ye[ye.FOR_POLYGON=64]="FOR_POLYGON",ye[ye.POLYFACE=128]="POLYFACE",ye);function oc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let B0={startWidth:0,endWidth:0,bulge:0},R0=[{code:91,name:"id",parser:w},{code:[...Js(71,75)],name:"faces",isMultiple:!0,parser:w},{code:50,name:"tangentDirection",parser:w},{code:70,name:"flag",parser:w},{code:42,name:"bulge",parser:w},{code:41,name:"endWidth",parser:w},{code:40,name:"startWidth",parser:w},{code:30,name:"z",parser:w},{code:20,name:"y",parser:w},{code:10,name:"x",parser:w},{code:100,name:"subclassMarker",parser:w},{code:100},...Wt];class So{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){oc(this,"parser",bt(R0,B0))}}function lc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}oc(So,"ForEntityName","VERTEX");let F0={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:[]},z0=[{code:0,name:"vertices",isMultiple:!0,parser:(n,t)=>Pt(n,0,"VERTEX")?(n=t.next(),new So().parseEntity(t,n)):xo},{code:210,name:"extrusionDirection",parser:G},{code:75,name:"smoothType",parser:w},{code:74,name:"surfaceNDensity",parser:w},{code:73,name:"surfaceMDensity",parser:w},{code:72,name:"meshNVertexCount",parser:w},{code:71,name:"meshMVertexCount",parser:w},{code:41,name:"endWidth",parser:w},{code:40,name:"startWidth",parser:w},{code:70,name:"flag",parser:w},{code:39,name:"thickness",parser:w},{code:30,name:"elevation",parser:w},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:w},...Wt];class hc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){lc(this,"parser",bt(z0,F0))}}function uc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}lc(hc,"ForEntityName","POLYLINE");let V0=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class cc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){uc(this,"parser",bt(V0))}}function dc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}uc(cc,"ForEntityName","RAY");let D0=[...ua("data"),{code:70,name:"version",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class pc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){dc(this,"parser",bt(D0))}}function gc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}dc(pc,"ForEntityName","REGION");let j0={vertices:[],backLineVertices:[]},U0=[{code:360,name:"geometrySettingHardId",parser:w},{code:12,name:"backLineVertices",isMultiple:!0,parser:G},{code:93,name:"numberOfBackLineVertices",parser:w},{code:11,name:"vertices",isMultiple:!0,parser:G},{code:92,name:"verticesCount",parser:w},{code:[63,411],name:"indicatorColor",parser:w},{code:70,name:"indicatorTransparency",parser:w},{code:41,name:"bottomHeight",parser:w},{code:40,name:"topHeight",parser:w},{code:10,name:"verticalDirection",parser:G},{code:1,name:"name",parser:w},{code:91,name:"flag",parser:w},{code:90,name:"state",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class mc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){gc(this,"parser",bt(U0,j0))}}function _c(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}gc(mc,"ForEntityName","SECTION");let W0={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},G0=[{code:210,name:"extrusionDirection",parser:G},{code:39,name:"thickness",parser:w},{code:[...Js(10,14)],name:"points",isMultiple:!0,parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class fc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){_c(this,"parser",bt(G0,W0))}}function yc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}_c(fc,"ForEntityName","SOLID");let H0=[{code:350,name:"historyObjectSoftId",parser:w},{code:100,name:"subclassMarker",parser:w},...ua("data"),{code:70,name:"version",parser:w},{code:100},...Wt];class vc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){yc(this,"parser",bt(H0))}}yc(vc,"ForEntityName","3DSOLID");(Xe={})[Xe.NONE=0]="NONE",Xe[Xe.CLOSED=1]="CLOSED",Xe[Xe.PERIODIC=2]="PERIODIC",Xe[Xe.RATIONAL=4]="RATIONAL",Xe[Xe.PLANAR=8]="PLANAR",Xe[Xe.LINEAR=16]="LINEAR";function wc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let X0={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},Y0=[{code:11,name:"fitPoints",isMultiple:!0,parser:G},{code:10,name:"controlPoints",isMultiple:!0,parser:G},{code:41,name:"weights",isMultiple:!0,parser:w},{code:40,name:"knots",isMultiple:!0,parser:w},{code:13,name:"endTangent",parser:G},{code:12,name:"startTangent",parser:G},{code:44,name:"fitTolerance",parser:w},{code:43,name:"controlTolerance",parser:w},{code:42,name:"knotTolerance",parser:w},{code:74,name:"numberOfFitPoints",parser:w},{code:73,name:"numberOfControlPoints",parser:w},{code:72,name:"numberOfKnots",parser:w},{code:71,name:"degree",parser:w},{code:70,name:"flag",parser:w},{code:210,name:"normal",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class bc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){wc(this,"parser",bt(Y0,X0))}}wc(bc,"ForEntityName","SPLINE");class Ps{parseEntity(t,e){let i={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:i.subclassMarker=e.value,e=t.next();break;case 2:i.name=e.value,e=t.next();break;case 5:i.handle=e.value,e=t.next();break;case 10:i.startPoint=on(Ft(t)),e=t.lastReadGroup;break;case 11:i.directionVector=on(Ft(t)),e=t.lastReadGroup;break;case 90:i.tableValue=e.value,e=t.next();break;case 91:i.rowCount=e.value,e=t.next();break;case 92:i.columnCount=e.value,e=t.next();break;case 93:i.overrideFlag=e.value,e=t.next();break;case 94:i.borderColorOverrideFlag=e.value,e=t.next();break;case 95:i.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:i.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:i.rowHeightArr??(i.rowHeightArr=[]),i.rowHeightArr.push(e.value),e=t.next();break;case 142:i.columnWidthArr??(i.columnWidthArr=[]),i.columnWidthArr.push(e.value),e=t.next();break;case 280:i.version=e.value,e=t.next();break;case 310:i.bmpPreview??(i.bmpPreview=""),i.bmpPreview+=e.value,e=t.next();break;case 330:i.ownerDictionaryId=e.value,e=t.next();break;case 342:i.tableStyleId=e.value,e=t.next();break;case 343:i.blockRecordHandle=e.value,e=t.next();break;case 170:i.attachmentPoint=e.value,e=t.next();break;case 171:i.cells??(i.cells=[]),i.cells.push(function(a,h){let u=!1,p=!1,y={};for(;!a.isEOF()&&h.code!==0&&!p;)switch(h.code){case 171:if(u){p=!0;continue}y.cellType=h.value,u=!0,h=a.next();break;case 172:y.flagValue=h.value,h=a.next();break;case 173:y.mergedValue=h.value,h=a.next();break;case 174:y.autoFit=h.value,h=a.next();break;case 175:y.borderWidth=h.value,h=a.next();break;case 176:y.borderHeight=h.value,h=a.next();break;case 91:y.overrideFlag=h.value,h=a.next();break;case 178:y.virtualEdgeFlag=h.value,h=a.next();break;case 145:y.rotation=h.value,h=a.next();break;case 345:y.fieldObjetId=h.value,h=a.next();break;case 340:y.blockTableRecordId=h.value,h=a.next();break;case 146:y.blockScale=h.value,h=a.next();break;case 177:y.blockAttrNum=h.value,h=a.next();break;case 7:y.textStyle=h.value,h=a.next();break;case 140:y.textHeight=h.value,h=a.next();break;case 170:y.attachmentPoint=h.value,h=a.next();break;case 92:y.extendedCellFlags=h.value,h=a.next();break;case 285:y.rightBorderVisibility=!!(h.value??!0),h=a.next();break;case 286:y.bottomBorderVisibility=!!(h.value??!0),h=a.next();break;case 288:y.leftBorderVisibility=!!(h.value??!0),h=a.next();break;case 289:y.topBorderVisibility=!!(h.value??!0),h=a.next();break;case 301:(function(f,x,b){for(;b.code!==304;)switch(b.code){case 301:case 93:case 90:case 94:b=x.next();break;case 1:f.text=b.value,b=x.next();break;case 300:f.attrText=b.value,b=x.next();break;case 302:f.text=b.value?b.value:f.text,b=x.next();break;default:console.log(`Ignore code: ${b.code}, value: ${b.value}`),b=x.next()}})(y,a,h),h=a.next();break;default:return y}return u=!1,p=!1,y}(t,e)),e=t.lastReadGroup;break;default:Io(i,e,t),e=t.next()}}return i}}function xc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ma="ACAD_TABLE",(Ta="ForEntityName")in Ps?Object.defineProperty(Ps,Ta,{value:Ma,enumerable:!0,configurable:!0,writable:!0}):Ps[Ta]=Ma;let q0=[{code:11,name:"xAxisDirection",parser:G},{code:210,name:"extrusionDirection",parser:G},{code:1,name:"text",parser:w},{code:10,name:"position",parser:G},{code:3,name:"styleName",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class Ic{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){xc(this,"parser",bt(q0))}}xc(Ic,"ForEntityName","TOLERANCE");class As{parseEntity(t,e){let i={};for(;e!=="EOF";){if(e.code===0){t.rewind();break}!function(a,h,u){if(u==="EOF")return!1;switch(u.code){case 0:return!1;case 8:a.layer=u.value;break;case 100:a.subclassMarker=u.value;break;case 10:a.viewportCenter=on(Ft(h));break;case 40:a.width=u.value;break;case 41:a.height=u.value;break;case 68:a.status=u.value;break;case 69:a.viewportId=u.value;break;case 12:a.displayCenter=Ft(h);break;case 13:a.snapBase=Ft(h);break;case 14:a.snapSpacing=Ft(h);break;case 15:a.gridSpacing=Ft(h);break;case 16:a.viewDirection=on(Ft(h));break;case 17:a.targetPoint=on(Ft(h));break;case 42:a.perspectiveLensLength=u.value;break;case 43:a.frontClipZ=u.value;break;case 44:a.backClipZ=u.value;break;case 45:a.viewHeight=u.value;break;case 50:a.snapAngle=u.value;break;case 51:a.viewTwistAngle=u.value;break;case 72:a.circleZoomPercent=u.value;break;case 331:a.frozenLayerIds??(a.frozenLayerIds=[]),a.frozenLayerIds.push(u.value);break;case 90:a.statusBitFlags=u.value;break;case 340:a.clippingBoundaryId=u.value;break;case 1:a.sheetName=u.value;break;case 281:a.renderMode=u.value;break;case 71:a.ucsPerViewport=u.value;break;case 110:a.ucsOrigin=on(Ft(h));break;case 111:a.ucsXAxis=on(Ft(h));break;case 112:a.ucsYAxis=on(Ft(h));break;case 345:a.ucsId=u.value;break;case 346:a.ucsBaseId=u.value;break;case 79:a.orthographicType=u.value;break;case 146:a.elevation=u.value;break;case 170:a.shadePlotMode=u.value;break;case 61:a.majorGridFrequency=u.value;break;case 332:a.backgroundId=u.value;break;case 333:a.shadePlotId=u.value;break;case 348:a.visualStyleId=u.value;break;case 292:a.isDefaultLighting=!!u.value;break;case 282:a.defaultLightingType=u.value;break;case 141:a.brightness=u.value;break;case 142:a.contrast=u.value;break;case 63:case 421:case 431:a.ambientLightColor=u.value;break;case 361:a.sunId=u.value;break;case 335:case 343:case 344:case 91:a.softPointer=u.value}return!0}(i,t,e)&&Io(i,e,t),e=t.next()}return i}}La="VIEWPORT",(Na="ForEntityName")in As?Object.defineProperty(As,Na,{value:La,enumerable:!0,configurable:!0,writable:!0}):As[Na]=La;(Rr={})[Rr.ShowImage=1]="ShowImage",Rr[Rr.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Rr[Rr.UseClippingBoundary=4]="UseClippingBoundary",Rr[Rr.Transparency=8]="Transparency";function Sc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}let K0={brightness:50,constrast:50,fade:0},$0=[{code:14,name:"boundary",isMultiple:!0,parser:G},{code:91,name:"numberOfVertices",parser:w},{code:71,name:"boundaryType",parser:w},{code:360,name:"imageDefReactorHardId",parser:w},{code:283,name:"fade",parser:w},{code:282,name:"contrast",parser:w},{code:281,name:"brightness",parser:w},{code:280,name:"isClipping",parser:jt},{code:70,name:"displayFlag",parser:w},{code:340,name:"imageDefHardId",parser:w},{code:13,name:"imageSize",parser:G},{code:12,name:"vDirection",parser:G},{code:11,name:"uDirection",parser:G},{code:10,name:"position",parser:G},{code:90,name:"classVersion",parser:w},{code:100,name:"subclassMarker",parser:w},...Wt];class Pc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Sc(this,"parser",bt($0,K0))}}function Ac(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Sc(Pc,"ForEntityName","WIPEOUT");let Z0=[{code:11,name:"direction",parser:G},{code:10,name:"position",parser:G},{code:100,name:"subclassMarker",parser:w},...Wt];class Ec{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ac(this,"parser",bt(Z0))}}function kc(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}Ac(Ec,"ForEntityName","XLINE");let Q0={},J0=[{code:170,name:"multileaderType",parser:w},{code:291,name:"doglegEnabled",parser:jt},{code:40,name:"doglegLength",parser:w},{code:172,name:"contentType",parser:w},{code:3,name:"textContent",parser:w},{code:12,name:"textAnchor",parser:G},{code:344,name:"blockHandle",parser:w},{code:15,name:"blockPosition",parser:G},{code:302,name:"leaderSections",parser:function(n,t,e){let i,a={leaderLines:[]};for(;t.hasNext()&&(i=t.next()).code!==303;)switch(i.code){case 10:a.landingPoint=(i.value,Ft(t));break;case 11:a.doglegVector=(i.value,Ft(t));break;case 40:a.doglegLength=i.value;break;case 304:a.leaderLines.push(function(h,u,p){let y,f={vertices:[]};for(;u.hasNext()&&(y=u.next()).code!==305;)y.code===10&&f.vertices.push((y.value,Ft(u)));return f}(0,t))}return a},isMultiple:!0},...Wt];class Tc{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){kc(this,"parser",bt(J0,Q0))}}kc(Tc,"ForEntityName","MULTILEADER");let tp=Object.fromEntries([Eu,Ou,Fu,Vu,ju,Is,Wu,Hu,$u,Qu,tc,rc,Ss,ic,Bu,Tc,ac,hc,cc,pc,mc,fc,vc,bc,Ps,Nu,Ic,qu,So,As,Pc,Ec].map(n=>[n.ForEntityName,new n]));function Mc(n,t){let e=[];for(;!Pt(n,0,"EOF");){if(n.code===0){if(n.value==="ENDBLK"||n.value==="ENDSEC"){t.rewind();break}let i=tp[n.value];if(i){let a=n.value;n=t.next();let h=i.parseEntity(t,n);h.type=a,Su(h),e.push(h)}else t.debug&&console.warn(`Unsupported ENTITY type: ${n.value}`)}n=t.next()}return e}function ep(n,t){let e={};for(;!Pt(n,0,"EOF")&&!Pt(n,0,"ENDSEC");){if(Pt(n,0,"BLOCK")){let i=rp(n=t.next(),t);Su(i),i.name&&(e[i.name]=i)}n=t.next()}return e}function rp(n,t){let e={};for(;!Pt(n,0,"EOF");){if(Pt(n,0,"ENDBLK")){for(n=t.next();!Pt(n,0,"EOF");){if(Pt(n,100,"AcDbBlockEnd"))return e;n=t.next()}break}switch(n.code){case 1:e.xrefPath=n.value;break;case 2:e.name=n.value;break;case 3:e.name2=n.value;break;case 5:e.handle=n.value;break;case 8:e.layer=n.value;break;case 10:e.position=Ft(t);break;case 67:e.paperSpace=!!n.value&&n.value==1;break;case 70:n.value!==0&&(e.type=n.value);break;case 100:break;case 330:e.ownerHandle=n.value;break;case 0:e.entities=Mc(n,t)}n=t.next()}return e}function np(n,t){let e=null,i={};for(;!Pt(n,0,"EOF")&&!Pt(n,0,"ENDSEC");)n.code===9?e=n.value:n.code===10?i[e]=Ft(t):i[e]=n.value,n=t.next();return i}(Ye={})[Ye.NOT_APPLICABLE=0]="NOT_APPLICABLE",Ye[Ye.KEEP_EXISTING=1]="KEEP_EXISTING",Ye[Ye.USE_CLONE=2]="USE_CLONE",Ye[Ye.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",Ye[Ye.VALUE_NAME=4]="VALUE_NAME",Ye[Ye.UNMANGLE_NAME=5]="UNMANGLE_NAME";let Po=[{code:330,name:"ownerObjectId",parser:w},{code:102,parser:Tn},{code:102,parser:Tn},{code:102,parser:Tn},{code:5,name:"handle",parser:w}],ip=[{code:3,name:"entries",parser:(n,t)=>{let e={name:n.value};return(n=t.next()).code===350?e.objectSoftId=n.value:n.code===360?e.objectHardId=n.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:w},{code:280,name:"isHardOwned",parser:jt},{code:100,name:"subclassMarker",parser:w},...Po],sp=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:w},{code:90,name:"version",parser:w},{code:1,name:"fileName",parser:w},{code:10,name:"size",parser:G},{code:11,name:"sizeOfOnePixel",parser:G},{code:280,name:"isLoaded",parser:w},{code:281,name:"resolutionUnits",parser:w},{code:100,name:"subclassMarker",parser:w}];(Sn={})[Sn.NOUNIT=0]="NOUNIT",Sn[Sn.CENTIMETERS=2]="CENTIMETERS",Sn[Sn.INCH=5]="INCH";(Wi={})[Wi.PSLTSCALE=1]="PSLTSCALE",Wi[Wi.LIMCHECK=2]="LIMCHECK";(Pn={})[Pn.INCHES=0]="INCHES",Pn[Pn.MILLIMETERS=1]="MILLIMETERS",Pn[Pn.PIXELS=2]="PIXELS";(qe={})[qe.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",qe[qe.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",qe[qe.DRAWING_LIMITS=2]="DRAWING_LIMITS",qe[qe.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",qe[qe.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",qe[qe.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Fr={})[Fr.AS_DISPLAYED=0]="AS_DISPLAYED",Fr[Fr.WIREFRAME=1]="WIREFRAME",Fr[Fr.HIDDEN=2]="HIDDEN",Fr[Fr.RENDERED=3]="RENDERED";(Ke={})[Ke.DRAFT=0]="DRAFT",Ke[Ke.PREVIEW=1]="PREVIEW",Ke[Ke.NORMAL=2]="NORMAL",Ke[Ke.PRESENTATION=3]="PRESENTATION",Ke[Ke.MAXIMUM=4]="MAXIMUM",Ke[Ke.CUSTOM=5]="CUSTOM";let Nc=[{code:333,name:"shadePlotId",parser:w},{code:149,name:"imageOriginY",parser:w},{code:148,name:"imageOriginX",parser:w},{code:147,name:"scaleFactor",parser:w},{code:78,name:"shadePlotCustomDPI",parser:w},{code:77,name:"shadePlotResolution",parser:w},{code:76,name:"shadePlotMode",parser:w},{code:75,name:"standardScaleType",parser:w},{code:7,name:"currentStyleSheet",parser:w},{code:74,name:"plotType",parser:w},{code:73,name:"plotRotation",parser:w},{code:72,name:"plotPaperUnit",parser:w},{code:70,name:"layoutFlag",parser:w},{code:143,name:"printScaleDenominator",parser:w},{code:142,name:"printScaleNumerator",parser:w},{code:141,name:"windowAreaYMax",parser:w},{code:140,name:"windowAreaXMax",parser:w},{code:49,name:"windowAreaYMin",parser:w},{code:48,name:"windowAreaXMin",parser:w},{code:47,name:"plotOriginY",parser:w},{code:46,name:"plotOriginX",parser:w},{code:45,name:"paperHeight",parser:w},{code:44,name:"paperWidth",parser:w},{code:43,name:"marginTop",parser:w},{code:42,name:"marginRight",parser:w},{code:41,name:"marginBottom",parser:w},{code:40,name:"marginLeft",parser:w},{code:6,name:"plotViewName",parser:w},{code:4,name:"paperSize",parser:w},{code:2,name:"configName",parser:w},{code:1,name:"pageSetupName",parser:w},{code:100,name:"subclassMarker",parser:w},...Po],ap=[{code:346,name:"orthographicUcsId",parser:w},{code:345,name:"namedUcsId",parser:w},{code:331,name:"viewportId",parser:w},{code:330,name:"paperSpaceTableId",parser:w},{code:76,name:"orthographicType",parser:w},{code:17,name:"ucsYAxis",parser:G},{code:16,name:"ucsXAxis",parser:G},{code:13,name:"ucsOrigin",parser:G},{code:146,name:"elevation",parser:w},{code:15,name:"maxExtent",parser:G},{code:14,name:"minExtent",parser:G},{code:12,name:"insertionPoint",parser:G},{code:11,name:"maxLimit",parser:G},{code:10,name:"minLimit",parser:G},{code:71,name:"tabOrder",parser:w},{code:70,name:"controlFlag",parser:w},{code:1,name:"layoutName",parser:w},{code:100,name:"subclassMarker",parser:w},...Nc],op=[{code:40,name:"wcsToOCSTransform",parser:Vl},{code:40,name:"ocsToWCSTransform",parser:Vl},{code:41,name:"backClippingDistance",parser:w},{code:73,name:"isBackClipping",parser:jt,pushContext:!0},{code:40,name:"frontClippingDistance",parser:w},{code:72,name:"isFrontClipping",parser:jt,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:jt},{code:11,name:"position",parser:G},{code:210,name:"normal",parser:G},{code:10,name:"boundaryVertices",parser:G,isMultiple:!0},{code:70,name:"boundaryCount",parser:w},{code:100,name:"subclassMarker",parser:w},{code:100},...Po];function Vl(n,t){let e=[];for(let i=0;i<3&&Pt(n,40);++i){let a=[];for(let h=0;h<4&&Pt(n,40);++h)a.push(n.value),n=t.next();e.push(a)}return t.rewind(),e}let lp={LAYOUT:ap,PLOTSETTINGS:Nc,DICTIONARY:ip,SPATIAL_FILTER:op,IMAGEDEF:sp};function hp(n,t){let e=[];for(;n.code!==0||!["EOF","ENDSEC"].includes(n.value);){let i=n.value,a=lp[i];if(n.code===0&&(a!=null&&a.length)){let h=bt(a),u={name:i};h(n=t.next(),t,u)?(e.push(u),n=t.peek()):n=t.next()}else n=t.next()}return{byName:Jd(e,({name:i})=>i)}}let oi=[{code:100,name:"subclassMarker",parser:w},{code:330,name:"ownerObjectId",parser:w},{code:102,parser(n,t){for(;!Pt(n,0,"EOF")&&!Pt(n,102,"}");)n=t.next()}},{code:5,name:"handle",parser:w}],up=bt([{code:310,name:"bmpPreview",parser:w},{code:281,name:"scalability",parser:w},{code:280,name:"explodability",parser:w},{code:70,name:"insertionUnits",parser:w},{code:340,name:"layoutObjects",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},...oi]),cp=[{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:Fl.Above,defaultValueImperial:Fl.Center},{name:"DIMZIN",code:78,defaultValue:Kn.Trailing,defaultValueImperial:Kn.Feet},{name:"DIMAZIN",code:79,defaultValue:zd.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:Vd.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:Dd.Center},{name:"DIMTZIN",code:284,defaultValue:Kn.Trailing,defaultValueImperial:Kn.Feet},{name:"DIMALTZ",code:285,defaultValue:Kn.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Kn.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}],dp=bt([...cp.map(n=>({...n,parser:w})),{code:70,name:"standardFlag",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},{code:105,name:"handle",parser:w},...oi.filter(n=>n.code!==5)]),pp=bt([{code:347,name:"materialObjectId",parser:w},{code:390,name:"plotStyleNameObjectId",parser:w},{code:370,name:"lineweight",parser:w},{code:290,name:"isPlotting",parser:jt},{code:6,name:"lineType",parser:w},{code:62,name:"colorIndex",parser:w},{code:70,name:"standardFlag",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},...oi]);(zr={})[zr.NONE=0]="NONE",zr[zr.AbsoluteRotation=1]="AbsoluteRotation",zr[zr.TextEmbedded=2]="TextEmbedded",zr[zr.ShapeEmbedded=4]="ShapeEmbedded";let gp=bt([{code:9,name:"text",parser:w},{code:45,name:"offsetY",parser:w},{code:44,name:"offsetX",parser:w},{code:50,name:"rotation",parser:w},{code:46,name:"scale",parser:w},{code:340,name:"styleObjectId",parser:w},{code:75,name:"shapeNumber",parser:w},{code:74,name:"elementTypeFlag",parser:w},{code:49,name:"elementLength",parser:w}],{elementTypeFlag:0,elementLength:0}),mp=bt([{code:49,name:"pattern",parser(n,t){let e={};return gp(n,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:w},{code:73,name:"numberOfLineTypes",parser:w},{code:72,parser:w},{code:3,name:"description",parser:w},{code:70,name:"standardFlag",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},...oi]),_p=bt([{code:1e3,name:"extendedFont",parser:w},{code:1001},{code:4,name:"bigFont",parser:w},{code:3,name:"font",parser:w},{code:42,name:"lastHeight",parser:w},{code:71,name:"textGenerationFlag",parser:w},{code:50,name:"obliqueAngle",parser:w},{code:41,name:"widthFactor",parser:w},{code:40,name:"fixedTextHeight",parser:w},{code:70,name:"standardFlag",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},...oi]),fp=bt([{code:[63,421,431],name:"ambientColor",parser:w},{code:142,name:"contrast",parser:w},{code:141,name:"brightness",parser:w},{code:282,name:"defaultLightingType",parser:w},{code:292,name:"isDefaultLightingOn",parser:jt},{code:348,name:"visualStyleObjectId",parser:w},{code:333,name:"shadePlotObjectId",parser:w},{code:332,name:"backgroundObjectId",parser:w},{code:61,name:"majorGridLines",parser:w},{code:170,name:"shadePlotSetting",parser:w},{code:146,name:"elevation",parser:w},{code:79,name:"orthographicType",parser:w},{code:112,name:"ucsYAxis",parser:G},{code:111,name:"ucsXAxis",parser:G},{code:110,name:"ucsOrigin",parser:G},{code:74,name:"ucsIconSetting",parser:w},{code:71,name:"viewMode",parser:w},{code:281,name:"renderMode",parser:w},{code:1,name:"styleSheet",parser:w},{code:[331,441],name:"frozenLayers",parser:w,isMultiple:!0},{code:72,name:"circleSides",parser:w},{code:51,name:"viewTwistAngle",parser:w},{code:50,name:"snapRotationAngle",parser:w},{code:45,name:"viewHeight",parser:w},{code:44,name:"backClippingPlane",parser:w},{code:43,name:"frontClippingPlane",parser:w},{code:42,name:"lensLength",parser:w},{code:17,name:"viewTarget",parser:G},{code:16,name:"viewDirectionFromTarget",parser:G},{code:15,name:"gridSpacing",parser:G},{code:14,name:"snapSpacing",parser:G},{code:13,name:"snapBasePoint",parser:G},{code:12,name:"center",parser:G},{code:11,name:"upperRightCorner",parser:G},{code:10,name:"lowerLeftCorner",parser:G},{code:70,name:"standardFlag",parser:w},{code:2,name:"name",parser:w},{code:100,name:"subclassMarker",parser:w},...oi]),yp={BLOCK_RECORD:up,DIMSTYLE:dp,LAYER:pp,LTYPE:mp,STYLE:_p,VPORT:fp},vp=bt([{code:70,name:"maxNumberOfEntries",parser:w},{code:100,name:"subclassMarker",parser:w},{code:330,name:"ownerObjectId",parser:w},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:w},{code:2,name:"name",parser:w}]);function wp(n,t){var i;let e={};for(;!Pt(n,0,"EOF")&&!Pt(n,0,"ENDSEC");){if(Pt(n,0,"TABLE")){n=t.next();let a={entries:[]};vp(n,t,a),e[a.name]=a}if(Pt(n,0)&&!Pt(n,0,"ENDTAB")){let a=n.value;n=t.next();let h=yp[a];if(!h){t.debug&&console.warn(`parseTable: Invalid table name '${a}'`),n=t.next();continue}let u={};h(n,t,u),(i=e[a])==null||i.entries.push(u)}n=t.next()}return e}function Gi(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class Dl{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=jl(t,this._data[this._pointer++],this.debug),i={code:t,value:e};return Pt(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=jl(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){Gi(this,"_data",void 0),Gi(this,"debug",void 0),Gi(this,"_pointer",void 0),Gi(this,"_eof",void 0),Gi(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function jl(n,t,e=!1){return n<=9?t:n>=10&&n<=59?parseFloat(t.trim()):n>=60&&n<=99?parseInt(t.trim()):n>=100&&n<=109?t:n>=110&&n<=149?parseFloat(t.trim()):n>=160&&n<=179?parseInt(t.trim()):n>=210&&n<=239?parseFloat(t.trim()):n>=270&&n<=289?parseInt(t.trim()):n>=290&&n<=299?function(i){if(i==="0")return!1;if(i==="1")return!0;throw TypeError("String '"+i+"' cannot be cast to Boolean type")}(t.trim()):n>=300&&n<=369?t:n>=370&&n<=389?parseInt(t.trim()):n>=390&&n<=399?t:n>=400&&n<=409?parseInt(t.trim()):n>=410&&n<=419?t:n>=420&&n<=429?parseInt(t.trim()):n>=430&&n<=439?t:n>=440&&n<=459?parseInt(t.trim()):n>=460&&n<=469?parseFloat(t.trim()):n>=470&&n<=481||n===999||n>=1e3&&n<=1009?t:n>=1010&&n<=1059?parseFloat(t.trim()):n>=1060&&n<=1071?parseInt(t.trim()):(e&&console.warn("WARNING: Group code does not have a defined type: %j",{code:n,value:t}),t)}function Ya(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class bp{constructor(){Ya(this,"encoding","utf-8"),Ya(this,"encodingFailureFatal",!1)}}class xp extends EventTarget{parseSync(t,e=!1){let i=new Dl(t.split(/\r\n|\r|\n/g),e);if(!i.hasNext())throw Error("Empty file");return this.parseAll(i)}parseStream(t){let e="",i=this;return new Promise((a,h)=>{t.on("data",u=>{e+=u}),t.on("end",()=>{try{let u=e.split(/\r\n|\r|\n/g),p=new Dl(u);if(!p.hasNext())throw Error("Empty file");a(i.parseAll(p))}catch(u){h(u)}}),t.on("error",u=>{h(u)})})}async parseFromUrl(t,e){let i=await fetch(t,e);if(!i.body)return null;let a=i.body.getReader(),h="";for(;;){let{done:u,value:p}=await a.read();if(u){h+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}h+=this._decoder.decode(p,{stream:!0})}return this.parseSync(h)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},i=t.next();for(;!Pt(i,0,"EOF");)Pt(i,0,"SECTION")&&(Pt(i=t.next(),2,"HEADER")?(i=t.next(),e.header=np(i,t)):Pt(i,2,"BLOCKS")?(i=t.next(),e.blocks=ep(i,t)):Pt(i,2,"ENTITIES")?(i=t.next(),e.entities=Mc(i,t)):Pt(i,2,"TABLES")?(i=t.next(),e.tables=wp(i,t)):Pt(i,2,"OBJECTS")&&(i=t.next(),e.objects=hp(i,t))),i=t.next();return e}constructor(t=new bp){super(),Ya(this,"_decoder",void 0),this._decoder=new TextDecoder(t.encoding,{fatal:t.encodingFailureFatal})}}class Ip{parse(t){const e=new xp,i=this.getDxfInfoFromBuffer(t);let a="";return i.version&&i.version.value<=23&&i.encoding?a=new TextDecoder(i.encoding).decode(t):a=new TextDecoder().decode(t),e.parseSync(a)}getDxfInfoFromBuffer(t){var f,x,b;const i=new TextDecoder("utf-8");let a=0,h="",u=null,p=null,y=!1;for(;a<t.byteLength;){const E=Math.min(a+65536,t.byteLength),I=t.slice(a,E);a=E;const O=(h+i.decode(I,{stream:!0})).split(/\r?\n/);h=O.pop()??"";for(let V=0;V<O.length;V++){const z=O[V].trim();if(z==="SECTION"&&((f=O[V+2])==null?void 0:f.trim())==="HEADER")y=!0;else if(z==="ENDSEC"&&y)return{version:u,encoding:p};if(y&&z==="$ACADVER"){const it=(x=O[V+2])==null?void 0:x.trim();it&&(u=new er(it))}else if(y&&z==="$DWGCODEPAGE"){const it=(b=O[V+2])==null?void 0:b.trim();if(it){const _t=to[it];p=ih(_t)}}if(u&&p)return{version:u,encoding:p}}}return{version:u,encoding:p}}}class Ul{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new Fs;return t.vertices.forEach((i,a)=>e.setVertexAt(a,i)),e}convertArc(t){return new Ls(t.center,t.radius,St.degToRad(t.startAngle),St.degToRad(t.endAngle),t.extrusionDirection??q.Z_AXIS)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&ce.Invisible)!==0,e.isConst=(t.attributeFlag&ce.Const)!==0,e.isVerifiable=(t.attributeFlag&ce.Verifiable)!==0,e.isPreset=(t.attributeFlag&ce.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&wr.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&wr.ConstMultiLine)!==0}convertAttribute(t){const e=new Cs;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new Os;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){return new Bs(t.center,t.radius,t.extrusionDirection??q.Z_AXIS)}convertEllipse(t){const e=new q(t.majorAxisEndPoint),i=e.length();return new Rs(t.center,t.extrusionDirection??q.Z_AXIS,e,i,i*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,i=t.endPoint;return new es(new W(e.x,e.y,e.z||0),new W(i.x,i.y,i.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new ns(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new ns(e,"Uniform",t.degree,!!(t.flag&1))}}catch(e){console.log(`Failed to convert spline with error: ${e}`)}return null}convertPoint(t){const e=new Us;return e.position=t.position,e}convertSolid(t){const e=new Ds;return t.points.forEach((i,a)=>e.setPointAt(a,i)),e.thickness=t.thickness,e}convertPolyline(t){const e=!!(t.flag&1),i=!!(t.flag&8),a=[],h=[];if(t.vertices.map(u=>{u.flag&C0.SPLINE_CONTROL_POINT||(a.push({x:u.x,y:u.y,z:u.z}),h.push(u.bulge??0))}),i){let u=Zi.SimplePoly;return t.flag&4&&(t.smoothType==vs.CUBIC?u=Zi.CubicSplinePoly:t.smoothType==vs.QUADRATIC&&(u=Zi.QuadSplinePoly)),new Ns(u,a,e)}else{let u=$n.SimplePoly;return t.flag&2?u=$n.FitCurvePoly:t.flag&4&&(t.smoothType==vs.CUBIC?u=$n.CubicSplinePoly:t.smoothType==vs.QUADRATIC&&(u=$n.QuadSplinePoly)),new Ms(u,a,0,e,t.startWidth,t.endWidth,h)}}convertLWPolyline(t){const e=new js;return e.closed=!!(t.flag&1),t.vertices.forEach((i,a)=>{e.addVertexAt(a,new Et(i.x,i.y),i.bulge,i.startWidth,i.endWidth)}),e}convertHatch(t){var a;const e=new ts;return(a=t.definitionLines)==null||a.forEach(h=>{e.definitionLines.push({angle:h.angle,base:h.base,offset:h.offset,dashLengths:h.numberOfDashLengths>0?h.dashLengths:[]})}),e.isSolidFill=t.solidFill==jd.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(h=>{if(h.boundaryPathTypeFlag&2){const p=h,y=new un;y.closed=p.isClosed,p.vertices.forEach((f,x)=>{y.addVertexAt(x,{x:f.x,y:f.y,bulge:f.bulge})}),e.add(y)}else{const p=h,y=new oa;p.edges.forEach(f=>{if(f.type==1){const x=f;y.add(new ei(x.start,x.end))}else if(f.type==2){const x=f;y.add(new Mn(x.center,x.radius,St.degToRad(x.startAngle||0),St.degToRad(x.endAngle||0),!x.isCCW))}else if(f.type==3){const x=f;new te().subVectors(x.end,x.center);const E=Math.sqrt(Math.pow(x.end.x,2)+Math.pow(x.end.y,2)),I=E*x.lengthOfMinorAxis;let L=St.degToRad(x.startAngle||0),O=St.degToRad(x.endAngle||0);const V=Math.atan2(x.end.y,x.end.x);x.isCCW||(L=Math.PI*2-L,O=Math.PI*2-O),y.add(new ls({...x.center,z:0},E,I,L,O,!x.isCCW,V))}else if(f.type==4){const x=f;if(x.numberOfControlPoints>0&&x.numberOfKnots>0){const b=x.controlPoints.map(L=>({x:L.x,y:L.y,z:0}));let E=!0;const I=x.controlPoints.map(L=>(L.weight==null&&(E=!1),L.weight||1));y.add(new Wr(b,x.knots,E?I:void 0))}else if(x.numberOfFitData>0){const b=x.fitDatum.map(E=>({x:E.x,y:E.y,z:0}));y.add(new Wr(b,"Uniform"))}}}),e.add(y)}}),e}convertTable(t){const e=new Vs(t.name,t.rowCount,t.columnCount);return e.tableDataVersion=t.version,e.tableStyleId=t.tableStyleId,e.owningBlockRecordId=t.blockRecordHandle,t.directionVector&&(e.horizontalDirection=new q(t.directionVector)),e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),e.tableValueFlag=t.tableValue,e.tableOverrideFlag=t.overrideFlag,e.borderColorOverrideFlag=t.borderColorOverrideFlag,e.borderLineweightOverrideFlag=t.borderLineWeightOverrideFlag,e.borderVisibilityOverrideFlag=t.borderVisibilityOverrideFlag,t.columnWidthArr.forEach((i,a)=>e.setColumnWidth(a,i)),t.rowHeightArr.forEach((i,a)=>e.setRowHeight(a,i)),t.cells.forEach((i,a)=>{e.setCell(a,i)}),e}convertText(t){const e=new ni;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=St.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new rs;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=St.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new q(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new zs;return t.vertices.forEach(i=>{e.appendVertex(i)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,i=new qs(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(i.dimBlockPosition={...e.insertionPoint,z:0}),i.rotation=St.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,i=new Ys(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,i=new $s(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,i=new Zs(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,i=new Ks(e.definitionPoint,e.centerPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(i=>{e.clipBoundary.push(new Et(i))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new is;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(i=>{e.clipBoundary.push(new Et(i))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new Hs;return this.processWipeout(t,e),e}convertViewport(t){const e=new Gs;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Ws;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new Xs;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new ii(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?St.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle.toString()),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=na.deserialize(t.transparency))}numberArrayToPointArray(t,e){const i=t.length;let a=0;if(i/2==e?a=2:i/3==e&&(a=3),a==0)return;const h=[];for(let u=0,p=i/a;u<p;++u)h.push({x:t[u*a],y:t[u*a+1],z:a==3?t[u*a+2]:0});return h}}class Sp{convertLayout(t,e){var h,u;const i=new hs;i.layoutName=t.layoutName,i.tabOrder=t.tabOrder,i.plotSettingsName=t.pageSetupName,i.plotCfgName=t.configName,i.canonicalMediaName=t.paperSize,i.plotViewName=t.plotViewName,i.currentStyleSheet=t.currentStyleSheet,i.plotPaperMargins={left:t.marginLeft,right:t.marginRight,top:t.marginTop,bottom:t.marginBottom},i.plotPaperSize.copy({x:t.paperWidth,y:t.paperHeight}),i.plotOrigin.copy({x:t.plotOriginX,y:t.plotOriginY}),i.plotWindowArea.min.copy({x:t.windowAreaXMin,y:t.windowAreaYMin}),i.plotWindowArea.max.copy({x:t.windowAreaXMax,y:t.windowAreaYMax}),i.customPrintScale={numerator:t.printScaleNumerator,denominator:t.printScaleDenominator},i.plotPaperUnits=t.plotPaperUnit,i.plotRotation=t.plotRotation,i.plotType=t.plotType,i.stdScaleType=t.standardScaleType,i.shadePlot=(()=>{switch(t.shadePlotMode){case 1:return Zn.kWireframe;case 2:return Zn.kHidden;case 3:return Zn.kRendered;default:return Zn.kAsDisplayed}})(),i.shadePlotResLevel=(()=>{switch(t.shadePlotResolution){case 1:return an.kPreview;case 2:return an.kNormal;case 3:return an.kPresentation;case 4:return an.kMaximum;case 5:return an.kCustom;default:return an.kDraft}})(),t.shadePlotCustomDPI!=null&&(i.shadePlotCustomDPI=t.shadePlotCustomDPI),t.shadePlotId&&(i.shadePlotId=t.shadePlotId);const a=t.layoutFlag??0;if(i.plotViewportBorders=(a&1)!==0,i.showPlotStyles=(a&2)!==0,i.plotCentered=(a&4)!==0,i.plotHidden=(a&8)!==0,i.useStandardScale=(a&16)!==0,i.plotPlotStyles=(a&32)!==0,i.scaleLineweights=(a&64)!==0,i.printLineweights=(a&128)!==0,i.drawViewportsFirst=(a&512)!==0,i.modelType=(a&1024)!==0,t.viewportId&&i.viewportArray.push(t.viewportId),t.layoutName==="Model"){const p=ue.MODEL_SPACE_NAME.toUpperCase();(h=e.tables.BLOCK_RECORD)==null||h.entries.some(y=>y.name.toUpperCase()===p?(i.blockTableRecordId=y.handle,!0):!1)}else(u=e.tables.BLOCK_RECORD)==null||u.entries.some(p=>p.layoutObjects===t.handle?(i.blockTableRecordId=p.handle,!0):!1),i.blockTableRecordId||(i.blockTableRecordId=t.paperSpaceTableId);return t.minLimit&&i.limits.min.copy(t.minLimit),t.maxLimit&&i.limits.max.copy(t.maxLimit),t.minExtent&&i.extents.min.copy(t.minExtent),t.maxExtent&&i.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,i),i}convertImageDef(t){const e=new su;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Lc{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const i=Date.now(),a=this.generateTaskId();try{return await this.executeInWorker(a,t,e||this.config.workerUrl)}catch(h){const u=Date.now()-i;return{success:!1,error:h instanceof Error?h.message:String(h),duration:u}}}async executeInWorker(t,e,i){const a=Date.now();return new Promise((h,u)=>{const p=this.getAvailableWorker(i),y=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(p),u(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:b=>{clearTimeout(y),this.releaseWorker(p),h(b)},reject:b=>{clearTimeout(y),this.releaseWorker(p),u(b)},timeout:y});const f=b=>{const{id:E,success:I,data:L,error:O}=b.data;if(E!==t)return;this.cleanupTask(t);const V=Date.now()-a;h(I?{success:!0,data:L,duration:V}:{success:!1,error:O,duration:V})},x=b=>{this.cleanupTask(t),u(new Error(`Worker error: ${b.message}`))};p.addEventListener("message",f),p.addEventListener("error",x),p.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[i,a]of this.workers)if(!a.isBusy)return a.isBusy=!0,a.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(t,{type:"module"}),a=this.generateWorkerId(),h={worker:i,isBusy:!0,id:a,createdAt:new Date};return this.workers.set(a,h),i}const e=Array.from(this.workers.values()).sort((i,a)=>i.createdAt.getTime()-a.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,i]of this.workers)if(i.worker===t){i.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Oc{constructor(t){this.framework=new Lc(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Cc(n){return new Oc(n)}class Pp{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:i}=t.data;try{const a=await this.executeTask(i);this.sendResponse(e,!0,a)}catch(a){this.sendResponse(e,!1,void 0,a instanceof Error?a.message:String(a))}}}sendResponse(t,e,i,a){const h={id:t,success:e,data:i,error:a};self.postMessage(h)}}class Bc extends bo{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t,e){const i=this.config,a=this.getParserWorkerTimeout(t,e);if(i.useWorker&&i.parserWorkerUrl){const h=Cc({workerUrl:i.parserWorkerUrl,timeout:a,maxConcurrentWorkers:1}),u=await h.execute(t);if(h.destroy(),u.success)return{model:u.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${u.error}'`)}else return{model:new Ip().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var h;const e=new Map,i=u=>{if(u){const p=u.lastIndexOf(".");return p>=0?u.substring(0,p).toLowerCase():u.toLowerCase()}};(h=t.tables.STYLE)==null||h.entries.forEach(u=>{const p=[];if(u.font){const y=i(u.font);y&&p.push(y)}if(u.bigFont){const y=i(u.bigFont);y&&p.push(y)}if(u.extendedFont){const y=i(u.extendedFont);y&&p.push(y)}e.set(u.name,p)});const a=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,a),Array.from(a)}getFontsInBlock(t,e,i,a){const h=/\\f(.*?)\|/g;t.forEach(u=>{if(u.type=="MTEXT"){const p=u;[...p.text.matchAll(h)].forEach(x=>{a.add(x[1].toLowerCase())});const f=i.get(p.styleName);f==null||f.forEach(x=>a.add(x))}else if(u.type=="TEXT"){const p=u,y=i.get(p.styleName);y==null||y.forEach(f=>a.add(f))}else if(u.type=="INSERT"){const y=e[u.name];y&&y.entities&&this.getFontsInBlock(y.entities,e,i,a)}})}async processEntities(t,e,i,a,h){const u=new Ul;let p=t.entities;const y=p.length,f=new Qa(y,100-a.value,i);this.config.convertByEntityType&&(p=this.groupAndFlattenByType(p));const x=new Map;for(let E=0;E<y;E++){const I=p[E];if(I.type==="ATTRIB"){const L=u.convert(I);if(L&&L.ownerId&&L.ownerId!=="0"){let O=x.get(L==null?void 0:L.ownerId);O==null&&(O=[],x.set(L.ownerId,O)),O.push(L)}}}const b=e.tables.blockTable.modelSpace;await f.processChunk(async(E,I)=>{let L=[],O=E<I?p[E].type:"";for(let z=E;z<I;z++){const it=p[z];if(!(it.ownerBlockRecordSoftId&&it.ownerBlockRecordSoftId!==b.objectId)&&it.type!=="ATTRIB"){const _t=u.convert(it);if(_t){if(this.config.convertByEntityType&&it.type!==O&&(b.appendEntity(L),L=[],O=it.type),it.type==="INSERT"){const st=x.get(_t.objectId);st&&st.length>0&&st.forEach(H=>{_t.appendAttributes(H)})}L.push(_t)}}}b.appendEntity(L);let V=a.value+I/y*(100-a.value);V>100&&(V=100),h&&await h(V,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,i=!1){const a=new Ul,h=t.length,u=[],p=e.objectId,y=[];for(let f=0;f<h;f++){const x=t[f],b=a.convert(x);b&&(x.type==="ATTRIB"?y.push(b):(!i||x.ownerBlockRecordSoftId===p)&&u.push(b))}y.forEach(f=>{const x=e.getIdAt(f.ownerId);x&&x.appendAttributes(f)}),e.appendEntity(u)}processBlocks(t,e){const i=t.blocks;for(const[a,h]of Object.entries(i)){let u=e.tables.blockTable.getAt(h.name);u||(u=new ue,u.objectId=h.handle,u.name=a,u.origin.copy(h.position),e.tables.blockTable.add(u)),h.entities?this.processEntitiesInBlock(h.entities,u):u.isPaperSapce&&this.processEntitiesInBlock(t.entities,u,!0)}}processHeader(t,e){const i=t.header;i.$ACADVER&&(e.version=i.$ACADVER),e.cecolor.colorIndex=i.$CECOLOR||256,e.angBase=i.$ANGBASE||0,e.angDir=i.$ANGDIR||0,i.$AUNITS!=null&&(e.aunits=i.$AUNITS),e.celtscale=i.$CELTSCALE||1,e.ltscale=i.$LTSCALE||1,i.$EXTMAX&&(e.extmax=i.$EXTMAX),i.$EXTMIN&&(e.extmin=i.$EXTMIN),i.$INSUNITS!=null&&(e.insunits=i.$INSUNITS),e.osmode=i.$OSMODE||0,e.pdmode=i.$PDMODE||0,e.pdsize=i.$PDSIZE||0,e.textstyle=i.$TEXTSTYLE||ne}processBlockTables(t,e){var a;const i=(a=t.tables.BLOCK_RECORD)==null?void 0:a.entries;i&&i.length>0&&(e.tables.blockTable.removeAll(),i.forEach(h=>{const u=new ue;u.objectId=h.handle,u.name=h.name,u.layoutId=h.layoutObjects,u.blockInsertUnits=h.insertionUnits,u.explodability=h.explodability,u.blockScaling=h.scalability,h.bmpPreview&&(u.bmpPreview=h.bmpPreview),e.tables.blockTable.add(u)}))}processObjects(t,e){const i=t.objects.byName,a=new Sp;if("LAYOUT"in i){const h=e.objects.layout;i.LAYOUT.forEach(u=>{const p=a.convertLayout(u,t);h.setAt(p.layoutName,p)})}if("IMAGEDEF"in i){const h=e.objects.imageDefinition;i.IMAGEDEF.forEach(u=>{const p=a.convertImageDef(u);h.setAt(p.objectId,p)})}}processViewports(t,e){var a;const i=(a=t.tables)==null?void 0:a.VPORT;if(i){this.processCommonTableAttrs(i,e.tables.viewportTable);const h=i.entries;h&&h.length>0&&h.forEach(u=>{const p=new wo;this.processCommonTableEntryAttrs(u,p),u.circleSides&&(p.circleSides=u.circleSides),p.standardFlag=u.standardFlag,p.center.copy(u.center),p.lowerLeftCorner.copy(u.lowerLeftCorner),p.upperRightCorner.copy(u.upperRightCorner),u.snapBasePoint&&p.snapBase.copy(u.snapBasePoint),u.snapRotationAngle&&(p.snapAngle=u.snapRotationAngle),u.snapSpacing&&p.snapIncrements.copy(u.snapSpacing),u.majorGridLines&&(p.gridMajor=u.majorGridLines),u.gridSpacing&&p.gridIncrements.copy(u.gridSpacing),u.backgroundObjectId&&(p.backgroundObjectId=u.backgroundObjectId),p.gsView.center.copy(u.center),p.gsView.viewDirectionFromTarget.copy(u.viewDirectionFromTarget),p.gsView.viewTarget.copy(u.viewTarget),u.lensLength&&(p.gsView.lensLength=u.lensLength),u.frontClippingPlane&&(p.gsView.frontClippingPlane=u.frontClippingPlane),u.backClippingPlane&&(p.gsView.backClippingPlane=u.backClippingPlane),u.viewHeight&&(p.gsView.viewHeight=u.viewHeight),u.viewTwistAngle&&(p.gsView.viewTwistAngle=u.viewTwistAngle),u.frozenLayers&&(p.gsView.frozenLayers=u.frozenLayers),u.styleSheet&&(p.gsView.styleSheet=u.styleSheet),u.renderMode&&(p.gsView.renderMode=u.renderMode),u.viewMode&&(p.gsView.viewMode=u.viewMode),u.ucsIconSetting&&(p.gsView.ucsIconSetting=u.ucsIconSetting),u.ucsOrigin&&p.gsView.ucsOrigin.copy(u.ucsOrigin),u.ucsXAxis&&p.gsView.ucsXAxis.copy(u.ucsXAxis),u.ucsYAxis&&p.gsView.ucsYAxis.copy(u.ucsYAxis),u.orthographicType&&(p.gsView.orthographicType=u.orthographicType),u.shadePlotSetting&&(p.gsView.shadePlotSetting=u.shadePlotSetting),u.shadePlotObjectId&&(p.gsView.shadePlotObjectId=u.shadePlotObjectId),u.visualStyleObjectId&&(p.gsView.visualStyleObjectId=u.visualStyleObjectId),u.isDefaultLightingOn&&(p.gsView.isDefaultLightingOn=u.isDefaultLightingOn),u.defaultLightingType&&(p.gsView.defaultLightingType=u.defaultLightingType),u.brightness&&(p.gsView.brightness=u.brightness),u.contrast&&(p.gsView.contrast=u.contrast),u.ambientColor&&(p.gsView.ambientColor=u.ambientColor),e.tables.viewportTable.add(p)})}}processLayers(t,e){var a;const i=(a=t.tables)==null?void 0:a.LAYER;if(i){this.processCommonTableAttrs(i,e.tables.layerTable);const h=i.entries;h&&h.length>0&&h.forEach(u=>{const p=new de;p.colorIndex=u.colorIndex;const y=new la({name:u.name,standardFlags:u.standardFlag,linetype:u.lineType,lineWeight:u.lineweight,isOff:u.colorIndex<0,color:p,isPlottable:u.isPlotting});this.processCommonTableEntryAttrs(u,y),e.tables.layerTable.add(y)})}}processLineTypes(t,e){var a;const i=(a=t.tables)==null?void 0:a.LTYPE;if(i){this.processCommonTableAttrs(i,e.tables.linetypeTable);const h=i.entries;h&&h.length>0&&h.forEach(u=>{const p=new hn(u);this.processCommonTableEntryAttrs(u,p),p.name=u.name,e.tables.linetypeTable.add(p)})}}processTextStyles(t,e){var a;const i=(a=t.tables)==null?void 0:a.STYLE;if(i){this.processCommonTableAttrs(i,e.tables.textStyleTable);const h=i.entries;h&&h.length>0&&h.forEach(u=>{const p=new ha(u);this.processCommonTableEntryAttrs(u,p),e.tables.textStyleTable.add(p)})}}processDimStyles(t,e){var a;const i=(a=t.tables)==null?void 0:a.DIMSTYLE;if(i){this.processCommonTableAttrs(i,e.tables.dimStyleTable);const h=i.entries;h&&h.length>0&&h.forEach(u=>{const p={name:u.name,ownerId:u.ownerObjectId,dimpost:u.DIMPOST||"",dimapost:u.DIMAPOST||"",dimscale:u.DIMSCALE,dimasz:u.DIMASZ,dimexo:u.DIMEXO,dimdli:u.DIMDLI,dimexe:u.DIMEXE,dimrnd:u.DIMRND,dimdle:u.DIMDLE,dimtp:u.DIMTP,dimtm:u.DIMTM,dimtxt:u.DIMTXT,dimcen:u.DIMCEN,dimtsz:u.DIMTSZ,dimaltf:u.DIMALTF,dimlfac:u.DIMLFAC,dimtvp:u.DIMTVP,dimtfac:u.DIMTFAC,dimgap:u.DIMGAP,dimaltrnd:u.DIMALTRND,dimtol:u.DIMTOL==null||u.DIMTOL==0?0:1,dimlim:u.DIMLIM==null||u.DIMLIM==0?0:1,dimtih:u.DIMTIH==null||u.DIMTIH==0?0:1,dimtoh:u.DIMTOH==null||u.DIMTOH==0?0:1,dimse1:u.DIMSE1==null||u.DIMSE1==0?0:1,dimse2:u.DIMSE2==null||u.DIMSE2==0?0:1,dimtad:u.DIMTAD,dimzin:u.DIMZIN,dimazin:u.DIMAZIN,dimalt:u.DIMALT,dimaltd:u.DIMALTD,dimtofl:u.DIMTOFL,dimsah:u.DIMSAH,dimtix:u.DIMTIX,dimsoxd:u.DIMSOXD,dimclrd:u.DIMCLRD,dimclre:u.DIMCLRE,dimclrt:u.DIMCLRT,dimadec:u.DIMADEC||0,dimunit:u.DIMUNIT||2,dimdec:u.DIMDEC,dimtdec:u.DIMTDEC,dimaltu:u.DIMALTU,dimalttd:u.DIMALTTD,dimaunit:u.DIMAUNIT,dimfrac:u.DIMFRAC,dimlunit:u.DIMLUNIT,dimdsep:u.DIMDSEP?u.DIMDSEP.toString():".",dimtmove:u.DIMTMOVE||0,dimjust:u.DIMJUST,dimsd1:u.DIMSD1,dimsd2:u.DIMSD2,dimtolj:u.DIMTOLJ,dimtzin:u.DIMTZIN,dimaltz:u.DIMALTZ,dimalttz:u.DIMALTTZ,dimfit:u.DIMFIT||0,dimupt:u.DIMUPT,dimatfit:u.DIMATFIT,dimtxsty:u.DIMTXSTY||ne,dimldrblk:u.DIMLDRBLK||"",dimblk:u.DIMBLK||"",dimblk1:u.DIMBLK1||"",dimblk2:u.DIMBLK2||"",dimlwd:u.DIMLWD,dimlwe:u.DIMLWE},y=new Ln(p);this.processCommonTableEntryAttrs(u,y),e.tables.dimStyleTable.add(y)})}}processCommonTableAttrs(t,e){t.handle!=null&&(e.objectId=t.handle),e.ownerId=t.ownerObjectId}processCommonTableEntryAttrs(t,e){e.name=t.name,t.handle!=null&&(e.objectId=t.handle),e.ownerId=t.ownerObjectId}groupAndFlattenByType(t){const e={},i=[];for(const a of t)e[a.type]||(e[a.type]=[],i.push(a.type)),e[a.type].push(a);return i.flatMap(a=>e[a])}}class Rc extends bo{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,i,a,h){let u=t.tables.blockTable.modelSpace.newIterator().toArray();const p=u.length,y=new Qa(p,100-a.value,i);this.config.convertByEntityType&&(u=this.groupAndFlattenByType(u));const f=e.tables.blockTable.modelSpace;await y.processChunk(async(x,b)=>{let E=[],I=x<b?u[x].type:"";for(let L=x;L<b;L++){const O=u[L];this.config.convertByEntityType&&O.type!==I&&(this.triggerEvents(f,E),E=[],I=O.type),E.push(O)}if(this.triggerEvents(f,E),h){let L=a.value+b/p*(100-a.value);L>100&&(L=100),await h(L,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const i=e.newIterator().toArray();this.triggerEvents(e,i)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const i of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const i of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},i=[];for(const a of t)e[a.type]||(e[a.type]=[],i.push(a.type)),e[a.type].push(a);return i.flatMap(a=>e[a])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}exports.ACAD_APPID=za;exports.AC_DB_SYSTEM_VARIABLE_NAMES=Od;exports.AcCmColor=de;exports.AcCmColorMethod=lt;exports.AcCmColorUtil=sn;exports.AcCmEntityColor=td;exports.AcCmErrors=Ze;exports.AcCmEventDispatcher=ed;exports.AcCmEventManager=he;exports.AcCmLoader=hd;exports.AcCmLoadingManager=Ql;exports.AcCmObject=ql;exports.AcCmPerformanceCollector=Ka;exports.AcCmTask=$l;exports.AcCmTaskScheduler=Zl;exports.AcCmTransparency=na;exports.AcCmTransparencyMethod=Ne;exports.AcDb2dPolyline=Ms;exports.AcDb2dVertex=Wa;exports.AcDb2dVertexType=Uh;exports.AcDb3PointAngularDimension=Ys;exports.AcDb3dPolyline=Ns;exports.AcDb3dVertex=Ga;exports.AcDb3dVertexType=Wh;exports.AcDbAbstractViewTableRecord=vo;exports.AcDbAlignedDimension=qs;exports.AcDbAngleUnits=Ja;exports.AcDbArc=Ls;exports.AcDbArcDimension=Ha;exports.AcDbAttribute=Cs;exports.AcDbAttributeDefinition=Os;exports.AcDbAttributeFlags=ce;exports.AcDbAttributeMTextFlag=wr;exports.AcDbBaseWorker=Pp;exports.AcDbBatchProcessing=Qa;exports.AcDbBlockReference=ii;exports.AcDbBlockScaling=nu;exports.AcDbBlockTable=hu;exports.AcDbBlockTableRecord=ue;exports.AcDbCircle=Bs;exports.AcDbCodePage=to;exports.AcDbCurve=Oe;exports.AcDbDataGenerator=ou;exports.AcDbDatabase=Cd;exports.AcDbDatabaseConverter=bo;exports.AcDbDatabaseConverterManager=vr;exports.AcDbDiametricDimension=Ks;exports.AcDbDictionary=Ji;exports.AcDbDimArrowType=lu;exports.AcDbDimStyleTable=uu;exports.AcDbDimStyleTableRecord=Ln;exports.AcDbDimTextHorizontal=cu;exports.AcDbDimTextVertical=du;exports.AcDbDimVerticalJustification=mu;exports.AcDbDimZeroSuppression=pu;exports.AcDbDimZeroSuppressionAngular=gu;exports.AcDbDimension=Gr;exports.AcDbDuplicateRecordCloning=au;exports.AcDbDwgVersion=er;exports.AcDbDxfCode=qa;exports.AcDbDxfConverter=Bc;exports.AcDbDxfFiler=Wl;exports.AcDbEllipse=Rs;exports.AcDbEntity=Le;exports.AcDbFace=Fs;exports.AcDbFileType=qi;exports.AcDbHatch=ts;exports.AcDbHatchPatternType=Qi;exports.AcDbHatchStyle=Xh;exports.AcDbHostApplicationServices=Es;exports.AcDbLayerTable=_u;exports.AcDbLayerTableRecord=la;exports.AcDbLayout=hs;exports.AcDbLayoutDictionary=ru;exports.AcDbLayoutManager=iu;exports.AcDbLeader=zs;exports.AcDbLeaderAnnotationType=Yh;exports.AcDbLine=es;exports.AcDbLineSpacingStyle=$h;exports.AcDbLinetypeTable=fu;exports.AcDbLinetypeTableRecord=hn;exports.AcDbMText=rs;exports.AcDbObject=Hr;exports.AcDbObjectIterator=us;exports.AcDbOpenMode=nh;exports.AcDbOrdinateDimension=$s;exports.AcDbOsnapMode=zt;exports.AcDbPlotPaperUnits=Zh;exports.AcDbPlotRotation=Qh;exports.AcDbPlotSettings=eu;exports.AcDbPlotShadePlotResLevel=an;exports.AcDbPlotShadePlotType=Zn;exports.AcDbPlotStdScaleType=tu;exports.AcDbPlotType=Jh;exports.AcDbPoint=Us;exports.AcDbPoly2dType=$n;exports.AcDbPoly3dType=Zi;exports.AcDbPolyline=js;exports.AcDbRadialDimension=Zs;exports.AcDbRasterImage=is;exports.AcDbRasterImageClipBoundaryType=qh;exports.AcDbRasterImageDef=su;exports.AcDbRasterImageImageDisplayOpt=Kh;exports.AcDbRay=Ws;exports.AcDbRegAppTable=bu;exports.AcDbRegAppTableRecord=Xa;exports.AcDbRegenerator=Rc;exports.AcDbRenderingCache=si;exports.AcDbResultBuffer=Za;exports.AcDbSpline=ns;exports.AcDbSymbolTable=Xr;exports.AcDbSymbolTableRecord=cn;exports.AcDbSysVarManager=Qs;exports.AcDbSystemVariables=Dt;exports.AcDbTable=Vs;exports.AcDbText=ni;exports.AcDbTextHorizontalMode=Gh;exports.AcDbTextStyleTable=yu;exports.AcDbTextStyleTableRecord=ha;exports.AcDbTextVerticalMode=Hh;exports.AcDbTrace=Ds;exports.AcDbUnitsValue=yo;exports.AcDbViewTable=vu;exports.AcDbViewTableRecord=Fd;exports.AcDbViewport=Gs;exports.AcDbViewportTable=wu;exports.AcDbViewportTableRecord=wo;exports.AcDbWipeout=Hs;exports.AcDbWorkerApi=Oc;exports.AcDbWorkerManager=Lc;exports.AcDbXline=Xs;exports.AcDbXrecord=fo;exports.AcGeArea2d=sa;exports.AcGeBox2d=ve;exports.AcGeBox3d=Nt;exports.AcGeCatmullRomCurve3d=Vh;exports.AcGeCircArc2d=Mn;exports.AcGeCircArc3d=co;exports.AcGeCurve2d=ai;exports.AcGeEllipseArc2d=ls;exports.AcGeEllipseArc3d=aa;exports.AcGeEuler=yd;exports.AcGeGeometryUtil=Eh;exports.AcGeLine2d=ei;exports.AcGeLine3d=ri;exports.AcGeLoop2d=oa;exports.AcGeMathUtil=St;exports.AcGeMatrix2d=ia;exports.AcGeMatrix3d=$e;exports.AcGeNurbsCurve=kn;exports.AcGePlane=as;exports.AcGePoint2d=Et;exports.AcGePoint3d=W;exports.AcGePolyline2d=un;exports.AcGeQuaternion=On;exports.AcGeShape2d=uo;exports.AcGeSpline3d=Wr;exports.AcGeTol=oo;exports.AcGeVector2d=te;exports.AcGeVector3d=q;exports.AcGiArrowType=po;exports.AcGiDefaultLightingType=_o;exports.AcGiLineWeight=Nn;exports.AcGiMTextAttachmentPoint=Pe;exports.AcGiMTextFlowDirection=Ur;exports.AcGiOrthographicType=mo;exports.AcGiRenderMode=go;exports.AcGiViewport=Dh;exports.AcTrStringUtil=ld;exports.ByBlock=ks;exports.ByLayer=ti;exports.DEBUG_MODE=ad;exports.DEFAULT_LINE_TYPE=Jn;exports.DEFAULT_TEXT_STYLE=ne;exports.DEFAULT_TOL=lo;exports.DEG2RAD=eo;exports.DefaultLoadingManager=Jl;exports.FLOAT_TOL=An;exports.MLIGHTCAD_APPID=Fa;exports.ORIGIN_POINT_2D=dd;exports.ORIGIN_POINT_3D=ao;exports.RAD2DEG=ro;exports.TAU=Qt;exports.TEMP_OBJECT_ID_PREFIX=ws;exports.acdbDisableOsnapMode=Ed;exports.acdbEnableOsnapMode=Ad;exports.acdbHasOsnapMode=Pd;exports.acdbHostApplicationServices=$a;exports.acdbMaskToOsnapModes=Id;exports.acdbOsnapModesToMask=xd;exports.acdbToggleOsnapMode=Sd;exports.basisFunction=Ts;exports.calculateCurveLength=Nh;exports.ceilPowerOfTwo=vh;exports.clamp=jr;exports.clone=Hi;exports.createWorkerApi=Cc;exports.damp=lh;exports.deepClone=Ca;exports.defaults=ss;exports.degToRad=_h;exports.dwgCodePageToEncoding=ih;exports.euclideanModulo=no;exports.evaluateNurbsPoint=$i;exports.floorPowerOfTwo=wh;exports.generateChordKnots=Th;exports.generateSqrtChordKnots=Mh;exports.generateUUID=sh;exports.generateUniformKnots=kh;exports.has=Gl;exports.intPartLength=so;exports.interpolateControlPoints=pd;exports.inverseLerp=oh;exports.isBetween=bh;exports.isBetweenAngle=xh;exports.isEmpty=Hl;exports.isEqual=Qn;exports.isImperialUnits=Nd;exports.isMetricUnits=Md;exports.isPointInPolygon=ho;exports.isPolygonIntersect=Ah;exports.isPowerOfTwo=yh;exports.lerp=io;exports.log=Yi;exports.mapLinear=ah;exports.normalizeAngle=Ki;exports.pingpong=hh;exports.radToDeg=fh;exports.randFloat=ph;exports.randFloatSpread=gh;exports.randInt=dh;exports.relativeEps=Ih;exports.seededRandom=mh;exports.setAcDbHostApplicationServicesProvider=eh;exports.setAcDbLayoutManagerFactory=rh;exports.setLogLevel=od;exports.smootherstep=ch;exports.smoothstep=uh;
|
|
3
|
+
`}registerHandle(t){return this._handleMap.has(t)||(/^[0-9A-F]+$/i.test(t)?this._handleMap.set(t,t.toUpperCase()):(this._handleMap.set(t,this._nextHandle.toString(16).toUpperCase()),this._nextHandle+=1,console.log(`Registered handle ${t} as ${this._handleMap.get(t)}`))),this._handleMap.get(t)}resolveHandle(t){if(t)return this.registerHandle(t)}writeGroup(t,e){return e==null?this:(this._lines.push(String(Math.trunc(t))),this._lines.push(this.formatValue(e)),this)}writeStart(t){return this.writeString(0,t)}writeSubclassMarker(t){return this.writeString(100,t)}writeString(t,e){return!e&&e!==""?this:this.writeGroup(t,e)}writeInt8(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt16(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt32(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeInt64(t,e){return e==null?this:this.writeGroup(t,Math.trunc(e))}writeUInt16(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeUInt32(t,e){return e==null?this:this.writeGroup(t,Math.max(0,e))}writeBoolean(t,e){return e==null?this:this.writeGroup(t,e?1:0)}writeBool(t,e){return this.writeBoolean(t,e)}writeDouble(t,e){return e==null||!Number.isFinite(e)?this:this.writeGroup(t,e)}writeAngle(t,e){return e==null||!Number.isFinite(e)?this:this.writeDouble(t,e*180/Math.PI)}writeHandle(t,e){const i=this.resolveHandle(e);return i?this.writeString(t,i):this}writeObjectId(t,e){return this.writeHandle(t,e)}writePoint2d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this):this}writePoint3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeVector3d(t,e){return e?(this.writeDouble(t,e.x),this.writeDouble(t+10,e.y),this.writeDouble(t+20,e.z??0),this):this}writeCmColor(t,e=62,i=420){if(!t)return this;const n=t.colorIndex;n!=null&&this.writeInt16(e,n);const r=t.RGB;return r!=null&&t.colorIndex==null&&this.writeInt32(i,r),this}writeTransparency(t,e=440){return t?this.writeInt32(e,t.serialize()):this}writeResultBuffer(t){if(!t)return this;for(const e of t)this.writeGroup(e.code,e.value);return this}startSection(t){return this.writeStart("SECTION"),this.writeString(2,t),this}endSection(){return this.writeStart("ENDSEC"),this}startTable(t){return this.writeStart("TABLE"),this.writeString(2,t),this}endTable(){return this.writeStart("ENDTAB"),this}formatValue(t){return typeof t=="string"?t:typeof t=="boolean"?t?"1":"0":typeof t=="number"?Number.isFinite(t)?Number.isInteger(t)?String(t):t.toFixed(this._precision).replace(/\.?0+$/,""):"0":String(t)}}function Kh(s,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in s)){const r=Object.getOwnPropertyDescriptor(i,n);r&&Object.defineProperty(s,n,r.get?r:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var E=(s=>(s[s.ByColor=1]="ByColor",s[s.ByACI=2]="ByACI",s[s.ByLayer=3]="ByLayer",s[s.ByBlock=4]="ByBlock",s[s.None=0]="None",s))(E||{});const kr={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},Hi=[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];let he=class{static getColorByIndex(t){return Hi[t]}static getIndexByColor(t){const e=Hi.length-1;for(let i=1;i<e;++i)if(Hi[i]===t)return i}static getColorByName(t){return kr[t.toLowerCase()]}static getNameByColor(t){for(const[e,i]of Object.entries(kr))if(i===t)return e}static getNameByIndex(t){const e=this.getColorByIndex(t);return this.getNameByColor(e)}},J=class te{constructor(t=E.ByLayer,e){this._colorMethod=t,this._colorMethod==E.ByColor&&e==null?this._value=16777215:this._colorMethod==E.ByACI?e==null?this._value=8:e===0?this._colorMethod=E.ByBlock:e===256?this._colorMethod=E.ByLayer:this._value=Math.max(0,Math.min(e,256)):this._value=e}get colorMethod(){return this._colorMethod}set colorMethod(t){this._colorMethod=t}get red(){const t=this.RGB;return t!=null?t>>16&255:void 0}get green(){const t=this.RGB;return t!=null?t>>8&255:void 0}get blue(){const t=this.RGB;return t!=null?t&255:void 0}get RGB(){switch(this._colorMethod){case E.ByColor:case E.ByBlock:case E.ByLayer:return this._value;case E.ByACI:return this._value?he.getColorByIndex(this._value):this._value;default:return}}setRGB(t,e,i){const n=Math.max(0,Math.min(255,Math.round(t))),r=Math.max(0,Math.min(255,Math.round(e))),a=Math.max(0,Math.min(255,Math.round(i)));return this._value=n<<16|r<<8|a,this._colorMethod=E.ByColor,this}setRGBValue(t){return t==null||!Number.isFinite(t)?(console.warn("Invalid RGB value:",t),this):(this._value=t&16777215,this._colorMethod=E.ByColor,this)}setRGBFromCss(t){if(!t)return this;const e=t.trim().toLowerCase();if(e.startsWith("#")){let r=0,a=0,o=0;if(e.length===7)r=parseInt(e.substr(1,2),16),a=parseInt(e.substr(3,2),16),o=parseInt(e.substr(5,2),16);else if(e.length===4)r=parseInt(e[1]+e[1],16),a=parseInt(e[2]+e[2],16),o=parseInt(e[3]+e[3],16);else return console.warn("Invalid hex color:",t),this;return this.setRGB(r,a,o)}const i=e.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(i){const r=parseInt(i[1],10),a=parseInt(i[2],10),o=parseInt(i[3],10);return this.setRGB(r,a,o)}const n=he.getColorByName(t);return n!==void 0?this.setRGBValue(n):(console.warn("Unknown CSS color string:",t),this)}setScalar(t){return this.setRGB(t,t,t)}get hexColor(){const t=this.RGB;return t==null?void 0:"0x"+t.toString(16).padStart(6,"0").toUpperCase()}get cssColor(){const t=this.RGB;if(t!=null)return`rgb(${t>>16&255},${t>>8&255},${t&255})`}cssColorAlpha(t){const e=this.RGB;if(e!=null)return`rgba(${e>>16&255},${e>>8&255},${e&255},${t})`}get colorIndex(){return this._colorMethod===E.ByACI?this._value:this._colorMethod===E.ByLayer?256:this._colorMethod===E.ByBlock?0:void 0}set colorIndex(t){if(t==null)return;const e=Math.max(0,Math.min(256,Math.round(t)));e===0?(this._colorMethod=E.ByBlock,this._value=void 0):e===256?(this._colorMethod=E.ByLayer,this._value=void 0):(this._colorMethod=E.ByACI,this._value=e)}get isByColor(){return this._colorMethod===E.ByColor}get isByACI(){return this._colorMethod===E.ByACI}get isForeground(){return this._colorMethod===E.ByACI&&this._value===7}setForeground(){return this._colorMethod=E.ByACI,this._value=7,this}get isByLayer(){return this._colorMethod===E.ByLayer}setByLayer(t){return this._colorMethod=E.ByLayer,t==null?this._value=256:this._value=t,this}get isByBlock(){return this._colorMethod===E.ByBlock}setByBlock(t){return this._colorMethod=E.ByBlock,t==null?this._value=0:this._value=t,this}get colorName(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByColor:return this._value?he.getNameByColor(this._value):"";case E.ByACI:return this._value?he.getNameByIndex(this._value):"";default:return}}set colorName(t){if(!t)return;const e=he.getColorByName(t);e!==void 0?(this._value=e,this._colorMethod=E.ByColor):console.warn("Unknown color name:",t)}clone(){const t=new te;return t._colorMethod=this._colorMethod,t._value=this._value,t}copy(t){return this._colorMethod=t._colorMethod,this._value=t._value,this}equals(t){return this._colorMethod===t._colorMethod&&this._value===t._value}toString(){switch(this._colorMethod){case E.ByLayer:return"ByLayer";case E.ByBlock:return"ByBlock";case E.ByACI:return this._value!==void 0?String(this._value):"";case E.ByColor:return this._value?`${this.red},${this.green},${this.blue}`:"";default:return""}}static fromString(t){if(!t)return;const e=t.trim();if(/^bylayer$/i.test(e))return new te(E.ByLayer);if(/^byblock$/i.test(e))return new te(E.ByBlock);const i=e.match(/^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i);if(i){const r=Number(i[1]),a=Number(i[2]),o=Number(i[3]),l=new te(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d{1,3},\d{1,3},\d{1,3}$/.test(e)){const[r,a,o]=e.split(",").map(Number),l=new te(E.ByColor);return l.setRGB(r,a,o),l}if(/^\d+$/.test(e)){const r=parseInt(e,10);return new te(E.ByACI,r)}if(/^book\$/i.test(e)){const r=e.substring(e.indexOf("$")+1),a=he.getColorByName(r);if(a!=null)return new te(E.ByColor,a);console.warn("Unknown color book entry:",t);return}const n=he.getColorByName(e);if(n!=null)return new te(E.ByColor,n);console.warn("Unknown color name:",t)}};class Zh{constructor(t=E.ByColor,e=0){this._colorMethod=t,this._value=e}get colorMethd(){return this._colorMethod}get red(){return this._value>>16&255}set red(t){this._colorMethod=E.ByColor,this._value=this._value&65535|(t&255)<<16}get green(){return this._value>>8&255}set green(t){this._colorMethod=E.ByColor,this._value=this._value&16711935|(t&255)<<8}get blue(){return this._value&255}set blue(t){this._colorMethod=E.ByColor,this._value=this._value&16776960|t&255}setRGB(t,e,i){this._colorMethod=E.ByColor,this._value=(t&255)<<16|(e&255)<<8|i&255}get colorIndex(){return this._value}set colorIndex(t){this._colorMethod=E.ByACI,this._value=t}get layerIndex(){return this._value}set layerIndex(t){this._colorMethod=E.ByLayer,this._value=t}isByColor(){return this._colorMethod===E.ByColor}isByLayer(){return this._colorMethod===E.ByLayer}isByBlock(){return this._colorMethod===E.ByBlock}isByACI(){return this._colorMethod===E.ByACI}isNone(){return this._colorMethod===E.None}get rawValue(){return this._value}set rawValue(t){this._value=t}}const gt={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 Qh{constructor(){this._listeners={}}addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;const i=this._listeners;return i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;const i=this._listeners[t];if(i!==void 0){const n=i.indexOf(e);n!==-1&&i.splice(n,1)}}dispatchEvent(t){if(this._listeners===void 0)return;const e=this._listeners[t.type];if(e!==void 0){t.target=this;const i=e.slice(0);for(let n=0,r=i.length;n<r;n++)i[n].call(this,t)}}}let K=class{constructor(){this.listeners=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}replaceEventListener(t){this.removeEventListener(t),this.addEventListener(t)}dispatch(t,...e){for(const i of this.listeners)i.call(null,t,...e)}};function ws(s){return s===null||typeof s!="object"?s:Array.isArray(s)?[...s]:{...s}}function rn(s){if(s===null||typeof s!="object")return s;if(s instanceof Date)return new Date(s.getTime());if(s instanceof RegExp)return new RegExp(s.source,s.flags);if(Array.isArray(s))return s.map(rn);const t={};for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(t[e]=rn(s[e]));return t}function Bs(s,...t){for(const e of t)if(e)for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&s[i]===void 0&&(s[i]=e[i]);return s}function Zr(s,t){return s!=null&&Object.prototype.hasOwnProperty.call(s,t)}function Qr(s){return s==null?!0:Array.isArray(s)||typeof s=="string"?s.length===0:s instanceof Map||s instanceof Set?s.size===0:typeof s=="object"?Object.keys(s).length===0:!1}function $e(s,t){if(s===t)return!0;if(s==null||t==null)return s===t;if(typeof s!=typeof t)return!1;if(typeof s!="object")return s===t;if(Array.isArray(s)!==Array.isArray(t))return!1;if(Array.isArray(s)){if(s.length!==t.length)return!1;for(let n=0;n<s.length;n++)if(!$e(s[n],t[n]))return!1;return!0}const e=Object.keys(s),i=Object.keys(t);if(e.length!==i.length)return!1;for(const n of e)if(!Object.prototype.hasOwnProperty.call(t,n)||!$e(s[n],t[n]))return!1;return!0}var Jh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function tl(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Jr={exports:{}};(function(s){(function(t,e){s.exports?s.exports=e():t.log=e()})(Jh,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],r={},a=null;function o(y,x){var w=y[x];if(typeof w.bind=="function")return w.bind(y);try{return Function.prototype.bind.call(w,y)}catch{return function(){return Function.prototype.apply.apply(w,[y,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(y){return y==="debug"&&(y="log"),typeof console===e?!1:y==="trace"&&i?l:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):t}function d(){for(var y=this.getLevel(),x=0;x<n.length;x++){var w=n[x];this[w]=x<y?t:this.methodFactory(w,y,this.name)}if(this.log=this.debug,typeof console===e&&y<this.levels.SILENT)return"No console available for logging"}function p(y){return function(){typeof console!==e&&(d.call(this),this[y].apply(this,arguments))}}function m(y,x,w){return c(y)||p.apply(this,arguments)}function u(y,x){var w=this,P,I,k,A="loglevel";typeof y=="string"?A+=":"+y:typeof y=="symbol"&&(A=void 0);function j(B){var H=(n[B]||"silent").toUpperCase();if(!(typeof window===e||!A)){try{window.localStorage[A]=H;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+H+";"}catch{}}}function T(){var B;if(!(typeof window===e||!A)){try{B=window.localStorage[A]}catch{}if(typeof B===e)try{var H=window.document.cookie,ye=encodeURIComponent(A),_e=H.indexOf(ye+"=");_e!==-1&&(B=/^([^;]+)/.exec(H.slice(_e+ye.length+1))[1])}catch{}return w.levels[B]===void 0&&(B=void 0),B}}function $(){if(!(typeof window===e||!A)){try{window.localStorage.removeItem(A)}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function C(B){var H=B;if(typeof H=="string"&&w.levels[H.toUpperCase()]!==void 0&&(H=w.levels[H.toUpperCase()]),typeof H=="number"&&H>=0&&H<=w.levels.SILENT)return H;throw new TypeError("log.setLevel() called with invalid level: "+B)}w.name=y,w.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},w.methodFactory=x||m,w.getLevel=function(){return k??I??P},w.setLevel=function(B,H){return k=C(B),H!==!1&&j(k),d.call(w)},w.setDefaultLevel=function(B){I=C(B),T()||w.setLevel(B,!1)},w.resetLevel=function(){k=null,$(),d.call(w)},w.enableAll=function(B){w.setLevel(w.levels.TRACE,B)},w.disableAll=function(B){w.setLevel(w.levels.SILENT,B)},w.rebuild=function(){if(a!==w&&(P=C(a.getLevel())),d.call(w),a===w)for(var B in r)r[B].rebuild()},P=C(a?a.getLevel():"WARN");var tt=T();tt!=null&&(k=C(tt)),d.call(w)}a=new u,a.getLogger=function(y){if(typeof y!="symbol"&&typeof y!="string"||y==="")throw new TypeError("You must supply a name when creating a logger.");var x=r[y];return x||(x=r[y]=new u(y,a.methodFactory)),x};var g=typeof window!==e?window.log:void 0;return a.noConflict=function(){return typeof window!==e&&window.log===a&&(window.log=g),a},a.getLoggers=function(){return r},a.default=a,a})})(Jr);var ta=Jr.exports;const el=tl(ta),sl=Kh({__proto__:null,default:el},[ta]),il=!0,bs=sl;bs.setLevel("debug");const nl=s=>{try{bs.setLevel(s)}catch(t){bs.setLevel("error"),bs.error(t)}};let ea=class sa{constructor(t,e){this.events={attrChanged:new K,modelChanged:new K},this._changing=!1,this._previousAttributes={},this._pending=!1;const i=t||{};e&&Bs(i,e),this.attributes=i,this.changed={}}get(t){return this.attributes[t]}set(t,e,i){if(t==null)return this;let n;typeof t=="object"?(n=t,i=e):(n={},n[t]=e),i||(i={});const r=i.unset,a=i.silent,o=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=ws(this.attributes),this.changed={});const c=this.attributes,d=this.changed,p=this._previousAttributes;for(const m in n)e=n[m],$e(c[m],e)||o.push(m),$e(p[m],e)?delete d[m]:d[m]=e,r?delete c[m]:c[m]=e;if(!a){o.length&&(this._pending=i);for(let m=0;m<o.length;m++)this.events.attrChanged.dispatch({object:this,attrName:o[m],attrValue:c[o[m]],options:i})}if(l)return this;if(!a)for(;this._pending;)i=this._pending,this._pending=!1,this.events.modelChanged.dispatch({object:this,options:i});return this._pending=!1,this._changing=!1,this}has(t){return this.get(t)!=null}hasChanged(t){return t==null?!Qr(this.changed):Zr(this.changed,t)}changedAttributes(t){if(!t)return this.hasChanged()?ws(this.changed):{};const e=this._changing?this._previousAttributes:this.attributes,i={};for(const n in t){const r=t[n];$e(e[n],r)||(i[n]=r)}return i}previous(t){return t==null||!this._previousAttributes?null:this._previousAttributes[t]}previousAttributes(){return ws(this._previousAttributes)}clone(){const t=ws(this.attributes);return new sa(t)}},xn=class xs{constructor(){this.entries=new Map}static getInstance(){return xs.instance||(xs.instance=new xs),xs.instance}collect(t){this.entries.set(t.name,t)}printAll(){for(const[t,e]of this.entries)console.log(`${t}:`),console.log(e.format())}clear(){this.entries.clear()}getAll(){return Array.from(this.entries.values())}getEntry(t){return this.entries.get(t)}remove(t){return this.entries.delete(t)}};class rl{static formatBytes(t,e=2){if(t===0)return"0 B";const i=1024,n=Math.max(0,e),r=["B","KB","MB","GB","TB"],a=Math.floor(Math.log(t)/Math.log(i)),o=t/Math.pow(i,a);return`${parseFloat(o.toFixed(n))} ${r[a]}`}}var ct=(s=>(s[s.ByLayer=0]="ByLayer",s[s.ByBlock=1]="ByBlock",s[s.ByAlpha=2]="ByAlpha",s[s.ErrorValue=3]="ErrorValue",s))(ct||{});let zi=class Ot{constructor(t){t!==void 0?(this._method=ct.ByAlpha,this._alpha=Ot.clampAlpha(t)):(this._method=ct.ByLayer,this._alpha=255)}get method(){return this._method}set method(t){this._method=t}get alpha(){return this._alpha}set alpha(t){this._alpha=Ot.clampAlpha(t),this._method=ct.ByAlpha}get percentage(){if(this._method===ct.ByAlpha)return Math.round((1-this._alpha/255)*100)}set percentage(t){const e=Math.max(0,Math.min(100,t)),i=Math.round(255*(1-e/100));this.alpha=i}static clampAlpha(t){return Math.max(0,Math.min(255,Math.floor(t)))}get isByAlpha(){return this._method===ct.ByAlpha}get isByBlock(){return this._method===ct.ByBlock}get isByLayer(){return this._method===ct.ByLayer}get isClear(){return this.isByAlpha&&this._alpha===0}get isSolid(){return this.isByAlpha&&this._alpha===255}get isInvalid(){return this._method===ct.ErrorValue}serialize(){return this._method<<24|this._alpha}clone(){const t=new Ot;return t._method=this._method,t._alpha=this._alpha,t}equals(t){return this._method===t._method&&this._alpha===t._alpha}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this._alpha.toString()}static fromString(t){const e=t.trim();if(/^bylayer$/i.test(e)){const r=new Ot;return r._method=ct.ByLayer,r}if(/^byblock$/i.test(e)){const r=new Ot;return r._method=ct.ByBlock,r}const i=Number(e);if(Number.isInteger(i)&&i>=0&&i<=255)return new Ot(i);const n=new Ot;return n._method=ct.ErrorValue,n}static deserialize(t){const e=t>>>24&255,i=t&255,n=Object.values(ct)[e]??ct.ErrorValue,r=new Ot;return r._method=n,r._alpha=Ot.clampAlpha(i),r}};class ia{constructor(t){this.name=t}run(t){throw new Error("run() must be implemented by subclass")}}class na{constructor(){this.tasks=[],this.onProgress=()=>{},this.onComplete=()=>{},this.onError=()=>!1}scheduleTask(t){return new Promise((e,i)=>{const n=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}addTask(t){this.tasks.push(t)}setProgressCallback(t){this.onProgress=t}setCompleteCallback(t){this.onComplete=t}setErrorCallback(t){this.onError=t}async run(t){const e=this.tasks.length;let i=t;for(let n=0;n<e;n++){const r=this.tasks[n];try{i=await this.scheduleTask(async()=>{const a=await r.run(i);return this.onProgress((n+1)/e,r),a})}catch(a){if(this.onError({error:a,taskIndex:n,task:r}))return Promise.reject(a)}}this.onComplete(i)}}let ra=class{constructor(t,e,i){this.isLoading=!1,this.itemsLoaded=0,this.itemsTotal=0,this.urlModifier=void 0,this.handlers=[],this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i}itemStart(t){this.itemsTotal++,this.isLoading===!1&&this.onStart!==void 0&&this.onStart(t,this.itemsLoaded,this.itemsTotal),this.isLoading=!0}itemEnd(t){this.itemsLoaded++,this.onProgress!==void 0&&this.onProgress(t,this.itemsLoaded,this.itemsTotal),this.itemsLoaded===this.itemsTotal&&(this.isLoading=!1,this.onLoad!==void 0&&this.onLoad())}itemError(t){this.onError!==void 0&&this.onError(t)}resolveURL(t){return this.urlModifier?this.urlModifier(t):t}setURLModifier(t){return this.urlModifier=t,this}addHandler(t,e){return this.handlers.push(t,e),this}removeHandler(t){const e=this.handlers.indexOf(t);return e!==-1&&this.handlers.splice(e,2),this}getHandler(t){for(let e=0,i=this.handlers.length;e<i;e+=2){const n=this.handlers[e],r=this.handlers[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return r}return null}};const aa=new ra;class al{constructor(t){this.manager=t!==void 0?t:aa,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}loadAsync(t,e){return new Promise((i,n)=>{this.load(t,i,e,n)})}parse(t){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}var Be=256,oa=[],Lr=256,qs;for(;Be--;)oa[Be]=(Be+256).toString(16).substring(1);function ol(s){var t=0,e=11;if(!qs||Be+e>Lr*2)for(qs="",Be=0;t<Lr;t++)qs+=oa[Math.random()*256|0];return qs.substring(Be,Be+++e)}const ei="TEMP_";let an;function ha(s){an=s}class ne{constructor(t,e){if(t=t||{},this._attrs=new ea(t,e),this._xDataMap=new Map,!this._attrs.get("objectId"))try{this._attrs.set("objectId",this.database.generateHandle())}catch{this._attrs.set("objectId",this.generateTemporaryHandle())}}generateTemporaryHandle(){return ei+ol()}get attrs(){return this._attrs}getAttr(t){const e=this._attrs.get(t);if(e===void 0)throw new Error(`[AcDbObject] Attribute name '${t}' does't exist in this object!`);return e}getAttrWithoutException(t){return this._attrs.get(t)}setAttr(t,e){this._attrs.set(t,e)}get objectId(){return this.getAttr("objectId")}set objectId(t){this._attrs.set("objectId",t),t&&!t.startsWith(ei)&&this.database.updateMaxHandle(t)}get isTemp(){const t=this.getAttrWithoutException("objectId");return!!t&&t.startsWith(ei)}get ownerId(){return this.getAttr("ownerId")}set ownerId(t){this._attrs.set("ownerId",t)}get extensionDictionary(){return this.getAttrWithoutException("extensionDictionary")}set extensionDictionary(t){this._attrs.set("extensionDictionary",t)}get database(){if(this._database)return this._database;if(an)return an().workingDatabase;throw new Error("The current working database must be set before using it!")}set database(t){this._database=t}getXData(t){return this._xDataMap.get(t)}setXData(t){for(const e of t)e.code===wn.ExtendedDataRegAppName&&this._xDataMap.set(e.value,t)}removeXData(t){this._xDataMap.delete(t)}createExtensionDictionary(){}close(){}dxfOut(...t){const[e,i=!1]=t;if(e.writeHandle(5,this.objectId),e.writeObjectId(330,this.ownerId),e.writeObjectId(360,this.extensionDictionary),this.dxfOutFields(e),i)for(const n of this._xDataMap.values())e.writeResultBuffer(n);return this}dxfOutFields(t){return this}}let on;function la(s){on=s}function bn(){return li.instance}const Fi=class Fi{constructor(){this._workingDatabase=null}get workingDatabase(){if(this._workingDatabase==null)throw new Error("The current working database must be set before using it!");return this._workingDatabase}set workingDatabase(t){this._workingDatabase=t}get layoutManager(){if(!this._layoutManager){if(!on)throw new Error("The layout manager factory must be registered before using it!");this._layoutManager=on()}return this._layoutManager}};Fi.instance=new Fi;let li=Fi;ha(bn);var ca=(s=>(s.kForRead="kForRead",s.kForWrite="kForWrite",s))(ca||{});class fn{constructor(t){if(this._values=[],t)for(const e of t)this._values.push({...e})}get length(){return this._values.length}at(t){return this._values[t]}add(t){this._values.push(t)}addRange(t){for(const e of t)this._values.push(e)}clear(){this._values.length=0}toArray(){return this._values.map(t=>({...t}))}clone(){return new fn(this._values)}[Symbol.iterator](){return this._values[Symbol.iterator]()}}class In{constructor(t,e,i){this._chunkSize=-1,this._minimumChunkSize=50,this._count=t,this._numerOfChunk=e<1?1:e,this._minimumChunkSize=i,this.calculateChunkSize()}get count(){return this._count}get numerOfChunk(){return this._numerOfChunk}get minimumChunkSize(){return this._minimumChunkSize}set minimumChunkSize(t){this._minimumChunkSize=t,this.calculateChunkSize()}get chunkSize(){return this._chunkSize}calculateChunkSize(){let t=this._count/this._numerOfChunk;t<this._minimumChunkSize&&(t=Math.min(this._minimumChunkSize,this._count)),this._chunkSize=t<1?this._count:Math.floor(t)}scheduleTask(t){return new Promise((e,i)=>{const n=()=>{Promise.resolve(t()).then(e).catch(i)};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(n):setTimeout(n,0)})}async processChunk(t,e){if(this._count<=0){await(e==null?void 0:e());return}let i=0;const n=async()=>{const r=i,a=Math.min(i+this._chunkSize,this._count);await t(r,a),i=a,i<this._count&&await this.scheduleTask(n)};await n(),await(e==null?void 0:e())}}var fs=(s=>(s.DXF="dxf",s.DWG="dwg",s))(fs||{});class Ft{constructor(){this.events={registered:new K,unregistered:new K},this._converters=new Map,this.register("dxf",new $h)}static createInstance(){return Ft._instance==null&&(Ft._instance=new Ft),this._instance}static get instance(){return Ft._instance||(Ft._instance=new Ft),Ft._instance}get fileTypes(){return this._converters.keys()}register(t,e){this._converters.set(t,e),this.events.registered.dispatch({fileType:t,converter:e})}get(t){return this._converters.get(t)}unregister(t){const e=this._converters.get(t);e&&(this._converters.delete(t),this.events.unregistered.dispatch({fileType:t,converter:e}))}}var Sn=(s=>(s[s.DecimalDegrees=0]="DecimalDegrees",s[s.DegreesMinutesSeconds=1]="DegreesMinutesSeconds",s[s.Gradians=2]="Gradians",s[s.Radians=3]="Radians",s[s.SurveyorsUnits=4]="SurveyorsUnits",s))(Sn||{});class Je{static get instance(){return this._instance||(this._instance=new Je),this._instance}constructor(){this._blocks=new Map}createKey(t,e){return`${t}_${e}`}set(t,e){return e=e.fastDeepClone(),this._blocks.set(t,e),e}get(t){let e=this._blocks.get(t);return e&&(e=e.fastDeepClone()),e}has(t){return this._blocks.has(t)}clear(){this._blocks.clear()}draw(t,e,i,n=[],r=!0,a,o){var c;const l=[];if(e!=null){const d=this.createKey(e.name,i);let p;if(this.has(d))p=this.get(d);else{const m=(c=t.basePoint)==null?void 0:c.clone();t.basePoint=void 0;const u=e.newIterator();let g=!0;for(const y of u)if(y.color.isByBlock&&i?(Or.copy(y.color),y.color.setRGBValue(i),this.addEntity(y,l,t),y.color.copy(Or)):this.addEntity(y,l,t),g&&l.length>0){const x=l[0];t.basePoint=x.basePoint,g=!1}p=t.group(l),p&&r&&Z.name&&!Z.name.startsWith("*U")&&this.set(d,p),t.basePoint=m}return p&&a&&(p.applyMatrix(a),o&&(o.x!=0||o.y!=0||o.z!=1)&&(a.setFromExtrusionDirection(o),p.applyMatrix(a))),p&&n&&n.length>0&&(p.bakeTransformToChildren(),n.forEach(m=>p.addChild(m))),p}else return t.group(l)}addEntity(t,e,i){const n=t.worldDraw(i);n&&(this.attachEntityInfo(n,t),e.push(n))}attachEntityInfo(t,e){t.objectId=e.objectId,t.ownerId=e.ownerId,t.layerName=e.layer,t.visible=e.visibility}}const Or=new J;var En=(s=>(s[s.UTF8=0]="UTF8",s[s.US_ASCII=1]="US_ASCII",s[s.ISO_8859_1=2]="ISO_8859_1",s[s.ISO_8859_2=3]="ISO_8859_2",s[s.ISO_8859_3=4]="ISO_8859_3",s[s.ISO_8859_4=5]="ISO_8859_4",s[s.ISO_8859_5=6]="ISO_8859_5",s[s.ISO_8859_6=7]="ISO_8859_6",s[s.ISO_8859_7=8]="ISO_8859_7",s[s.ISO_8859_8=9]="ISO_8859_8",s[s.ISO_8859_9=10]="ISO_8859_9",s[s.CP437=11]="CP437",s[s.CP850=12]="CP850",s[s.CP852=13]="CP852",s[s.CP855=14]="CP855",s[s.CP857=15]="CP857",s[s.CP860=16]="CP860",s[s.CP861=17]="CP861",s[s.CP863=18]="CP863",s[s.CP864=19]="CP864",s[s.CP865=20]="CP865",s[s.CP869=21]="CP869",s[s.CP932=22]="CP932",s[s.MACINTOSH=23]="MACINTOSH",s[s.BIG5=24]="BIG5",s[s.CP949=25]="CP949",s[s.JOHAB=26]="JOHAB",s[s.CP866=27]="CP866",s[s.ANSI_1250=28]="ANSI_1250",s[s.ANSI_1251=29]="ANSI_1251",s[s.ANSI_1252=30]="ANSI_1252",s[s.GB2312=31]="GB2312",s[s.ANSI_1253=32]="ANSI_1253",s[s.ANSI_1254=33]="ANSI_1254",s[s.ANSI_1255=34]="ANSI_1255",s[s.ANSI_1256=35]="ANSI_1256",s[s.ANSI_1257=36]="ANSI_1257",s[s.ANSI_874=37]="ANSI_874",s[s.ANSI_932=38]="ANSI_932",s[s.ANSI_936=39]="ANSI_936",s[s.ANSI_949=40]="ANSI_949",s[s.ANSI_950=41]="ANSI_950",s[s.ANSI_1361=42]="ANSI_1361",s[s.UTF16=43]="UTF16",s[s.ANSI_1258=44]="ANSI_1258",s[s.UNDEFINED=255]="UNDEFINED",s))(En||{});const hl=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],da=s=>hl[s],qe="Continuous",Y="Standard",Ke="ByLayer",ci="ByBlock",hn="mlightcad",ln="ACAD",nt=["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 Nr=1234567;const Pn=Math.PI/180,An=180/Math.PI;function ua(){const s=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(nt[s&255]+nt[s>>8&255]+nt[s>>16&255]+nt[s>>24&255]+"-"+nt[t&255]+nt[t>>8&255]+"-"+nt[t>>16&15|64]+nt[t>>24&255]+"-"+nt[e&63|128]+nt[e>>8&255]+"-"+nt[e>>16&255]+nt[e>>24&255]+nt[i&255]+nt[i>>8&255]+nt[i>>16&255]+nt[i>>24&255]).toLowerCase()}function ee(s,t,e){return Math.max(t,Math.min(e,s))}function Tn(s,t){return(s%t+t)%t}function pa(s,t,e,i,n){return i+(s-t)*(n-i)/(e-t)}function ma(s,t,e){return s!==t?(e-s)/(t-s):0}function Mn(s,t,e){return(1-e)*s+e*t}function ga(s,t,e,i){return Mn(s,t,1-Math.exp(-e*i))}function ya(s,t=1){return t-Math.abs(Tn(s,t*2)-t)}function _a(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*(3-2*s))}function wa(s,t,e){return s<=t?0:s>=e?1:(s=(s-t)/(e-t),s*s*s*(s*(s*6-15)+10))}function xa(s,t){return s+Math.floor(Math.random()*(t-s+1))}function ba(s,t){return s+Math.random()*(t-s)}function fa(s){return s*(.5-Math.random())}function Ia(s){s!==void 0&&(Nr=s);let t=Nr+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Sa(s){return s*Pn}function Ea(s){return s*An}function Pa(s){return(s&s-1)===0&&s!==0}function Aa(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Ta(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Is(s){const t=Math.PI*2;return(s%t+t)%t}function Ma(s,t,e){return s>t&&s<e||s>e&&s<t}function va(s,t,e,i=!1){return s=Is(s),t=Is(t),e=Is(e),i?t>e?s<=t&&s>=e:s<=t||s>=e:t<e?s>=t&&s<=e:s>=t||s<=e}function vn(s){return s=Math.abs(s),s<1?0:Math.ceil(Math.log10(Math.abs(s)+1))}function ka(s,t=1e-7){const e=vn(s);return Math.max(Math.pow(10,e)*t,t)}const N={DEG2RAD:Pn,RAD2DEG:An,generateUUID:ua,clamp:ee,euclideanModulo:Tn,mapLinear:pa,inverseLerp:ma,lerp:Mn,damp:ga,pingpong:ya,smoothstep:_a,smootherstep:wa,randInt:xa,randFloat:ba,randFloatSpread:fa,seededRandom:Ia,degToRad:Sa,radToDeg:Ea,isPowerOfTwo:Pa,ceilPowerOfTwo:Aa,floorPowerOfTwo:Ta,normalizeAngle:Is,isBetween:Ma,isBetweenAngle:va,intPartLength:vn,relativeEps:ka},cn=class La{constructor(t,e){this.x=0,this.y=0;const i=+(t!==void 0)+ +(e!==void 0);if(i!==0){if(i===1&&t instanceof Array){this.x=t[0],this.y=t[1];return}if(i===1){const{x:n,y:r}=t;this.x=n,this.y=r;return}if(i===2){this.x=t,this.y=e;return}throw gt.ILLEGAL_PARAMETERS}}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new La(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix2d(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*i-a*n+t.x,this.y=r*n+a*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}relativeEps(t=1e-7){return Math.min(N.relativeEps(this.x,t),N.relativeEps(this.y,t))}*[Symbol.iterator](){yield this.x,yield this.y}};cn.EMPTY=Object.freeze(new cn(0,0));let U=cn;const dn=class Oa{constructor(t,e,i,n,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],t!=null&&e!=null&&i!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&this.set(t,e,i,n,r,a,o,l,c)}set(t,e,i,n,r,a,o,l,c){const d=this.elements;return d[0]=t,d[1]=n,d[2]=o,d[3]=e,d[4]=r,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],p=i[7],m=i[2],u=i[5],g=i[8],y=n[0],x=n[3],w=n[6],P=n[1],I=n[4],k=n[7],A=n[2],j=n[5],T=n[8];return r[0]=a*y+o*P+l*A,r[3]=a*x+o*I+l*j,r[6]=a*w+o*k+l*T,r[1]=c*y+d*P+p*A,r[4]=c*x+d*I+p*j,r[7]=c*w+d*k+p*T,r[2]=m*y+u*P+g*A,r[5]=m*x+u*I+g*j,r[8]=m*w+u*k+g*T,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],d=t[8];return e*a*d-e*o*c-i*r*d+i*o*l+n*r*c-n*a*l}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],d=t[8],p=d*a-o*c,m=o*l-d*r,u=c*r-a*l,g=e*p+i*m+n*u;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/g;return t[0]=p*y,t[1]=(n*c-d*i)*y,t[2]=(o*i-n*a)*y,t[3]=m*y,t[4]=(d*e-n*l)*y,t[5]=(n*r-o*e)*y,t[6]=u*y,t[7]=(i*l-c*e)*y,t[8]=(a*e-i*r)*y,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t.elements[0]=e[0],t.elements[1]=e[3],t.elements[2]=e[6],t.elements[3]=e[1],t.elements[4]=e[4],t.elements[5]=e[7],t.elements[6]=e[2],t.elements[7]=e[5],t.elements[8]=e[8],this}setUvTransform(t,e,i,n,r,a,o){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*a+c*o)+a+t,-n*c,n*l,-n*(-c*a+l*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Ui.makeScale(t,e)),this}rotate(t){return this.premultiply(Ui.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ui.makeTranslation(t,e)),this}makeTranslation(t,e){return t instanceof U?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let n=0;n<9;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new Oa().fromArray(this.elements)}};dn.IDENTITY=Object.freeze(new dn);let Vi=dn;const Ui=new Vi,Fe=1e-6,G=2*Math.PI,ll={x:0,y:0},kn={x:0,y:0,z:0};class Ln{constructor(){this.equalPointTol=Fe,this.equalVectorTol=Fe}equalPoint2d(t,e){return new U(t).sub(e).length()<this.equalPointTol}equalPoint3d(t,e){return new f(t).sub(e).length()<this.equalPointTol}static equalToZero(t,e=Fe){return t<e&&t>-e}static equal(t,e,i=Fe){return Math.abs(t-e)<i}static great(t,e,i=Fe){return t-e>i}static less(t,e,i=Fe){return t-e<i}}const On=new Ln;function Nn(s,t,e=!1){const i=s.x,n=s.y;let r=!1;const a=t.length;for(let o=0,l=a-1;o<a;l=o++){const c=t[o].x,d=t[o].y,p=t[l].x,m=t[l].y;let u=d>n!=m>n;e&&(u=d>=n!=m>=n),u&&i<(p-c)*(n-d)/(m-d)+c&&(r=!r)}return r}function Na(s,t){if(s.length===0||t.length===0)return!1;const e=new dt().setFromPoints(s),i=new dt().setFromPoints(t);if(!e.intersectsBox(i))return!1;for(let n=0;n<s.length;){if(Nn(s[n],t,!0))return!0;n<s.length-1&&On.equalPoint2d(s[n+1],s[n])&&++n,++n}return!1}const Ca={isPointInPolygon:Nn,isPolygonIntersect:Na};function cl(s,t){const e=[],i=t-1,n=s;for(let r=0;r<=n;r++)e.push(0);for(let r=1;r<=i-n;r++)e.push(r);for(let r=0;r<=n;r++)e.push(i-n+1);return e}function dl(s,t){const e=t.length-1,i=s,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],d=t[o][2]-t[o-1][2],p=Math.sqrt(l*l+c*c+d*d);r+=p,n.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=e-i;o++){const l=n[o]/r;a.push(l*(e-i+1))}for(let o=0;o<=i;o++)a.push(e-i+1);return a}function Fa(s,t="Uniform"){const e=s.length;if(e===0)return[];if(e===1)return[0];const i=e-1;if(t==="Uniform")return new Array(e).fill(0).map((a,o)=>o/i);const n=[0];let r=0;for(let a=1;a<=i;a++){const o=s[a][0]-s[a-1][0],l=s[a][1]-s[a-1][1],c=s[a][2]-s[a-1][2],d=Math.sqrt(o*o+l*l+c*c),p=t==="SqrtChord"?Math.sqrt(d):d;r+=p,n.push(r)}return r<1e-12?new Array(e).fill(0).map((a,o)=>o/i):n.map(a=>a/r)}function Ba(s,t){const e=t.length-1,i=s,n=e+i+1,r=new Array(n+1).fill(0),a=t[t.length-1];for(let o=n-i;o<=n;o++)r[o]=a;for(let o=1;o<=e-i;o++){let l=0;for(let c=o;c<o+i;c++)l+=t[c];r[o+i]=l/i}return r}function ul(s,t){const e=t.length-1,i=s,n=[0];let r=0;for(let o=1;o<=e;o++){const l=t[o][0]-t[o-1][0],c=t[o][1]-t[o-1][1],d=t[o][2]-t[o-1][2],p=Math.sqrt(l*l+c*c+d*d),m=Math.sqrt(p);r+=m,n.push(r)}const a=[];for(let o=0;o<=i;o++)a.push(0);for(let o=1;o<=e-i;o++){const l=n[o]/r;a.push(l*(e-i+1))}for(let o=0;o<=i;o++)a.push(e-i+1);return a}function Xi(s,t){const e=s.length,i=s.map(a=>a.slice()),n=t.slice();for(let a=0;a<e;a++){let o=a,l=Math.abs(i[a][a]);for(let c=a+1;c<e;c++){const d=Math.abs(i[c][a]);d>l&&(l=d,o=c)}if(l<1e-12)throw new Error("Interpolation matrix is singular.");if(o!==a){const c=i[a];i[a]=i[o],i[o]=c;const d=n[a];n[a]=n[o],n[o]=d}for(let c=a+1;c<e;c++){const d=i[c][a]/i[a][a];if(!(Math.abs(d)<1e-14)){for(let p=a;p<e;p++)i[c][p]-=d*i[a][p];n[c]-=d*n[a]}}}const r=new Array(e).fill(0);for(let a=e-1;a>=0;a--){let o=n[a];for(let l=a+1;l<e;l++)o-=i[a][l]*r[l];r[a]=o/i[a][a]}return r}function Cn(s,t,e="Uniform",i,n){if(s.length===0)return{controlPoints:[],knots:[],weights:[]};const r=s.map(C=>[C[0],C[1],C[2]??0]),a=!!i,o=!!n,l=(a?1:0)+(o?1:0),c=r.length-1,d=c+l;if(d<t)throw new Error("Not enough points to interpolate a curve of this degree.");const p=Fa(r,e),m=p.slice();a&&m.unshift(p[0]),o&&m.push(p[p.length-1]);const u=Ba(t,m),g=d+1,y=new Array(g),x=new Array(g),w=new Array(g),P=new Array(g);let I=0;y[I]=new Array(g).fill(0),y[I][0]=1,x[I]=r[0][0],w[I]=r[0][1],P[I]=r[0][2],I++;for(let C=1;C<=c-1;C++){const tt=p[C];y[I]=new Array(g).fill(0);for(let B=0;B<=d;B++)y[I][B]=Ms(B,t,tt,u);x[I]=r[C][0],w[I]=r[C][1],P[I]=r[C][2],I++}if(y[I]=new Array(g).fill(0),y[I][d]=1,x[I]=r[c][0],w[I]=r[c][1],P[I]=r[c][2],I++,a){const C=u[t+1]-u[0],tt=C!==0?t/C:0;y[I]=new Array(g).fill(0),y[I][0]=-tt,y[I][1]=tt,x[I]=(i==null?void 0:i[0])??0,w[I]=(i==null?void 0:i[1])??0,P[I]=(i==null?void 0:i[2])??0,I++}if(o){const C=u[d+t+1]-u[d],tt=C!==0?t/C:0;y[I]=new Array(g).fill(0),y[I][d-1]=-tt,y[I][d]=tt,x[I]=(n==null?void 0:n[0])??0,w[I]=(n==null?void 0:n[1])??0,P[I]=(n==null?void 0:n[2])??0,I++}const k=Xi(y,x),A=Xi(y,w),j=Xi(y,P),T=new Array(g);for(let C=0;C<g;C++)T[C]=[k[C],A[C],j[C]];const $=new Array(g).fill(1);return{controlPoints:T,knots:u,weights:$}}function Ms(s,t,e,i){if(t===0)return e>=i[s]&&e<i[s+1]?1:0;const n=i[s+t]-i[s],r=i[s+t+1]-i[s+1],a=n>1e-10?(e-i[s])/n:0,o=r>1e-10?(i[s+t+1]-e)/r:0;return a*Ms(s,t-1,e,i)+o*Ms(s+1,t-1,e,i)}function Ss(s,t,e,i,n){const r=i.length-1,a=t;if(s=Math.max(e[a],Math.min(e[r+1],s)),Math.abs(s-e[r+1])<1e-8)return[...i[r]];if(Math.abs(s-e[a])<1e-8)return[...i[0]];const o=[0,0,0];let l=0;for(let c=0;c<=r;c++){const d=Ms(c,a,s,e),p=n[c]*d;o[0]+=i[c][0]*p,o[1]+=i[c][1]*p,o[2]+=i[c][2]*p,l+=p}if(l<1e-10){const c=e[e.length-a-1];if(Math.abs(s-c)<1e-8)return[...i[r]];if(Math.abs(s-e[a])<1e-8)return[...i[0]]}return l>1e-10&&(o[0]/=l,o[1]/=l,o[2]/=l),o}function Ra(s,t,e,i){const n=s,r=t[n],a=t[t.length-n-1];let o=0;const l=1e3,c=(a-r)/l;let d=Ss(r,s,t,e,i);for(let y=1;y<=l;y++){const x=r+y*c,w=Ss(x,s,t,e,i),P=w[0]-d[0],I=w[1]-d[1],k=w[2]-d[2];o+=Math.sqrt(P*P+I*I+k*k),d=w}const p=Ss(a,s,t,e,i),m=p[0]-d[0],u=p[1]-d[1],g=p[2]-d[2];return o+=Math.sqrt(m*m+u*u+g*g),o}function pl(s,t=3,e="Uniform",i,n){return s.length===0?[]:Cn(s,t,e,i,n).controlPoints}class Ge{constructor(t=0,e=0,i=0,n=1){this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,a,o){let l=i[n+0],c=i[n+1],d=i[n+2],p=i[n+3];const m=r[a+0],u=r[a+1],g=r[a+2],y=r[a+3];if(o===0){t[e+0]=l,t[e+1]=c,t[e+2]=d,t[e+3]=p;return}if(o===1){t[e+0]=m,t[e+1]=u,t[e+2]=g,t[e+3]=y;return}if(p!==y||l!==m||c!==u||d!==g){let x=1-o;const w=l*m+c*u+d*g+p*y,P=w>=0?1:-1,I=1-w*w;if(I>Number.EPSILON){const A=Math.sqrt(I),j=Math.atan2(A,w*P);x=Math.sin(x*j)/A,o=Math.sin(o*j)/A}const k=o*P;if(l=l*x+m*k,c=c*x+u*k,d=d*x+g*k,p=p*x+y*k,x===1-o){const A=1/Math.sqrt(l*l+c*c+d*d+p*p);l*=A,c*=A,d*=A,p*=A}}t[e]=l,t[e+1]=c,t[e+2]=d,t[e+3]=p}static multiplyQuaternionsFlat(t,e,i,n,r,a){const o=i[n],l=i[n+1],c=i[n+2],d=i[n+3],p=r[a],m=r[a+1],u=r[a+2],g=r[a+3];return t[e]=o*g+d*p+l*u-c*m,t[e+1]=l*g+d*m+c*p-o*u,t[e+2]=c*g+d*u+o*m-l*p,t[e+3]=d*g-o*p-l*m-c*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new Ge(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t.x,n=t.y,r=t.z,a=t.order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(n/2),p=o(r/2),m=l(i/2),u=l(n/2),g=l(r/2);switch(a){case"XYZ":this._x=m*d*p+c*u*g,this._y=c*u*p-m*d*g,this._z=c*d*g+m*u*p,this._w=c*d*p-m*u*g;break;case"YXZ":this._x=m*d*p+c*u*g,this._y=c*u*p-m*d*g,this._z=c*d*g-m*u*p,this._w=c*d*p+m*u*g;break;case"ZXY":this._x=m*d*p-c*u*g,this._y=c*u*p+m*d*g,this._z=c*d*g+m*u*p,this._w=c*d*p-m*u*g;break;case"ZYX":this._x=m*d*p-c*u*g,this._y=c*u*p+m*d*g,this._z=c*d*g-m*u*p,this._w=c*d*p+m*u*g;break;case"YZX":this._x=m*d*p+c*u*g,this._y=c*u*p+m*d*g,this._z=c*d*g-m*u*p,this._w=c*d*p-m*u*g;break;case"XZY":this._x=m*d*p-c*u*g,this._y=c*u*p-m*d*g,this._z=c*d*g+m*u*p,this._w=c*d*p+m*u*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],a=e[1],o=e[5],l=e[9],c=e[2],d=e[6],p=e[10],m=i+o+p;if(m>0){const u=.5/Math.sqrt(m+1);this._w=.25/u,this._x=(d-l)*u,this._y=(r-c)*u,this._z=(a-n)*u}else if(i>o&&i>p){const u=2*Math.sqrt(1+i-o-p);this._w=(d-l)/u,this._x=.25*u,this._y=(n+a)/u,this._z=(r+c)/u}else if(o>p){const u=2*Math.sqrt(1+o-i-p);this._w=(r-c)/u,this._x=(n+a)/u,this._y=.25*u,this._z=(l+d)/u}else{const u=2*Math.sqrt(1+p-i-o);this._w=(a-n)/u,this._x=(r+c)/u,this._y=(l+d)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ee(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const n=Math.min(1,e/i);return this.slerp(t,n),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,a=t._w,o=e._x,l=e._y,c=e._z,d=e._w;return this._x=i*d+a*o+n*c-r*l,this._y=n*d+a*l+r*o-i*c,this._z=r*d+a*c+i*l-n*o,this._w=a*d-i*o-n*l-r*c,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);const i=this._x,n=this._y,r=this._z,a=this._w;let o=a*t._w+i*t._x+n*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;const l=1-o*o;if(l<=Number.EPSILON){const u=1-e;return this._w=u*a+e*this._w,this._x=u*i+e*this._x,this._y=u*n+e*this._y,this._z=u*r+e*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,o),p=Math.sin((1-e)*d)/c,m=Math.sin(e*d)/c;return this._w=a*p+this._w*m,this._x=i*p+this._x*m,this._y=n*p+this._y*m,this._z=r*p+this._z*m,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const lt=class za{constructor(t,e,i){this.x=0,this.y=0,this.z=0;const n=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0);if(n!==0){if(n===1&&t instanceof Array){this.x=t[0],this.y=t[1],this.z=t[2];return}if(n===1){const{x:r,y:a,z:o}=t;this.x=r,this.y=a,this.z=o||0;return}if(n===3){this.x=t,this.y=e,this.z=i;return}throw gt.ILLEGAL_PARAMETERS}}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new za(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z||0,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z||0,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Cr.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Cr.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,a=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,a=t.y,o=t.z,l=t.w,c=2*(a*n-o*i),d=2*(o*e-r*n),p=2*(r*i-a*e);return this.x=e+l*c+a*p-o*d,this.y=i+l*d+o*c-r*p,this.z=n+l*p+r*d-a*c,this}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z}isParallelTo(t){const e=this.dot(t),i=this.length(),n=t.length();return Math.abs(e)===i*n}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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,a=e.x,o=e.y,l=e.z;return this.x=n*l-r*o,this.y=r*a-i*l,this.z=i*o-n*a,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Yi.copy(this).projectOnVector(t),this.sub(Yi)}reflect(t){return this.sub(Yi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Math.max(-1,Math.min(1,i)))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};lt.ORIGIN=Object.freeze(new lt(0,0,0)),lt.X_AXIS=Object.freeze(new lt(1,0,0)),lt.NEGATIVE_X_AXIS=Object.freeze(new lt(-1,0,0)),lt.Y_AXIS=Object.freeze(new lt(0,1,0)),lt.NEGATIVE_Y_AXIS=Object.freeze(new lt(0,-1,0)),lt.Z_AXIS=Object.freeze(new lt(0,0,1)),lt.NEGATIVE_Z_AXIS=Object.freeze(new lt(0,0,-1));let f=lt;const Yi=new f,Cr=new Ge,un=class Va{constructor(t,e,i,n,r,a,o,l,c,d,p,m,u,g,y,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!=null&&e!=null&&i!=null&&n!=null&&r!=null&&a!=null&&o!=null&&l!=null&&c!=null&&d!=null&&p!=null&&m!=null&&u!=null&&g!=null&&y!=null&&x!=null&&this.set(t,e,i,n,r,a,o,l,c,d,p,m,u,g,y,x)}set(t,e,i,n,r,a,o,l,c,d,p,m,u,g,y,x){const w=this.elements;return w[0]=t,w[4]=e,w[8]=i,w[12]=n,w[1]=r,w[5]=a,w[9]=o,w[13]=l,w[2]=c,w[6]=d,w[10]=p,w[14]=m,w[3]=u,w[7]=g,w[11]=y,w[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 Va().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}setFromExtrusionDirection(t){if(On.equalPoint3d(t,f.Z_AXIS))this.identity();else{const e=new f(1,0,0);Math.abs(t.x)<1/64&&Math.abs(t.y)<1/64?e.crossVectors(f.Y_AXIS,t).normalize():e.crossVectors(f.Z_AXIS,t).normalize();const i=t.clone().cross(e).normalize();this.set(e.x,e.y,e.z,0,i.x,i.y,i.z,0,t.x,t.y,t.z,0,0,0,0,1)}return this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/He.setFromMatrixColumn(t,0).length(),r=1/He.setFromMatrixColumn(t,1).length(),a=1/He.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*a,e[9]=i[9]*a,e[10]=i[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ml,t,gl)}lookAt(t,e,i){const n=this.elements;return yt.subVectors(t,e),yt.lengthSq()===0&&(yt.z=1),yt.normalize(),oe.crossVectors(i,yt),oe.lengthSq()===0&&(Math.abs(i.z)===1?yt.x+=1e-4:yt.z+=1e-4,yt.normalize(),oe.crossVectors(i,yt)),oe.normalize(),Ks.crossVectors(yt,oe),n[0]=oe.x,n[4]=Ks.x,n[8]=yt.x,n[1]=oe.y,n[5]=Ks.y,n[9]=yt.y,n[2]=oe.z,n[6]=Ks.z,n[10]=yt.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],p=i[5],m=i[9],u=i[13],g=i[2],y=i[6],x=i[10],w=i[14],P=i[3],I=i[7],k=i[11],A=i[15],j=n[0],T=n[4],$=n[8],C=n[12],tt=n[1],B=n[5],H=n[9],ye=n[13],_e=n[2],Ws=n[6],Gs=n[10],Hs=n[14],Us=n[3],Xs=n[7],Ys=n[11],$s=n[15];return r[0]=a*j+o*tt+l*_e+c*Us,r[4]=a*T+o*B+l*Ws+c*Xs,r[8]=a*$+o*H+l*Gs+c*Ys,r[12]=a*C+o*ye+l*Hs+c*$s,r[1]=d*j+p*tt+m*_e+u*Us,r[5]=d*T+p*B+m*Ws+u*Xs,r[9]=d*$+p*H+m*Gs+u*Ys,r[13]=d*C+p*ye+m*Hs+u*$s,r[2]=g*j+y*tt+x*_e+w*Us,r[6]=g*T+y*B+x*Ws+w*Xs,r[10]=g*$+y*H+x*Gs+w*Ys,r[14]=g*C+y*ye+x*Hs+w*$s,r[3]=P*j+I*tt+k*_e+A*Us,r[7]=P*T+I*B+k*Ws+A*Xs,r[11]=P*$+I*H+k*Gs+A*Ys,r[15]=P*C+I*ye+k*Hs+A*$s,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],a=t[1],o=t[5],l=t[9],c=t[13],d=t[2],p=t[6],m=t[10],u=t[14],g=t[3],y=t[7],x=t[11],w=t[15];return g*(+r*l*p-n*c*p-r*o*m+i*c*m+n*o*u-i*l*u)+y*(+e*l*u-e*c*m+r*a*m-n*a*u+n*c*d-r*l*d)+x*(+e*c*p-e*o*u-r*a*p+i*a*u+r*o*d-i*c*d)+w*(-n*o*d-e*l*p+e*o*m+n*a*p-i*a*m+i*l*d)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t instanceof f?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],a=t[4],o=t[5],l=t[6],c=t[7],d=t[8],p=t[9],m=t[10],u=t[11],g=t[12],y=t[13],x=t[14],w=t[15],P=p*x*c-y*m*c+y*l*u-o*x*u-p*l*w+o*m*w,I=g*m*c-d*x*c-g*l*u+a*x*u+d*l*w-a*m*w,k=d*y*c-g*p*c+g*o*u-a*y*u-d*o*w+a*p*w,A=g*p*l-d*y*l-g*o*m+a*y*m+d*o*x-a*p*x,j=e*P+i*I+n*k+r*A;if(j===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/j;return t[0]=P*T,t[1]=(y*m*r-p*x*r-y*n*u+i*x*u+p*n*w-i*m*w)*T,t[2]=(o*x*r-y*l*r+y*n*c-i*x*c-o*n*w+i*l*w)*T,t[3]=(p*l*r-o*m*r-p*n*c+i*m*c+o*n*u-i*l*u)*T,t[4]=I*T,t[5]=(d*x*r-g*m*r+g*n*u-e*x*u-d*n*w+e*m*w)*T,t[6]=(g*l*r-a*x*r-g*n*c+e*x*c+a*n*w-e*l*w)*T,t[7]=(a*m*r-d*l*r+d*n*c-e*m*c-a*n*u+e*l*u)*T,t[8]=k*T,t[9]=(g*p*r-d*y*r-g*i*u+e*y*u+d*i*w-e*p*w)*T,t[10]=(a*y*r-g*o*r+g*i*c-e*y*c-a*i*w+e*o*w)*T,t[11]=(d*o*r-a*p*r-d*i*c+e*p*c+a*i*u-e*o*u)*T,t[12]=A*T,t[13]=(d*y*n-g*p*n+g*i*m-e*y*m-d*i*x+e*p*x)*T,t[14]=(g*o*n-a*y*n-g*i*l+e*y*l+a*i*x-e*o*x)*T,t[15]=(a*p*n-d*o*n+d*i*l-e*p*l-a*i*m+e*o*m)*T,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t instanceof f?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,a=t.x,o=t.y,l=t.z,c=r*a,d=r*o;return this.set(c*a+i,c*o-n*l,c*l+n*o,0,c*o+n*l,d*o+i,d*l-n*a,0,c*l-n*o,d*l+n*a,r*l*l+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,a){return this.set(1,i,r,0,t,1,a,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e.x,a=e.y,o=e.z,l=e.w,c=r+r,d=a+a,p=o+o,m=r*c,u=r*d,g=r*p,y=a*d,x=a*p,w=o*p,P=l*c,I=l*d,k=l*p,A=i.x,j=i.y,T=i.z;return n[0]=(1-(y+w))*A,n[1]=(u+k)*A,n[2]=(g-I)*A,n[3]=0,n[4]=(u-k)*j,n[5]=(1-(m+w))*j,n[6]=(x+P)*j,n[7]=0,n[8]=(g+I)*T,n[9]=(x-P)*T,n[10]=(1-(m+y))*T,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let r=He.set(n[0],n[1],n[2]).length();const a=He.set(n[4],n[5],n[6]).length(),o=He.set(n[8],n[9],n[10]).length();this.determinant()<0&&(r=-r),t.x=n[12],t.y=n[13],t.z=n[14],Tt.copy(this);const l=1/r,c=1/a,d=1/o;return Tt.elements[0]*=l,Tt.elements[1]*=l,Tt.elements[2]*=l,Tt.elements[4]*=c,Tt.elements[5]*=c,Tt.elements[6]*=c,Tt.elements[8]*=d,Tt.elements[9]*=d,Tt.elements[10]*=d,e.setFromRotationMatrix(Tt),i.x=r,i.y=a,i.z=o,this}equals(t){const e=this.elements,i=t.elements;for(let n=0;n<16;n++)if(e[n]!==i[n])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};un.IDENTITY=Object.freeze(new un);let Pt=un;const He=new f,Tt=new Pt,ml=new f(0,0,0),gl=new f(1,1,1),oe=new f,Ks=new f,yt=new f;let F=class Da{constructor(t=void 0,e=void 0){this.min=t==null?new f(1/0,1/0,1/0):new f(t.x,t.y,t.z),this.max=e==null?new f(-1/0,-1/0,-1/0):new f(e.x,e.y,e.z)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint($i.fromArray(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=$i.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new Da().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new f(0,0,0):new f(0,0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new f(0,0,0):new f(0,0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,$i).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(zt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const zt=[new f,new f,new f,new f,new f,new f,new f,new f],$i=new f,Fr=new U;let dt=class ja{constructor(t=void 0,e=void 0){this.min=t==null?new U(1/0,1/0):new U(t.x,t.y),this.max=e==null?new U(-1/0,-1/0):new U(e.x,e.y)}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Fr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return new ja().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}get center(){return this.isEmpty()?new U(0,0):new U(0,0).addVectors(this.min,this.max).multiplyScalar(.5)}get size(){return this.isEmpty()?new U(0,0):new U(0,0).subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Fr).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}};const Br=new f,yl=new f,_l=new Vi;class Rs{constructor(t=new f(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Br.subVectors(i,e).cross(yl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectsBox(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||_l.getNormalMatrix(t),n=this.coplanarPoint(Br).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new Rs().copy(this)}}let O=class extends U{static pointArrayToNumberArray(t){const e=new Array(t.length*2);return t.forEach((i,n)=>{i.toArray(e,n*2)}),e}},b=class extends f{static pointArrayToNumberArray(t,e=!0){const i=e?3:2,n=new Array(t.length*i);return t.forEach((r,a)=>{r.toArray(n,a*i)}),n}};const Rr=new Pt,zr=new Ge,Wa=class pn{constructor(t=0,e=0,i=0,n=pn.DEFAULT_ORDER){this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new pn(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],a=n[4],o=n[8],l=n[1],c=n[5],d=n[9],p=n[2],m=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(ee(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,u),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ee(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,r),this._z=0);break;case"ZXY":this._x=Math.asin(ee(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-p,u),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-ee(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(m,u),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(ee(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-p,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-ee(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-d,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i=!0){return Rr.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Rr,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return zr.setFromEuler(this),this.setFromQuaternion(zr,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Wa.DEFAULT_ORDER="XYZ";let wl=Wa;class Ga{constructor(){this._boundingBoxNeedsUpdate=!1}get boundingBoxNeedUpdate(){return this._boundingBoxNeedsUpdate}}class Fn extends Ga{translate(t){return this.transform(new Vi().makeTranslation(t.x,t.y))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class vs extends Fn{constructor(){super(),this._loops=[]}add(t){this._loops.push(t),this._boundingBoxNeedsUpdate=!0}get loops(){return this._loops}get outter(){if(this._loops.length>0)return this._loops[0]}calculateBoundingBox(){const t=this.outter;return t?t.box:new dt}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints(t){const e=[];for(let i=0;i<this.loops.length;++i){const n=this.loops[i].getPoints(t);e.push(n)}return e}buildHierarchy(){var t;const e=this.getPoints(100),i=this.calculateBoundaryBoxes(e),n=this.sortBoundaryBoxesByAreas(i),r=new Map,a=n.length;for(let l=0;l<a;l++)r.set(n[l],{index:n[l],children:[]});const o={index:-1,children:[]};for(let l=0;l<a;l++){const c=n[l],d=e[c],p=i[c];let m=l+1;for(;m<a;m++){const u=n[m],g=e[u];if(i[u].containsBox(p)&&Ca.isPointInPolygon(d[N.randInt(0,d.length-1)],g)){(t=r.get(u))==null||t.children.push(r.get(c));break}}m===a&&o.children.push(r.get(c))}return o}get area(){if(this._loops.length===0)return 0;let t=0;for(let e=0;e<this._loops.length;e++){const i=this._loops[e].getPoints(128),n=this.polygonArea(i);e===0?t+=Math.abs(n):t-=Math.abs(n)}return t}polygonArea(t){const e=t.length;if(e<3)return 0;let i=0;for(let n=0,r=e-1;n<e;r=n++){const a=t[r],o=t[n];i+=a.x*o.y-o.x*a.y}return i*.5}calculateBoundaryBoxes(t){const e=[];return t.forEach(i=>{e.push(new dt().setFromPoints(i))}),e}sortBoundaryBoxesByAreas(t){const e=[];t.forEach((n,r)=>{const a=n.size,o=a.width*a.height;e.push({area:o,index:r})}),e.sort((n,r)=>n.area-r.area);const i=[];return e.forEach(n=>{i.push(n.index)}),i}}class ts extends Fn{constructor(){super(),this.arcLengthDivisions=100}get startPoint(){return this.getPoint(0)}get endPoint(){return this.getPoint(1)}get length(){return this.getLength()}getPoint(t){throw new Error("AcGeCurve2d: .getPoint() not implemented.")}getPointAt(t){const e=this.getUtoTmapping(t);return this.getPoint(e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let a=1;a<=t;a++)i=this.getPoint(a/t),r+=i.distanceTo(n),e.push(r),n=i;return e}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const r=i.length;let a;e?a=e:a=t*i[r-1];let o=0,l=r-1,c;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),c=i[n]-a,c<0)o=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,i[n]===a)return n/(r-1);const d=i[n],p=i[n+1]-d,m=(a-d)/p;return(n+m)/(r-1)}getTangent(t){let e=t-1e-4,i=t+1e-4;e<0&&(e=0),i>1&&(i=1);const n=this.getPoint(e),r=this.getPoint(i),a=new O;return a.copy(r).sub(n).normalize(),a}getTangentAt(t){const e=this.getUtoTmapping(t);return this.getTangent(e)}}let Ve=class Ha extends ts{constructor(t,e,i,n,r){super();const a=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a==3)typeof t=="object"&&typeof e=="object"&&typeof i=="object"?this.createByThreePoints(t,e,i):this.createByStartEndPointsAndBulge(t,e,i);else if(a==5){const o=t;this.center=new O(o.x,o.y),this.radius=e,this._clockwise=r,this._startAngle=this._clockwise?this._mirrorAngle(N.normalizeAngle(i)):N.normalizeAngle(i),this._endAngle=this._clockwise?this._mirrorAngle(N.normalizeAngle(n)):N.normalizeAngle(n)}else throw gt.ILLEGAL_PARAMETERS}createByThreePoints(t,e,i){const n=(T,$)=>({x:(T.x+$.x)/2,y:(T.y+$.y)/2}),r=(T,$)=>($.y-T.y)/($.x-T.x),a=T=>-1/T,o=n(t,e),l=n(e,i),c=r(t,e),d=r(e,i),p=a(c),m=a(d),u=(T,$,C,tt)=>{const B=(tt-$)/(T-C),H=T*B+$;return{x:B,y:H}},g=o.y-p*o.x,y=l.y-m*l.x,x=u(p,g,m,y),w=Math.sqrt(Math.pow(t.x-x.x,2)+Math.pow(t.y-x.y,2)),P=(T,$)=>Math.atan2(T.y-$.y,T.x-$.x),I=P(t,x),k=P(e,x),A=P(i,x),j=A>I&&A<k||I>A&&I<k||k>A&&k<I;this.center=x,this.radius=w,this._clockwise=!j,this._startAngle=I,this._endAngle=A}createByStartEndPointsAndBulge(t,e,i){let n,r,a;i<0?(n=Math.atan(-i)*4,r=new U(t),a=new U(e)):(n=Math.atan(i)*4,r=new U(e),a=new U(t));const o=new U().subVectors(a,r),l=o.length(),c=new U().addVectors(r,o.multiplyScalar(.5)),d=Math.abs(l/2/Math.tan(n/2)),p=o.normalize();let m;if(n<Math.PI){const u=new U(p.x*Math.cos(Math.PI/2)-p.y*Math.sin(Math.PI/2),p.y*Math.cos(Math.PI/2)+p.x*Math.sin(Math.PI/2));m=c.add(u.multiplyScalar(-d))}else{const u=new U(p.x*Math.cos(Math.PI/2)-p.y*Math.sin(Math.PI/2),p.y*Math.cos(Math.PI/2)+p.x*Math.sin(Math.PI/2));m=c.add(u.multiplyScalar(d))}i<0?(this._startAngle=Math.atan2(r.y-m.y,r.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(r.y-m.y,r.x-m.x)),this._clockwise=i<0,this.center=m,this.radius=a.sub(m).length()}get center(){return this._center}set center(t){this._center=new O(t.x,t.y),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._clockwise?this._mirrorAngle(this._startAngle):this._startAngle}set startAngle(t){this._startAngle=this._clockwise?this._mirrorAngle(N.normalizeAngle(t)):N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._clockwise?this._mirrorAngle(this._endAngle):this._endAngle}set endAngle(t){const e=this.startAngle==0&&t==G?t:N.normalizeAngle(t);this._endAngle=this._clockwise?this._mirrorAngle(e):e,this._boundingBoxNeedsUpdate=!0}_mirrorAngle(t){return(360-t*180/Math.PI)%360*Math.PI/180}_getInternalAngle(t){return this._clockwise?this._mirrorAngle(t):t}get deltaAngle(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return this.clockwise?N.normalizeAngle(t-e):N.normalizeAngle(e-t)}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this.startAngle)}get endPoint(){return this.getPointAtAngle(this.endAngle)}get midPoint(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle),i=N.normalizeAngle((t+e)/2),n=this._clockwise?this._mirrorAngle(i):i;return this.getPointAtAngle(n)}get closed(){const t=this._getInternalAngle(this.startAngle),e=this._getInternalAngle(this.endAngle);return Math.abs(e-t)/Math.PI%2==0}calculateBoundingBox(){const t=[this.startPoint,this.endPoint],e=[0,Math.PI/2,Math.PI,3*Math.PI/2];for(const r of e){const a=this._getInternalAngle(r);N.isBetweenAngle(a,this._getInternalAngle(this.startAngle),this._getInternalAngle(this.endAngle),this.clockwise)&&t.push(this.getPointAtAngle(r))}const i=t.map(r=>r.x),n=t.map(r=>r.y);return new dt(new O(Math.min(...i),Math.min(...n)),new O(Math.max(...i),Math.max(...n)))}get length(){return Math.abs(this.deltaAngle*this.radius)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}clone(){return new Ha(this.center.clone(),this.radius,this._startAngle,this._endAngle,this.clockwise)}getPointAtAngle(t){const e=this._getInternalAngle(t),i=this.center.x+this.radius*Math.cos(e),n=this.center.y+this.radius*Math.sin(e);return new O(i,n)}getPoints(t=100){const e=[];let i=this.deltaAngle,n=this._getInternalAngle(this.startAngle);if(this.closed&&(i=G,n=0),this.clockwise)for(let r=0;r<=t;r++){const a=n-i*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new O(l.x,l.y))}else for(let r=0;r<=t;r++){const a=n+i*(r/t),o=this._clockwise?this._mirrorAngle(a):a,l=this.getPointAtAngle(o);e.push(new O(l.x,l.y))}return e}};class xl extends Ga{translate(t){return this.transform(new Pt().makeTranslation(t.x,t.y,t.z))}get box(){return(this._box==null||this._boundingBoxNeedsUpdate)&&(this._box=this.calculateBoundingBox(),this._boundingBoxNeedsUpdate=!1),this._box}}class zs extends xl{}class ue extends zs{constructor(t,e){super(),this._start=new b(t),this._end=new b(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}get direction(){return new f().subVectors(this.endPoint,this.startPoint).normalize()}get midPoint(){return new b((this._start.x+this._end.x)/2,(this._start.y+this._end.y)/2,(this._start.z+this._end.z)/2)}nearestPoint(t){return this.project(t)}get length(){return this.startPoint.distanceTo(this.endPoint)}isPointOnLine(t){return this.project(t).distanceTo(t)<1e-6}at(t,e){return this.delta(e).multiplyScalar(t).add(this._start)}atLength(t,e=!1){if(e){const i=this.delta(we).normalize();return new b(this._start).addScaledVector(i,t)}else{const i=this.delta(we).normalize();return new b(this._end).addScaledVector(i,t)}}extend(t,e=!1){if(e){const i=we.subVectors(this._start,this._end).normalize();this._start=new b(this._start).addScaledVector(i,t)}else{const i=this.delta(we).normalize();this._end=new b(this._end).addScaledVector(i,t)}return this._boundingBoxNeedsUpdate=!0,this}closestPointToPointParameter(t,e){Vr.subVectors(t,this._start),Zs.subVectors(this.endPoint,this.startPoint);const i=Zs.dot(Zs);let n=Zs.dot(Vr)/i;return e&&(n=N.clamp(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this._start)}delta(t){return t.subVectors(this._end,this._start)}distanceSq(){return this._start.distanceToSquared(this._end)}distance(){return this._start.distanceTo(this._end)}project(t){const e=this.direction,i=we.subVectors(t,this.startPoint).dot(e);return new b().copy(e).multiplyScalar(i).add(this.startPoint)}perpPoint(t){const e=this.direction,i=this.startPoint,n=we.subVectors(t,i).dot(e),r=we.copy(e).multiplyScalar(n);return new b().addVectors(i,r)}calculateBoundingBox(){const t=new b(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y),Math.min(this._start.z,this._end.z)),e=new b(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 F(t,e)}transform(t){return this._start.applyMatrix4(t),this._end.applyMatrix4(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new ue(this._start.clone(),this._end.clone())}}const we=new f,Vr=new f,Zs=new f;class Re extends zs{static computeCenterPoint(t,e,i){const n=new f().addVectors(t,e).multiplyScalar(.5),r=new f().addVectors(t,i).multiplyScalar(.5),a=new f().subVectors(e,t),o=new f().subVectors(i,t),l=new f().crossVectors(a,o).normalize();if(l.lengthSq()===0)return console.error("Points are collinear and cannot form a valid arc."),null;const c=new f().crossVectors(a,l).normalize(),d=new f().crossVectors(o,l).normalize(),p=c.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),m=d.clone().multiplyScalar(Number.MAX_SAFE_INTEGER),u=new ue(n,n.clone().add(p)),g=new ue(r,r.clone().add(m)),y=new f;return u.closestPointToPoint(g.startPoint,!0,y)?y:(console.error("Cannot find a valid center for the arc."),null)}static createByThreePoints(t,e,i){const n=Re.computeCenterPoint(t,e,i);if(n){const r=n.distanceTo(t),a=new f().subVectors(t,n),o=new f().subVectors(e,n),l=Math.atan2(a.y,a.x),c=Math.atan2(o.y,o.x);return new Re(n,r,l,c,f.Z_AXIS)}}constructor(t,e,i,n,r,a=f.X_AXIS){super(),this.center=t,this.radius=e,this.startAngle=i,this.endAngle=n,this.normal=r,this.refVec=a,(n-i)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=i,this.endAngle=n)}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get radius(){return this._radius}set radius(t){if(t<0)throw gt.ILLEGAL_PARAMETERS;this._radius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==G?t:N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return N.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(t){this._normal=new f(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get refVec(){return this._refVec}set refVec(t){this._refVec=new f(t.x,t.y,t.z),this._refVec.normalize(),this._boundingBoxNeedsUpdate=!0}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;this.closed&&(t=0,e=G);const i=t+e*.5;return this.getPointAtAngle(i)}get length(){return this.closed?2*Math.PI*this.radius:Math.abs(this.deltaAngle*this.radius)}get area(){return this.closed?Math.PI*this.radius*this.radius:Math.abs(this.deltaAngle*this.radius*this.radius)}nearestPoint(t){const e=new f(t.x,t.y,t.z||0),i=this.center,n=this.normal,r=e.clone().sub(i).dot(n),a=e.clone().sub(n.clone().multiplyScalar(r)).clone().sub(i);if(a.lengthSq()===0)return this.startPoint.clone();a.normalize().multiplyScalar(this.radius);const o=i.clone().add(a),l=this.getAngle(o.clone()),c=this.startAngle,d=this.deltaAngle;let p=N.normalizeAngle(l-c);p<0&&(p=0),p>d&&(p=d);const m=this.getPointAtAngle(c+p),u=m.distanceTo(e),g=this.startPoint.distanceTo(e),y=this.endPoint.distanceTo(e);return g<u&&g<=y?this.startPoint.clone():y<u&&y<g?this.endPoint.clone():m}tangentPoints(t){const e=[],i=new f(t.x,t.y,t.z||0),n=this.center,r=this.normal,a=this.radius,o=i.clone().sub(n).dot(r),l=i.clone().sub(r.clone().multiplyScalar(o)),c=n.clone(),d=l.clone().sub(c).length();if(d<a)return e;const p=Math.acos(a/d),m=this.getAngle(l.clone()),u=[m+p,m-p];for(const g of u){const y=N.normalizeAngle(g-this.startAngle);y>=0&&y<=this.deltaAngle&&e.push(this.getPointAtAngle(this.startAngle+y))}return e}nearestTangentPoint(t){const e=this.tangentPoints(t);if(e.length===0)return null;const i=new b(t.x,t.y,t.z||0);return e.length===1||e[0].distanceTo(i)<e[1].distanceTo(i)?e[0]:e[1]}calculateBoundingBox(){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)N.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<i&&(i=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new F({x:e,y:i,z:n},{x:r,y:a,z:o})}get closed(){return Math.abs(this.endAngle-this.startAngle)/Math.PI%2==0}getPoints(t){const e=[];let i=this.deltaAngle,n=this.startAngle;this.closed&&(i=G,n=0);for(let r=0;r<=t;r++){const a=n+i*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}transform(t){const e=qi.copy(this.refVec).applyAxisAngle(this.normal,this.startAngle).multiplyScalar(this.radius),i=qi.copy(this.refVec).applyAxisAngle(this.normal,this.endAngle).multiplyScalar(this.radius);return this.center.applyMatrix4(t),e.applyMatrix4(t),i.applyMatrix4(t),this.normal.applyMatrix4(t).normalize(),this.refVec.applyMatrix4(t).normalize(),this.startAngle=this.getAngle(e),this.endAngle=this.getAngle(i),this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.radius=t.radius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.normal=t.normal,this.refVec=t.refVec,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Re(this.center.clone(),this.radius,this.startAngle,this.endAngle,this.normal,this.refVec)}getAngle(t){return t.sub(this.center),Math.atan2(t.dot(qi.crossVectors(this.refVec,this.normal)),t.dot(this.refVec))}getPointAtAngle(t){const e=this.normal,i=this.refVec,n={x:e.y*i.z-e.z*i.y,y:e.z*i.x-e.x*i.z,z:e.x*i.y-e.y*i.x},r=this.center,a=this.radius;return new b(r.x+a*(i.x*Math.cos(t)+n.x*Math.sin(t)),r.y+a*(i.y*Math.cos(t)+n.y*Math.sin(t)),r.z+a*(i.z*Math.cos(t)+n.z*Math.sin(t)))}get plane(){const t=new f(this.center).distanceTo(kn);return new Rs(this.normal,t)}}const qi=new f;class De extends ts{constructor(t,e,i,n=0,r=G,a=!1,o=0){super(),this.center=t,this.majorAxisRadius=e,this.minorAxisRadius=i,(r-n)%G==0?(this.startAngle=0,this.endAngle=G):(this.startAngle=n,this.endAngle=r),this.clockwise=a,this.rotation=o}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==G?t:N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get clockwise(){return this._clockwise}set clockwise(t){this._clockwise=t,this._boundingBoxNeedsUpdate=!0}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._boundingBoxNeedsUpdate=!0}get deltaAngle(){return N.normalizeAngle(this.endAngle-this.startAngle)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}calculateBoundingBox(){let t=1/0,e=1/0,i=-1/0,n=-1/0;for(let r=0;r<=100;r++){const a=this.getPoint(r/100);t=Math.min(t,a.x),e=Math.min(e,a.y),i=Math.max(i,a.x),n=Math.max(n,a.y)}return new dt({x:t,y:e},{x:i,y:n})}get closed(){return this.deltaAngle==0}getPoint(t){const e=Math.PI*2;let i=this.endAngle-this.startAngle;const n=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=e;for(;i>e;)i-=e;i<Number.EPSILON&&(n?i=0:i=e),this.clockwise===!0&&!n&&(i===e?i=-e:i=i-e);const r=this.startAngle+t*i;let a=this.center.x+this.majorAxisRadius*Math.cos(r),o=this.center.y+this.minorAxisRadius*Math.sin(r);if(this.rotation!==0){const l=Math.cos(this.rotation),c=Math.sin(this.rotation),d=a-this.center.x,p=o-this.center.y;a=d*l-p*c+this.center.x,o=d*c+p*l+this.center.y}return new O(a,o)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this.clockwise=t.clockwise,this.rotation=t.rotation,this}clone(){return new De(this.center,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle,this.clockwise,this.rotation)}}class Di extends zs{constructor(t,e,i,n,r,a=0,o=G){super(),this.center=t,this.normal=e,this.majorAxis=i,this.majorAxisRadius=n,this.minorAxisRadius=r;const l=Math.abs(o-a);Math.abs(l-G)<1e-10||Math.abs(l-2*G)<1e-10?(this.startAngle=0,this.endAngle=G):(this.startAngle=a,this.endAngle=o)}get center(){return this._center}set center(t){this._center=new b(t.x,t.y,t.z||0),this._boundingBoxNeedsUpdate=!0}get majorAxisRadius(){return this._majorAxisRadius}set majorAxisRadius(t){if(t<0)throw gt.ILLEGAL_PARAMETERS;this._majorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get minorAxisRadius(){return this._minorAxisRadius}set minorAxisRadius(t){if(t<0)throw gt.ILLEGAL_PARAMETERS;this._minorAxisRadius=t,this._boundingBoxNeedsUpdate=!0}get startAngle(){return this._startAngle}set startAngle(t){this._startAngle=N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get endAngle(){return this._endAngle}set endAngle(t){this._endAngle=this.startAngle==0&&t==G?t:N.normalizeAngle(t),this._boundingBoxNeedsUpdate=!0}get deltaAngle(){const t=this.endAngle-this.startAngle;return Math.abs(t-G)<1e-10?G:N.normalizeAngle(t)}get isLargeArc(){return Math.abs(this.deltaAngle)>Math.PI?1:0}get clockwise(){return this.deltaAngle<=0}get normal(){return this._normal}set normal(t){this._normal=new f(t.x,t.y,t.z),this._normal.normalize(),this._boundingBoxNeedsUpdate=!0}get majorAxis(){return this._majorAxis}set majorAxis(t){this._majorAxis=new f(t.x,t.y,t.z),this._majorAxis.normalize(),this._boundingBoxNeedsUpdate=!0}get minorAxis(){return new f().crossVectors(this.normal,this.majorAxis).normalize()}get startPoint(){return this.getPointAtAngle(this._startAngle)}get endPoint(){return this.getPointAtAngle(this._endAngle)}get midPoint(){let t=this.startAngle,e=this.deltaAngle;(this.closed||Math.abs(e-G)<1e-10)&&(t=0,e=G);const i=t+e/2;return this.getPointAtAngle(i)}get isCircular(){return Ln.equal(this.majorAxisRadius,this.minorAxisRadius)}get length(){if(this.isCircular)return this.majorAxisRadius*Math.abs(this.deltaAngle);const t=1e3,e=this.deltaAngle/t;let i=0,n=this.getPointAtAngle(this.startAngle);for(let r=1;r<=t;r++){const a=this.startAngle+r*e,o=this.getPointAtAngle(a),l=o.x-n.x,c=o.y-n.y,d=o.z-n.z;i+=Math.sqrt(l*l+c*c+d*d),n=o}return i}get area(){const t=this.majorAxisRadius,e=this.minorAxisRadius,i=this.startAngle,n=i+this.deltaAngle;if(Math.abs(this.deltaAngle-G)<1e-10)return Math.PI*t*e;const r=t*e/2*(n-i-(Math.sin(n)*Math.cos(n)-Math.sin(i)*Math.cos(i)));return Math.abs(r)}calculateBoundingBox(){if(this.majorAxis.equals(f.X_AXIS)||this.majorAxis.equals(f.Y_AXIS)||this.majorAxis.isParallelTo(f.X_AXIS)||this.majorAxis.isParallelTo(f.Y_AXIS)){const t=[this.startAngle,this.endAngle];for(let l=0;l<2*Math.PI;l+=Math.PI/2)N.isBetweenAngle(l,this.startAngle,this.endAngle)&&t.push(l);let e=1/0,i=1/0,n=1/0,r=-1/0,a=-1/0,o=-1/0;for(const l of t){const c=this.getPointAtAngle(l);c.x<e&&(e=c.x),c.y<i&&(i=c.y),c.z<n&&(n=c.z),c.x>r&&(r=c.x),c.y>a&&(a=c.y),c.z>o&&(o=c.z)}return new F({x:e,y:i,z:n},{x:r,y:a,z:o})}else{let t=1/0,e=1/0,i=1/0,n=-1/0,r=-1/0,a=-1/0;for(let o=0;o<=100;o++){const l=this.startAngle+this.deltaAngle*(o/100),c=this.getPointAtAngle(l);t=Math.min(t,c.x),e=Math.min(e,c.y),i=Math.min(i,c.z),n=Math.max(n,c.x),r=Math.max(r,c.y),a=Math.max(a,c.z)}return new F({x:t,y:e,z:i},{x:n,y:r,z:a})}}get closed(){return this.deltaAngle==0}getPoints(t=100){const e=[];let i=this.deltaAngle,n=this.startAngle;this.closed&&(i=G,n=0);for(let r=0;r<=t;r++){const a=n+i*(r/t),o=this.getPointAtAngle(a);e.push(o)}return e}getPointAtAngle(t){const e=Math.cos(t),i=Math.sin(t),n=this.minorAxis.clone().multiplyScalar(this.minorAxisRadius).multiplyScalar(i),r=this.majorAxis.clone().multiplyScalar(e*this.majorAxisRadius).add(n);return new b(this.center.x+r.x,this.center.y+r.y,this.center.z+r.z)}contains(t){const e=new f(t).sub(this.center),i=e.dot(this.majorAxis),n=e.dot(this.minorAxis),r=i/this.majorAxisRadius,a=n/this.minorAxisRadius;return r*r+a*a<=1}transform(t){return this._boundingBoxNeedsUpdate=!0,this}copy(t){return this.center=t.center,this.normal=t.normal,this.majorAxis=t.majorAxis,this.majorAxisRadius=t.majorAxisRadius,this.minorAxisRadius=t.minorAxisRadius,this.startAngle=t.startAngle,this.endAngle=t.endAngle,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Di(this.center,this.normal,this.majorAxis,this.majorAxisRadius,this.minorAxisRadius,this.startAngle,this.endAngle)}get plane(){const t=new f(this.center).distanceTo(kn);return new Rs(this.normal,t)}}class me extends ts{constructor(t=null,e=!1){super(),this._vertices=t||new Array,this._closed=e}get vertices(){return this._vertices}get numberOfVertices(){return this._vertices.length}get closed(){return this._closed}get startPoint(){if(this.numberOfVertices>0){const t=this._vertices[0];return new O(t.x,t.y)}throw new Error("Start point does not exist in an empty polyline.")}get endPoint(){const t=this.numberOfVertices;if(t>0)if(this.closed){const e=this._vertices[0];return new O(e.x,e.y)}else{const e=this._vertices[t-1];return new O(e.x,e.y)}throw new Error("End point does not exist in an empty polyline.")}get length(){let t=0;const e=this._vertices.length;for(let i=0;i<e;++i){const n=this._vertices[i];let r=null;if(i<e-1?r=this._vertices[i+1]:i==e-1&&this.closed&&(r=this._vertices[0]),r)if(n.bulge){const a=new Ve(n,r,n.bulge);t+=a.length}else t+=new O(n.x,n.y).distanceTo(r)}return t}set closed(t){this._closed=t,this._boundingBoxNeedsUpdate=!0}addVertexAt(t,e){t<=0?this._vertices.unshift(e):this._vertices.splice(t,0,e),this._boundingBoxNeedsUpdate=!0}removeVertexAt(t){if(t<0||t>=this._vertices.length)throw new Error(`Index ${t} is out of bounds. Valid range is 0 to ${this._vertices.length-1}.`);this._vertices.splice(t,1),this._boundingBoxNeedsUpdate=!0}reset(t,e){t?e!==void 0&&e>=0&&e<this._vertices.length&&(this._vertices=this._vertices.slice(0,e),this._boundingBoxNeedsUpdate=!0):(this._vertices=new Array,this._boundingBoxNeedsUpdate=!0)}getPointAt(t){const e=this._vertices[t];return new O(e.x,e.y)}calculateBoundingBox(){const t=this.getPoints(100);return new dt().setFromPoints(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}getPoints3d(t,e){const i=[];return this.getPoints(t).forEach(n=>i.push(new b().set(n.x,n.y,e))),i}getPoints(t){const e=[],i=this._vertices.length;for(let n=0;n<i;++n){const r=this._vertices[n];if(r.bulge){let a=null;if(n<i-1?a=this._vertices[n+1]:n==i-1&&this.closed&&(a=this._vertices[0]),a){const o=new Ve(r,a,r.bulge).getPoints(t),l=o.length;for(let c=0;c<l;++c){const d=o[c];e.push(new O(d.x,d.y))}}}else e.push(new O(r.x,r.y)),n==i-1&&this.closed&&e.push(e[0])}return e}}class Rt extends ts{constructor(t,e){super(),this._start=new O(t),this._end=new O(e)}get startPoint(){return this._start}set startPoint(t){this._start.copy(t),this._boundingBoxNeedsUpdate=!0}get endPoint(){return this._end}set endPoint(t){this._end.copy(t),this._boundingBoxNeedsUpdate=!0}getPoints(){return[this.startPoint,this.endPoint]}get length(){return this.startPoint.distanceTo(this.endPoint)}calculateBoundingBox(){const t=new O(Math.min(this._start.x,this._end.x),Math.min(this._start.y,this._end.y)),e=new O(Math.max(this._start.x,this._end.x),Math.max(this._start.y,this._end.y));return new dt(t,e)}transform(t){return this._start.applyMatrix2d(t),this._end.applyMatrix2d(t),this._boundingBoxNeedsUpdate=!0,this}get closed(){return!1}copy(t){return this.startPoint=t.startPoint,this.endPoint=t.endPoint,this._boundingBoxNeedsUpdate=!0,this}clone(){return new Rt(this._start.clone(),this._end.clone())}}let ks=class Nt extends ts{constructor(t=[]){super(),this._curves=t}get curves(){return this._curves}static buildFromEdges(t,e=.001){if(t.length===0)return[];const i=[...t],n=[],r=e*e,a=(o,l)=>{const c=o.x-l.x,d=o.y-l.y;return c*c+d*d<=r};for(;i.length>0;){const o=[],l=i.shift();o.push(l);const c=Nt.getEdgeStartPoint(l);let d=Nt.getEdgeEndPoint(l);if(!a(c,d))for(;i.length>0;){const p=Nt.findConnectingEdge(i,d,r);if(p.index<0)break;let m=i.splice(p.index,1)[0];if(p.reverse&&(m=Nt.reverseEdge(m)),o.push(m),d=Nt.getEdgeEndPoint(m),a(d,c))break}n.push(new Nt(o))}return n}add(t){this._curves.push(t),this._boundingBoxNeedsUpdate=!0}get numberOfEdges(){return this._curves.length}get startPoint(){if(this._curves.length>0){const t=this._curves[0].startPoint;return new O(t.x,t.y)}throw new Error("Start point does not exist in an empty loop.")}get endPoint(){return this.startPoint}get length(){let t=0;return this._curves.forEach(e=>{t+=e.length}),t}calculateBoundingBox(){const t=this.getPoints(100),e=new dt;return e.setFromPoints(t),e}transform(t){return this._boundingBoxNeedsUpdate=!0,this}get closed(){return!0}getPoints(t){const e=[];return this.curves.forEach(i=>{i.getPoints(t).forEach(n=>{e.push(new O(n.x,n.y))})}),e}static findConnectingEdge(t,e,i){let n=-1,r=!1,a=Number.POSITIVE_INFINITY;for(let o=0;o<t.length;o++){const l=t[o],c=Nt.getEdgeStartPoint(l),d=Nt.getEdgeEndPoint(l),p=e.x-c.x,m=e.y-c.y,u=p*p+m*m;u<a&&(a=u,n=o,r=!1);const g=e.x-d.x,y=e.y-d.y,x=g*g+y*y;x<a&&(a=x,n=o,r=!0)}return a>i?{index:-1,reverse:!1}:{index:n,reverse:r}}static getEdgeStartPoint(t){const e=t.startPoint;return new O(e.x,e.y)}static getEdgeEndPoint(t){const e=t.endPoint;return new O(e.x,e.y)}static reverseEdge(t){return t instanceof Rt?new Rt(t.endPoint,t.startPoint):t instanceof Ve?new Ve(t.center,t.radius,t.endAngle,t.startAngle,!t.clockwise):t instanceof De?new De(t.center,t.majorAxisRadius,t.minorAxisRadius,t.endAngle,t.startAngle,!t.clockwise,t.rotation):t instanceof Lt?Nt.reverseSplineEdge(t):t}static reverseSplineEdge(t){const e=[...t.controlPoints].reverse(),i=t.knots,n=i[0],r=i[i.length-1],a=i.map(c=>n+r-c).reverse(),o=t.weights,l=o.length>0?[...o].reverse():void 0;return new Lt(e,a,l,t.degree,t.closed)}};class Ki{constructor(){this.c0=0,this.c1=0,this.c2=0,this.c3=0}init(t,e,i,n){this.c0=t,this.c1=i,this.c2=-3*t+3*e-2*i-n,this.c3=2*t-2*e+i+n}initCatmullRom(t,e,i,n,r){this.init(e,i,r*(i-t),r*(n-e))}initNonuniformCatmullRom(t,e,i,n,r,a,o){let l=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;l*=a,c*=a,this.init(e,i,l,c)}calc(t){const e=t*t,i=e*t;return this.c0+this.c1*t+this.c2*e+this.c3*i}}class Ua extends zs{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3d=!0,this.type="CatmullRomCurve3d",this._tmp=new f,this._px=new Ki,this._py=new Ki,this._pz=new Ki,this._points=t.map(r=>new b(r)),this._closed=e,this._curveType=i,this._tension=n}get points(){return this._points}get closed(){return this._closed}get curveType(){return this._curveType}get tension(){return this._tension}get startPoint(){return this._points.length>0?this._points[0]:new b}get endPoint(){return this._points.length>0?this._points[this._points.length-1]:new b}get length(){if(this._points.length<2)return 0;let t=0;for(let e=1;e<this._points.length;e++)t+=this._points[e-1].distanceTo(this._points[e]);return this._closed&&this._points.length>2&&(t+=this._points[this._points.length-1].distanceTo(this._points[0])),t}getPoint(t,e=new b){const i=e,n=this._points,r=n.length;if(r===0)return i.set(0,0,0);if(r===1)return i.copy(n[0]);const a=(r-(this._closed?0:1))*t;let o=Math.floor(a),l=a-o;this._closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,d;this._closed||o>0?c=n[(o-1)%r]:(this._tmp.subVectors(n[0],n[1]).add(n[0]),c=new b(this._tmp.x,this._tmp.y,this._tmp.z));const p=n[o%r],m=n[(o+1)%r];if(this._closed||o+2<r?d=n[(o+2)%r]:(this._tmp.subVectors(n[r-1],n[r-2]).add(n[r-1]),d=new b(this._tmp.x,this._tmp.y,this._tmp.z)),this._curveType==="centripetal"||this._curveType==="chordal"){const u=this._curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(p),u),y=Math.pow(p.distanceToSquared(m),u),x=Math.pow(m.distanceToSquared(d),u);y<1e-4&&(y=1),g<1e-4&&(g=y),x<1e-4&&(x=y),this._px.initNonuniformCatmullRom(c.x,p.x,m.x,d.x,g,y,x),this._py.initNonuniformCatmullRom(c.y,p.y,m.y,d.y,g,y,x),this._pz.initNonuniformCatmullRom(c.z,p.z,m.z,d.z,g,y,x)}else this._curveType==="catmullrom"&&(this._px.initCatmullRom(c.x,p.x,m.x,d.x,this._tension),this._py.initCatmullRom(c.y,p.y,m.y,d.y,this._tension),this._pz.initCatmullRom(c.z,p.z,m.z,d.z,this._tension));return i.set(this._px.calc(l),this._py.calc(l),this._pz.calc(l)),i}getPoints(t){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}setPoints(t){this._points=t.map(e=>new b(e)),this._boundingBoxNeedsUpdate=!0}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0)}setCurveType(t){this._curveType=t}setTension(t){this._tension=t}transform(t){return this._points=this._points.map(e=>{const i=new b;return i.copy(e),i.applyMatrix4(t),i}),this._boundingBoxNeedsUpdate=!0,this}calculateBoundingBox(){if(this._points.length===0)return new F;const t=new F;return this._points.forEach(e=>{t.expandByPoint(e)}),t}}let Ct=class si{constructor(t,e,i,n){this._degree=t,this._knots=[...e],this._controlPoints=i.map(r=>({x:r.x,y:r.y,z:r.z})),this._weights=n?[...n]:new Array(i.length).fill(1)}degree(){return this._degree}knots(){return[...this._knots]}controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z}))}weights(){return[...this._weights]}point(t){const e=this._controlPoints.map(i=>[i.x,i.y,i.z]);return Ss(t,this._degree,this._knots,e,this._weights)}length(){const t=this._controlPoints.map(e=>[e.x,e.y,e.z]);return Ra(this._degree,this._knots,t,this._weights)}static byKnotsControlPointsWeights(t,e,i,n){return new si(t,e,i,n)}static byPoints(t,e,i="Uniform",n,r){const a=Cn(t,e,i,n,r),o=a.controlPoints.map(l=>({x:l[0],y:l[1],z:l[2]}));return new si(e,a.knots,o,a.weights)}getParameterRange(){const t=this._knots[this._degree],e=this._knots[this._knots.length-this._degree-1];return{start:t,end:e}}getPoints(t){const e=[],{start:i,end:n}=this.getParameterRange();for(let r=0;r<=t;r++){const a=i+(n-i)*(r/t);e.push(this.point(a))}return e}isClosed(t=1e-6){const{start:e,end:i}=this.getParameterRange(),n=this.point(e),r=this.point(i),a=n[0]-r[0],o=n[1]-r[1],l=n[2]-r[2];return Math.sqrt(a*a+o*o+l*l)<t}static createFitPointsForClosedCurve(t){if(t.length<4)throw new Error("At least 4 points are required for a closed NURBS curve");const e=new Ua(t,!0,"centripetal"),i=Math.max(50,t.length*2);return e.getPoints(i)}static createClosedCurve(t,e,i="Chord"){const n=this.createFitPointsForClosedCurve(t).map(r=>[r.x,r.y,r.z]);return si.byPoints(n,e,i)}};class Lt extends zs{constructor(t,e,i,n,r,a){super();const o=arguments.length;if(this._degree=3,this._closed=!1,Array.isArray(e)){if(o<2||o>5)throw gt.ILLEGAL_PARAMETERS;this._controlPoints=t;let l,c=3,d=!1;if(o>=3&&(Array.isArray(i)?(l=i,o>=4&&(c=n||3),o>=5&&(d=r)):i!==void 0&&(c=i||3,o>=4&&(d=n))),i===void 0&&o>=4&&(c=n||3,o>=5&&(d=r)),this._degree=c,this._closed=d,this._controlPoints.length<this._degree+1)throw gt.ILLEGAL_PARAMETERS;this._nurbsCurve=Ct.byKnotsControlPointsWeights(this._degree,e,this._controlPoints,l)}else{if(o<2||o>6)throw gt.ILLEGAL_PARAMETERS;this._fitPoints=t,this._knotParameterization=e,o>=3&&(this._degree=i||3);const l=typeof n=="boolean";o>=4&&l&&(this._closed=n),l?(o>=5&&(this._startTangent=r),o>=6&&(this._endTangent=a)):(o>=4&&(this._startTangent=n),o>=5&&(this._endTangent=r)),this._closed&&(this._startTangent=void 0,this._endTangent=void 0);const c=(this._startTangent?1:0)+(this._endTangent?1:0);if(this._fitPoints.length+c<this._degree+1)throw gt.ILLEGAL_PARAMETERS;if(this._closed)this._nurbsCurve=Ct.createClosedCurve(this._fitPoints,this._degree,this._knotParameterization);else{const d=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Ct.byPoints(d,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(d=>[d.x,d.y,d.z||0]))}}buildCurve(){if(this._fitPoints&&this._knotParameterization){if(this._closed){const t=Ct.createFitPointsForClosedCurve(this._fitPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Ct.byPoints(e,this._degree,this._knotParameterization)}else{const t=this.toNurbsPoints(this._fitPoints);this._nurbsCurve=Ct.byPoints(t,this._degree,this._knotParameterization,this._startTangent?this.toNurbsPoint(this._startTangent):void 0,this._endTangent?this.toNurbsPoint(this._endTangent):void 0)}this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(t=>[t.x,t.y,t.z||0]))}else if(this._controlPoints)if(this._closed){const t=Ct.createFitPointsForClosedCurve(this._controlPoints),e=this.toNurbsPoints(t);this._nurbsCurve=Ct.byPoints(e,this._degree,this._knotParameterization),this._controlPoints=this.toGePoints(this._nurbsCurve.controlPoints().map(i=>[i.x,i.y,i.z||0]))}else{const t=this._nurbsCurve.knots(),e=this._nurbsCurve.weights();this._nurbsCurve=Ct.byKnotsControlPointsWeights(this._degree,t,this._controlPoints,e)}}setClosed(t){this._closed!==t&&(this._closed=t,this._boundingBoxNeedsUpdate=!0,this.buildCurve())}get degree(){return this._degree}get knotParameterization(){return this._knotParameterization}get controlPoints(){return this._controlPoints.map(t=>({x:t.x,y:t.y,z:t.z||0}))}get fitPoints(){var t;return(t=this._fitPoints)==null?void 0:t.map(e=>({x:e.x,y:e.y,z:e.z||0}))}get knots(){return[...this._nurbsCurve.knots()]}get weights(){return[...this._nurbsCurve.weights()]}get startPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),i=t[e],n=this._nurbsCurve.point(i);return new b(n[0],n[1],n[2])}get endPoint(){const t=this._nurbsCurve.knots(),e=this._nurbsCurve.degree(),i=t[t.length-e-1],n=this._nurbsCurve.point(i);return new b(n[0],n[1],n[2])}get length(){return this._nurbsCurve.length()}getFitPointAt(t){if(!this._fitPoints)throw new Error("No fit points in this spline");const e=this._fitPoints.length,i=t<0||t>=e?e-1:t,n=this._fitPoints[i];return{x:n.x,y:n.y,z:n.z||0}}getControlPointAt(t){const e=this._controlPoints.length,i=t<0||t>=e?e-1:t;return this._controlPoints[i]}getPoints(t=100){const e=this._nurbsCurve,i=[],n=e.knots(),r=this._nurbsCurve.degree(),a=n[r],o=n[n.length-r-1],l=(o-a)/(t-1);for(let c=0;c<t;c++){const d=c===t-1?o:a+c*l,p=e.point(d);i.push(new b(p[0],p[1],p[2]))}return i}getCurvePoints(t,e){const i=[],n=t.knots(),r=t.degree(),a=n[r],o=(n[n.length-r-1]-a)/(e-1);for(let l=0;l<e;l++){const c=a+l*o;i.push(t.point(c))}return i}calculateBoundingBox(){const t=this.getPoints(100);return new F().setFromPoints(t)}get closed(){return this._closed}set closed(t){this.setClosed(t)}transform(t){return this._boundingBoxNeedsUpdate=!0,this}toNurbsPoints(t){const e=new Array(t.length);return t.forEach((i,n)=>{e[n]=[i.x,i.y,i.z||0]}),e}toGePoints(t){const e=new Array(t.length);return t.forEach((i,n)=>{e[n]={x:i[0],y:i[1],z:i[2]}}),e}toNurbsPoint(t){return[t.x,t.y,t.z||0]}static createClosedSpline(t,e="Uniform",i=3){if(t.length<i+1)throw new Error(`At least ${i+1} points are required for a degree ${i} closed spline`);return new Lt(t,e,i,!0)}}var Bn=(s=>(s.ClosedFilled="",s.Dot="_DOT",s.DotSmall="_DOTSMALL",s.DotBlank="_DOTBLANK",s.Origin="_ORIGIN",s.Origin2="_ORIGIN2",s.Open="_OPEN",s.Open90="_OPEN90",s.Open30="_OPEN30",s.Closed="_CLOSED",s.Small="_SMALL",s.None="_NONE",s.Oblique="_OBLIQUE",s.BoxFilled="_BOXFILLED",s.Box="_BOXBLANK",s.ClosedBlank="_CLOSEDBLANK",s.DatumBlank="_DATUMBLANK",s.DatumFilled="_DATUMFILLED",s.Integral="_INTEGRAL",s.ArchTick="_ARCHTICK",s))(Bn||{}),je=(s=>(s[s.ByBlock=-2]="ByBlock",s[s.ByDIPs=-4]="ByDIPs",s[s.ByLayer=-1]="ByLayer",s[s.ByLineWeightDefault=-3]="ByLineWeightDefault",s[s.LineWeight000=0]="LineWeight000",s[s.LineWeight005=5]="LineWeight005",s[s.LineWeight009=9]="LineWeight009",s[s.LineWeight013=13]="LineWeight013",s[s.LineWeight015=15]="LineWeight015",s[s.LineWeight018=18]="LineWeight018",s[s.LineWeight020=20]="LineWeight020",s[s.LineWeight025=25]="LineWeight025",s[s.LineWeight030=30]="LineWeight030",s[s.LineWeight035=35]="LineWeight035",s[s.LineWeight040=40]="LineWeight040",s[s.LineWeight050=50]="LineWeight050",s[s.LineWeight053=53]="LineWeight053",s[s.LineWeight060=60]="LineWeight060",s[s.LineWeight070=70]="LineWeight070",s[s.LineWeight080=80]="LineWeight080",s[s.LineWeight090=90]="LineWeight090",s[s.LineWeight100=100]="LineWeight100",s[s.LineWeight106=106]="LineWeight106",s[s.LineWeight120=120]="LineWeight120",s[s.LineWeight140=140]="LineWeight140",s[s.LineWeight158=158]="LineWeight158",s[s.LineWeight200=200]="LineWeight200",s[s.LineWeight211=211]="LineWeight211",s))(je||{}),se=(s=>(s[s.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",s[s.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",s[s.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",s[s.BOTTOM_TO_TOP=4]="BOTTOM_TO_TOP",s[s.BY_STYLE=5]="BY_STYLE",s))(se||{}),rt=(s=>(s[s.TopLeft=1]="TopLeft",s[s.TopCenter=2]="TopCenter",s[s.TopRight=3]="TopRight",s[s.MiddleLeft=4]="MiddleLeft",s[s.MiddleCenter=5]="MiddleCenter",s[s.MiddleRight=6]="MiddleRight",s[s.BottomLeft=7]="BottomLeft",s[s.BottomCenter=8]="BottomCenter",s[s.BottomRight=9]="BottomRight",s))(rt||{}),Rn=(s=>(s[s.OPTIMIZED_2D=0]="OPTIMIZED_2D",s[s.WIREFRAME=1]="WIREFRAME",s[s.HIDDEN_LINE=2]="HIDDEN_LINE",s[s.FLAT_SHADED=3]="FLAT_SHADED",s[s.GOURAUD_SHADED=4]="GOURAUD_SHADED",s[s.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",s[s.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME",s))(Rn||{}),zn=(s=>(s[s.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",s[s.TOP=1]="TOP",s[s.BOTTOM=2]="BOTTOM",s[s.FRONT=3]="FRONT",s[s.BACK=4]="BACK",s[s.LEFT=5]="LEFT",s[s.RIGHT=6]="RIGHT",s))(zn||{}),Vn=(s=>(s[s.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",s[s.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS",s))(Vn||{});let Xa=class Ya{constructor(){this._number=-1,this._id="",this._groupId="",this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0}get number(){return this._number}set number(t){this._number=t}get id(){return this._id}set id(t){this._id=t}get groupId(){return this._groupId}set groupId(t){this._groupId=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get box(){const t=new dt;return t.setFromCenterAndSize(this.centerPoint,{x:this.width,y:this.height}),t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter.copy(t)}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get viewWidth(){return this.viewHeight*(this.width/this.height)}get viewBox(){const t=new dt;return t.setFromCenterAndSize(this.viewCenter,{x:this.viewWidth,y:this.viewHeight}),t}clone(){const t=new Ya;return t.id=this.id,t.groupId=this.groupId,t.number=this.number,t.centerPoint.copy(this.centerPoint),t.height=this.height,t.width=this.width,t.viewCenter.copy(this.viewCenter),t.viewHeight=this.viewHeight,t}copy(t){return this.id=t.id,this.groupId=t.groupId,this.number=t.number,this.centerPoint.copy(t.centerPoint),this.height=t.height,this.width=t.width,this.viewCenter.copy(t.viewCenter),this.viewHeight=t.viewHeight,this}};const $n=class $n extends ne{constructor(){super(...arguments),this._lineType=Ke,this._visibility=!0,this._transparency=new zi}get type(){return this.constructor.typeName}get layer(){return this._layer==null&&(this._layer=this.database.clayer??"0"),this._layer}set layer(t){this._layer=t}get color(){return this._color==null&&(this._color=new J,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._color}set color(t){this._color==null&&(this._color=new J),this._color.copy(t)}get resolvedColor(){let t=this.color;if(t.isByLayer){const e=this.getLayerColor();e&&e.RGB!=null&&(t=e)}else t.isByBlock;return t}get rgbColor(){const e=this.resolvedColor.RGB;return e??16777215}get lineType(){return this._lineType}set lineType(t){this._lineType=t||Ke}get lineWeight(){return this._lineWeight==null&&(this._lineWeight=this.database.celweight??je.ByLayer),this._lineWeight}set lineWeight(t){this._lineWeight=t}get linetypeScale(){return this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._linetypeScale}set linetypeScale(t){this._linetypeScale=t}get visibility(){return this._visibility}set visibility(t){this._visibility=t}get transparency(){return this._transparency}set transparency(t){this._transparency=t.clone()}dxfOutFields(t){t.writeSubclassMarker("AcDbEntity"),t.writeString(8,this.layer),t.writeString(6,this.lineType),t.writeDouble(48,this.linetypeScale),t.writeInt16(60,this.visibility?0:1),t.writeCmColor(this.color),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency);const e=this.database.tables.blockTable.getIdAt(this.ownerId);return e!=null&&e.isPaperSapce&&t.writeInt16(67,1),this}resolveEffectiveProperties(){this._layer==null&&(this._layer=this.database.clayer??"0"),this._color==null&&(this._color=new J,this.database.cecolor&&this._color.copy(this.database.cecolor)),this._linetypeScale==null&&(this._linetypeScale=this.database.celtscale??-1),this._lineWeight==null&&(this._lineWeight=this.database.celweight??je.ByLayer)}get properties(){return{type:this.type,groups:[this.getGeneralProperties()]}}subGetGripPoints(){return new Array}subGetOsnapPoints(t,e,i,n,r){}transformBy(t){return this}erase(){return this.database.tables.blockTable.removeEntity(this.objectId)}worldDraw(t,e){const i=t.subEntityTraits;i.color=this.resolvedColor,i.rgbColor=this.rgbColor,i.lineType=this.lineStyle,i.lineTypeScale=this.linetypeScale,i.lineWeight=this.lineWeight,i.transparency=this.transparency,i.layer=this.layer,"thickness"in this&&(i.thickness=this.thickness);const n=this.subWorldDraw(t,e);return this.attachEntityInfo(n),n}triggerModifiedEvent(){this.database.events.entityModified.dispatch({database:this.database,entity:this})}getGeneralProperties(){return{groupName:"general",properties:[{name:"handle",type:"int",editable:!1,accessor:{get:()=>this.objectId}},{name:"color",type:"color",editable:!0,accessor:{get:()=>this.color,set:t=>{this.color.copy(t)}}},{name:"layer",type:"string",editable:!0,accessor:{get:()=>this.layer,set:t=>{this.layer=t}}},{name:"linetype",type:"linetype",editable:!0,accessor:{get:()=>this.lineType,set:t=>{this.lineType=t}}},{name:"linetypeScale",type:"float",editable:!0,accessor:{get:()=>this.linetypeScale,set:t=>{this.linetypeScale=t}}},{name:"lineWeight",type:"lineweight",editable:!0,accessor:{get:()=>this.lineWeight,set:t=>{this.lineWeight=t}}},{name:"transparency",type:"transparency",editable:!0,accessor:{get:()=>this.transparency,set:t=>{this.transparency=t}}}]}}get lineStyle(){var n;const{type:t,name:e}=this.getLineType(),i=(n=this.database)==null?void 0:n.tables.linetypeTable.getAt(e);return i?{type:t,...i.linetype}:{type:t,name:e,standardFlag:0,description:"",totalPatternLength:0}}getLineType(){if(this.lineType==Ke){const t=this.database.tables.layerTable.getAt(this.layer);if(t&&t.linetype)return{type:"ByLayer",name:t.linetype}}else return this.lineType==ci?{type:"ByBlock",name:qe}:{type:"UserSpecified",name:this.lineType};return{type:"UserSpecified",name:qe}}getLayerColor(){const t=this.database.tables.layerTable.getAt(this.layer);if(t==null)console.error(`The layer with name '${this.layer}' not found in drawing database!`);else return t.color;return null}attachEntityInfo(t){t&&(t.objectId=this.objectId,this.attrs.has("ownerId")&&(t.ownerId=this.ownerId),t.layerName=this.layer,t.visible=this.visibility)}};$n.typeName="Entity";let ut=$n;const qn=class qn extends ut{};qn.typeName="Curve";let pt=qn;var Xe=(s=>(s[s.SimplePoly=0]="SimplePoly",s[s.FitCurvePoly=1]="FitCurvePoly",s[s.QuadSplinePoly=2]="QuadSplinePoly",s[s.CubicSplinePoly=3]="CubicSplinePoly",s))(Xe||{});const Kn=class Kn extends pt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=0,n=!1,r=0,a=0,o=null){super(),this._polyType=t,this._elevation=i;const l=o&&(o==null?void 0:o.length)===e.length,c=e.map((d,p)=>({x:d.x,y:d.y,bulge:l?o[p]:void 0}));this._geo=new me(c,n)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}getBulgeAt(t){const e=this._geo.vertices[t];return(e==null?void 0:e.bulge)||0}get geometricExtents(){const t=this._geo.box;return new F({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new b(i.x,i.y,0))}return t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);n.push(new b(a.x,a.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(n=>e.push(new b().set(n.x,n.y,this.elevation))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i)t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint3d(10,{x:this.getPointAt(i).x,y:this.getPointAt(i).y,z:this.elevation}),t.writeDouble(42,this.getBulgeAt(i)),t.writeInt16(70,0);return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb2dPolyline");let e=this.closed?1:0;return this.polyType===1&&(e|=2),this.polyType===2&&(e|=4),this.polyType===3&&(e|=8),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),t.writeDouble(10,0),t.writeDouble(20,0),t.writeDouble(30,this.elevation),this}};Kn.typeName="2dPolyline";let di=Kn;var $a=(s=>(s[s.Vertex=0]="Vertex",s[s.CurveFitVertex=1]="CurveFitVertex",s[s.SplineFitVertex=8]="SplineFitVertex",s[s.SplineCtlVertex=9]="SplineCtlVertex",s))($a||{});const Zn=class Zn extends ut{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._bulge=0,this._startWidth=0,this._endWidth=0,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get bulge(){return this._bulge}set bulge(t){this._bulge=t}get startWidth(){return this._startWidth}set startWidth(t){this._startWidth=t}get endWidth(){return this._endWidth}set endWidth(t){this._endWidth=t}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new F().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,i,n){n.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb2dVertex"),t.writePoint2d(10,this.position),t.writeDouble(40,this.startWidth),t.writeDouble(41,this.endWidth),t.writeDouble(42,this.bulge),t.writeInt16(70,this.vertexType),this}};Zn.typeName="2dVertex";let mn=Zn;var Es=(s=>(s[s.SimplePoly=0]="SimplePoly",s[s.QuadSplinePoly=1]="QuadSplinePoly",s[s.CubicSplinePoly=2]="CubicSplinePoly",s))(Es||{});const Qn=class Qn extends pt{get dxfTypeName(){return"POLYLINE"}constructor(t,e,i=!1){super(),this._polyType=t,this._geo=new me(e,i)}get polyType(){return this._polyType}set polyType(t){this._polyType=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}get numberOfVertices(){return this._geo.numberOfVertices}getPointAt(t){return this._geo.getPointAt(t)}get geometricExtents(){const t=this._geo.box;return new F({x:t.min.x,y:t.min.y,z:0},{x:t.max.x,y:t.max.y,z:0})}subGetGripPoints(){const t=new Array;for(let e=0;e<this._geo.numberOfVertices;++e){const i=this._geo.getPointAt(e);t.push(new b(i.x,i.y,0))}return t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:for(let r=0;r<this._geo.numberOfVertices;++r){const a=this._geo.getPointAt(r);n.push(new b(a.x,a.y,0))}break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0},{name:"z",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(n=>e.push(new b().set(n.x,n.y,0))),t.lines(e)}dxfOut(t,e=!1){super.dxfOut(t,e);for(let i=0;i<this.numberOfVertices;++i){const n=this.getPointAt(i);t.writeStart("VERTEX"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,{x:n.x,y:n.y,z:0}),t.writeInt16(70,32)}return t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),this}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDb3dPolyline");let e=this.closed?1:0;return e|=8,this.polyType===1&&(e|=16),this.polyType===2&&(e|=32),t.writeInt16(66,this.numberOfVertices>0?1:0),t.writeInt16(70,e),this}};Qn.typeName="3dPolyline";let ui=Qn;var qa=(s=>(s[s.SimpleVertex=0]="SimpleVertex",s[s.ControlVertex=1]="ControlVertex",s[s.FitVertex=2]="FitVertex",s))(qa||{});const Jn=class Jn extends ut{get dxfTypeName(){return"VERTEX"}constructor(){super(),this._position=new b,this._vertexType=0}get position(){return this._position}set position(t){this._position.copy(t)}get vertexType(){return this._vertexType}set vertexType(t){this._vertexType=t}get geometricExtents(){return new F().expandByPoint(this._position)}subGetGripPoints(){const t=new Array;return t.push(this._position),t}subGetOsnapPoints(t,e,i,n){n.push(this._position)}transformBy(t){return this._position.applyMatrix4(t),this}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbVertex"),t.writeSubclassMarker("AcDb3dPolylineVertex"),t.writePoint3d(10,this.position),t.writeInt16(70,this.vertexType|32),this}};Jn.typeName="3dVertex";let gn=Jn;const tr=class tr extends pt{get dxfTypeName(){return"ARC"}constructor(t,e,i,n,r=f.Z_AXIS){super(),this._geo=new Re(t,e,i,n,r,f.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get startPoint(){return this._geo.startPoint}get endPoint(){return this._geo.endPoint}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"arcLength",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"totalAngle",type:"float",editable:!1,accessor:{get:()=>N.radToDeg(Math.abs(this._geo.deltaAngle))}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,i,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.nearestPoint(e);n.push(o)}break;case z.Perpendicular:break;case z.Tangent:{const o=this._geo.tangentPoints(e);n.push(...o);break}}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArc"),t.writePoint3d(10,this.center),t.writeDouble(40,this.radius),t.writeAngle(50,this.startAngle),t.writeAngle(51,this.endAngle),t.writeVector3d(210,this.normal),this}};tr.typeName="Arc";let pi=tr;var Ka=(s=>(s[s.LEFT=0]="LEFT",s[s.CENTER=1]="CENTER",s[s.RIGHT=2]="RIGHT",s[s.ALIGNED=3]="ALIGNED",s[s.MIDDLE=4]="MIDDLE",s[s.FIT=5]="FIT",s))(Ka||{}),Za=(s=>(s[s.BASELINE=0]="BASELINE",s[s.BOTTOM=1]="BOTTOM",s[s.MIDDLE=2]="MIDDLE",s[s.TOP=3]="TOP",s))(Za||{});const er=class er extends ut{get dxfTypeName(){return"TEXT"}constructor(){super(),this._textString="",this._height=0,this._thickness=1,this._position=new b,this._rotation=0,this._oblique=0,this._horizontalMode=0,this._verticalModel=2,this._styleName="",this._widthFactor=1}get textString(){return this._textString}set textString(t){this._textString=t}get thickness(){return this._thickness}set thickness(t){this._thickness=t}get height(){return this._height}set height(t){this._height=t}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get horizontalMode(){return this._horizontalMode}set horizontalMode(t){this._horizontalMode=t}get verticalMode(){return this._verticalModel}set verticalMode(t){this._verticalModel=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get widthFactor(){return this._widthFactor}set widthFactor(t){this._widthFactor=t}get geometricExtents(){return new F}subGetOsnapPoints(t,e,i,n){z.Insertion===t&&n.push(this._position)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.textString,set:t=>{this.textString=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"widthFactor",type:"float",editable:!0,accessor:{get:()=>this.widthFactor,set:t=>{this.widthFactor=t}}},{name:"oblique",type:"float",editable:!0,accessor:{get:()=>this.oblique,set:t=>{this.oblique=t}}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt(Y)||t.getAt(Y)),e.textStyle}subWorldDraw(t,e){const i={text:this.textString,height:this.height,width:1/0,widthFactor:this.widthFactor,position:this.position,rotation:this.rotation,drawingDirection:se.BOTTOM_TO_TOP,attachmentPoint:rt.BottomLeft};return t.mtext(i,this.getTextStyle(),e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbText"),t.writePoint3d(10,this.position),t.writeDouble(39,this.thickness),t.writeDouble(40,this.height),t.writeString(1,this.textString),t.writeAngle(50,this.rotation),t.writeDouble(41,this.widthFactor),t.writeAngle(51,this.oblique),t.writeString(7,this.styleName),t.writeInt16(72,this.horizontalMode),t.writeInt16(73,this.verticalMode),t.writePoint3d(11,this.position),this}};er.typeName="Text";let Ze=er;var Q=(s=>(s[s.Invisible=1]="Invisible",s[s.Const=2]="Const",s[s.Verifiable=4]="Verifiable",s[s.Preset=8]="Preset",s))(Q||{}),Bt=(s=>(s[s.MultiLine=2]="MultiLine",s[s.ConstMultiLine=4]="ConstMultiLine",s))(Bt||{});const sr=class sr extends Ze{get dxfTypeName(){return"ATTDEF"}constructor(){super(),this._flags=0,this._prompt="",this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&1)!==0}set isInvisible(t){t?this._flags|=1:this._flags&=-2}get prompt(){return this._prompt}set prompt(t){this._prompt=t}get isConst(){return(this._flags&2)!==0}set isConst(t){t?this._flags|=2:this._flags&=-3}get isVerifiable(){return(this._flags&4)!==0}set isVerifiable(t){t?this._flags|=4:this._flags&=-5}get isPreset(){return(this._flags&8)!==0}set isPreset(t){t?this._flags|=8:this._flags&=-9}get isMTextAttribute(){return(this._mtextFlag&2)!==0}set isMTextAttribute(t){t?this._mtextFlag|=2:this._mtextFlag&=-3}get isConstMTextAttribute(){return(this._mtextFlag&4)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=4:this._mtextFlag&=-5}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}subWorldDraw(t){}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttributeDefinition"),t.writeString(3,this.prompt),t.writeString(2,this.tag),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeInt16(74,this.isReallyLocked?1:0),this}};sr.typeName="AttDef";let mi=sr;const ir=class ir extends Ze{get dxfTypeName(){return"ATTRIB"}constructor(){super(),this._flags=0,this._mtextFlag=0,this._tag="",this._fieldLength=0,this._lockPositionInBlock=!1,this._isReallyLocked=!1}get isInvisible(){return(this._flags&Q.Invisible)!==0}set isInvisible(t){t?this._flags|=Q.Invisible:this._flags&=~Q.Invisible}get isConst(){return(this._flags&Q.Const)!==0}set isConst(t){t?this._flags|=Q.Const:this._flags&=~Q.Const}get isVerifiable(){return(this._flags&Q.Verifiable)!==0}set isVerifiable(t){t?this._flags|=Q.Verifiable:this._flags&=~Q.Verifiable}get isPreset(){return(this._flags&Q.Preset)!==0}set isPreset(t){t?this._flags|=Q.Preset:this._flags&=~Q.Preset}get isMTextAttribute(){return(this._mtextFlag&Bt.MultiLine)!==0}set isMTextAttribute(t){t?this._mtextFlag|=Bt.MultiLine:this._mtextFlag&=~Bt.MultiLine}get isConstMTextAttribute(){return(this._mtextFlag&Bt.ConstMultiLine)!==0}set isConstMTextAttribute(t){t?this._mtextFlag|=Bt.ConstMultiLine:this._mtextFlag&=~Bt.ConstMultiLine}get tag(){return this._tag}set tag(t){this._tag=t}get fieldLength(){return this._fieldLength}set fieldLength(t){this._fieldLength=t}get lockPositionInBlock(){return this._lockPositionInBlock}set lockPositionInBlock(t){this._lockPositionInBlock=t}get isReallyLocked(){return this._isReallyLocked}set isReallyLocked(t){this._isReallyLocked=t}get mtext(){return this._mtext}set mtext(t){this._mtext=t,this.isMTextAttribute=t!=null}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAttribute"),t.writeInt16(70,this.isInvisible?1:0),t.writeInt16(73,this.fieldLength),t.writeString(2,this.tag),t.writeInt16(74,this.isReallyLocked?1:0),this.mtext&&t.writeInt16(71,this.isMTextAttribute?1:0),this}};ir.typeName="Attrib";let gi=ir;const nr=class nr extends ut{get dxfTypeName(){return"INSERT"}constructor(t){super(),this._blockName=t,this._position=new b,this._rotation=0,this._normal=new f(0,0,1),this._scaleFactors=new b(1,1,1),this._attribs=new Map}get position(){return this._position}set position(t){this._position.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scaleFactors(){return this._scaleFactors}set scaleFactors(t){this._scaleFactors.copy(t)}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}get blockName(){return this._blockName}get blockTableRecord(){return this.database.tables.blockTable.getAt(this._blockName)}appendAttributes(t){this._attribs.set(t.objectId,t),t.ownerId=this.objectId}attributeIterator(){return new Ds(this._attribs)}get blockTransform(){const t=this.blockTableRecord,e=(t==null?void 0:t.origin)??b.ORIGIN,i=new Pt().makeTranslation(-e.x,-e.y,-e.z),n=new Pt().makeScale(this._scaleFactors.x,this._scaleFactors.y,this._scaleFactors.z),r=new Ge().setFromAxisAngle(f.Z_AXIS,this._rotation),a=new Pt().makeRotationFromQuaternion(r),o=new Pt().makeTranslation(this._position.x,this._position.y,this._position.z);return new Pt().multiplyMatrices(o,a).multiply(n).multiply(i)}subGetOsnapPoints(t,e,i,n,r){z.Insertion===t?n.push(this._position):r&&this.subEntityGetOsnapPoints(t,e,i,n,r)}get properties(){const t={type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"blockName",type:"float",editable:!1,accessor:{get:()=>this._blockName}},{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:e=>{this.position.x=e}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:e=>{this.position.y=e}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:e=>{this.position.z=e}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:e=>{this.rotation=e}}},{name:"scaleFactorsX",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.x,set:e=>{this.scaleFactors.x=e}}},{name:"scaleFactorsY",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.y,set:e=>{this.scaleFactors.y=e}}},{name:"scaleFactorsZ",type:"float",editable:!0,accessor:{get:()=>this.scaleFactors.z,set:e=>{this.scaleFactors.z=e}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:e=>{this.normal.x=e}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:e=>{this.normal.y=e}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:e=>{this.normal.z=e}}}]}]};if(this._attribs.size>0){const e={groupName:"attribute",properties:[]};t.groups.push(e),this._attribs.forEach(i=>{e.properties.push({name:i.tag,type:"string",editable:!i.isConst,skipTranslation:!0,accessor:{get:()=>i.textString,set:n=>{i.textString=n}}})})}return t}get geometricExtents(){const t=new F,e=this.blockTableRecord;if(e!=null){const n=e.newIterator();for(const r of n)t.union(r.geometricExtents)}const i=this.blockTransform;return t.applyMatrix4(i),t}subWorldDraw(t){const e=this.blockTableRecord;if(e!=null){const i=this.blockTransform,n=[];return this._attribs.forEach(a=>{if(!a.isInvisible){const o=a.worldDraw(t);o&&n.push(o)}}),Je.instance.draw(t,e,this.rgbColor,n,!0,i,this._normal)}else return t.group([])}dxfOut(t,e=!1){super.dxfOut(t,e);let i=!1;for(const n of this.attributeIterator())i=!0,t.writeStart("ATTRIB"),n.dxfOut(t);return i&&(t.writeStart("SEQEND"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity")),this}subEntityGetOsnapPoints(t,e,i,n,r){var o;if(r===this.objectId)return;const a=(o=this.database)==null?void 0:o.tables.blockTable;if(a!=null){const l=a.getEntityById(r);if(l){const c=[];l.subGetOsnapPoints(t,e,i,c,r);const d=this.blockTransform;c.forEach(p=>{const m=p.clone().applyMatrix4(d);n.push(m)})}}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockReference"),t.writePoint3d(10,this.position),t.writeString(2,this.blockName),t.writeDouble(41,this.scaleFactors.x),t.writeDouble(42,this.scaleFactors.y),t.writeDouble(43,this.scaleFactors.z),t.writeAngle(50,this.rotation),t.writeVector3d(210,this.normal),this}};nr.typeName="BlockReference";let Qe=nr;const rr=class rr extends pt{get dxfTypeName(){return"CIRCLE"}constructor(t,e,i=f.Z_AXIS){super(),this._geo=new Re(t,e,0,G,i,f.X_AXIS)}get center(){return this._geo.center}set center(t){this._geo.center=t}get radius(){return this._geo.radius}set radius(t){this._geo.radius=t}get normal(){return this._geo.normal}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,i,n){switch(t){case z.Center:case z.Centroid:n.push(this._geo.center);break;case z.Quadrant:n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3));break;case z.Nearest:{const r=this._geo.nearestPoint(e);n.push(r)}break;case z.Tangent:{const r=this._geo.tangentPoints(e);n.push(...r);break}}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"radius",type:"float",editable:!0,accessor:{get:()=>this.radius,set:t=>{this.radius=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"diameter",type:"float",editable:!1,accessor:{get:()=>this._geo.radius*2}},{name:"perimeter",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.center),t}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){return t.circularArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbCircle"),t.writePoint3d(10,this.center),t.writeDouble(40,this.radius),t.writeVector3d(210,this.normal),this}};rr.typeName="Circle";let yi=rr;const ar=class ar extends pt{get dxfTypeName(){return"ELLIPSE"}constructor(t,e,i,n,r,a,o){super(),this._geo=new Di(t,e,i,n,r,a,o)}get center(){return this._geo.center}set center(t){this._geo.center=t}get majorAxisRadius(){return this._geo.majorAxisRadius}set majorAxisRadius(t){this._geo.majorAxisRadius=t}get minorAxisRadius(){return this._geo.minorAxisRadius}set minorAxisRadius(t){this._geo.minorAxisRadius=t}get startAngle(){return this._geo.startAngle}set startAngle(t){this._geo.startAngle=t}get endAngle(){return this._geo.endAngle}set endAngle(t){this._geo.endAngle=t}get normal(){return this._geo.normal}set normal(t){this._geo.normal=t}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:this.closed||(n.push(this._geo.startPoint),n.push(this._geo.endPoint));break;case z.MidPoint:this.closed||n.push(this._geo.midPoint);break;case z.Quadrant:this.closed&&(n.push(this._geo.getPointAtAngle(0)),n.push(this._geo.getPointAtAngle(Math.PI/2)),n.push(this._geo.getPointAtAngle(Math.PI)),n.push(this._geo.getPointAtAngle(Math.PI/2*3)));break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"centerX",type:"float",editable:!0,accessor:{get:()=>this.center.x,set:t=>{this.center.x=t}}},{name:"centerY",type:"float",editable:!0,accessor:{get:()=>this.center.y,set:t=>{this.center.y=t}}},{name:"centerZ",type:"float",editable:!0,accessor:{get:()=>this.center.z,set:t=>{this.center.z=t}}},{name:"majorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.majorAxisRadius,set:t=>{this.center.x=t}}},{name:"minorAxisRadius",type:"float",editable:!0,accessor:{get:()=>this.minorAxisRadius,set:t=>{this.minorAxisRadius=t}}},{name:"startAngle",type:"float",editable:!0,accessor:{get:()=>this.startAngle,set:t=>{this.startAngle=t}}},{name:"endAngle",type:"float",editable:!0,accessor:{get:()=>this.endAngle,set:t=>{this.endAngle=t}}},{name:"normalX",type:"float",editable:!0,accessor:{get:()=>this.normal.x,set:t=>{this.normal.x=t}}},{name:"normalY",type:"float",editable:!0,accessor:{get:()=>this.normal.y,set:t=>{this.normal.y=t}}},{name:"normalZ",type:"float",editable:!0,accessor:{get:()=>this.normal.z,set:t=>{this.normal.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this._geo.area}}]}]}}subWorldDraw(t){return t.ellipticalArc(this._geo)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbEllipse"),t.writePoint3d(10,this.center),t.writePoint3d(11,{x:this.majorAxisRadius,y:0,z:0}),t.writeVector3d(210,this.normal),t.writeDouble(40,this.minorAxisRadius/this.majorAxisRadius),t.writeDouble(41,this.startAngle),t.writeDouble(42,this.endAngle),this}};ar.typeName="Ellipse";let _i=ar;const or=class or extends ut{get dxfTypeName(){return"3DFACE"}constructor(){super(),this._vertices=[new b,new b,new b],this._edgeInvisibilities=0}getVertexAt(t){return t<0?this._vertices[0]:t>this._vertices.length?this._vertices[this._vertices.length-1]:this._vertices[t]}setVertexAt(t,e){if(t<0&&this._vertices[0].copy(e),t>=3)return this._vertices.length===3&&this._vertices.push(new b),this._vertices[3].copy(e);this._vertices[t].copy(e)}setEdgeInvisibilities(t){this._edgeInvisibilities=t}isEdgeVisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");return(this._edgeInvisibilities&1<<t)===0}makeEdgeInvisibleAt(t){if(t<0||t>3)throw new Error("Index out of range");this._edgeInvisibilities=this._edgeInvisibilities|1<<t}get geometricExtents(){return new F().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}subWorldDraw(t){const e=this._vertices.length,i=new Float32Array(e*3),n=new Uint16Array(e*2);for(let r=0;r<e;r++)i[r*3]=this._vertices[r].x,i[r*3+1]=this._vertices[r].y,i[r*3+2]=this._vertices[r].z,this.isEdgeVisibleAt(r)&&(n[r*2]=r,n[r*2+1]=(r+1)%4);return t.lineSegments(i,3,n)}dxfOutFields(t){super.dxfOutFields(t);const e=this.getVertexAt(0),i=this.getVertexAt(1),n=this.getVertexAt(2),r=this.getVertexAt(3);t.writeSubclassMarker("AcDbFace"),t.writePoint3d(10,e),t.writePoint3d(11,i),t.writePoint3d(12,n),t.writePoint3d(13,r);let a=0;for(let o=0;o<4;++o)this.isEdgeVisibleAt(o)||(a|=1<<o);return t.writeInt16(70,a),this}};or.typeName="Face";let wi=or;var Ps=(s=>(s[s.UserDefined=0]="UserDefined",s[s.Predefined=1]="Predefined",s[s.Custom=2]="Custom",s))(Ps||{}),Qa=(s=>(s[s.Normal=0]="Normal",s[s.Outer=1]="Outer",s[s.Ignore=2]="Ignore",s))(Qa||{});const hr=class hr extends ut{get dxfTypeName(){return"HATCH"}constructor(){super(),this._elevation=0,this._geo=new vs,this._isSolidFill=!1,this._definitionLines=[],this._patternName="",this._patternType=1,this._patternAngle=0,this._patternScale=1,this._hatchStyle=0}get isSolidFill(){return this._isSolidFill||this._patternName.toUpperCase()==="SOLID"}set isSolidFill(t){this._isSolidFill=t}get definitionLines(){return this._definitionLines}get patternName(){return this._patternName}set patternName(t){this._patternName=t}get patternType(){return this._patternType}set patternType(t){this._patternType=t}get patternAngle(){return this._patternAngle}set patternAngle(t){this._patternAngle=t}get patternScale(){return this._patternScale}set patternScale(t){this._patternScale=t}get hatchStyle(){return this._hatchStyle}set hatchStyle(t){this._hatchStyle=t}get elevation(){return this._elevation}set elevation(t){this._elevation=t}add(t){this._geo.add(t)}buildAreasFromLoops(){const t=this._geo.loops;if(t.length===0)return[];if(t.length===1)return[this._geo];const e=this._geo.buildHierarchy(),i=[],n=(r,a)=>{if(r.index>=0&&a%2===0){const o=new vs;o.add(t[r.index]),r.children.forEach(l=>{l.index>=0&&o.add(t[l.index])}),i.push(o)}r.children.forEach(o=>n(o,a+1))};return e.children.forEach(r=>n(r,0)),i.length>0?i:[this._geo]}getCalculatedAreaValue(){const t=this.buildAreasFromLoops();return t.length===0?0:t.reduce((e,i)=>e+i.area,0)}get geometricExtents(){const t=this.buildAreasFromLoops();if(t.length===0)return new F;const e=new F;return t.forEach(i=>{const n=i.box;e.union(new F({x:n.min.x,y:n.min.y,z:this._elevation},{x:n.max.x,y:n.max.y,z:this._elevation}))}),e}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"pattern",properties:[{name:"patternType",type:"enum",editable:!0,options:[{label:Ps[0],value:0},{label:Ps[1],value:1},{label:Ps[2],value:2}],accessor:{get:()=>this.patternType,set:t=>{this.patternType=t}}},{name:"patternName",type:"string",editable:!0,accessor:{get:()=>this.patternName,set:t=>{this.patternName=t}}},{name:"patternAngle",type:"float",editable:!0,accessor:{get:()=>this.patternAngle,set:t=>{this.patternAngle=t}}},{name:"patternScale",type:"float",editable:!0,accessor:{get:()=>this.patternScale,set:t=>{this.patternScale=t}}}]},{groupName:"geometry",properties:[{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"area",type:"float",editable:!1,accessor:{get:()=>this.getCalculatedAreaValue()}}]}]}}subWorldDraw(t){const e=t.subEntityTraits;e.fillType={solidFill:this.isSolidFill,patternAngle:this.patternAngle,definitionLines:this.definitionLines};const i=this.buildAreasFromLoops();if(i.length===0)return t.area(this._geo);if(i.length===1)return t.area(i[0]);const n=i.map(r=>t.area(r));return t.group(n)}dxfOutFields(t){super.dxfOutFields(t);const e=this._geo.loops;return t.writeSubclassMarker("AcDbHatch"),t.writePoint3d(10,{x:0,y:0,z:this.elevation}),t.writeVector3d(210,{x:0,y:0,z:1}),t.writeString(2,this.patternName||(this.isSolidFill?"SOLID":"USER")),t.writeInt16(70,this.isSolidFill?1:0),t.writeInt16(71,0),t.writeInt16(91,e.length),e.forEach((i,n)=>{const r=n===0;if(i instanceof me){const a=i.vertices,o=a.some(c=>(c.bulge??0)!==0);t.writeInt16(92,2),t.writeInt16(72,o?1:0),t.writeInt16(73,i.closed?1:0),t.writeInt16(93,a.length);for(const c of a)t.writePoint2d(10,c),o&&t.writeDouble(42,c.bulge??0);t.writeInt16(97,0);return}if(i instanceof ks){const a=r?1:0;t.writeInt16(92,a),t.writeInt16(93,i.numberOfEdges);for(const o of i.curves){if(o instanceof Rt){t.writeInt16(72,1),t.writePoint2d(10,o.startPoint),t.writePoint2d(11,o.endPoint);continue}if(o instanceof Ve){t.writeInt16(72,2),t.writePoint2d(10,o.center),t.writeDouble(40,o.radius),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof De){t.writeInt16(72,3),t.writePoint2d(10,o.center);const l=new O(o.majorAxisRadius*Math.cos(o.rotation),o.majorAxisRadius*Math.sin(o.rotation));t.writePoint2d(11,l);const c=o.majorAxisRadius===0?0:o.minorAxisRadius/o.majorAxisRadius;t.writeDouble(40,c),t.writeAngle(50,o.startAngle),t.writeAngle(51,o.endAngle),t.writeInt16(73,o.clockwise?0:1);continue}if(o instanceof Lt){const l=o.knots,c=o.controlPoints,d=o.weights,p=o.fitPoints,m=d.some(u=>u!==1);t.writeInt16(72,4),t.writeInt16(94,o.degree),t.writeInt16(73,m?1:0),t.writeInt16(74,o.closed?1:0),t.writeInt16(95,l.length),t.writeInt16(96,c.length),l.forEach(u=>t.writeDouble(40,u)),c.forEach((u,g)=>{t.writePoint2d(10,u),m&&t.writeDouble(42,d[g]??1)}),t.writeInt16(97,(p==null?void 0:p.length)??0),p==null||p.forEach(u=>t.writePoint2d(11,u))}}t.writeInt16(97,0)}}),t.writeInt16(75,this.hatchStyle),t.writeInt16(76,this.patternType),t.writeAngle(52,this.patternAngle),t.writeDouble(41,this.patternScale),t.writeInt16(77,0),t.writeInt16(78,this.definitionLines.length),this.definitionLines.forEach(i=>{t.writeAngle(53,i.angle),t.writePoint2d(43,i.base),t.writePoint2d(45,i.offset),t.writeInt16(79,i.dashLengths.length),i.dashLengths.forEach(n=>t.writeDouble(49,n))}),t.writeInt16(98,0),this}};hr.typeName="Hatch";let Ls=hr;var Ja=(s=>(s[s.MText=0]="MText",s[s.Fcf=1]="Fcf",s[s.BlockReference=2]="BlockReference",s[s.NoAnnotation=3]="NoAnnotation",s))(Ja||{});const lr=class lr extends pt{get dxfTypeName(){return"LEADER"}constructor(){super(),this._isSplined=!1,this._updated=!1,this._hasArrowHead=!1,this._vertices=[],this._dimensionStyle="",this._hasHookLine=!1,this._annoType=3}get isSplined(){return this._isSplined}set isSplined(t){this._isSplined=t}get hasArrowHead(){return this._hasArrowHead}set hasArrowHead(t){this._hasArrowHead=t}get hasHookLine(){return this._hasHookLine}set hasHookLine(t){this._hasHookLine=t}get numVertices(){return this._vertices.length}get vertices(){return this._vertices.map(t=>t.clone())}get dimensionStyle(){return this._dimensionStyle}set dimensionStyle(t){this._dimensionStyle=t}get annoType(){return this._annoType}set annoType(t){this._annoType=t}appendVertex(t){this._vertices.push(new b().copy(t)),this._updated=!0}setVertexAt(t,e){throw(t<0||t>=this._vertices.length)&&(this._vertices[t].copy(e),this._updated=!0),new Error("The vertex index is out of range!")}vertexAt(t){throw(t<0||t>=this._vertices.length)&&this._vertices[t],new Error("The vertex index is out of range!")}get geometricExtents(){return this._isSplined&&this.splineGeo?this.splineGeo.calculateBoundingBox():new F().setFromPoints(this._vertices)}get closed(){return!1}set closed(t){}subWorldDraw(t){if(this.isSplined&&this.splineGeo){const e=this.splineGeo.getPoints(100);return t.lines(e)}else return t.lines(this._vertices)}get splineGeo(){return this.createSplineIfNeeded(),this._splineGeo}createSplineIfNeeded(){this.isSplined&&this.numVertices>=2&&(this._splineGeo==null||this._updated)&&(this._splineGeo=new Lt(this._vertices,"Uniform"),this._updated=!1)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLeader"),t.writeString(3,this.dimensionStyle),t.writeInt16(71,this.hasArrowHead?1:0),t.writeInt16(72,this.annoType),t.writeInt16(73,this.hasHookLine?1:0),t.writeInt16(74,this.isSplined?1:0),t.writeInt16(76,this.numVertices);for(const e of this.vertices)t.writePoint3d(10,e);return this}};lr.typeName="Leader";let xi=lr;var z=(s=>(s[s.EndPoint=1]="EndPoint",s[s.MidPoint=2]="MidPoint",s[s.Center=3]="Center",s[s.Node=4]="Node",s[s.Quadrant=5]="Quadrant",s[s.Insertion=7]="Insertion",s[s.Perpendicular=8]="Perpendicular",s[s.Tangent=9]="Tangent",s[s.Nearest=10]="Nearest",s[s.Centroid=11]="Centroid",s))(z||{});function bl(s){let t=0;for(const e of s)t|=1<<e-1;return t}function fl(s){const t=[];for(const e of Object.values(z)){if(typeof e!="number")continue;const i=1<<e-1;s&i&&t.push(e)}return t}function Il(s,t){return s^1<<t-1}function Sl(s,t){return(s&1<<t-1)!==0}function El(s,t){return s|1<<t-1}function Pl(s,t){return s&~(1<<t-1)}const cr=class cr extends pt{get dxfTypeName(){return"LINE"}constructor(t,e){super(),this._geo=new ue(t,e)}get startPoint(){return this._geo.startPoint}set startPoint(t){this._geo.startPoint=t}get endPoint(){return this._geo.endPoint}set endPoint(t){this._geo.endPoint=t}get midPoint(){return this._geo.midPoint}get geometricExtents(){return this._geo.box}get closed(){return!1}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"startX",type:"float",editable:!0,accessor:{get:()=>this.startPoint.x,set:t=>{this.startPoint.x=t}}},{name:"startY",type:"float",editable:!0,accessor:{get:()=>this.startPoint.y,set:t=>{this.startPoint.y=t}}},{name:"startZ",type:"float",editable:!0,accessor:{get:()=>this.startPoint.z,set:t=>{this.startPoint.z=t}}},{name:"endX",type:"float",editable:!0,accessor:{get:()=>this.endPoint.x,set:t=>{this.endPoint.x=t}}},{name:"endY",type:"float",editable:!0,accessor:{get:()=>this.endPoint.y,set:t=>{this.endPoint.y=t}}},{name:"endZ",type:"float",editable:!0,accessor:{get:()=>this.endPoint.z,set:t=>{this.endPoint.z=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.midPoint),t.push(this.startPoint),t.push(this.endPoint),t}subGetOsnapPoints(t,e,i,n){const r=this.startPoint,a=this.endPoint;switch(t){case z.EndPoint:n.push(r),n.push(a);break;case z.MidPoint:n.push(this.midPoint);break;case z.Nearest:{const o=this._geo.project(e);n.push(o)}break;case z.Perpendicular:{const o=this._geo.perpPoint(e);n.push(o)}break;case z.Tangent:break}}transformBy(t){return this._geo.transform(t),this}subWorldDraw(t){const e=this.startPoint,i=this.endPoint,n=[new b(e.x,e.y,0),new b(i.x,i.y,0)];return t.lines(n)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLine"),t.writePoint3d(10,this.startPoint),t.writePoint3d(11,this.endPoint),this}};cr.typeName="Line";let Os=cr;const dr=class dr extends ut{get dxfTypeName(){return"MTEXT"}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 b,this._attachmentPoint=rt.TopLeft,this._direction=new f(1,0,0),this._drawingDirection=se.LEFT_TO_RIGHT}get contents(){return this._contents}set contents(t){this._contents=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get lineSpacingFactor(){return this._lineSpacingFactor}set lineSpacingFactor(t){this._lineSpacingFactor=t}get lineSpacingStyle(){return this._lineSpacingStyle}set lineSpacingStyle(t){this._lineSpacingStyle=t}get backgroundFill(){return this._backgroundFill}set backgroundFill(t){this._backgroundFill=t,this._backgroundFillColor=13158600}get backgroundFillColor(){return this._backgroundFillColor}set backgroundFillColor(t){this._backgroundFillColor=t}get backgroundFillTransparency(){return this._backgroundFillTransparency}set backgroundFillTransparency(t){this._backgroundFillTransparency=t}get backgroundScaleFactor(){return this._backgroundScaleFactor}set backgroundScaleFactor(t){this._backgroundScaleFactor=t}get styleName(){return this._styleName}set styleName(t){this._styleName=t}get location(){return this._location}set location(t){this._location.copy(t)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get direction(){return this._direction}set direction(t){this._direction.copy(t)}get drawingDirection(){return this._drawingDirection}set drawingDirection(t){this._drawingDirection=t}get geometricExtents(){return new F}subGetOsnapPoints(t,e,i,n){z.Insertion===t&&n.push(this._location)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"text",properties:[{name:"contents",type:"string",editable:!0,accessor:{get:()=>this.contents,set:t=>{this.contents=t}}},{name:"styleName",type:"string",editable:!0,accessor:{get:()=>this.styleName,set:t=>{this.styleName=t}}},{name:"attachmentPoint",type:"enum",editable:!0,options:[{label:rt[1],value:1},{label:rt[2],value:2},{label:rt[3],value:3},{label:rt[4],value:4},{label:rt[5],value:5},{label:rt[6],value:6},{label:rt[7],value:7},{label:rt[8],value:8},{label:rt[9],value:9}],accessor:{get:()=>this.attachmentPoint,set:t=>{this.attachmentPoint=t}}},{name:"drawingDirection",type:"enum",editable:!0,options:[{label:se[1],value:1},{label:se[2],value:2},{label:se[3],value:3},{label:se[4],value:4},{label:se[5],value:5}],accessor:{get:()=>this.drawingDirection,set:t=>{this.drawingDirection=t}}},{name:"textHeight",type:"float",editable:!0,accessor:{get:()=>this.height,set:t=>{this.height=t}}},{name:"rotation",type:"float",editable:!0,accessor:{get:()=>this.rotation,set:t=>{this.rotation=t}}},{name:"lineSpacingFactor",type:"float",editable:!0,accessor:{get:()=>this.lineSpacingFactor,set:t=>{this.lineSpacingFactor=t}}},{name:"definedWidth",type:"float",editable:!0,accessor:{get:()=>this.width,set:t=>{this.width=t}}},{name:"directionX",type:"float",editable:!0,accessor:{get:()=>this.direction.x,set:t=>{this.direction.x=t}}},{name:"directionY",type:"float",editable:!0,accessor:{get:()=>this.direction.y,set:t=>{this.direction.y=t}}},{name:"directionZ",type:"float",editable:!0,accessor:{get:()=>this.direction.z,set:t=>{this.direction.z=t}}}]},{groupName:"geometry",properties:[{name:"locationX",type:"float",editable:!0,accessor:{get:()=>this.location.x,set:t=>{this.location.x=t}}},{name:"locationY",type:"float",editable:!0,accessor:{get:()=>this.location.y,set:t=>{this.location.y=t}}},{name:"locationZ",type:"float",editable:!0,accessor:{get:()=>this.location.z,set:t=>{this.location.z=t}}}]}]}}getTextStyle(){const t=this.database.tables.textStyleTable;let e=t.getAt(this.styleName);return e||(e=t.getAt(Y)||t.getAt(Y)),e.textStyle}subWorldDraw(t,e){const i={text:this.contents,height:this.height,width:this.width,position:this.location,rotation:this.rotation,directionVector:this.direction,attachmentPoint:this.attachmentPoint,drawingDirection:this.drawingDirection,lineSpaceFactor:this.lineSpacingFactor};return t.mtext(i,this.getTextStyle(),e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbMText"),t.writePoint3d(10,this.location),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writeString(1,this.contents),t.writeString(7,this.styleName),t.writeAngle(50,this.rotation),t.writeVector3d(11,this.direction),t.writeInt16(71,this.attachmentPoint),t.writeInt16(72,this.drawingDirection),t.writeInt16(73,this.lineSpacingStyle),t.writeDouble(44,this.lineSpacingFactor),this.backgroundFill&&(t.writeInt16(90,1),t.writeInt32(63,this.backgroundFillColor),t.writeInt32(441,this.backgroundFillTransparency),t.writeDouble(45,this.backgroundScaleFactor)),this}};dr.typeName="MText";let Ns=dr;const ur=class ur extends pt{get dxfTypeName(){return"SPLINE"}constructor(t,e,i,n,r){super();const a=+(t!==void 0)+ +(e!==void 0)+ +(i!==void 0)+ +(n!==void 0)+ +(r!==void 0);if(a<2||a>5)throw gt.ILLEGAL_PARAMETERS;!Array.isArray(e)?this._geo=new Lt(t,e,i,n):this._geo=new Lt(t,e,i,n,r)}get geometricExtents(){return this._geo.box}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:n.push(this._geo.startPoint),n.push(this._geo.endPoint);break}}subWorldDraw(t){const e=this._geo.getPoints(100);return t.lines(e)}dxfOutFields(t){var i;const e=this._geo;super.dxfOutFields(t),t.writeSubclassMarker("AcDbSpline"),t.writeInt16(70,this.closed?1:0),t.writeInt16(71,e.degree),t.writeInt16(72,e.knots.length),t.writeInt16(73,e.controlPoints.length),t.writeInt16(74,((i=e.fitPoints)==null?void 0:i.length)??0);for(const n of e.knots)t.writeDouble(40,n);for(const n of e.weights)t.writeDouble(41,n);for(const n of e.controlPoints)t.writePoint3d(10,n);for(const n of e.fitPoints??[])t.writePoint3d(11,n);return this}};ur.typeName="Spline";let Cs=ur;const Al=new f,pr=class pr extends Qe{get dxfTypeName(){return"ACAD_TABLE"}constructor(t,e,i){super(t),this._attachmentPoint=rt.TopLeft,this._numColumns=i,this._numRows=e,this._columnWidth=new Array(i),this._rowHeight=new Array(e),this._cells=new Array(e*i)}get attachmentPoint(){return this._attachmentPoint}set attachmentPoint(t){this._attachmentPoint=t}get numRows(){return this._numRows}set numRows(t){this._numRows=t}get numColumns(){return this._numColumns}set numColumns(t){this._numColumns=t}numContents(t,e){return 1}rowHeight(t){return this._rowHeight[t]}setRowHeight(t,e){this._rowHeight[t]=e}setUniformRowHeight(t){this._rowHeight.fill(t)}columnWidth(t){return this._columnWidth[t]}setUniformColumnWidth(t){this._columnWidth.fill(t)}setColumnWidth(t,e){this._columnWidth[t]=e}cell(t){if(!(t<0||t>=this._cells.length))return this._cells[t]}setCell(t,e){this._cells[t]=e}textString(t,e,i){var r;const n=t*this._numColumns+e;return(r=this._cells[n])==null?void 0:r.text}setTextString(t,e,i){const n=t*this._numColumns+e;if(!this._cells[n]){this._cells[n]={text:i,attachmentPoint:this._attachmentPoint,cellType:1,textHeight:0};return}this._cells[n].text=i}isEmpty(t,e){var n;const i=t*this._numColumns+e;return!((n=this._cells[i])!=null&&n.text)}get geometricExtents(){return new F}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"table",properties:[{name:"numRows",type:"string",editable:!0,accessor:{get:()=>this.numRows,set:t=>{this.numRows=t}}},{name:"numColumns",type:"float",editable:!0,accessor:{get:()=>this.numColumns,set:t=>{this.numColumns=t}}},{name:"tableWidth",type:"float",editable:!1,accessor:{get:()=>this._columnWidth.reduce((t,e)=>t+e,0)}},{name:"tableHeight",type:"float",editable:!1,accessor:{get:()=>this._rowHeight.reduce((t,e)=>t+e,0)}}]},{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}subWorldDraw(t){let e=0,i=0;const n=new Uint16Array(this.numColumns*this.numRows*8),r=new Float32Array((this.numColumns+1)*(this.numRows+1)*3);let a=0;for(let m=0;m<=this.numRows;m++){e-=m>0?this.rowHeight(m-1):0,i=0;for(let u=0;u<=this.numColumns;u++)i+=u>0?this.columnWidth(u-1):0,r[a++]=i,r[a++]=e,r[a++]=0}const o=[],l=new Array(this.numRows*this.numColumns).fill(!1);i=0,a=0;let c=0;for(let m=0;m<this.numColumns;m++){i+=m>0?this.columnWidth(m-1):0,e=0;for(let u=0;u<this.numRows;u++){e+=u>0?this.rowHeight(u-1):0;const g=this.cell(u*this.numColumns+m);if(c=u*this.numColumns+m,g&&!l[c]){const y=g.borderWidth??1,x=g.borderHeight??1;this.fillVisited(l,c,this.numColumns,y,x),n[a++]=m+u*(this.numColumns+1),n[a++]=m+u*(this.numColumns+1)+y;const w=r[n[a-1]*3]-i,P=m+(u+x)*(this.numColumns+1)+y;m+y==this.numColumns&&(n[a++]=m+u*(this.numColumns+1)+y,n[a++]=P);const I=-r[P*3+1]-e;if(u+x==this.numRows&&(n[a++]=m+(u+x)*(this.numColumns+1)+x,n[a++]=m+(u+x)*(this.numColumns+1)),n[a++]=m+(u+x)*(this.numColumns+1),n[a++]=m+u*(this.numColumns+1),g.text){const k=g.attachmentPoint||this.attachmentPoint||rt.MiddleCenter,A=this.getTableTextOffset(k,w,I),j={text:g.text,height:g.textHeight,width:w,position:Al.set(i,-e,0).clone().add(A),rotation:this.rotation,attachmentPoint:k},T=this.getTextStyle(g);o.push(t.mtext(j,T))}}}}o.push(t.lineSegments(r,3,n));const d=t.group(o),p=new Ge;return p.setFromAxisAngle(f.Z_AXIS,this.rotation),Dr.compose(this.position,p,this.scaleFactors),d.applyMatrix(Dr),d}fillVisited(t,e,i,n,r){if(r==1&&n==1)t[e]=!0;else for(let a=0;a<n;++a)for(let o=0;o<r;++o)t[e+a+o*i]=!0}getTextStyle(t){const e=this.database.tables.textStyleTable;let i;return t.textStyle&&(i=e.getAt(t.textStyle)),i||(i=e.getAt(Y)||e.getAt(Y)),i.textStyle}getTableTextOffset(t,e,i){const n=new f;switch(t){case 1:break;case 2:n.setX(e/2);break;case 3:n.setX(e);break;case 4:n.setY(-i/2);break;case 5:n.set(e/2,-i/2,0);break;case 6:n.set(e,-i/2,0);break;case 7:n.setY(-i);break;case 8:n.set(e/2,-i,0);break;case 9:n.set(e,-i,0);break}return n}dxfOutFields(t){var r,a,o,l,c,d,p;super.dxfOutFields(t),t.writeSubclassMarker("AcDbTable");const e=t.version??((r=t.database)==null?void 0:r.version)??((a=this.database)==null?void 0:a.version),i=(e==null?void 0:e.value)!=null?e.value>=27:!1;t.writeInt16(280,this.tableDataVersion),t.writeObjectId(342,this.tableStyleId),t.writeObjectId(343,this.owningBlockRecordId),t.writeVector3d(11,this.horizontalDirection),t.writeUInt32(90,this.tableValueFlag),t.writeUInt32(93,this.tableOverrideFlag),t.writeUInt32(94,this.borderColorOverrideFlag),t.writeUInt32(95,this.borderLineweightOverrideFlag),t.writeUInt32(96,this.borderVisibilityOverrideFlag),t.writeInt16(71,this.attachmentPoint),t.writeInt32(91,this.numRows),t.writeInt32(92,this.numColumns);for(let m=0;m<this.numRows;++m)t.writeDouble(141,this.rowHeight(m));for(let m=0;m<this.numColumns;++m)t.writeDouble(142,this.columnWidth(m));const n=this._cells.length>0?this._cells.length:this.numRows*this.numColumns;for(let m=0;m<n;m++){const u=this._cells[m],g=(u==null?void 0:u.cellType)??(u!=null&&u.blockTableRecordId?2:1);if(t.writeInt16(171,g),t.writeInt16(172,(u==null?void 0:u.flagValue)??0),t.writeInt16(173,(u==null?void 0:u.mergedValue)??0),t.writeBoolean(174,u==null?void 0:u.autoFit),t.writeInt16(175,u==null?void 0:u.borderWidth),t.writeInt16(176,u==null?void 0:u.borderHeight),(u==null?void 0:u.overrideFlag)!=null&&(i?t.writeInt32(91,u.overrideFlag):t.writeInt16(177,u.overrideFlag)),t.writeInt16(178,u==null?void 0:u.virtualEdgeFlag),t.writeAngle(145,u==null?void 0:u.rotation),i&&t.writeInt16(92,u==null?void 0:u.extendedCellFlags),g===1)u!=null&&u.fieldObjetId?t.writeObjectId(344,u.fieldObjetId):this.writeCellText(t,(u==null?void 0:u.text)??"",i,u==null?void 0:u.cellValueBlockBegin);else if(g===2){if(t.writeObjectId(340,u==null?void 0:u.blockTableRecordId),t.writeDouble(144,u==null?void 0:u.blockScale),t.writeInt16(179,u==null?void 0:u.blockAttrNum),(o=u==null?void 0:u.attrDefineId)!=null&&o.length)for(const y of u.attrDefineId)t.writeObjectId(331,y);if((u==null?void 0:u.attrText)!=null)if(Array.isArray(u.attrText))for(const y of u.attrText)t.writeString(300,y);else t.writeString(300,u.attrText)}u!=null&&u.textStyle&&t.writeString(7,u.textStyle),(u==null?void 0:u.textHeight)!=null&&t.writeDouble(140,u.textHeight),(u==null?void 0:u.attachmentPoint)!=null&&t.writeInt16(170,u.attachmentPoint),(u==null?void 0:u.topBorderVisibility)!=null&&t.writeInt16(289,u.topBorderVisibility?1:0),(u==null?void 0:u.rightBorderVisibility)!=null&&t.writeInt16(285,u.rightBorderVisibility?1:0),(u==null?void 0:u.bottomBorderVisibility)!=null&&t.writeInt16(286,u.bottomBorderVisibility?1:0),(u==null?void 0:u.leftBorderVisibility)!=null&&t.writeInt16(288,u.leftBorderVisibility?1:0)}if(t.writeInt16(70,this.flowDirection),t.writeDouble(40,this.horizontalCellMargin),t.writeDouble(41,this.verticalCellMargin),this.suppressTitle!=null&&t.writeInt16(280,this.suppressTitle?1:0),this.suppressHeader!=null&&t.writeInt16(281,this.suppressHeader?1:0),(l=this.cellTypeOverrides)!=null&&l.length)for(const m of this.cellTypeOverrides){t.writeString(7,m.textStyle),t.writeDouble(140,m.textHeight),t.writeInt16(170,m.alignment),t.writeInt16(63,m.backgroundColor),t.writeInt16(64,m.contentColor),m.backgroundColorEnabled!=null&&t.writeInt16(283,m.backgroundColorEnabled?1:0);const u=m.borderLineweights;u&&(t.writeInt16(274,u.top),t.writeInt16(275,u.right),t.writeInt16(276,u.bottom),t.writeInt16(277,u.left),t.writeInt16(278,u.insideHorizontal),t.writeInt16(279,u.insideVertical));const g=m.borderVisibility;g&&(t.writeInt16(284,g.top?1:0),t.writeInt16(285,g.right?1:0),t.writeInt16(286,g.bottom?1:0),t.writeInt16(287,g.left?1:0),t.writeInt16(288,g.insideHorizontal?1:0),t.writeInt16(289,g.insideVertical?1:0))}if(this.tableBorderColors&&(t.writeInt16(63,this.tableBorderColors.left),t.writeInt16(64,this.tableBorderColors.top),t.writeInt16(65,this.tableBorderColors.insideHorizontal),t.writeInt16(66,this.tableBorderColors.bottom),t.writeInt16(68,this.tableBorderColors.insideVertical),t.writeInt16(69,this.tableBorderColors.right)),(c=this.rowDataTypes)!=null&&c.length)for(const m of this.rowDataTypes)t.writeInt16(97,m);if((d=this.rowUnitTypes)!=null&&d.length)for(const m of this.rowUnitTypes)t.writeInt16(98,m);if((p=this.rowFormats)!=null&&p.length)for(const m of this.rowFormats)t.writeString(4,m);return this}writeCellText(t,e,i,n){if(!i){if(e.length<=250){t.writeString(1,e);return}const o=Math.ceil(e.length/250);for(let l=0;l<o;l++){const c=l*250,d=c+250,p=e.slice(c,d);l===o-1?t.writeString(1,p):t.writeString(2,p)}return}if(t.writeString(301,n??"CELL_VALUE"),e.length<=250){t.writeString(302,e),t.writeString(304,"ACVALUE_END");return}const a=Math.ceil(e.length/250);for(let o=0;o<a;o++){const l=o*250,c=l+250,d=e.slice(l,c);o===a-1?t.writeString(302,d):t.writeString(303,d)}t.writeString(304,"ACVALUE_END")}};pr.typeName="Table";let bi=pr;const Dr=new Pt,mr=class mr extends pt{get dxfTypeName(){return"TRACE"}constructor(){super(),this._elevation=0,this._thickness=1,this._vertices=[new b,new b,new b,new b]}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return!0}get thickness(){return this._thickness}set thickness(t){this._thickness=t}getPointAt(t){return t<0?this._vertices[0]:t>3?this._vertices[3]:this._vertices[t]}setPointAt(t,e){if(t<0&&this._vertices[0].copy(e),t>3)return this._vertices[3].copy(e);this._vertices[t].copy(e)}get geometricExtents(){return new F().setFromPoints(this._vertices)}subGetGripPoints(){const t=new Array;return t.push(...this._vertices),t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:n.push(...this._vertices);break}}subWorldDraw(t){const e=new me(this._vertices,!0),i=new vs;i.add(e);const n=t.subEntityTraits;return n.fillType={solidFill:!0,patternAngle:0,definitionLines:[]},t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTrace"),t.writeDouble(38,this.elevation),t.writeDouble(39,this.thickness),t.writePoint3d(10,this.getPointAt(0)),t.writePoint3d(11,this.getPointAt(1)),t.writePoint3d(12,this.getPointAt(2)),t.writePoint3d(13,this.getPointAt(3)),this}};mr.typeName="Trace";let fi=mr;const gr=class gr extends pt{get dxfTypeName(){return"LWPOLYLINE"}constructor(){super(),this._elevation=0,this._geo=new me}get numberOfVertices(){return this._geo.numberOfVertices}get elevation(){return this._elevation}set elevation(t){this._elevation=t}get closed(){return this._geo.closed}set closed(t){this._geo.closed=t}addVertexAt(t,e,i=0,n=-1,r=-1){const a=n<0?void 0:n,o=r<0?void 0:r,l={x:e.x,y:e.y,bulge:i,startWidth:a,endWidth:o};this._geo.addVertexAt(t,l)}removeVertexAt(t){this._geo.removeVertexAt(t)}reset(t,e){this._geo.reset(t,e)}getPoint2dAt(t){return this._geo.getPointAt(t)}getPoint3dAt(t){const e=this.getPoint2dAt(t);return new b(e.x,e.y,this._elevation)}get geometricExtents(){const t=this._geo.box;return new F({x:t.min.x,y:t.min.y,z:this._elevation},{x:t.max.x,y:t.max.y,z:this._elevation})}subGetGripPoints(){const t=new Array;for(let e=0;e<this.numberOfVertices;++e)t.push(this.getPoint3dAt(e));return t}subGetOsnapPoints(t,e,i,n){const r=new Array;for(let a=0;a<this.numberOfVertices;++a)r.push(this.getPoint3dAt(a));switch(t){case z.EndPoint:n.push(...r);break}}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"vertices",type:"array",editable:!1,itemSchema:{properties:[{name:"x",type:"float",editable:!0},{name:"y",type:"float",editable:!0}]},accessor:{get:()=>this._geo.vertices}},{name:"elevation",type:"float",editable:!0,accessor:{get:()=>this.elevation,set:t=>{this.elevation=t}}},{name:"length",type:"float",editable:!1,accessor:{get:()=>this._geo.length}}]},{groupName:"others",properties:[{name:"closed",type:"float",editable:!0,accessor:{get:()=>this.closed,set:t=>{this.closed=t}}}]}]}}subWorldDraw(t){const e=[];return this._geo.getPoints(100).forEach(n=>e.push(new b().set(n.x,n.y,this.elevation))),t.lines(e)}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPolyline"),t.writeInt32(90,this.numberOfVertices),t.writeInt16(70,this.closed?1:0),t.writeDouble(38,this.elevation);for(let e=0;e<this.numberOfVertices;++e)t.writePoint2d(10,this.getPoint2dAt(e));return this}};gr.typeName="Polyline";let Ii=gr;const yr=class yr extends ut{get dxfTypeName(){return"POINT"}constructor(){super(),this._geo=new b}get position(){return this._geo}set position(t){this._geo.set(t.x,t.y,t.z||0)}get geometricExtents(){return new F().expandByPoint(this._geo)}subGetOsnapPoints(t,e,i,n){z.Node===t&&n.push(this._geo)}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"positionX",type:"float",editable:!0,accessor:{get:()=>this.position.x,set:t=>{this.position.x=t}}},{name:"positionY",type:"float",editable:!0,accessor:{get:()=>this.position.y,set:t=>{this.position.y=t}}},{name:"positionZ",type:"float",editable:!0,accessor:{get:()=>this.position.z,set:t=>{this.position.z=t}}}]}]}}transformBy(t){return this._geo.applyMatrix4(t),this}subWorldDraw(t){return t.point(this._geo,{displayMode:this.database.pdmode,displaySize:this.database.pdsize})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbPoint"),t.writePoint3d(10,this.position),this}};yr.typeName="Point";let Si=yr;var to=(s=>(s[s.Invalid=0]="Invalid",s[s.Rect=1]="Rect",s[s.Poly=2]="Poly",s))(to||{}),eo=(s=>(s[s.Show=1]="Show",s[s.ShowUnAligned=2]="ShowUnAligned",s[s.Clip=4]="Clip",s[s.Transparent=8]="Transparent",s))(eo||{});const _r=class _r extends ut{get dxfTypeName(){return"IMAGE"}constructor(){super(),this._brightness=50,this._contrast=50,this._fade=0,this._width=0,this._height=0,this._position=new b,this._scale=new U(1,1),this._rotation=0,this._imageSize=new O,this._clipBoundaryType=1,this._clipBoundary=[],this._isClipped=!1,this._isShownClipped=!1,this._isImageShown=!0,this._isImageTransparent=!1,this._imageDefId=""}get brightness(){return this._brightness}set brightness(t){this._brightness=t}get contrast(){return this._contrast}set contrast(t){this._contrast=t}get fade(){return this._fade}set fade(t){this._fade=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get position(){return this._position}set position(t){this._position=t}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get scale(){return this._scale}set scale(t){this._scale.copy(t)}get imageSize(){return this._imageSize}set imageSize(t){this._imageSize.copy(t)}get clipBoundaryType(){return this._clipBoundaryType}set clipBoundaryType(t){this._clipBoundaryType=t}get clipBoundary(){return this._clipBoundary}set clipBoundary(t){this._clipBoundary=[],this._clipBoundary.push(...t)}get isClipped(){return this._isClipped}set isClipped(t){this._isClipped=t}get isShownClipped(){return this._isShownClipped}set isShownClipped(t){this._isShownClipped=t}get isImageShown(){return this._isImageShown}set isImageShown(t){this._isImageShown=t}get isImageTransparent(){return this._isImageTransparent}set isImageTransparent(t){this._isImageTransparent=t}get image(){return this._image}set image(t){this._image=t}get imageDefId(){return this._imageDefId}set imageDefId(t){this._imageDefId=t}get imageFileName(){if(this._imageDefId){const t=this.database.objects.imageDefinition.getIdAt(this._imageDefId);if(t)return t.sourceFileName}return""}get geometricExtents(){const t=new F;return t.min.copy(this._position),t.max.set(this._position.x+this._width,this._position.y+this._height,0),t}subGetGripPoints(){return this.boundaryPath()}subWorldDraw(t){const e=this.boundaryPath();return this._image?t.image(this._image,{boundary:e,roation:this._rotation}):t.lines(e)}boundaryPath(){const t=[];if(this.isClipped&&this._clipBoundary.length>3){const e=this._width,i=this._height,n=new dt;n.setFromPoints(this._clipBoundary);const r=new O;r.setX(this._position.x-n.min.x*e),r.setY(this._position.y-n.min.y*i),this._clipBoundary.forEach(a=>{const o=a.x*e+r.x,l=a.y*i+r.y;t.push(new b(o,l,this._position.z))})}else{if(t.push(this._position),t.push(this._position.clone().setX(this._position.x+this._width)),t.push(this._position.clone().set(this._position.x+this._width,this._position.y+this._height,this._position.z)),t.push(this._position.clone().setY(this._position.y+this._height)),this._rotation>0){jr.copy(t[1]);for(let e=1;e<4;e++)Qs.copy(t[e]),Qs.rotateAround(jr,this._rotation),t[e].setX(Qs.x),t[e].setY(Qs.y)}t.push(t[0])}return t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImage"),t.writePoint3d(10,this.position);const e=this.width*this.scale.x,i=this.height*this.scale.y,n=this._imageSize.x>0&&this._imageSize.y>0?this._imageSize:{x:e,y:i},r=n.x>0?e/n.x:e,a=n.y>0?i/n.y:i,o=Math.cos(this._rotation),l=Math.sin(this._rotation);t.writePoint3d(11,{x:r*o,y:r*l,z:0}),t.writePoint3d(12,{x:-a*l,y:a*o,z:0}),t.writePoint2d(13,n),t.writeObjectId(340,this.imageDefId);const c=(this.isImageShown?1:0)|(this.isShownClipped?4:0)|(this.isImageTransparent?8:0);if(t.writeInt16(70,c),t.writeInt16(280,this.isClipped?1:0),t.writeInt16(281,this.brightness),t.writeInt16(282,this.contrast),t.writeInt16(283,this.fade),t.writeInt16(71,this.clipBoundaryType),this.isClipped){t.writeInt16(91,this.clipBoundary.length);for(const d of this.clipBoundary)t.writePoint2d(14,d)}return this}};_r.typeName="RasterImage";let Fs=_r;const jr=new O,Qs=new O,wr=class wr extends pt{get dxfTypeName(){return"RAY"}constructor(){super(),this._basePoint=new b,this._unitDir=new f}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new F;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subGetOsnapPoints(t,e,i,n){switch(t){case z.EndPoint:n.push(this.basePoint);break}}subWorldDraw(t){const e=[];return e.push(this.basePoint),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRay"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}};wr.typeName="Ray";let Ei=wr;const xr=class xr extends ut{get dxfTypeName(){return"VIEWPORT"}constructor(){super(),this._centerPoint=new b,this._height=0,this._width=0,this._viewCenter=new b,this._viewHeight=0,this._number=-1}get number(){return this._number}set number(t){this._number=t}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint=t}get height(){return this._height}set height(t){this._height=t}get width(){return this._width}set width(t){this._width=t}get viewCenter(){return this._viewCenter}set viewCenter(t){this._viewCenter=t}get viewHeight(){return this._viewHeight}set viewHeight(t){this._viewHeight=t}get geometricExtents(){return new F}subWorldDraw(t){if(this._number>1&&this.ownerId!=this.database.tables.blockTable.modelSpace.objectId){const e=this.toGiViewport();return t.group(this.createViewportRect(e,t))}}toGiViewport(){const t=new Xa;return t.id=this.objectId,t.groupId=this.ownerId,t.number=this.number,t.centerPoint=this.centerPoint,t.width=this.width,t.height=this.height,t.viewHeight=this.viewHeight,t.viewCenter=this.viewCenter,t}createViewportRect(t,e){const i=[];return i.push(e.lines([new b(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0),new b(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0)])),i.push(e.lines([new b(t.centerPoint.x+t.width/2,t.centerPoint.y-t.height/2,0),new b(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new b(t.centerPoint.x+t.width/2,t.centerPoint.y+t.height/2,0),new b(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0)])),i.push(e.lines([new b(t.centerPoint.x-t.width/2,t.centerPoint.y+t.height/2,0),new b(t.centerPoint.x-t.width/2,t.centerPoint.y-t.height/2,0)])),i}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewport"),t.writePoint3d(10,this.centerPoint),t.writeDouble(40,this.height),t.writeDouble(41,this.width),t.writePoint3d(12,this.viewCenter),t.writeDouble(45,this.viewHeight),t.writeInt32(69,this.number),this}};xr.typeName="Viewport";let Pi=xr;const br=class br extends Fs{get dxfTypeName(){return"WIPEOUT"}subWorldDraw(t){const e=this.boundaryPath(),i=new vs;return i.add(new me(e)),t.area(i)}dxfOutFields(t){return super.dxfOutFields(t),this}};br.typeName="Wipeout";let Ai=br;const fr=class fr extends pt{get dxfTypeName(){return"XLINE"}constructor(){super(),this._basePoint=new b,this._unitDir=new f}get basePoint(){return this._basePoint}set basePoint(t){this._basePoint.copy(t)}get unitDir(){return this._unitDir}set unitDir(t){this._unitDir.copy(t)}get closed(){return!1}get geometricExtents(){const t=new F;return t.expandByPoint(this._unitDir.clone().multiplyScalar(10).add(this._basePoint)),t.expandByPoint(this._unitDir.clone().multiplyScalar(-10).add(this._basePoint)),t}get properties(){return{type:this.type,groups:[this.getGeneralProperties(),{groupName:"geometry",properties:[{name:"basePointX",type:"float",editable:!0,accessor:{get:()=>this.basePoint.x,set:t=>{this.basePoint.x=t}}},{name:"basePointY",type:"float",editable:!0,accessor:{get:()=>this.basePoint.y,set:t=>{this.basePoint.y=t}}},{name:"basePointZ",type:"float",editable:!0,accessor:{get:()=>this.basePoint.z,set:t=>{this.basePoint.z=t}}},{name:"unitDirX",type:"float",editable:!0,accessor:{get:()=>this.unitDir.x,set:t=>{this.unitDir.x=t}}},{name:"unitDirY",type:"float",editable:!0,accessor:{get:()=>this.unitDir.y,set:t=>{this.unitDir.y=t}}},{name:"unitDirZ",type:"float",editable:!0,accessor:{get:()=>this.unitDir.z,set:t=>{this.unitDir.z=t}}}]}]}}subGetGripPoints(){const t=new Array;return t.push(this.basePoint),t}subWorldDraw(t){const e=[];return e.push(this._unitDir.clone().multiplyScalar(-1e6).add(this._basePoint)),e.push(this._unitDir.clone().multiplyScalar(1e6).add(this._basePoint)),t.lines(e)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXline"),t.writePoint3d(10,this.basePoint),t.writeVector3d(11,this.unitDir),this}};fr.typeName="Xline";let Ti=fr;var so=(s=>(s[s.AtLeast=1]="AtLeast",s[s.Exactly=2]="Exactly",s))(so||{});const Ir=class Ir extends ut{get dxfTypeName(){return"DIMENSION"}constructor(){super(),this._dimBlockId=null,this._dimBlockPosition=new b,this._dimensionStyleName=null,this._dimensionText=null,this._textLineSpacingFactor=1,this._textLineSpacingStyle=1,this._textPosition=new b,this._textRotation=0,this._normal=new f(0,0,1)}get dimBlockId(){return this._dimBlockId}set dimBlockId(t){this._dimBlockId=t}get dimBlockPosition(){return this._dimBlockPosition}set dimBlockPosition(t){this._dimBlockPosition.copy(t)}get dimensionStyleName(){return this._dimensionStyleName}set dimensionStyleName(t){this._dimensionStyleName=t}get dimensionStyle(){if(this._dimStyle==null){let t;this.dimensionStyleName&&(t=this.database.tables.dimStyleTable.getAt(this.dimensionStyleName)),t==null&&(t=new We),this._dimStyle=t}return this._dimStyle}get dimensionText(){return this._dimensionText}set dimensionText(t){this._dimensionText=t}get measurement(){return this._measurement}set measurement(t){this._measurement=t}get textLineSpacingFactor(){return this._textLineSpacingFactor}set textLineSpacingFactor(t){this._textLineSpacingFactor=t}get textLineSpacingStyle(){return this._textLineSpacingStyle}set textLineSpacingStyle(t){this._textLineSpacingStyle=t}get textPosition(){return this._textPosition}set textPosition(t){this._textPosition.copy(t)}get textRotation(){return this._textRotation}set textRotation(t){this._textRotation=t}get normal(){return this._normal}set normal(t){this._normal.copy(t).normalize()}subWorldDraw(t){if(this.dimBlockId){const i=this.database.tables.blockTable.getAt(this.dimBlockId);if(i){const n=this.computeDimBlockTransform();return Je.instance.draw(t,i,this.rgbColor,[],!1,n,this._normal)}}return t.group([])}get arrowScaleFactor(){return this.dimensionStyle.dimasz}get firstArrowStyle(){return{type:this.firstArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse1==0}}get secondArrowStyle(){return{type:this.secondArrowType,scale:this.arrowScaleFactor,appended:this.isAppendArrow,visible:this.dimensionStyle.dimse2==0}}get isAppendArrow(){return!0}get firstArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk1}get firstArrowType(){const t=this.firstArrowTypeBtrId;return this.getArrowName(t)}get secondArrowTypeBtrId(){const t=this.dimensionStyle;return t.dimsah==0?t.dimblk:t.dimblk2}get secondArrowType(){const t=this.secondArrowTypeBtrId;return this.getArrowName(t)}get arrowLineCount(){return 1}getLineArrowStyle(t){}findPointOnLine1(t,e,i){const n=new b().subVectors(e,t).normalize();return new b(e).addScaledVector(n,i)}findPointOnLine2(t,e,i){const n=t.x+i*Math.cos(e),r=t.y+i*Math.sin(e);return{x:n,y:r}}adjustExtensionLine(t){const e=this.dimensionStyle;t.extend(e.dimexe),t.extend(-e.dimexo,!0)}getArrowName(t){const e=this.database.tables.blockTable.getIdAt(t);return e?e.name.toUpperCase():Bn.Closed}computeDimBlockTransform(){const t=this.dimBlockId?this.database.tables.blockTable.getAt(this.dimBlockId):void 0,e=(t==null?void 0:t.origin)??b.ORIGIN,i=new Pt().makeTranslation(-e.x,-e.y,-e.z),n=new Pt().makeTranslation(this._dimBlockPosition.x,this._dimBlockPosition.y,this._dimBlockPosition.z);return new Pt().multiplyMatrices(n,i)}dxfOutFields(t){super.dxfOutFields(t);const e=this.dimensionStyleName!=null?this.database.tables.dimStyleTable.getAt(this.dimensionStyleName):void 0;return t.writeSubclassMarker("AcDbDimension"),t.writeString(3,this.dimensionStyleName??this.dimensionStyle.name),t.writePoint3d(10,this.dimBlockPosition),t.writeString(1,this.dimensionText??""),t.writeAngle(53,this.textRotation),t.writePoint3d(11,this.textPosition),t.writeInt16(70,0),t.writeVector3d(210,this.normal),t.writeObjectId(340,e==null?void 0:e.objectId),this}};Ir.typeName="Dimension";let ie=Ir;const Sr=class Sr extends ie{constructor(t,e,i,n,r=null,a=null){super(),this._centerPoint=new b().copy(t),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(i),this._arcPoint=new b().copy(n),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new F}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDb3PointAngularDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Sr.typeName="3PointAngularDimension";let Mi=Sr;const Er=class Er extends ie{constructor(t,e,i,n=null,r=null){super(),this._dimLinePoint=new b().copy(i),this._xLine1Point=new b().copy(t),this._xLine2Point=new b().copy(e),this._oblique=0,this._rotation=0,this.calculateRotation(),n?this.dimensionText=n:this.dimensionText=this._xLine1Point.distanceTo(this._xLine2Point).toFixed(3),this.dimensionStyleName=r}get dimLinePoint(){return this._dimLinePoint}set dimLinePoint(t){this._dimLinePoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get rotation(){return this._rotation}set rotation(t){this._rotation=t}get oblique(){return this._oblique}set oblique(t){this._oblique=t}get geometricExtents(){return new F}get isAppendArrow(){return!1}createDimBlock(t){const e=new Z;e.name=t;const i=this.createLines();i.forEach(o=>e.appendEntity(new Os(o.startPoint,o.endPoint))),this.createArrows(i[0]).forEach(o=>e.appendEntity(o));const r=i[0].midPoint,a=this.createMText(r,this._rotation);return a&&e.appendEntity(a),e}createMText(t,e){const i=n=>({x:Math.cos(n),y:Math.sin(n),z:0});if(this.dimensionText){const n=new Ns;return n.attachmentPoint=rt.MiddleLeft,n.layer="0",n.color=new J(E.ByBlock),n.location=t,n.contents=this.dimensionText??"",n.height=10,n.direction=i(e),n.styleName=this.dimensionStyle.dimtxsty,n}}createArrows(t){const e=[];return e.push(this.createArrow(t.startPoint,this.rotation+Math.PI,10)),e.push(this.createArrow(t.endPoint,this.rotation,10)),e}createArrow(t,e,i){const n="_CAXARROW",r=new Qe(n);return r.position=t,r.rotation=e,r.scaleFactors={x:i,y:i,z:i},r}createLines(){const t=[],e=this.createExtensionLine(this._xLine1Point),i=this.createExtensionLine(this._xLine2Point),n=this.findIntersectionPoint(e,this._dimLinePoint),r=this.findIntersectionPoint(i,this._dimLinePoint),a=new ue(n,r);return t.push(a),e.endPoint=n,this.adjustExtensionLine(e),t.push(e),i.endPoint=r,this.adjustExtensionLine(i),t.push(i),t}createExtensionLine(t){const e=this.rotation+Math.PI/2,i=this.findPointOnLine2(t,e,100);return new ue(t,{...i,z:t.z})}findIntersectionPoint(t,e){const i=t.startPoint,n=t.endPoint,r=new f().subVectors(n,i).normalize(),o=new f().subVectors(e,i).dot(r),l=new f().copy(r).multiplyScalar(o);return new f().addVectors(i,l)}calculateRotation(){const t=this._xLine1Point,e=this._xLine2Point,i=e.x-t.x,n=e.y-t.y;this._rotation=Math.atan2(n,i)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbAlignedDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.dimLinePoint),t.writeAngle(50,this.rotation),t.writeAngle(52,this.oblique),this}};Er.typeName="AlignedDimension";let vi=Er;const Pr=class Pr extends ie{constructor(t,e,i,n,r=null,a=null){super(),this._arcPoint=new b().copy(n),this._xLine1Point=new b().copy(e),this._xLine2Point=new b().copy(i),this._centerPoint=new b().copy(t),this.dimensionText=r,this.dimensionStyleName=a}get arcPoint(){return this._arcPoint}set arcPoint(t){this._arcPoint.copy(t)}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get xLine1Point(){return this._xLine1Point}set xLine1Point(t){this._xLine1Point.copy(t)}get xLine2Point(){return this._xLine2Point}set xLine2Point(t){this._xLine2Point.copy(t)}get geometricExtents(){return new F}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbArcDimension"),t.writePoint3d(13,this.xLine1Point),t.writePoint3d(14,this.xLine2Point),t.writePoint3d(15,this.centerPoint),t.writePoint3d(16,this.arcPoint),this}};Pr.typeName="ArcDimension";let yn=Pr;const Ar=class Ar extends ie{constructor(t,e,i=0,n=null,r=null){super(),this._chordPoint=new b().copy(t),this._farChordPoint=new b().copy(e),this._extArcStartAngle=0,this._extArcEndAngle=0,this._leaderLength=i,this.dimensionText=n,this.dimensionStyleName=r}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get farChordPoint(){return this._farChordPoint}set farChordPoint(t){this._farChordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}get geometricExtents(){return new F}drawLines(t,e){const i=[],n=e.length;return n==1?i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})):n==3?(this.sortLines(e),i.push(this.drawLine(t,e[0],{firstArrow:this.firstArrowStyle})),i.push(this.drawLine(t,e[1])),i.push(this.drawLine(t,e[2],{firstArrow:this.firstArrowStyle}))):e.forEach(r=>{i.push(this.drawLine(t,r))}),i}drawLine(t,e,i){if(i){const n=[e.startPoint,e.endPoint];return t.lines(n)}else return e.worldDraw(t)}sortLines(t){const e=(i,n)=>i.x!==n.x?i.x-n.x:i.y!==n.y?i.y-n.y:i.z-n.z;t.sort((i,n)=>{const r=e(i.startPoint,n.startPoint);return r!==0?r:e(i.endPoint,n.endPoint)})}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbDiametricDimension"),t.writePoint3d(15,this.chordPoint),t.writePoint3d(16,this.farChordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Ar.typeName="DiametricDimension";let ki=Ar;const Tr=class Tr extends ie{constructor(t,e,i=null,n=null){super(),this._definingPoint=new b().copy(t),this._leaderEndPoint=new b().copy(e),this.dimensionText=i,this.dimensionStyleName=n}get definingPoint(){return this._definingPoint}set definingPoint(t){this._definingPoint.copy(t)}get leaderEndPoint(){return this._leaderEndPoint}set leaderEndPoint(t){this._leaderEndPoint.copy(t)}get geometricExtents(){return new F}get arrowLineCount(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbOrdinateDimension"),t.writePoint3d(13,this.definingPoint),t.writePoint3d(14,this.leaderEndPoint),this}};Tr.typeName="OrdinateDimension";let Li=Tr;const Mr=class Mr extends ie{constructor(t,e,i,n=null,r=null){super(),this._center=new b().copy(t),this._chordPoint=new b().copy(e),this._leaderLength=i,this._extArcStartAngle=0,this._extArcEndAngle=0,this.dimensionText=n,this.dimensionStyleName=r}get center(){return this._center}set center(t){this._center.copy(t)}get chordPoint(){return this._chordPoint}set chordPoint(t){this._chordPoint.copy(t)}get extArcStartAngle(){return this._extArcStartAngle}set extArcStartAngle(t){this._extArcStartAngle=t}get extArcEndAngle(){return this._extArcEndAngle}set extArcEndAngle(t){this._extArcEndAngle=t}get leaderLength(){return this._leaderLength}set leaderLenght(t){this._leaderLength=t}get geometricExtents(){return new F}getLineArrowStyle(t){return{secondArrow:this.secondArrowStyle}}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRadialDimension"),t.writePoint3d(15,this.center),t.writePoint3d(13,this.chordPoint),t.writeDouble(40,this.leaderLength),t.writeAngle(52,this.extArcStartAngle),t.writeAngle(53,this.extArcEndAngle),this}};Mr.typeName="RadialDimension";let Oi=Mr;var io=(s=>(s[s.kInches=0]="kInches",s[s.kMillimeters=1]="kMillimeters",s[s.kPixels=2]="kPixels",s))(io||{}),no=(s=>(s[s.k0degrees=0]="k0degrees",s[s.k90degrees=1]="k90degrees",s[s.k180degrees=2]="k180degrees",s[s.k270degrees=3]="k270degrees",s))(no||{}),ro=(s=>(s[s.kDisplay=0]="kDisplay",s[s.kExtents=1]="kExtents",s[s.kLimits=2]="kLimits",s[s.kView=3]="kView",s[s.kWindow=4]="kWindow",s[s.kLayout=5]="kLayout",s))(ro||{}),le=(s=>(s[s.kDraft=0]="kDraft",s[s.kPreview=1]="kPreview",s[s.kNormal=2]="kNormal",s[s.kPresentation=3]="kPresentation",s[s.kMaximum=4]="kMaximum",s[s.kCustom=5]="kCustom",s))(le||{}),Ye=(s=>(s[s.kAsDisplayed=0]="kAsDisplayed",s[s.kWireframe=1]="kWireframe",s[s.kHidden=2]="kHidden",s[s.kRendered=3]="kRendered",s[s.kVisualStyle=4]="kVisualStyle",s[s.kRenderPreset=5]="kRenderPreset",s))(Ye||{}),ao=(s=>(s[s.kScaleToFit=0]="kScaleToFit",s[s.k1_128in_1ft=1]="k1_128in_1ft",s[s.k1_64in_1ft=2]="k1_64in_1ft",s[s.k1_32in_1ft=3]="k1_32in_1ft",s[s.k1_16in_1ft=4]="k1_16in_1ft",s[s.k3_32in_1ft=5]="k3_32in_1ft",s[s.k1_8in_1ft=6]="k1_8in_1ft",s[s.k3_16in_1ft=7]="k3_16in_1ft",s[s.k1_4in_1ft=8]="k1_4in_1ft",s[s.k3_8in_1ft=9]="k3_8in_1ft",s[s.k1_2in_1ft=10]="k1_2in_1ft",s[s.k3_4in_1ft=11]="k3_4in_1ft",s[s.k1in_1ft=12]="k1in_1ft",s[s.k3in_1ft=13]="k3in_1ft",s[s.k6in_1ft=14]="k6in_1ft",s[s.k1ft_1ft=15]="k1ft_1ft",s[s.k1_1=16]="k1_1",s[s.k1_2=17]="k1_2",s[s.k1_4=18]="k1_4",s[s.k1_5=19]="k1_5",s[s.k1_8=20]="k1_8",s[s.k1_10=21]="k1_10",s[s.k1_16=22]="k1_16",s[s.k1_20=23]="k1_20",s[s.k1_30=24]="k1_30",s[s.k1_40=25]="k1_40",s[s.k1_50=26]="k1_50",s[s.k1_100=27]="k1_100",s[s.k2_1=28]="k2_1",s[s.k4_1=29]="k4_1",s[s.k8_1=30]="k8_1",s[s.k10_1=31]="k10_1",s[s.k100_1=32]="k100_1",s[s.k1000_1=33]="k1000_1",s[s.k1and1_2in_1ft=34]="k1and1_2in_1ft",s))(ao||{});const Tl={0:0,1:1/1536,2:1/768,3:1/384,4:1/192,5:1/128,6:1/96,7:1/64,8:1/48,9:1/32,10:1/24,11:1/16,12:1/12,13:1/4,14:1/2,15:1,16:1,17:1/2,18:1/4,19:1/5,20:1/8,21:1/10,22:1/16,23:1/20,24:1/30,25:1/40,26:1/50,27:1/100,28:2,29:4,30:8,31:10,32:100,33:1e3,34:1/8};class oo extends ne{constructor(t=!1){super(),this._plotSettingsName="",this._plotCfgName="",this._canonicalMediaName="",this._currentStyleSheet="",this._plotOrigin=new O,this._customPrintScale={numerator:1,denominator:1},this._plotPaperSize=new O,this._plotPaperMargins={left:0,right:0,top:0,bottom:0},this._plotViewName="",this._plotWindowArea=new dt,this._modelType=t,this._plotCentered=!1,this._plotHidden=!1,this._plotPaperUnits=1,this._plotPlotStyles=!0,this._plotRotation=0,this._plotType=5,this._plotViewportBorders=!1,this._printLineweights=!0,this._scaleLineweights=!1,this._drawViewportsFirst=!1,this._showPlotStyles=!0,this._shadePlotType=0,this._shadePlotResLevel=2,this._shadePlotCustomDpi=300,this._shadePlotId=void 0,this._stdScaleType=0,this._useStandardScale=!0}get plotSettingsName(){return this._plotSettingsName}set plotSettingsName(t){this._plotSettingsName=t}getPlotSettingsName(){return this._plotSettingsName}setPlotSettingsName(t){this._plotSettingsName=t}get plotCfgName(){return this._plotCfgName}set plotCfgName(t){this._plotCfgName=t}getPlotCfgName(){return this._plotCfgName}get canonicalMediaName(){return this._canonicalMediaName}set canonicalMediaName(t){this._canonicalMediaName=t}getCanonicalMediaName(){return this._canonicalMediaName}get currentStyleSheet(){return this._currentStyleSheet}set currentStyleSheet(t){this._currentStyleSheet=t}getCurrentStyleSheet(){return this._currentStyleSheet}get plotOrigin(){return this._plotOrigin}set plotOrigin(t){this._plotOrigin=t}getPlotOrigin(){return this._plotOrigin}get customPrintScale(){return this._customPrintScale}set customPrintScale(t){this._customPrintScale=t}getCustomPrintScale(){return this._customPrintScale}get plotPaperSize(){return this._plotPaperSize}set plotPaperSize(t){this._plotPaperSize=t}getPlotPaperSize(){return this._plotPaperSize}get plotPaperMargins(){return this._plotPaperMargins}set plotPaperMargins(t){this._plotPaperMargins=t}getPlotPaperMargins(){return this._plotPaperMargins}get plotViewName(){return this._plotViewName}set plotViewName(t){this._plotViewName=t}getPlotViewName(){return this._plotViewName}get plotWindowArea(){return this._plotWindowArea}set plotWindowArea(t){this._plotWindowArea=t}getPlotWindowArea(){return this._plotWindowArea}get modelType(){return this._modelType}set modelType(t){this._modelType=t}getModelType(){return this._modelType}setModelType(t){this._modelType=t}get drawViewportsFirst(){return this._drawViewportsFirst}set drawViewportsFirst(t){this._drawViewportsFirst=t}setDrawViewportsFirst(t){this._drawViewportsFirst=t}get plotCentered(){return this._plotCentered}set plotCentered(t){this._plotCentered=t}setPlotCentered(t){this._plotCentered=t}get plotHidden(){return this._plotHidden}set plotHidden(t){this._plotHidden=t}setPlotHidden(t){this._plotHidden=t}get plotPaperUnits(){return this._plotPaperUnits}set plotPaperUnits(t){this._plotPaperUnits=t}get plotPlotStyles(){return this._plotPlotStyles}set plotPlotStyles(t){this._plotPlotStyles=t}setPlotPlotStyles(t){this._plotPlotStyles=t}get plotRotation(){return this._plotRotation}set plotRotation(t){this._plotRotation=t}get plotType(){return this._plotType}set plotType(t){this._plotType=t}get plotViewportBorders(){return this._plotViewportBorders}set plotViewportBorders(t){this._plotViewportBorders=t}setPlotViewportBorders(t){this._plotViewportBorders=t}get printLineweights(){return this._printLineweights}set printLineweights(t){this._printLineweights=t}setPrintLineweights(t){this._printLineweights=t}get scaleLineweights(){return this._scaleLineweights}set scaleLineweights(t){this._scaleLineweights=t}setScaleLineweights(t){this._scaleLineweights=t}get showPlotStyles(){return this._showPlotStyles}set showPlotStyles(t){this._showPlotStyles=t}setShowPlotStyles(t){this._showPlotStyles=t}get shadePlot(){return this._shadePlotType}set shadePlot(t){this._shadePlotType=t}setShadePlot(t){this._shadePlotType=t}get shadePlotResLevel(){return this._shadePlotResLevel}set shadePlotResLevel(t){this._shadePlotResLevel=t}setShadePlotResLevel(t){this._shadePlotResLevel=t}get shadePlotCustomDPI(){return this._shadePlotCustomDpi}set shadePlotCustomDPI(t){this._shadePlotCustomDpi=t}setShadePlotCustomDPI(t){this._shadePlotCustomDpi=t}get shadePlotId(){return this._shadePlotId}set shadePlotId(t){this._shadePlotId=t}get plotWireframe(){return this._shadePlotType===1}get plotAsRaster(){return this._shadePlotType===3||this._shadePlotType===4||this._shadePlotType===5}get stdScaleType(){return this._stdScaleType}set stdScaleType(t){this._stdScaleType=t}get stdScale(){return Tl[this._stdScaleType]??1}get useStandardScale(){return this._useStandardScale}set useStandardScale(t){this._useStandardScale=t}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbPlotSettings"),t.writeString(1,this.plotSettingsName),t.writeString(2,this.plotCfgName),t.writeString(4,this.canonicalMediaName),t.writeString(6,this.plotViewName),t.writeDouble(40,this.plotPaperMargins.left),t.writeDouble(41,this.plotPaperMargins.bottom),t.writeDouble(42,this.plotPaperMargins.right),t.writeDouble(43,this.plotPaperMargins.top),t.writeDouble(44,this.plotPaperSize.x),t.writeDouble(45,this.plotPaperSize.y),t.writeDouble(46,this.plotOrigin.x),t.writeDouble(47,this.plotOrigin.y),t.writeDouble(48,this.plotWindowArea.min.x),t.writeDouble(49,this.plotWindowArea.min.y),t.writeDouble(140,this.plotWindowArea.max.x),t.writeDouble(141,this.plotWindowArea.max.y),t.writeDouble(142,this.customPrintScale.numerator),t.writeDouble(143,this.customPrintScale.denominator);let e=0;return this.plotViewportBorders&&(e|=1),this.showPlotStyles&&(e|=2),this.plotCentered&&(e|=4),this.plotHidden&&(e|=8),this.useStandardScale&&(e|=16),this.plotPlotStyles&&(e|=32),this.scaleLineweights&&(e|=64),this.printLineweights&&(e|=128),this.drawViewportsFirst&&(e|=512),this.modelType&&(e|=1024),t.writeInt16(70,e),t.writeInt16(72,this.plotPaperUnits),t.writeInt16(73,this.plotRotation),t.writeInt16(74,this.plotType),t.writeString(7,this.currentStyleSheet),t.writeInt16(75,this.stdScaleType),t.writeInt16(76,this.shadePlot),t.writeInt16(77,this.shadePlotResLevel),t.writeInt16(78,this.shadePlotCustomDPI),t.writeDouble(147,this.stdScale),t.writeObjectId(333,this.shadePlotId),this}}class Vs extends oo{constructor(){super(),this._tabOrder=-1,this._tabSelected=!1,this._blockTableRecordId="",this._layoutName="",this._limits=new dt,this._extents=new F,this._viewportArray=[]}get layoutName(){return this._layoutName}set layoutName(t){this._layoutName=t.length>256?t.slice(0,256):t}get tabOrder(){return this._tabOrder}set tabOrder(t){this._tabOrder=t}get tabSelected(){return this._tabSelected}set tabSelected(t){this._tabSelected=t}get blockTableRecordId(){return this._blockTableRecordId}set blockTableRecordId(t){this._blockTableRecordId=t}get limits(){return this._limits}set limits(t){this._limits.copy(t)}get extents(){return this._extents}set extents(t){this._extents.copy(t)}get viewportArray(){return this._viewportArray}set viewportArray(t){this._viewportArray=t.slice()}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayout"),t.writeString(1,this.layoutName),t.writeInt16(70,this.tabSelected?1:0),t.writeInt16(71,this.tabOrder),t.writeObjectId(330,this.blockTableRecordId),t.writeObjectId(331,this._viewportArray.length>0?this._viewportArray[0]:"0"),t.writePoint2d(10,this.limits.min),t.writePoint2d(11,this.limits.max),t.writePoint3d(14,this.extents.min),t.writePoint3d(15,this.extents.max),this}}class Ds{constructor(t){this.i=0,this._records=t,this._keys=Array.from(t.keys())}get count(){return this._records.size}toArray(){return Array.from(this._records.values())}[Symbol.iterator](){return this}next(){for(;this.i<this._keys.length;){const t=this._records.get(this._keys[this.i]);return this.i+=1,{value:t,done:!1}}return{value:null,done:!0}}}class As extends ne{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}setAt(t,e){e.database=this.database,e.ownerId=this.objectId,this.database.commitObjectHandle(e,i=>this.hasId(i)),this._recordsByName.set(t,e),this._recordsById.set(e.objectId,e),this.database.events.dictObjetSet.dispatch({database:this.database,object:e,key:t})}remove(t){const e=this.getAt(t);return e?(this._recordsByName.delete(t.toUpperCase()),this._recordsById.delete(this.objectId),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:t}),!0):!1}removeId(t){const e=this.getIdAt(t);return e?(this._recordsById.delete(this.objectId),this._recordsByName.forEach((i,n)=>{i===e&&(this._recordsByName.delete(n),this.database.events.dictObjectErased.dispatch({database:this.database,object:e,key:n}))}),!0):!1}removeAll(){this._recordsByName.forEach((t,e)=>{this.database.events.dictObjectErased.dispatch({database:this.database,object:t,key:e})}),this._recordsByName.clear(),this._recordsById.clear()}has(t){return this._recordsByName.has(t.toUpperCase())}hasId(t){return this._recordsById.has(t)}getAt(t){return this._recordsByName.get(t)}getIdAt(t){return this._recordsById.get(t)}newIterator(){return new Ds(this._recordsByName)}entries(){return this._recordsByName.entries()}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbDictionary"),t.writeInt16(280,1),t.writeInt16(281,1);for(const[e,i]of this._recordsByName)t.writeString(3,e),t.writeObjectId(350,i.objectId);return this}}class ho extends As{getBtrIdAt(t){for(const[e,i]of this._recordsByName)if(i.blockTableRecordId==t)return i}get maxTabOrder(){let t=-1;return this._recordsByName.forEach(e=>{e.tabOrder>t&&(t=e.tabOrder)}),t}}class ge extends ne{constructor(t,e){t=t||{},Bs(t,{name:""}),super(t,e)}get name(){return this.getAttr("name")}set name(t){this.setAttr("name",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTableRecord"),this}}var lo=(s=>(s[s.Any=0]="Any",s[s.Uniform=1]="Uniform",s))(lo||{});const ce=class ce extends ge{static isModelSapceName(t){return t.toLowerCase()==ce.MODEL_SPACE_NAME.toLowerCase()}static isPaperSapceName(t){return t.toLowerCase().startsWith(ce.PAPER_SPACE_NAME_PREFIX.toLowerCase())}constructor(){super(),this._origin=new b,this._layoutId="",this._entities=new Map,this._blockInsertUnits=0,this._explodability=1,this._blockScaling=1,this._bmpPreview=void 0}get isModelSapce(){return ce.isModelSapceName(this.name)}get isPaperSapce(){return ce.isPaperSapceName(this.name)}get origin(){return this._origin}set origin(t){this._origin.copy(t)}get layoutId(){return this._layoutId}set layoutId(t){this._layoutId=t}get blockInsertUnits(){return this._blockInsertUnits}set blockInsertUnits(t){this._blockInsertUnits=t}get explodability(){return this._explodability}set explodability(t){this._explodability=t}get blockScaling(){return this._blockScaling}set blockScaling(t){this._blockScaling=t}get bmpPreview(){return this._bmpPreview}set bmpPreview(t){this._bmpPreview=t}appendEntity(t){const e=i=>{i.database=this.database,i.ownerId=this.objectId,this.database.commitObjectHandle(i,n=>this._entities.has(n)),i.resolveEffectiveProperties(),this._entities.set(i.objectId,i)};if(Array.isArray(t))for(let i=0;i<t.length;++i)e(t[i]);else e(t);(this.isModelSapce||this.isPaperSapce)&&this.database.events.entityAppended.dispatch({database:this.database,entity:t})}removeEntity(t){const e=Array.isArray(t)?t:[t],i=[];return e.forEach(n=>{const r=this._entities.get(n);r&&i.push(r),this._entities.delete(n)}),i.length>0&&this.database.events.entityErased.dispatch({database:this.database,entity:i}),i.length>0}newIterator(){return new Ds(this._entities)}getIdAt(t){return this._entities.get(t)}dxfOutBlockRecord(t){return t.writeStart("BLOCK_RECORD"),this.dxfOut(t),this}dxfOutBlockBegin(t){return t.writeStart("BLOCK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeString(8,"0"),t.writeSubclassMarker("AcDbBlockBegin"),t.writeString(2,this.name),t.writeInt16(70,0),t.writePoint3d(10,this.origin),t.writeString(3,this.name),this}dxfOutBlockEnd(t){return t.writeStart("ENDBLK"),t.writeHandle(5,this.database.generateHandle()),t.writeObjectId(330,this.objectId),t.writeSubclassMarker("AcDbEntity"),t.writeSubclassMarker("AcDbBlockEnd"),this}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbBlockTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.blockInsertUnits),t.writeInt16(280,this.explodability),t.writeInt16(281,this.blockScaling),(this.isModelSapce||this.isPaperSapce)&&t.writeObjectId(340,this.layoutId),this}};ce.MODEL_SPACE_NAME="*Model_Space",ce.PAPER_SPACE_NAME_PREFIX="*Paper_Space";let Z=ce;class co{constructor(){this.events={layoutCreated:new K,layoutRemoved:new K,layoutRenamed:new K,layoutSwitched:new K}}countLayouts(t){return this.getWorkingDatabase(t).objects.layout.numEntries}findLayoutNamed(t,e){return this.getWorkingDatabase(e).objects.layout.getAt(t)}findActiveLayout(){const t=this.getActiveLayout();return t?t.layoutName:"Model"}setCurrentLayoutId(t,e){const i=this.getWorkingDatabase(e),n=i.objects.layout.getIdAt(t);return this.setCurrentLayoutInternal(n,i)}setCurrentLayoutBtrId(t,e){const i=this.getWorkingDatabase(e),n=i.objects.layout.getBtrIdAt(t);return this.setCurrentLayoutInternal(n,i)}setCurrentLayout(t,e){const i=this.getWorkingDatabase(e),n=i.objects.layout.getAt(t);return this.setCurrentLayoutInternal(n,i)}renameLayout(t,e,i){const r=this.getWorkingDatabase(i).objects.layout.getAt(t);return r?(r.layoutName=e,this.events.layoutRenamed.dispatch({layout:r,oldName:t,newName:e}),!0):!1}layoutExists(t,e){return this.getWorkingDatabase(e).objects.layout.has(t)}deleteLayout(t,e){const i=this.getWorkingDatabase(e).objects.layout,n=i.getAt(t);let r=!1;return n&&(r=i.remove(t),r&&this.events.layoutRemoved.dispatch({layout:n})),r}createLayout(t,e){const i=this.getWorkingDatabase(e),n=new Vs;n.layoutName=t,n.tabOrder=i.objects.layout.maxTabOrder;const r=new Z;return r.name=`*Paper_Space${n.tabOrder}`,i.tables.blockTable.add(r),i.objects.layout.setAt(t,n),this.events.layoutCreated.dispatch({layout:n}),{layout:n,btr:r}}getActiveLayout(t){const e=this.getWorkingDatabase(t);return e.objects.layout.getBtrIdAt(e.currentSpaceId)}getWorkingDatabase(t){return t||bn().workingDatabase}setCurrentLayoutInternal(t,e){return t?(this.events.layoutSwitched.dispatch({layout:t}),e.currentSpaceId=t.blockTableRecordId,!0):!1}}la(()=>new co);class uo extends ne{constructor(){super(),this._sourceFileName=""}get sourceFileName(){return this._sourceFileName}set sourceFileName(t){this._sourceFileName=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRasterImageDef"),t.writeString(1,this.sourceFileName),t.writeInt16(280,1),t.writeInt16(281,0),this}}var po=(s=>(s[s.NotApplicable=0]="NotApplicable",s[s.Ignore=1]="Ignore",s[s.Replace=2]="Replace",s[s.XrefMangleName=3]="XrefMangleName",s[s.MangleName=4]="MangleName",s))(po||{});class Dn extends ne{constructor(){super(...arguments),this._data=null}get data(){return this._data}set data(t){this._data=t}clear(){var t;(t=this._data)==null||t.clear()}clone(){var e;const t=new Dn;return t._data=((e=this._data)==null?void 0:e.clone())??null,t}getDuplicateRecordCloning(){return 0}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbXrecord"),t.writeInt16(280,1),t.writeResultBuffer(this.data),this}}class mo{constructor(t){this.db=t}createDefaultLayer(){const t=new J;return t.colorIndex=7,this.db.tables.layerTable.add(new ji({name:"0",standardFlags:0,linetype:"Continuous",lineWeight:0,isOff:!1,color:t,isPlottable:!0}))}createDefaultLineType(){this.db.tables.linetypeTable.add(new de({name:"ByBlock",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new de({name:"ByLayer",standardFlag:0,description:"",totalPatternLength:0})),this.db.tables.linetypeTable.add(new de({name:"Continuous",standardFlag:0,description:"Solid line",totalPatternLength:0}))}createDefaultTextStyle(){this.db.tables.textStyleTable.add(new Wi({name:Y,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"}))}createDefaultDimStyle(){this.db.tables.dimStyleTable.add(new We({name:Y,dimtxsty:Y}))}createDefaultLayout(){const t=new Vs;t.layoutName="Model",t.tabOrder=0,t.blockTableRecordId=this.db.tables.blockTable.modelSpace.objectId,t.limits.min.copy({x:0,y:0}),t.limits.max.copy({x:1e6,y:1e6}),t.extents.min.copy({x:0,y:0,z:0}),t.extents.max.copy({x:1e6,y:1e6,z:0}),this.db.objects.layout.setAt(t.layoutName,t),this.db.tables.blockTable.modelSpace.layoutId=t.objectId}createArrowBlock(){if(!this.db.tables.blockTable.getAt("_CAXARROW")){const e=new Ls;e.patternName="SOLID";const i=new ks;i.add(new Rt({x:0,y:0},{x:-1,y:.125})),i.add(new Rt({x:-1,y:.125},{x:-1,y:-.125})),i.add(new Rt({x:-1,y:-.125},{x:0,y:0})),e.add(i);const n=new Z;n.name="_CAXARROW",n.appendEntity(e),this.db.tables.blockTable.add(n)}}}var go=(s=>(s.ClosedFilled="",s.Dot="_DOT",s.DotSmall="_DOTSMALL",s.DotBlank="_DOTBLANK",s.Origin="_ORIGIN",s.Origin2="_ORIGIN2",s.Open="_OPEN",s.Open90="_OPEN90",s.Open30="_OPEN30",s.Closed="_CLOSED",s.Small="_SMALL",s.None="_NONE",s.Oblique="_OBLIQUE",s.BoxFilled="_BOXFILLED",s.Box="_BOXBLANK",s.ClosedBlank="_CLOSEDBLANK",s.DatumBlank="_DATUMBLANK",s.DatumFilled="_DATUMFILLED",s.Integral="_INTEGRAL",s.ArchTick="_ARCHTICK",s))(go||{}),jn=(s=>(s[s.Undefined=0]="Undefined",s[s.Inches=1]="Inches",s[s.Feet=2]="Feet",s[s.Miles=3]="Miles",s[s.Millimeters=4]="Millimeters",s[s.Centimeters=5]="Centimeters",s[s.Meters=6]="Meters",s[s.Kilometers=7]="Kilometers",s[s.Microinches=8]="Microinches",s[s.Mils=9]="Mils",s[s.Yards=10]="Yards",s[s.Angstroms=11]="Angstroms",s[s.Nanometers=12]="Nanometers",s[s.Microns=13]="Microns",s[s.Decimeters=14]="Decimeters",s[s.Dekameters=15]="Dekameters",s[s.Hectometers=16]="Hectometers",s[s.Gigameters=17]="Gigameters",s[s.Astronomical=18]="Astronomical",s[s.LightYears=19]="LightYears",s[s.Parsecs=20]="Parsecs",s[s.USSurveyFeet=21]="USSurveyFeet",s[s.USSurveyInch=22]="USSurveyInch",s[s.USSurveyYard=23]="USSurveyYard",s[s.USSurveyMile=24]="USSurveyMile",s[s.Max=24]="Max",s))(jn||{});function Ml(s){return s==4||s==5||s==6||s==7||s==12||s==13||s==14||s==15||s==16||s==17}function vl(s){return s==1||s==2||s==3||s==8||s==9||s==10||s==21}class re extends ne{constructor(t){super(),this.database=t,this.objectId=t.generateHandle(),this.ownerId=t.objectId,this._recordsByName=new Map,this._recordsById=new Map}get numEntries(){return this._recordsByName.size}add(t){t.database=this.database,t.ownerId=this.objectId,this.database.commitObjectHandle(t,i=>this.hasId(i));const e=this.normalizeName(t.name);this._recordsByName.set(e,t),this._recordsById.set(t.objectId,t)}remove(t){const e=this.normalizeName(t),i=this._recordsByName.get(e);return i?(this._recordsById.delete(i.objectId),this._recordsByName.delete(t),!0):!1}removeId(t){const e=this._recordsById.get(t);return e?(this._recordsByName.delete(e.name),this._recordsById.delete(t),!0):!1}removeAll(){this._recordsByName.clear(),this._recordsById.clear()}has(t){const e=this.normalizeName(t);return this._recordsByName.has(e)}hasId(t){return this._recordsById.has(t)}getAt(t){const e=this.normalizeName(t);return this._recordsByName.get(e)}getIdAt(t){return this._recordsById.get(t)}getOwnerIdAt(t){return this._recordsById.get(t)}newIterator(){return new Ds(this._recordsByName)}normalizeName(t){return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbSymbolTable"),t.writeInt16(70,this.numEntries),this}}class yo extends re{constructor(t){super(t)}get modelSpace(){let t=this.getAt(Z.MODEL_SPACE_NAME);return t||(t=new Z,t.name=Z.MODEL_SPACE_NAME,this.add(t)),t}getEntityById(t){for(const e of this.database.tables.blockTable.newIterator()){const i=e.getIdAt(t);if(i)return i}}removeEntity(t){let e=!1;for(const i of this.database.tables.blockTable.newIterator())if(i.removeEntity(t)){e=!0;break}return e}normalizeName(t){let e=t;if(Z.isModelSapceName(t))e=Z.MODEL_SPACE_NAME;else if(Z.isPaperSapceName(t)){const i=Z.PAPER_SPACE_NAME_PREFIX,n=t.substring(i.length);e=i+n}return e}}class _o extends re{constructor(t){super(t)}}var wo=(s=>(s[s.Center=0]="Center",s[s.Left=1]="Left",s[s.Right=2]="Right",s[s.OverFirst=3]="OverFirst",s[s.OverSecond=4]="OverSecond",s))(wo||{}),xo=(s=>(s[s.Center=0]="Center",s[s.Above=1]="Above",s[s.Outside=2]="Outside",s[s.JIS=3]="JIS",s[s.Below=4]="Below",s))(xo||{}),bo=(s=>(s[s.Feet=0]="Feet",s[s.None=1]="None",s[s.Inch=2]="Inch",s[s.FeetAndInch=3]="FeetAndInch",s[s.Leading=4]="Leading",s[s.Trailing=8]="Trailing",s[s.LeadingAndTrailing=12]="LeadingAndTrailing",s))(bo||{}),fo=(s=>(s[s.None=0]="None",s[s.Leading=1]="Leading",s[s.Trailing=2]="Trailing",s[s.LeadingAndTrailing=3]="LeadingAndTrailing",s))(fo||{}),Io=(s=>(s[s.Bottom=0]="Bottom",s[s.Middle=1]="Middle",s[s.Top=2]="Top",s))(Io||{});const Bi=class Bi extends ge{constructor(t,e){t=t||{},Bs(t,Bi.DEFAULT_DIM_VALUES),super(t,e)}get dimpost(){return this.getAttr("dimpost")}set dimpost(t){this.setAttr("dimpost",t)}get dimapost(){return this.getAttr("dimapost")}set dimapost(t){this.setAttr("dimapost",t)}get dimscale(){return this.getAttr("dimscale")}set dimscale(t){this.setAttr("dimscale",t)}get dimasz(){return this.getAttr("dimasz")}set dimasz(t){this.setAttr("dimasz",t)}get dimexo(){return this.getAttr("dimexo")}set dimexo(t){this.setAttr("dimexo",t)}get dimdli(){return this.getAttr("dimdli")}set dimdli(t){this.setAttr("dimdli",t)}get dimexe(){return this.getAttr("dimexe")}set dimexe(t){this.setAttr("dimexe",t)}get dimrnd(){return this.getAttr("dimrnd")}set dimrnd(t){this.setAttr("dimrnd",t)}get dimdle(){return this.getAttr("dimdle")}set dimdle(t){this.setAttr("dimdle",t)}get dimtp(){return this.getAttr("dimtp")}set dimtp(t){this.setAttr("dimtp",t)}get dimtm(){return this.getAttr("dimtm")}set dimtm(t){this.setAttr("dimtm",t)}get dimtxt(){return this.getAttr("dimtxt")}set dimtxt(t){this.setAttr("dimtxt",t)}get dimcen(){return this.getAttr("dimcen")}set dimcen(t){this.setAttr("dimcen",t)}get dimtsz(){return this.getAttr("dimtsz")}set dimtsz(t){this.setAttr("dimtsz",t)}get dimaltf(){return this.getAttr("dimaltf")}set dimaltf(t){this.setAttr("dimaltf",t)}get dimlfac(){return this.getAttr("dimlfac")}set dimlfac(t){this.setAttr("dimlfac",t)}get dimtvp(){return this.getAttr("dimtvp")}set dimtvp(t){this.setAttr("dimtvp",t)}get dimtfac(){return this.getAttr("dimtfac")}set dimtfac(t){this.setAttr("dimtfac",t)}get dimgap(){return this.getAttr("dimgap")}set dimgap(t){this.setAttr("dimgap",t)}get dimaltrnd(){return this.getAttr("dimaltrnd")}set dimaltrnd(t){this.setAttr("dimaltrnd",t)}get dimtol(){return this.getAttr("dimtol")}set dimtol(t){this.setAttr("dimtol",t)}get dimlim(){return this.getAttr("dimlim")}set dimlim(t){this.setAttr("dimlim",t)}get dimtih(){return this.getAttr("dimtih")}set dimtih(t){this.setAttr("dimtih",t)}get dimtoh(){return this.getAttr("dimtoh")}set dimtoh(t){this.setAttr("dimtoh",t)}get dimse1(){return this.getAttr("dimse1")}set dimse1(t){this.setAttr("dimse1",t)}get dimse2(){return this.getAttr("dimse2")}set dimse2(t){this.setAttr("dimse2",t)}get dimtad(){return this.getAttr("dimtad")}set dimtad(t){this.setAttr("dimtad",t)}get dimzin(){return this.getAttr("dimzin")}set dimzin(t){this.setAttr("dimzin",t)}get dimazin(){return this.getAttr("dimazin")}set dimazin(t){this.setAttr("dimazin",t)}get dimalt(){return this.getAttr("dimalt")}set dimalt(t){this.setAttr("dimalt",t)}get dimaltd(){return this.getAttr("dimaltd")}set dimaltd(t){this.setAttr("dimaltd",t)}get dimtofl(){return this.getAttr("dimtofl")}set dimtofl(t){this.setAttr("dimtofl",t)}get dimsah(){return this.getAttr("dimsah")}set dimsah(t){this.setAttr("dimsah",t)}get dimtix(){return this.getAttr("dimtix")}set dimtix(t){this.setAttr("dimtix",t)}get dimsoxd(){return this.getAttr("dimsoxd")}set dimsoxd(t){this.setAttr("dimsoxd",t)}get dimclrd(){return this.getAttr("dimclrd")}set dimclrd(t){this.setAttr("dimclrd",t)}get dimclre(){return this.getAttr("dimclre")}set dimclre(t){this.setAttr("dimclre",t)}get dimclrt(){return this.getAttr("dimclrt")}set dimclrt(t){this.setAttr("dimclrt",t)}get dimadec(){return this.getAttr("dimadec")}set dimadec(t){this.setAttr("dimadec",t)}get dimunit(){return this.getAttr("dimunit")}set dimunit(t){this.setAttr("dimunit",t)}get dimdec(){return this.getAttr("dimdec")}set dimdec(t){this.setAttr("dimdec",t)}get dimtdec(){return this.getAttr("dimtdec")}set dimtdec(t){this.setAttr("dimtdec",t)}get dimaltu(){return this.getAttr("dimaltu")}set dimaltu(t){this.setAttr("dimaltu",t)}get dimalttd(){return this.getAttr("dimalttd")}set dimalttd(t){this.setAttr("dimalttd",t)}get dimaunit(){return this.getAttr("dimaunit")}set dimaunit(t){this.setAttr("dimaunit",t)}get dimfrac(){return this.getAttr("dimfrac")}set dimfrac(t){this.setAttr("dimfrac",t)}get dimlunit(){return this.getAttr("dimlunit")}set dimlunit(t){this.setAttr("dimlunit",t)}get dimdsep(){return this.getAttr("dimdsep")}set dimdsep(t){this.setAttr("dimdsep",t)}get dimtmove(){return this.getAttr("dimtmove")}set dimtmove(t){this.setAttr("dimtmove",t)}get dimjust(){return this.getAttr("dimjust")}set dimjust(t){this.setAttr("dimjust",t)}get dimsd1(){return this.getAttr("dimsd1")}set dimsd1(t){this.setAttr("dimsd1",t)}get dimsd2(){return this.getAttr("dimsd2")}set dimsd2(t){this.setAttr("dimsd2",t)}get dimtolj(){return this.getAttr("dimtolj")}set dimtolj(t){this.setAttr("dimtolj",t)}get dimtzin(){return this.getAttr("dimtzin")}set dimtzin(t){this.setAttr("dimtzin",t)}get dimaltz(){return this.getAttr("dimaltz")}set dimaltz(t){this.setAttr("dimaltz",t)}get dimalttz(){return this.getAttr("dimalttz")}set dimalttz(t){this.setAttr("dimalttz",t)}get dimfit(){return this.getAttr("dimfit")}set dimfit(t){this.setAttr("dimfit",t)}get dimupt(){return this.getAttr("dimupt")}set dimupt(t){this.setAttr("dimupt",t)}get dimatfit(){return this.getAttr("dimatfit")}set dimatfit(t){this.setAttr("dimatfit",t)}get dimtxsty(){return this.getAttr("dimtxsty")}set dimtxsty(t){this.setAttr("dimtxsty",t)}get dimldrblk(){return this.getAttr("dimldrblk")}set dimldrblk(t){this.setAttr("dimldrblk",t)}get dimblk(){return this.getAttr("dimblk")}set dimblk(t){this.setAttr("dimblk",t)}get dimblk1(){return this.getAttr("dimblk1")}set dimblk1(t){this.setAttr("dimblk1",t)}get dimblk2(){return this.getAttr("dimblk2")}set dimblk2(t){this.setAttr("dimblk2",t)}get dimlwd(){return this.getAttr("dimlwd")}set dimlwd(t){this.setAttr("dimlwd",t)}get dimlwe(){return this.getAttr("dimlwe")}set dimlwe(t){this.setAttr("dimlwe",t)}dxfOutFields(t){super.dxfOutFields(t);const e=this.database.tables.textStyleTable.getAt(this.dimtxsty),i=this.database.tables.blockTable.getAt(this.dimldrblk),n=this.database.tables.blockTable.getAt(this.dimblk),r=this.database.tables.blockTable.getAt(this.dimblk1),a=this.database.tables.blockTable.getAt(this.dimblk2);return t.writeSubclassMarker("AcDbDimStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),t.writeString(3,this.dimpost),t.writeString(4,this.dimapost),t.writeDouble(40,this.dimscale),t.writeDouble(41,this.dimasz),t.writeDouble(42,this.dimexo),t.writeDouble(43,this.dimdli),t.writeDouble(44,this.dimexe),t.writeDouble(140,this.dimtxt),t.writeDouble(147,this.dimgap),t.writeInt16(170,this.dimalt),t.writeInt16(171,this.dimtol),t.writeInt16(172,this.dimlim),t.writeInt16(173,this.dimtih),t.writeInt16(174,this.dimtoh),t.writeObjectId(340,e==null?void 0:e.objectId),t.writeObjectId(341,i==null?void 0:i.objectId),t.writeObjectId(342,n==null?void 0:n.objectId),t.writeObjectId(343,r==null?void 0:r.objectId),t.writeObjectId(344,a==null?void 0:a.objectId),t.writeInt16(371,this.dimlwd),t.writeInt16(372,this.dimlwe),this}};Bi.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:Y,dimldrblk:"",dimblk:"",dimblk1:"",dimblk2:"",dimlwd:-2,dimlwe:-2};let We=Bi;class So extends re{constructor(t){super(t)}add(t){super.add(t),this.database.events.layerAppended.dispatch({database:this.database,layer:t})}}class ji extends ge{constructor(t,e){t=t||{},Bs(t,{color:new J,description:"",standardFlags:0,isHidden:!1,isInUse:!0,isOff:!1,isPlottable:!0,transparency:new zi,linetype:"",lineWeight:1,materialId:-1}),super(t,e),this.attrs.events.attrChanged.addEventListener(i=>{this.database.events.layerModified.dispatch({database:this.database,layer:this,changes:i.object.changedAttributes()})})}get color(){return this.getAttr("color")}set color(t){this.setAttr("color",t.clone())}get description(){return this.getAttr("description")}set description(t){this.setAttr("description",t)}get standardFlags(){return this.getAttr("standardFlags")}set standardFlags(t){this.setAttr("standardFlags",t)}get isFrozen(){return(this.standardFlags&1)==1}set isFrozen(t){const e=t?1:0;this.standardFlags=this.standardFlags|e}get isHidden(){return this.getAttr("isHidden")}set isHidden(t){this.setAttr("isHidden",t)}get isInUse(){return this.getAttr("isInUse")}set isInUse(t){this.setAttr("isInUse",t)}get isLocked(){return(this.standardFlags&4)==4}set isLocked(t){const e=t?4:0;this.standardFlags=this.standardFlags|e}get isOff(){return this.getAttr("isOff")}set isOff(t){this.setAttr("isOff",t)}get isPlottable(){return this.getAttr("isPlottable")}set isPlottable(t){this.setAttr("isPlottable",t)}get transparency(){return this.getAttr("transparency")}set transparency(t){this.setAttr("transparency",t.clone())}get linetype(){return this.getAttr("linetype")}set linetype(t){this.setAttr("linetype",t)}get lineStyle(){var e;const t=(e=this.database)==null?void 0:e.tables.linetypeTable.getAt(this.linetype);if(t)return{type:"UserSpecified",...t.linetype}}get lineWeight(){return this.getAttr("lineWeight")}set lineWeight(t){this.setAttr("lineWeight",t)}get materialId(){return this.getAttr("materialId")}set materialId(t){this.setAttr("materialId",t)}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbLayerTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeCmColor(this.color),t.writeString(6,this.linetype),t.writeInt16(290,this.isPlottable?1:0),t.writeInt16(370,this.lineWeight),t.writeTransparency(this.transparency),this.description&&t.writeString(4,this.description),this}}class Eo extends re{constructor(t){super(t)}}class de extends ge{constructor(t){super(),this.name=t.name,this._linetype=t}get numDashes(){return this._linetype.pattern?this._linetype.pattern.length:0}get patternLength(){return this._linetype.totalPatternLength}get comments(){return this._linetype.description}get linetype(){return this._linetype}dashLengthAt(t){if(t<0||t>=this.numDashes)throw new Error('Index must be greater than or equal to zero, but less than the value of property "numDashes".');return this._linetype.pattern[t].elementLength}dxfOutFields(t){super.dxfOutFields(t),t.writeSubclassMarker("AcDbLinetypeTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.linetype.standardFlag),t.writeString(3,this.comments),t.writeInt16(72,65),t.writeInt16(73,this.numDashes),t.writeDouble(40,this.patternLength);for(const e of this.linetype.pattern??[])t.writeDouble(49,e.elementLength),t.writeInt16(74,e.elementTypeFlag);return this}}class Po extends re{constructor(t){super(t)}get fonts(){const t=new Set,e=n=>{if(n){const r=n.lastIndexOf(".");if(r>=0){const a=n.substring(0,r).toLowerCase();t.add(a)}else t.add(n.toLowerCase())}},i=this.newIterator();for(const n of i)e(n.fileName),e(n.bigFontFileName);return Array.from(t)}}class Wi extends ge{constructor(t){super(),this.name=t.name,this._textStyle=t,this._textStyle.font=this.getFileNameWithoutExtension(this._textStyle.font||this._textStyle.extendedFont||this.name),this._isVertical=!1}get obliquingAngle(){return this._textStyle.obliqueAngle}set obliquingAngle(t){this._textStyle.obliqueAngle=t}get priorSize(){return this._textStyle.lastHeight}set priorSize(t){this._textStyle.lastHeight=t}get textSize(){return this._textStyle.fixedTextHeight}set textSize(t){this._textStyle.fixedTextHeight=t}get xScale(){return this._textStyle.widthFactor}set xScale(t){this._textStyle.widthFactor=t}get isVertical(){return this._isVertical}set isVertical(t){this._isVertical=t}get fileName(){return this._textStyle.font}set fileName(t){this._textStyle.font=t}get bigFontFileName(){return this._textStyle.bigFont}set bigFontFileName(t){this._textStyle.bigFont=t}get textStyle(){return this._textStyle}getFileNameWithoutExtension(t){const e=t.split("/").pop();if(e){const i=e.lastIndexOf(".");return i===-1?e:e.substring(0,i)}return t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbTextStyleTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.textStyle.standardFlag),t.writeDouble(40,this.textSize),t.writeDouble(41,this.xScale),t.writeAngle(50,this.obliquingAngle),t.writeInt16(71,this.isVertical?4:this.textStyle.textGenerationFlag),t.writeDouble(42,this.priorSize),t.writeString(3,this.fileName),t.writeString(4,this.bigFontFileName),this}}class Ao extends re{constructor(t){super(t)}}class To extends re{constructor(t){super(t)}}const kl=()=>({center:new O,viewDirectionFromTarget:new b(0,0,1),viewTarget:new b(0,0,0),lensLength:500,frontClippingPlane:0,backClippingPlane:0,viewHeight:1e3,viewTwistAngle:0,frozenLayers:[],styleSheet:"",renderMode:Rn.OPTIMIZED_2D,viewMode:0,ucsIconSetting:0,ucsOrigin:new b(0,0,0),ucsXAxis:new b(1,0,0),ucsYAxis:new b(0,1,0),orthographicType:zn.TOP,shadePlotSetting:0,shadePlotObjectId:void 0,visualStyleObjectId:void 0,isDefaultLightingOn:!1,defaultLightingType:Vn.ONE_DISTANT_LIGHT,brightness:0,contrast:0,ambientColor:void 0});class Wn extends ge{constructor(){super(),this._gsView=kl(),this._centerPoint=this._gsView.center}get gsView(){return this._gsView}get centerPoint(){return this._centerPoint}set centerPoint(t){this._centerPoint.copy(t)}get viewDirectionFromTarget(){return this._gsView.viewDirectionFromTarget}set viewDirectionFromTarget(t){this._gsView.viewDirectionFromTarget.copy(t)}get viewTarget(){return this._gsView.viewTarget}set viewTarget(t){this._gsView.viewTarget.copy(t)}get viewHeight(){return this._gsView.viewHeight}set viewHeight(t){this._gsView.viewHeight=t}get viewTwistAngle(){return this._gsView.viewTwistAngle}set viewTwistAngle(t){this._gsView.viewTwistAngle=t}get lensLength(){return this._gsView.lensLength}set lensLength(t){this._gsView.lensLength=t}get frontClippingPlane(){return this._gsView.frontClippingPlane}set frontClippingPlane(t){this._gsView.frontClippingPlane=t}get backClippingPlane(){return this._gsView.backClippingPlane}set backClippingPlane(t){this._gsView.backClippingPlane=t}get renderMode(){return this._gsView.renderMode}set renderMode(t){this._gsView.renderMode=t}get viewMode(){return this._gsView.viewMode}set viewMode(t){this._gsView.viewMode=t}get ucsIconSetting(){return this._gsView.ucsIconSetting}set ucsIconSetting(t){this._gsView.ucsIconSetting=t}get ucsOrigin(){return this._gsView.ucsOrigin}set ucsOrigin(t){this._gsView.ucsOrigin.copy(t)}get ucsXAxis(){return this._gsView.ucsXAxis}set ucsXAxis(t){this._gsView.ucsXAxis.copy(t)}get ucsYAxis(){return this._gsView.ucsYAxis}set ucsYAxis(t){this._gsView.ucsYAxis.copy(t)}get orthographicType(){return this._gsView.orthographicType}set orthographicType(t){this._gsView.orthographicType=t}get shadePlotSetting(){return this._gsView.shadePlotSetting}set shadePlotSetting(t){this._gsView.shadePlotSetting=t}get shadePlotObjectId(){return this._gsView.shadePlotObjectId}set shadePlotObjectId(t){this._gsView.shadePlotObjectId=t}get visualStyleObjectId(){return this._gsView.visualStyleObjectId}set visualStyleObjectId(t){this._gsView.visualStyleObjectId=t}get isDefaultLightingOn(){return this._gsView.isDefaultLightingOn}set isDefaultLightingOn(t){this._gsView.isDefaultLightingOn=t}get defaultLightingType(){return this._gsView.defaultLightingType}set defaultLightingType(t){this._gsView.defaultLightingType=t}get brightness(){return this._gsView.brightness}set brightness(t){this._gsView.brightness=t}get contrast(){return this._gsView.contrast}set contrast(t){this._gsView.contrast=t}get ambientColor(){return this._gsView.ambientColor}set ambientColor(t){this._gsView.ambientColor=t}}class Gn extends Wn{constructor(){super(),this._circleSides=100,this._lowerLeftCorner=new O(0,0),this._upperRightCorner=new O(1,1),this._snapBase=new O(0,0),this._snapAngle=0,this._snapSpacing=new O(0,0),this._standardFlag=0,this._gridSpacing=new O,this._gridMajor=10}get circleSides(){return this._circleSides}set circleSides(t){this._circleSides=t}get center(){return this.centerPoint}set center(t){this.centerPoint=t}get lowerLeftCorner(){return this._lowerLeftCorner}set lowerLeftCorner(t){this._lowerLeftCorner.copy(t)}get upperRightCorner(){return this._upperRightCorner}set upperRightCorner(t){this._upperRightCorner.copy(t)}get snapBase(){return this._snapBase}set snapBase(t){this._snapBase.copy(t)}get snapAngle(){return this._snapAngle}set snapAngle(t){this._snapAngle=t}get snapIncrements(){return this._snapSpacing}set snapIncrements(t){this._snapSpacing.copy(t)}get gridMajor(){return this._gridMajor}set gridMajor(t){this._gridMajor=t}get gridIncrements(){return this._gridSpacing}set gridIncrements(t){this._gridSpacing.copy(t)}get standardFlag(){return this._standardFlag}set standardFlag(t){this._standardFlag=t}get snapEnabled(){return!!(this._standardFlag&256)}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewportTableRecord"),t.writeString(2,this.name),t.writeDouble(45,this.gsView.viewHeight),t.writePoint2d(10,this.lowerLeftCorner),t.writePoint2d(11,this.upperRightCorner),t.writePoint2d(12,this.center),t.writePoint2d(13,this.snapBase),t.writePoint2d(14,this.snapIncrements),t.writePoint2d(15,this.gridIncrements),t.writeInt16(70,this.standardFlag),t.writeInt16(71,this.circleSides),t.writeDouble(42,this.gsView.lensLength),t.writePoint3d(16,this.gsView.viewDirectionFromTarget),t.writePoint3d(17,this.gsView.viewTarget),t.writeAngle(50,this.snapAngle),t.writeAngle(51,this.gsView.viewTwistAngle),t.writeInt16(61,this.gridMajor),t.writeInt16(281,this.backgroundObjectId?1:0),t.writeObjectId(332,this.backgroundObjectId),this}}class Mo extends re{constructor(t){super(t)}}class _n extends ge{constructor(t){super(),this.name=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbRegAppTableRecord"),t.writeString(2,this.name),t.writeInt16(70,0),this}}const D={ACADVER:"ACADVER",ANGBASE:"ANGBASE",ANGDIR:"ANGDIR",AUNITS:"AUNITS",CECOLOR:"CECOLOR",CELTSCALE:"CELTSCALE",CELWEIGHT:"CELWEIGHT",CLAYER:"CLAYER",COLORTHEME:"COLORTHEME",EXTMAX:"EXTMAX",EXTMIN:"EXTMIN",INSUNITS:"INSUNITS",LTSCALE:"LTSCALE",LWDISPLAY:"LWDISPLAY",MEASUREMENTCOLOR:"MEASUREMENTCOLOR",OSMODE:"OSMODE",PDMODE:"PDMODE",PDSIZE:"PDSIZE",PICKBOX:"PICKBOX",TEXTSTYLE:"TEXTSTYLE",WHITEBKCOLOR:"WHITEBKCOLOR"},Ll=Object.freeze(Object.values(D)),Ri=class Ri{constructor(){this.registry=new Map,this.cache=new Map,this.events={sysVarChanged:new K},this.registerVar({name:D.CECOLOR,type:"color",isDbVar:!0,defaultValue:new J(E.ByLayer)}),this.registerVar({name:D.CELTSCALE,type:"number",isDbVar:!0,defaultValue:-1}),this.registerVar({name:D.CELWEIGHT,type:"number",isDbVar:!0,defaultValue:je.ByLayer}),this.registerVar({name:D.CLAYER,type:"string",isDbVar:!0,defaultValue:"0"}),this.registerVar({name:D.COLORTHEME,type:"number",isDbVar:!1,defaultValue:"0"}),this.registerVar({name:D.LWDISPLAY,type:"boolean",isDbVar:!0,defaultValue:!1}),this.registerVar({name:D.MEASUREMENTCOLOR,type:"color",isDbVar:!1,defaultValue:(()=>{const t=new J(E.ByColor);return t.setRGB(96,165,250),t})()}),this.registerVar({name:D.OSMODE,type:"number",isDbVar:!0,defaultValue:0}),this.registerVar({name:D.PICKBOX,type:"number",isDbVar:!1,defaultValue:10}),this.registerVar({name:D.TEXTSTYLE,type:"string",isDbVar:!0,defaultValue:Y}),this.registerVar({name:D.WHITEBKCOLOR,type:"boolean",isDbVar:!1,defaultValue:!1})}static instance(){return this._instance||(this._instance=new Ri),this._instance}registerVar(t){const e=this.normalizeName(t.name);this.registry.set(e,{...t,name:e}),t.isDbVar||this.cache.set(e,t.defaultValue)}registerMany(t){t.forEach(e=>this.registerVar(e))}getVar(t,e){t=this.normalizeName(t);const i=this.getDescriptor(t);if(i){if(i.isDbVar)return e[t.toLowerCase()];if(this.cache.has(t))return this.cache.get(t)}}setVar(t,e,i){t=this.normalizeName(t);const n=this.getDescriptor(t);if(n){const r=this.getVar(t,i);if(n.type!=="string"&&(typeof e=="string"||e instanceof String)){if(n.type==="number"){const a=Number(e);if(Number.isNaN(a))throw new Error("Invalid number input!");e=a}else if(n.type==="boolean")e=this.parseBoolean(e);else if(n.type==="color"){const a=J.fromString(e);if(a==null)throw new Error("Invalid color value!");e=a}}n.isDbVar?i[t.toLowerCase()]=e:(this.cache.set(t,e),this.hasValueChanged(r,e)&&this.events.sysVarChanged.dispatch({database:i,name:t,newVal:e,oldVal:r}))}else throw new Error(`System variable ${t} not found!`)}getDescriptor(t){return this.registry.get(this.normalizeName(t))}getAllDescriptors(){return[...this.registry.values()]}parseBoolean(t){if(t==null)return!1;const e=String(t).trim().toLowerCase(),i=new Set(["true","t","1","yes","y"]),n=new Set(["false","f","0","no","n"]);return i.has(e)?!0:(n.has(e),!1)}hasValueChanged(t,e){return t instanceof J&&e instanceof J?!t.equals(e):!Object.is(t,e)}normalizeName(t){return t.toLowerCase()}};Ri._instance=null;let Ni=Ri;class Ol extends ne{constructor(){super({objectId:"0"}),this.events={dictObjetSet:new K,dictObjectErased:new K,entityAppended:new K,entityModified:new K,entityErased:new K,layerAppended:new K,layerModified:new K,layerErased:new K,openProgress:new K},this._version=new At("AC1014"),this._angBase=0,this._angDir=0,this._aunits=Sn.DecimalDegrees,this._celtscale=1,this._cecolor=new J,this._celweight=je.ByLayer,this._clayer="0",this._textstyle=Y,this._extents=new F,this._insunits=jn.Millimeters,this._ltscale=1,this._lwdisplay=!0,this._pdmode=0,this._pdsize=0,this._osmode=0,this._maxHandle=0,this._tables={appIdTable:new Mo(this),blockTable:new yo(this),dimStyleTable:new _o(this),linetypeTable:new Eo(this),textStyleTable:new Po(this),viewTable:new Ao(this),layerTable:new So(this),viewportTable:new To(this)},this._objects={dictionary:new As(this),imageDefinition:new As(this),layout:new ho(this),xrecord:new As(this)}}get tables(){return this._tables}get objects(){return this._objects}generateHandle(){return this._maxHandle++,this._maxHandle.toString(16).toUpperCase()}updateMaxHandle(t){const e=parseInt(t,16);!isNaN(e)&&e>this._maxHandle&&(this._maxHandle=e)}commitObjectHandle(t,e){const i=t.getAttrWithoutException("objectId");!i||t.isTemp||e&&e(i)?t.objectId=this.generateHandle():this.updateMaxHandle(i)}get currentSpaceId(){return this._currentSpace||(this._currentSpace=this._tables.blockTable.modelSpace),this._currentSpace.objectId}set currentSpaceId(t){const e=this.tables.blockTable.getIdAt(t);if(e==null)throw new Error(`[AcDbDatabase] The specified block table record id '${t}' doesn't exist in the drawing database!`);this._currentSpace=e}get aunits(){return this._aunits}set aunits(t){this.updateSysVar(D.AUNITS,this._aunits,t??0,e=>{this._aunits=e})}get version(){return this._version}set version(t){this.updateSysVar(D.ACADVER,this._version,new At(t),e=>{this._version=e})}get insunits(){return this._insunits}set insunits(t){this.updateSysVar(D.INSUNITS,this._insunits,t??4,e=>{this._insunits=e})}get ltscale(){return this._ltscale}set ltscale(t){this.updateSysVar(D.LTSCALE,this._ltscale,t??1,e=>{this._ltscale=e})}get lwdisplay(){return this._lwdisplay}set lwdisplay(t){this.updateSysVar(D.LWDISPLAY,this._lwdisplay,t??!1,e=>{this._lwdisplay=e})}get cecolor(){return this._cecolor}set cecolor(t){this.updateSysVar(D.CECOLOR,this._cecolor,t||0,e=>{this._cecolor=e.clone()})}get celtscale(){return this._celtscale}set celtscale(t){this.updateSysVar(D.CELTSCALE,this._celtscale,t??1,e=>{this._celtscale=e})}get celweight(){return this._celweight}set celweight(t){this.updateSysVar(D.CELWEIGHT,this._celweight,t??je.ByLayer,e=>{this._celweight=e})}get clayer(){return this._clayer}set clayer(t){this.updateSysVar(D.CLAYER,this._clayer,t??"0",e=>{this._clayer=e})}get textstyle(){return this._textstyle}set textstyle(t){this.updateSysVar(D.TEXTSTYLE,this._textstyle,t??Y,e=>{this._textstyle=e})}get angBase(){return this._angBase}set angBase(t){this.updateSysVar(D.ANGBASE,this._angBase,t??0,e=>{this._angBase=e})}get angDir(){return this._angDir}set angDir(t){this.updateSysVar(D.ANGDIR,this._angDir,t??0,e=>{this._angDir=e})}get extmax(){return this._extents.max}set extmax(t){if(t){const e=this._extents.max.clone();this._extents.expandByPoint(t),this._extents.max.equals(e)||this.triggerSysVarChangedEvent(D.EXTMAX,e,this._extents.max)}}get extmin(){return this._extents.min}set extmin(t){if(t){const e=this._extents.min.clone();this._extents.expandByPoint(t),this._extents.min.equals(e)||this.triggerSysVarChangedEvent(D.EXTMIN,e,this._extents.min)}}get extents(){return this._extents}get pdmode(){return this._pdmode}set pdmode(t){this.updateSysVar(D.PDMODE,this._pdmode,t??0,e=>{this._pdmode=e})}get pdsize(){return this._pdsize}set pdsize(t){this.updateSysVar(D.PDSIZE,this._pdsize,t??0,e=>{this._pdsize=e})}get osmode(){return this._osmode}set osmode(t){this.updateSysVar(D.OSMODE,this._osmode,t??0,e=>{this._osmode=e})}async read(t,e,i=fs.DXF){const n=Ft.instance.get(i);if(n==null)throw new Error(`Database converter for file type '${i}' isn't registered and can can't read this file!`);this.clear(),await n.read(t,this,e&&e.minimumChunkSize||10,async(r,a,o,l)=>{if(this.events.openProgress.dispatch({database:this,percentage:r,stage:"CONVERSION",subStage:a,subStageStatus:o,data:l}),e&&e.fontLoader&&a=="FONT"&&o=="END"){const c=l||this.tables.textStyleTable.fonts;await e.fontLoader.load(c)}},e==null?void 0:e.timeout),this.ensureDatabaseDefaults()}async openUri(t,e){var u;this.events.openProgress.dispatch({database:this,percentage:0,stage:"FETCH_FILE",subStageStatus:"START"});const i=await fetch(t);if(!i.ok)throw this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"ERROR"}),new Error(`Failed to fetch file '${t}' with HTTP status code '${i.status}'!`);const n=i.headers.get("content-length"),r=n?parseInt(n,10):null;let a=0;const o=(u=i.body)==null?void 0:u.getReader();if(!o)throw new Error("Failed to get response reader");const l=[];for(;;){const{done:g,value:y}=await o.read();if(g)break;if(l.push(y),a+=y.length,r!==null){const x=Math.round(a/r*100);this.events.openProgress.dispatch({database:this,percentage:x,stage:"FETCH_FILE",subStageStatus:"IN-PROGRESS"})}}const c=new Uint8Array(a);let d=0;for(const g of l)c.set(g,d),d+=g.length;const m=this.getFileNameFromUri(t).toLowerCase().split(".").pop();m==="dwg"?await this.read(c.buffer,e,fs.DWG):m==="dxf"?await this.read(c.buffer,e,fs.DXF):await this.read(c.buffer,e,m),this.events.openProgress.dispatch({database:this,percentage:100,stage:"FETCH_FILE",subStageStatus:"END"})}dxfOut(t,e=16,i=this.version.name,n=!1){this.ensureDatabaseDefaults();const r=i instanceof At?i:new At(i),a=new Kr({database:this,precision:e,version:r});return this.writeDxfHeaderSection(a),this.writeDxfTablesSection(a,r),this.writeDxfBlocksSection(a),this.writeDxfEntitiesSection(a),this.writeDxfObjectsSection(a),a.writeStart("EOF"),a.toString()}async regen(){await new qh(this).read(null,this,500,async(e,i,n,r)=>{this.events.openProgress.dispatch({database:this,percentage:e,stage:"CONVERSION",subStage:i,subStageStatus:n,data:r})})}createDefaultData(t={layer:!0,lineType:!0,textStyle:!0,dimStyle:!0,layout:!0}){const e=new mo(this);t.layer&&e.createDefaultLayer(),t.lineType&&e.createDefaultLineType(),t.textStyle&&e.createDefaultTextStyle(),t.dimStyle&&e.createDefaultDimStyle(),t.layout&&e.createDefaultLayout()}ensureDatabaseDefaults(){if(!this.tables.layerTable.has("0")){const e=new J;e.colorIndex=7,this.tables.layerTable.add(new ji({name:"0",standardFlags:0,linetype:qe,lineWeight:0,isOff:!1,color:e,isPlottable:!0}))}if(this.tables.linetypeTable.has(ci)||this.tables.linetypeTable.add(new de({name:ci,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(Ke)||this.tables.linetypeTable.add(new de({name:Ke,standardFlag:0,description:"",totalPatternLength:0})),this.tables.linetypeTable.has(qe)||this.tables.linetypeTable.add(new de({name:qe,standardFlag:0,description:"Solid line",totalPatternLength:0})),this.tables.textStyleTable.has(Y)||this.tables.textStyleTable.add(new Wi({name:Y,standardFlag:0,fixedTextHeight:0,widthFactor:1,obliqueAngle:0,textGenerationFlag:0,lastHeight:.2,font:"SimKai",bigFont:"",extendedFont:"SimKai"})),this.tables.dimStyleTable.has(Y)||this.tables.dimStyleTable.add(new We({name:Y,dimtxsty:Y})),!this.tables.viewportTable.has("*Active")){const e=new Gn;e.name="*Active",this.tables.viewportTable.add(e)}const t=this.tables.blockTable.modelSpace;if(!this.objects.layout.getAt("Model")){const e=new Vs;e.layoutName="Model",e.tabOrder=0,e.blockTableRecordId=t.objectId,e.limits.min.copy({x:0,y:0}),e.limits.max.copy({x:1e6,y:1e6}),e.extents.min.copy({x:0,y:0,z:0}),e.extents.max.copy({x:1e6,y:1e6,z:0}),this.objects.layout.setAt(e.layoutName,e),t.layoutId=e.objectId}this.tables.appIdTable.has(ln)||this.tables.appIdTable.add(new _n(ln)),this.tables.appIdTable.has(hn)||this.tables.appIdTable.add(new _n(hn))}writeDxfHeaderSection(t){var e;t.startSection("HEADER"),t.writeString(9,"$ACADVER"),t.writeString(1,((e=t.version)==null?void 0:e.name)??this.version.name),t.writeString(9,"$INSUNITS"),t.writeInt16(70,this.insunits),t.writeString(9,"$LTSCALE"),t.writeDouble(40,this.ltscale),t.writeString(9,"$LWDISPLAY"),t.writeInt16(70,this.lwdisplay?1:0),t.writeString(9,"$CLAYER"),t.writeString(8,this.clayer),t.writeString(9,"$TEXTSTYLE"),t.writeString(7,this.textstyle),t.writeString(9,"$ANGBASE"),t.writeAngle(50,this.angBase),t.writeString(9,"$ANGDIR"),t.writeInt16(70,this.angDir),t.writeString(9,"$EXTMIN"),t.writePoint3d(10,this.extmin),t.writeString(9,"$EXTMAX"),t.writePoint3d(10,this.extmax),t.writeString(9,"$PDMODE"),t.writeInt32(70,this.pdmode),t.writeString(9,"$PDSIZE"),t.writeDouble(40,this.pdsize),t.writeString(9,"$OSMODE"),t.writeInt32(70,this.osmode),t.endSection()}writeDxfTablesSection(t,e){t.startSection("TABLES"),this.writeDxfTable(t,"VPORT",this.tables.viewportTable,this.tables.viewportTable.newIterator(),"VPORT"),this.writeDxfTable(t,"VIEW",this.tables.viewTable,this.tables.viewTable.newIterator(),"VIEW"),this.writeDxfTable(t,"LTYPE",this.tables.linetypeTable,this.tables.linetypeTable.newIterator(),"LTYPE"),this.writeDxfTable(t,"LAYER",this.tables.layerTable,this.tables.layerTable.newIterator(),"LAYER"),this.writeDxfTable(t,"STYLE",this.tables.textStyleTable,this.tables.textStyleTable.newIterator(),"STYLE"),this.writeDxfTable(t,"APPID",this.tables.appIdTable,this.tables.appIdTable.newIterator(),"APPID"),this.writeDxfTable(t,"DIMSTYLE",this.tables.dimStyleTable,this.tables.dimStyleTable.newIterator(),"DIMSTYLE"),e.value>=19&&this.writeDxfTable(t,"BLOCK_RECORD",this.tables.blockTable,this.tables.blockTable.newIterator(),"BLOCK_RECORD"),t.endSection()}writeDxfBlocksSection(t){t.startSection("BLOCKS");for(const e of this.tables.blockTable.newIterator()){if(e.dxfOutBlockBegin(t),!e.isModelSapce&&!e.isPaperSapce)for(const i of e.newIterator())this.writeDxfEntity(t,i);e.dxfOutBlockEnd(t)}t.endSection()}writeDxfEntitiesSection(t){t.startSection("ENTITIES");for(const e of this.tables.blockTable.newIterator())if(!(!e.isModelSapce&&!e.isPaperSapce))for(const i of e.newIterator())this.writeDxfEntity(t,i);t.endSection()}writeDxfObjectsSection(t){t.startSection("OBJECTS");const e=this.objects.dictionary;e.ownerId="0";const i=a=>{t.writeStart("DICTIONARY"),a.dxfOut(t)},n=(a,o)=>{e.getAt(a)!==o&&e.setAt(a,o)},r=a=>{e.getAt(a)&&e.remove(a)};n("ACAD_LAYOUT",this.objects.layout),this.objects.imageDefinition.numEntries>0?n("ISM_RASTER_IMAGE_DICT",this.objects.imageDefinition):r("ISM_RASTER_IMAGE_DICT"),this.objects.xrecord.numEntries>0?n("MLIGHT_XRECORD",this.objects.xrecord):r("MLIGHT_XRECORD"),i(e),i(this.objects.layout),this.objects.imageDefinition.numEntries>0&&i(this.objects.imageDefinition),this.objects.xrecord.numEntries>0&&i(this.objects.xrecord);for(const[a,o]of this.objects.layout.entries())t.writeStart("LAYOUT"),o.dxfOut(t);for(const[a,o]of this.objects.imageDefinition.entries())t.writeStart("IMAGEDEF"),o.dxfOut(t);for(const[a,o]of this.objects.xrecord.entries())t.writeStart("XRECORD"),o.dxfOut(t);t.endSection()}writeDxfTable(t,e,i,n,r){const a=[...n];t.startTable(e),i.dxfOut(t);for(const o of a){if(r==="BLOCK_RECORD"&&o instanceof Z){o.dxfOutBlockRecord(t);continue}t.writeStart(r),o.dxfOut(t)}t.endTable()}writeDxfEntity(t,e){t.writeStart(e.dxfTypeName),e.dxfOut(t)}clear(){this._tables.blockTable.removeAll(),this._tables.dimStyleTable.removeAll(),this._tables.linetypeTable.removeAll(),this._tables.textStyleTable.removeAll(),this._tables.viewTable.removeAll(),this._tables.layerTable.removeAll(),this._tables.viewportTable.removeAll(),this._objects.layout.removeAll(),this._currentSpace=void 0,this._extents.makeEmpty()}updateSysVar(t,e,i,n){this.hasSysVarValueChanged(e,i)&&(n(i),this.triggerSysVarChangedEvent(t,e,i))}hasSysVarValueChanged(t,e){return t instanceof J&&e instanceof J?!t.equals(e):t instanceof At&&e instanceof At?t.value!==e.value:!Object.is(t,e)}triggerSysVarChangedEvent(t,e,i){const n=Ni.instance(),r=t.toLowerCase();n.getDescriptor(r)!=null&&n.events.sysVarChanged.dispatch({database:this,name:r,oldVal:e,newVal:i})}getFileNameFromUri(t){try{const i=new URL(t).pathname.split("/");return i[i.length-1]||""}catch(e){return console.error("Invalid URI:",e),""}}}const vo="Load Database",Wr=3e4,Nl=12e4,Cl=1024*1024;class mt extends ia{constructor(t,e){super(t.stage),this.data=t,this.progress=e}async run(t){const e=xn.getInstance().getEntry(vo),i=Date.now();this.progress&&await this.progress(this.data.progress.value,this.data.stage,"START");const n=await this.data.task(t);return this.progress&&(await this.progress(this.data.progress.value,this.data.stage,"END",n?n.data:null),this.data.progress.value+=this.data.step,this.data.progress.value>100&&(this.data.progress.value=100)),e&&(e.data[this.name]=Date.now()-i),n}}class Hn{constructor(t={}){this.config=t}async read(t,e,i,n,r){const a={name:vo,data:{total:0},format(){let d="";return Object.keys(this.data).forEach(p=>{p!=="total"&&(d+=`- ${p}: ${this.data[p]} ms
|
|
4
|
+
`)}),d+=`- total: ${this.data.total} ms`,d}};xn.getInstance().collect(a),this.progress=n;const o={value:0},l=new na;l.setCompleteCallback(()=>this.onFinished()),l.setErrorCallback(d=>this.onError(d)),l.addTask(new mt({stage:"START",step:1,progress:o,task:async d=>d},n)),l.addTask(new mt({stage:"PARSE",step:5,progress:o,task:async d=>await this.parse(d,r)},n)),l.addTask(new mt({stage:"FONT",step:5,progress:o,task:async d=>{const p=this.getFonts(d.model);return{model:d.model,data:p}}},n)),l.addTask(new mt({stage:"LTYPE",step:1,progress:o,task:async d=>(this.processLineTypes(d.model,e),d)},n)),l.addTask(new mt({stage:"STYLE",step:1,progress:o,task:async d=>(this.processTextStyles(d.model,e),d)},n)),l.addTask(new mt({stage:"DIMSTYLE",step:1,progress:o,task:async d=>(this.processDimStyles(d.model,e),d)},n)),l.addTask(new mt({stage:"LAYER",step:1,progress:o,task:async d=>(this.processLayers(d.model,e),e.tables.layerTable.numEntries===0&&e.createDefaultData({layer:!0}),d)},n)),l.addTask(new mt({stage:"VPORT",step:1,progress:o,task:async d=>(this.processViewports(d.model,e),d)},n)),l.addTask(new mt({stage:"HEADER",step:1,progress:o,task:async d=>(this.processHeader(d.model,e),d)},n)),l.addTask(new mt({stage:"BLOCK_RECORD",step:5,progress:o,task:async d=>(this.processBlockTables(d.model,e),d)},n)),l.addTask(new mt({stage:"OBJECT",step:5,progress:o,task:async d=>(this.processObjects(d.model,e),e.objects.layout.numEntries===0&&e.createDefaultData({layout:!0}),d)},n)),l.addTask(new mt({stage:"BLOCK",step:5,progress:o,task:async d=>(await this.processBlocks(d.model,e),d)},n)),l.addTask(new mt({stage:"ENTITY",step:100,progress:o,task:async d=>(await this.processEntities(d.model,e,i,o,n),d)},n)),l.addTask(new mt({stage:"END",step:0,progress:o,task:async d=>d},n));const c=Date.now();await l.run(t),a.data.total=Date.now()-c}onError(t){if(this.progress){const e=t.task;this.progress(e.data.progress.value,e.data.stage,"ERROR",void 0,t)}return console.error(`Error occurred in conversion stage '${t.task.name}': `,t.error),t.task.name==="ENTITY"?!1:(this.onFinished(),!0)}onFinished(){this.progress&&(this.progress(100,"END","END"),Je.instance.clear())}getParserWorkerTimeout(t,e){const i=e??this.config.timeout;if(i!=null)return i;const n=Math.ceil(t.byteLength/Cl),r=Wr+n*1e3;return Math.min(Nl,Math.max(Wr,r))}async parse(t,e){throw new Error("Not impelemented yet!")}getFonts(t){throw new Error("Not impelemented yet!")}processLineTypes(t,e){throw new Error("Not impelemented yet!")}processTextStyles(t,e){throw new Error("Not impelemented yet!")}processDimStyles(t,e){throw new Error("Not impelemented yet!")}processLayers(t,e){throw new Error("Not impelemented yet!")}processViewports(t,e){throw new Error("Not impelemented yet!")}processHeader(t,e){throw new Error("Not impelemented yet!")}processBlockTables(t,e){throw new Error("Not impelemented yet!")}processObjects(t,e){throw new Error("Not impelemented yet!")}processBlocks(t,e){throw new Error("Not impelemented yet!")}processEntities(t,e,i,n,r){throw new Error("Not impelemented yet!")}}class Fl extends Wn{constructor(){super(),this._standardFlags=0,this._viewWidth=this.viewHeight,this._ucsAssociated=!1,this._cameraPlottable=!1,this._ucsElevation=0}get standardFlags(){return this._standardFlags}set standardFlags(t){this._standardFlags=t}get viewWidth(){return this._viewWidth}set viewWidth(t){this._viewWidth=t}get ucsAssociated(){return this._ucsAssociated}set ucsAssociated(t){this._ucsAssociated=t}get cameraPlottable(){return this._cameraPlottable}set cameraPlottable(t){this._cameraPlottable=t}get ucsElevation(){return this._ucsElevation}set ucsElevation(t){this._ucsElevation=t}get ucsObjectId(){return this._ucsObjectId}set ucsObjectId(t){this._ucsObjectId=t}get ucsBaseObjectId(){return this._ucsBaseObjectId}set ucsBaseObjectId(t){this._ucsBaseObjectId=t}get backgroundObjectId(){return this._backgroundObjectId}set backgroundObjectId(t){this._backgroundObjectId=t}get liveSectionObjectId(){return this._liveSectionObjectId}set liveSectionObjectId(t){this._liveSectionObjectId=t}dxfOutFields(t){return super.dxfOutFields(t),t.writeSubclassMarker("AcDbViewTableRecord"),t.writeString(2,this.name),t.writeInt16(70,this.standardFlags),t.writeDouble(40,this.gsView.viewHeight),t.writePoint2d(10,this.centerPoint),t.writeDouble(41,this.viewWidth),t.writePoint3d(11,this.gsView.viewDirectionFromTarget),t.writePoint3d(12,this.gsView.viewTarget),t.writeDouble(42,this.gsView.lensLength),t.writeDouble(43,this.gsView.frontClippingPlane),t.writeDouble(44,this.gsView.backClippingPlane),t.writeAngle(50,this.gsView.viewTwistAngle),t.writeInt16(71,this.gsView.viewMode),t.writeInt16(281,this.gsView.renderMode),t.writeInt16(72,this.ucsAssociated?1:0),t.writeInt16(73,this.cameraPlottable?1:0),t.writeObjectId(332,this.backgroundObjectId),t.writeObjectId(334,this.liveSectionObjectId),t.writeObjectId(348,this.gsView.visualStyleObjectId),this.ucsAssociated&&(t.writePoint3d(110,this.gsView.ucsOrigin),t.writePoint3d(111,this.gsView.ucsXAxis),t.writePoint3d(112,this.gsView.ucsYAxis),t.writeInt16(79,this.gsView.orthographicType),t.writeDouble(146,this.ucsElevation),t.writeObjectId(345,this.ucsObjectId),t.writeObjectId(346,this.ucsBaseObjectId)),this}}var et,es,X,q,ss,Mt,xe,Vt,at,Dt,vt,be,fe,Ie,_t,jt,is,ns,Se,Ee,rs,as,os,wt,Wt,W,Pe,hs,M,ot,ls,ht,cs,Gt,V,ds,Ht,Ae,Zi,Qi,kt,us,Te,xt,Ut,Xt,Yt,ps,ms,$t,Me,ve,Ji,gs,ke,qt,Le,st,Kt,bt,tn,it,en,Zt,ft,Oe,ys,Ne,It,Qt,St,Jt,sn,Ce,Et;(et={})[et.None=0]="None",et[et.Anonymous=1]="Anonymous",et[et.NonConstant=2]="NonConstant",et[et.Xref=4]="Xref",et[et.XrefOverlay=8]="XrefOverlay",et[et.ExternallyDependent=16]="ExternallyDependent",et[et.ResolvedOrDependent=32]="ResolvedOrDependent",et[et.ReferencedXref=64]="ReferencedXref";(es={})[es.BYBLOCK=0]="BYBLOCK",es[es.BYLAYER=256]="BYLAYER";(X={})[X.Rotated=0]="Rotated",X[X.Aligned=1]="Aligned",X[X.Angular=2]="Angular",X[X.Diameter=3]="Diameter",X[X.Radius=4]="Radius",X[X.Angular3Point=5]="Angular3Point",X[X.Ordinate=6]="Ordinate",X[X.ReferenceIsExclusive=32]="ReferenceIsExclusive",X[X.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",X[X.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag";(q={})[q.TopLeft=1]="TopLeft",q[q.TopCenter=2]="TopCenter",q[q.TopRight=3]="TopRight",q[q.MiddleLeft=4]="MiddleLeft",q[q.MiddleCenter=5]="MiddleCenter",q[q.MiddleRight=6]="MiddleRight",q[q.BottomLeft=7]="BottomLeft",q[q.BottomCenter=8]="BottomCenter",q[q.BottomRight=9]="BottomRight";(ss={})[ss.AtLeast=1]="AtLeast",ss[ss.Exact=2]="Exact";var Gr=((Mt={})[Mt.Center=0]="Center",Mt[Mt.Above=1]="Above",Mt[Mt.Outside=2]="Outside",Mt[Mt.JIS=3]="JIS",Mt[Mt.Below=4]="Below",Mt);(xe={})[xe.WithDimension=0]="WithDimension",xe[xe.AddLeader=1]="AddLeader",xe[xe.Independent=2]="Independent";(Vt={})[Vt.BothOutside=0]="BothOutside",Vt[Vt.ArrowFirst=1]="ArrowFirst",Vt[Vt.TextFirst=2]="TextFirst",Vt[Vt.Auto=3]="Auto";var Ue=((at={})[at.Feet=0]="Feet",at[at.None=1]="None",at[at.Inch=2]="Inch",at[at.FeetAndInch=3]="FeetAndInch",at[at.Leading=4]="Leading",at[at.Trailing=8]="Trailing",at[at.LeadingAndTrailing=12]="LeadingAndTrailing",at),Bl=((Dt={})[Dt.None=0]="None",Dt[Dt.Leading=1]="Leading",Dt[Dt.Trailing=2]="Trailing",Dt[Dt.LeadingAndTrailing=3]="LeadingAndTrailing",Dt),Rl=((vt={})[vt.Center=0]="Center",vt[vt.First=1]="First",vt[vt.Second=2]="Second",vt[vt.OverFirst=3]="OverFirst",vt[vt.OverSecond=4]="OverSecond",vt),zl=((be={})[be.Bottom=0]="Bottom",be[be.Center=1]="Center",be[be.Top=2]="Top",be);(fe={})[fe.None=0]="None",fe[fe.UseDrawingBackground=1]="UseDrawingBackground",fe[fe.Custom=2]="Custom";(Ie={})[Ie.Horizontal=0]="Horizontal",Ie[Ie.Diagonal=1]="Diagonal",Ie[Ie.NotStacked=2]="NotStacked";(_t={})[_t.Scientific=1]="Scientific",_t[_t.Decimal=2]="Decimal",_t[_t.Engineering=3]="Engineering",_t[_t.Architectural=4]="Architectural",_t[_t.Fractional=5]="Fractional",_t[_t.WindowDesktop=6]="WindowDesktop";(jt={})[jt.Decimal=0]="Decimal",jt[jt.DegreesMinutesSecond=1]="DegreesMinutesSecond",jt[jt.Gradian=2]="Gradian",jt[jt.Radian=3]="Radian";var Vl=((is={})[is.PatternFill=0]="PatternFill",is[is.SolidFill=1]="SolidFill",is);(ns={})[ns.NonAssociative=0]="NonAssociative",ns[ns.Associative=1]="Associative";(Se={})[Se.Normal=0]="Normal",Se[Se.Outer=1]="Outer",Se[Se.Ignore=2]="Ignore";(Ee={})[Ee.UserDefined=0]="UserDefined",Ee[Ee.Predefined=1]="Predefined",Ee[Ee.Custom=2]="Custom";(rs={})[rs.NotAnnotated=0]="NotAnnotated",rs[rs.Annotated=1]="Annotated";(as={})[as.Solid=0]="Solid",as[as.Gradient=1]="Gradient";(os={})[os.TwoColor=0]="TwoColor",os[os.OneColor=1]="OneColor";var Dl=((wt={})[wt.Default=0]="Default",wt[wt.External=1]="External",wt[wt.Polyline=2]="Polyline",wt[wt.Derived=4]="Derived",wt[wt.Textbox=8]="Textbox",wt[wt.Outermost=16]="Outermost",wt),Js=((Wt={})[Wt.Line=1]="Line",Wt[Wt.Circular=2]="Circular",Wt[Wt.Elliptic=3]="Elliptic",Wt[Wt.Spline=4]="Spline",Wt),jl=((W={})[W.Off=0]="Off",W[W.Solid=1]="Solid",W[W.Dashed=2]="Dashed",W[W.Dotted=3]="Dotted",W[W.ShotDash=4]="ShotDash",W[W.MediumDash=5]="MediumDash",W[W.LongDash=6]="LongDash",W[W.DoubleShortDash=7]="DoubleShortDash",W[W.DoubleMediumDash=8]="DoubleMediumDash",W[W.DoubleLongDash=9]="DoubleLongDash",W[W.DoubleMediumLongDash=10]="DoubleMediumLongDash",W[W.SparseDot=11]="SparseDot",W);jl.Off;(Pe={})[Pe.Standard=-3]="Standard",Pe[Pe.ByLayer=-2]="ByLayer",Pe[Pe.ByBlock=-1]="ByBlock";(hs={})[hs.English=0]="English",hs[hs.Metric=1]="Metric";(M={})[M.PERSPECTIVE_MODE=1]="PERSPECTIVE_MODE",M[M.FRONT_CLIPPING=2]="FRONT_CLIPPING",M[M.BACK_CLIPPING=4]="BACK_CLIPPING",M[M.UCS_FOLLOW=8]="UCS_FOLLOW",M[M.FRONT_CLIP_NOT_AT_EYE=16]="FRONT_CLIP_NOT_AT_EYE",M[M.UCS_ICON_VISIBILITY=32]="UCS_ICON_VISIBILITY",M[M.UCS_ICON_AT_ORIGIN=64]="UCS_ICON_AT_ORIGIN",M[M.FAST_ZOOM=128]="FAST_ZOOM",M[M.SNAP_MODE=256]="SNAP_MODE",M[M.GRID_MODE=512]="GRID_MODE",M[M.ISOMETRIC_SNAP_STYLE=1024]="ISOMETRIC_SNAP_STYLE",M[M.HIDE_PLOT_MODE=2048]="HIDE_PLOT_MODE",M[M.K_ISO_PAIR_TOP=4096]="K_ISO_PAIR_TOP",M[M.K_ISO_PAIR_RIGHT=8192]="K_ISO_PAIR_RIGHT",M[M.VIEWPORT_ZOOM_LOCKING=16384]="VIEWPORT_ZOOM_LOCKING",M[M.UNUSED=32768]="UNUSED",M[M.NON_RECTANGULAR_CLIPPING=65536]="NON_RECTANGULAR_CLIPPING",M[M.VIEWPORT_OFF=131072]="VIEWPORT_OFF",M[M.GRID_BEYOND_DRAWING_LIMITS=262144]="GRID_BEYOND_DRAWING_LIMITS",M[M.ADAPTIVE_GRID_DISPLAY=524288]="ADAPTIVE_GRID_DISPLAY",M[M.SUBDIVISION_BELOW_SPACING=1048576]="SUBDIVISION_BELOW_SPACING",M[M.GRID_FOLLOWS_WORKPLANE=2097152]="GRID_FOLLOWS_WORKPLANE";(ot={})[ot.OPTIMIZED_2D=0]="OPTIMIZED_2D",ot[ot.WIREFRAME=1]="WIREFRAME",ot[ot.HIDDEN_LINE=2]="HIDDEN_LINE",ot[ot.FLAT_SHADED=3]="FLAT_SHADED",ot[ot.GOURAUD_SHADED=4]="GOURAUD_SHADED",ot[ot.FLAT_SHADED_WITH_WIREFRAME=5]="FLAT_SHADED_WITH_WIREFRAME",ot[ot.GOURAUD_SHADED_WITH_WIREFRAME=6]="GOURAUD_SHADED_WITH_WIREFRAME";(ls={})[ls.UCS_UNCHANGED=0]="UCS_UNCHANGED",ls[ls.HAS_OWN_UCS=1]="HAS_OWN_UCS";(ht={})[ht.NON_ORTHOGRAPHIC=0]="NON_ORTHOGRAPHIC",ht[ht.TOP=1]="TOP",ht[ht.BOTTOM=2]="BOTTOM",ht[ht.FRONT=3]="FRONT",ht[ht.BACK=4]="BACK",ht[ht.LEFT=5]="LEFT",ht[ht.RIGHT=6]="RIGHT";(cs={})[cs.ONE_DISTANT_LIGHT=0]="ONE_DISTANT_LIGHT",cs[cs.TWO_DISTANT_LIGHTS=1]="TWO_DISTANT_LIGHTS";(Gt={})[Gt.ByLayer=0]="ByLayer",Gt[Gt.ByBlock=1]="ByBlock",Gt[Gt.ByDictionaryDefault=2]="ByDictionaryDefault",Gt[Gt.ByObject=3]="ByObject";(V={})[V.NotAllowed=0]="NotAllowed",V[V.AllowErase=1]="AllowErase",V[V.AllowTransform=2]="AllowTransform",V[V.AllowChangeColor=4]="AllowChangeColor",V[V.AllowChangeLayer=8]="AllowChangeLayer",V[V.AllowChangeLinetype=16]="AllowChangeLinetype",V[V.AllowChangeLinetypeScale=32]="AllowChangeLinetypeScale",V[V.AllowChangeVisibility=64]="AllowChangeVisibility",V[V.AllowClone=128]="AllowClone",V[V.AllowChangeLineweight=256]="AllowChangeLineweight",V[V.AllowChangePlotStyleName=512]="AllowChangePlotStyleName",V[V.AllowAllExceptClone=895]="AllowAllExceptClone",V[V.AllowAll=1023]="AllowAll",V[V.DisableProxyWarning=1024]="DisableProxyWarning",V[V.R13FormatProxy=32768]="R13FormatProxy";function L(s,t,e){return s.code===t&&(e==null||s.value===e)}function pe(s){let t={};s.rewind();let e=s.next(),i=e.code;if(t.x=e.value,(e=s.next()).code!==i+10)throw Error("Expected code for point value to be 20 but got "+e.code+".");return t.y=e.value,(e=s.next()).code!==i+20?s.rewind():t.z=e.value,t}let js=Symbol();function S(s,t){return(e,i,n)=>{let r=function(l,c=!1){return l.reduce((d,p)=>{p.pushContext&&d.push({});let m=d[d.length-1];for(let u of typeof p.code=="number"?[p.code]:p.code){let g=m[u]??(m[u]=[]);p.isMultiple&&g.length&&c&&console.warn(`Snippet ${g[g.length-1].name} for code(${u}) is shadowed by ${p.name}`),g.push(p)}return d},[{}])}(s,i.debug),a=!1,o=r.length-1;for(;!L(e,0,"EOF");){let l=function(x,w,P){return x.find((I,k)=>{var A;return k>=P&&((A=I[w])==null?void 0:A.length)})}(r,e.code,o),c=l==null?void 0:l[e.code],d=c==null?void 0:c[c.length-1];if(!l||!d){i.rewind();break}d.isMultiple||l[e.code].pop();let{name:p,parser:m,isMultiple:u,isReducible:g}=d,y=m==null?void 0:m(e,i,n);if(y===js){i.rewind();break}if(p){let[x,w]=Wl(n,p);u&&!g?(Object.prototype.hasOwnProperty.call(x,w)||(x[w]=[]),x[w].push(y)):x[w]=y}d.pushContext&&(o-=1),a=!0,e=i.next()}return t&&Object.setPrototypeOf(n,t),a}}function Wl(s,t){let e=t.split(".");if(!e.length)throw Error("[parserGenerator::getObjectByPath] Invalid empty path");let i=s;for(let n=0;n<e.length-1;++n){let r=nn(e[n]),a=nn(e[n+1]);Object.prototype.hasOwnProperty.call(i,r)||(typeof a=="number"?i[r]=[]:i[r]={}),i=i[r]}return[i,nn(e[e.length-1])]}function nn(s){let t=Number.parseInt(s);return Number.isNaN(t)?s:t}function h({value:s}){return s}function _(s,t){return pe(t)}function v({value:s}){return!!s}function Gl({value:s}){return s.trim()}let Hl=[{code:281,name:"isEntity",parser:v},{code:280,name:"wasProxy",parser:v},{code:91,name:"instanceCount",parser:h},{code:90,name:"proxyFlag",parser:h},{code:3,name:"appName",parser:h},{code:2,name:"cppClassName",parser:h},{code:1,name:"name",parser:h}],Ul=S(Hl),Xl=[{code:0,name:"classes",isMultiple:!0,parser(s,t){if(s.value!=="CLASS")return js;s=t.next();let e={};return Ul(s,t,e),e}}],Yl=S(Xl);(ds={})[ds.RayTrace=0]="RayTrace",ds[ds.ShadowMap=1]="ShadowMap";function ze(s,t,e){for(;L(s,102);){var i;let n=s.value;if(s=t.next(),!n.startsWith("{")){t.debug&&console.warn(`Invalid application group, expected to start with "{" but received: ${n}`),function(a,o){for(;!L(a,102)&&!L(a,0,"EOF");)a=o.next()}(s,t),s=t.next();continue}let r=n.slice(1).trim();e.extensions??(e.extensions={}),(i=e.extensions)[r]??(i[r]=[]),function(a,o,l){for(;!L(a,102,"}")&&!L(a,0,"EOF");)l.push(a),a=o.next()}(s,t,e.extensions[r]),s=t.next()}t.rewind()}let $l=[{code:1001,name:"xdata",isMultiple:!0,parser:ko}],ql=new Set([1010,1011,1012,1013]);function ko(s,t){var n;if(!L(s,1001))throw Error("XData must starts with code 1001");let e={appName:s.value,value:[]};s=t.next();let i=[e.value];for(;!L(s,0,"EOF")&&!L(s,1001)&&s.code>=1e3;){let r=i[i.length-1];if(s.code===1002){s.value==="{"?i.push([]):(i.pop(),(n=i[i.length-1])==null||n.push(r)),s=t.next();continue}ql.has(s.code)?r.push(pe(t)):r.push(s.value),s=t.next()}return t.rewind(),e}(Ht={})[Ht.CAST_AND_RECEIVE=0]="CAST_AND_RECEIVE",Ht[Ht.CAST=1]="CAST",Ht[Ht.RECEIVE=2]="RECEIVE",Ht[Ht.IGNORE=3]="IGNORE";let R=[...$l,{code:284,name:"shadowMode",parser:h},{code:390,name:"plotStyleHardId",parser:h},{code:380,name:"plotStyleType",parser:h},{code:440,name:"transparency",parser:h},{code:430,name:"colorName",parser:h},{code:420,name:"color",parser:h},{code:310,name:"proxyEntity",isMultiple:!0,isReducible:!0,parser:(s,t,e)=>(e.proxyEntity??"")+s.value},{code:[92,160],name:"proxyByte",parser:h},{code:60,name:"isVisible",parser:v},{code:48,name:"lineTypeScale",parser:h},{code:370,name:"lineweight",parser:h},{code:62,name:"colorIndex",parser:h},{code:347,name:"materialObjectHardId",parser:h},{code:6,name:"lineType",parser:h},{code:8,name:"layer",parser:h},{code:410,name:"layoutTabName",parser:h},{code:67,name:"isInPaperSpace",parser:v},{code:100},{code:330,name:"ownerBlockRecordSoftId",parser:h},{code:102,parser:ze},{code:102,parser:ze},{code:102,parser:ze},{code:5,name:"handle",parser:h}];function Gi(s){return[{code:3,name:s,parser:(t,e,i)=>(i._code3text=(i._code3text??"")+t.value,i._code3text+(i._code1text??"")),isMultiple:!0,isReducible:!0},{code:1,name:s,parser:(t,e,i)=>(i._code1text=t.value,(i._code3text??"")+i._code1text)}]}function Lo(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Kl={extrusionDirection:{x:0,y:0,z:1}},Zl=[{code:210,name:"extrusionDirection",parser:_},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:100,name:"subclassMarker",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100},...R];class Oo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Lo(this,"parser",S(Zl,Kl))}}Lo(Oo,"ForEntityName","ARC");(Ae={})[Ae.BeforeText=0]="BeforeText",Ae[Ae.AboveText=1]="AboveText",Ae[Ae.None=2]="None";let Un=[{name:"DIMPOST",code:3},{name:"DIMAPOST",code:4,defaultValue:""},{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:"DIMFXL",code:49,defaultValue:1},{name:"DIMJOGANG",code:50,defaultValue:45},{name:"DIMTFILL",code:69,defaultValue:0},{name:"DIMTFILLCLR",code:70,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:Gr.Above,defaultValueImperial:Gr.Center},{name:"DIMZIN",code:78,defaultValue:Ue.Trailing,defaultValueImperial:Ue.Feet},{name:"DIMAZIN",code:79,defaultValue:Bl.None},{name:"DIMARCSYM",code:90,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:"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,defaultValue:0},{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:3,defaultValueImperial:2},{name:"DIMAUNIT",code:275,defaultValue:0},{name:"DIMFRAC",code:276,defaultValue:0},{name:"DIMLUNIT",code:277,defaultValue:2},{name:"DIMDSEP",code:278,defaultValue:44,defaultValueImperial:46},{name:"DIMTMOVE",code:279,defaultValue:0},{name:"DIMJUST",code:280,defaultValue:Rl.Center},{name:"DIMSD1",code:281,defaultValue:0},{name:"DIMSD2",code:282,defaultValue:0},{name:"DIMTOLJ",code:283,defaultValue:zl.Center},{name:"DIMTZIN",code:284,defaultValue:Ue.Trailing,defaultValueImperial:Ue.Feet},{name:"DIMALTZ",code:285,defaultValue:Ue.Trailing},{name:"DIMALTTZ",code:286,defaultValue:Ue.Trailing},{name:"DIMFIT",code:287},{name:"DIMUPT",code:288,defaultValue:0},{name:"DIMATFIT",code:289,defaultValue:3},{name:"DIMFXLON",code:290,defaultValue:0},{name:"DIMTXTDIRECTION",code:294,defaultValue:0},{name:"DIMTXSTY",code:340,defaultValue:"Standard"},{name:"DIMLDRBLK",code:341,defaultValue:""},{name:"DIMBLK",code:342,defaultValue:""},{name:"DIMBLK1",code:343,defaultValue:""},{name:"DIMBLK2",code:344,defaultValue:""},{name:"DIMLTYPE",code:345,defaultValue:""},{name:"DIMLTEX1",code:346,defaultValue:""},{name:"DIMLTEX2",code:347,defaultValue:""},{name:"DIMLWD",code:371,defaultValue:-2},{name:"DIMLWE",code:372,defaultValue:-2}],No=[{code:3,name:"styleName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:51,name:"ocsRotation",parser:h},{code:53,name:"textRotation",parser:h},{code:1,name:"text",parser:h},{code:42,name:"measurement",parser:h},{code:72,name:"textLineSpacingStyle",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:70,name:"dimensionType",parser:h},{code:11,name:"textPoint",parser:_},{code:10,name:"definitionPoint",parser:_},{code:2,name:"name",parser:h},{code:280,name:"version",parser:h},{code:100}],Ql=[{code:100},{code:52,name:"obliqueAngle",parser:h},{code:50,name:"rotationAngle",parser:h},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:12,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],Jl=[{code:16,name:"arcPoint",parser:_},{code:15,name:"centerPoint",parser:_},{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],tc=[{code:14,name:"subDefinitionPoint2",parser:_},{code:13,name:"subDefinitionPoint1",parser:_},{code:100,name:"subclassMarker",parser:h}],ec=[{code:40,name:"leaderLength",parser:h},{code:15,name:"subDefinitionPoint",parser:_},{code:100,name:"subclassMarker",parser:h}],sc=[{code:100,parser(s,t,e){let i=function(n){switch(n){case"AcDbAlignedDimension":return S(Ql);case"AcDb3PointAngularDimension":case"AcDb2LineAngularDimension":return S(Jl);case"AcDbOrdinateDimension":return S(tc);case"AcDbRadialDimension":case"AcDbDiametricDimension":return S(ec)}return null}(s.value);if(!i)return js;i(s,t,e)},pushContext:!0},...Un.map(s=>({...s,parser:h})),...No,...R];class ii{parseEntity(t,e){let i={};return S(sc)(e,t,i),i}}(Zi="ForEntityName")in ii?Object.defineProperty(ii,Zi,{value:"DIMENSION",enumerable:!0,configurable:!0,writable:!0}):ii[Zi]="DIMENSION";let ic=[{code:73},{code:17,name:"leaderEnd",parser:_},{code:16,name:"leaderStart",parser:_},{code:71,name:"hasLeader",parser:v},{code:41,name:"endAngle",parser:h},{code:40,name:"startAngle",parser:h},{code:70,name:"isPartial",parser:v},{code:15,name:"centerPoint",parser:_},{code:14,name:"xline2Point",parser:_},{code:13,name:"xline1Point",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...Un.map(s=>({...s,parser:h})),...No,...R];class ni{parseEntity(t,e){let i={};return S(ic)(e,t,i),i}}(Qi="ForEntityName")in ni?Object.defineProperty(ni,Qi,{value:"ARC_DIMENSION",enumerable:!0,configurable:!0,writable:!0}):ni[Qi]="ARC_DIMENSION";(kt={})[kt.NONE=0]="NONE",kt[kt.INVISIBLE=1]="INVISIBLE",kt[kt.CONSTANT=2]="CONSTANT",kt[kt.VERIFICATION_REQUIRED=4]="VERIFICATION_REQUIRED",kt[kt.PRESET=8]="PRESET";(us={})[us.MULTILINE=2]="MULTILINE",us[us.CONSTANT_MULTILINE=4]="CONSTANT_MULTILINE";(Te={})[Te.NONE=0]="NONE",Te[Te.MIRRORED_X=2]="MIRRORED_X",Te[Te.MIRRORED_Y=4]="MIRRORED_Y";var nc=((xt={})[xt.LEFT=0]="LEFT",xt[xt.CENTER=1]="CENTER",xt[xt.RIGHT=2]="RIGHT",xt[xt.ALIGNED=3]="ALIGNED",xt[xt.MIDDLE=4]="MIDDLE",xt[xt.FIT=5]="FIT",xt),rc=((Ut={})[Ut.BASELINE=0]="BASELINE",Ut[Ut.BOTTOM=1]="BOTTOM",Ut[Ut.MIDDLE=2]="MIDDLE",Ut[Ut.TOP=3]="TOP",Ut);function Co(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Fo={thickness:0,rotation:0,xScale:1,obliqueAngle:0,styleName:"STANDARD",generationFlag:0,halign:nc.LEFT,valign:rc.BASELINE,extrusionDirection:{x:0,y:0,z:1}},Bo=[{code:73,name:"valign",parser:h},{code:100},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:72,name:"valign",parser:h},{code:72,name:"halign",parser:h},{code:71,name:"generationFlag",parser:h},{code:7,name:"styleName",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"xScale",parser:h},{code:50,name:"rotation",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Ro{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Co(this,"parser",S(Bo,Fo))}}function zo(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Co(Ro,"ForEntityName","TEXT");let ac={...Fo},oc=[{code:2},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardIds",isMultiple:!0,parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:v},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedRecord",parser:v},{code:100},{code:280,name:"isLocked",parser:v},{code:74,name:"valign",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:3,name:"prompt",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},...Bo.slice(2)];class Vo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){zo(this,"parser",S(oc,ac))}}function hc(s,t){let e={};for(let i of s){let n=t(i);n!=null&&(e[n]??(e[n]=[]),e[n].push(i))}return e}function*Ci(s,t=1/0,e=1){for(let i=s;i!==t;i+=e)yield i}function Hr(s){return{x:s.x??0,y:s.y??0,z:s.z??0}}zo(Vo,"ForEntityName","ATTDEF");var lc=[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 cc(s){return lc[s]}function dc(s){s.rewind();let t=s.next();if(t.code!==101)throw Error("Bad call for skipEmbeddedObject()");do t=s.next();while(t.code!==0);s.rewind()}function uc(s,t,e){if(L(t,102))return ze(t,e,s),!0;switch(t.code){case 0:s.type=t.value;break;case 5:s.handle=t.value;break;case 330:s.ownerBlockRecordSoftId=t.value;break;case 67:s.isInPaperSpace=!!t.value;break;case 8:s.layer=t.value;break;case 6:s.lineType=t.value;break;case 347:s.materialObjectHardId=t.value;break;case 62:s.colorIndex=t.value,s.color=cc(Math.abs(t.value));break;case 370:s.lineweight=t.value;break;case 48:s.lineTypeScale=t.value;break;case 60:s.isVisible=!!t.value;break;case 92:s.proxyByte=t.value;break;case 310:s.proxyEntity=t.value;break;case 100:break;case 420:s.color=t.value;break;case 430:s.transparency=t.value;break;case 390:s.plotStyleHardId=t.value;break;case 284:s.shadowMode=t.value;break;case 1001:(s.xdata??(s.xdata=[])).push(ko(t,e));break;default:return!1}return!0}function Do(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let pc={textStyle:"STANDARD",extrusionDirection:{x:0,y:0,z:1},rotation:0},ri=[{code:46,name:"annotationHeight",parser:h},{code:101,parser(s,t){dc(t)}},{code:50,name:"columnHeight",parser:h},{code:49,name:"columnGutter",parser:h},{code:48,name:"columnWidth",parser:h},{code:79,name:"columnAutoHeight",parser:h},{code:78,name:"columnFlowReversed",parser:h},{code:76,name:"columnCount",parser:h},{code:75,name:"columnType",parser:h},{code:441,name:"backgroundFillTransparency",parser:h},{code:63,name:"backgroundFillColor",parser:h},{code:45,name:"fillBoxScale",parser:h},{code:[...Ci(430,440)],name:"backgroundColor",parser:h},{code:[...Ci(420,430)],name:"backgroundColor",parser:h},{code:90,name:"backgroundFill",parser:h},{code:44,name:"lineSpacing",parser:h},{code:73,name:"lineSpacingStyle",parser:h},{code:50,name:"rotation",parser:h},{code:43},{code:42},{code:11,name:"direction",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:7,name:"styleName",parser:h},...Gi("text"),{code:72,name:"drawingDirection",parser:h},{code:71,name:"attachmentPoint",parser:h},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:10,name:"insertionPoint",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class jo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Do(this,"parser",S(ri,pc))}}function Wo(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Do(jo,"ForEntityName","MTEXT");let mc={thickness:0,rotation:0,scale:1,obliqueAngle:0,textStyle:"STANDARD",textGenerationFlag:0,horizontalJustification:0,verticalJustification:0,extrusionDirection:{x:0,y:0,z:1}},gc=[...ri.slice(ri.findIndex(({name:s})=>s==="columnType"),ri.findIndex(({name:s})=>s==="subclassMarker")+1),{code:100},{code:0,parser(s){if(!L(s,0,"MTEXT"))return js}},{code:2,name:"definitionTag",parser:h},{code:40,name:"annotationScale",parser:h},{code:10,name:"alignmentPoint",parser:_},{code:340,name:"secondaryAttributesHardId",parser:h},{code:70,name:"numberOfSecondaryAttributes",parser:h},{code:70,name:"isReallyLocked",parser:v},{code:70,name:"mtextFlag",parser:h},{code:280,name:"isDuplicatedEntriesKeep",parser:v},{code:100},{code:280,name:"lockPositionFlag",parser:v},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"alignmentPoint",parser:_},{code:74,name:"verticalJustification",parser:h},{code:72,name:"horizontalJustification",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:7,name:"textStyle",parser:h},{code:51,name:"obliqueAngle",parser:h},{code:41,name:"scale",parser:h},{code:50,name:"rotation",parser:h},{code:73},{code:70,name:"attributeFlag",parser:h},{code:2,name:"tag",parser:h},{code:280},{code:100,name:"subclassMarker",parser:h},{code:1,name:"text",parser:h},{code:40,name:"textHeight",parser:h},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100},...R];class Go{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Wo(this,"parser",S(gc,mc))}}function Ho(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Wo(Go,"ForEntityName","ATTRIB");let yc=[...Gi("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Uo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ho(this,"parser",S(yc))}}function Xo(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Ho(Uo,"ForEntityName","BODY");let _c={thickness:0,extrusionDirection:{x:0,y:0,z:1}},wc=[{code:210,name:"extrusionDirection",parser:_},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Yo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Xo(this,"parser",S(wc,_c))}}function $o(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Xo(Yo,"ForEntityName","CIRCLE");let xc={extrusionDirection:{x:0,y:0,z:1}},bc=[{code:42,name:"endAngle",parser:h},{code:41,name:"startAngle",parser:h},{code:40,name:"axisRatio",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:11,name:"majorAxisEndPoint",parser:_},{code:10,name:"center",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class qo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){$o(this,"parser",S(bc,xc))}}function Ko(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}$o(qo,"ForEntityName","ELLIPSE");let fc=[{code:13,name:"vertices.3",parser:_},{code:12,name:"vertices.2",parser:_},{code:11,name:"vertices.1",parser:_},{code:10,name:"vertices.0",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class Zo{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ko(this,"parser",S(fc))}}Ko(Zo,"ForEntityName","3DFACE");(Xt={})[Xt.First=1]="First",Xt[Xt.Second=2]="Second",Xt[Xt.Third=4]="Third",Xt[Xt.Fourth=8]="Fourth";let Qo=[{code:330,name:"sourceBoundaryObjects",parser:h,isMultiple:!0},{code:97,name:"numberOfSourceBoundaryObjects",parser:h}],Ic=[{code:11,name:"end",parser:_},{code:10,name:"start",parser:_}],Sc=[{code:73,name:"isCCW",parser:v},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"radius",parser:h},{code:10,name:"center",parser:_}],Ec=[{code:73,name:"isCCW",parser:v},{code:51,name:"endAngle",parser:h},{code:50,name:"startAngle",parser:h},{code:40,name:"lengthOfMinorAxis",parser:h},{code:11,name:"end",parser:_},{code:10,name:"center",parser:_}],Pc=[{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:11,name:"fitDatum",isMultiple:!0,parser:_},{code:97,name:"numberOfFitData",parser:h},{code:10,name:"controlPoints",isMultiple:!0,parser(s,t){let e={...pe(t),weight:1};return(s=t.next()).code===42?e.weight=s.value:t.rewind(),e}},{code:40,name:"knots",isMultiple:!0,parser:h},{code:96,name:"numberOfControlPoints",parser:h},{code:95,name:"numberOfKnots",parser:h},{code:74,name:"isPeriodic",parser:v},{code:73,name:"splineFlag",parser:h},{code:94,name:"degree",parser:h}],Ac={[Js.Line]:Ic,[Js.Circular]:Sc,[Js.Elliptic]:Ec,[Js.Spline]:Pc},Tc=[...Qo,{code:72,name:"edges",parser(s,t){let e={type:s.value},i=S(Ac[e.type]);if(!i)throw Error(`Invalid edge type ${e.type}`);return i(s=t.next(),t,e),e},isMultiple:!0},{code:93,name:"numberOfEdges",parser:h}],Mc=[...Qo,{code:10,name:"vertices",parser(s,t){let e={...pe(t),bulge:0};return(s=t.next()).code===42?e.bulge=s.value:t.rewind(),e},isMultiple:!0},{code:93,name:"numberOfVertices",parser:h},{code:73,name:"isClosed",parser:v},{code:72,name:"hasBulge",parser:v}];function vc(s,t){let e={boundaryPathTypeFlag:s.value},i=e.boundaryPathTypeFlag&Dl.Polyline;return s=t.next(),i?S(Mc)(s,t,e):S(Tc)(s,t,e),e}let kc=[{code:49,name:"dashLengths",parser:h,isMultiple:!0},{code:79,name:"numberOfDashLengths",parser:h},{code:45,name:"offset",parser:Ur},{code:43,name:"base",parser:Ur},{code:53,name:"angle",parser:h}];function Ur(s,t){let e=s.code+1,i={x:s.value,y:1};return(s=t.next()).code===e?i.y=s.value:t.rewind(),i}function Lc(s,t){let e={};return S(kc)(s,t,e),e}function Jo(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Oc={extrusionDirection:{x:0,y:0,z:1},gradientRotation:0,colorTint:0},Nc=[{code:470},{code:463},{code:462,name:"colorTint",parser:h},{code:461,name:"gradientDefinition",parser:h},{code:460,name:"gradientRotation",parser:h},{code:453,name:"numberOfColors",parser:h},{code:452,name:"gradientColorFlag",parser:h},{code:451},{code:450,name:"gradientFlag",parser:h},{code:10,name:"seedPoints",parser:_,isMultiple:!0},{code:99},{code:11,name:"offsetVector",parser:_},{code:98,name:"numberOfSeedPoints",parser:h},{code:47,name:"pixelSize",parser:h},{code:53,name:"definitionLines",parser:Lc,isMultiple:!0},{code:78,name:"numberOfDefinitionLines",parser:h},{code:77,name:"isDouble",parser:v},{code:73,name:"isAnnotated",parser:v},{code:41,name:"patternScale",parser:h},{code:52,name:"patternAngle",parser:h},{code:76,name:"patternType",parser:h},{code:75,name:"hatchStyle",parser:h},{code:92,name:"boundaryPaths",parser:vc,isMultiple:!0},{code:91,name:"numberOfBoundaryPaths",parser:h},{code:71,name:"associativity",parser:h},{code:63,name:"patternFillColor",parser:h},{code:70,name:"solidFill",parser:h},{code:2,name:"patternName",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"elevationPoint",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...R];class th{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Jo(this,"parser",S(Nc,Oc))}}function eh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Jo(th,"ForEntityName","HATCH");let Cc={brightness:50,contrast:50,fade:0,clippingBoundaryPath:[]},Fc=[{code:290,name:"clipMode",parser:h},{code:14,name:"clippingBoundaryPath",isMultiple:!0,parser:_},{code:91,name:"countBoundaryPoints",parser:h},{code:71,name:"clippingBoundaryType",parser:h},{code:360,name:"imageDefReactorHandle",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipped",parser:v},{code:70,name:"flags",parser:h},{code:340,name:"imageDefHandle",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vPixel",parser:_},{code:11,name:"uPixel",parser:_},{code:10,name:"position",parser:_},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class sh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){eh(this,"parser",S(Fc,Cc))}}eh(sh,"ForEntityName","IMAGE");(Yt={})[Yt.ShowImage=1]="ShowImage",Yt[Yt.ShowImageWhenNotAlignedWithScreen=2]="ShowImageWhenNotAlignedWithScreen",Yt[Yt.UseClippingBoundary=4]="UseClippingBoundary",Yt[Yt.TransparencyIsOn=8]="TransparencyIsOn";(ps={})[ps.Rectangular=1]="Rectangular",ps[ps.Polygonal=2]="Polygonal";(ms={})[ms.Outside=0]="Outside",ms[ms.Inside=1]="Inside";function ih(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Bc={xScale:1,yScale:1,zScale:1,rotation:0,columnCount:0,rowCount:0,columnSpacing:0,rowSpacing:0,extrusionDirection:{x:0,y:0,z:1}},Rc=[{code:210,name:"extrusionDirection",parser:_},{code:45,name:"rowSpacing",parser:h},{code:44,name:"columnSpacing",parser:h},{code:71,name:"rowCount",parser:h},{code:70,name:"columnCount",parser:h},{code:50,name:"rotation",parser:h},{code:43,name:"zScale",parser:h},{code:42,name:"yScale",parser:h},{code:41,name:"xScale",parser:h},{code:10,name:"insertionPoint",parser:_},{code:2,name:"name",parser:h},{code:66,name:"isVariableAttributes",parser:v},{code:100,name:"subclassMarker",parser:h},...R];class nh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){ih(this,"parser",S(Rc,Bc))}}function rh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}ih(nh,"ForEntityName","INSERT");let zc={isArrowheadEnabled:!0},Vc=[{code:213,name:"offsetFromAnnotation",parser:_},{code:212,name:"offsetFromBlock",parser:_},{code:211,name:"horizontalDirection",parser:_},{code:210,name:"normal",parser:_},{code:340,name:"associatedAnnotation",parser:h},{code:77,name:"byBlockColor",parser:h},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:76,name:"numberOfVertices",parser:h},{code:41,name:"textWidth",parser:h},{code:40,name:"textHeight",parser:h},{code:75,name:"isHooklineExists",parser:v},{code:74,name:"isHooklineSameDirection",parser:v},{code:73,name:"leaderCreationFlag",parser:h},{code:72,name:"isSpline",parser:v},{code:71,name:"isArrowheadEnabled",parser:v},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class ah{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){rh(this,"parser",S(Vc,zc))}}rh(ah,"ForEntityName","LEADER");($t={})[$t.TextAnnotation=0]="TextAnnotation",$t[$t.ToleranceAnnotation=1]="ToleranceAnnotation",$t[$t.BlockReferenceAnnotation=2]="BlockReferenceAnnotation",$t[$t.NoAnnotation=3]="NoAnnotation";function oh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Dc={thickness:0,extrusionDirection:{x:0,y:0,z:1}},jc=[{code:210,name:"extrusionDirection",parser:_},{code:11,name:"endPoint",parser:_},{code:10,name:"startPoint",parser:_},{code:39,name:"thickness",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class hh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){oh(this,"parser",S(jc,Dc))}}function lh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}oh(hh,"ForEntityName","LINE");let Wc=[{code:280,name:"shadowMapSoftness",parser:h},{code:91,name:"shadowMapSize",parser:h},{code:73,name:"shadowType",parser:h},{code:293,name:"isShadowCast",parser:v},{code:51,name:"falloffAngle",parser:h},{code:50,name:"hotspotAngle",parser:h},{code:42,name:"limitEnd",parser:h},{code:41,name:"limitStart",parser:h},{code:292,name:"isAttenuationLimited",parser:v},{code:72,name:"attenuationType",parser:h},{code:11,name:"target",parser:_},{code:10,name:"position",parser:_},{code:40,name:"intensity",parser:h},{code:291,name:"isPlotGlyph",parser:v},{code:290,name:"isOn",parser:v},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:70,name:"lightType",parser:h},{code:1,name:"name",parser:h},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class ch{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){lh(this,"parser",S(Wc))}}lh(ch,"ForEntityName","LIGHT");(Me={})[Me.Distant=1]="Distant",Me[Me.Point=2]="Point",Me[Me.Spot=3]="Spot";(ve={})[ve.None=0]="None",ve[ve.InverseLinear=1]="InverseLinear",ve[ve.InverseSquare=2]="InverseSquare";let Gc={flag:0,elevation:0,thickness:0,extrusionDirection:{x:0,y:0,z:1},vertices:[]},Hc={bulge:0},Uc=[{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:91,name:"id",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h}],Xc=[{code:210,name:"extrusionDirection",parser:_},{code:10,name:"vertices",isMultiple:!0,parser(s,t){let e={};return S(Uc,Hc)(s,t,e),e}},{code:39,name:"thickness",parser:h},{code:38,name:"elevation",parser:h},{code:43,name:"constantWidth",parser:h},{code:70,name:"flag",parser:h},{code:90,name:"numberOfVertices",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class ai{parseEntity(t,e){let i={};return S(Xc,Gc)(e,t,i),i}}(Ji="ForEntityName")in ai?Object.defineProperty(ai,Ji,{value:"LWPOLYLINE",enumerable:!0,configurable:!0,writable:!0}):ai[Ji]="LWPOLYLINE";(gs={})[gs.IS_CLOSED=1]="IS_CLOSED",gs[gs.PLINE_GEN=128]="PLINE_GEN";function dh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Yc=[{code:90,name:"overridenSubEntityCount",parser:h},{code:140,name:"edgeCreaseWeights",parser:h,isMultiple:!0},{code:95,name:"edgeCreaseCount",parser:h},{code:94,parser(s,t,e){e.edgeCount=s.value,e.edgeIndices=[];for(let i=0;i<e.edgeCount;++i){let n=[];s=t.next(),n[0]=s.value,s=t.next(),n[1]=s.value,e.edgeIndices.push(n)}}},{code:93,parser(s,t,e){e.totalFaceIndices=s.value,e.faceIndices=[];let i=[];for(let r=0;r<e.totalFaceIndices&&!L(s,0);++r)s=t.next(),i.push(s.value);let n=0;for(;n<i.length;){let r=i[n++],a=[];for(let o=0;o<r;++o)a.push(i[n++]);e.faceIndices.push(a)}}},{code:10,name:"vertices",parser:_,isMultiple:!0},{code:92,name:"verticesCount",parser:h},{code:91,name:"subdivisionLevel",parser:h},{code:40,name:"blendCrease",parser:h},{code:72,name:"isBlendCreased",parser:v},{code:71,name:"version",parser:h},{code:100,name:"subclassMarker",parser:Gl,pushContext:!0},...R];class uh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){dh(this,"parser",S(Yc))}}function ph(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}dh(uh,"ForEntityName","MESH");let $c=[{code:42,name:"fillParameters",parser:h,isMultiple:!0},{code:75,name:"fillCount",parser:h},{code:41,name:"parameters",parser:h,isMultiple:!0},{code:74,name:"parameterCount",parser:h}],qc=[{code:[74,41,75,42],name:"elements",parser(s,t){let e=S($c),i={};return e(s,t,i),i},isMultiple:!0},{code:13,name:"miterDirection",parser:_},{code:12,name:"direction",parser:_},{code:11,name:"position",parser:_}],Kc=[{code:[11,12,13],name:"segments",parser(s,t){let e=S(qc),i={};return e(s,t,i),i},isMultiple:!0},{code:210,name:"extrusionDirection",parser:_},{code:10,name:"startPosition",parser:_},{code:73,name:"styleCount",parser:h},{code:72,name:"vertexCount",parser:h},{code:71,name:"flags",parser:h},{code:70,name:"justification",parser:h},{code:40,name:"scale",parser:h},{code:340,name:"styleObjectHandle",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...R];class mh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){ph(this,"parser",S(Kc))}}ph(mh,"ForEntityName","MLINE");(ke={})[ke.Top=0]="Top",ke[ke.Zero=1]="Zero",ke[ke.Bottom=2]="Bottom";(qt={})[qt.HasVertex=1]="HasVertex",qt[qt.Closed=2]="Closed",qt[qt.SuppressStartCaps=4]="SuppressStartCaps",qt[qt.SuppressEndCaps=8]="SuppressEndCaps";(Le={})[Le.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",Le[Le.TOP_TO_BOTTOM=3]="TOP_TO_BOTTOM",Le[Le.BY_STYLE=5]="BY_STYLE";function gh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let Zc={},Qc=[{code:170,name:"multileaderType",parser:h},{code:291,name:"doglegEnabled",parser:v},{code:40,name:"doglegLength",parser:h},{code:172,name:"contentType",parser:h},{code:3,name:"textContent",parser:h},{code:12,name:"textAnchor",parser:_},{code:344,name:"blockHandle",parser:h},{code:15,name:"blockPosition",parser:_},{code:302,name:"leaderSections",parser:function(s,t,e){let i,n={leaderLines:[]};for(;t.hasNext()&&(i=t.next()).code!==303;)switch(i.code){case 10:n.landingPoint=_(i.value,t);break;case 11:n.doglegVector=_(i.value,t);break;case 40:n.doglegLength=i.value;break;case 304:n.leaderLines.push(function(r){let a,o={vertices:[]};for(;r.hasNext()&&(a=r.next()).code!==305;)a.code===10&&o.vertices.push(_(a.value,r));return o}(t))}return n},isMultiple:!0},...R];class yh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){gh(this,"parser",S(Qc,Zc))}}function _h(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}gh(yh,"ForEntityName","MULTILEADER");let Jc={thickness:0,extrusionDirection:{x:0,y:0,z:1},angle:0},td=[{code:50,name:"angle",parser:h},{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class wh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){_h(this,"parser",S(td,Jc))}}function xh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}_h(wh,"ForEntityName","POINT");let ed={startWidth:0,endWidth:0,bulge:0},sd=[{code:91,name:"id",parser:h},{code:[...Ci(71,75)],name:"faces",isMultiple:!0,parser:h},{code:50,name:"tangentDirection",parser:h},{code:70,name:"flag",parser:h},{code:42,name:"bulge",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:30,name:"z",parser:h},{code:20,name:"y",parser:h},{code:10,name:"x",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...R];class Xn{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){xh(this,"parser",S(sd,ed))}}function bh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}xh(Xn,"ForEntityName","VERTEX");let id={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:[]},nd=[{code:0,name:"vertices",isMultiple:!0,parser:(s,t)=>L(s,0,"VERTEX")?(s=t.next(),new Xn().parseEntity(t,s)):js},{code:210,name:"extrusionDirection",parser:_},{code:75,name:"smoothType",parser:h},{code:74,name:"surfaceNDensity",parser:h},{code:73,name:"surfaceMDensity",parser:h},{code:72,name:"meshNVertexCount",parser:h},{code:71,name:"meshMVertexCount",parser:h},{code:41,name:"endWidth",parser:h},{code:40,name:"startWidth",parser:h},{code:70,name:"flag",parser:h},{code:39,name:"thickness",parser:h},{code:30,name:"elevation",parser:h},{code:20},{code:10},{code:66},{code:100,name:"subclassMarker",parser:h},...R];class fh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){bh(this,"parser",S(nd,id))}}bh(fh,"ForEntityName","POLYLINE");(st={})[st.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",st[st.CURVE_FIT=2]="CURVE_FIT",st[st.SPLINE_FIT=4]="SPLINE_FIT",st[st.POLYLINE_3D=8]="POLYLINE_3D",st[st.POLYGON_3D=16]="POLYGON_3D",st[st.CLOSED_POLYGON=32]="CLOSED_POLYGON",st[st.POLYFACE=64]="POLYFACE",st[st.CONTINUOUS=128]="CONTINUOUS";var ti=((Kt={})[Kt.NONE=0]="NONE",Kt[Kt.QUADRATIC=5]="QUADRATIC",Kt[Kt.CUBIC=6]="CUBIC",Kt[Kt.BEZIER=8]="BEZIER",Kt);function Ih(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let rd=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class Sh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ih(this,"parser",S(rd))}}function Eh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Ih(Sh,"ForEntityName","RAY");let ad=[...Gi("data"),{code:70,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Ph{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Eh(this,"parser",S(ad))}}function Ah(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Eh(Ph,"ForEntityName","REGION");let od={vertices:[],backLineVertices:[]},hd=[{code:360,name:"geometrySettingHardId",parser:h},{code:12,name:"backLineVertices",isMultiple:!0,parser:_},{code:93,name:"numberOfBackLineVertices",parser:h},{code:11,name:"vertices",isMultiple:!0,parser:_},{code:92,name:"verticesCount",parser:h},{code:[63,411],name:"indicatorColor",parser:h},{code:70,name:"indicatorTransparency",parser:h},{code:41,name:"bottomHeight",parser:h},{code:40,name:"topHeight",parser:h},{code:10,name:"verticalDirection",parser:_},{code:1,name:"name",parser:h},{code:91,name:"flag",parser:h},{code:90,name:"state",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Th{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Ah(this,"parser",S(hd,od))}}function Mh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Ah(Th,"ForEntityName","SECTION");let ld={points:[],thickness:0,extrusionDirection:{x:0,y:0,z:1}},cd=[{code:210,name:"extrusionDirection",parser:_},{code:39,name:"thickness",parser:h},{code:[...Ci(10,14)],name:"points",isMultiple:!0,parser:_},{code:100,name:"subclassMarker",parser:h},...R];class vh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Mh(this,"parser",S(cd,ld))}}function kh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}Mh(vh,"ForEntityName","SOLID");let dd=[{code:350,name:"historyObjectSoftId",parser:h},{code:100,name:"subclassMarker",parser:h},...Gi("data"),{code:70,name:"version",parser:h},{code:100},...R];class Lh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){kh(this,"parser",S(dd))}}function Oh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}kh(Lh,"ForEntityName","3DSOLID");let ud={knotTolerance:1e-6,controlTolerance:1e-6,fitTolerance:1e-9,knotValues:[],controlPoints:[],fitPoints:[]},pd=[{code:11,name:"fitPoints",isMultiple:!0,parser:_},{code:10,name:"controlPoints",isMultiple:!0,parser:_},{code:41,name:"weights",isMultiple:!0,parser:h},{code:40,name:"knots",isMultiple:!0,parser:h},{code:13,name:"endTangent",parser:_},{code:12,name:"startTangent",parser:_},{code:44,name:"fitTolerance",parser:h},{code:43,name:"controlTolerance",parser:h},{code:42,name:"knotTolerance",parser:h},{code:74,name:"numberOfFitPoints",parser:h},{code:73,name:"numberOfControlPoints",parser:h},{code:72,name:"numberOfKnots",parser:h},{code:71,name:"degree",parser:h},{code:70,name:"flag",parser:h},{code:210,name:"normal",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class Nh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Oh(this,"parser",S(pd,ud))}}Oh(Nh,"ForEntityName","SPLINE");(bt={})[bt.NONE=0]="NONE",bt[bt.CLOSED=1]="CLOSED",bt[bt.PERIODIC=2]="PERIODIC",bt[bt.RATIONAL=4]="RATIONAL",bt[bt.PLANAR=8]="PLANAR",bt[bt.LINEAR=16]="LINEAR";function Ch(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let md=[{code:280,name:"shadowMapSoftness",parser:h},{code:71,name:"shadowMapSize",parser:h},{code:70,name:"shadowType",parser:h},{code:292,name:"isSummerTime",parser:v},{code:92,name:"time",parser:h},{code:91,name:"julianDay",parser:h},{code:291,name:"hasShadow",parser:v},{code:40,name:"intensity",parser:h},{code:421,name:"lightColorInstance",parser:h},{code:63,name:"lightColorIndex",parser:h},{code:290,name:"isOn",parser:v},{code:90,name:"version",parser:h},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...R.filter(s=>s.code!==100)];class Fh{parseEntity(t,e){let i={layer:""};return this.parser(e,t,i),i}constructor(){Ch(this,"parser",S(md))}}Ch(Fh,"ForEntityName","SUN");class oi{parseEntity(t,e){let i={};for(;!t.isEOF();){if(e.code===0){t.rewind();break}switch(e.code){case 100:i.subclassMarker=e.value,e=t.next();break;case 2:i.name=e.value,e=t.next();break;case 5:i.handle=e.value,e=t.next();break;case 10:i.startPoint=Hr(pe(t)),e=t.lastReadGroup;break;case 11:i.directionVector=Hr(pe(t)),e=t.lastReadGroup;break;case 90:i.tableValue=e.value,e=t.next();break;case 91:i.rowCount=e.value,e=t.next();break;case 92:i.columnCount=e.value,e=t.next();break;case 93:i.overrideFlag=e.value,e=t.next();break;case 94:i.borderColorOverrideFlag=e.value,e=t.next();break;case 95:i.borderLineWeightOverrideFlag=e.value,e=t.next();break;case 96:i.borderVisibilityOverrideFlag=e.value,e=t.next();break;case 141:i.rowHeightArr??(i.rowHeightArr=[]),i.rowHeightArr.push(e.value),e=t.next();break;case 142:i.columnWidthArr??(i.columnWidthArr=[]),i.columnWidthArr.push(e.value),e=t.next();break;case 280:i.version=e.value,e=t.next();break;case 310:i.bmpPreview??(i.bmpPreview=""),i.bmpPreview+=e.value,e=t.next();break;case 330:i.ownerDictionaryId=e.value,e=t.next();break;case 342:i.tableStyleId=e.value,e=t.next();break;case 343:i.blockRecordHandle=e.value,e=t.next();break;case 170:i.attachmentPoint=e.value,e=t.next();break;case 171:i.cells??(i.cells=[]),i.cells.push(function(n,r){let a=!1,o=!1,l={};for(;!n.isEOF()&&r.code!==0&&!o;)switch(r.code){case 171:if(a){o=!0;continue}l.cellType=r.value,a=!0,r=n.next();break;case 172:l.flagValue=r.value,r=n.next();break;case 173:l.mergedValue=r.value,r=n.next();break;case 174:l.autoFit=r.value,r=n.next();break;case 175:l.borderWidth=r.value,r=n.next();break;case 176:l.borderHeight=r.value,r=n.next();break;case 91:l.overrideFlag=r.value,r=n.next();break;case 178:l.virtualEdgeFlag=r.value,r=n.next();break;case 145:l.rotation=r.value,r=n.next();break;case 345:l.fieldObjetId=r.value,r=n.next();break;case 340:l.blockTableRecordId=r.value,r=n.next();break;case 146:l.blockScale=r.value,r=n.next();break;case 177:l.blockAttrNum=r.value,r=n.next();break;case 7:l.textStyle=r.value,r=n.next();break;case 140:l.textHeight=r.value,r=n.next();break;case 170:l.attachmentPoint=r.value,r=n.next();break;case 92:l.extendedCellFlags=r.value,r=n.next();break;case 285:l.rightBorderVisibility=!!(r.value??!0),r=n.next();break;case 286:l.bottomBorderVisibility=!!(r.value??!0),r=n.next();break;case 288:l.leftBorderVisibility=!!(r.value??!0),r=n.next();break;case 289:l.topBorderVisibility=!!(r.value??!0),r=n.next();break;case 301:(function(c,d,p){for(;p.code!==304;)switch(p.code){case 301:case 93:case 90:case 94:p=d.next();break;case 1:c.text=p.value,p=d.next();break;case 300:c.attrText=p.value,p=d.next();break;case 302:c.text=p.value?p.value:c.text,p=d.next();break;default:console.log(`Ignore code: ${p.code}, value: ${p.value}`),p=d.next()}})(l,n,r),r=n.next();break;default:return l}return a=!1,o=!1,l}(t,e)),e=t.lastReadGroup;break;default:uc(i,e,t),e=t.next()}}return i}}function Bh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}(tn="ForEntityName")in oi?Object.defineProperty(oi,tn,{value:"ACAD_TABLE",enumerable:!0,configurable:!0,writable:!0}):oi[tn]="ACAD_TABLE";let gd=[{code:11,name:"xAxisDirection",parser:_},{code:210,name:"extrusionDirection",parser:_},{code:1,name:"text",parser:h},{code:10,name:"position",parser:_},{code:3,name:"styleName",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Rh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Bh(this,"parser",S(gd))}}Bh(Rh,"ForEntityName","TOLERANCE");var yd=((it={})[it.CREATED_BY_CURVE_FIT=1]="CREATED_BY_CURVE_FIT",it[it.TANGENT_DEFINED=2]="TANGENT_DEFINED",it[it.NOT_USED=4]="NOT_USED",it[it.CREATED_BY_SPLINE_FIT=8]="CREATED_BY_SPLINE_FIT",it[it.SPLINE_CONTROL_POINT=16]="SPLINE_CONTROL_POINT",it[it.FOR_POLYLINE=32]="FOR_POLYLINE",it[it.FOR_POLYGON=64]="FOR_POLYGON",it[it.POLYFACE=128]="POLYFACE",it);let _d=[{code:[335,343,344,91],name:"softPointers",isMultiple:!0,parser:h},{code:361,name:"sunId",parser:h},{code:431,name:"ambientLightColorName",parser:h},{code:421,name:"ambientLightColorInstance",parser:h},{code:63,name:"ambientLightColorIndex",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLighting",parser:v},{code:348,name:"visualStyleId",parser:h},{code:333,name:"shadePlotId",parser:h},{code:332,name:"backgroundId",parser:h},{code:61,name:"majorGridFrequency",parser:h},{code:170,name:"shadePlotMode",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:346,name:"ucsBaseId",parser:h},{code:345,name:"ucsId",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"iconFlag",parser:h},{code:71,name:"ucsPerViewport",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"sheetName",parser:h},{code:340,name:"clippingBoundaryId",parser:h},{code:90,name:"statusBitFlags",parser:h},{code:331,name:"frozenLayerIds",isMultiple:!0,parser:h},{code:72,name:"circleZoomPercent",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClipZ",parser:h},{code:43,name:"frontClipZ",parser:h},{code:42,name:"perspectiveLensLength",parser:h},{code:17,name:"targetPoint",parser:_},{code:16,name:"viewDirection",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBase",parser:_},{code:12,name:"displayCenter",parser:_},{code:69,name:"viewportId",parser:h},{code:68,name:"status",parser:h},{code:41,name:"height",parser:h},{code:40,name:"width",parser:h},{code:10,name:"viewportCenter",parser:_},{code:100,name:"subclassMarker",parser:h,pushContext:!0},...R];class hi{parseEntity(t,e){let i={};return S(_d)(e,t,i),i}}function zh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}(en="ForEntityName")in hi?Object.defineProperty(hi,en,{value:"VIEWPORT",enumerable:!0,configurable:!0,writable:!0}):hi[en]="VIEWPORT";let wd={brightness:50,constrast:50,fade:0},xd=[{code:14,name:"boundary",isMultiple:!0,parser:_},{code:91,name:"numberOfVertices",parser:h},{code:71,name:"boundaryType",parser:h},{code:360,name:"imageDefReactorHardId",parser:h},{code:283,name:"fade",parser:h},{code:282,name:"contrast",parser:h},{code:281,name:"brightness",parser:h},{code:280,name:"isClipping",parser:v},{code:70,name:"displayFlag",parser:h},{code:340,name:"imageDefHardId",parser:h},{code:13,name:"imageSize",parser:_},{code:12,name:"vDirection",parser:_},{code:11,name:"uDirection",parser:_},{code:10,name:"position",parser:_},{code:90,name:"classVersion",parser:h},{code:100,name:"subclassMarker",parser:h},...R];class Vh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){zh(this,"parser",S(xd,wd))}}zh(Vh,"ForEntityName","WIPEOUT");(Zt={})[Zt.ShowImage=1]="ShowImage",Zt[Zt.ShowImageWhenNotAligned=2]="ShowImageWhenNotAligned",Zt[Zt.UseClippingBoundary=4]="UseClippingBoundary",Zt[Zt.Transparency=8]="Transparency";function Dh(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}let bd=[{code:11,name:"direction",parser:_},{code:10,name:"position",parser:_},{code:100,name:"subclassMarker",parser:h},...R];class jh{parseEntity(t,e){let i={};return this.parser(e,t,i),i}constructor(){Dh(this,"parser",S(bd))}}Dh(jh,"ForEntityName","XLINE");let fd=0;function Wh(s){if(!s)throw TypeError("entity cannot be undefined or null");s.handle||(s.handle=fd++)}let Id=Object.fromEntries([Oo,ni,Vo,Go,Uo,Yo,ii,qo,Zo,sh,nh,ah,hh,ch,ai,uh,mh,jo,yh,wh,fh,Sh,Ph,Th,vh,Lh,Nh,Fh,oi,Ro,Rh,th,Xn,hi,Vh,jh].map(s=>[s.ForEntityName,new s]));function Gh(s,t){let e=[];for(;!L(s,0,"EOF");){if(s.code===0){if(s.value==="ENDBLK"||s.value==="ENDSEC"){t.rewind();break}let i=Id[s.value];if(i){let n=s.value;s=t.next();let r=i.parseEntity(t,s);r.type=n,Wh(r),e.push(r)}else t.debug&&console.warn(`Unsupported ENTITY type: ${s.value}`)}s=t.next()}return e}function _s(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}class Xr{next(){if(!this.hasNext())return this._eof?this.debug&&console.warn("Cannot call 'next' after EOF group has been read"):this.debug&&console.warn("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]),{code:0,value:"EOF"};let t=parseInt(this._data[this._pointer++],10),e=Yr(t,this._data[this._pointer++],this.debug),i={code:t,value:e};return L(i,0,"EOF")&&(this._eof=!0),this.lastReadGroup=i,i}peek(){if(!this.hasNext())throw this._eof?Error("Cannot call 'next' after EOF group has been read"):Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);let t={code:parseInt(this._data[this._pointer]),value:0};return t.value=Yr(t.code,this._data[this._pointer+1],this.debug),t}rewind(t){t=t||1,this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}constructor(t,e=!1){_s(this,"_data",void 0),_s(this,"debug",void 0),_s(this,"_pointer",void 0),_s(this,"_eof",void 0),_s(this,"lastReadGroup",void 0),this._data=t,this.debug=e,this.lastReadGroup={code:0,value:0},this._pointer=0,this._eof=!1}}function Yr(s,t,e=!1){return s<=9?t:s>=10&&s<=59?parseFloat(t.trim()):s>=60&&s<=99?parseInt(t.trim()):s>=100&&s<=109?t:s>=110&&s<=149?parseFloat(t.trim()):s>=160&&s<=179?parseInt(t.trim()):s>=210&&s<=239?parseFloat(t.trim()):s>=270&&s<=289?parseInt(t.trim()):s>=290&&s<=299?function(i){if(i==="0")return!1;if(i==="1")return!0;throw TypeError("String '"+i+"' cannot be cast to Boolean type")}(t.trim()):s>=300&&s<=369?t:s>=370&&s<=389?parseInt(t.trim()):s>=390&&s<=399?t:s>=400&&s<=409?parseInt(t.trim()):s>=410&&s<=419?t:s>=420&&s<=429?parseInt(t.trim()):s>=430&&s<=439?t:s>=440&&s<=459?parseInt(t.trim()):s>=460&&s<=469?parseFloat(t.trim()):s>=470&&s<=481||s===999||s>=1e3&&s<=1009?t:s>=1010&&s<=1059?parseFloat(t.trim()):s>=1060&&s<=1071?parseInt(t.trim()):(e&&console.warn("WARNING: Group code does not have a defined type: %j",{code:s,value:t}),t)}function Sd(s,t){let e=null,i={};for(;!L(s,0,"EOF")&&!L(s,0,"ENDSEC");)s.code===9?e=s.value:s.code===10?i[e]=pe(t):i[e]=s.value,s=t.next();return i}let ae=[{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102,parser(s,t){for(;!L(s,0,"EOF")&&!L(s,102,"}");)s=t.next()}},{code:5,name:"handle",parser:h}],Ed=[{code:70,name:"flag",parser:h},{code:2,name:"appName",parser:h},{code:100,name:"subclassMarker",parser:h},...ae],Pd=S(Ed),Ad=S([{code:310,name:"bmpPreview",parser:h},{code:281,name:"scalability",parser:h},{code:280,name:"explodability",parser:h},{code:70,name:"insertionUnits",parser:h},{code:340,name:"layoutObjects",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae]),Td=S([...Un.map(s=>({...s,parser:h})),{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},{code:105,name:"handle",parser:h},...ae.filter(s=>s.code!==5)]),Md=S([{code:347,name:"materialObjectId",parser:h},{code:390,name:"plotStyleNameObjectId",parser:h},{code:370,name:"lineweight",parser:h},{code:290,name:"isPlotting",parser:v},{code:6,name:"lineType",parser:h},{code:62,name:"colorIndex",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae]),vd=S([{code:9,name:"text",parser:h},{code:45,name:"offsetY",parser:h},{code:44,name:"offsetX",parser:h},{code:50,name:"rotation",parser:h},{code:46,name:"scale",parser:h},{code:340,name:"styleObjectId",parser:h},{code:75,name:"shapeNumber",parser:h},{code:74,name:"elementTypeFlag",parser:h},{code:49,name:"elementLength",parser:h}],{elementTypeFlag:0,elementLength:0}),kd=S([{code:49,name:"pattern",parser(s,t){let e={};return vd(s,t,e),e},isMultiple:!0},{code:40,name:"totalPatternLength",parser:h},{code:73,name:"numberOfLineTypes",parser:h},{code:72,parser:h},{code:3,name:"description",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae]),Ld=S([{code:1e3,name:"extendedFont",parser:h},{code:1001},{code:4,name:"bigFont",parser:h},{code:3,name:"font",parser:h},{code:42,name:"lastHeight",parser:h},{code:71,name:"textGenerationFlag",parser:h},{code:50,name:"obliqueAngle",parser:h},{code:41,name:"widthFactor",parser:h},{code:40,name:"fixedTextHeight",parser:h},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae]),Od=[{code:13,name:"orthographicOrigin",parser:_},{code:71,name:"orthographicType",parser:h},{code:346,name:"baseUcsHandle",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"isOrthographic",parser:v},{code:12,name:"yAxis",parser:_},{code:11,name:"xAxis",parser:_},{code:10,name:"origin",parser:_},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae],Nd=S(Od),Cd=[{code:346,name:"baseUcsId",parser:h},{code:345,name:"ucsId",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:361,name:"sunHardId",parser:h},{code:348,name:"styleHardId",parser:h},{code:334,name:"liveSectionSoftId",parser:h},{code:332,name:"backgroundSoftId",parser:h},{code:73,name:"isPlottable",parser:v},{code:72,name:"isUcsAssociated",parser:v},{code:281,name:"renderMode",parser:h},{code:71,name:"viewMode",parser:h},{code:50,name:"twistAngle",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:12,name:"target",parser:_},{code:11,name:"direction",parser:_},{code:10,name:"center",parser:_},{code:41,name:"width",parser:h},{code:40,name:"height",parser:h},{code:70,name:"flag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae],Fd=S(Cd),Bd=S([{code:[63,421,431],name:"ambientColor",parser:h},{code:142,name:"contrast",parser:h},{code:141,name:"brightness",parser:h},{code:282,name:"defaultLightingType",parser:h},{code:292,name:"isDefaultLightingOn",parser:v},{code:348,name:"visualStyleObjectId",parser:h},{code:333,name:"shadePlotObjectId",parser:h},{code:332,name:"backgroundObjectId",parser:h},{code:61,name:"majorGridLines",parser:h},{code:170,name:"shadePlotSetting",parser:h},{code:146,name:"elevation",parser:h},{code:79,name:"orthographicType",parser:h},{code:112,name:"ucsYAxis",parser:_},{code:111,name:"ucsXAxis",parser:_},{code:110,name:"ucsOrigin",parser:_},{code:74,name:"ucsIconSetting",parser:h},{code:71,name:"viewMode",parser:h},{code:281,name:"renderMode",parser:h},{code:1,name:"styleSheet",parser:h},{code:[331,441],name:"frozenLayers",parser:h,isMultiple:!0},{code:72,name:"circleSides",parser:h},{code:51,name:"viewTwistAngle",parser:h},{code:50,name:"snapRotationAngle",parser:h},{code:45,name:"viewHeight",parser:h},{code:44,name:"backClippingPlane",parser:h},{code:43,name:"frontClippingPlane",parser:h},{code:42,name:"lensLength",parser:h},{code:17,name:"viewTarget",parser:_},{code:16,name:"viewDirectionFromTarget",parser:_},{code:15,name:"gridSpacing",parser:_},{code:14,name:"snapSpacing",parser:_},{code:13,name:"snapBasePoint",parser:_},{code:12,name:"center",parser:_},{code:11,name:"upperRightCorner",parser:_},{code:10,name:"lowerLeftCorner",parser:_},{code:70,name:"standardFlag",parser:h},{code:2,name:"name",parser:h},{code:100,name:"subclassMarker",parser:h},...ae]),Rd={APPID:Pd,BLOCK_RECORD:Ad,DIMSTYLE:Td,LAYER:Md,LTYPE:kd,STYLE:Ld,UCS:Nd,VIEW:Fd,VPORT:Bd},zd=S([{code:70,name:"maxNumberOfEntries",parser:h},{code:100,name:"subclassMarker",parser:h},{code:330,name:"ownerObjectId",parser:h},{code:102},{code:360,isMultiple:!0},{code:102},{code:5,name:"handle",parser:h},{code:2,name:"name",parser:h}]);function Vd(s,t){var i;let e={};for(;!L(s,0,"EOF")&&!L(s,0,"ENDSEC");){if(L(s,0,"TABLE")){s=t.next();let n={entries:[]};zd(s,t,n),e[n.name]=n}if(L(s,0)&&!L(s,0,"ENDTAB")){let n=s.value;s=t.next();let r=Rd[n];if(!r){t.debug&&console.warn(`parseTable: Invalid table name '${n}'`),s=t.next();continue}let a={};r(s,t,a),(i=e[n])==null||i.entries.push(a)}s=t.next()}return e}function Dd(s,t){let e={};for(;!L(s,0,"EOF")&&!L(s,0,"ENDSEC");){if(L(s,0,"BLOCK")){let i=jd(s=t.next(),t);Wh(i),i.name&&(e[i.name]=i)}s=t.next()}return e}function jd(s,t){let e={};for(;!L(s,0,"EOF");){if(L(s,0,"ENDBLK")){for(s=t.next();!L(s,0,"EOF");){if(L(s,100,"AcDbBlockEnd"))return e;s=t.next()}break}switch(s.code){case 1:e.xrefPath=s.value;break;case 2:e.name=s.value;break;case 3:e.name2=s.value;break;case 5:e.handle=s.value;break;case 8:e.layer=s.value;break;case 10:e.position=pe(t);break;case 67:e.paperSpace=!!s.value&&s.value==1;break;case 70:s.value!==0&&(e.type=s.value);break;case 100:break;case 330:e.ownerHandle=s.value;break;case 0:e.entities=Gh(s,t)}s=t.next()}return e}let Yn=[{code:330,name:"ownerObjectId",parser:h},{code:102,parser:ze},{code:102,parser:ze},{code:102,parser:ze},{code:5,name:"handle",parser:h}],Hh=[{code:333,name:"shadePlotId",parser:h},{code:149,name:"imageOriginY",parser:h},{code:148,name:"imageOriginX",parser:h},{code:147,name:"scaleFactor",parser:h},{code:78,name:"shadePlotCustomDPI",parser:h},{code:77,name:"shadePlotResolution",parser:h},{code:76,name:"shadePlotMode",parser:h},{code:75,name:"standardScaleType",parser:h},{code:7,name:"currentStyleSheet",parser:h},{code:74,name:"plotType",parser:h},{code:73,name:"plotRotation",parser:h},{code:72,name:"plotPaperUnit",parser:h},{code:70,name:"layoutFlag",parser:h},{code:143,name:"printScaleDenominator",parser:h},{code:142,name:"printScaleNumerator",parser:h},{code:141,name:"windowAreaYMax",parser:h},{code:140,name:"windowAreaXMax",parser:h},{code:49,name:"windowAreaYMin",parser:h},{code:48,name:"windowAreaXMin",parser:h},{code:47,name:"plotOriginY",parser:h},{code:46,name:"plotOriginX",parser:h},{code:45,name:"paperHeight",parser:h},{code:44,name:"paperWidth",parser:h},{code:43,name:"marginTop",parser:h},{code:42,name:"marginRight",parser:h},{code:41,name:"marginBottom",parser:h},{code:40,name:"marginLeft",parser:h},{code:6,name:"plotViewName",parser:h},{code:4,name:"paperSize",parser:h},{code:2,name:"configName",parser:h},{code:1,name:"pageSetupName",parser:h},{code:100,name:"subclassMarker",parser:h},...Yn],Wd=[{code:346,name:"orthographicUcsId",parser:h},{code:345,name:"namedUcsId",parser:h},{code:331,name:"viewportId",parser:h},{code:330,name:"paperSpaceTableId",parser:h},{code:76,name:"orthographicType",parser:h},{code:17,name:"ucsYAxis",parser:_},{code:16,name:"ucsXAxis",parser:_},{code:13,name:"ucsOrigin",parser:_},{code:146,name:"elevation",parser:h},{code:15,name:"maxExtent",parser:_},{code:14,name:"minExtent",parser:_},{code:12,name:"insertionPoint",parser:_},{code:11,name:"maxLimit",parser:_},{code:10,name:"minLimit",parser:_},{code:71,name:"tabOrder",parser:h},{code:70,name:"controlFlag",parser:h},{code:1,name:"layoutName",parser:h},{code:100,name:"subclassMarker",parser:h},...Hh],Gd=[{code:3,name:"entries",parser:(s,t)=>{let e={name:s.value};return(s=t.next()).code===350?e.objectSoftId=s.value:s.code===360?e.objectHardId=s.value:t.rewind(),e},isMultiple:!0},{code:281,name:"recordCloneFlag",parser:h},{code:280,name:"isHardOwned",parser:v},{code:100,name:"subclassMarker",parser:h},...Yn],Hd=[{code:40,name:"wcsToOCSTransform",parser:$r},{code:40,name:"ocsToWCSTransform",parser:$r},{code:41,name:"backClippingDistance",parser:h},{code:73,name:"isBackClipping",parser:v,pushContext:!0},{code:40,name:"frontClippingDistance",parser:h},{code:72,name:"isFrontClipping",parser:v,pushContext:!0},{code:71,name:"isClipBoundaryDisplayed",parser:v},{code:11,name:"position",parser:_},{code:210,name:"normal",parser:_},{code:10,name:"boundaryVertices",parser:_,isMultiple:!0},{code:70,name:"boundaryCount",parser:h},{code:100,name:"subclassMarker",parser:h},{code:100},...Yn];function $r(s,t){let e=[];for(let i=0;i<3&&L(s,40);++i){let n=[];for(let r=0;r<4&&L(s,40);++r)n.push(s.value),s=t.next();e.push(n)}return t.rewind(),e}let Ud=[{code:330,name:"imageDefReactorIdSoft",isMultiple:!0,parser:h},{code:90,name:"version",parser:h},{code:1,name:"fileName",parser:h},{code:10,name:"size",parser:_},{code:11,name:"sizeOfOnePixel",parser:_},{code:280,name:"isLoaded",parser:h},{code:281,name:"resolutionUnits",parser:h},{code:100,name:"subclassMarker",parser:h}],Xd={LAYOUT:Wd,PLOTSETTINGS:Hh,DICTIONARY:Gd,SPATIAL_FILTER:Hd,IMAGEDEF:Ud};function Yd(s,t){let e=[];for(;s.code!==0||!["EOF","ENDSEC"].includes(s.value);){let i=s.value,n=Xd[i];if(s.code===0&&(n!=null&&n.length)){let r=S(n),a={name:i};r(s=t.next(),t,a)?(e.push(a),s=t.peek()):s=t.next()}else s=t.next()}return{byName:hc(e,({name:i})=>i)}}function Ts(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}class $d{constructor(){Ts(this,"encoding","utf-8"),Ts(this,"encodingFailureFatal",!1),Ts(this,"thumbnailImageFormat","base64")}}class qd extends EventTarget{parseSync(t,e=!1){let i=new Xr(t.split(/\r\n|\r|\n/g),e);if(!i.hasNext())throw Error("Empty file");return this.parseAll(i)}parseStream(t){let e="",i=this;return new Promise((n,r)=>{t.on("data",a=>{e+=a}),t.on("end",()=>{try{let a=e.split(/\r\n|\r|\n/g),o=new Xr(a);if(!o.hasNext())throw Error("Empty file");n(i.parseAll(o))}catch(a){r(a)}}),t.on("error",a=>{r(a)})})}async parseFromUrl(t,e){let i=await fetch(t,e);if(!i.body)return null;let n=i.body.getReader(),r="";for(;;){let{done:a,value:o}=await n.read();if(a){r+=this._decoder.decode(new ArrayBuffer(0),{stream:!1});break}r+=this._decoder.decode(o,{stream:!0})}return this.parseSync(r)}parseAll(t){let e={header:{},blocks:{},entities:[],tables:{},objects:{byName:{},byTree:void 0}},i=t.next();for(;!L(i,0,"EOF");)L(i,0,"SECTION")&&(L(i=t.next(),2,"HEADER")?e.header=Sd(i=t.next(),t):L(i,2,"CLASSES")?Yl(i=t.next(),t,e):L(i,2,"BLOCKS")?e.blocks=Dd(i=t.next(),t):L(i,2,"ENTITIES")?e.entities=Gh(i=t.next(),t):L(i,2,"TABLES")?e.tables=Vd(i=t.next(),t):L(i,2,"OBJECTS")?e.objects=Yd(i=t.next(),t):L(i,2,"THUMBNAILIMAGE")&&(e.thumbnailImage=function(n,r,a="base64"){let o,l="",c=0;for(;!L(n,0,"EOF")&&!L(n,0,"ENDSEC");)n.code===90?c=n.value:n.code===310&&(l+=n.value),n=r.next();if(a==="hex")o=l;else{let d=function(p){let m=p.length/2,u=new Uint8Array(m);for(let g=0;g<m;g++)u[g]=parseInt(p.substr(2*g,2),16);return u}(l);o=a==="buffer"?d:function(p){let m="";for(let u=0;u<p.length;u++)m+=String.fromCharCode(p[u]);return btoa(m)}(d)}return{size:c,data:o}}(i=t.next(),t,this._options.thumbnailImageFormat))),i=t.next();return e}constructor(t={}){super(),Ts(this,"_decoder",void 0),Ts(this,"_options",void 0);let e=new $d;this._options=Object.assign(e,t),this._decoder=new TextDecoder(this._options.encoding,{fatal:this._options.encodingFailureFatal})}}(ft={})[ft.NOT_APPLICABLE=0]="NOT_APPLICABLE",ft[ft.KEEP_EXISTING=1]="KEEP_EXISTING",ft[ft.USE_CLONE=2]="USE_CLONE",ft[ft.XREF_VALUE_NAME=3]="XREF_VALUE_NAME",ft[ft.VALUE_NAME=4]="VALUE_NAME",ft[ft.UNMANGLE_NAME=5]="UNMANGLE_NAME";(Oe={})[Oe.NOUNIT=0]="NOUNIT",Oe[Oe.CENTIMETERS=2]="CENTIMETERS",Oe[Oe.INCH=5]="INCH";(ys={})[ys.PSLTSCALE=1]="PSLTSCALE",ys[ys.LIMCHECK=2]="LIMCHECK";(Ne={})[Ne.INCHES=0]="INCHES",Ne[Ne.MILLIMETERS=1]="MILLIMETERS",Ne[Ne.PIXELS=2]="PIXELS";(It={})[It.LAST_SCREEN_DISPLAY=0]="LAST_SCREEN_DISPLAY",It[It.DRAWING_EXTENTS=1]="DRAWING_EXTENTS",It[It.DRAWING_LIMITS=2]="DRAWING_LIMITS",It[It.VIEW_SPECIFIED=3]="VIEW_SPECIFIED",It[It.WINDOW_SPECIFIED=4]="WINDOW_SPECIFIED",It[It.LAYOUT_INFORMATION=5]="LAYOUT_INFORMATION";(Qt={})[Qt.AS_DISPLAYED=0]="AS_DISPLAYED",Qt[Qt.WIREFRAME=1]="WIREFRAME",Qt[Qt.HIDDEN=2]="HIDDEN",Qt[Qt.RENDERED=3]="RENDERED";(St={})[St.DRAFT=0]="DRAFT",St[St.PREVIEW=1]="PREVIEW",St[St.NORMAL=2]="NORMAL",St[St.PRESENTATION=3]="PRESENTATION",St[St.MAXIMUM=4]="MAXIMUM",St[St.CUSTOM=5]="CUSTOM";(Jt={})[Jt.NONE=0]="NONE",Jt[Jt.AbsoluteRotation=1]="AbsoluteRotation",Jt[Jt.TextEmbedded=2]="TextEmbedded",Jt[Jt.ShapeEmbedded=4]="ShapeEmbedded";(sn={})[sn.PaperSpace=1]="PaperSpace";(Ce={})[Ce.XrefDependent=16]="XrefDependent",Ce[Ce.XrefResolved=32]="XrefResolved",Ce[Ce.Referenced=64]="Referenced";(Et={})[Et.Off=0]="Off",Et[Et.Perspective=1]="Perspective",Et[Et.ClipFront=2]="ClipFront",Et[Et.ClipBack=4]="ClipBack",Et[Et.UcsFollow=8]="UcsFollow",Et[Et.ClipFrontByFrontZ=16]="ClipFrontByFrontZ";class Kd{parse(t){const e=new qd,i=this.getDxfInfoFromBuffer(t);let n="";return i.version&&i.version.value<=23&&i.encoding?n=new TextDecoder(i.encoding).decode(t):n=new TextDecoder().decode(t),e.parseSync(n)}getDxfInfoFromBuffer(t){var c,d,p;const i=new TextDecoder("utf-8");let n=0,r="",a=null,o=null,l=!1;for(;n<t.byteLength;){const m=Math.min(n+65536,t.byteLength),u=t.slice(n,m);n=m;const y=(r+i.decode(u,{stream:!0})).split(/\r?\n/);r=y.pop()??"";for(let x=0;x<y.length;x++){const w=y[x].trim();if(w==="SECTION"&&((c=y[x+2])==null?void 0:c.trim())==="HEADER")l=!0;else if(w==="ENDSEC"&&l)return{version:a,encoding:o};if(l&&w==="$ACADVER"){const P=(d=y[x+2])==null?void 0:d.trim();P&&(a=new At(P))}else if(l&&w==="$DWGCODEPAGE"){const P=(p=y[x+2])==null?void 0:p.trim();if(P){const I=En[P];o=da(I)}}if(a&&o)return{version:a,encoding:o}}}return{version:a,encoding:o}}}class qr{convert(t){const e=this.createEntity(t);return e&&this.processCommonAttrs(t,e),e}createEntity(t){return t.type=="3DFACE"?this.convertFace(t):t.type=="ARC"?this.convertArc(t):t.type=="ATTDEF"?this.convertAttributeDefinition(t):t.type=="ATTRIB"?this.convertAttribute(t):t.type=="CIRCLE"?this.convertCirle(t):t.type=="DIMENSION"?this.convertDimension(t):t.type=="ELLIPSE"?this.convertEllipse(t):t.type=="HATCH"?this.convertHatch(t):t.type=="IMAGE"?this.convertImage(t):t.type=="LEADER"?this.convertLeader(t):t.type=="LINE"?this.convertLine(t):t.type=="LWPOLYLINE"?this.convertLWPolyline(t):t.type=="MTEXT"?this.convertMText(t):t.type=="POLYLINE"?this.convertPolyline(t):t.type=="POINT"?this.convertPoint(t):t.type=="RAY"?this.convertRay(t):t.type=="SPLINE"?this.convertSpline(t):t.type=="ACAD_TABLE"?this.convertTable(t):t.type=="TEXT"?this.convertText(t):t.type=="SOLID"?this.convertSolid(t):t.type=="VIEWPORT"?this.convertViewport(t):t.type=="WIPEOUT"?this.convertWipeout(t):t.type=="XLINE"?this.convertXline(t):t.type=="INSERT"?this.convertBlockReference(t):null}convertFace(t){const e=new wi;return t.vertices.forEach((i,n)=>e.setVertexAt(n,i)),e}convertArc(t){return new pi(t.center,t.radius,N.degToRad(t.startAngle),N.degToRad(t.endAngle),t.extrusionDirection??f.Z_AXIS)}convertAttributeCommon(t,e){e.textString=t.text,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=t.rotation,e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.tag=t.tag,e.fieldLength=0,e.isInvisible=(t.attributeFlag&Q.Invisible)!==0,e.isConst=(t.attributeFlag&Q.Const)!==0,e.isVerifiable=(t.attributeFlag&Q.Verifiable)!==0,e.isPreset=(t.attributeFlag&Q.Preset)!==0,e.isReallyLocked=!!t.isReallyLocked,e.isMTextAttribute=(t.mtextFlag&Bt.MultiLine)!==0,e.isConstMTextAttribute=(t.mtextFlag&Bt.ConstMultiLine)!==0}convertAttribute(t){const e=new gi;return this.convertAttributeCommon(t,e),e.styleName=t.textStyle,e.horizontalMode=t.horizontalJustification,e.verticalMode=t.verticalJustification,e.widthFactor=t.scale??1,e.lockPositionInBlock=t.lockPositionFlag,e}convertAttributeDefinition(t){const e=new mi;return this.convertAttributeCommon(t,e),e.styleName=t.styleName,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e.prompt=t.prompt,e}convertCirle(t){return new yi(t.center,t.radius,t.extrusionDirection??f.Z_AXIS)}convertEllipse(t){const e=new f(t.majorAxisEndPoint),i=e.length();return new _i(t.center,t.extrusionDirection??f.Z_AXIS,e,i,i*t.axisRatio,t.startAngle,t.endAngle)}convertLine(t){const e=t.startPoint,i=t.endPoint;return new Os(new b(e.x,e.y,e.z||0),new b(i.x,i.y,i.z||0))}convertSpline(t){try{if(t.numberOfControlPoints>0&&t.numberOfKnots>0)return new Cs(t.controlPoints,t.knots,t.weights,t.degree,!!(t.flag&1));if(t.numberOfFitPoints>0){const e=this.numberArrayToPointArray(t.fitPoints,t.numberOfFitPoints);if(e!=null)return new Cs(e,"Uniform",t.degree,!!(t.flag&1))}}catch(e){console.log(`Failed to convert spline with error: ${e}`)}return null}convertPoint(t){const e=new Si;return e.position=t.position,e}convertSolid(t){const e=new fi;return t.points.forEach((i,n)=>e.setPointAt(n,i)),e.thickness=t.thickness,e}convertPolyline(t){const e=!!(t.flag&1),i=!!(t.flag&8),n=[],r=[];if(t.vertices.map(a=>{a.flag&yd.SPLINE_CONTROL_POINT||(n.push({x:a.x,y:a.y,z:a.z}),r.push(a.bulge??0))}),i){let a=Es.SimplePoly;return t.flag&4&&(t.smoothType==ti.CUBIC?a=Es.CubicSplinePoly:t.smoothType==ti.QUADRATIC&&(a=Es.QuadSplinePoly)),new ui(a,n,e)}else{let a=Xe.SimplePoly;return t.flag&2?a=Xe.FitCurvePoly:t.flag&4&&(t.smoothType==ti.CUBIC?a=Xe.CubicSplinePoly:t.smoothType==ti.QUADRATIC&&(a=Xe.QuadSplinePoly)),new di(a,n,0,e,t.startWidth,t.endWidth,r)}}convertLWPolyline(t){const e=new Ii;return e.closed=!!(t.flag&1),t.vertices.forEach((i,n)=>{e.addVertexAt(n,new O(i.x,i.y),i.bulge,i.startWidth,i.endWidth)}),e}convertHatch(t){var n;const e=new Ls;return(n=t.definitionLines)==null||n.forEach(r=>{e.definitionLines.push({angle:r.angle,base:r.base,offset:r.offset,dashLengths:r.numberOfDashLengths>0?r.dashLengths:[]})}),e.isSolidFill=t.solidFill==Vl.SolidFill,e.hatchStyle=t.hatchStyle,e.patternName=t.patternName,e.patternType=t.patternType,e.patternAngle=t.patternAngle==null?0:t.patternAngle,e.patternScale=t.patternScale==null?0:t.patternScale,t.boundaryPaths.forEach(r=>{if(r.boundaryPathTypeFlag&2){const o=r,l=new me;l.closed=o.isClosed,o.vertices.forEach((c,d)=>{l.addVertexAt(d,{x:c.x,y:c.y,bulge:c.bulge})}),e.add(l)}else{const o=r,l=[];o.edges.forEach(d=>{if(d.type==1){const p=d;l.push(new Rt(p.start,p.end))}else if(d.type==2){const p=d;l.push(new Ve(p.center,p.radius,N.degToRad(p.startAngle||0),N.degToRad(p.endAngle||0),!p.isCCW))}else if(d.type==3){const p=d;new U().subVectors(p.end,p.center);const u=Math.sqrt(Math.pow(p.end.x,2)+Math.pow(p.end.y,2)),g=u*p.lengthOfMinorAxis;let y=N.degToRad(p.startAngle||0),x=N.degToRad(p.endAngle||0);const w=Math.atan2(p.end.y,p.end.x);p.isCCW||(y=Math.PI*2-y,x=Math.PI*2-x),l.push(new De({...p.center,z:0},u,g,y,x,!p.isCCW,w))}else if(d.type==4){const p=d;if(p.numberOfControlPoints>0&&p.numberOfKnots>0){const m=p.controlPoints.map(y=>({x:y.x,y:y.y,z:0}));let u=!0;const g=p.controlPoints.map(y=>(y.weight==null&&(u=!1),y.weight||1));l.push(new Lt(m,p.knots,u?g:void 0))}else if(p.numberOfFitData>0){const m=p.fitDatum.map(u=>({x:u.x,y:u.y,z:0}));l.push(new Lt(m,"Uniform"))}}});const c=ks.buildFromEdges(l);c.length==0&&l.length>0?e.add(new ks(l)):c.forEach(d=>e.add(d))}}),e}convertTable(t){const e=new bi(t.name,t.rowCount,t.columnCount);return e.tableDataVersion=t.version,e.tableStyleId=t.tableStyleId,e.owningBlockRecordId=t.blockRecordHandle,t.directionVector&&(e.horizontalDirection=new f(t.directionVector)),e.attachmentPoint=t.attachmentPoint,e.position.copy(t.startPoint),e.tableValueFlag=t.tableValue,e.tableOverrideFlag=t.overrideFlag,e.borderColorOverrideFlag=t.borderColorOverrideFlag,e.borderLineweightOverrideFlag=t.borderLineWeightOverrideFlag,e.borderVisibilityOverrideFlag=t.borderVisibilityOverrideFlag,t.columnWidthArr.forEach((i,n)=>e.setColumnWidth(n,i)),t.rowHeightArr.forEach((i,n)=>e.setRowHeight(n,i)),t.cells.forEach((i,n)=>{e.setCell(n,i)}),e}convertText(t){const e=new Ze;return e.textString=t.text,e.styleName=t.styleName,e.height=t.textHeight,e.position.copy(t.startPoint),e.rotation=N.degToRad(t.rotation||0),e.oblique=t.obliqueAngle??0,e.thickness=t.thickness,e.horizontalMode=t.halign,e.verticalMode=t.valign,e.widthFactor=t.xScale??1,e}convertMText(t){const e=new Ns;return e.contents=t.text,t.styleName!=null&&(e.styleName=t.styleName),e.height=t.height,e.width=t.width,e.rotation=N.degToRad(t.rotation||0),e.location=t.insertionPoint,e.attachmentPoint=t.attachmentPoint,t.direction&&(e.direction=new f(t.direction)),e.drawingDirection=t.drawingDirection,e}convertLeader(t){const e=new xi;return t.vertices.forEach(i=>{e.appendVertex(i)}),e.hasArrowHead=t.isArrowheadEnabled,e.hasHookLine=t.isHooklineExists,e.isSplined=t.isSpline,e.dimensionStyle=t.styleName,e.annoType=t.leaderCreationFlag,e}convertDimension(t){if(t.subclassMarker=="AcDbAlignedDimension"||t.subclassMarker=="AcDbRotatedDimension"){const e=t,i=new vi(e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return e.insertionPoint&&(i.dimBlockPosition={...e.insertionPoint,z:0}),i.rotation=N.degToRad(e.rotationAngle||0),this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDb3PointAngularDimension"){const e=t,i=new Mi(e.centerPoint,e.subDefinitionPoint1,e.subDefinitionPoint2,e.definitionPoint);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbOrdinateDimension"){const e=t,i=new Li(e.subDefinitionPoint1,e.subDefinitionPoint2);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbRadialDimension"){const e=t,i=new Oi(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}else if(t.subclassMarker=="AcDbDiametricDimension"){const e=t,i=new ki(e.definitionPoint,e.subDefinitionPoint,e.leaderLength);return this.processDimensionCommonAttrs(t,i),i}return null}processImage(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.flags|4)>0,e.isImageShown=(t.flags|3)>0,e.isImageTransparent=(t.flags|8)>0,e.imageDefId=t.imageDefHandle,e.isClipped=t.isClipped,t.clippingBoundaryPath.forEach(i=>{e.clipBoundary.push(new O(i))}),e.width=Math.sqrt(t.uPixel.x**2+t.uPixel.y**2+t.uPixel.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vPixel.x**2+t.vPixel.y**2+t.vPixel.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uPixel.y,t.uPixel.x)}convertImage(t){const e=new Fs;return this.processImage(t,e),e.clipBoundaryType=t.clippingBoundaryType,e}processWipeout(t,e){e.position.copy(t.position),e.brightness=t.brightness,e.contrast=t.contrast,e.fade=t.fade,e.imageSize.copy(t.imageSize),e.isShownClipped=(t.displayFlag|4)>0,e.isImageShown=(t.displayFlag|3)>0,e.isImageTransparent=(t.displayFlag|8)>0,e.imageDefId=t.imageDefHardId,e.isClipped=t.isClipping,t.boundary.forEach(i=>{e.clipBoundary.push(new O(i))}),e.clipBoundaryType=t.boundaryType,e.width=Math.sqrt(t.uDirection.x**2+t.uDirection.y**2+t.uDirection.z**2)*t.imageSize.x,e.height=Math.sqrt(t.vDirection.x**2+t.vDirection.y**2+t.vDirection.z**2)*t.imageSize.y,e.rotation=Math.atan2(t.uDirection.y,t.uDirection.x)}convertWipeout(t){const e=new Ai;return this.processWipeout(t,e),e}convertViewport(t){const e=new Pi;return e.number=t.viewportId,e.centerPoint.copy(t.viewportCenter),e.height=t.height,e.width=t.width,e.viewCenter.copy(t.displayCenter),e.viewHeight=t.viewHeight,e}convertRay(t){const e=new Ei;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertXline(t){const e=new Ti;return e.basePoint.copy(t.position),e.unitDir.copy(t.direction),e}convertBlockReference(t){const e=new Qe(t.name);return t.insertionPoint&&e.position.copy(t.insertionPoint),e.scaleFactors.x=t.xScale||1,e.scaleFactors.y=t.yScale||1,e.scaleFactors.z=t.zScale||1,e.rotation=t.rotation!=null?N.degToRad(t.rotation):0,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1}),e}processDimensionCommonAttrs(t,e){e.dimBlockId=t.name,e.textPosition.copy(t.textPoint),e.textRotation=t.textRotation||0,t.textLineSpacingFactor&&(e.textLineSpacingFactor=t.textLineSpacingFactor),t.textLineSpacingStyle&&(e.textLineSpacingStyle=t.textLineSpacingStyle),e.dimensionStyleName=t.styleName,e.dimensionText=t.text||"",e.measurement=t.measurement,e.normal.copy(t.extrusionDirection??{x:0,y:0,z:1})}processCommonAttrs(t,e){e.layer=t.layer||"0",t.handle&&(e.objectId=t.handle.toString()),e.ownerId=t.ownerBlockRecordSoftId||"",t.lineType!=null&&(e.lineType=t.lineType),t.lineweight!=null&&(e.lineWeight=t.lineweight),t.lineTypeScale!=null&&(e.linetypeScale=t.lineTypeScale),t.color!=null&&e.color.setRGBValue(t.color),t.colorIndex!=null&&(e.color.colorIndex=t.colorIndex),t.colorName&&(e.color.colorName=t.colorName),t.isVisible!=null&&(e.visibility=t.isVisible),t.transparency!=null&&(e.transparency=zi.deserialize(t.transparency))}numberArrayToPointArray(t,e){const i=t.length;let n=0;if(i/2==e?n=2:i/3==e&&(n=3),n==0)return;const r=[];for(let a=0,o=i/n;a<o;++a)r.push({x:t[a*n],y:t[a*n+1],z:n==3?t[a*n+2]:0});return r}}class Zd{convertLayout(t,e){var r,a;const i=new Vs;i.layoutName=t.layoutName,i.tabOrder=t.tabOrder,i.plotSettingsName=t.pageSetupName,i.plotCfgName=t.configName,i.canonicalMediaName=t.paperSize,i.plotViewName=t.plotViewName,i.currentStyleSheet=t.currentStyleSheet,i.plotPaperMargins={left:t.marginLeft,right:t.marginRight,top:t.marginTop,bottom:t.marginBottom},i.plotPaperSize.copy({x:t.paperWidth,y:t.paperHeight}),i.plotOrigin.copy({x:t.plotOriginX,y:t.plotOriginY}),i.plotWindowArea.min.copy({x:t.windowAreaXMin,y:t.windowAreaYMin}),i.plotWindowArea.max.copy({x:t.windowAreaXMax,y:t.windowAreaYMax}),i.customPrintScale={numerator:t.printScaleNumerator,denominator:t.printScaleDenominator},i.plotPaperUnits=t.plotPaperUnit,i.plotRotation=t.plotRotation,i.plotType=t.plotType,i.stdScaleType=t.standardScaleType,i.shadePlot=(()=>{switch(t.shadePlotMode){case 1:return Ye.kWireframe;case 2:return Ye.kHidden;case 3:return Ye.kRendered;default:return Ye.kAsDisplayed}})(),i.shadePlotResLevel=(()=>{switch(t.shadePlotResolution){case 1:return le.kPreview;case 2:return le.kNormal;case 3:return le.kPresentation;case 4:return le.kMaximum;case 5:return le.kCustom;default:return le.kDraft}})(),t.shadePlotCustomDPI!=null&&(i.shadePlotCustomDPI=t.shadePlotCustomDPI),t.shadePlotId&&(i.shadePlotId=t.shadePlotId);const n=t.layoutFlag??0;if(i.plotViewportBorders=(n&1)!==0,i.showPlotStyles=(n&2)!==0,i.plotCentered=(n&4)!==0,i.plotHidden=(n&8)!==0,i.useStandardScale=(n&16)!==0,i.plotPlotStyles=(n&32)!==0,i.scaleLineweights=(n&64)!==0,i.printLineweights=(n&128)!==0,i.drawViewportsFirst=(n&512)!==0,i.modelType=(n&1024)!==0,t.viewportId&&i.viewportArray.push(t.viewportId),t.layoutName==="Model"){const o=Z.MODEL_SPACE_NAME.toUpperCase();(r=e.tables.BLOCK_RECORD)==null||r.entries.some(l=>l.name.toUpperCase()===o?(i.blockTableRecordId=l.handle,!0):!1)}else(a=e.tables.BLOCK_RECORD)==null||a.entries.some(o=>o.layoutObjects===t.handle?(i.blockTableRecordId=o.handle,!0):!1),i.blockTableRecordId||(i.blockTableRecordId=t.paperSpaceTableId);return t.minLimit&&i.limits.min.copy(t.minLimit),t.maxLimit&&i.limits.max.copy(t.maxLimit),t.minExtent&&i.extents.min.copy(t.minExtent),t.maxExtent&&i.extents.max.copy(t.maxExtent),this.processCommonAttrs(t,i),i}convertImageDef(t){const e=new uo;return e.sourceFileName=t.fileName,this.processCommonAttrs(t,e),e}processCommonAttrs(t,e){e.objectId=t.handle,e.ownerId=t.ownerObjectId}}class Uh{constructor(t){this.taskId=0,this.workers=new Map,this.pendingTasks=new Map,this.config={workerUrl:t.workerUrl,timeout:t.timeout??3e4,maxConcurrentWorkers:t.maxConcurrentWorkers??4}}async execute(t,e){const i=Date.now(),n=this.generateTaskId();try{return await this.executeInWorker(n,t,e||this.config.workerUrl)}catch(r){const a=Date.now()-i;return{success:!1,error:r instanceof Error?r.message:String(r),duration:a}}}async executeInWorker(t,e,i){const n=Date.now();return new Promise((r,a)=>{const o=this.getAvailableWorker(i),l=setTimeout(()=>{this.cleanupTask(t),this.releaseWorker(o),a(new Error(`Worker operation timed out after ${this.config.timeout}ms`))},this.config.timeout);this.pendingTasks.set(t,{resolve:p=>{clearTimeout(l),this.releaseWorker(o),r(p)},reject:p=>{clearTimeout(l),this.releaseWorker(o),a(p)},timeout:l});const c=p=>{const{id:m,success:u,data:g,error:y}=p.data;if(m!==t)return;this.cleanupTask(t);const x=Date.now()-n;r(u?{success:!0,data:g,duration:x}:{success:!1,error:y,duration:x})},d=p=>{this.cleanupTask(t),a(new Error(`Worker error: ${p.message}`))};o.addEventListener("message",c),o.addEventListener("error",d),o.postMessage({id:t,input:e})})}cleanupTask(t){const e=this.pendingTasks.get(t);e&&(clearTimeout(e.timeout),this.pendingTasks.delete(t))}generateTaskId(){return`task_${++this.taskId}_${Date.now()}`}detectWorkerSupport(){return typeof Worker<"u"}getAvailableWorker(t){for(const[i,n]of this.workers)if(!n.isBusy)return n.isBusy=!0,n.worker;if(this.workers.size<this.config.maxConcurrentWorkers){const i=new Worker(t,{type:"module"}),n=this.generateWorkerId(),r={worker:i,isBusy:!0,id:n,createdAt:new Date};return this.workers.set(n,r),i}const e=Array.from(this.workers.values()).sort((i,n)=>i.createdAt.getTime()-n.createdAt.getTime())[0];return e.isBusy=!0,e.worker}releaseWorker(t){for(const[e,i]of this.workers)if(i.worker===t){i.isBusy=!1;break}}generateWorkerId(){return`worker_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}getStats(){return{totalWorkers:this.workers.size,busyWorkers:Array.from(this.workers.values()).filter(t=>t.isBusy).length,pendingTasks:this.pendingTasks.size,config:this.config}}destroy(){for(const[t,e]of this.pendingTasks)clearTimeout(e.timeout),e.reject(new Error("Framework destroyed"));this.pendingTasks.clear();for(const[t,e]of this.workers)e.worker.terminate();this.workers.clear()}}class Xh{constructor(t){this.framework=new Uh(t)}async execute(t,e){return this.framework.execute(t,e)}getStats(){return this.framework.getStats()}destroy(){this.framework.destroy()}}function Yh(s){return new Xh(s)}class Qd{constructor(){this.setupMessageHandler()}setupMessageHandler(){self.onmessage=async t=>{const{id:e,input:i}=t.data;try{const n=await this.executeTask(i);this.sendResponse(e,!0,n)}catch(n){this.sendResponse(e,!1,void 0,n instanceof Error?n.message:String(n))}}}sendResponse(t,e,i,n){const r={id:t,success:e,data:i,error:n};self.postMessage(r)}}class $h extends Hn{constructor(t={}){super(t),t.parserWorkerUrl||(t.parserWorkerUrl="/assets/dxf-parser-worker.js")}async parse(t,e){const i=this.config,n=this.getParserWorkerTimeout(t,e);if(i.useWorker&&i.parserWorkerUrl){const r=Yh({workerUrl:i.parserWorkerUrl,timeout:n,maxConcurrentWorkers:1}),a=await r.execute(t);if(r.destroy(),a.success)return{model:a.data,data:{unknownEntityCount:0}};throw new Error(`Failed to parse drawing due to error: '${a.error}'`)}else return{model:new Kd().parse(t),data:{unknownEntityCount:0}}}getFonts(t){var r;const e=new Map,i=a=>{if(a){const o=a.lastIndexOf(".");return o>=0?a.substring(0,o).toLowerCase():a.toLowerCase()}};(r=t.tables.STYLE)==null||r.entries.forEach(a=>{const o=[];if(a.font){const l=i(a.font);l&&o.push(l)}if(a.bigFont){const l=i(a.bigFont);l&&o.push(l)}if(a.extendedFont){const l=i(a.extendedFont);l&&o.push(l)}e.set(a.name,o)});const n=new Set;return this.getFontsInBlock(t.entities,t.blocks,e,n),Array.from(n)}getFontsInBlock(t,e,i,n){const r=/\\f(.*?)\|/g;t.forEach(a=>{if(a.type=="MTEXT"){const o=a;[...o.text.matchAll(r)].forEach(d=>{n.add(d[1].toLowerCase())});const c=i.get(o.styleName);c==null||c.forEach(d=>n.add(d))}else if(a.type=="TEXT"){const o=a,l=i.get(o.styleName);l==null||l.forEach(c=>n.add(c))}else if(a.type=="INSERT"){const l=e[a.name];l&&l.entities&&this.getFontsInBlock(l.entities,e,i,n)}})}async processEntities(t,e,i,n,r){const a=new qr;let o=t.entities;const l=o.length,c=new In(l,100-n.value,i);this.config.convertByEntityType&&(o=this.groupAndFlattenByType(o));const d=new Map;for(let m=0;m<l;m++){const u=o[m];if(u.type==="ATTRIB"){const g=a.convert(u);if(g&&g.ownerId&&g.ownerId!=="0"){let y=d.get(g==null?void 0:g.ownerId);y==null&&(y=[],d.set(g.ownerId,y)),y.push(g)}}}const p=e.tables.blockTable.modelSpace;await c.processChunk(async(m,u)=>{let g=[],y=m<u?o[m].type:"";for(let w=m;w<u;w++){const P=o[w];if(!(P.ownerBlockRecordSoftId&&P.ownerBlockRecordSoftId!==p.objectId)&&P.type!=="ATTRIB"){const I=a.convert(P);if(I){if(this.config.convertByEntityType&&P.type!==y&&(p.appendEntity(g),g=[],y=P.type),P.type==="INSERT"){const k=d.get(I.objectId);k&&k.length>0&&k.forEach(A=>{I.appendAttributes(A)})}g.push(I)}}}p.appendEntity(g);let x=n.value+u/l*(100-n.value);x>100&&(x=100),r&&await r(x,"ENTITY","IN-PROGRESS")})}async processEntitiesInBlock(t,e,i=!1){const n=new qr,r=t.length,a=[],o=e.objectId,l=[];for(let c=0;c<r;c++){const d=t[c],p=n.convert(d);p&&(d.type==="ATTRIB"?l.push(p):(!i||d.ownerBlockRecordSoftId===o)&&a.push(p))}l.forEach(c=>{const d=e.getIdAt(c.ownerId);d&&d.appendAttributes(c)}),e.appendEntity(a)}processBlocks(t,e){const i=t.blocks;for(const[n,r]of Object.entries(i)){let a=e.tables.blockTable.getAt(r.name);a||(a=new Z,a.objectId=r.handle,a.name=n,a.origin.copy(r.position),e.tables.blockTable.add(a)),r.entities?this.processEntitiesInBlock(r.entities,a):a.isPaperSapce&&this.processEntitiesInBlock(t.entities,a,!0)}}processHeader(t,e){const i=t.header;i.$ACADVER&&(e.version=i.$ACADVER),e.cecolor.colorIndex=i.$CECOLOR||256,e.angBase=i.$ANGBASE||0,e.angDir=i.$ANGDIR||0,i.$AUNITS!=null&&(e.aunits=i.$AUNITS),e.celtscale=i.$CELTSCALE||1,e.ltscale=i.$LTSCALE||1,i.$EXTMAX&&(e.extmax=i.$EXTMAX),i.$EXTMIN&&(e.extmin=i.$EXTMIN),i.$INSUNITS!=null&&(e.insunits=i.$INSUNITS),e.osmode=i.$OSMODE||0,e.pdmode=i.$PDMODE||0,e.pdsize=i.$PDSIZE||0,e.textstyle=i.$TEXTSTYLE||Y}processBlockTables(t,e){var n;const i=(n=t.tables.BLOCK_RECORD)==null?void 0:n.entries;i&&i.length>0&&(e.tables.blockTable.removeAll(),i.forEach(r=>{const a=new Z;a.objectId=r.handle,a.name=r.name,a.layoutId=r.layoutObjects,a.blockInsertUnits=r.insertionUnits,a.explodability=r.explodability,a.blockScaling=r.scalability,r.bmpPreview&&(a.bmpPreview=r.bmpPreview),e.tables.blockTable.add(a)}))}processObjects(t,e){const i=t.objects.byName,n=new Zd;if("LAYOUT"in i){const r=e.objects.layout;i.LAYOUT.forEach(a=>{const o=n.convertLayout(a,t);r.setAt(o.layoutName,o)})}if("IMAGEDEF"in i){const r=e.objects.imageDefinition;i.IMAGEDEF.forEach(a=>{const o=n.convertImageDef(a);r.setAt(o.objectId,o)})}}processViewports(t,e){var n;const i=(n=t.tables)==null?void 0:n.VPORT;if(i){this.processCommonTableAttrs(i,e.tables.viewportTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new Gn;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),e.tables.viewportTable.add(o)})}}processLayers(t,e){var n;const i=(n=t.tables)==null?void 0:n.LAYER;if(i){this.processCommonTableAttrs(i,e.tables.layerTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new J;o.colorIndex=a.colorIndex;const l=new ji({name:a.name,standardFlags:a.standardFlag,linetype:a.lineType,lineWeight:a.lineweight,isOff:a.colorIndex<0,color:o,isPlottable:a.isPlotting});this.processCommonTableEntryAttrs(a,l),e.tables.layerTable.add(l)})}}processLineTypes(t,e){var n;const i=(n=t.tables)==null?void 0:n.LTYPE;if(i){this.processCommonTableAttrs(i,e.tables.linetypeTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new de(a);this.processCommonTableEntryAttrs(a,o),o.name=a.name,e.tables.linetypeTable.add(o)})}}processTextStyles(t,e){var n;const i=(n=t.tables)==null?void 0:n.STYLE;if(i){this.processCommonTableAttrs(i,e.tables.textStyleTable);const r=i.entries;r&&r.length>0&&r.forEach(a=>{const o=new Wi(a);this.processCommonTableEntryAttrs(a,o),e.tables.textStyleTable.add(o)})}}processDimStyles(t,e){var n;const i=(n=t.tables)==null?void 0:n.DIMSTYLE;if(i){this.processCommonTableAttrs(i,e.tables.dimStyleTable);const r=i.entries;r&&r.length>0&&r.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?a.DIMDSEP.toString():".",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||Y,dimldrblk:a.DIMLDRBLK||"",dimblk:a.DIMBLK||"",dimblk1:a.DIMBLK1||"",dimblk2:a.DIMBLK2||"",dimlwd:a.DIMLWD,dimlwe:a.DIMLWE},l=new We(o);this.processCommonTableEntryAttrs(a,l),e.tables.dimStyleTable.add(l)})}}processCommonTableAttrs(t,e){t.handle!=null&&(e.objectId=t.handle),e.ownerId=t.ownerObjectId}processCommonTableEntryAttrs(t,e){e.name="name"in t?t.name:"",t.handle!=null&&(e.objectId=t.handle),e.ownerId=t.ownerObjectId}groupAndFlattenByType(t){const e={},i=[];for(const n of t)e[n.type]||(e[n.type]=[],i.push(n.type)),e[n.type].push(n);return i.flatMap(n=>e[n])}}class qh extends Hn{constructor(t){super({}),this._database=t}async parse(){return{model:this._database,data:{unknownEntityCount:0}}}getFonts(){return[]}async processEntities(t,e,i,n,r){let a=t.tables.blockTable.modelSpace.newIterator().toArray();const o=a.length,l=new In(o,100-n.value,i);this.config.convertByEntityType&&(a=this.groupAndFlattenByType(a));const c=e.tables.blockTable.modelSpace;await l.processChunk(async(d,p)=>{let m=[],u=d<p?a[d].type:"";for(let g=d;g<p;g++){const y=a[g];this.config.convertByEntityType&&y.type!==u&&(this.triggerEvents(c,m),m=[],u=y.type),m.push(y)}if(this.triggerEvents(c,m),r){let g=n.value+p/o*(100-n.value);g>100&&(g=100),await r(g,"ENTITY","IN-PROGRESS")}})}processBlocks(){const t=this._database.tables.blockTable.newIterator();for(const e of t){const i=e.newIterator().toArray();this.triggerEvents(e,i)}}processHeader(){}processBlockTables(){}processObjects(){const t=this._database.objects.layout.newIterator();for(const i of t)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.layoutName});const e=this._database.objects.imageDefinition.newIterator();for(const i of e)this._database.events.dictObjetSet.dispatch({database:this._database,object:i,key:i.objectId})}processViewports(){}processLayers(){this._database.tables.layerTable.newIterator().toArray().forEach(e=>{this._database.events.layerAppended.dispatch({database:this._database,layer:e})})}processLineTypes(){}processTextStyles(){}processDimStyles(){}groupAndFlattenByType(t){const e={},i=[];for(const n of t)e[n.type]||(e[n.type]=[],i.push(n.type)),e[n.type].push(n);return i.flatMap(n=>e[n])}triggerEvents(t,e){(t.isModelSapce||t.isPaperSapce)&&t.database.events.entityAppended.dispatch({database:t.database,entity:e})}}exports.ACAD_APPID=ln;exports.AC_DB_SYSTEM_VARIABLE_NAMES=Ll;exports.AcCmColor=J;exports.AcCmColorMethod=E;exports.AcCmColorUtil=he;exports.AcCmEntityColor=Zh;exports.AcCmErrors=gt;exports.AcCmEventDispatcher=Qh;exports.AcCmEventManager=K;exports.AcCmLoader=al;exports.AcCmLoadingManager=ra;exports.AcCmObject=ea;exports.AcCmPerformanceCollector=xn;exports.AcCmTask=ia;exports.AcCmTaskScheduler=na;exports.AcCmTransparency=zi;exports.AcCmTransparencyMethod=ct;exports.AcDb2dPolyline=di;exports.AcDb2dVertex=mn;exports.AcDb2dVertexType=$a;exports.AcDb3PointAngularDimension=Mi;exports.AcDb3dPolyline=ui;exports.AcDb3dVertex=gn;exports.AcDb3dVertexType=qa;exports.AcDbAbstractViewTableRecord=Wn;exports.AcDbAlignedDimension=vi;exports.AcDbAngleUnits=Sn;exports.AcDbArc=pi;exports.AcDbArcDimension=yn;exports.AcDbAttribute=gi;exports.AcDbAttributeDefinition=mi;exports.AcDbAttributeFlags=Q;exports.AcDbAttributeMTextFlag=Bt;exports.AcDbBaseWorker=Qd;exports.AcDbBatchProcessing=In;exports.AcDbBlockReference=Qe;exports.AcDbBlockScaling=lo;exports.AcDbBlockTable=yo;exports.AcDbBlockTableRecord=Z;exports.AcDbCircle=yi;exports.AcDbCodePage=En;exports.AcDbCurve=pt;exports.AcDbDataGenerator=mo;exports.AcDbDatabase=Ol;exports.AcDbDatabaseConverter=Hn;exports.AcDbDatabaseConverterManager=Ft;exports.AcDbDiametricDimension=ki;exports.AcDbDictionary=As;exports.AcDbDimArrowType=go;exports.AcDbDimStyleTable=_o;exports.AcDbDimStyleTableRecord=We;exports.AcDbDimTextHorizontal=wo;exports.AcDbDimTextVertical=xo;exports.AcDbDimVerticalJustification=Io;exports.AcDbDimZeroSuppression=bo;exports.AcDbDimZeroSuppressionAngular=fo;exports.AcDbDimension=ie;exports.AcDbDuplicateRecordCloning=po;exports.AcDbDwgVersion=At;exports.AcDbDxfCode=wn;exports.AcDbDxfConverter=$h;exports.AcDbDxfFiler=Kr;exports.AcDbEllipse=_i;exports.AcDbEntity=ut;exports.AcDbFace=wi;exports.AcDbFileType=fs;exports.AcDbHatch=Ls;exports.AcDbHatchPatternType=Ps;exports.AcDbHatchStyle=Qa;exports.AcDbHostApplicationServices=li;exports.AcDbLayerTable=So;exports.AcDbLayerTableRecord=ji;exports.AcDbLayout=Vs;exports.AcDbLayoutDictionary=ho;exports.AcDbLayoutManager=co;exports.AcDbLeader=xi;exports.AcDbLeaderAnnotationType=Ja;exports.AcDbLine=Os;exports.AcDbLineSpacingStyle=so;exports.AcDbLinetypeTable=Eo;exports.AcDbLinetypeTableRecord=de;exports.AcDbMText=Ns;exports.AcDbObject=ne;exports.AcDbObjectIterator=Ds;exports.AcDbOpenMode=ca;exports.AcDbOrdinateDimension=Li;exports.AcDbOsnapMode=z;exports.AcDbPlotPaperUnits=io;exports.AcDbPlotRotation=no;exports.AcDbPlotSettings=oo;exports.AcDbPlotShadePlotResLevel=le;exports.AcDbPlotShadePlotType=Ye;exports.AcDbPlotStdScaleType=ao;exports.AcDbPlotType=ro;exports.AcDbPoint=Si;exports.AcDbPoly2dType=Xe;exports.AcDbPoly3dType=Es;exports.AcDbPolyline=Ii;exports.AcDbRadialDimension=Oi;exports.AcDbRasterImage=Fs;exports.AcDbRasterImageClipBoundaryType=to;exports.AcDbRasterImageDef=uo;exports.AcDbRasterImageImageDisplayOpt=eo;exports.AcDbRay=Ei;exports.AcDbRegAppTable=Mo;exports.AcDbRegAppTableRecord=_n;exports.AcDbRegenerator=qh;exports.AcDbRenderingCache=Je;exports.AcDbResultBuffer=fn;exports.AcDbSpline=Cs;exports.AcDbSymbolTable=re;exports.AcDbSymbolTableRecord=ge;exports.AcDbSysVarManager=Ni;exports.AcDbSystemVariables=D;exports.AcDbTable=bi;exports.AcDbText=Ze;exports.AcDbTextHorizontalMode=Ka;exports.AcDbTextStyleTable=Po;exports.AcDbTextStyleTableRecord=Wi;exports.AcDbTextVerticalMode=Za;exports.AcDbTrace=fi;exports.AcDbUnitsValue=jn;exports.AcDbViewTable=Ao;exports.AcDbViewTableRecord=Fl;exports.AcDbViewport=Pi;exports.AcDbViewportTable=To;exports.AcDbViewportTableRecord=Gn;exports.AcDbWipeout=Ai;exports.AcDbWorkerApi=Xh;exports.AcDbWorkerManager=Uh;exports.AcDbXline=Ti;exports.AcDbXrecord=Dn;exports.AcGeArea2d=vs;exports.AcGeBox2d=dt;exports.AcGeBox3d=F;exports.AcGeCatmullRomCurve3d=Ua;exports.AcGeCircArc2d=Ve;exports.AcGeCircArc3d=Re;exports.AcGeCurve2d=ts;exports.AcGeEllipseArc2d=De;exports.AcGeEllipseArc3d=Di;exports.AcGeEuler=wl;exports.AcGeGeometryUtil=Ca;exports.AcGeLine2d=Rt;exports.AcGeLine3d=ue;exports.AcGeLoop2d=ks;exports.AcGeMathUtil=N;exports.AcGeMatrix2d=Vi;exports.AcGeMatrix3d=Pt;exports.AcGeNurbsCurve=Ct;exports.AcGePlane=Rs;exports.AcGePoint2d=O;exports.AcGePoint3d=b;exports.AcGePolyline2d=me;exports.AcGeQuaternion=Ge;exports.AcGeShape2d=Fn;exports.AcGeSpline3d=Lt;exports.AcGeTol=Ln;exports.AcGeVector2d=U;exports.AcGeVector3d=f;exports.AcGiArrowType=Bn;exports.AcGiDefaultLightingType=Vn;exports.AcGiLineWeight=je;exports.AcGiMTextAttachmentPoint=rt;exports.AcGiMTextFlowDirection=se;exports.AcGiOrthographicType=zn;exports.AcGiRenderMode=Rn;exports.AcGiViewport=Xa;exports.AcTrStringUtil=rl;exports.ByBlock=ci;exports.ByLayer=Ke;exports.DEBUG_MODE=il;exports.DEFAULT_LINE_TYPE=qe;exports.DEFAULT_TEXT_STYLE=Y;exports.DEFAULT_TOL=On;exports.DEG2RAD=Pn;exports.DefaultLoadingManager=aa;exports.FLOAT_TOL=Fe;exports.MLIGHTCAD_APPID=hn;exports.ORIGIN_POINT_2D=ll;exports.ORIGIN_POINT_3D=kn;exports.RAD2DEG=An;exports.TAU=G;exports.TEMP_OBJECT_ID_PREFIX=ei;exports.acdbDisableOsnapMode=Pl;exports.acdbEnableOsnapMode=El;exports.acdbHasOsnapMode=Sl;exports.acdbHostApplicationServices=bn;exports.acdbMaskToOsnapModes=fl;exports.acdbOsnapModesToMask=bl;exports.acdbToggleOsnapMode=Il;exports.basisFunction=Ms;exports.calculateCurveLength=Ra;exports.ceilPowerOfTwo=Aa;exports.clamp=ee;exports.clone=ws;exports.computeParameterValues=Fa;exports.createWorkerApi=Yh;exports.damp=ga;exports.deepClone=rn;exports.defaults=Bs;exports.degToRad=Sa;exports.dwgCodePageToEncoding=da;exports.euclideanModulo=Tn;exports.evaluateNurbsPoint=Ss;exports.floorPowerOfTwo=Ta;exports.generateAveragedKnots=Ba;exports.generateChordKnots=dl;exports.generateSqrtChordKnots=ul;exports.generateUUID=ua;exports.generateUniformKnots=cl;exports.has=Zr;exports.intPartLength=vn;exports.interpolateControlPoints=pl;exports.interpolateNurbsCurve=Cn;exports.inverseLerp=ma;exports.isBetween=Ma;exports.isBetweenAngle=va;exports.isEmpty=Qr;exports.isEqual=$e;exports.isImperialUnits=vl;exports.isMetricUnits=Ml;exports.isPointInPolygon=Nn;exports.isPolygonIntersect=Na;exports.isPowerOfTwo=Pa;exports.lerp=Mn;exports.log=bs;exports.mapLinear=pa;exports.normalizeAngle=Is;exports.pingpong=ya;exports.radToDeg=Ea;exports.randFloat=ba;exports.randFloatSpread=fa;exports.randInt=xa;exports.relativeEps=ka;exports.seededRandom=Ia;exports.setAcDbHostApplicationServicesProvider=ha;exports.setAcDbLayoutManagerFactory=la;exports.setLogLevel=nl;exports.smootherstep=wa;exports.smoothstep=_a;
|