@mlightcad/libredwg-converter 3.15.30 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libredwg-converter.umd.cjs +1 -1
- package/dist/libredwg-parser-worker.js +20 -24
- package/dist/libredwg-web.wasm +0 -0
- package/lib/AcDbEntitiyConverter.d.ts.map +1 -1
- package/lib/AcDbEntitiyConverter.js +12 -17
- package/lib/AcDbEntitiyConverter.js.map +1 -1
- package/lib/AcDbLibreDwgConverterUtil.d.ts.map +1 -1
- package/lib/AcDbLibreDwgConverterUtil.js +2 -0
- package/lib/AcDbLibreDwgConverterUtil.js.map +1 -1
- package/lib/normalizeLibreDwgLineWeights.d.ts +34 -0
- package/lib/normalizeLibreDwgLineWeights.d.ts.map +1 -0
- package/lib/normalizeLibreDwgLineWeights.js +134 -0
- package/lib/normalizeLibreDwgLineWeights.js.map +1 -0
- package/package.json +4 -4
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
var io=Object.defineProperty;var so=(a,t,i)=>t in a?io(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i;var bt=(a,t,i)=>so(a,typeof t!="symbol"?t+"":t,i);var _o="DwgConverterLicenseError",lo=["evaluation of @mlightcad/dwg-converter has expired"],co=["invalid @mlightcad/dwg-converter license key"];function uo(a){return a==="license_expired"||a==="license_invalid"}function ur(a){var t=a.toLowerCase();if(lo.some(function(i){return t.includes(i)}))return"license_expired";if(co.some(function(i){return t.includes(i)}))return"license_invalid"}function Eo(a){var t;return(t=ur(a))!==null&&t!==void 0?t:"license_invalid"}var fo=function(a,t,i,n){function d(_){return _ instanceof i?_:new i(function(u){u(_)})}return new(i||(i=Promise))(function(_,u){function f(T){try{A(n.next(T))}catch(v){u(v)}}function h(T){try{A(n.throw(T))}catch(v){u(v)}}function A(T){T.done?_(T.value):d(T.value).then(f,h)}A((n=n.apply(a,t||[])).next())})},ho=function(a,t){var i={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},n,d,_,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(A){return function(T){return h([A,T])}}function h(A){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,A[0]&&(i=0)),i;)try{if(n=1,d&&(_=A[0]&2?d.return:A[0]?d.throw||((_=d.return)&&_.call(d),0):d.next)&&!(_=_.call(d,A[1])).done)return _;switch(d=0,_&&(A=[A[0]&2,_.value]),A[0]){case 0:case 1:_=A;break;case 4:return i.label++,{value:A[1],done:!1};case 5:i.label++,d=A[1],A=[0];continue;case 7:A=i.ops.pop(),i.trys.pop();continue;default:if(_=i.trys,!(_=_.length>0&&_[_.length-1])&&(A[0]===6||A[0]===2)){i=0;continue}if(A[0]===3&&(!_||A[1]>_[0]&&A[1]<_[3])){i.label=A[1];break}if(A[0]===6&&i.label<_[1]){i.label=_[1],_=A;break}if(_&&i.label<_[2]){i.label=_[2],i.ops.push(A);break}_[2]&&i.ops.pop(),i.trys.pop();continue}A=t.call(a,i)}catch(T){A=[6,T],d=0}finally{n=_=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},go=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];function Ao(a){var t=a.toLowerCase();return go.some(function(i){return t.includes(i)})}function In(){var a=globalThis;if(typeof a.postMessage!="function")throw new Error("Worker messaging is not available in this runtime");return a}var yo=(function(){function a(){this.setupMessageHandler()}return a.prototype.setupMessageHandler=function(){var t=this;In().onmessage=function(i){return fo(t,void 0,void 0,function(){var n,d,_,u,f,h,A;return ho(this,function(T){switch(T.label){case 0:n=i,d=n.data,_=d.id,u=d.input,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.executeTask(u)];case 2:return f=T.sent(),this.sendResponse(_,!0,f),[3,4];case 3:return h=T.sent(),A=h instanceof Error?h.message:String(h),this.sendResponse(_,!1,void 0,A,this.classifyTaskError(h,A)),[3,4];case 4:return[2]}})})}},a.prototype.sendResponse=function(t,i,n,d,_){var u={id:t,success:i,data:n,error:d,errorCode:_};try{In().postMessage(u)}catch(h){var f=h instanceof Error?h.message:String(h);In().postMessage({id:t,success:!1,error:f,errorCode:this.classifyPostMessageError(f)})}},a.prototype.classifyTaskError=function(t,i){if(t instanceof Error){var n=t.code;if(uo(n))return n;if(t.name===_o)return Eo(i)}var d=ur(i);return d||this.classifyPostMessageError(i)},a.prototype.classifyPostMessageError=function(t){return Ao(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"},a})();const To="modulepreload",po=function(a,t){return new URL(a,t).href},nr={},Po=function(t,i,n){let d=Promise.resolve();if(i&&i.length>0){let u=function(T){return Promise.all(T.map(v=>Promise.resolve(v).then(P=>({status:"fulfilled",value:P}),P=>({status:"rejected",reason:P}))))};const f=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),A=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));d=u(i.map(T=>{if(T=po(T,n),T in nr)return;nr[T]=!0;const v=T.endsWith(".css"),P=v?'[rel="stylesheet"]':"";if(!!n)for(let w=f.length-1;w>=0;w--){const I=f[w];if(I.href===T&&(!v||I.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${T}"]${P}`))return;const D=document.createElement("link");if(D.rel=v?"stylesheet":To,v||(D.as="script"),D.crossOrigin="",D.href=T,A&&D.setAttribute("nonce",A),document.head.appendChild(D),v)return new Promise((w,I)=>{D.addEventListener("load",w),D.addEventListener("error",()=>I(new Error(`Unable to preload CSS for ${T}`)))})}))}function _(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return d.then(u=>{for(const f of u||[])f.status==="rejected"&&_(f.reason);return t().catch(_)})};var rr=(()=>{var a=import.meta.url;return(async function(t={}){var i,n=t,d,_,u=new Promise((e,r)=>{d=e,_=r}),f=typeof window=="object",h=typeof WorkerGlobalScope<"u",A=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(A){const{createRequire:e}=await Po(()=>Promise.resolve().then(()=>ti),void 0,import.meta.url);var T=e(import.meta.url)}var v=Object.assign({},n),P="./this.program",m="";function D(e){return n.locateFile?n.locateFile(e,m):m+e}var w,I;if(A){var S=T("fs"),G=T("path");import.meta.url.startsWith("data:")||(m=G.dirname(T("url").fileURLToPath(import.meta.url))+"/"),I=e=>{e=Tt(e)?new URL(e):e;var r=S.readFileSync(e);return r},w=async(e,r=!0)=>{e=Tt(e)?new URL(e):e;var o=S.readFileSync(e,r?void 0:"utf8");return o},!n.thisProgram&&process.argv.length>1&&(P=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else(f||h)&&(h?m=self.location.href:typeof document<"u"&&document.currentScript&&(m=document.currentScript.src),a&&(m=a),m.startsWith("blob:")?m="":m=m.slice(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1),h&&(I=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),w=async e=>{if(Tt(e))return new Promise((o,s)=>{var c=new XMLHttpRequest;c.open("GET",e,!0),c.responseType="arraybuffer",c.onload=()=>{if(c.status==200||c.status==0&&c.response){o(c.response);return}s(c.status)},c.onerror=s,c.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var M=n.print||(()=>{}).bind(console),b=n.printErr||(()=>{}).bind(console);Object.assign(n,v),v=null,n.arguments&&n.arguments,n.thisProgram&&(P=n.thisProgram);var k=n.wasmBinary,$,q=!1,U,Z,rt,dt,Y,F,ct,it,Yt,It,Tt=e=>e.startsWith("file://");function wt(){var e=$.buffer;n.HEAP8=U=new Int8Array(e),n.HEAP16=rt=new Int16Array(e),n.HEAPU8=Z=new Uint8Array(e),n.HEAPU16=dt=new Uint16Array(e),n.HEAP32=Y=new Int32Array(e),n.HEAPU32=F=new Uint32Array(e),n.HEAPF32=ct=new Float32Array(e),n.HEAPF64=It=new Float64Array(e),n.HEAP64=it=new BigInt64Array(e),n.HEAPU64=Yt=new BigUint64Array(e)}function xt(){if(n.preRun)for(typeof n.preRun=="function"&&(n.preRun=[n.preRun]);n.preRun.length;)Ne(n.preRun.shift());$t(he)}function Ct(){!n.noFSInit&&!l.initialized&&l.init(),X.__wasm_call_ctors(),l.ignorePermissions=!1}function kt(){if(n.postRun)for(typeof n.postRun=="function"&&(n.postRun=[n.postRun]);n.postRun.length;)Vt(n.postRun.shift());$t(oe)}var ft=0,Dt=null;function zt(e){var r;ft++,(r=n.monitorRunDependencies)==null||r.call(n,ft)}function Ot(e){var o;if(ft--,(o=n.monitorRunDependencies)==null||o.call(n,ft),ft==0&&Dt){var r=Dt;Dt=null,r()}}function Nt(e){var o;(o=n.onAbort)==null||o.call(n,e),e="Aborted("+e+")",b(e),q=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw _(r),r}var Bt;function Ft(){return n.locateFile?D("libredwg-web.wasm"):new URL(""+new URL("libredwg-web.wasm",import.meta.url).href,import.meta.url).href}function ne(e){if(e==Bt&&k)return new Uint8Array(k);if(I)return I(e);throw"both async and sync fetching of the wasm failed"}async function re(e){if(!k)try{var r=await w(e);return new Uint8Array(r)}catch{}return ne(e)}async function ae(e,r){try{var o=await re(e),s=await WebAssembly.instantiate(o,r);return s}catch(c){b(`failed to asynchronously prepare wasm: ${c}`),Nt(c)}}async function Ut(e,r,o){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!Tt(r)&&!A)try{var s=fetch(r,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(s,o);return c}catch(E){b(`wasm streaming compile failed: ${E}`),b("falling back to ArrayBuffer instantiation")}return ae(r,o)}function Q(){return{env:tr,wasi_snapshot_preview1:tr}}async function H(){function e(E,g){return X=E.exports,X=oo(X),$=X.memory,wt(),Bn=X.__indirect_function_table,Ot(),X}zt();function r(E){return e(E.instance)}var o=Q();if(n.instantiateWasm)return new Promise((E,g)=>{n.instantiateWasm(o,(y,p)=>{e(y),E(y.exports)})});Bt??(Bt=Ft());try{var s=await Ut(k,Bt,o),c=r(s);return c}catch(E){return _(E),Promise.reject(E)}}var $t=e=>{for(;e.length>0;)e.shift()(n)},oe=[],Vt=e=>oe.unshift(e),he=[],Ne=e=>he.unshift(e);n.noExitRuntime;function Ge(e,r,o="i8"){switch(o.endsWith("*")&&(o="*"),o){case"i1":U[e>>>0]=r;break;case"i8":U[e>>>0]=r;break;case"i16":rt[e>>>1>>>0]=r;break;case"i32":Y[e>>>2>>>0]=r;break;case"i64":it[e>>>3]=BigInt(r);break;case"float":ct[e>>>2>>>0]=r;break;case"double":It[e>>>3>>>0]=r;break;case"*":F[e>>>2>>>0]=r;break;default:Nt(`invalid type for setValue: ${o}`)}}var We=e=>no(e),Me=()=>ao();class be{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){F[this.ptr+4>>>2>>>0]=r}get_type(){return F[this.ptr+4>>>2>>>0]}set_destructor(r){F[this.ptr+8>>>2>>>0]=r}get_destructor(){return F[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,U[this.ptr+12>>>0]=r}get_caught(){return U[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,U[this.ptr+13>>>0]=r}get_rethrown(){return U[this.ptr+13>>>0]!=0}init(r,o){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(o)}set_adjusted_ptr(r){F[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return F[this.ptr+16>>>2>>>0]}}var ge=0,Ae=9007199254740992,ye=-9007199254740992,Te=e=>e<ye||e>Ae?NaN:Number(e);function xe(e,r,o){e>>>=0,r>>>=0,o>>>=0;var s=new be(e);throw s.init(r,o),ge=e,ge}var Jt=()=>{var e=Y[+et.varargs>>>2>>>0];return et.varargs+=4,e},Gt=Jt,z={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var o=0,s=e.length-1;s>=0;s--){var c=e[s];c==="."?e.splice(s,1):c===".."?(e.splice(s,1),o++):o&&(e.splice(s,1),o--)}if(r)for(;o;o--)e.unshift("..");return e},normalize:e=>{var r=z.isAbs(e),o=e.slice(-1)==="/";return e=z.normalizeArray(e.split("/").filter(s=>!!s),!r).join("/"),!e&&!r&&(e="."),e&&o&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=z.splitPath(e),o=r[0],s=r[1];return!o&&!s?".":(s&&(s=s.slice(0,-1)),o+s)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>z.normalize(e.join("/")),join2:(e,r)=>z.normalize(e+"/"+r)},pe=()=>{if(A){var e=T("crypto");return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},Zt=e=>{(Zt=pe())(e)},Rt={resolve:(...e)=>{for(var r="",o=!1,s=e.length-1;s>=-1&&!o;s--){var c=s>=0?e[s]:l.cwd();if(typeof c!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";r=c+"/"+r,o=z.isAbs(c)}return r=z.normalizeArray(r.split("/").filter(E=>!!E),!o).join("/"),(o?"/":"")+r||"."},relative:(e,r)=>{e=Rt.resolve(e).slice(1),r=Rt.resolve(r).slice(1);function o(C){for(var R=0;R<C.length&&C[R]==="";R++);for(var N=C.length-1;N>=0&&C[N]==="";N--);return R>N?[]:C.slice(R,N-R+1)}for(var s=o(e.split("/")),c=o(r.split("/")),E=Math.min(s.length,c.length),g=E,y=0;y<E;y++)if(s[y]!==c[y]){g=y;break}for(var p=[],y=g;y<s.length;y++)p.push("..");return p=p.concat(c.slice(g)),p.join("/")}},ie=typeof TextDecoder<"u"?new TextDecoder:void 0,St=(e,r=0,o=NaN)=>{r>>>=0;for(var s=r+o,c=r;e[c]&&!(c>=s);)++c;if(c-r>16&&e.buffer&&ie)return ie.decode(e.subarray(r,c));for(var E="";r<c;){var g=e[r++];if(!(g&128)){E+=String.fromCharCode(g);continue}var y=e[r++]&63;if((g&224)==192){E+=String.fromCharCode((g&31)<<6|y);continue}var p=e[r++]&63;if((g&240)==224?g=(g&15)<<12|y<<6|p:g=(g&7)<<18|y<<12|p<<6|e[r++]&63,g<65536)E+=String.fromCharCode(g);else{var C=g-65536;E+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return E},qt=[],Wt=e=>{for(var r=0,o=0;o<e.length;++o){var s=e.charCodeAt(o);s<=127?r++:s<=2047?r+=2:s>=55296&&s<=57343?(r+=4,++o):r+=3}return r},Qt=(e,r,o,s)=>{if(o>>>=0,!(s>0))return 0;for(var c=o,E=o+s-1,g=0;g<e.length;++g){var y=e.charCodeAt(g);if(y>=55296&&y<=57343){var p=e.charCodeAt(++g);y=65536+((y&1023)<<10)|p&1023}if(y<=127){if(o>=E)break;r[o++>>>0]=y}else if(y<=2047){if(o+1>=E)break;r[o++>>>0]=192|y>>6,r[o++>>>0]=128|y&63}else if(y<=65535){if(o+2>=E)break;r[o++>>>0]=224|y>>12,r[o++>>>0]=128|y>>6&63,r[o++>>>0]=128|y&63}else{if(o+3>=E)break;r[o++>>>0]=240|y>>18,r[o++>>>0]=128|y>>12&63,r[o++>>>0]=128|y>>6&63,r[o++>>>0]=128|y&63}}return r[o>>>0]=0,o-c},se=(e,r,o)=>{var s=Wt(e)+1,c=new Array(s),E=Qt(e,c,0,c.length);return c.length=E,c},Pe=()=>{if(!qt.length){var e=null;if(A){var r=256,o=Buffer.alloc(r),s=0,c=process.stdin.fd;try{s=S.readSync(c,o,0,r)}catch(E){if(E.toString().includes("EOF"))s=0;else throw E}s>0&&(e=o.slice(0,s).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
|
-
`));if(!e)return null;qt=se(e)}return qt.shift()},pt={ttys:[],init(){},shutdown(){},register(e,r){pt.ttys[e]={input:[],output:[],ops:r},l.registerDevice(e,pt.stream_ops)},stream_ops:{open(e){var r=pt.ttys[e.node.rdev];if(!r)throw new l.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,o,s,c){if(!e.tty||!e.tty.ops.get_char)throw new l.ErrnoError(60);for(var E=0,g=0;g<s;g++){var y;try{y=e.tty.ops.get_char(e.tty)}catch{throw new l.ErrnoError(29)}if(y===void 0&&E===0)throw new l.ErrnoError(6);if(y==null)break;E++,r[o+g]=y}return E&&(e.node.atime=Date.now()),E},write(e,r,o,s,c){if(!e.tty||!e.tty.ops.put_char)throw new l.ErrnoError(60);try{for(var E=0;E<s;E++)e.tty.ops.put_char(e.tty,r[o+E])}catch{throw new l.ErrnoError(29)}return s&&(e.node.mtime=e.node.ctime=Date.now()),E}},default_tty_ops:{get_char(e){return Pe()},put_char(e,r){r===null||r===10?(M(St(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(M(St(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,r,o){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(b(St(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(b(St(e.output)),e.output=[])}}},ve=(e,r)=>Math.ceil(e/r)*r,_e=e=>{Nt()},B={ops_table:null,mount(e){return B.createNode(null,"/",16895,0)},createNode(e,r,o,s){if(l.isBlkdev(o)||l.isFIFO(o))throw new l.ErrnoError(63);B.ops_table||(B.ops_table={dir:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr,lookup:B.node_ops.lookup,mknod:B.node_ops.mknod,rename:B.node_ops.rename,unlink:B.node_ops.unlink,rmdir:B.node_ops.rmdir,readdir:B.node_ops.readdir,symlink:B.node_ops.symlink},stream:{llseek:B.stream_ops.llseek}},file:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr},stream:{llseek:B.stream_ops.llseek,read:B.stream_ops.read,write:B.stream_ops.write,allocate:B.stream_ops.allocate,mmap:B.stream_ops.mmap,msync:B.stream_ops.msync}},link:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr,readlink:B.node_ops.readlink},stream:{}},chrdev:{node:{getattr:B.node_ops.getattr,setattr:B.node_ops.setattr},stream:l.chrdev_stream_ops}});var c=l.createNode(e,r,o,s);return l.isDir(c.mode)?(c.node_ops=B.ops_table.dir.node,c.stream_ops=B.ops_table.dir.stream,c.contents={}):l.isFile(c.mode)?(c.node_ops=B.ops_table.file.node,c.stream_ops=B.ops_table.file.stream,c.usedBytes=0,c.contents=null):l.isLink(c.mode)?(c.node_ops=B.ops_table.link.node,c.stream_ops=B.ops_table.link.stream):l.isChrdev(c.mode)&&(c.node_ops=B.ops_table.chrdev.node,c.stream_ops=B.ops_table.chrdev.stream),c.atime=c.mtime=c.ctime=Date.now(),e&&(e.contents[r]=c,e.atime=e.mtime=e.ctime=c.atime),c},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,r){var o=e.contents?e.contents.length:0;if(!(o>=r)){var s=1024*1024;r=Math.max(r,o*(o<s?2:1.125)>>>0),o!=0&&(r=Math.max(r,256));var c=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(c.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var o=e.contents;e.contents=new Uint8Array(r),o&&e.contents.set(o.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr(e){var r={};return r.dev=l.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,l.isDir(e.mode)?r.size=4096:l.isFile(e.mode)?r.size=e.usedBytes:l.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(const o of["mode","atime","mtime","ctime"])r[o]!=null&&(e[o]=r[o]);r.size!==void 0&&B.resizeFileStorage(e,r.size)},lookup(e,r){throw B.doesNotExistError},mknod(e,r,o,s){return B.createNode(e,r,o,s)},rename(e,r,o){var s;try{s=l.lookupNode(r,o)}catch{}if(s){if(l.isDir(e.mode))for(var c in s.contents)throw new l.ErrnoError(55);l.hashRemoveNode(s)}delete e.parent.contents[e.name],r.contents[o]=e,e.name=o,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var o=l.lookupNode(e,r);for(var s in o.contents)throw new l.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,o){var s=B.createNode(e,r,41471,0);return s.link=o,s},readlink(e){if(!l.isLink(e.mode))throw new l.ErrnoError(28);return e.link}},stream_ops:{read(e,r,o,s,c){var E=e.node.contents;if(c>=e.node.usedBytes)return 0;var g=Math.min(e.node.usedBytes-c,s);if(g>8&&E.subarray)r.set(E.subarray(c,c+g),o);else for(var y=0;y<g;y++)r[o+y]=E[c+y];return g},write(e,r,o,s,c,E){if(r.buffer===U.buffer&&(E=!1),!s)return 0;var g=e.node;if(g.mtime=g.ctime=Date.now(),r.subarray&&(!g.contents||g.contents.subarray)){if(E)return g.contents=r.subarray(o,o+s),g.usedBytes=s,s;if(g.usedBytes===0&&c===0)return g.contents=r.slice(o,o+s),g.usedBytes=s,s;if(c+s<=g.usedBytes)return g.contents.set(r.subarray(o,o+s),c),s}if(B.expandFileStorage(g,c+s),g.contents.subarray&&r.subarray)g.contents.set(r.subarray(o,o+s),c);else for(var y=0;y<s;y++)g.contents[c+y]=r[o+y];return g.usedBytes=Math.max(g.usedBytes,c+s),s},llseek(e,r,o){var s=r;if(o===1?s+=e.position:o===2&&l.isFile(e.node.mode)&&(s+=e.node.usedBytes),s<0)throw new l.ErrnoError(28);return s},allocate(e,r,o){B.expandFileStorage(e.node,r+o),e.node.usedBytes=Math.max(e.node.usedBytes,r+o)},mmap(e,r,o,s,c){if(!l.isFile(e.node.mode))throw new l.ErrnoError(43);var E,g,y=e.node.contents;if(!(c&2)&&y&&y.buffer===U.buffer)g=!1,E=y.byteOffset;else{if(g=!0,E=_e(),!E)throw new l.ErrnoError(48);y&&((o>0||o+r<y.length)&&(y.subarray?y=y.subarray(o,o+r):y=Array.prototype.slice.call(y,o,o+r)),U.set(y,E>>>0))}return{ptr:E,allocated:g}},msync(e,r,o,s,c){return B.stream_ops.write(e,r,0,s,o,!1),0}}},me=async e=>{var r=await w(e);return new Uint8Array(r)},Ie=(e,r,o,s,c,E)=>{l.createDataFile(e,r,o,s,c,E)},we=n.preloadPlugins||[],Ce=(e,r,o,s)=>{typeof Browser<"u"&&Browser.init();var c=!1;return we.forEach(E=>{c||E.canHandle(r)&&(E.handle(e,r,o,s),c=!0)}),c},ze=(e,r,o,s,c,E,g,y,p,C)=>{var R=r?Rt.resolve(z.join2(e,r)):e;function N(O){function W(x){C==null||C(),y||Ie(e,r,x,s,c,p),E==null||E(),Ot()}Ce(O,R,W,()=>{g==null||g(),Ot()})||W(O)}zt(),typeof o=="string"?me(o).then(N,g):N(o)},Je=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},o=r[e];if(typeof o>"u")throw new Error(`Unknown file open mode: ${e}`);return o},De=(e,r)=>{var o=0;return e&&(o|=365),r&&(o|=146),o},l={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){bt(this,"name","ErrnoError");this.errno=e}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){bt(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,o,s){bt(this,"node_ops",{});bt(this,"stream_ops",{});bt(this,"readMode",365);bt(this,"writeMode",146);bt(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=l.nextInode++,this.name=r,this.mode=o,this.rdev=s,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return l.isDir(this.mode)}get isDevice(){return l.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new l.ErrnoError(44);r.follow_mount??(r.follow_mount=!0),z.isAbs(e)||(e=l.cwd()+"/"+e);t:for(var o=0;o<40;o++){for(var s=e.split("/").filter(C=>!!C),c=l.root,E="/",g=0;g<s.length;g++){var y=g===s.length-1;if(y&&r.parent)break;if(s[g]!=="."){if(s[g]===".."){E=z.dirname(E),c=c.parent;continue}E=z.join2(E,s[g]);try{c=l.lookupNode(c,s[g])}catch(C){if((C==null?void 0:C.errno)===44&&y&&r.noent_okay)return{path:E};throw C}if(l.isMountpoint(c)&&(!y||r.follow_mount)&&(c=c.mounted.root),l.isLink(c.mode)&&(!y||r.follow)){if(!c.node_ops.readlink)throw new l.ErrnoError(52);var p=c.node_ops.readlink(c);z.isAbs(p)||(p=z.dirname(E)+"/"+p),e=p+"/"+s.slice(g+1).join("/");continue t}}}return{path:E,node:c}}throw new l.ErrnoError(32)},getPath(e){for(var r;;){if(l.isRoot(e)){var o=e.mount.mountpoint;return r?o[o.length-1]!=="/"?`${o}/${r}`:o+r:o}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var o=0,s=0;s<r.length;s++)o=(o<<5)-o+r.charCodeAt(s)|0;return(e+o>>>0)%l.nameTable.length},hashAddNode(e){var r=l.hashName(e.parent.id,e.name);e.name_next=l.nameTable[r],l.nameTable[r]=e},hashRemoveNode(e){var r=l.hashName(e.parent.id,e.name);if(l.nameTable[r]===e)l.nameTable[r]=e.name_next;else for(var o=l.nameTable[r];o;){if(o.name_next===e){o.name_next=e.name_next;break}o=o.name_next}},lookupNode(e,r){var o=l.mayLookup(e);if(o)throw new l.ErrnoError(o);for(var s=l.hashName(e.id,r),c=l.nameTable[s];c;c=c.name_next){var E=c.name;if(c.parent.id===e.id&&E===r)return c}return l.lookup(e,r)},createNode(e,r,o,s){var c=new l.FSNode(e,r,o,s);return l.hashAddNode(c),c},destroyNode(e){l.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return l.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!l.isDir(e.mode))return 54;var r=l.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!l.isDir(e.mode))return 54;try{var o=l.lookupNode(e,r);return 20}catch{}return l.nodePermissions(e,"wx")},mayDelete(e,r,o){var s;try{s=l.lookupNode(e,r)}catch(E){return E.errno}var c=l.nodePermissions(e,"wx");if(c)return c;if(o){if(!l.isDir(s.mode))return 54;if(l.isRoot(s)||l.getPath(s)===l.cwd())return 10}else if(l.isDir(s.mode))return 31;return 0},mayOpen(e,r){return e?l.isLink(e.mode)?32:l.isDir(e.mode)&&(l.flagsToPermissionString(r)!=="r"||r&576)?31:l.nodePermissions(e,l.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new l.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=l.MAX_OPEN_FDS;e++)if(!l.streams[e])return e;throw new l.ErrnoError(33)},getStreamChecked(e){var r=l.getStream(e);if(!r)throw new l.ErrnoError(8);return r},getStream:e=>l.streams[e],createStream(e,r=-1){return e=Object.assign(new l.FSStream,e),r==-1&&(r=l.nextfd()),e.fd=r,l.streams[r]=e,e},closeStream(e){l.streams[e]=null},dupStream(e,r=-1){var s,c;var o=l.createStream(e,r);return(c=(s=o.stream_ops)==null?void 0:s.dup)==null||c.call(s,o),o},doSetAttr(e,r,o){var s=e==null?void 0:e.stream_ops.setattr,c=s?e:r;s??(s=r.node_ops.setattr),l.checkOpExists(s,63),s(c,o)},chrdev_stream_ops:{open(e){var o,s;var r=l.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(s=(o=e.stream_ops).open)==null||s.call(o,e)},llseek(){throw new l.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){l.devices[e]={stream_ops:r}},getDevice:e=>l.devices[e],getMounts(e){for(var r=[],o=[e];o.length;){var s=o.pop();r.push(s),o.push(...s.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),l.syncFSRequests++,l.syncFSRequests>1&&b(`warning: ${l.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var o=l.getMounts(l.root.mount),s=0;function c(g){return l.syncFSRequests--,r(g)}function E(g){if(g)return E.errored?void 0:(E.errored=!0,c(g));++s>=o.length&&c(null)}o.forEach(g=>{if(!g.type.syncfs)return E(null);g.type.syncfs(g,e,E)})},mount(e,r,o){var s=o==="/",c=!o,E;if(s&&l.root)throw new l.ErrnoError(10);if(!s&&!c){var g=l.lookupPath(o,{follow_mount:!1});if(o=g.path,E=g.node,l.isMountpoint(E))throw new l.ErrnoError(10);if(!l.isDir(E.mode))throw new l.ErrnoError(54)}var y={type:e,opts:r,mountpoint:o,mounts:[]},p=e.mount(y);return p.mount=y,y.root=p,s?l.root=p:E&&(E.mounted=y,E.mount&&E.mount.mounts.push(y)),p},unmount(e){var r=l.lookupPath(e,{follow_mount:!1});if(!l.isMountpoint(r.node))throw new l.ErrnoError(28);var o=r.node,s=o.mounted,c=l.getMounts(s);Object.keys(l.nameTable).forEach(g=>{for(var y=l.nameTable[g];y;){var p=y.name_next;c.includes(y.mount)&&l.destroyNode(y),y=p}}),o.mounted=null;var E=o.mount.mounts.indexOf(s);o.mount.mounts.splice(E,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,o){var s=l.lookupPath(e,{parent:!0}),c=s.node,E=z.basename(e);if(!E)throw new l.ErrnoError(28);if(E==="."||E==="..")throw new l.ErrnoError(20);var g=l.mayCreate(c,E);if(g)throw new l.ErrnoError(g);if(!c.node_ops.mknod)throw new l.ErrnoError(63);return c.node_ops.mknod(c,E,r,o)},statfs(e){return l.statfsNode(l.lookupPath(e,{follow:!0}).node)},statfsStream(e){return l.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:l.nextInode,ffree:l.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,l.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,l.mknod(e,r,0)},mkdirTree(e,r){for(var o=e.split("/"),s="",c=0;c<o.length;++c)if(o[c]){s+="/"+o[c];try{l.mkdir(s,r)}catch(E){if(E.errno!=20)throw E}}},mkdev(e,r,o){return typeof o>"u"&&(o=r,r=438),r|=8192,l.mknod(e,r,o)},symlink(e,r){if(!Rt.resolve(e))throw new l.ErrnoError(44);var o=l.lookupPath(r,{parent:!0}),s=o.node;if(!s)throw new l.ErrnoError(44);var c=z.basename(r),E=l.mayCreate(s,c);if(E)throw new l.ErrnoError(E);if(!s.node_ops.symlink)throw new l.ErrnoError(63);return s.node_ops.symlink(s,c,e)},rename(e,r){var o=z.dirname(e),s=z.dirname(r),c=z.basename(e),E=z.basename(r),g,y,p;if(g=l.lookupPath(e,{parent:!0}),y=g.node,g=l.lookupPath(r,{parent:!0}),p=g.node,!y||!p)throw new l.ErrnoError(44);if(y.mount!==p.mount)throw new l.ErrnoError(75);var C=l.lookupNode(y,c),R=Rt.relative(e,s);if(R.charAt(0)!==".")throw new l.ErrnoError(28);if(R=Rt.relative(r,o),R.charAt(0)!==".")throw new l.ErrnoError(55);var N;try{N=l.lookupNode(p,E)}catch{}if(C!==N){var O=l.isDir(C.mode),W=l.mayDelete(y,c,O);if(W)throw new l.ErrnoError(W);if(W=N?l.mayDelete(p,E,O):l.mayCreate(p,E),W)throw new l.ErrnoError(W);if(!y.node_ops.rename)throw new l.ErrnoError(63);if(l.isMountpoint(C)||N&&l.isMountpoint(N))throw new l.ErrnoError(10);if(p!==y&&(W=l.nodePermissions(y,"w"),W))throw new l.ErrnoError(W);l.hashRemoveNode(C);try{y.node_ops.rename(C,p,E),C.parent=p}catch(x){throw x}finally{l.hashAddNode(C)}}},rmdir(e){var r=l.lookupPath(e,{parent:!0}),o=r.node,s=z.basename(e),c=l.lookupNode(o,s),E=l.mayDelete(o,s,!0);if(E)throw new l.ErrnoError(E);if(!o.node_ops.rmdir)throw new l.ErrnoError(63);if(l.isMountpoint(c))throw new l.ErrnoError(10);o.node_ops.rmdir(o,s),l.destroyNode(c)},readdir(e){var r=l.lookupPath(e,{follow:!0}),o=r.node,s=l.checkOpExists(o.node_ops.readdir,54);return s(o)},unlink(e){var r=l.lookupPath(e,{parent:!0}),o=r.node;if(!o)throw new l.ErrnoError(44);var s=z.basename(e),c=l.lookupNode(o,s),E=l.mayDelete(o,s,!1);if(E)throw new l.ErrnoError(E);if(!o.node_ops.unlink)throw new l.ErrnoError(63);if(l.isMountpoint(c))throw new l.ErrnoError(10);o.node_ops.unlink(o,s),l.destroyNode(c)},readlink(e){var r=l.lookupPath(e),o=r.node;if(!o)throw new l.ErrnoError(44);if(!o.node_ops.readlink)throw new l.ErrnoError(28);return o.node_ops.readlink(o)},stat(e,r){var o=l.lookupPath(e,{follow:!r}),s=o.node,c=l.checkOpExists(s.node_ops.getattr,63);return c(s)},fstat(e){var r=l.getStreamChecked(e),o=r.node,s=r.stream_ops.getattr,c=s?r:o;return s??(s=o.node_ops.getattr),l.checkOpExists(s,63),s(c)},lstat(e){return l.stat(e,!0)},doChmod(e,r,o,s){l.doSetAttr(e,r,{mode:o&4095|r.mode&-4096,ctime:Date.now(),dontFollow:s})},chmod(e,r,o){var s;if(typeof e=="string"){var c=l.lookupPath(e,{follow:!o});s=c.node}else s=e;l.doChmod(null,s,r,o)},lchmod(e,r){l.chmod(e,r,!0)},fchmod(e,r){var o=l.getStreamChecked(e);l.doChmod(o,o.node,r,!1)},doChown(e,r,o){l.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:o})},chown(e,r,o,s){var c;if(typeof e=="string"){var E=l.lookupPath(e,{follow:!s});c=E.node}else c=e;l.doChown(null,c,s)},lchown(e,r,o){l.chown(e,r,o,!0)},fchown(e,r,o){var s=l.getStreamChecked(e);l.doChown(s,s.node,!1)},doTruncate(e,r,o){if(l.isDir(r.mode))throw new l.ErrnoError(31);if(!l.isFile(r.mode))throw new l.ErrnoError(28);var s=l.nodePermissions(r,"w");if(s)throw new l.ErrnoError(s);l.doSetAttr(e,r,{size:o,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new l.ErrnoError(28);var o;if(typeof e=="string"){var s=l.lookupPath(e,{follow:!0});o=s.node}else o=e;l.doTruncate(null,o,r)},ftruncate(e,r){var o=l.getStreamChecked(e);if(r<0||(o.flags&2097155)===0)throw new l.ErrnoError(28);l.doTruncate(o,o.node,r)},utime(e,r,o){var s=l.lookupPath(e,{follow:!0}),c=s.node,E=l.checkOpExists(c.node_ops.setattr,63);E(c,{atime:r,mtime:o})},open(e,r,o=438){if(e==="")throw new l.ErrnoError(44);r=typeof r=="string"?Je(r):r,r&64?o=o&4095|32768:o=0;var s,c;if(typeof e=="object")s=e;else{c=e.endsWith("/");var E=l.lookupPath(e,{follow:!(r&131072),noent_okay:!0});s=E.node,e=E.path}var g=!1;if(r&64)if(s){if(r&128)throw new l.ErrnoError(20)}else{if(c)throw new l.ErrnoError(31);s=l.mknod(e,o|511,0),g=!0}if(!s)throw new l.ErrnoError(44);if(l.isChrdev(s.mode)&&(r&=-513),r&65536&&!l.isDir(s.mode))throw new l.ErrnoError(54);if(!g){var y=l.mayOpen(s,r);if(y)throw new l.ErrnoError(y)}r&512&&!g&&l.truncate(s,0),r&=-131713;var p=l.createStream({node:s,path:l.getPath(s),flags:r,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1});return p.stream_ops.open&&p.stream_ops.open(p),g&&l.chmod(s,o&511),n.logReadFiles&&!(r&1)&&(e in l.readFiles||(l.readFiles[e]=1)),p},close(e){if(l.isClosed(e))throw new l.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{l.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,o){if(l.isClosed(e))throw new l.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new l.ErrnoError(70);if(o!=0&&o!=1&&o!=2)throw new l.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,o),e.ungotten=[],e.position},read(e,r,o,s,c){if(s<0||c<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===1)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.read)throw new l.ErrnoError(28);var E=typeof c<"u";if(!E)c=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var g=e.stream_ops.read(e,r,o,s,c);return E||(e.position+=g),g},write(e,r,o,s,c,E){if(s<0||c<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===0)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.write)throw new l.ErrnoError(28);e.seekable&&e.flags&1024&&l.llseek(e,0,2);var g=typeof c<"u";if(!g)c=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var y=e.stream_ops.write(e,r,o,s,c,E);return g||(e.position+=y),y},allocate(e,r,o){if(l.isClosed(e))throw new l.ErrnoError(8);if(r<0||o<=0)throw new l.ErrnoError(28);if((e.flags&2097155)===0)throw new l.ErrnoError(8);if(!l.isFile(e.node.mode)&&!l.isDir(e.node.mode))throw new l.ErrnoError(43);if(!e.stream_ops.allocate)throw new l.ErrnoError(138);e.stream_ops.allocate(e,r,o)},mmap(e,r,o,s,c){if((s&2)!==0&&(c&2)===0&&(e.flags&2097155)!==2)throw new l.ErrnoError(2);if((e.flags&2097155)===1)throw new l.ErrnoError(2);if(!e.stream_ops.mmap)throw new l.ErrnoError(43);if(!r)throw new l.ErrnoError(28);return e.stream_ops.mmap(e,r,o,s,c)},msync(e,r,o,s,c){return e.stream_ops.msync?e.stream_ops.msync(e,r,o,s,c):0},ioctl(e,r,o){if(!e.stream_ops.ioctl)throw new l.ErrnoError(59);return e.stream_ops.ioctl(e,r,o)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var o,s=l.open(e,r.flags),c=l.stat(e),E=c.size,g=new Uint8Array(E);return l.read(s,g,0,E,0),r.encoding==="utf8"?o=St(g):r.encoding==="binary"&&(o=g),l.close(s),o},writeFile(e,r,o={}){o.flags=o.flags||577;var s=l.open(e,o.flags,o.mode);if(typeof r=="string"){var c=new Uint8Array(Wt(r)+1),E=Qt(r,c,0,c.length);l.write(s,c,0,E,void 0,o.canOwn)}else if(ArrayBuffer.isView(r))l.write(s,r,0,r.byteLength,void 0,o.canOwn);else throw new Error("Unsupported data type");l.close(s)},cwd:()=>l.currentPath,chdir(e){var r=l.lookupPath(e,{follow:!0});if(r.node===null)throw new l.ErrnoError(44);if(!l.isDir(r.node.mode))throw new l.ErrnoError(54);var o=l.nodePermissions(r.node,"x");if(o)throw new l.ErrnoError(o);l.currentPath=r.path},createDefaultDirectories(){l.mkdir("/tmp"),l.mkdir("/home"),l.mkdir("/home/web_user")},createDefaultDevices(){l.mkdir("/dev"),l.registerDevice(l.makedev(1,3),{read:()=>0,write:(s,c,E,g,y)=>g,llseek:()=>0}),l.mkdev("/dev/null",l.makedev(1,3)),pt.register(l.makedev(5,0),pt.default_tty_ops),pt.register(l.makedev(6,0),pt.default_tty1_ops),l.mkdev("/dev/tty",l.makedev(5,0)),l.mkdev("/dev/tty1",l.makedev(6,0));var e=new Uint8Array(1024),r=0,o=()=>(r===0&&(Zt(e),r=e.byteLength),e[--r]);l.createDevice("/dev","random",o),l.createDevice("/dev","urandom",o),l.mkdir("/dev/shm"),l.mkdir("/dev/shm/tmp")},createSpecialDirectories(){l.mkdir("/proc");var e=l.mkdir("/proc/self");l.mkdir("/proc/self/fd"),l.mount({mount(){var r=l.createNode(e,"fd",16895,73);return r.stream_ops={llseek:B.stream_ops.llseek},r.node_ops={lookup(o,s){var c=+s,E=l.getStreamChecked(c),g={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>E.path},id:c+1};return g.parent=g,g},readdir(){return Array.from(l.streams.entries()).filter(([o,s])=>s).map(([o,s])=>o.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,o){e?l.createDevice("/dev","stdin",e):l.symlink("/dev/tty","/dev/stdin"),r?l.createDevice("/dev","stdout",null,r):l.symlink("/dev/tty","/dev/stdout"),o?l.createDevice("/dev","stderr",null,o):l.symlink("/dev/tty1","/dev/stderr"),l.open("/dev/stdin",0),l.open("/dev/stdout",1),l.open("/dev/stderr",1)},staticInit(){l.nameTable=new Array(4096),l.mount(B,{},"/"),l.createDefaultDirectories(),l.createDefaultDevices(),l.createSpecialDirectories(),l.filesystems={MEMFS:B}},init(e,r,o){l.initialized=!0,e??(e=n.stdin),r??(r=n.stdout),o??(o=n.stderr),l.createStandardStreams(e,r,o)},quit(){l.initialized=!1;for(var e=0;e<l.streams.length;e++){var r=l.streams[e];r&&l.close(r)}},findObject(e,r){var o=l.analyzePath(e,r);return o.exists?o.object:null},analyzePath(e,r){try{var o=l.lookupPath(e,{follow:!r});e=o.path}catch{}var s={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var o=l.lookupPath(e,{parent:!0});s.parentExists=!0,s.parentPath=o.path,s.parentObject=o.node,s.name=z.basename(e),o=l.lookupPath(e,{follow:!r}),s.exists=!0,s.path=o.path,s.object=o.node,s.name=o.node.name,s.isRoot=o.path==="/"}catch(c){s.error=c.errno}return s},createPath(e,r,o,s){e=typeof e=="string"?e:l.getPath(e);for(var c=r.split("/").reverse();c.length;){var E=c.pop();if(E){var g=z.join2(e,E);try{l.mkdir(g)}catch{}e=g}}return g},createFile(e,r,o,s,c){var E=z.join2(typeof e=="string"?e:l.getPath(e),r),g=De(s,c);return l.create(E,g)},createDataFile(e,r,o,s,c,E){var g=r;e&&(e=typeof e=="string"?e:l.getPath(e),g=r?z.join2(e,r):e);var y=De(s,c),p=l.create(g,y);if(o){if(typeof o=="string"){for(var C=new Array(o.length),R=0,N=o.length;R<N;++R)C[R]=o.charCodeAt(R);o=C}l.chmod(p,y|146);var O=l.open(p,577);l.write(O,o,0,o.length,0,E),l.close(O),l.chmod(p,y)}},createDevice(e,r,o,s){var y;var c=z.join2(typeof e=="string"?e:l.getPath(e),r),E=De(!!o,!!s);(y=l.createDevice).major??(y.major=64);var g=l.makedev(l.createDevice.major++,0);return l.registerDevice(g,{open(p){p.seekable=!1},close(p){var C;(C=s==null?void 0:s.buffer)!=null&&C.length&&s(10)},read(p,C,R,N,O){for(var W=0,x=0;x<N;x++){var K;try{K=o()}catch{throw new l.ErrnoError(29)}if(K===void 0&&W===0)throw new l.ErrnoError(6);if(K==null)break;W++,C[R+x]=K}return W&&(p.node.atime=Date.now()),W},write(p,C,R,N,O){for(var W=0;W<N;W++)try{s(C[R+W])}catch{throw new l.ErrnoError(29)}return N&&(p.node.mtime=p.node.ctime=Date.now()),W}}),l.mkdev(c,E,g)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=I(e.url),e.usedBytes=e.contents.length}catch{throw new l.ErrnoError(29)}},createLazyFile(e,r,o,s,c){class E{constructor(){bt(this,"lengthKnown",!1);bt(this,"chunks",[])}get(W){if(!(W>this.length-1||W<0)){var x=W%this.chunkSize,K=W/this.chunkSize|0;return this.getter(K)[x]}}setDataGetter(W){this.getter=W}cacheLength(){var W=new XMLHttpRequest;if(W.open("HEAD",o,!1),W.send(null),!(W.status>=200&&W.status<300||W.status===304))throw new Error("Couldn't load "+o+". Status: "+W.status);var x=Number(W.getResponseHeader("Content-length")),K,_t=(K=W.getResponseHeader("Accept-Ranges"))&&K==="bytes",at=(K=W.getResponseHeader("Content-Encoding"))&&K==="gzip",lt=1024*1024;_t||(lt=x);var tt=(At,Kt)=>{if(At>Kt)throw new Error("invalid range ("+At+", "+Kt+") or no bytes requested!");if(Kt>x-1)throw new Error("only "+x+" bytes available! programmer error!");var ot=new XMLHttpRequest;if(ot.open("GET",o,!1),x!==lt&&ot.setRequestHeader("Range","bytes="+At+"-"+Kt),ot.responseType="arraybuffer",ot.overrideMimeType&&ot.overrideMimeType("text/plain; charset=x-user-defined"),ot.send(null),!(ot.status>=200&&ot.status<300||ot.status===304))throw new Error("Couldn't load "+o+". Status: "+ot.status);return ot.response!==void 0?new Uint8Array(ot.response||[]):se(ot.responseText||"")},ue=this;ue.setDataGetter(At=>{var Kt=At*lt,ot=(At+1)*lt-1;if(ot=Math.min(ot,x-1),typeof ue.chunks[At]>"u"&&(ue.chunks[At]=tt(Kt,ot)),typeof ue.chunks[At]>"u")throw new Error("doXHR failed!");return ue.chunks[At]}),(at||!x)&&(lt=x=1,x=this.getter(0).length,lt=x,M("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=x,this._chunkSize=lt,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!h)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var g=new E,y={isDevice:!1,contents:g}}else var y={isDevice:!1,url:o};var p=l.createFile(e,r,y,s,c);y.contents?p.contents=y.contents:y.url&&(p.contents=null,p.url=y.url),Object.defineProperties(p,{usedBytes:{get:function(){return this.contents.length}}});var C={},R=Object.keys(p.stream_ops);R.forEach(O=>{var W=p.stream_ops[O];C[O]=(...x)=>(l.forceLoadFile(p),W(...x))});function N(O,W,x,K,_t){var at=O.node.contents;if(_t>=at.length)return 0;var lt=Math.min(at.length-_t,K);if(at.slice)for(var tt=0;tt<lt;tt++)W[x+tt]=at[_t+tt];else for(var tt=0;tt<lt;tt++)W[x+tt]=at.get(_t+tt);return lt}return C.read=(O,W,x,K,_t)=>(l.forceLoadFile(p),N(O,W,x,K,_t)),C.mmap=(O,W,x,K,_t)=>{l.forceLoadFile(p);var at=_e();if(!at)throw new l.ErrnoError(48);return N(O,U,at,W,x),{ptr:at,allocated:!0}},p.stream_ops=C,p}},de=(e,r)=>(e>>>=0,e?St(Z,e,r):""),et={DEFAULT_POLLMASK:5,calculateAt(e,r,o){if(z.isAbs(r))return r;var s;if(e===-100)s=l.cwd();else{var c=et.getStreamFromFD(e);s=c.path}if(r.length==0){if(!o)throw new l.ErrnoError(44);return s}return s+"/"+r},writeStat(e,r){Y[e>>>2>>>0]=r.dev,Y[e+4>>>2>>>0]=r.mode,F[e+8>>>2>>>0]=r.nlink,Y[e+12>>>2>>>0]=r.uid,Y[e+16>>>2>>>0]=r.gid,Y[e+20>>>2>>>0]=r.rdev,it[e+24>>>3]=BigInt(r.size),Y[e+32>>>2>>>0]=4096,Y[e+36>>>2>>>0]=r.blocks;var o=r.atime.getTime(),s=r.mtime.getTime(),c=r.ctime.getTime();return it[e+40>>>3]=BigInt(Math.floor(o/1e3)),F[e+48>>>2>>>0]=o%1e3*1e3*1e3,it[e+56>>>3]=BigInt(Math.floor(s/1e3)),F[e+64>>>2>>>0]=s%1e3*1e3*1e3,it[e+72>>>3]=BigInt(Math.floor(c/1e3)),F[e+80>>>2>>>0]=c%1e3*1e3*1e3,it[e+88>>>3]=BigInt(r.ino),0},writeStatFs(e,r){Y[e+4>>>2>>>0]=r.bsize,Y[e+40>>>2>>>0]=r.bsize,Y[e+8>>>2>>>0]=r.blocks,Y[e+12>>>2>>>0]=r.bfree,Y[e+16>>>2>>>0]=r.bavail,Y[e+20>>>2>>>0]=r.files,Y[e+24>>>2>>>0]=r.ffree,Y[e+28>>>2>>>0]=r.fsid,Y[e+44>>>2>>>0]=r.flags,Y[e+36>>>2>>>0]=r.namelen},doMsync(e,r,o,s,c){if(!l.isFile(r.node.mode))throw new l.ErrnoError(43);if(s&2)return 0;var E=Z.slice(e,e+o);l.msync(r,E,c,o,s)},getStreamFromFD(e){var r=l.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=de(e);return r}};function cn(e,r,o){o>>>=0,et.varargs=o;try{var s=et.getStreamFromFD(e);switch(r){case 0:{var c=Jt();if(c<0)return-28;for(;l.streams[c];)c++;var E;return E=l.dupStream(s,c),E.fd}case 1:case 2:return 0;case 3:return s.flags;case 4:{var c=Jt();return s.flags|=c,0}case 12:{var c=Gt(),g=0;return rt[c+g>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(y){if(typeof l>"u"||y.name!=="ErrnoError")throw y;return-y.errno}}function Ze(e,r){r>>>=0;try{return et.writeStat(r,l.fstat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function ke(e,r,o){o>>>=0,et.varargs=o;try{var s=et.getStreamFromFD(e);switch(r){case 21509:return s.tty?0:-59;case 21505:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcgets){var c=s.tty.ops.ioctl_tcgets(s),E=Gt();Y[E>>>2>>>0]=c.c_iflag||0,Y[E+4>>>2>>>0]=c.c_oflag||0,Y[E+8>>>2>>>0]=c.c_cflag||0,Y[E+12>>>2>>>0]=c.c_lflag||0;for(var g=0;g<32;g++)U[E+g+17>>>0]=c.c_cc[g]||0;return 0}return 0}case 21510:case 21511:case 21512:return s.tty?0:-59;case 21506:case 21507:case 21508:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcsets){for(var E=Gt(),y=Y[E>>>2>>>0],p=Y[E+4>>>2>>>0],C=Y[E+8>>>2>>>0],R=Y[E+12>>>2>>>0],N=[],g=0;g<32;g++)N.push(U[E+g+17>>>0]);return s.tty.ops.ioctl_tcsets(s.tty,r,{c_iflag:y,c_oflag:p,c_cflag:C,c_lflag:R,c_cc:N})}return 0}case 21519:{if(!s.tty)return-59;var E=Gt();return Y[E>>>2>>>0]=0,0}case 21520:return s.tty?-28:-59;case 21531:{var E=Gt();return l.ioctl(s,r,E)}case 21523:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tiocgwinsz){var O=s.tty.ops.ioctl_tiocgwinsz(s.tty),E=Gt();rt[E>>>1>>>0]=O[0],rt[E+2>>>1>>>0]=O[1]}return 0}case 21524:return s.tty?0:-59;case 21515:return s.tty?0:-59;default:return-28}}catch(W){if(typeof l>"u"||W.name!=="ErrnoError")throw W;return-W.errno}}function J(e,r){e>>>=0,r>>>=0;try{return e=et.getStr(e),et.writeStat(r,l.lstat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function j(e,r,o,s){r>>>=0,o>>>=0;try{r=et.getStr(r);var c=s&256,E=s&4096;return s=s&-6401,r=et.calculateAt(e,r,E),et.writeStat(o,c?l.lstat(r):l.stat(r))}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function jt(e,r,o,s){r>>>=0,s>>>=0,et.varargs=s;try{r=et.getStr(r),r=et.calculateAt(e,r);var c=s?Jt():0;return l.open(r,o,c).fd}catch(E){if(typeof l>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function qe(e,r){e>>>=0,r>>>=0;try{return e=et.getStr(e),et.writeStat(r,l.stat(e))}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var un=()=>Nt(""),Re=e=>{if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e},Oe=()=>{for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Qe=e},Qe,st=e=>{for(var r="",o=e;Z[o>>>0];)r+=Qe[Z[o++>>>0]];return r},Ht={},ut={},ht={},te,V=e=>{throw new te(e)},je,Se=e=>{throw new je(e)},Le=(e,r,o)=>{e.forEach(y=>ht[y]=r);function s(y){var p=o(y);p.length!==e.length&&Se("Mismatched type converter count");for(var C=0;C<e.length;++C)Et(e[C],p[C])}var c=new Array(r.length),E=[],g=0;r.forEach((y,p)=>{ut.hasOwnProperty(y)?c[p]=ut[y]:(E.push(y),Ht.hasOwnProperty(y)||(Ht[y]=[]),Ht[y].push(()=>{c[p]=ut[y],++g,g===E.length&&s(c)}))}),E.length===0&&s(c)};function Be(e,r,o={}){var s=r.name;if(e||V(`type "${s}" must have a positive integer typeid pointer`),ut.hasOwnProperty(e)){if(o.ignoreDuplicateRegistrations)return;V(`Cannot register type '${s}' twice`)}if(ut[e]=r,delete ht[e],Ht.hasOwnProperty(e)){var c=Ht[e];delete Ht[e],c.forEach(E=>E())}}function Et(e,r,o={}){return Be(e,r,o)}var Fe=(e,r,o)=>{switch(r){case 1:return o?s=>U[s>>>0]:s=>Z[s>>>0];case 2:return o?s=>rt[s>>>1>>>0]:s=>dt[s>>>1>>>0];case 4:return o?s=>Y[s>>>2>>>0]:s=>F[s>>>2>>>0];case 8:return o?s=>it[s>>>3]:s=>Yt[s>>>3];default:throw new TypeError(`invalid integer width (${r}): ${e}`)}};function pr(e,r,o,s,c){e>>>=0,r>>>=0,o>>>=0,r=st(r);var E=r.indexOf("u")!=-1;Et(e,{name:r,fromWireType:g=>g,toWireType:function(g,y){if(typeof y!="bigint"&&typeof y!="number")throw new TypeError(`Cannot convert "${Re(y)}" to ${this.name}`);return typeof y=="number"&&(y=BigInt(y)),y},argPackAdvance:Mt,readValueFromPointer:Fe(r,o,!E),destructorFunction:null})}var Mt=8;function Pr(e,r,o,s){e>>>=0,r>>>=0,r=st(r),Et(e,{name:r,fromWireType:function(c){return!!c},toWireType:function(c,E){return E?o:s},argPackAdvance:Mt,readValueFromPointer:function(c){return this.fromWireType(Z[c>>>0])},destructorFunction:null})}var vr=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),En=e=>{function r(o){return o.$$.ptrType.registeredClass.name}V(r(e)+" instance already deleted")},fn=!1,Mn=e=>{},mr=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},bn=e=>{e.count.value-=1;var r=e.count.value===0;r&&mr(e)},xn=(e,r,o)=>{if(r===o)return e;if(o.baseClass===void 0)return null;var s=xn(e,r,o.baseClass);return s===null?null:o.downcast(s)},kn={},Ir={},wr=(e,r)=>{for(r===void 0&&V("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},Cr=(e,r)=>(r=wr(e,r),Ir[r]),tn=(e,r)=>{(!r.ptrType||!r.ptr)&&Se("makeClassHandle requires ptr and ptrType");var o=!!r.smartPtrType,s=!!r.smartPtr;return o!==s&&Se("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Ue(Object.create(e,{$$:{value:r,writable:!0}}))};function Dr(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var o=Cr(this.registeredClass,r);if(o!==void 0){if(o.$$.count.value===0)return o.$$.ptr=r,o.$$.smartPtr=e,o.clone();var s=o.clone();return this.destructor(e),s}function c(){return this.isSmartPointer?tn(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):tn(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var E=this.registeredClass.getActualType(r),g=kn[E];if(!g)return c.call(this);var y;this.isConst?y=g.constPointerType:y=g.pointerType;var p=xn(r,this.registeredClass,y.registeredClass);return p===null?c.call(this):this.isSmartPointer?tn(y.registeredClass.instancePrototype,{ptrType:y,ptr:p,smartPtrType:this,smartPtr:e}):tn(y.registeredClass.instancePrototype,{ptrType:y,ptr:p})}var Ue=e=>typeof FinalizationRegistry>"u"?(Ue=r=>r,e):(fn=new FinalizationRegistry(r=>{bn(r.$$)}),Ue=r=>{var o=r.$$,s=!!o.smartPtr;if(s){var c={$$:o};fn.register(r,c,r)}return r},Mn=r=>fn.unregister(r),Ue(e)),Rr=()=>{Object.assign(en.prototype,{isAliasOf(e){if(!(this instanceof en)||!(e instanceof en))return!1;var r=this.$$.ptrType.registeredClass,o=this.$$.ptr;e.$$=e.$$;for(var s=e.$$.ptrType.registeredClass,c=e.$$.ptr;r.baseClass;)o=r.upcast(o),r=r.baseClass;for(;s.baseClass;)c=s.upcast(c),s=s.baseClass;return r===s&&o===c},clone(){if(this.$$.ptr||En(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ue(Object.create(Object.getPrototypeOf(this),{$$:{value:vr(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||En(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&V("Object already scheduled for deletion"),Mn(this),bn(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||En(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&V("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}})};function en(){}var Ye=(e,r)=>Object.defineProperty(r,"name",{value:e}),Sr=(e,r,o)=>{if(e[r].overloadTable===void 0){var s=e[r];e[r]=function(...c){return e[r].overloadTable.hasOwnProperty(c.length)||V(`Function '${o}' called with an invalid number of arguments (${c.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[c.length].apply(this,c)},e[r].overloadTable=[],e[r].overloadTable[s.argCount]=s}},hn=(e,r,o)=>{n.hasOwnProperty(e)?((o===void 0||n[e].overloadTable!==void 0&&n[e].overloadTable[o]!==void 0)&&V(`Cannot register public name '${e}' twice`),Sr(n,e,e),n[e].overloadTable.hasOwnProperty(o)&&V(`Cannot register multiple overloads of a function with the same number of arguments (${o})!`),n[e].overloadTable[o]=r):(n[e]=r,n[e].argCount=o)},Lr=48,Yr=57,Nr=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Lr&&r<=Yr?`_${e}`:e};function Gr(e,r,o,s,c,E,g,y){this.name=e,this.constructor=r,this.instancePrototype=o,this.rawDestructor=s,this.baseClass=c,this.getActualType=E,this.upcast=g,this.downcast=y,this.pureVirtualFunctions=[]}var nn=(e,r,o)=>{for(;r!==o;)r.upcast||V(`Expected null or instance of ${o.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function Wr(e,r){if(r===null)return this.isReference&&V(`null is not a valid ${this.name}`),0;r.$$||V(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||V(`Cannot pass deleted object as a pointer of type ${this.name}`);var o=r.$$.ptrType.registeredClass,s=nn(r.$$.ptr,o,this.registeredClass);return s}function Mr(e,r){var o;if(r===null)return this.isReference&&V(`null is not a valid ${this.name}`),this.isSmartPointer?(o=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,o),o):0;(!r||!r.$$)&&V(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||V(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&V(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var s=r.$$.ptrType.registeredClass;if(o=nn(r.$$.ptr,s,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&V("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?o=r.$$.smartPtr:V(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:o=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)o=r.$$.smartPtr;else{var c=r.clone();o=this.rawShare(o,gt.toHandle(()=>c.delete())),e!==null&&e.push(this.rawDestructor,o)}break;default:V("Unsupporting sharing policy")}return o}function br(e,r){if(r===null)return this.isReference&&V(`null is not a valid ${this.name}`),0;r.$$||V(`Cannot pass "${Re(r)}" as a ${this.name}`),r.$$.ptr||V(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&V(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var o=r.$$.ptrType.registeredClass,s=nn(r.$$.ptr,o,this.registeredClass);return s}function rn(e){return this.fromWireType(F[e>>>2>>>0])}var xr=()=>{Object.assign(an.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var r;(r=this.rawDestructor)==null||r.call(this,e)},argPackAdvance:Mt,readValueFromPointer:rn,fromWireType:Dr})};function an(e,r,o,s,c,E,g,y,p,C,R){this.name=e,this.registeredClass=r,this.isReference=o,this.isConst=s,this.isSmartPointer=c,this.pointeeType=E,this.sharingPolicy=g,this.rawGetPointee=y,this.rawConstructor=p,this.rawShare=C,this.rawDestructor=R,!c&&r.baseClass===void 0?s?(this.toWireType=Wr,this.destructorFunction=null):(this.toWireType=br,this.destructorFunction=null):this.toWireType=Mr}var On=(e,r,o)=>{n.hasOwnProperty(e)||Se("Replacing nonexistent public symbol"),n[e].overloadTable!==void 0&&o!==void 0?n[e].overloadTable[o]=r:(n[e]=r,n[e].argCount=o)},on=[],Bn,Fn=e=>{var r=on[e];return r||(e>=on.length&&(on.length=e+1),on[e]=r=Bn.get(e)),r},kr=(e,r,o=[])=>{var s=Fn(r)(...o);return e[0]=="p"?s>>>0:s},Or=(e,r)=>(...o)=>kr(e,r,o),le=(e,r)=>{e=st(e);function o(){return e.includes("p")?Or(e,r):Fn(r)}var s=o();return typeof s!="function"&&V(`unknown function pointer with signature ${e}: ${r}`),s},Br=(e,r)=>{var o=Ye(r,function(s){this.name=r,this.message=s;var c=new Error(s).stack;c!==void 0&&(this.stack=this.toString()+`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`,N.push(`${O}_dtor`))}return o&&(C+=`var ret = retType['fromWireType'](rv);
|
|
1
|
+
var no=Object.defineProperty;var ro=(r,t,o)=>t in r?no(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var Gt=(r,t,o)=>ro(r,typeof t!="symbol"?t+"":t,o);var Ht;(function(r){r[r.ByBlock=-2]="ByBlock",r[r.ByDIPs=-4]="ByDIPs",r[r.ByLayer=-1]="ByLayer",r[r.ByLineWeightDefault=-3]="ByLineWeightDefault",r[r.LineWeight000=0]="LineWeight000",r[r.LineWeight005=5]="LineWeight005",r[r.LineWeight009=9]="LineWeight009",r[r.LineWeight013=13]="LineWeight013",r[r.LineWeight015=15]="LineWeight015",r[r.LineWeight018=18]="LineWeight018",r[r.LineWeight020=20]="LineWeight020",r[r.LineWeight025=25]="LineWeight025",r[r.LineWeight030=30]="LineWeight030",r[r.LineWeight035=35]="LineWeight035",r[r.LineWeight040=40]="LineWeight040",r[r.LineWeight050=50]="LineWeight050",r[r.LineWeight053=53]="LineWeight053",r[r.LineWeight060=60]="LineWeight060",r[r.LineWeight070=70]="LineWeight070",r[r.LineWeight080=80]="LineWeight080",r[r.LineWeight090=90]="LineWeight090",r[r.LineWeight100=100]="LineWeight100",r[r.LineWeight106=106]="LineWeight106",r[r.LineWeight120=120]="LineWeight120",r[r.LineWeight140=140]="LineWeight140",r[r.LineWeight158=158]="LineWeight158",r[r.LineWeight200=200]="LineWeight200",r[r.LineWeight211=211]="LineWeight211"})(Ht||(Ht={}));var ao="DwgConverterLicenseError",oo=["evaluation of @mlightcad/dwg-converter has expired"],io=["invalid @mlightcad/dwg-converter license key"];function so(r){return r==="license_expired"||r==="license_invalid"}function Ar(r){var t=r.toLowerCase();if(oo.some(function(o){return t.includes(o)}))return"license_expired";if(io.some(function(o){return t.includes(o)}))return"license_invalid"}function _o(r){var t;return(t=Ar(r))!==null&&t!==void 0?t:"license_invalid"}var lo=function(r,t,o,n){function d(_){return _ instanceof o?_:new o(function(c){c(_)})}return new(o||(o=Promise))(function(_,c){function f(T){try{A(n.next(T))}catch(p){c(p)}}function h(T){try{A(n.throw(T))}catch(p){c(p)}}function A(T){T.done?_(T.value):d(T.value).then(f,h)}A((n=n.apply(r,t||[])).next())})},co=function(r,t){var o={label:0,sent:function(){if(_[0]&1)throw _[1];return _[1]},trys:[],ops:[]},n,d,_,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(A){return function(T){return h([A,T])}}function h(A){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,A[0]&&(o=0)),o;)try{if(n=1,d&&(_=A[0]&2?d.return:A[0]?d.throw||((_=d.return)&&_.call(d),0):d.next)&&!(_=_.call(d,A[1])).done)return _;switch(d=0,_&&(A=[A[0]&2,_.value]),A[0]){case 0:case 1:_=A;break;case 4:return o.label++,{value:A[1],done:!1};case 5:o.label++,d=A[1],A=[0];continue;case 7:A=o.ops.pop(),o.trys.pop();continue;default:if(_=o.trys,!(_=_.length>0&&_[_.length-1])&&(A[0]===6||A[0]===2)){o=0;continue}if(A[0]===3&&(!_||A[1]>_[0]&&A[1]<_[3])){o.label=A[1];break}if(A[0]===6&&o.label<_[1]){o.label=_[1],_=A;break}if(_&&o.label<_[2]){o.label=_[2],o.ops.push(A);break}_[2]&&o.ops.pop(),o.trys.pop();continue}A=t.call(r,o)}catch(T){A=[6,T],d=0}finally{n=_=0}if(A[0]&5)throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}},uo=["out of memory","data cannot be cloned","allocation failed","memory access out of bounds"];function Eo(r){var t=r.toLowerCase();return uo.some(function(o){return t.includes(o)})}function vn(){var r=globalThis;if(typeof r.postMessage!="function")throw new Error("Worker messaging is not available in this runtime");return r}var fo=(function(){function r(){this.setupMessageHandler()}return r.prototype.setupMessageHandler=function(){var t=this;vn().onmessage=function(o){return lo(t,void 0,void 0,function(){var n,d,_,c,f,h,A;return co(this,function(T){switch(T.label){case 0:n=o,d=n.data,_=d.id,c=d.input,T.label=1;case 1:return T.trys.push([1,3,,4]),[4,this.executeTask(c)];case 2:return f=T.sent(),this.sendResponse(_,!0,f),[3,4];case 3:return h=T.sent(),A=h instanceof Error?h.message:String(h),this.sendResponse(_,!1,void 0,A,this.classifyTaskError(h,A)),[3,4];case 4:return[2]}})})}},r.prototype.sendResponse=function(t,o,n,d,_){var c={id:t,success:o,data:n,error:d,errorCode:_};try{vn().postMessage(c)}catch(h){var f=h instanceof Error?h.message:String(h);vn().postMessage({id:t,success:!1,error:f,errorCode:this.classifyPostMessageError(f)})}},r.prototype.classifyTaskError=function(t,o){if(t instanceof Error){var n=t.code;if(so(n))return n;if(t.name===ao)return _o(o)}var d=Ar(o);return d||this.classifyPostMessageError(o)},r.prototype.classifyPostMessageError=function(t){return Eo(t)?"worker_oom":t.toLowerCase().includes("timed out")?"worker_timeout":"worker_error"},r})();const ho="modulepreload",go=function(r,t){return new URL(r,t).href},ir={},Ao=function(t,o,n){let d=Promise.resolve();if(o&&o.length>0){let c=function(T){return Promise.all(T.map(p=>Promise.resolve(p).then(I=>({status:"fulfilled",value:I}),I=>({status:"rejected",reason:I}))))};const f=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),A=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));d=c(o.map(T=>{if(T=go(T,n),T in ir)return;ir[T]=!0;const p=T.endsWith(".css"),I=p?'[rel="stylesheet"]':"";if(!!n)for(let w=f.length-1;w>=0;w--){const m=f[w];if(m.href===T&&(!p||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${T}"]${I}`))return;const C=document.createElement("link");if(C.rel=p?"stylesheet":ho,p||(C.as="script"),C.crossOrigin="",C.href=T,A&&C.setAttribute("nonce",A),document.head.appendChild(C),p)return new Promise((w,m)=>{C.addEventListener("load",w),C.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${T}`)))})}))}function _(c){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=c,window.dispatchEvent(f),!f.defaultPrevented)throw c}return d.then(c=>{for(const f of c||[])f.status==="rejected"&&_(f.reason);return t().catch(_)})};async function sr(r={}){var er,nr,rr;var t,o=r,n=!!globalThis.window,d=!!globalThis.WorkerGlobalScope,_=((nr=(er=globalThis.process)==null?void 0:er.versions)==null?void 0:nr.node)&&((rr=globalThis.process)==null?void 0:rr.type)!="renderer";if(_){const{createRequire:e}=await Ao(()=>Promise.resolve().then(()=>jo),void 0,import.meta.url);var c=e(import.meta.url)}var f="./this.program",h=import.meta.url,A="";function T(e){return o.locateFile?o.locateFile(e,A):A+e}var p,I;if(_){var v=c("node:fs");h.startsWith("file:")&&(A=c("node:path").dirname(c("node:url").fileURLToPath(h))+"/"),I=e=>{e=N(e)?new URL(e):e;var a=v.readFileSync(e);return a},p=async(e,a=!0)=>{e=N(e)?new URL(e):e;var i=v.readFileSync(e,a?void 0:"utf8");return i},process.argv.length>1&&(f=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2)}else if(n||d){try{A=new URL(".",h).href}catch{}d&&(I=e=>{var a=new XMLHttpRequest;return a.open("GET",e,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),p=async e=>{if(N(e))return new Promise((i,s)=>{var u=new XMLHttpRequest;u.open("GET",e,!0),u.responseType="arraybuffer",u.onload=()=>{if(u.status==200||u.status==0&&u.response){i(u.response);return}s(u.status)},u.onerror=s,u.send(null)});var a=await fetch(e,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw new Error(a.status+" : "+a.url)}}var C=(()=>{}).bind(console),w=(()=>{}).bind(console),m,S=!1,N=e=>e.startsWith("file://"),W,M,k=!1;function U(){var e=_n.buffer;z=new Int8Array(e),dt=new Int16Array(e),lt=new Uint8Array(e),Tt=new Uint16Array(e),O=new Int32Array(e),B=new Uint32Array(e),Ot=new Float32Array(e),Bt=new Float64Array(e),tt=new BigInt64Array(e),Xt=new BigUint64Array(e)}function J(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Ft(o.preRun.shift());St(zt)}function nt(){k=!0,!o.noFSInit&&!l.initialized&&l.init(),he.__wasm_call_ctors(),l.ignorePermissions=!1}function ft(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)se(o.postRun.shift());St(Kt)}function Z(e){var i;(i=o.onAbort)==null||i.call(o,e),e=`Aborted(${e})`,w(e),S=!0,e+=". Build with -sASSERTIONS for more info.";var a=new WebAssembly.RuntimeError(e);throw M==null||M(a),a}var ut;function Et(){return o.locateFile?T("libredwg-web.wasm"):new URL(""+new URL("libredwg-web.wasm",import.meta.url).href,import.meta.url).href}function ht(e){if(e==ut&&m)return new Uint8Array(m);if(I)return I(e);throw"both async and sync fetching of the wasm failed"}async function gt(e){if(!m)try{var a=await p(e);return new Uint8Array(a)}catch{}return ht(e)}async function Mt(e,a){try{var i=await gt(e),s=await WebAssembly.instantiate(i,a);return s}catch(u){w(`failed to asynchronously prepare wasm: ${u}`),Z(u)}}async function bt(e,a,i){if(!e&&!N(a)&&!_)try{var s=fetch(a,{credentials:"same-origin"}),u=await WebAssembly.instantiateStreaming(s,i);return u}catch(E){w(`wasm streaming compile failed: ${E}`),w("falling back to ArrayBuffer instantiation")}return Mt(a,i)}function xt(){var e={env:tr,wasi_snapshot_preview1:tr};return e}async function kt(){function e(E,g){return he=E.exports,he=eo(he),to(he),U(),he}function a(E){return e(E.instance)}var i=xt();if(o.instantiateWasm)return new Promise((E,g)=>{o.instantiateWasm(i,(y,P)=>{E(e(y))})});ut??(ut=Et());var s=await bt(m,ut,i),u=a(s);return u}var dt,O,tt,z,Ot,Bt,Tt,B,Xt,lt,St=e=>{for(;e.length>0;)e.shift()(o)},Kt=[],se=e=>Kt.push(e),zt=[],Ft=e=>zt.push(e);function q(e,a,i="i8"){switch(i.endsWith("*")&&(i="*"),i){case"i1":z[e>>>0]=a;break;case"i8":z[e>>>0]=a;break;case"i16":dt[e>>>1>>>0]=a;break;case"i32":O[e>>>2>>>0]=a;break;case"i64":tt[e>>>3>>>0]=BigInt(a);break;case"float":Ot[e>>>2>>>0]=a;break;case"double":Bt[e>>>3>>>0]=a;break;case"*":B[e>>>2>>>0]=a;break;default:Z(`invalid type for setValue: ${i}`)}}var V=e=>Zn(e),Jt=()=>Qn();class Te{constructor(a){this.excPtr=a,this.ptr=a-24}set_type(a){B[this.ptr+4>>>2>>>0]=a}get_type(){return B[this.ptr+4>>>2>>>0]}set_destructor(a){B[this.ptr+8>>>2>>>0]=a}get_destructor(){return B[this.ptr+8>>>2>>>0]}set_caught(a){a=a?1:0,z[this.ptr+12>>>0]=a}get_caught(){return z[this.ptr+12>>>0]!=0}set_rethrown(a){a=a?1:0,z[this.ptr+13>>>0]=a}get_rethrown(){return z[this.ptr+13>>>0]!=0}init(a,i){this.set_adjusted_ptr(0),this.set_type(a),this.set_destructor(i)}set_adjusted_ptr(a){B[this.ptr+16>>>2>>>0]=a}get_adjusted_ptr(){return B[this.ptr+16>>>2>>>0]}}var Ut=9007199254740992,Ye=-9007199254740992,ye=e=>e<Ye||e>Ut?NaN:Number(e);function Ne(e,a,i){e>>>=0,a>>>=0,i>>>=0;var s=new Te(e);s.init(a,i),Z()}var Zt=()=>{var e=O[+Q.varargs>>>2>>>0];return Q.varargs+=4,e},Lt=Zt,X={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var a=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return a.exec(e).slice(1)},normalizeArray:(e,a)=>{for(var i=0,s=e.length-1;s>=0;s--){var u=e[s];u==="."?e.splice(s,1):u===".."?(e.splice(s,1),i++):i&&(e.splice(s,1),i--)}if(a)for(;i;i--)e.unshift("..");return e},normalize:e=>{var a=X.isAbs(e),i=e.slice(-1)==="/";return e=X.normalizeArray(e.split("/").filter(s=>!!s),!a).join("/"),!e&&!a&&(e="."),e&&i&&(e+="/"),(a?"/":"")+e},dirname:e=>{var a=X.splitPath(e),i=a[0],s=a[1];return!i&&!s?".":(s&&(s=s.slice(0,-1)),i+s)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>X.normalize(e.join("/")),join2:(e,a)=>X.normalize(e+"/"+a)},We=()=>{if(_){var e=c("node:crypto");return a=>e.randomFillSync(a)}return a=>(crypto.getRandomValues(a),0)},qt=e=>(qt=We())(e),Dt={resolve:(...e)=>{for(var a="",i=!1,s=e.length-1;s>=-1&&!i;s--){var u=s>=0?e[s]:l.cwd();if(typeof u!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!u)return"";a=u+"/"+a,i=X.isAbs(u)}return a=X.normalizeArray(a.split("/").filter(E=>!!E),!i).join("/"),(i?"/":"")+a||"."},relative:(e,a)=>{e=Dt.resolve(e).slice(1),a=Dt.resolve(a).slice(1);function i(D){for(var R=0;R<D.length&&D[R]==="";R++);for(var G=D.length-1;G>=0&&D[G]==="";G--);return R>G?[]:D.slice(R,G-R+1)}for(var s=i(e.split("/")),u=i(a.split("/")),E=Math.min(s.length,u.length),g=E,y=0;y<E;y++)if(s[y]!==u[y]){g=y;break}for(var P=[],y=g;y<s.length;y++)P.push("..");return P=P.concat(u.slice(g)),P.join("/")}},Pe=globalThis.TextDecoder&&new TextDecoder,pe=(e,a,i,s)=>{var u=a+i;if(s)return u;for(;e[a]&&!(a>=u);)++a;return a},Yt=(e,a=0,i,s)=>{a>>>=0;var u=pe(e,a,i,s);if(u-a>16&&e.buffer&&Pe)return Pe.decode(e.subarray(a,u));for(var E="";a<u;){var g=e[a++];if(!(g&128)){E+=String.fromCharCode(g);continue}var y=e[a++]&63;if((g&224)==192){E+=String.fromCharCode((g&31)<<6|y);continue}var P=e[a++]&63;if((g&240)==224?g=(g&15)<<12|y<<6|P:g=(g&7)<<18|y<<12|P<<6|e[a++]&63,g<65536)E+=String.fromCharCode(g);else{var D=g-65536;E+=String.fromCharCode(55296|D>>10,56320|D&1023)}}return E},_e=[],Nt=e=>{for(var a=0,i=0;i<e.length;++i){var s=e.charCodeAt(i);s<=127?a++:s<=2047?a+=2:s>=55296&&s<=57343?(a+=4,++i):a+=3}return a},de=(e,a,i,s)=>{if(i>>>=0,!(s>0))return 0;for(var u=i,E=i+s-1,g=0;g<e.length;++g){var y=e.codePointAt(g);if(y<=127){if(i>=E)break;a[i++>>>0]=y}else if(y<=2047){if(i+1>=E)break;a[i++>>>0]=192|y>>6,a[i++>>>0]=128|y&63}else if(y<=65535){if(i+2>=E)break;a[i++>>>0]=224|y>>12,a[i++>>>0]=128|y>>6&63,a[i++>>>0]=128|y&63}else{if(i+3>=E)break;a[i++>>>0]=240|y>>18,a[i++>>>0]=128|y>>12&63,a[i++>>>0]=128|y>>6&63,a[i++>>>0]=128|y&63,g++}}return a[i>>>0]=0,i-u},Qt=(e,a,i)=>{var s=Nt(e)+1,u=new Array(s),E=de(e,u,0,u.length);return u.length=E,u},Ie=()=>{var E;if(!_e.length){var e=null;if(_){var a=256,i=Buffer.alloc(a),s=0,u=process.stdin.fd;try{s=v.readSync(u,i,0,a)}catch(g){if(g.toString().includes("EOF"))s=0;else throw g}s>0&&(e=i.slice(0,s).toString("utf-8"))}else(E=globalThis.window)!=null&&E.prompt&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
|
+
`));if(!e)return null;_e=Qt(e)}return _e.shift()},yt={ttys:[],init(){},shutdown(){},register(e,a){yt.ttys[e]={input:[],output:[],ops:a},l.registerDevice(e,yt.stream_ops)},stream_ops:{open(e){var a=yt.ttys[e.node.rdev];if(!a)throw new l.ErrnoError(43);e.tty=a,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,a,i,s,u){if(!e.tty||!e.tty.ops.get_char)throw new l.ErrnoError(60);for(var E=0,g=0;g<s;g++){var y;try{y=e.tty.ops.get_char(e.tty)}catch{throw new l.ErrnoError(29)}if(y===void 0&&E===0)throw new l.ErrnoError(6);if(y==null)break;E++,a[i+g]=y}return E&&(e.node.atime=Date.now()),E},write(e,a,i,s,u){if(!e.tty||!e.tty.ops.put_char)throw new l.ErrnoError(60);try{for(var E=0;E<s;E++)e.tty.ops.put_char(e.tty,a[i+E])}catch{throw new l.ErrnoError(29)}return s&&(e.node.mtime=e.node.ctime=Date.now()),E}},default_tty_ops:{get_char(e){return Ie()},put_char(e,a){a===null||a===10?(C(Yt(e.output)),e.output=[]):a!=0&&e.output.push(a)},fsync(e){var a;((a=e.output)==null?void 0:a.length)>0&&(C(Yt(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,a,i){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,a){a===null||a===10?(w(Yt(e.output)),e.output=[]):a!=0&&e.output.push(a)},fsync(e){var a;((a=e.output)==null?void 0:a.length)>0&&(w(Yt(e.output)),e.output=[])}}},le=e=>{Z()},x={ops_table:null,mount(e){return x.createNode(null,"/",16895,0)},createNode(e,a,i,s){if(l.isBlkdev(i)||l.isFIFO(i))throw new l.ErrnoError(63);x.ops_table||(x.ops_table={dir:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr,lookup:x.node_ops.lookup,mknod:x.node_ops.mknod,rename:x.node_ops.rename,unlink:x.node_ops.unlink,rmdir:x.node_ops.rmdir,readdir:x.node_ops.readdir,symlink:x.node_ops.symlink},stream:{llseek:x.stream_ops.llseek}},file:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr},stream:{llseek:x.stream_ops.llseek,read:x.stream_ops.read,write:x.stream_ops.write,mmap:x.stream_ops.mmap,msync:x.stream_ops.msync}},link:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr,readlink:x.node_ops.readlink},stream:{}},chrdev:{node:{getattr:x.node_ops.getattr,setattr:x.node_ops.setattr},stream:l.chrdev_stream_ops}});var u=l.createNode(e,a,i,s);return l.isDir(u.mode)?(u.node_ops=x.ops_table.dir.node,u.stream_ops=x.ops_table.dir.stream,u.contents={}):l.isFile(u.mode)?(u.node_ops=x.ops_table.file.node,u.stream_ops=x.ops_table.file.stream,u.usedBytes=0,u.contents=x.emptyFileContents??(x.emptyFileContents=new Uint8Array(0))):l.isLink(u.mode)?(u.node_ops=x.ops_table.link.node,u.stream_ops=x.ops_table.link.stream):l.isChrdev(u.mode)&&(u.node_ops=x.ops_table.chrdev.node,u.stream_ops=x.ops_table.chrdev.stream),u.atime=u.mtime=u.ctime=Date.now(),e&&(e.contents[a]=u,e.atime=e.mtime=e.ctime=u.atime),u},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,a){var i=e.contents.length;if(!(i>=a)){var s=1024*1024;a=Math.max(a,i*(i<s?2:1.125)>>>0),i&&(a=Math.max(a,256));var u=x.getFileDataAsTypedArray(e);e.contents=new Uint8Array(a),e.contents.set(u)}},resizeFileStorage(e,a){if(e.usedBytes!=a){var i=e.contents;e.contents=new Uint8Array(a),e.contents.set(i.subarray(0,Math.min(a,e.usedBytes))),e.usedBytes=a}},node_ops:{getattr(e){var a={};return a.dev=l.isChrdev(e.mode)?e.id:1,a.ino=e.id,a.mode=e.mode,a.nlink=1,a.uid=0,a.gid=0,a.rdev=e.rdev,l.isDir(e.mode)?a.size=4096:l.isFile(e.mode)?a.size=e.usedBytes:l.isLink(e.mode)?a.size=e.link.length:a.size=0,a.atime=new Date(e.atime),a.mtime=new Date(e.mtime),a.ctime=new Date(e.ctime),a.blksize=4096,a.blocks=Math.ceil(a.size/a.blksize),a},setattr(e,a){for(const i of["mode","atime","mtime","ctime"])a[i]!=null&&(e[i]=a[i]);a.size!==void 0&&x.resizeFileStorage(e,a.size)},lookup(e,a){throw x.doesNotExistError||(x.doesNotExistError=new l.ErrnoError(44),x.doesNotExistError.stack="<generic error, no stack>"),x.doesNotExistError},mknod(e,a,i,s){return x.createNode(e,a,i,s)},rename(e,a,i){var s;try{s=l.lookupNode(a,i)}catch{}if(s){if(l.isDir(e.mode))for(var u in s.contents)throw new l.ErrnoError(55);l.hashRemoveNode(s)}delete e.parent.contents[e.name],a.contents[i]=e,e.name=i,a.ctime=a.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,a){delete e.contents[a],e.ctime=e.mtime=Date.now()},rmdir(e,a){var i=l.lookupNode(e,a);for(var s in i.contents)throw new l.ErrnoError(55);delete e.contents[a],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,a,i){var s=x.createNode(e,a,41471,0);return s.link=i,s},readlink(e){if(!l.isLink(e.mode))throw new l.ErrnoError(28);return e.link}},stream_ops:{read(e,a,i,s,u){var E=e.node.contents;if(u>=e.node.usedBytes)return 0;var g=Math.min(e.node.usedBytes-u,s);return a.set(E.subarray(u,u+g),i),g},write(e,a,i,s,u,E){if(a.buffer===z.buffer&&(E=!1),!s)return 0;var g=e.node;return g.mtime=g.ctime=Date.now(),E?(g.contents=a.subarray(i,i+s),g.usedBytes=s):g.usedBytes===0&&u===0?(g.contents=a.slice(i,i+s),g.usedBytes=s):(x.expandFileStorage(g,u+s),g.contents.set(a.subarray(i,i+s),u),g.usedBytes=Math.max(g.usedBytes,u+s)),s},llseek(e,a,i){var s=a;if(i===1?s+=e.position:i===2&&l.isFile(e.node.mode)&&(s+=e.node.usedBytes),s<0)throw new l.ErrnoError(28);return s},mmap(e,a,i,s,u){if(!l.isFile(e.node.mode))throw new l.ErrnoError(43);var E,g,y=e.node.contents;if(!(u&2)&&y.buffer===z.buffer)g=!1,E=y.byteOffset;else{if(g=!0,E=le(),!E)throw new l.ErrnoError(48);y&&((i>0||i+a<y.length)&&(y.subarray?y=y.subarray(i,i+a):y=Array.prototype.slice.call(y,i,i+a)),z.set(y,E>>>0))}return{ptr:E,allocated:g}},msync(e,a,i,s,u){return x.stream_ops.write(e,a,0,s,i,!1),0}}},ve=e=>{if(typeof e!="string")return e;var a={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},i=a[e];if(typeof i>"u")throw new Error(`Unknown file open mode: ${e}`);return i},ce=e=>(typeof e=="string"&&(e=Qt(e)),e.subarray||(e=new Uint8Array(e)),e),jt=(e,a)=>{var i=0;return e&&(i|=365),a&&(i|=146),i},me=async e=>{var a=await p(e);return new Uint8Array(a)},we=(...e)=>l.createDataFile(...e),Pt=0,Wt=null,Ce=e=>{var i;if(Pt--,(i=o.monitorRunDependencies)==null||i.call(o,Pt),Pt==0&&Wt){var a=Wt;Wt=null,a()}},De=e=>{var a;Pt++,(a=o.monitorRunDependencies)==null||a.call(o,Pt)},ue=[],Re=async(e,a)=>{typeof Browser<"u"&&Browser.init();for(var i of ue)if(i.canHandle(a))return i.handle(e,a);return e},Ee=async(e,a,i,s,u,E,g,y)=>{var P=a?Dt.resolve(X.join2(e,a)):e;De();try{var D=i;typeof i=="string"&&(D=await me(i)),D=await Re(D,P),y==null||y(),E||we(e,a,D,s,u,g)}finally{Ce()}},Xe=(e,a,i,s,u,E,g,y,P,D)=>{Ee(e,a,i,s,u,y,P,D).then(E).catch(g)},l={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{constructor(e){Gt(this,"name","ErrnoError");this.errno=e}},FSStream:class{constructor(){Gt(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,a,i,s){Gt(this,"node_ops",{});Gt(this,"stream_ops",{});Gt(this,"readMode",365);Gt(this,"writeMode",146);Gt(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=l.nextInode++,this.name=a,this.mode=i,this.rdev=s,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return l.isDir(this.mode)}get isDevice(){return l.isChrdev(this.mode)}},lookupPath(e,a={}){if(!e)throw new l.ErrnoError(44);a.follow_mount??(a.follow_mount=!0),X.isAbs(e)||(e=l.cwd()+"/"+e);t:for(var i=0;i<40;i++){for(var s=e.split("/").filter(D=>!!D),u=l.root,E="/",g=0;g<s.length;g++){var y=g===s.length-1;if(y&&a.parent)break;if(s[g]!=="."){if(s[g]===".."){if(E=X.dirname(E),l.isRoot(u)){e=E+"/"+s.slice(g+1).join("/"),i--;continue t}else u=u.parent;continue}E=X.join2(E,s[g]);try{u=l.lookupNode(u,s[g])}catch(D){if((D==null?void 0:D.errno)===44&&y&&a.noent_okay)return{path:E};throw D}if(l.isMountpoint(u)&&(!y||a.follow_mount)&&(u=u.mounted.root),l.isLink(u.mode)&&(!y||a.follow)){if(!u.node_ops.readlink)throw new l.ErrnoError(52);var P=u.node_ops.readlink(u);X.isAbs(P)||(P=X.dirname(E)+"/"+P),e=P+"/"+s.slice(g+1).join("/");continue t}}}return{path:E,node:u}}throw new l.ErrnoError(32)},getPath(e){for(var a;;){if(l.isRoot(e)){var i=e.mount.mountpoint;return a?i[i.length-1]!=="/"?`${i}/${a}`:i+a:i}a=a?`${e.name}/${a}`:e.name,e=e.parent}},hashName(e,a){for(var i=0,s=0;s<a.length;s++)i=(i<<5)-i+a.charCodeAt(s)|0;return(e+i>>>0)%l.nameTable.length},hashAddNode(e){var a=l.hashName(e.parent.id,e.name);e.name_next=l.nameTable[a],l.nameTable[a]=e},hashRemoveNode(e){var a=l.hashName(e.parent.id,e.name);if(l.nameTable[a]===e)l.nameTable[a]=e.name_next;else for(var i=l.nameTable[a];i;){if(i.name_next===e){i.name_next=e.name_next;break}i=i.name_next}},lookupNode(e,a){var i=l.mayLookup(e);if(i)throw new l.ErrnoError(i);for(var s=l.hashName(e.id,a),u=l.nameTable[s];u;u=u.name_next){var E=u.name;if(u.parent.id===e.id&&E===a)return u}return l.lookup(e,a)},createNode(e,a,i,s){var u=new l.FSNode(e,a,i,s);return l.hashAddNode(u),u},destroyNode(e){l.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var a=["r","w","rw"][e&3];return e&512&&(a+="w"),a},nodePermissions(e,a){return l.ignorePermissions?0:a.includes("r")&&!(e.mode&292)||a.includes("w")&&!(e.mode&146)||a.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!l.isDir(e.mode))return 54;var a=l.nodePermissions(e,"x");return a||(e.node_ops.lookup?0:2)},mayCreate(e,a){if(!l.isDir(e.mode))return 54;try{var i=l.lookupNode(e,a);return 20}catch{}return l.nodePermissions(e,"wx")},mayDelete(e,a,i){var s;try{s=l.lookupNode(e,a)}catch(E){return E.errno}var u=l.nodePermissions(e,"wx");if(u)return u;if(i){if(!l.isDir(s.mode))return 54;if(l.isRoot(s)||l.getPath(s)===l.cwd())return 10}else if(l.isDir(s.mode))return 31;return 0},mayOpen(e,a){if(!e)return 44;if(l.isLink(e.mode))return 32;var i=l.flagsToPermissionString(a);return l.isDir(e.mode)&&(i!=="r"||a&576)?31:l.nodePermissions(e,i)},checkOpExists(e,a){if(!e)throw new l.ErrnoError(a);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=l.MAX_OPEN_FDS;e++)if(!l.streams[e])return e;throw new l.ErrnoError(33)},getStreamChecked(e){var a=l.getStream(e);if(!a)throw new l.ErrnoError(8);return a},getStream:e=>l.streams[e],createStream(e,a=-1){return e=Object.assign(new l.FSStream,e),a==-1&&(a=l.nextfd()),e.fd=a,l.streams[a]=e,e},closeStream(e){l.streams[e]=null},dupStream(e,a=-1){var s,u;var i=l.createStream(e,a);return(u=(s=i.stream_ops)==null?void 0:s.dup)==null||u.call(s,i),i},doSetAttr(e,a,i){var s=e==null?void 0:e.stream_ops.setattr,u=s?e:a;s??(s=a.node_ops.setattr),l.checkOpExists(s,63);try{s(u,i)}catch(E){throw E instanceof RangeError?new l.ErrnoError(22):E}},chrdev_stream_ops:{open(e){var i,s;var a=l.getDevice(e.node.rdev);e.stream_ops=a.stream_ops,(s=(i=e.stream_ops).open)==null||s.call(i,e)},llseek(){throw new l.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,a)=>e<<8|a,registerDevice(e,a){l.devices[e]={stream_ops:a}},getDevice:e=>l.devices[e],getMounts(e){for(var a=[],i=[e];i.length;){var s=i.pop();a.push(s),i.push(...s.mounts)}return a},syncfs(e,a){typeof e=="function"&&(a=e,e=!1),l.syncFSRequests++,l.syncFSRequests>1&&w(`warning: ${l.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var i=l.getMounts(l.root.mount),s=0;function u(y){return l.syncFSRequests--,a(y)}function E(y){if(y)return E.errored?void 0:(E.errored=!0,u(y));++s>=i.length&&u(null)}for(var g of i)g.type.syncfs?g.type.syncfs(g,e,E):E(null)},mount(e,a,i){var s=i==="/",u=!i,E;if(s&&l.root)throw new l.ErrnoError(10);if(!s&&!u){var g=l.lookupPath(i,{follow_mount:!1});if(i=g.path,E=g.node,l.isMountpoint(E))throw new l.ErrnoError(10);if(!l.isDir(E.mode))throw new l.ErrnoError(54)}var y={type:e,opts:a,mountpoint:i,mounts:[]},P=e.mount(y);return P.mount=y,y.root=P,s?l.root=P:E&&(E.mounted=y,E.mount&&E.mount.mounts.push(y)),P},unmount(e){var a=l.lookupPath(e,{follow_mount:!1});if(!l.isMountpoint(a.node))throw new l.ErrnoError(28);var i=a.node,s=i.mounted,u=l.getMounts(s);for(var[E,g]of Object.entries(l.nameTable))for(;g;){var y=g.name_next;u.includes(g.mount)&&l.destroyNode(g),g=y}i.mounted=null;var P=i.mount.mounts.indexOf(s);i.mount.mounts.splice(P,1)},lookup(e,a){return e.node_ops.lookup(e,a)},mknod(e,a,i){var s=l.lookupPath(e,{parent:!0}),u=s.node,E=X.basename(e);if(!E)throw new l.ErrnoError(28);if(E==="."||E==="..")throw new l.ErrnoError(20);var g=l.mayCreate(u,E);if(g)throw new l.ErrnoError(g);if(!u.node_ops.mknod)throw new l.ErrnoError(63);return u.node_ops.mknod(u,E,a,i)},statfs(e){return l.statfsNode(l.lookupPath(e,{follow:!0}).node)},statfsStream(e){return l.statfsNode(e.node)},statfsNode(e){var a={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:l.nextInode,ffree:l.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(a,e.node_ops.statfs(e.mount.opts.root)),a},create(e,a=438){return a&=4095,a|=32768,l.mknod(e,a,0)},mkdir(e,a=511){return a&=1023,a|=16384,l.mknod(e,a,0)},mkdirTree(e,a){var i=e.split("/"),s="";for(var u of i)if(u){(s||X.isAbs(e))&&(s+="/"),s+=u;try{l.mkdir(s,a)}catch(E){if(E.errno!=20)throw E}}},mkdev(e,a,i){return typeof i>"u"&&(i=a,a=438),a|=8192,l.mknod(e,a,i)},symlink(e,a){if(!Dt.resolve(e))throw new l.ErrnoError(44);var i=l.lookupPath(a,{parent:!0}),s=i.node;if(!s)throw new l.ErrnoError(44);var u=X.basename(a),E=l.mayCreate(s,u);if(E)throw new l.ErrnoError(E);if(!s.node_ops.symlink)throw new l.ErrnoError(63);return s.node_ops.symlink(s,u,e)},rename(e,a){var i=X.dirname(e),s=X.dirname(a),u=X.basename(e),E=X.basename(a),g,y,P;if(g=l.lookupPath(e,{parent:!0}),y=g.node,g=l.lookupPath(a,{parent:!0}),P=g.node,!y||!P)throw new l.ErrnoError(44);if(y.mount!==P.mount)throw new l.ErrnoError(75);var D=l.lookupNode(y,u),R=Dt.relative(e,s);if(R.charAt(0)!==".")throw new l.ErrnoError(28);if(R=Dt.relative(a,i),R.charAt(0)!==".")throw new l.ErrnoError(55);var G;try{G=l.lookupNode(P,E)}catch{}if(D!==G){var b=l.isDir(D.mode),Y=l.mayDelete(y,u,b);if(Y)throw new l.ErrnoError(Y);if(Y=G?l.mayDelete(P,E,b):l.mayCreate(P,E),Y)throw new l.ErrnoError(Y);if(!y.node_ops.rename)throw new l.ErrnoError(63);if(l.isMountpoint(D)||G&&l.isMountpoint(G))throw new l.ErrnoError(10);if(P!==y&&(Y=l.nodePermissions(y,"w"),Y))throw new l.ErrnoError(Y);l.hashRemoveNode(D);try{y.node_ops.rename(D,P,E),D.parent=P}catch(F){throw F}finally{l.hashAddNode(D)}}},rmdir(e){var a=l.lookupPath(e,{parent:!0}),i=a.node,s=X.basename(e),u=l.lookupNode(i,s),E=l.mayDelete(i,s,!0);if(E)throw new l.ErrnoError(E);if(!i.node_ops.rmdir)throw new l.ErrnoError(63);if(l.isMountpoint(u))throw new l.ErrnoError(10);i.node_ops.rmdir(i,s),l.destroyNode(u)},readdir(e){var a=l.lookupPath(e,{follow:!0}),i=a.node,s=l.checkOpExists(i.node_ops.readdir,54);return s(i)},unlink(e){var a=l.lookupPath(e,{parent:!0}),i=a.node;if(!i)throw new l.ErrnoError(44);var s=X.basename(e),u=l.lookupNode(i,s),E=l.mayDelete(i,s,!1);if(E)throw new l.ErrnoError(E);if(!i.node_ops.unlink)throw new l.ErrnoError(63);if(l.isMountpoint(u))throw new l.ErrnoError(10);i.node_ops.unlink(i,s),l.destroyNode(u)},readlink(e){var a=l.lookupPath(e),i=a.node;if(!i)throw new l.ErrnoError(44);if(!i.node_ops.readlink)throw new l.ErrnoError(28);return i.node_ops.readlink(i)},stat(e,a){var i=l.lookupPath(e,{follow:!a}),s=i.node,u=l.checkOpExists(s.node_ops.getattr,63);return u(s)},fstat(e){var a=l.getStreamChecked(e),i=a.node,s=a.stream_ops.getattr,u=s?a:i;return s??(s=i.node_ops.getattr),l.checkOpExists(s,63),s(u)},lstat(e){return l.stat(e,!0)},doChmod(e,a,i,s){l.doSetAttr(e,a,{mode:i&4095|a.mode&-4096,ctime:Date.now(),dontFollow:s})},chmod(e,a,i){var s;if(typeof e=="string"){var u=l.lookupPath(e,{follow:!i});s=u.node}else s=e;l.doChmod(null,s,a,i)},lchmod(e,a){l.chmod(e,a,!0)},fchmod(e,a){var i=l.getStreamChecked(e);l.doChmod(i,i.node,a,!1)},doChown(e,a,i){l.doSetAttr(e,a,{timestamp:Date.now(),dontFollow:i})},chown(e,a,i,s){var u;if(typeof e=="string"){var E=l.lookupPath(e,{follow:!s});u=E.node}else u=e;l.doChown(null,u,s)},lchown(e,a,i){l.chown(e,a,i,!0)},fchown(e,a,i){var s=l.getStreamChecked(e);l.doChown(s,s.node,!1)},doTruncate(e,a,i){if(l.isDir(a.mode))throw new l.ErrnoError(31);if(!l.isFile(a.mode))throw new l.ErrnoError(28);var s=l.nodePermissions(a,"w");if(s)throw new l.ErrnoError(s);l.doSetAttr(e,a,{size:i,timestamp:Date.now()})},truncate(e,a){if(a<0)throw new l.ErrnoError(28);var i;if(typeof e=="string"){var s=l.lookupPath(e,{follow:!0});i=s.node}else i=e;l.doTruncate(null,i,a)},ftruncate(e,a){var i=l.getStreamChecked(e);if(a<0||(i.flags&2097155)===0)throw new l.ErrnoError(28);l.doTruncate(i,i.node,a)},utime(e,a,i){var s=l.lookupPath(e,{follow:!0}),u=s.node,E=l.checkOpExists(u.node_ops.setattr,63);E(u,{atime:a,mtime:i})},open(e,a,i=438){if(e==="")throw new l.ErrnoError(44);a=ve(a),a&64?i=i&4095|32768:i=0;var s,u;if(typeof e=="object")s=e;else{u=e.endsWith("/");var E=l.lookupPath(e,{follow:!(a&131072),noent_okay:!0});s=E.node,e=E.path}var g=!1;if(a&64)if(s){if(a&128)throw new l.ErrnoError(20)}else{if(u)throw new l.ErrnoError(31);s=l.mknod(e,i|511,0),g=!0}if(!s)throw new l.ErrnoError(44);if(l.isChrdev(s.mode)&&(a&=-513),a&65536&&!l.isDir(s.mode))throw new l.ErrnoError(54);if(!g){var y=l.mayOpen(s,a);if(y)throw new l.ErrnoError(y)}a&512&&!g&&l.truncate(s,0),a&=-131713;var P=l.createStream({node:s,path:l.getPath(s),flags:a,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1});return P.stream_ops.open&&P.stream_ops.open(P),g&&l.chmod(s,i&511),P},close(e){if(l.isClosed(e))throw new l.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(a){throw a}finally{l.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,a,i){if(l.isClosed(e))throw new l.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new l.ErrnoError(70);if(i!=0&&i!=1&&i!=2)throw new l.ErrnoError(28);return e.position=e.stream_ops.llseek(e,a,i),e.ungotten=[],e.position},read(e,a,i,s,u){if(s<0||u<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===1)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.read)throw new l.ErrnoError(28);var E=typeof u<"u";if(!E)u=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var g=e.stream_ops.read(e,a,i,s,u);return E||(e.position+=g),g},write(e,a,i,s,u,E){if(s<0||u<0)throw new l.ErrnoError(28);if(l.isClosed(e))throw new l.ErrnoError(8);if((e.flags&2097155)===0)throw new l.ErrnoError(8);if(l.isDir(e.node.mode))throw new l.ErrnoError(31);if(!e.stream_ops.write)throw new l.ErrnoError(28);e.seekable&&e.flags&1024&&l.llseek(e,0,2);var g=typeof u<"u";if(!g)u=e.position;else if(!e.seekable)throw new l.ErrnoError(70);var y=e.stream_ops.write(e,a,i,s,u,E);return g||(e.position+=y),y},mmap(e,a,i,s,u){if((s&2)!==0&&(u&2)===0&&(e.flags&2097155)!==2)throw new l.ErrnoError(2);if((e.flags&2097155)===1)throw new l.ErrnoError(2);if(!e.stream_ops.mmap)throw new l.ErrnoError(43);if(!a)throw new l.ErrnoError(28);return e.stream_ops.mmap(e,a,i,s,u)},msync(e,a,i,s,u){return e.stream_ops.msync?e.stream_ops.msync(e,a,i,s,u):0},ioctl(e,a,i){if(!e.stream_ops.ioctl)throw new l.ErrnoError(59);return e.stream_ops.ioctl(e,a,i)},readFile(e,a={}){a.flags=a.flags??0,a.encoding=a.encoding??"binary",a.encoding!=="utf8"&&a.encoding!=="binary"&&Z(`Invalid encoding type "${a.encoding}"`);var i=l.open(e,a.flags),s=l.stat(e),u=s.size,E=new Uint8Array(u);return l.read(i,E,0,u,0),a.encoding==="utf8"&&(E=Yt(E)),l.close(i),E},writeFile(e,a,i={}){i.flags=i.flags??577;var s=l.open(e,i.flags,i.mode);a=ce(a),l.write(s,a,0,a.byteLength,void 0,i.canOwn),l.close(s)},cwd:()=>l.currentPath,chdir(e){var a=l.lookupPath(e,{follow:!0});if(a.node===null)throw new l.ErrnoError(44);if(!l.isDir(a.node.mode))throw new l.ErrnoError(54);var i=l.nodePermissions(a.node,"x");if(i)throw new l.ErrnoError(i);l.currentPath=a.path},createDefaultDirectories(){l.mkdir("/tmp"),l.mkdir("/home"),l.mkdir("/home/web_user")},createDefaultDevices(){l.mkdir("/dev"),l.registerDevice(l.makedev(1,3),{read:()=>0,write:(s,u,E,g,y)=>g,llseek:()=>0}),l.mkdev("/dev/null",l.makedev(1,3)),yt.register(l.makedev(5,0),yt.default_tty_ops),yt.register(l.makedev(6,0),yt.default_tty1_ops),l.mkdev("/dev/tty",l.makedev(5,0)),l.mkdev("/dev/tty1",l.makedev(6,0));var e=new Uint8Array(1024),a=0,i=()=>(a===0&&(qt(e),a=e.byteLength),e[--a]);l.createDevice("/dev","random",i),l.createDevice("/dev","urandom",i),l.mkdir("/dev/shm"),l.mkdir("/dev/shm/tmp")},createSpecialDirectories(){l.mkdir("/proc");var e=l.mkdir("/proc/self");l.mkdir("/proc/self/fd"),l.mount({mount(){var a=l.createNode(e,"fd",16895,73);return a.stream_ops={llseek:x.stream_ops.llseek},a.node_ops={lookup(i,s){var u=+s,E=l.getStreamChecked(u),g={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>E.path},id:u+1};return g.parent=g,g},readdir(){return Array.from(l.streams.entries()).filter(([i,s])=>s).map(([i,s])=>i.toString())}},a}},{},"/proc/self/fd")},createStandardStreams(e,a,i){e?l.createDevice("/dev","stdin",e):l.symlink("/dev/tty","/dev/stdin"),a?l.createDevice("/dev","stdout",null,a):l.symlink("/dev/tty","/dev/stdout"),i?l.createDevice("/dev","stderr",null,i):l.symlink("/dev/tty1","/dev/stderr"),l.open("/dev/stdin",0),l.open("/dev/stdout",1),l.open("/dev/stderr",1)},staticInit(){l.nameTable=new Array(4096),l.mount(x,{},"/"),l.createDefaultDirectories(),l.createDefaultDevices(),l.createSpecialDirectories(),l.filesystems={MEMFS:x}},init(e,a,i){l.initialized=!0,e??(e=o.stdin),a??(a=o.stdout),i??(i=o.stderr),l.createStandardStreams(e,a,i)},quit(){l.initialized=!1;for(var e of l.streams)e&&l.close(e)},findObject(e,a){var i=l.analyzePath(e,a);return i.exists?i.object:null},analyzePath(e,a){try{var i=l.lookupPath(e,{follow:!a});e=i.path}catch{}var s={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=l.lookupPath(e,{parent:!0});s.parentExists=!0,s.parentPath=i.path,s.parentObject=i.node,s.name=X.basename(e),i=l.lookupPath(e,{follow:!a}),s.exists=!0,s.path=i.path,s.object=i.node,s.name=i.node.name,s.isRoot=i.path==="/"}catch(u){s.error=u.errno}return s},createPath(e,a,i,s){e=typeof e=="string"?e:l.getPath(e);for(var u=a.split("/").reverse();u.length;){var E=u.pop();if(E){var g=X.join2(e,E);try{l.mkdir(g)}catch(y){if(y.errno!=20)throw y}e=g}}return g},createFile(e,a,i,s,u){var E=X.join2(typeof e=="string"?e:l.getPath(e),a),g=jt(s,u);return l.create(E,g)},createDataFile(e,a,i,s,u,E){var g=a;e&&(e=typeof e=="string"?e:l.getPath(e),g=a?X.join2(e,a):e);var y=jt(s,u),P=l.create(g,y);if(i){i=ce(i),l.chmod(P,y|146);var D=l.open(P,577);l.write(D,i,0,i.length,0,E),l.close(D),l.chmod(P,y)}},createDevice(e,a,i,s){var y;var u=X.join2(typeof e=="string"?e:l.getPath(e),a),E=jt(!!i,!!s);(y=l.createDevice).major??(y.major=64);var g=l.makedev(l.createDevice.major++,0);return l.registerDevice(g,{open(P){P.seekable=!1},close(P){var D;(D=s==null?void 0:s.buffer)!=null&&D.length&&s(10)},read(P,D,R,G,b){for(var Y=0,F=0;F<G;F++){var H;try{H=i()}catch{throw new l.ErrnoError(29)}if(H===void 0&&Y===0)throw new l.ErrnoError(6);if(H==null)break;Y++,D[R+F]=H}return Y&&(P.node.atime=Date.now()),Y},write(P,D,R,G,b){for(var Y=0;Y<G;Y++)try{s(D[R+Y])}catch{throw new l.ErrnoError(29)}return G&&(P.node.mtime=P.node.ctime=Date.now()),Y}}),l.mkdev(u,E,g)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)Z("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");else try{e.contents=I(e.url)}catch{throw new l.ErrnoError(29)}},createLazyFile(e,a,i,s,u){class E{constructor(){Gt(this,"lengthKnown",!1);Gt(this,"chunks",[])}get(b){if(!(b>this.length-1||b<0)){var Y=b%this.chunkSize,F=b/this.chunkSize|0;return this.getter(F)[Y]}}setDataGetter(b){this.getter=b}cacheLength(){var b=new XMLHttpRequest;b.open("HEAD",i,!1),b.send(null),b.status>=200&&b.status<300||b.status===304||Z("Couldn't load "+i+". Status: "+b.status);var Y=Number(b.getResponseHeader("Content-length")),F,H=(F=b.getResponseHeader("Accept-Ranges"))&&F==="bytes",rt=(F=b.getResponseHeader("Content-Encoding"))&&F==="gzip",at=1024*1024;H||(at=Y);var ct=(It,Vt)=>{It>Vt&&Z(`invalid range (${It}, ${Vt}) or no bytes requested!`),Vt>Y-1&&Z(`only ${Y} bytes available! programmer error!`);var it=new XMLHttpRequest;return it.open("GET",i,!1),Y!==at&&it.setRequestHeader("Range","bytes="+It+"-"+Vt),it.responseType="arraybuffer",it.overrideMimeType&&it.overrideMimeType("text/plain; charset=x-user-defined"),it.send(null),it.status>=200&&it.status<300||it.status===304||Z("Couldn't load "+i+". Status: "+it.status),it.response!==void 0?new Uint8Array(it.response||[]):Qt(it.responseText??"")},_t=this;_t.setDataGetter(It=>{var Vt=It*at,it=(It+1)*at-1;return it=Math.min(it,Y-1),typeof _t.chunks[It]>"u"&&(_t.chunks[It]=ct(Vt,it)),typeof _t.chunks[It]>"u"&&Z("doXHR failed!"),_t.chunks[It]}),(rt||!Y)&&(at=Y=1,Y=this.getter(0).length,at=Y,C("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=Y,this._chunkSize=at,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){d||Z("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var g=new E,y={isDevice:!1,contents:g}}else var y={isDevice:!1,url:i};var P=l.createFile(e,a,y,s,u);y.contents?P.contents=y.contents:y.url&&(P.contents=null,P.url=y.url),Object.defineProperties(P,{usedBytes:{get:function(){return this.contents.length}}});var D={};for(const[G,b]of Object.entries(P.stream_ops))D[G]=(...Y)=>(l.forceLoadFile(P),b(...Y));function R(G,b,Y,F,H){var rt=G.node.contents;if(H>=rt.length)return 0;var at=Math.min(rt.length-H,F);if(rt.slice)for(var ct=0;ct<at;ct++)b[Y+ct]=rt[H+ct];else for(var ct=0;ct<at;ct++)b[Y+ct]=rt.get(H+ct);return at}return D.read=(G,b,Y,F,H)=>(l.forceLoadFile(P),R(G,b,Y,F,H)),D.mmap=(G,b,Y,F,H)=>{l.forceLoadFile(P);var rt=le();if(!rt)throw new l.ErrnoError(48);return R(G,z,rt,b,Y),{ptr:rt,allocated:!0}},P.stream_ops=D,P}},te=(e,a,i)=>(e>>>=0,e?Yt(lt,e,a,i):""),Q={currentUmask:18,calculateAt(e,a,i){if(X.isAbs(a))return a;var s;if(e===-100)s=l.cwd();else{var u=Q.getStreamFromFD(e);s=u.path}if(a.length==0){if(!i)throw new l.ErrnoError(44);return s}return s+"/"+a},writeStat(e,a){B[e>>>2>>>0]=a.dev,B[e+4>>>2>>>0]=a.mode,B[e+8>>>2>>>0]=a.nlink,B[e+12>>>2>>>0]=a.uid,B[e+16>>>2>>>0]=a.gid,B[e+20>>>2>>>0]=a.rdev,tt[e+24>>>3>>>0]=BigInt(a.size),O[e+32>>>2>>>0]=4096,O[e+36>>>2>>>0]=a.blocks;var i=a.atime.getTime(),s=a.mtime.getTime(),u=a.ctime.getTime();return tt[e+40>>>3>>>0]=BigInt(Math.floor(i/1e3)),B[e+48>>>2>>>0]=i%1e3*1e3*1e3,tt[e+56>>>3>>>0]=BigInt(Math.floor(s/1e3)),B[e+64>>>2>>>0]=s%1e3*1e3*1e3,tt[e+72>>>3>>>0]=BigInt(Math.floor(u/1e3)),B[e+80>>>2>>>0]=u%1e3*1e3*1e3,tt[e+88>>>3>>>0]=BigInt(a.ino),0},writeStatFs(e,a){B[e+4>>>2>>>0]=a.bsize,B[e+60>>>2>>>0]=a.bsize,tt[e+8>>>3>>>0]=BigInt(a.blocks),tt[e+16>>>3>>>0]=BigInt(a.bfree),tt[e+24>>>3>>>0]=BigInt(a.bavail),tt[e+32>>>3>>>0]=BigInt(a.files),tt[e+40>>>3>>>0]=BigInt(a.ffree),B[e+48>>>2>>>0]=a.fsid,B[e+64>>>2>>>0]=a.flags,B[e+56>>>2>>>0]=a.namelen},doMsync(e,a,i,s,u){if(!l.isFile(a.node.mode))throw new l.ErrnoError(43);if(s&2)return 0;var E=lt.slice(e,e+i);l.msync(a,E,u,i,s)},getStreamFromFD(e){var a=l.getStreamChecked(e);return a},varargs:void 0,getStr(e){var a=te(e);return a}};function cn(e,a,i){i>>>=0,Q.varargs=i;try{var s=Q.getStreamFromFD(e);switch(a){case 0:{var u=Zt();if(u<0)return-28;for(;l.streams[u];)u++;var E;return E=l.dupStream(s,u),E.fd}case 1:case 2:return 0;case 3:return s.flags;case 4:{var u=Zt(),g=289792;return s.flags=s.flags&~g|u&g,0}case 12:{var u=Lt(),y=0;return dt[u+y>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(P){if(typeof l>"u"||P.name!=="ErrnoError")throw P;return-P.errno}}function un(e,a){a>>>=0;try{return Q.writeStat(a,l.fstat(e))}catch(i){if(typeof l>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function En(e,a,i){i>>>=0,Q.varargs=i;try{var s=Q.getStreamFromFD(e);switch(a){case 21509:return s.tty?0:-59;case 21505:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcgets){var u=s.tty.ops.ioctl_tcgets(s),E=Lt();O[E>>>2>>>0]=u.c_iflag||0,O[E+4>>>2>>>0]=u.c_oflag||0,O[E+8>>>2>>>0]=u.c_cflag||0,O[E+12>>>2>>>0]=u.c_lflag||0;for(var g=0;g<32;g++)z[E+g+17>>>0]=u.c_cc[g]||0;return 0}return 0}case 21510:case 21511:case 21512:return s.tty?0:-59;case 21506:case 21507:case 21508:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tcsets){for(var E=Lt(),y=O[E>>>2>>>0],P=O[E+4>>>2>>>0],D=O[E+8>>>2>>>0],R=O[E+12>>>2>>>0],G=[],g=0;g<32;g++)G.push(z[E+g+17>>>0]);return s.tty.ops.ioctl_tcsets(s.tty,a,{c_iflag:y,c_oflag:P,c_cflag:D,c_lflag:R,c_cc:G})}return 0}case 21519:{if(!s.tty)return-59;var E=Lt();return O[E>>>2>>>0]=0,0}case 21520:return s.tty?-28:-59;case 21537:case 21531:{var E=Lt();return l.ioctl(s,a,E)}case 21523:{if(!s.tty)return-59;if(s.tty.ops.ioctl_tiocgwinsz){var b=s.tty.ops.ioctl_tiocgwinsz(s.tty),E=Lt();dt[E>>>1>>>0]=b[0],dt[E+2>>>1>>>0]=b[1]}return 0}case 21524:return s.tty?0:-59;case 21515:return s.tty?0:-59;default:return-28}}catch(Y){if(typeof l>"u"||Y.name!=="ErrnoError")throw Y;return-Y.errno}}function Ke(e,a){e>>>=0,a>>>=0;try{return e=Q.getStr(e),Q.writeStat(a,l.lstat(e))}catch(i){if(typeof l>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Ge(e,a,i,s){a>>>=0,i>>>=0;try{a=Q.getStr(a);var u=s&256,E=s&4096;return s=s&-6401,a=Q.calculateAt(e,a,E),Q.writeStat(i,u?l.lstat(a):l.stat(a))}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function K(e,a,i,s){a>>>=0,s>>>=0,Q.varargs=s;try{a=Q.getStr(a),a=Q.calculateAt(e,a);var u=s?Zt():0;return i&64&&(u&=~Q.currentUmask),l.open(a,i,u).fd}catch(E){if(typeof l>"u"||E.name!=="ErrnoError")throw E;return-E.errno}}function j(e,a){e>>>=0,a>>>=0;try{return e=Q.getStr(e),Q.writeStat(a,l.stat(e))}catch(i){if(typeof l>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var ee=()=>Z(""),st=e=>{e>>>=0;for(var a="";;){var i=lt[e++>>>0];if(!i)return a;a+=String.fromCharCode(i)}},ne={},$t={},re={},Se=class extends Error{constructor(a){super(a),this.name="BindingError"}},$=e=>{throw new Se(e)};function ze(e,a,i={}){var s=a.name;if(e||$(`type "${s}" must have a positive integer typeid pointer`),$t.hasOwnProperty(e)){if(i.ignoreDuplicateRegistrations)return;$(`Cannot register type '${s}' twice`)}if($t[e]=a,delete re[e],ne.hasOwnProperty(e)){var u=ne[e];delete ne[e],u.forEach(E=>E())}}function ot(e,a,i={}){return ze(e,a,i)}var Rt=(e,a,i)=>{switch(a){case 1:return i?s=>z[s>>>0]:s=>lt[s>>>0];case 2:return i?s=>dt[s>>>1>>>0]:s=>Tt[s>>>1>>>0];case 4:return i?s=>O[s>>>2>>>0]:s=>B[s>>>2>>>0];case 8:return i?s=>tt[s>>>3>>>0]:s=>Xt[s>>>3>>>0];default:throw new TypeError(`invalid integer width (${a}): ${e}`)}},Je=function(e,a,i,s,u){e>>>=0,a>>>=0,i>>>=0,a=st(a);const E=s===0n;let g=y=>y;if(E){const y=i*8;g=P=>BigInt.asUintN(y,P),u=g(u)}ot(e,{name:a,fromWireType:g,toWireType:(y,P)=>(typeof P=="number"&&(P=BigInt(P)),P),readValueFromPointer:Rt(a,i,!E),destructorFunction:null})};function fn(e,a,i,s){e>>>=0,a>>>=0,a=st(a),ot(e,{name:a,fromWireType:function(u){return!!u},toWireType:function(u,E){return E?i:s},readValueFromPointer:function(u){return this.fromWireType(lt[u>>>0])},destructorFunction:null})}var hn=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Me=e=>{function a(i){return i.$$.ptrType.registeredClass.name}$(a(e)+" instance already deleted")},be=!1,Le=e=>{},xe=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},ke=e=>{e.count.value-=1;var a=e.count.value===0;a&&xe(e)},Oe=e=>globalThis.FinalizationRegistry?(be=new FinalizationRegistry(a=>{ke(a.$$)}),Oe=a=>{var i=a.$$,s=!!i.smartPtr;if(s){var u={$$:i};be.register(a,u,a)}return a},Le=a=>be.unregister(a),Oe(e)):(Oe=a=>a,e),wr=()=>{let e=Ze.prototype;Object.assign(e,{isAliasOf(i){if(!(this instanceof Ze)||!(i instanceof Ze))return!1;var s=this.$$.ptrType.registeredClass,u=this.$$.ptr;i.$$=i.$$;for(var E=i.$$.ptrType.registeredClass,g=i.$$.ptr;s.baseClass;)u=s.upcast(u),s=s.baseClass;for(;E.baseClass;)g=E.upcast(g),E=E.baseClass;return s===E&&u===g},clone(){if(this.$$.ptr||Me(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var i=Oe(Object.create(Object.getPrototypeOf(this),{$$:{value:hn(this.$$)}}));return i.$$.count.value+=1,i.$$.deleteScheduled=!1,i},delete(){this.$$.ptr||Me(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),Le(this),ke(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Me(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const a=Symbol.dispose;a&&(e[a]=e.delete)};function Ze(){}var qe=(e,a)=>Object.defineProperty(a,"name",{value:e}),Gn={},Cr=(e,a,i)=>{if(e[a].overloadTable===void 0){var s=e[a];e[a]=function(...u){return e[a].overloadTable.hasOwnProperty(u.length)||$(`Function '${i}' called with an invalid number of arguments (${u.length}) - expects one of (${e[a].overloadTable})!`),e[a].overloadTable[u.length].apply(this,u)},e[a].overloadTable=[],e[a].overloadTable[s.argCount]=s}},Be=(e,a,i)=>{o.hasOwnProperty(e)?((i===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[i]!==void 0)&&$(`Cannot register public name '${e}' twice`),Cr(o,e,e),o[e].overloadTable.hasOwnProperty(i)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${i})!`),o[e].overloadTable[i]=a):(o[e]=a,o[e].argCount=i)},Dr=48,Rr=57,Sr=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,"$");var a=e.charCodeAt(0);return a>=Dr&&a<=Rr?`_${e}`:e};function Lr(e,a,i,s,u,E,g,y){this.name=e,this.constructor=a,this.instancePrototype=i,this.rawDestructor=s,this.baseClass=u,this.getActualType=E,this.upcast=g,this.downcast=y,this.pureVirtualFunctions=[]}var Qe=(e,a,i)=>{for(;a!==i;)a.upcast||$(`Expected null or instance of ${i.name}, got an instance of ${a.name}`),e=a.upcast(e),a=a.baseClass;return e},gn=e=>{if(e===null)return"null";var a=typeof e;return a==="object"||a==="array"||a==="function"?e.toString():""+e};function Yr(e,a){if(a===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;a.$$||$(`Cannot pass "${gn(a)}" as a ${this.name}`),a.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var i=a.$$.ptrType.registeredClass,s=Qe(a.$$.ptr,i,this.registeredClass);return s}function Nr(e,a){var i;if(a===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(i=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,i),i):0;(!a||!a.$$)&&$(`Cannot pass "${gn(a)}" as a ${this.name}`),a.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&a.$$.ptrType.isConst&&$(`Cannot convert argument of type ${a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name} to parameter type ${this.name}`);var s=a.$$.ptrType.registeredClass;if(i=Qe(a.$$.ptr,s,this.registeredClass),this.isSmartPointer)switch(a.$$.smartPtr===void 0&&$("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:a.$$.smartPtrType===this?i=a.$$.smartPtr:$(`Cannot convert argument of type ${a.$$.smartPtrType?a.$$.smartPtrType.name:a.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:i=a.$$.smartPtr;break;case 2:if(a.$$.smartPtrType===this)i=a.$$.smartPtr;else{var u=a.clone();i=this.rawShare(i,pt.toHandle(()=>u.delete())),e!==null&&e.push(this.rawDestructor,i)}break;default:$("Unsupported sharing policy")}return i}function Wr(e,a){if(a===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;a.$$||$(`Cannot pass "${gn(a)}" as a ${this.name}`),a.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),a.$$.ptrType.isConst&&$(`Cannot convert argument of type ${a.$$.ptrType.name} to parameter type ${this.name}`);var i=a.$$.ptrType.registeredClass,s=Qe(a.$$.ptr,i,this.registeredClass);return s}function je(e){return this.fromWireType(B[e>>>2>>>0])}var Mn=(e,a,i)=>{if(a===i)return e;if(i.baseClass===void 0)return null;var s=Mn(e,a,i.baseClass);return s===null?null:i.downcast(s)},Gr={},Mr=(e,a)=>{for(a===void 0&&$("ptr should not be undefined");e.baseClass;)a=e.upcast(a),e=e.baseClass;return a},br=(e,a)=>(a=Mr(e,a),Gr[a]),xr=class extends Error{constructor(a){super(a),this.name="InternalError"}},tn=e=>{throw new xr(e)},en=(e,a)=>{(!a.ptrType||!a.ptr)&&tn("makeClassHandle requires ptr and ptrType");var i=!!a.smartPtrType,s=!!a.smartPtr;return i!==s&&tn("Both smartPtrType and smartPtr must be specified"),a.count={value:1},Oe(Object.create(e,{$$:{value:a,writable:!0}}))};function kr(e){var a=this.getPointee(e);if(!a)return this.destructor(e),null;var i=br(this.registeredClass,a);if(i!==void 0){if(i.$$.count.value===0)return i.$$.ptr=a,i.$$.smartPtr=e,i.clone();var s=i.clone();return this.destructor(e),s}function u(){return this.isSmartPointer?en(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:a,smartPtrType:this,smartPtr:e}):en(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var E=this.registeredClass.getActualType(a),g=Gn[E];if(!g)return u.call(this);var y;this.isConst?y=g.constPointerType:y=g.pointerType;var P=Mn(a,this.registeredClass,y.registeredClass);return P===null?u.call(this):this.isSmartPointer?en(y.registeredClass.instancePrototype,{ptrType:y,ptr:P,smartPtrType:this,smartPtr:e}):en(y.registeredClass.instancePrototype,{ptrType:y,ptr:P})}var Or=()=>{Object.assign(nn.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){var a;(a=this.rawDestructor)==null||a.call(this,e)},readValueFromPointer:je,fromWireType:kr})};function nn(e,a,i,s,u,E,g,y,P,D,R){this.name=e,this.registeredClass=a,this.isReference=i,this.isConst=s,this.isSmartPointer=u,this.pointeeType=E,this.sharingPolicy=g,this.rawGetPointee=y,this.rawConstructor=P,this.rawShare=D,this.rawDestructor=R,!u&&a.baseClass===void 0?s?(this.toWireType=Yr,this.destructorFunction=null):(this.toWireType=Wr,this.destructorFunction=null):this.toWireType=Nr}var bn=(e,a,i)=>{o.hasOwnProperty(e)||tn("Replacing nonexistent public symbol"),o[e].overloadTable!==void 0&&i!==void 0?o[e].overloadTable[i]=a:(o[e]=a,o[e].argCount=i)},xn=[],kn=e=>{var a=xn[e];return a||(xn[e]=a=jn.get(e)),a},Br=(e,a,i=[],s=!1)=>{var u=kn(a),E=u(...i);function g(y){return e[0]=="p"?y>>>0:y}return g(E)},Fr=(e,a,i=!1)=>(...s)=>Br(e,a,s,i),fe=(e,a,i=!1)=>{e=st(e);function s(){if(e.includes("p"))return Fr(e,a,i);var E=kn(a);return E}var u=s();return typeof u!="function"&&$(`unknown function pointer with signature ${e}: ${a}`),u};class Ur extends Error{}var On=e=>{var a=Jn(e),i=st(a);return ie(a),i},rn=(e,a)=>{var i=[],s={};function u(E){if(!s[E]&&!$t[E]){if(re[E]){re[E].forEach(u);return}i.push(E),s[E]=!0}}throw a.forEach(u),new Ur(`${e}: `+i.map(On).join([", "]))},an=(e,a,i)=>{e.forEach(y=>re[y]=a);function s(y){var P=i(y);P.length!==e.length&&tn("Mismatched type converter count");for(var D=0;D<e.length;++D)ot(e[D],P[D])}var u=new Array(a.length),E=[],g=0;for(let[y,P]of a.entries())$t.hasOwnProperty(P)?u[y]=$t[P]:(E.push(P),ne.hasOwnProperty(P)||(ne[P]=[]),ne[P].push(()=>{u[y]=$t[P],++g,g===E.length&&s(u)}));E.length===0&&s(u)};function $r(e,a,i,s,u,E,g,y,P,D,R,G,b){e>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,E>>>=0,g>>>=0,y>>>=0,P>>>=0,D>>>=0,R>>>=0,G>>>=0,b>>>=0,R=st(R),E=fe(u,E),y&&(y=fe(g,y)),D&&(D=fe(P,D)),b=fe(G,b);var Y=Sr(R);Be(Y,function(){rn(`Cannot construct ${R} due to unbound types`,[s])}),an([e,a,i],s?[s]:[],F=>{var ar;F=F[0];var H,rt;s?(H=F.registeredClass,rt=H.instancePrototype):rt=Ze.prototype;var at=qe(R,function(...In){if(Object.getPrototypeOf(this)!==ct)throw new Se(`Use 'new' to construct ${R}`);if(_t.constructor_body===void 0)throw new Se(`${R} has no accessible constructor`);var or=_t.constructor_body[In.length];if(or===void 0)throw new Se(`Tried to invoke ctor of ${R} with invalid number of parameters (${In.length}) - expected (${Object.keys(_t.constructor_body).toString()}) parameters instead!`);return or.apply(this,In)}),ct=Object.create(rt,{constructor:{value:at}});at.prototype=ct;var _t=new Lr(R,at,ct,b,H,E,y,D);_t.baseClass&&((ar=_t.baseClass).__derivedClasses??(ar.__derivedClasses=[]),_t.baseClass.__derivedClasses.push(_t));var It=new nn(R,_t,!0,!1,!1),Vt=new nn(R+"*",_t,!1,!1,!1),it=new nn(R+" const*",_t,!1,!0,!1);return Gn[e]={pointerType:Vt,constPointerType:it},bn(Y,at),[It,Vt,it]})}var An=e=>{for(;e.length;){var a=e.pop(),i=e.pop();i(a)}},Bn=(e,a,i)=>(e instanceof Object||$(`${i} with invalid "this": ${e}`),e instanceof a.registeredClass.constructor||$(`${i} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||$(`cannot call emscripten binding method ${i} on deleted object`),Qe(e.$$.ptr,e.$$.ptrType.registeredClass,a.registeredClass)),Vr=function(e,a,i,s,u,E,g,y,P,D){e>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,E>>>=0,g>>>=0,y>>>=0,P>>>=0,D>>>=0,a=st(a),u=fe(s,u),an([],[e],R=>{R=R[0];var G=`${R.name}.${a}`,b={get(){rn(`Cannot access ${G} due to unbound types`,[i,g])},enumerable:!0,configurable:!0};return P?b.set=()=>rn(`Cannot access ${G} due to unbound types`,[i,g]):b.set=Y=>$(G+" is a read-only property"),Object.defineProperty(R.registeredClass.instancePrototype,a,b),an([],P?[i,g]:[i],Y=>{var F=Y[0],H={get(){var at=Bn(this,R,G+" getter");return F.fromWireType(u(E,at))},enumerable:!0};if(P){P=fe(y,P);var rt=Y[1];H.set=function(at){var ct=Bn(this,R,G+" setter"),_t=[];P(D,ct,rt.toWireType(_t,at)),An(_t)}}return Object.defineProperty(R.registeredClass.instancePrototype,a,H),[]}),[]})},Fn=[],ae=[0,1,,1,null,1,!0,1,!1,1];function Tn(e){e>>>=0,e>9&&--ae[e+1]===0&&(ae[e],ae[e]=void 0,Fn.push(e))}var pt={toValue:e=>(e||$(`Cannot use deleted val. handle = ${e}`),ae[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const a=Fn.pop()||ae.length;return ae[a]=e,ae[a+1]=1,a}}}},Hr={name:"emscripten::val",fromWireType:e=>{var a=pt.toValue(e);return Tn(e),a},toWireType:(e,a)=>pt.toHandle(a),readValueFromPointer:je,destructorFunction:null};function Xr(e){return e>>>=0,ot(e,Hr)}var yn=(e,a,i)=>{switch(a){case 1:return i?function(s){return this.fromWireType(z[s>>>0])}:function(s){return this.fromWireType(lt[s>>>0])};case 2:return i?function(s){return this.fromWireType(dt[s>>>1>>>0])}:function(s){return this.fromWireType(Tt[s>>>1>>>0])};case 4:return i?function(s){return this.fromWireType(O[s>>>2>>>0])}:function(s){return this.fromWireType(B[s>>>2>>>0])};default:throw new TypeError(`invalid integer width (${a}): ${e}`)}};function Kr(e){return e===0?"object":e===1?"number":"string"}function zr(e,a,i,s,u){e>>>=0,a>>>=0,i>>>=0,a=st(a);const E=Kr(u);switch(E){case"object":{let D=function(){};D.values={},ot(e,{name:a,constructor:D,valueType:E,fromWireType:function(R){return this.constructor.values[R]},toWireType:(R,G)=>G.value,readValueFromPointer:yn(a,i,s),destructorFunction:null}),Be(a,D);break}case"number":{var g={};ot(e,{name:a,keysMap:g,valueType:E,fromWireType:D=>D,toWireType:(D,R)=>R,readValueFromPointer:yn(a,i,s),destructorFunction:null}),Be(a,g),delete o[a].argCount;break}case"string":{var y={},P={},g={};ot(e,{name:a,valuesMap:y,reverseMap:P,keysMap:g,valueType:E,fromWireType:function(R){return this.reverseMap[R]},toWireType:function(R,G){return this.valuesMap[G]},readValueFromPointer:yn(a,i,s),destructorFunction:null}),Be(a,g),delete o[a].argCount;break}}}var Un=(e,a)=>{var i=$t[e];return i===void 0&&$(`${a} has unknown type ${On(e)}`),i};function Jr(e,a,i){e>>>=0,a>>>=0;var s=Un(e,"enum");switch(a=st(a),s.valueType){case"object":{var u=s.constructor,E=Object.create(s.constructor.prototype,{value:{value:i},constructor:{value:qe(`${s.name}_${a}`,function(){})}});u.values[i]=E,u[a]=E;break}case"number":{s.keysMap[a]=i;break}case"string":{s.valuesMap[a]=i,s.reverseMap[i]=a,s.keysMap[a]=a;break}}}var Zr=(e,a)=>{switch(a){case 4:return function(i){return this.fromWireType(Ot[i>>>2>>>0])};case 8:return function(i){return this.fromWireType(Bt[i>>>3>>>0])};default:throw new TypeError(`invalid float width (${a}): ${e}`)}},qr=function(e,a,i){e>>>=0,a>>>=0,i>>>=0,a=st(a),ot(e,{name:a,fromWireType:s=>s,toWireType:(s,u)=>u,readValueFromPointer:Zr(a,i),destructorFunction:null})};function $n(e){for(var a=1;a<e.length;++a)if(e[a]!==null&&e[a].destructorFunction===void 0)return!0;return!1}function Qr(e,a,i,s){for(var u=$n(e),E=e.length-2,g=[],y=["fn"],P=0;P<E;++P)g.push(`arg${P}`),y.push(`arg${P}Wired`);g=g.join(","),y=y.join(",");var D=`return function (${g}) {
|
|
3
|
+
`;u&&(D+=`var destructors = [];
|
|
4
|
+
`);for(var R=u?"destructors":"null",G=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"],P=0;P<E;++P){var b=`toArg${P}Wire`;D+=`var arg${P}Wired = ${b}(${R}, arg${P});
|
|
5
|
+
`,G.push(b)}if(D+=(i||s?"var rv = ":"")+`invoker(${y});
|
|
6
|
+
`,u)D+=`runDestructors(destructors);
|
|
7
|
+
`;else for(var P=2;P<e.length;++P){var Y=P===1?"thisWired":"arg"+(P-2)+"Wired";e[P].destructorFunction!==null&&(D+=`${Y}_dtor(${Y});
|
|
8
|
+
`,G.push(`${Y}_dtor`))}return i&&(D+=`var ret = fromRetWire(rv);
|
|
10
9
|
return ret;
|
|
11
|
-
`),
|
|
12
|
-
`,
|
|
13
|
-
|
|
14
|
-
`,g+=s[R].argPackAdvance;var N=o===1?"new func":"func.call";E+=` var rv = ${N}(${y.join(", ")});
|
|
15
|
-
`,c.isVoid||(p.push("emval_returnValue"),C.push(ya),E+=` return emval_returnValue(retType, destructorsRef, rv);
|
|
16
|
-
`),E+=`};
|
|
17
|
-
`,p.push(E);var O=Xn(Function,p)(...C),W=`methodCaller<(${s.map(x=>x.name).join(", ")}) => ${c.name}>`;return ga(Ye(W,O))}function pa(e){e>>>=0,e>9&&(Xt[e+1]+=1)}function Pa(){return gt.toHandle([])}function va(e){return e>>>=0,gt.toHandle(zn(e))}function ma(){return gt.toHandle({})}function Ia(e){e>>>=0;var r=gt.toValue(e);gn(r),yn(e)}function wa(e,r,o){e>>>=0,r>>>=0,o>>>=0,e=gt.toValue(e),r=gt.toValue(r),o=gt.toValue(o),e[r]=o}function Ca(e,r){e>>>=0,r>>>=0,e=Tn(e,"_emval_take_value");var o=e.readValueFromPointer(r);return gt.toHandle(o)}function Da(e,r){e=Te(e),r>>>=0;var o=new Date(e*1e3);Y[r>>>2>>>0]=o.getUTCSeconds(),Y[r+4>>>2>>>0]=o.getUTCMinutes(),Y[r+8>>>2>>>0]=o.getUTCHours(),Y[r+12>>>2>>>0]=o.getUTCDate(),Y[r+16>>>2>>>0]=o.getUTCMonth(),Y[r+20>>>2>>>0]=o.getUTCFullYear()-1900,Y[r+24>>>2>>>0]=o.getUTCDay();var s=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),c=(o.getTime()-s)/(1e3*60*60*24)|0;Y[r+28>>>2>>>0]=c}var Ra=e=>e%4===0&&(e%100!==0||e%400===0),Sa=[0,31,60,91,121,152,182,213,244,274,305,335],La=[0,31,59,90,120,151,181,212,243,273,304,334],Ya=e=>{var r=Ra(e.getFullYear()),o=r?Sa:La,s=o[e.getMonth()]+e.getDate()-1;return s},Na=function(e){e>>>=0;var r=(()=>{var o=new Date(Y[e+20>>>2>>>0]+1900,Y[e+16>>>2>>>0],Y[e+12>>>2>>>0],Y[e+8>>>2>>>0],Y[e+4>>>2>>>0],Y[e>>>2>>>0],0),s=Y[e+32>>>2>>>0],c=o.getTimezoneOffset(),E=new Date(o.getFullYear(),0,1),g=new Date(o.getFullYear(),6,1).getTimezoneOffset(),y=E.getTimezoneOffset(),p=Math.min(y,g);if(s<0)Y[e+32>>>2>>>0]=+(g!=y&&p==c);else if(s>0!=(p==c)){var C=Math.max(y,g),R=s>0?p:C;o.setTime(o.getTime()+(R-c)*6e4)}Y[e+24>>>2>>>0]=o.getDay();var N=Ya(o)|0;Y[e+28>>>2>>>0]=N,Y[e>>>2>>>0]=o.getSeconds(),Y[e+4>>>2>>>0]=o.getMinutes(),Y[e+8>>>2>>>0]=o.getHours(),Y[e+12>>>2>>>0]=o.getDate(),Y[e+16>>>2>>>0]=o.getMonth(),Y[e+20>>>2>>>0]=o.getYear();var O=o.getTime();return isNaN(O)?-1:O/1e3})();return BigInt(r)},Ga=function(e,r,o,s){e>>>=0,r>>>=0,o>>>=0,s>>>=0;var c=new Date().getFullYear(),E=new Date(c,0,1),g=new Date(c,6,1),y=E.getTimezoneOffset(),p=g.getTimezoneOffset(),C=Math.max(y,p);F[e>>>2>>>0]=C*60,Y[r>>>2>>>0]=+(y!=p);var R=W=>{var x=W>=0?"-":"+",K=Math.abs(W),_t=String(Math.floor(K/60)).padStart(2,"0"),at=String(K%60).padStart(2,"0");return`UTC${x}${_t}${at}`},N=R(y),O=R(p);p<y?(ce(N,o,17),ce(O,s,17)):(ce(N,s,17),ce(O,o,17))},Jn=()=>performance.now(),Zn=()=>Date.now(),Wa=e=>e>=0&&e<=3;function Ma(e,r,o){if(o>>>=0,!Wa(e))return 28;var s;e===0?s=Zn():s=Jn();var c=Math.round(s*1e3*1e3);return it[o>>>3]=BigInt(c),0}function ba(e){return e>>>=0,b(de(e))}var xa=()=>4294901760,ka=e=>{var r=$.buffer,o=(e-r.byteLength+65535)/65536|0;try{return $.grow(o),wt(),1}catch{}};function Oa(e){e>>>=0;var r=Z.length,o=xa();if(e>o)return!1;for(var s=1;s<=4;s*=2){var c=r*(1+.2/s);c=Math.min(c,e+100663296);var E=Math.min(o,ve(Math.max(e,c),65536)),g=ka(E);if(g)return!0}return!1}var _n={},Ba=()=>P||"./this.program",$e=()=>{if(!$e.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Ba()};for(var o in _n)_n[o]===void 0?delete r[o]:r[o]=_n[o];var s=[];for(var o in r)s.push(`${o}=${r[o]}`);$e.strings=s}return $e.strings},Fa=(e,r)=>{for(var o=0;o<e.length;++o)U[r++>>>0]=e.charCodeAt(o);U[r>>>0]=0},Ua=function(e,r){e>>>=0,r>>>=0;var o=0;return $e().forEach((s,c)=>{var E=r+o;F[e+c*4>>>2>>>0]=E,Fa(s,E),o+=s.length+1}),0},$a=function(e,r){e>>>=0,r>>>=0;var o=$e();F[e>>>2>>>0]=o.length;var s=0;return o.forEach(c=>s+=c.length+1),F[r>>>2>>>0]=s,0};function Va(e){try{var r=et.getStreamFromFD(e);return l.close(r),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var Ha=(e,r,o,s)=>{for(var c=0,E=0;E<o;E++){var g=F[r>>>2>>>0],y=F[r+4>>>2>>>0];r+=8;var p=l.read(e,U,g,y,s);if(p<0)return-1;if(c+=p,p<y)break}return c};function Xa(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=et.getStreamFromFD(e),E=Ha(c,r,o);return F[s>>>2>>>0]=E,0}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return g.errno}}function Ka(e,r,o,s){r=Te(r),s>>>=0;try{if(isNaN(r))return 61;var c=et.getStreamFromFD(e);return l.llseek(c,r,o),it[s>>>3]=BigInt(c.position),c.getdents&&r===0&&o===0&&(c.getdents=null),0}catch(E){if(typeof l>"u"||E.name!=="ErrnoError")throw E;return E.errno}}var za=(e,r,o,s)=>{for(var c=0,E=0;E<o;E++){var g=F[r>>>2>>>0],y=F[r+4>>>2>>>0];r+=8;var p=l.write(e,U,g,y,s);if(p<0)return-1;if(c+=p,p<y)break}return c};function Ja(e,r,o,s){r>>>=0,o>>>=0,s>>>=0;try{var c=et.getStreamFromFD(e),E=za(c,r,o);return F[s>>>2>>>0]=E,0}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return g.errno}}function Za(e,r){e>>>=0,r>>>=0;try{return Zt(Z.subarray(e>>>0,e+r>>>0)),0}catch(o){if(typeof l>"u"||o.name!=="ErrnoError")throw o;return o.errno}}var qn=e=>{var r=n["_"+e];return r},qa=(e,r)=>{U.set(e,r>>>0)},Qn=e=>ro(e),Qa=e=>{var r=Wt(e)+1,o=Qn(r);return ce(e,o,r),o},jn=(e,r,o,s,c)=>{var E={string:x=>{var K=0;return x!=null&&x!==0&&(K=Qa(x)),K},array:x=>{var K=Qn(x.length);return qa(x,K),K}};function g(x){return r==="string"?de(x):r==="boolean"?!!x:x}var y=qn(e),p=[],C=0;if(s)for(var R=0;R<s.length;R++){var N=E[o[R]];N?(C===0&&(C=Me()),p[R]=N(s[R])):p[R]=s[R]}var O=y(...p);function W(x){return C!==0&&We(C),g(x)}return O=W(O),O},ja=(e,r,o,s)=>{var c=!o||o.every(g=>g==="number"||g==="boolean"),E=r!=="string";return E&&c&&!s?qn(e):(...g)=>jn(e,r,o,g)},to=e=>{var r=Wt(e)+1,o=Pn(r);return o&&ce(e,o,r),o};l.createPreloadedFile=ze,l.staticInit(),B.doesNotExistError=new l.ErrnoError(44),B.doesNotExistError.stack="<generic error, no stack>",Oe(),te=n.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},je=n.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},Rr(),xr(),Un=n.UnboundTypeError=Br(Error,"UnboundTypeError"),Vr();var tr={__cxa_throw:xe,__syscall_fcntl64:cn,__syscall_fstat64:Ze,__syscall_ioctl:ke,__syscall_lstat64:J,__syscall_newfstatat:j,__syscall_openat:jt,__syscall_stat64:qe,_abort_js:un,_embind_register_bigint:pr,_embind_register_bool:Pr,_embind_register_class:Fr,_embind_register_class_property:Ur,_embind_register_emval:Xr,_embind_register_enum:zr,_embind_register_enum_value:Jr,_embind_register_float:qr,_embind_register_function:na,_embind_register_integer:ra,_embind_register_memory_view:aa,_embind_register_std_string:oa,_embind_register_std_wstring:ua,_embind_register_void:Ea,_emval_call_method:ha,_emval_decref:yn,_emval_get_method_caller:Ta,_emval_incref:pa,_emval_new_array:Pa,_emval_new_cstring:va,_emval_new_object:ma,_emval_run_destructors:Ia,_emval_set_property:wa,_emval_take_value:Ca,_gmtime_js:Da,_mktime_js:Na,_tzset_js:Ga,clock_time_get:Ma,emscripten_date_now:Zn,emscripten_err:ba,emscripten_get_now:Jn,emscripten_resize_heap:Oa,environ_get:Ua,environ_sizes_get:$a,fd_close:Va,fd_read:Xa,fd_seek:Ka,fd_write:Ja,random_get:Za},X=await H();X.__wasm_call_ctors,n.__ZdlPvm=X._ZdlPvm;var Pn=X.malloc,ee=X.free;X.calloc,X.realloc;var eo=X.__getTypeName;n._strndup=X.strndup,n.__ZdaPv=X._ZdaPv,n.__ZdaPvm=X._ZdaPvm,n.__ZdlPv=X._ZdlPv,n._emscripten_builtin_malloc=X.emscripten_builtin_malloc,n.__Znaj=X._Znaj,n.__ZnajSt11align_val_t=X._ZnajSt11align_val_t,n.__Znwj=X._Znwj,n.__ZnwjSt11align_val_t=X._ZnwjSt11align_val_t,n.___libc_calloc=X.__libc_calloc,n.___libc_free=X.__libc_free,n.___libc_malloc=X.__libc_malloc,n.___libc_realloc=X.__libc_realloc,n._emscripten_builtin_calloc=X.emscripten_builtin_calloc,n._emscripten_builtin_free=X.emscripten_builtin_free,n._emscripten_builtin_realloc=X.emscripten_builtin_realloc,n._malloc_size=X.malloc_size,n._malloc_usable_size=X.malloc_usable_size,n._reallocf=X.reallocf;var no=X._emscripten_stack_restore,ro=X._emscripten_stack_alloc,ao=X.emscripten_stack_get_current;function oo(e){e=Object.assign({},e);var r=c=>E=>c(E)>>>0,o=c=>(E,g)=>c(E,g)>>>0,s=c=>()=>c()>>>0;return e.malloc=r(e.malloc),e.calloc=o(e.calloc),e.__getTypeName=r(e.__getTypeName),e.emscripten_builtin_malloc=r(e.emscripten_builtin_malloc),e.emscripten_builtin_calloc=o(e.emscripten_builtin_calloc),e._emscripten_stack_alloc=r(e._emscripten_stack_alloc),e.emscripten_stack_get_current=s(e.emscripten_stack_get_current),e}n.ENV=_n,n.ccall=jn,n.cwrap=ja,n.setValue=Ge,n.UTF8ToString=de,n.stringToNewUTF8=to,n.FS=l;function vn(){if(ft>0){Dt=vn;return}if(xt(),ft>0){Dt=vn;return}function e(){var r;n.calledRun=!0,!q&&(Ct(),d(n),(r=n.onRuntimeInitialized)==null||r.call(n),kt())}n.setStatus?(n.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>n.setStatus(""),1),e()},1)):e()}if(n.preInit)for(typeof n.preInit=="function"&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return vn(),i=u,i})})(),vo=Object.defineProperty,mo=(a,t,i)=>t in a?vo(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,nt=(a,t,i)=>mo(a,typeof t!="symbol"?t+"":t,i);const Io=["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","euc-kr","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"],ar=a=>Io[a];var Ee=(a=>(a[a.TopLeft=1]="TopLeft",a[a.TopCenter=2]="TopCenter",a[a.TopRight=3]="TopRight",a[a.MiddleLeft=4]="MiddleLeft",a[a.MiddleCenter=5]="MiddleCenter",a[a.MiddleRight=6]="MiddleRight",a[a.BottomLeft=7]="BottomLeft",a[a.BottomCenter=8]="BottomCenter",a[a.BottomRight=9]="BottomRight",a))(Ee||{}),Dn=(a=>(a[a.PatternFill=0]="PatternFill",a[a.SolidFill=1]="SolidFill",a))(Dn||{}),Rn=(a=>(a[a.NonAssociative=0]="NonAssociative",a[a.Associative=1]="Associative",a))(Rn||{}),Er=(a=>(a[a.Solid=0]="Solid",a[a.Gradient=1]="Gradient",a))(Er||{}),Sn=(a=>(a[a.TwoColor=0]="TwoColor",a[a.OneColor=1]="OneColor",a))(Sn||{}),He=(a=>(a[a.Line=1]="Line",a[a.Circular=2]="Circular",a[a.Elliptic=3]="Elliptic",a[a.Spline=4]="Spline",a))(He||{}),Ln=(a=>(a[a.LEFT=0]="LEFT",a[a.CENTER=1]="CENTER",a[a.RIGHT=2]="RIGHT",a[a.ALIGNED=3]="ALIGNED",a[a.MIDDLE=4]="MIDDLE",a[a.FIT=5]="FIT",a))(Ln||{});const wo=Object.freeze(["ACADMAINTVER","ACADVER","ANGBASE","ANGDIR","ATTMODE","AUNITS","AUPREC","CECOLOR","CELTSCALE","CELTYPE","CELWEIGHT","CEPSNID","CEPSNTYPE","CHAMFERA","CHAMFERB","CHAMFERC","CHAMFERD","CLAYER","CMLJUST","CMLSCALE","CMLSTYLE","CSHADOW","DIMADEC","DIMALT","DIMALTD","DIMALTF","DIMALTRND","DIMALTTD","DIMALTTZ","DIMALTU","DIMALTZ","DIMAPOST","DIMASO","DIMASSOC","DIMASZ","DIMATFIT","DIMAUNIT","DIMAZIN","DIMBLK","DIMBLK1","DIMBLK2","DIMCEN","DIMCLRD","DIMCLRE","DIMCLRT","DIMDEC","DIMDLE","DIMDLI","DIMDSEP","DIMEXE","DIMEXO","DIMFAC","DIMGAP","DIMJUST","DIMLDRBLK","DIMLFAC","DIMLIM","DIMLUNIT","DIMLWD","DIMLWE","DIMPOST","DIMRND","DIMSAH","DIMSCALE","DIMSD1","DIMSD2","DIMSE1","DIMSE2","DIMSHO","DIMSOXD","DIMSTYLE","DIMTAD","DIMTDEC","DIMTFAC","DIMTIH","DIMTIX","DIMTM","DIMTMOVE","DIMTOFL","DIMTOH","DIMTOL","DIMTOLJ","DIMTP","DIMTSZ","DIMTVP","DIMTXSTY","DIMTXT","DIMTZIN","DIMUPT","DIMZIN","DISPSILH","DRAGVS","DWGCODEPAGE","ELEVATION","ENDCAPS","EXTMAX","EXTMIN","EXTNAMES","FILLETRAD","FILLMODE","FINGERPRINTGUID","HALOGAP","HANDSEED","HIDETEXT","HYPERLINKBASE","INDEXCTL","INSBASE","INSUNITS","INTERFERECOLOR","INTERFEREOBJVS","INTERFEREVPVS","INTERSECTIONCOLOR","INTERSECTIONDISPLAY","JOINSTYLE","LIMCHECK","LIMMAX","LIMMIN","LTSCALE","LUNITS","LUPREC","LWDISPLAY","MAXACTVP","MEASUREMENT","MENU","MIRRTEXT","OBSCOLOR","OBSLTYPE","ORTHOMODE","PDMODE","PDSIZE","PELEVATION","PEXTMAX","PEXTMIN","PINSBASE","PLIMCHECK","PLIMMAX","PLIMMIN","PLINEGEN","PLINEWID","PROJECTNAME","PROXYGRAPHICS","PSLTSCALE","PSTYLEMODE","PSVPSCALE","PUCSBASE","PUCSNAME","PUCSORG","PUCSORGBACK","PUCSORGBOTTOM","PUCSORGFRONT","PUCSORGLEFT","PUCSORGRIGHT","PUCSORGTOP","PUCSORTHOREF","PUCSORTHOVIEW","PUCSXDIR","PUCSYDIR","QTEXTMODE","REGENMODE","SHADEDGE","SHADEDIF","SHADOWPLANELOCATION","SKETCHINC","SKPOLY","SORTENTS","SPLINESEGS","SPLINETYPE","SURFTAB1","SURFTAB2","SURFTYPE","SURFU","SURFV","TDCREATE","TDINDWG","TDUCREATE","TDUPDATE","TDUSRTIMER","TDUUPDATE","TEXTSIZE","TEXTSTYLE","THICKNESS","TILEMODE","TRACEWID","TREEDEPTH","UCSBASE","UCSNAME","UCSORG","UCSORGBACK","UCSORGBOTTOM","UCSORGFRONT","UCSORGLEFT","UCSORGRIGHT","UCSORGTOP","UCSORTHOREF","UCSORTHOVIEW","UCSXDIR","UCSYDIR","UNITMODE","USERI1","USERI2","USERI3","USERI4","USERI5","USERR1","USERR2","USERR3","USERR4","USERR5","USRTIMER","VERSIONGUID","VISRETAIN","WORLDVIEW","XCLIPFRAME","XEDIT"]),Co=/\\U\+([0-9A-Fa-f]{4})/g;function or(a){return!a||!a.includes("\\U+")?a:a.replace(Co,(t,i)=>String.fromCharCode(parseInt(i,16)))}const Do=[{type:"invalid",hdr:"INVALI",description:"No DWG",version:0},{type:"r1.1",hdr:"MC0.0",description:"MicroCAD Release 1.1",version:0},{type:"r1.2",hdr:"AC1.2",description:"AutoCAD Release 1.2",version:0},{type:"r1.3",hdr:"AC1.3",description:"AutoCAD Release 1.3",version:1},{type:"r1.4",hdr:"AC1.40",description:"AutoCAD Release 1.4",version:2},{type:"r2.0b",hdr:"AC1.50",description:"AutoCAD 2.0 beta",version:3},{type:"r2.0",hdr:"AC1.50",description:"AutoCAD Release 2.0",version:4},{type:"r2.10",hdr:"AC2.10",description:"AutoCAD Release 2.10",version:5},{type:"r2.21",hdr:"AC2.21",description:"AutoCAD Release 2.21",version:6},{type:"r2.22",hdr:"AC2.22",description:"AutoCAD Release 2.22",version:7},{type:"r2.4",hdr:"AC1001",description:"AutoCAD Release 2.4",version:8},{type:"r2.5",hdr:"AC1002",description:"AutoCAD Release 2.5",version:9},{type:"r2.6",hdr:"AC1003",description:"AutoCAD Release 2.6",version:10},{type:"r9",hdr:"AC1004",description:"AutoCAD Release 9",version:11},{type:"r9c1",hdr:"AC1005",description:"AutoCAD Release 9c1",version:12},{type:"r10",hdr:"AC1006",description:"AutoCAD Release 10",version:13},{type:"r11b1",hdr:"AC1007",description:"AutoCAD 11 beta 1",version:14},{type:"r11b2",hdr:"AC1008",description:"AutoCAD 11 beta 2",version:15},{type:"r11",hdr:"AC1009",description:"AutoCAD Release 11/12 (LT R1/R2)",version:16},{type:"r13b1",hdr:"AC1010",description:"AutoCAD pre-R13 a",version:17},{type:"r13b2",hdr:"AC1011",description:"AutoCAD pre-R13 b",version:18},{type:"r13",hdr:"AC1012",description:"AutoCAD Release 13",version:19},{type:"r13c3",hdr:"AC1013",description:"AutoCAD Release 13c3",version:20},{type:"r14",hdr:"AC1014",description:"AutoCAD Release 14",version:21},{type:"r2000b",hdr:"AC1500",description:"AutoCAD 2000 beta",version:22},{type:"r2000",hdr:"AC1015",description:"AutoCAD Release 2000",version:23},{type:"r2000i",hdr:"AC1016",description:"AutoCAD Release 2000i",version:23},{type:"r2002",hdr:"AC1017",description:"AutoCAD Release 2002",version:23},{type:"r2004a",hdr:"AC402a",description:"AutoCAD 2004 alpha a",version:24},{type:"r2004b",hdr:"AC402b",description:"AutoCAD 2004 alpha b",version:24},{type:"r2004c",hdr:"AC1018",description:"AutoCAD 2004 beta",version:24},{type:"r2004",hdr:"AC1018",description:"AutoCAD Release 2004",version:25},{type:"r2007a",hdr:"AC701a",description:"AutoCAD 2007 alpha",version:26},{type:"r2007b",hdr:"AC1021",description:"AutoCAD 2007 beta",version:26},{type:"r2007",hdr:"AC1021",description:"AutoCAD Release 2007",version:27},{type:"r2010b",hdr:"AC1024",description:"AutoCAD 2010 beta",version:28},{type:"r2010",hdr:"AC1024",description:"AutoCAD Release 2010",version:29},{type:"r2013b",hdr:"AC1027",description:"AutoCAD 2013 beta",version:30},{type:"r2013",hdr:"AC1027",description:"AutoCAD Release 2013",version:31},{type:"r2018b",hdr:"AC1032",description:"AutoCAD 2018 beta",version:32},{type:"r2018",hdr:"AC1032",description:"AutoCAD Release 2018",version:33},{type:"r2022b",hdr:"AC103-4",description:"AutoCAD 2022 beta",version:36},{type:"r>2022",hdr:"",description:"AutoCAD Release >2022",version:0}];var Yn=(a=>(a[a.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",a[a.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT",a))(Yn||{}),Nn=(a=>(a[a.WRONGCRC=1]="WRONGCRC",a[a.NOTYETSUPPORTED=2]="NOTYETSUPPORTED",a[a.UNHANDLEDCLASS=4]="UNHANDLEDCLASS",a[a.INVALIDTYPE=8]="INVALIDTYPE",a[a.INVALIDHANDLE=16]="INVALIDHANDLE",a[a.INVALIDEED=32]="INVALIDEED",a[a.VALUEOUTOFBOUNDS=64]="VALUEOUTOFBOUNDS",a[a.CLASSESNOTFOUND=128]="CLASSESNOTFOUND",a[a.SECTIONNOTFOUND=256]="SECTIONNOTFOUND",a[a.PAGENOTFOUND=512]="PAGENOTFOUND",a[a.INTERNALERROR=1024]="INTERNALERROR",a[a.INVALIDDWG=2048]="INVALIDDWG",a[a.IOERROR=4096]="IOERROR",a[a.OUTOFMEM=8192]="OUTOFMEM",a))(Nn||{}),L=(a=>(a[a.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",a[a.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",a[a.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",a[a.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",a[a.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",a[a.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",a[a.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",a[a.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",a[a.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",a[a.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",a[a.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",a[a.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",a[a.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",a[a.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",a[a.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",a[a.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",a[a.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",a[a.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",a[a.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",a[a.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",a[a.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",a[a.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",a[a.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",a[a.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",a[a.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",a[a.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",a[a.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",a[a.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",a[a.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",a[a.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",a[a.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",a[a.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",a[a.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",a[a.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",a[a.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",a[a.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",a[a.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",a[a.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",a[a.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",a[a.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",a[a.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",a[a.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",a[a.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",a[a.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",a[a.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",a[a.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",a[a.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",a[a.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",a[a.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",a[a.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",a[a.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",a[a.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",a[a.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",a[a.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",a[a.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",a[a.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",a[a.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",a[a.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",a[a.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",a[a.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",a[a.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",a[a.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",a[a.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",a[a.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",a[a.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",a[a.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",a[a.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",a[a.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",a[a.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",a[a.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",a[a.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",a[a.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",a[a.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",a[a.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",a[a.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",a[a.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",a[a.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",a[a.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",a[a.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",a[a.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",a[a.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",a[a.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",a[a.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",a[a.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",a[a.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",a[a.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",a[a.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",a[a.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",a[a.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",a[a.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",a[a.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",a[a.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",a[a.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",a[a.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",a[a.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",a[a.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",a[a.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",a[a.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",a[a.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",a[a.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",a[a.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",a[a.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",a[a.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",a[a.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",a[a.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",a[a.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",a[a.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",a[a.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",a[a.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",a[a.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",a[a.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",a[a.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",a[a.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",a[a.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",a[a.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",a[a.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",a[a.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",a[a.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",a[a.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",a[a.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",a[a.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",a[a.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",a[a.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",a[a.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",a[a.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",a[a.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",a[a.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",a[a.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",a[a.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",a[a.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",a[a.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",a[a.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",a[a.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",a[a.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",a[a.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",a[a.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",a[a.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",a[a.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",a[a.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",a[a.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",a[a.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",a[a.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",a[a.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",a[a.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",a[a.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",a[a.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",a[a.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",a[a.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",a[a.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",a[a.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",a[a.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",a[a.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",a[a.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",a[a.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",a[a.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",a[a.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",a[a.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",a[a.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",a[a.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",a[a.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",a[a.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",a[a.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",a[a.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",a[a.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",a[a.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",a[a.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",a[a.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",a[a.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",a[a.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",a[a.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",a[a.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",a[a.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",a[a.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",a[a.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",a[a.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",a[a.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",a[a.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",a[a.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",a[a.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",a[a.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",a[a.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",a[a.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",a[a.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",a[a.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",a[a.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",a[a.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",a[a.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",a[a.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",a[a.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",a[a.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",a[a.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",a[a.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",a[a.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",a[a.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",a[a.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",a[a.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",a[a.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",a[a.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",a[a.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",a[a.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",a[a.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",a[a.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",a[a.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",a[a.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",a[a.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",a[a.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",a[a.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",a[a.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",a[a.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",a[a.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",a[a.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",a[a.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",a[a.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",a[a.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",a[a.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",a[a.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",a[a.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",a[a.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",a[a.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",a[a.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",a[a.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",a[a.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",a[a.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",a[a.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",a[a.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",a[a.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",a[a.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",a[a.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",a[a.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",a[a.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",a[a.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",a[a.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",a[a.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",a[a.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",a[a.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",a[a.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",a[a.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",a[a.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",a[a.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",a[a.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",a[a.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",a[a.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",a[a.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",a[a.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",a[a.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",a[a.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",a[a.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",a[a.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",a[a.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",a[a.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",a[a.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",a[a.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",a[a.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",a[a.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",a[a.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",a[a.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",a[a.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",a[a.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",a[a.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",a[a.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",a[a.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",a[a.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",a[a.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",a[a.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",a[a.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",a[a.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",a[a.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",a[a.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",a[a.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",a[a.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",a[a.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",a[a.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",a[a.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",a[a.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",a[a.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",a[a.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",a[a.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",a[a.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",a[a.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",a[a.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",a[a.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",a[a.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",a[a.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",a[a.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",a[a.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",a[a.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",a[a.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",a[a.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",a[a.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",a[a.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",a[a.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",a[a.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",a[a.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",a[a.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",a[a.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",a[a.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",a[a.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",a[a.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",a[a.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ",a))(L||{});Object.fromEntries(Object.entries(L).map(([a,t])=>[t,a]));var Lt=(a=>(a[a.DWG=0]="DWG",a[a.DXF=1]="DXF",a))(Lt||{}),Xe=(a=>(a[a.Line=1]="Line",a[a.CircularArc=2]="CircularArc",a[a.EllipticArc=3]="EllipticArc",a[a.Spline=4]="Spline",a))(Xe||{}),vt=(a=>(a[a.ByLayer=192]="ByLayer",a[a.ByBlock=193]="ByBlock",a[a.Entities=194]="Entities",a[a.TrueColor=195]="TrueColor",a[a.ForegroundColor=197]="ForegroundColor",a[a.None=200]="None",a))(vt||{});const ir=192,sr=193,Ro=194,wn=195,_r=200;function fr(a){if(a==null)return;const t=a.method,i=a.method!=null&&t!==0?t:a.rgb>>>24&255,n=a.index;if(a.rgb!=null&&i>=ir&&i<=_r&&(a.rgb>>>24&255)===i)return a.rgb>>0;if(i===vt.ByLayer||n===256)return ir<<24>>0;if(i===vt.ByBlock||n===0)return sr<<24>>0;if(i===vt.None)return _r<<24>>0;if(i===vt.TrueColor){const d=a.rgb!=null?a.rgb&16777215:void 0;if(d!=null)return(Ro<<24|d)>>0}return i===vt.ForegroundColor?(wn<<24|7)>>0:i===vt.Entities&&n>0&&n<256||n>0&&n<256?(wn<<24|n&255)>>0:sr<<24>>0}function So(a){if(a==null)return;const t=a.method,i=a.method!=null&&t!==0?t:a.rgb>>>24&255,n=a.index;if(!(i===vt.ByLayer||i===vt.ByBlock||i===vt.None||n===256)){if(i===vt.ForegroundColor)return 7;if(i===vt.TrueColor)return a.rgb==null?void 0:a.rgb&16777215;if(n>=1&&n<=255)return n;if(n!==0&&a.rgb!=null){const d=a.rgb&16777215;if(d!==0)return d}}}const Lo="*MODEL_SPACE",Yo="*PAPER_SPACE",Gn=a=>a&&a.toUpperCase()==Lo,No=a=>a&&a.toUpperCase().startsWith(Yo),yt=a=>a.toString(16).toUpperCase(),Ke=a=>{const t=new Array(a.length);for(let i=0;i<a.length;i++)t[i]=a[i].toString(16).toUpperCase().padStart(2,"0");return t.join("")},Go=a=>{if(!a||a.length<98)return null;const t=new DataView(a.buffer,a.byteOffset,a.byteLength),i=_=>({x:t.getFloat64(_,!0),y:t.getFloat64(_+8,!0),z:t.getFloat64(_+16,!0)}),n=i(2),d=i(50);return[n.x,n.y,n.z,d.x,d.y,d.z].every(Number.isFinite)?{upperLeft:n,lowerRight:d}:null};class Wo{constructor(t){nt(this,"libredwg"),nt(this,"layers",new Map),nt(this,"ltypes",new Map),nt(this,"classes",[]),nt(this,"unknownEntityCount"),this.libredwg=t,this.unknownEntityCount=0}prepare(t,i=!1){(i||this.layers.size==0)&&(this.layers.clear(),t.tables.LAYER.entries.forEach(n=>{this.layers.set(n.handle,n.name)})),(i||this.ltypes.size==0)&&(this.ltypes.clear(),t.tables.LTYPE.entries.forEach(n=>{this.ltypes.set(n.handle,n.name)})),this.classes=t.classes,this.unknownEntityCount=0}setClasses(t){this.classes=t}clear(){this.layers.clear(),this.ltypes.clear(),this.classes=[],this.unknownEntityCount=0}convert(t){const i=this.libredwg,n=i.dwg_object_to_entity(t),d=i.dwg_object_to_entity_tio(t);if(n&&d){const _=this.getCommonAttrs(n),u=i.dwg_object_get_fixedtype(t);if(u==L.DWG_TYPE_3DFACE)return this.convert3dFace(d,_);if(u==L.DWG_TYPE_3DSOLID)return this.convert3dSolid(d,_);if(u==L.DWG_TYPE_ARC)return this.convertArc(d,_);if(u==L.DWG_TYPE_ARCALIGNEDTEXT)return this.convertArcAlignedText(d,_);if(u==L.DWG_TYPE_ATTDEF)return this.convertAttdef(d,_);if(u==L.DWG_TYPE_CIRCLE)return this.convertCircle(d,_);if(u==L.DWG_TYPE_DIMENSION_ALIGNED)return this.convertAlignedDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_LINEAR)return this.convertRotatedDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_ANG2LN)return this.convert2LineAngularDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(d,_);if(u==L.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(d,_);if(u==L.DWG_TYPE_ELLIPSE)return this.convertEllise(d,_);if(u==L.DWG_TYPE_HATCH)return this.convertHatch(d,_);if(u==L.DWG_TYPE_IMAGE)return this.convertImage(d,_);if(u==L.DWG_TYPE_INSERT)return this.convertInsert(d,_);if(u==L.DWG_TYPE_LEADER)return this.convertLeader(d,_);if(u==L.DWG_TYPE_LINE)return this.convertLine(d,_);if(u==L.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(d,_);if(u==L.DWG_TYPE_MLINE)return this.convertMLine(d,_);if(u==L.DWG_TYPE_MULTILEADER)return this.convertMultiLeader(d,_);if(u==L.DWG_TYPE_MTEXT)return this.convertMText(d,_);if(u==L.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(d,_);if(u==L.DWG_TYPE_OLEFRAME)return this.convertOleFrame(d,_);if(u==L.DWG_TYPE_POINT)return this.convertPoint(d,_);if(u==L.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(d,_,t);if(u==L.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(d,_,t);if(u==L.DWG_TYPE_PROXY_ENTITY)return this.convertProxyEntity(d,_,t);if(u==L.DWG_TYPE_RAY)return this.convertRay(d,_);if(u==L.DWG_TYPE_SECTIONOBJECT)return this.convertSection(d,_);if(u==L.DWG_TYPE_SHAPE)return this.convertShape(d,_);if(u==L.DWG_TYPE_SOLID)return this.convertSolid(d,_);if(u==L.DWG_TYPE_TRACE)return this.convertTrace(d,_);if(u==L.DWG_TYPE_SPLINE)return this.convertSpline(d,_);if(u==L.DWG_TYPE_TABLE)return this.convertTable(d,_);if(u==L.DWG_TYPE_TEXT)return this.convertText(d,_);if(u==L.DWG_TYPE_TOLERANCE)return this.convertTolerance(d,_);if(u==L.DWG_TYPE_VIEWPORT)return this.convertViewport(d,_);if(u==L.DWG_TYPE_WIPEOUT)return this.convertWipeout(d,_);if(u==L.DWG_TYPE_XLINE)return this.convertXline(d,_);u===L.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),u=n.dwg_dynapi_entity_data(t,"corner3"),f=n.dwg_dynapi_entity_data(t,"corner4"),h=n.dwg_dynapi_entity_data(t,"invis_flags");return{type:"3DFACE",...i,corner1:d,corner2:_,corner3:u,corner4:f,flag:h}}convert3dSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"version"),_=n.dwg_dynapi_entity_data(t,"acis_empty"),u=n.dwg_dynapi_entity_data(t,"acis_data"),f=n.dwg_dynapi_entity_data(t,"has_revision_guid"),h=n.dwg_dynapi_entity_data(t,"history_id"),A=n.dwg_ref_get_id(h),T={type:"3DSOLID",subclassMarker:"AcDb3dSolid",...i};if(d&&(T.version=d),T.satCache=_,u&&(T.data=u),f){const v=n.dwg_dynapi_entity_field_offset(t,"revision_guid");if(v>=0){const P=n.UTF8ToString(t+v,38);P&&(T.guid=P)}}return A&&(T.historyObjectSoftId=A),T}convertArc(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),u=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ARC",...i,thickness:u,center:d,radius:_,startAngle:h,endAngle:A,extrusionDirection:f}}convertArcAlignedText(t,i){const n=this.libredwg,d=(A,T=0)=>{const v=n.dwg_dynapi_entity_data(t,A);if(typeof v=="number"&&Number.isFinite(v))return v;if(typeof v=="string"&&v.trim()!==""){const P=Number(v);if(Number.isFinite(P))return P}return T},_=n.dwg_dynapi_entity_data(t,"center"),u=n.dwg_dynapi_entity_data(t,"extrusion"),f=n.dwg_dynapi_entity_data(t,"arc_handle"),h=d("xscale",1);return{type:"ARCALIGNEDTEXT",...i,text:n.dwg_dynapi_entity_data(t,"text_value")??"",textSize:d("text_size"),xScale:h>0?h:1,characterSpacing:d("char_spacing"),styleName:n.dwg_dynapi_entity_data(t,"style")??"",fontName:n.dwg_dynapi_entity_data(t,"font_name")??"",bigFontName:n.dwg_dynapi_entity_data(t,"bigfont_name")??"",offsetFromArc:d("offset_from_arc"),rightOffset:d("right_offset"),leftOffset:d("left_offset"),center:_??{x:0,y:0,z:0},radius:n.dwg_dynapi_entity_data(t,"radius")??0,startAngle:n.dwg_dynapi_entity_data(t,"start_angle")??0,endAngle:n.dwg_dynapi_entity_data(t,"end_angle")??0,extrusionDirection:u??{x:0,y:0,z:1},rawTextColor:n.dwg_dynapi_entity_data(t,"color")??256,characterSet:n.dwg_dynapi_entity_data(t,"character_set")??0,pitchAndFamily:n.dwg_dynapi_entity_data(t,"pitch_and_family")??0,isShx:(n.dwg_dynapi_entity_data(t,"is_shx")??0)!==0,isBold:(n.dwg_dynapi_entity_data(t,"is_bold")??0)!==0,isItalic:(n.dwg_dynapi_entity_data(t,"is_italic")??0)!==0,isUnderlined:(n.dwg_dynapi_entity_data(t,"is_underlined")??0)!==0,alignment:n.dwg_dynapi_entity_data(t,"alignment")??0,isReverse:(n.dwg_dynapi_entity_data(t,"is_reverse")??0)!==0,wizardFlag:n.dwg_dynapi_entity_data(t,"wizard_flag")??0,textPosition:n.dwg_dynapi_entity_data(t,"text_position")??1,textDirection:n.dwg_dynapi_entity_data(t,"text_direction")??1,arcHandle:f?n.dwg_ref_get_id(f)??"":""}}convertEmbeddedMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,i,"attachment"),_=n.dwg_dynapi_subclass_data(t,i,"ins_pt"),u=n.dwg_dynapi_subclass_data(t,i,"x_axis_dir"),f=n.dwg_dynapi_subclass_data(t,i,"rect_height"),h=n.dwg_dynapi_subclass_data(t,i,"rect_width"),A=n.dwg_dynapi_subclass_data(t,i,"extents_height"),T=n.dwg_dynapi_subclass_data(t,i,"extents_width");return{insertionPoint:_,rectHeight:f,rectWidth:h,extentsHeight:A,extentsWidth:T,attachmentPoint:d,direction:u}}convertAttdef(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"default_value"),_=this.convertTextBase(t);_.text=d;const u=n.dwg_dynapi_entity_data(t,"prompt"),f=n.dwg_dynapi_entity_data(t,"tag"),h=n.dwg_dynapi_entity_data(t,"flags"),A=n.dwg_dynapi_entity_data(t,"field_length"),T=n.dwg_dynapi_entity_data(t,"lock_position_flag"),v=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),P=n.dwg_dynapi_entity_data(t,"is_really_locked"),m=n.dwg_dynapi_entity_data(t,"mtext_type"),D=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTDEF",...i,text:this.convertTextBase(t),prompt:u,tag:f,flags:h,fieldLength:A,lockPositionFlag:T>0,duplicateRecordCloningFlag:v>0,mtextFlag:m,isReallyLocked:P>0,alignmentPoint:D,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertAttrib(t,i){const n=this.libredwg,d=this.convertTextBase(t),_=n.dwg_dynapi_entity_data(t,"tag"),u=n.dwg_dynapi_entity_data(t,"flags"),f=n.dwg_dynapi_entity_data(t,"field_length"),h=n.dwg_dynapi_entity_data(t,"lock_position_flag"),A=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),T=n.dwg_dynapi_entity_data(t,"mtext_type"),v=n.dwg_dynapi_entity_data(t,"is_really_locked"),P=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTRIB",...i,text:d,tag:_,flags:u,fieldLength:f,lockPositionFlag:!!h,duplicateRecordCloningFlag:!!A,mtextFlag:T,isReallyLocked:!!v,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...P,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertCircle(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),u=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"CIRCLE",...i,thickness:u,center:d,radius:_,extrusionDirection:f}}convertAlignedDimension(t,i){return this.convertLinearOrAlignedDimension(t,i,"AcDbAlignedDimension")}convertRotatedDimension(t,i){return this.convertLinearOrAlignedDimension(t,i,"AcDbRotatedDimension")}convertLinearOrAlignedDimension(t,i,n){const d=this.libredwg,_=this.getDimensionCommonAttrs(t),u=d.dwg_dynapi_entity_data(t,"clone_ins_pt"),f=d.dwg_dynapi_entity_data(t,"xline1_pt"),h=d.dwg_dynapi_entity_data(t,"xline2_pt"),A=n==="AcDbRotatedDimension"?d.dwg_dynapi_entity_data(t,"dim_rotation"):0,T=d.dwg_dynapi_entity_data(t,"oblique_angle");return{subclassMarker:n,...i,..._,insertionPoint:u,subDefinitionPoint1:f,subDefinitionPoint2:h,rotationAngle:A??0,obliqueAngle:T}}convert3PointAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1_pt"),u=n.dwg_dynapi_entity_data(t,"xline2_pt"),f=n.dwg_dynapi_entity_data(t,"center_pt"),h=n.dwg_dynapi_entity_data(t,"xline2end_pt");return{subclassMarker:"AcDb3PointAngularDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:u,centerPoint:f,arcPoint:h}}convert2LineAngularDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1start_pt"),u=n.dwg_dynapi_entity_data(t,"xline1end_pt"),f=n.dwg_dynapi_entity_data(t,"xline2start_pt"),h=n.dwg_dynapi_entity_data(t,"xline2end_pt"),A=n.dwg_dynapi_entity_data(t,"def_pt");return h&&(d.definitionPoint=h),{subclassMarker:"AcDb2LineAngularDimension",...i,...d,subDefinitionPoint1:_??u??A??h,subDefinitionPoint2:f??h??A??u,centerPoint:A??f??u??h,arcPoint:h??d.definitionPoint}}convertDiameterDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),u=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbDiametricDimension",...i,...d,centerPoint:_,leaderLength:u}}convertOrdinateDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"feature_location_pt"),u=n.dwg_dynapi_entity_data(t,"leader_endpt");return{subclassMarker:"AcDbOrdinateDimension",...i,...d,subDefinitionPoint1:_,subDefinitionPoint2:u}}convertRadiusDimension(t,i){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),u=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbRadialDimension",...i,...d,centerPoint:_,leaderLength:u}}convertEllise(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"sm_axis"),u=n.dwg_dynapi_entity_data(t,"extrusion"),f=n.dwg_dynapi_entity_data(t,"axis_ratio"),h=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ELLIPSE",...i,center:d,majorAxisEndPoint:_,extrusionDirection:u,axisRatio:f,startAngle:h,endAngle:A}}convertHatch(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"extrusion"),_=n.dwg_dynapi_entity_data(t,"name"),u=n.dwg_dynapi_entity_data(t,"is_solid_fill"),f=n.dwg_dynapi_entity_data(t,"is_associative"),h=n.dwg_dynapi_entity_data(t,"num_paths"),A=n.dwg_dynapi_entity_data(t,"paths"),T=n.dwg_ptr_to_hatch_path_array(A,h),v=n.dwg_dynapi_entity_data(t,"style"),P=n.dwg_dynapi_entity_data(t,"pattern_type"),m=n.dwg_dynapi_entity_data(t,"angle"),D=n.dwg_dynapi_entity_data(t,"scale_spacing"),w=n.dwg_dynapi_entity_data(t,"num_deflines"),I=n.dwg_dynapi_entity_data(t,"deflines"),S=n.dwg_ptr_to_hatch_defline_array(I,w),G=n.dwg_dynapi_entity_data(t,"pixel_size"),M=n.dwg_dynapi_entity_data(t,"num_seeds"),b=n.dwg_dynapi_entity_data(t,"seeds"),k=n.dwg_ptr_to_point2d_array(b,M),$={...i,extrusionDirection:d,patternName:_,solidFill:u?Dn.SolidFill:Dn.PatternFill,associativity:f?Rn.Associative:Rn.NonAssociative,numberOfBoundaryPaths:h,boundaryPaths:this.convertHatchBoundaryPaths(T),hatchStyle:v,patternType:P,patternAngle:m,patternScale:D,numberOfDefinitionLines:w,definitionLines:S.map(U=>({angle:U.angle,base:U.pt0,offset:U.offset,numberOfDashLengths:U.dashes.length,dashLengths:U.dashes})),pixelSize:G,numberOfSeedPoints:M,seedPoints:k};if(n.dwg_dynapi_entity_data(t,"is_gradient_fill")>0){const U=n.dwg_dynapi_entity_data(t,"gradient_name"),Z=n.dwg_dynapi_entity_data(t,"gradient_angle"),rt=n.dwg_dynapi_entity_data(t,"gradient_shift"),dt=n.dwg_dynapi_entity_data(t,"gradient_tint"),Y=n.dwg_dynapi_entity_data(t,"single_color_gradient"),F=n.dwg_dynapi_entity_data(t,"colors"),ct=n.dwg_ptr_to_hatch_gradient_color_array(F,Y==1?1:2);return{type:"HATCH",...$,gradientFlag:Er.Gradient,gradientColorFlag:Y==1?Sn.OneColor:Sn.TwoColor,gradientName:U,gradientRotation:Z,gradientDefinition:rt,colorTint:dt,gradientColors:ct}}else return{type:"HATCH",...$}}convertHatchBoundaryPaths(t){return t.filter(n=>n.num_segs_or_paths>0).map(n=>{const d={boundaryPathTypeFlag:n.flag};if(n.flag&2)return{...d,hasBulge:n.bulges_present,isClosed:n.closed,numberOfVertices:n.num_segs_or_paths,vertices:n.polyline_paths.map(_=>({x:_.point.x,y:_.point.y,bulge:_.bulge}))};{const _=n.segs.map(u=>{if(u.curve_type==Xe.Line)return{type:He.Line,start:u.first_endpoint,end:u.second_endpoint};if(u.curve_type==Xe.CircularArc)return{type:He.Circular,center:u.center,radius:u.radius,startAngle:u.start_angle,endAngle:u.end_angle,isCCW:u.is_ccw};if(u.curve_type==Xe.EllipticArc)return{type:He.Elliptic,center:u.center,end:u.endpoint,lengthOfMinorAxis:u.minor_major_ratio,startAngle:u.start_angle,endAngle:u.end_angle,isCCW:u.is_ccw};if(u.curve_type==Xe.Spline)return{type:He.Spline,degree:u.degree,isRational:u.is_rational,isPeriodic:u.is_periodic,numberOfKnots:u.num_knots,numberOfControlPoints:u.num_control_points,knots:u.knots,controlPoints:u.control_points,numberOfFitData:u.num_fitpts,fitDatum:u.fitpts,startTangent:u.start_tangent,endTangent:u.end_tangent}}).filter(u=>u!=null);return{...d,numberOfEdges:_.length,edges:_}}})}convertImage(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),u=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),T=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),P=n.dwg_dynapi_entity_data(t,"contrast"),m=n.dwg_dynapi_entity_data(t,"fade"),D=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),I=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),G=n.dwg_ptr_to_point3d_array(S,I),M=n.dwg_dynapi_entity_data(t,"imagedef"),b=n.dwg_ref_get_id(M)??"",k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),$=n.dwg_ref_get_id(k)??"";return{type:"IMAGE",...i,version:d,position:_,uPixel:u,vPixel:f,imageSize:h,imageDefHandle:b,flags:A,clipping:T,brightness:v,contrast:P,fade:m,imageDefReactorHandle:$,clippingBoundaryType:w,countBoundaryPoints:I,clippingBoundaryPath:G,clipMode:D}}convertInsert(t,i){const n=this.libredwg;let d="";const _=n.dwg_dynapi_entity_data(t,"block_header");if(_){const I=n.dwg_ref_get_object(_);if(I){const S=n.dwg_object_to_object_tio(I);S&&(d=n.dwg_entity_block_header_get_block(S).name)}}d||(d=n.dwg_dynapi_entity_data(t,"block_name"));const u=n.dwg_dynapi_entity_data(t,"ins_pt"),f=n.dwg_dynapi_entity_data(t,"scale"),h=n.dwg_dynapi_entity_data(t,"rotation"),A=n.dwg_dynapi_entity_data(t,"num_cols"),T=n.dwg_dynapi_entity_data(t,"num_rows"),v=n.dwg_dynapi_entity_data(t,"col_spacing"),P=n.dwg_dynapi_entity_data(t,"row_spacing"),m=n.dwg_dynapi_entity_data(t,"extrusion"),D=n.dwg_entity_insert_get_attribs(t),w=[];return D.forEach(I=>{const S=n.dwg_object_to_entity(I),G=n.dwg_object_to_entity_tio(I);if(S&&G){const M=this.getCommonAttrs(S);n.dwg_object_get_fixedtype(I)==L.DWG_TYPE_ATTRIB&&w.push(this.convertAttrib(G,M))}}),{type:"INSERT",...i,name:d,insertionPoint:u,xScale:f?f.x:1,yScale:f?f.y:1,zScale:f?f.z:1,rotation:h,columnCount:A,rowCount:T,columnSpacing:v,rowSpacing:P,extrusionDirection:m,attribs:w}}convertLeader(t,i){const n=this.libredwg;let d="";try{d=n.dwg_entity_get_dimstyle_name(t)||""}catch{d=""}const u=n.dwg_dynapi_entity_data(t,"arrowhead_on")>0,f=n.dwg_dynapi_entity_data(t,"path_type"),h=n.dwg_dynapi_entity_data(t,"annot_type"),A=n.dwg_dynapi_entity_data(t,"hookline_dir"),T=n.dwg_dynapi_entity_data(t,"hookline_on"),v=n.dwg_dynapi_entity_data(t,"box_height"),P=n.dwg_dynapi_entity_data(t,"box_width"),m=n.dwg_dynapi_entity_data(t,"num_points"),D=n.dwg_dynapi_entity_data(t,"points"),w=m>0?n.dwg_ptr_to_point3d_array(D,m):[],I=n.dwg_dynapi_entity_data(t,"byblock_color"),S=n.dwg_dynapi_entity_data(t,"extrusion"),G=n.dwg_dynapi_entity_data(t,"x_direction"),M=n.dwg_dynapi_entity_data(t,"inspt_offset"),b=n.dwg_dynapi_entity_data(t,"endptproj");return{type:"LEADER",...i,styleName:d,isArrowheadEnabled:u,isSpline:f>0,leaderCreationFlag:h,isHooklineSameDirection:A>0,isHooklineExists:T>0,textHeight:v,textWidth:P,numberOfVertices:m,vertices:w,byBlockColor:I,normal:S,horizontalDirection:G,offsetFromBlock:M,offsetFromAnnotation:b}}convertLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"start"),_=n.dwg_dynapi_entity_data(t,"end"),u=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"LINE",...i,thickness:u,startPoint:d,endPoint:_,extrusionDirection:f}}convertLWPolyline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"num_points"),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"const_width"),f=n.dwg_dynapi_entity_data(t,"elevation"),h=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion"),T=[],v=n.dwg_dynapi_entity_data(t,"num_points"),P=n.dwg_dynapi_entity_data(t,"points"),m=n.dwg_ptr_to_point2d_array(P,v),D=n.dwg_dynapi_entity_data(t,"num_bulges"),w=n.dwg_dynapi_entity_data(t,"bulges"),I=n.dwg_ptr_to_double_array(w,D),S=n.dwg_dynapi_entity_data(t,"num_widths")??0,G=n.dwg_dynapi_entity_data(t,"widths"),M=S>0&&G?n.dwg_ptr_to_double_array(G,S*2):[];return m.forEach((b,k)=>{const $={id:k,x:b.x,y:b.y,bulge:I.length>k?I[k]:0};k<S&&M.length>=(k+1)*2&&($.startWidth=M[k*2],$.endWidth=M[k*2+1]),T.push($)}),{type:"LWPOLYLINE",...i,numberOfVertices:d,flag:_,constantWidth:u,elevation:f,thickness:h,extrusionDirection:A,vertices:T}}convertMLine(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"scale"),_=n.dwg_dynapi_entity_data(t,"flags"),u=n.dwg_dynapi_entity_data(t,"justification"),f=n.dwg_dynapi_entity_data(t,"base_point"),h=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"num_lines"),T=n.dwg_dynapi_entity_data(t,"num_verts"),v=n.dwg_dynapi_entity_data(t,"verts"),P=n.dwg_ptr_to_mline_vertex_array(v,T),m=[];return P.forEach(D=>{m.push({vertex:D.vertex,vertexDirection:D.vertex_direction,miterDirection:D.miter_direction,numberOfLines:D.num_lines,lines:D.lines.map(w=>({numberOfSegmentParams:w.num_segparms,segmentParams:w.segparms,numberOfAreaFillParams:w.num_areafillparms,areaFillParams:w.areafillparms}))})}),{type:"MLINE",...i,scale:d,flags:_,justification:u,startPoint:f,extrusionDirection:h,numberOfLines:A,numberOfVertices:T,vertices:m,mlineStyle:""}}convertMultiLeader(t,i){const n=this.libredwg,d=J=>n.dwg_dynapi_entity_data(t,J),_=(J,j,jt)=>n.dwg_dynapi_subclass_data(J,j,jt),u=J=>n.dwg_ref_get_id(J),f=J=>J>0,h=J=>J!=null?fr(J):void 0,A=d("class_version"),T=u(d("mleaderstyle")),v=d("flags"),P=d("type"),m=h(d("line_color")),D=u(d("line_ltype")),w=d("line_linewt"),I=f(d("has_landing")),S=f(d("has_dogleg")),G=d("landing_dist"),M=u(d("arrow_handle")),b=d("arrow_size"),k=d("style_content"),$=u(d("text_style")),q=d("text_left"),U=d("text_right"),Z=d("text_angletype"),rt=d("text_alignment"),dt=h(d("text_color")),Y=f(d("has_text_frame")),F=u(d("block_style")),ct=h(d("block_color")),it=d("block_scale"),Yt=d("block_rotation"),It=d("style_attachment"),Tt=f(d("is_annotative")),wt=f(d("is_neg_textdir")),xt=d("ipe_alignment");let Ct=d("justification");const kt=d("attach_dir"),ft=d("attach_bottom"),Dt=d("attach_top"),zt=d("scale_factor"),Ot=d("num_arrowheads"),Nt=d("arrowheads"),Bt=n.dwg_dynapi_subclass_size("LEADER_ArrowHead"),Ft=[];for(let J=0;J<Ot;J++){const j=Nt+J*Bt;Ft.push({index:_(j,"LEADER_ArrowHead","is_default"),handle:u(_(j,"LEADER_ArrowHead","arrowhead"))??""})}const ne=d("num_blocklabels"),re=d("blocklabels"),ae=n.dwg_dynapi_subclass_size("LEADER_BlockLabel"),Ut=[];for(let J=0;J<ne;J++){const j=re+J*ae;Ut.push({id:u(_(j,"LEADER_BlockLabel","attdef")),index:_(j,"LEADER_BlockLabel","ui_index"),width:_(j,"LEADER_BlockLabel","width"),text:_(j,"LEADER_BlockLabel","label_text")})}const Q=t+n.dwg_dynapi_entity_field_offset(t,"ctx"),H=Q+n.dwg_dynapi_subclass_field_offset("MLEADER_AnnotContext","content"),$t=_(Q,"MLEADER_AnnotContext","scale_factor"),oe=_(Q,"MLEADER_AnnotContext","content_base"),Vt=_(Q,"MLEADER_AnnotContext","landing_gap"),he=_(Q,"MLEADER_AnnotContext","attach_dir"),Ne=_(Q,"MLEADER_AnnotContext","text_height"),Ge=_(Q,"MLEADER_AnnotContext","arrow_size"),We=_(Q,"MLEADER_AnnotContext","text_left"),Me=_(Q,"MLEADER_AnnotContext","text_right"),be=_(Q,"MLEADER_AnnotContext","text_angletype"),ge=_(Q,"MLEADER_AnnotContext","text_alignment"),Ae=f(_(Q,"MLEADER_AnnotContext","has_content_txt")),ye=f(_(Q,"MLEADER_AnnotContext","has_content_blk")),Te=_(Q,"MLEADER_AnnotContext","base"),xe=_(Q,"MLEADER_AnnotContext","base_dir"),Jt=_(Q,"MLEADER_AnnotContext","base_vert"),Gt=f(_(Q,"MLEADER_AnnotContext","is_normal_reversed"));let z,pe,Zt,Rt,ie,St,qt,Wt,Qt,se,Pe,pt,ve,_e,B,me,Ie,we,Ce,ze,Je;if(Ae){const J=_(H,"MLEADER_Content_MText","alignment");J!=null&&J!==0&&(Ct=J),pe=_(H,"MLEADER_Content_MText","normal"),qt=_(H,"MLEADER_Content_MText","location"),Zt=_(H,"MLEADER_Content_MText","rotation"),Wt=_(H,"MLEADER_Content_MText","direction"),Rt=_(H,"MLEADER_Content_MText","width"),ie=_(H,"MLEADER_Content_MText","line_spacing_factor"),St=_(H,"MLEADER_Content_MText","line_spacing_style"),z=_(H,"MLEADER_Content_MText","flow"),Qt=h(_(H,"MLEADER_Content_MText","bg_color")),se=_(H,"MLEADER_Content_MText","bg_scale"),Pe=_(H,"MLEADER_Content_MText","bg_transparency"),ve=f(_(H,"MLEADER_Content_MText","is_bg_fill")),pt=f(_(H,"MLEADER_Content_MText","is_bg_mask_fill")),_e=_(H,"MLEADER_Content_MText","col_type"),B=f(_(H,"MLEADER_Content_MText","is_height_auto")),me=_(H,"MLEADER_Content_MText","col_width"),Ie=_(H,"MLEADER_Content_MText","col_gutter"),we=f(_(H,"MLEADER_Content_MText","is_col_flow_reversed"));const j=_(H,"MLEADER_Content_MText","num_col_sizes"),jt=_(H,"MLEADER_Content_MText","col_sizes");j>0&&(Ce=n.dwg_ptr_to_double_array(jt,j)[0]),ze=f(_(H,"MLEADER_Content_MText","word_break")),Je=_(H,"MLEADER_Content_MText","default_text")}let De;if(ye){const J=_(H,"MLEADER_Content_Block","transform");De={blockContentId:u(_(H,"MLEADER_Content_Block","block_table")),normal:_(H,"MLEADER_Content_Block","normal"),position:_(H,"MLEADER_Content_Block","location"),scale:_(H,"MLEADER_Content_Block","scale"),rotation:_(H,"MLEADER_Content_Block","rotation"),color:h(_(H,"MLEADER_Content_Block","color")),transformationMatrix:J?n.dwg_ptr_to_double_array(J,16):void 0}}const l=_(Q,"MLEADER_AnnotContext","num_leaders"),de=_(Q,"MLEADER_AnnotContext","leaders"),et=n.dwg_dynapi_subclass_size("LEADER_Node"),cn=n.dwg_dynapi_subclass_size("LEADER_Line"),Ze=n.dwg_dynapi_subclass_size("LEADER_Break"),ke=[];for(let J=0;J<l;J++){const j=de+J*et,jt=f(_(j,"LEADER_Node","has_lastleaderlinepoint")),qe=f(_(j,"LEADER_Node","has_dogleg")),un=_(j,"LEADER_Node","num_breaks"),Re=_(j,"LEADER_Node","breaks"),Oe=[];for(let ut=0;ut<un;ut++){const ht=Re+ut*Ze;Oe.push({start:_(ht,"LEADER_Break","start"),end:_(ht,"LEADER_Break","end")})}const Qe=_(j,"LEADER_Node","num_lines"),st=_(j,"LEADER_Node","lines"),Ht=[];for(let ut=0;ut<Qe;ut++){const ht=st+ut*cn,te=_(ht,"LEADER_Line","num_points"),V=_(ht,"LEADER_Line","points"),je=te>0?n.dwg_ptr_to_point3d_array(V,te):[],Se=_(ht,"LEADER_Line","num_breaks"),Le=_(ht,"LEADER_Line","breaks"),Be=[];for(let Et=0;Et<Se;Et++){const Fe=Le+Et*Ze;Be.push({start:_(Fe,"LEADER_Break","start"),end:_(Fe,"LEADER_Break","end")})}Ht.push({vertices:je,leaderLineIndex:_(ht,"LEADER_Line","line_index"),breaks:Be.length>0?Be:void 0})}ke.push({lastLeaderLinePoint:jt?_(j,"LEADER_Node","lastleaderlinepoint"):void 0,lastLeaderLinePointSet:jt,doglegVector:qe?_(j,"LEADER_Node","dogleg_vector"):void 0,doglegVectorSet:qe,doglegLength:_(j,"LEADER_Node","dogleg_length"),breaks:Oe.length>0?Oe:void 0,leaderBranchIndex:_(j,"LEADER_Node","branch_index"),leaderLines:Ht})}return{type:"MULTILEADER",...i,subclassMarker:"AcDbMLeader",version:A,leaderStyleId:T,propertyOverrideFlag:v,leaderLineType:P,leaderLineColor:m,leaderLineTypeId:D,leaderLineWeight:w,landingEnabled:I,doglegEnabled:S,doglegLength:G,arrowheadId:M,arrowheadSize:b||Ge,contentType:k,textStyleId:$,textLeftAttachmentType:q||We,textRightAttachmentType:U||Me,textAngleType:Z||be,textAlignmentType:rt||ge,textColor:dt,textFrameEnabled:Y,landingGap:Vt,textAttachment:he,textFlowDirection:z,blockContentId:F,blockContentColor:ct,blockContentScale:it,blockContentRotation:Yt,blockContentConnectionType:It,annotativeScaleEnabled:Tt,arrowheadOverrides:Ft.length>0?Ft:void 0,blockAttributes:Ut.length>0?Ut:void 0,textDirectionNegative:wt,textAlignInIPE:xt,textAttachmentPoint:Ct,textAttachmentDirection:kt,bottomTextAttachmentDirection:ft,topTextAttachmentDirection:Dt,contentScale:zt||$t,contentBasePosition:oe,normal:pe,textHeight:Ne,textRotation:Zt,textWidth:Rt,textLineSpacingFactor:ie,textLineSpacingStyle:St,textAnchor:qt,textDirection:Wt,textBackgroundColor:Qt,textBackgroundScaleFactor:se,textBackgroundTransparency:Pe,textBackgroundColorOn:pt,textFillOn:ve,textColumnType:_e,textUseAutoHeight:B,textColumnWidth:me,textColumnGutterWidth:Ie,textColumnFlowReversed:we,textColumnHeight:Ce,textUseWordBreak:ze,textContent:Je,hasMText:Ae,hasBlock:ye,blockContent:De,planeOrigin:Te,planeXAxisDirection:xe,planeYAxisDirection:Jt,planeNormalReversed:Gt,leaderSections:ke.length>0?ke:void 0}}convertOle2Frame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"oleversion"),_=n.dwg_dynapi_entity_data(t,"oleclient"),u=n.dwg_dynapi_entity_data(t,"data_size");let f=n.dwg_dynapi_entity_data(t,"pt1"),h=n.dwg_dynapi_entity_data(t,"pt2");const A=n.dwg_dynapi_entity_data(t,"lock_aspect"),T=n.dwg_dynapi_entity_data(t,"type"),v=n.dwg_dynapi_entity_data(t,"mode"),P=n.dwg_entity_ole2frame_get_data(t),m=P?Ke(P):"";if(P){const D=Go(P);D&&(f=D.upperLeft,h=D.lowerRight)}return{type:"OLE2FRAME",...i,oleVersion:d,oleClient:_,dataSize:u,leftUpPoint:f,rightDownPoint:h,lockAspect:A,oleObjectType:T,tileModeDescriptor:v,binaryData:m}}convertOleFrame(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"flag"),_=n.dwg_dynapi_entity_data(t,"mode"),u=n.dwg_dynapi_entity_data(t,"data_size"),f=n.dwg_entity_oleframe_get_data(t),h=f?Ke(f):"";return{type:"OLEFRAME",...i,flag:d,mode:_,dataSize:u,binaryData:h}}convertMText(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_height"),u=n.dwg_dynapi_entity_data(t,"rect_height"),f=n.dwg_dynapi_entity_data(t,"rect_width"),h=n.dwg_dynapi_entity_data(t,"extents_width"),A=n.dwg_dynapi_entity_data(t,"extents_height"),T=n.dwg_dynapi_entity_data(t,"attachment"),v=n.dwg_dynapi_entity_data(t,"flow_dir"),P=n.dwg_dynapi_entity_data(t,"text"),m=n.dwg_entity_mtext_get_style_name(t),D=n.dwg_dynapi_entity_data(t,"extrusion"),w=n.dwg_dynapi_entity_data(t,"x_axis_dir"),I=n.dwg_dynapi_entity_data(t,"linespace_style"),S=n.dwg_dynapi_entity_data(t,"linespace_factor"),G=n.dwg_dynapi_entity_data(t,"bg_fill_flag"),M=n.dwg_dynapi_entity_data(t,"bg_fill_scale"),b=n.dwg_dynapi_entity_data(t,"bg_fill_color"),k=n.dwg_dynapi_entity_data(t,"bg_fill_trans"),$=G===1?So(b):void 0,q=n.dwg_dynapi_entity_data(t,"column_type"),U=n.dwg_dynapi_entity_data(t,"flow_reversed"),Z=n.dwg_dynapi_entity_data(t,"auto_height"),rt=n.dwg_dynapi_entity_data(t,"column_width"),dt=n.dwg_dynapi_entity_data(t,"gutter"),Y=n.dwg_dynapi_entity_data(t,"num_column_heights"),F=n.dwg_dynapi_entity_data(t,"column_heights"),ct=n.dwg_ptr_to_double_array(F,Y);return{type:"MTEXT",...i,insertionPoint:d,textHeight:_,rectHeight:u,rectWidth:f,extentsHeight:A,extentsWidth:h,attachmentPoint:T,drawingDirection:v,text:P,styleName:m,extrusionDirection:D,direction:w,rotation:0,lineSpacingStyle:I,lineSpacing:S,backgroundFill:G,fillBoxScale:M,...$!==void 0?{backgroundFillColor:$}:{},backgroundFillTransparency:k,columnType:q,columnFlowReversed:U,columnAutoHeight:Z,columnWidth:rt,columnGutter:dt,columnHeightCount:Y,columnHeights:ct}}convertPoint(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"x"),_=n.dwg_dynapi_entity_data(t,"y"),u=n.dwg_dynapi_entity_data(t,"z"),f=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"x_ang");return{type:"POINT",...i,position:{x:d,y:_,z:u},thickness:f,extrusionDirection:h,angle:A}}convertPolyline2d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),u=d.dwg_dynapi_entity_data(t,"curve_type"),f=d.dwg_dynapi_entity_data(t,"start_width"),h=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"elevation"),T=d.dwg_dynapi_entity_data(t,"thickness"),v=d.dwg_dynapi_entity_data(t,"extrusion"),P=d.dwg_entity_polyline_2d_get_vertices(n)??[];return{type:"POLYLINE2D",...i,flag:_,smoothType:u,startWidth:f,endWidth:h,elevation:A,thickness:T,extrusionDirection:v,vertices:P.map(m=>({x:m.point.x,y:m.point.y,z:m.point.z,startWidth:m.start_width,endWidth:m.end_width,bulge:m.bulge,flag:m.flag,tangentDirection:m.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),u=d.dwg_dynapi_entity_data(t,"curve_type"),f=d.dwg_dynapi_entity_data(t,"start_width"),h=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"extrusion"),T=d.dwg_entity_polyline_3d_get_vertices(n)??[];return{type:"POLYLINE3D",...i,flag:_,smoothType:u,startWidth:f,endWidth:h,extrusionDirection:A,vertices:T.map(v=>({x:v.point.x,y:v.point.y,z:v.point.z,flag:v.flag}))}}convertProxyEntity(t,i,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"proxy_id"),u=d.dwg_dynapi_entity_data(t,"class_id"),f=d.dwg_dynapi_entity_data(t,"data_numbits"),h=d.dwg_dynapi_entity_data(t,"version"),A=d.dwg_dynapi_entity_data(t,"from_dxf"),T=d.dwg_dynapi_entity_data(t,"num_objids"),v=d.dwg_entity_get_preview(n),P=(v==null?void 0:v.length)??0,m=d.dwg_entity_proxy_entity_get_entity_data(t),D=v?Ke(v):void 0,w=m?Ke(m):void 0;let I;if(T>0){const M=d.dwg_dynapi_entity_data(t,"objids");M&&(I=d.dwg_ptr_to_object_ref_array(M,T).map(k=>yt(k.absolute_ref)))}const S=this.getOriginalDxfName(u),G={type:"ACAD_PROXY_ENTITY",subclassMarker:"AcDbProxyEntity",...i,proxyEntityClassId:_||498,applicationEntityClassId:u};return S&&(G.originalDxfName=S),P>0&&(G.graphicsDataSize=P),D&&(G.graphicsData=D),f>0&&(G.entityDataSize=f),w&&(G.entityData=w),I&&I.length>0&&(G.linkedObjectIds=I),h&&(G.objectDrawingFormat=h),(A===0||A===1)&&(G.originalDataFormat=A),G}getOriginalDxfName(t){if(this.classes.length===0||t<0)return;const i=t>=500?t-500:t;if(i>=0&&i<this.classes.length)return this.classes[i].dxfName}convertRay(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"RAY",...i,firstPoint:d,unitDirection:_}}convertSection(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"state"),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"name"),f=n.dwg_dynapi_entity_data(t,"vert_dir"),h=n.dwg_dynapi_entity_data(t,"top_height"),A=n.dwg_dynapi_entity_data(t,"bottom_height"),T=n.dwg_dynapi_entity_data(t,"indicator_alpha"),v=n.dwg_dynapi_entity_data(t,"indicator_color"),P=n.dwg_dynapi_entity_data(t,"num_verts"),m=n.dwg_dynapi_entity_data(t,"verts"),D=P>0?n.dwg_ptr_to_point3d_array(m,P):[],w=n.dwg_dynapi_entity_data(t,"num_blverts"),I=n.dwg_dynapi_entity_data(t,"blverts"),S=w>0?n.dwg_ptr_to_point3d_array(I,w):[],G=n.dwg_dynapi_entity_data(t,"geometrySettingHardId"),M=n.dwg_ref_get_handle_absolute_ref(G)??0n;return{type:"SECTION",...i,state:d,flags:_,name:u,verticalDirection:f,topHeight:h,bottomHeight:A,indicatorTransparency:T,indicatorColor:v.rgb,numberOfVertices:P,vertices:D,numberOfBackLineVertices:w,backLineVertices:S,geometrySettingHardId:M}}convertShape(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"scale"),u=n.dwg_dynapi_entity_data(t,"rotation"),f=n.dwg_dynapi_entity_data(t,"width_factor"),h=n.dwg_dynapi_entity_data(t,"oblique_angle"),A=n.dwg_dynapi_entity_data(t,"thickness"),T=n.dwg_dynapi_entity_data(t,"extrusion"),v=n.dwg_dynapi_entity_data(t,"style_id"),P=n.dwg_entity_text_get_style_name(t);return{type:"SHAPE",subclassMarker:"AcDbShape",...i,thickness:A,insertionPoint:d,size:_,shapeNumber:v,styleName:P,rotation:u,xScale:f,obliqueAngle:h,extrusionDirection:T}}convertSolid(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),u=n.dwg_dynapi_entity_data(t,"corner3"),f=n.dwg_dynapi_entity_data(t,"corner4"),h=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"SOLID",...i,corner1:d,corner2:_,corner3:u,corner4:f,thickness:h,extrusionDirection:A}}convertTrace(t,i){return{...this.convertSolid(t,i),type:"TRACE"}}convertSpline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"splineflags"),_=n.dwg_dynapi_entity_data(t,"degree"),u=n.dwg_dynapi_entity_data(t,"knot_tol"),f=n.dwg_dynapi_entity_data(t,"num_knots"),h=n.dwg_dynapi_entity_data(t,"knots"),A=n.dwg_ptr_to_double_array(h,f),T=n.dwg_dynapi_entity_data(t,"fit_tol"),v=n.dwg_dynapi_entity_data(t,"num_fit_pts"),P=n.dwg_dynapi_entity_data(t,"fit_pts"),m=n.dwg_ptr_to_point3d_array(P,v),D=n.dwg_dynapi_entity_data(t,"weighted"),w=n.dwg_dynapi_entity_data(t,"ctrl_tol"),I=n.dwg_dynapi_entity_data(t,"num_ctrl_pts"),S=n.dwg_dynapi_entity_data(t,"ctrl_pts"),G=n.dwg_ptr_to_point4d_array(S,I),M=n.dwg_dynapi_entity_data(t,"beg_tan_vec"),b=n.dwg_dynapi_entity_data(t,"end_tan_vec");return{type:"SPLINE",...i,flag:d,degree:_,numberOfKnots:f,numberOfControlPoints:I,numberOfFitPoints:v,knotTolerance:u,controlTolerance:w,fitTolerance:T,startTangent:M,endTangent:b,knots:A,weights:D?G.map(k=>k.w):void 0,controlPoints:G.map(k=>({x:k.x,y:k.y,z:k.z})),fitPoints:m}}convertTable(t,i){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,"ldata","name"),_=n.dwg_dynapi_entity_data(t,"ins_pt"),u=n.dwg_dynapi_entity_data(t,"horiz_direction"),f=n.dwg_dynapi_entity_data(t,"flag_for_table_value"),h=n.dwg_dynapi_entity_data(t,"num_rows"),A=n.dwg_dynapi_entity_data(t,"num_cols"),T=n.dwg_dynapi_entity_data(t,"row_heights"),v=n.dwg_ptr_to_double_array(T,h),P=n.dwg_dynapi_entity_data(t,"col_widths"),m=n.dwg_ptr_to_double_array(P,A),D=n.dwg_dynapi_entity_data(t,"tablestyle"),w=n.dwg_ref_get_id(D)??"",I=n.dwg_dynapi_entity_data(t,"block_header"),S=n.dwg_ref_get_id(I)??"",G=n.dwg_dynapi_entity_data(t,"table_flag_override"),M=n.dwg_dynapi_entity_data(t,"border_color_overrides_flag"),b=n.dwg_dynapi_entity_data(t,"border_lineweight_overrides_flag"),k=n.dwg_dynapi_entity_data(t,"border_visibility_overrides_flag"),$=n.dwg_dynapi_entity_data(t,"num_cells"),q=n.dwg_dynapi_entity_data(t,"cells"),U=n.dwg_ptr_to_table_cell_array(q,$);return{type:"ACAD_TABLE",...i,name:d,startPoint:_,directionVector:u,tableValue:f,rowCount:h,columnCount:A,overrideFlag:G,borderColorOverrideFlag:M,borderLineWeightOverrideFlag:b,borderVisibilityOverrideFlag:k,rowHeightArr:v,columnWidthArr:m,tableStyleId:w,blockRecordHandle:S,cells:this.convertTableCells(U),bmpPreview:""}}convertTableCells(t){return t.map(i=>{var n,d;return{text:i.text_value,attachmentPoint:i.cell_alignment,textStyle:i.text_style?String(i.text_style):void 0,rotation:i.rotation,cellType:i.type,flagValue:i.flags,mergedValue:i.is_merged_value,autoFit:i.is_autofit_flag,topBorderVisibility:!!i.top_visibility,bottomBorderVisibility:!!i.bottom_visibility,leftBorderVisibility:!!i.left_visibility,rightBorderVisibility:!!i.right_visibility,overrideFlag:i.cell_flag_override,virtualEdgeFlag:i.virtual_edge_flag,blockTableRecordId:i.block_handle?String(i.block_handle.absolute_ref??""):void 0,blockScale:i.block_scale,blockAttrNum:((n=i.attr_defs)==null?void 0:n.length)??0,attrDefineId:(d=i.attr_defs)==null?void 0:d.map(_=>{var u;return String(((u=_.attdef)==null?void 0:u.absolute_ref)??"")}),textHeight:i.text_height??0,extendedCellFlags:i.additional_data_flag}})}convertTextBase(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"text_value"),d=i.dwg_dynapi_entity_data(t,"thickness"),_=i.dwg_dynapi_entity_data(t,"ins_pt"),u=i.dwg_dynapi_entity_data(t,"alignment_pt"),f=i.dwg_dynapi_entity_data(t,"rotation"),h=i.dwg_dynapi_entity_data(t,"height"),A=i.dwg_dynapi_entity_data(t,"width_factor"),T=i.dwg_dynapi_entity_data(t,"oblique_angle"),v=i.dwg_entity_text_get_style_name(t),P=i.dwg_dynapi_entity_data(t,"generation"),m=i.dwg_dynapi_entity_data(t,"horiz_alignment"),D=i.dwg_dynapi_entity_data(t,"vert_alignment"),w=i.dwg_dynapi_entity_data(t,"elevation"),I=i.dwg_dynapi_entity_data(t,"extrusion");return{text:n,thickness:d,startPoint:_,endPoint:u,textHeight:h,rotation:f,xScale:A,obliqueAngle:T,styleName:v,generationFlag:P,halign:m,valign:D,elevation:w,extrusionDirection:I}}convertText(t,i){return{type:"TEXT",...i,...this.convertTextBase(t)}}convertTolerance(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_value"),u=n.dwg_dynapi_entity_data(t,"x_direction"),f=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_entity_get_dimstyle_name(t);return{type:"TOLERANCE",...i,styleName:h,insertionPoint:d,text:_,extrusionDirection:f,xAxisDirection:u}}convertViewport(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"width"),u=n.dwg_dynapi_entity_data(t,"height"),f=n.dwg_dynapi_entity_data(t,"on_off"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"SNAPBASE"),T=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),v=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),P=n.dwg_dynapi_entity_data(t,"VIEWDIR"),m=n.dwg_dynapi_entity_data(t,"view_target"),D=n.dwg_dynapi_entity_data(t,"lens_length"),w=n.dwg_dynapi_entity_data(t,"front_clip_z"),I=n.dwg_dynapi_entity_data(t,"back_clip_z"),S=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),G=n.dwg_dynapi_entity_data(t,"SNAPANG"),M=n.dwg_dynapi_entity_data(t,"twist_angle"),b=n.dwg_dynapi_entity_data(t,"circle_zoom"),k=n.dwg_dynapi_entity_data(t,"num_frozen_layers");let $;if(k>0){const $t=n.dwg_dynapi_entity_data(t,"frozen_layers");$t&&($=n.dwg_ptr_to_object_ref_ptr_array($t,k).map(Vt=>n.dwg_ref_get_id(Vt)).filter(Vt=>!!Vt))}const q=n.dwg_dynapi_entity_data(t,"status_flag"),U=n.dwg_dynapi_entity_data(t,"clip_boundary"),Z=n.dwg_ref_get_id(U),rt=n.dwg_dynapi_entity_data(t,"style_sheet"),dt=n.dwg_dynapi_entity_data(t,"render_mode"),Y=n.dwg_dynapi_entity_data(t,"UCSVP"),F=n.dwg_dynapi_entity_data(t,"ucsorg"),ct=n.dwg_dynapi_entity_data(t,"ucsxdir"),it=n.dwg_dynapi_entity_data(t,"ucsydir"),Yt=n.dwg_dynapi_entity_data(t,"named_ucs"),It=n.dwg_ref_get_id(Yt),Tt=n.dwg_dynapi_entity_data(t,"base_ucs"),wt=n.dwg_ref_get_id(Tt),xt=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),Ct=n.dwg_dynapi_entity_data(t,"ucs_elevation"),kt=n.dwg_dynapi_entity_data(t,"shadeplot_mode"),ft=n.dwg_dynapi_entity_data(t,"use_default_lights"),Dt=n.dwg_dynapi_entity_data(t,"default_lighting_type"),zt=n.dwg_dynapi_entity_data(t,"brightness"),Ot=n.dwg_dynapi_entity_data(t,"contrast"),Nt=n.dwg_dynapi_entity_data(t,"grid_major"),Bt=n.dwg_dynapi_entity_data(t,"background"),Ft=n.dwg_ref_get_id(Bt),ne=n.dwg_dynapi_entity_data(t,"shadeplot"),re=n.dwg_ref_get_id(ne),ae=n.dwg_dynapi_entity_data(t,"visualstyle"),Ut=n.dwg_ref_get_id(ae),Q=n.dwg_dynapi_entity_data(t,"sun"),H=n.dwg_ref_get_id(Q);return{type:"VIEWPORT",...i,viewportCenter:d,width:_,height:u,status:f,viewportId:0,displayCenter:h,snapBase:A,snapSpacing:T,gridSpacing:v,viewDirection:P,targetPoint:m,perspectiveLensLength:D,frontClipZ:w,backClipZ:I,viewHeight:S,snapAngle:G,viewTwistAngle:M,circleZoomPercent:b,frozenLayerIds:$,statusBitFlags:q,clippingBoundaryId:Z,sheetName:rt,renderMode:dt,ucsPerViewport:Y,ucsOrigin:F,ucsXAxis:ct,ucsYAxis:it,ucsId:It??"",ucsBaseId:wt??"",orthographicType:xt,elevation:Ct,shadePlotMode:kt,majorGridFrequency:Nt,backgroundId:Ft??"",shadePlotId:re??"",visualStyleId:Ut??"",isDefaultLighting:!!ft,defaultLightingType:Dt,brightness:zt,contrast:Ot,sunId:H??""}}convertWipeout(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),u=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),T=n.dwg_dynapi_entity_data(t,"clipping"),v=n.dwg_dynapi_entity_data(t,"brightness"),P=n.dwg_dynapi_entity_data(t,"contrast"),m=n.dwg_dynapi_entity_data(t,"fade"),D=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),I=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),G=n.dwg_ptr_to_point2d_array(S,I),M=n.dwg_dynapi_entity_data(t,"imagedef"),b=n.dwg_ref_get_absref(M)??0,k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),$=n.dwg_ref_get_absref(k)??0;return{type:"WIPEOUT",...i,version:d,position:_,uPixel:u,vPixel:f,imageSize:h,imageDefHandle:b,flags:A,clipping:T,brightness:v,contrast:P,fade:m,imageDefReactorHandle:$,clippingBoundaryType:w,countBoundaryPoints:I,clippingBoundaryPath:G,clipMode:D}}convertXline(t,i){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"XLINE",...i,firstPoint:d,unitDirection:_}}getDimensionCommonAttrs(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"class_version"),d=i.dwg_entity_get_block_name(t,"block"),_=i.dwg_dynapi_entity_data(t,"def_pt"),u=i.dwg_dynapi_entity_data(t,"text_midpt"),f=i.dwg_dynapi_entity_data(t,"attachmentPoint"),h=i.dwg_dynapi_entity_data(t,"flag"),A=i.dwg_dynapi_entity_data(t,"lspace_factor"),T=i.dwg_dynapi_entity_data(t,"lspace_factor"),v=i.dwg_dynapi_entity_data(t,"act_measurement"),P=i.dwg_dynapi_entity_data(t,"user_text"),m=i.dwg_dynapi_entity_data(t,"text_rotation"),D=i.dwg_dynapi_entity_data(t,"ins_rotation"),w=i.dwg_dynapi_entity_data(t,"extrusion"),I=i.dwg_entity_get_dimstyle_name(t);return{type:"DIMENSION",version:n,name:d,definitionPoint:_,textPoint:u,dimensionType:h,attachmentPoint:f,textLineSpacingStyle:A,textLineSpacingFactor:T||1,measurement:v,text:P,textRotation:m,ocsRotation:D,extrusionDirection:w,styleName:I}}getCommonAttrs(t){const i=this.libredwg,n=i.dwg_object_entity_get_color_object(t),d=n.method,_=n.index;let u;(d==194||(n.rgb>>>24&255)===194)&&(u=n.rgb&16777215);const f=this.getLayerName(t),h=i.dwg_object_entity_get_handle_object(t),A=i.dwg_object_entity_get_ownerhandle_object(t),T=i.dwg_object_entity_get_xdicobjhandle_object(t),v=this.getLtypeName(t),P=i.dwg_object_entity_get_line_weight(t),m=i.dwg_object_entity_get_ltype_scale(t),D=!i.dwg_object_entity_get_invisible(t),w=i.dwg_object_entity_get_xdata(t);return{handle:yt(h.value),ownerDictionaryHardId:yt(T.absolute_ref),ownerBlockRecordSoftId:yt(A.absolute_ref),layer:f,color:u,colorIndex:_,colorName:n.name,lineType:v,lineweight:P,lineTypeScale:m,isVisible:D,transparency:n.alpha,transparencyType:n.alpha_type,xdata:w}}getLayerName(t){const n=this.libredwg.dwg_object_entity_get_layer_object_ref(t);return this.layers.get(yt(n.handleref.value))??"0"}getLtypeName(t){const n=this.libredwg.dwg_object_entity_get_ltype_object_ref(t);return this.ltypes.get(yt(n.handleref.value))??""}}class dr{constructor(t){nt(this,"libredwg"),nt(this,"entityConverter"),nt(this,"orphanEntitiesByBlock",null),nt(this,"ownerlessOrphanIndices",null),nt(this,"orphanIndexDataPtr",null),nt(this,"layerPlotFlagSupported",!0),this.libredwg=t,this.entityConverter=new Wo(t)}convert(t){var i;this.entityConverter.clear(),this.orphanEntitiesByBlock=null,this.ownerlessOrphanIndices=null,this.orphanIndexDataPtr=t,this.layerPlotFlagSupported=!0;const n={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],GROUP:[],IMAGEDEF:[],LAYER_FILTER:[],LAYER_INDEX:[],LAYOUT:[],MLEADERSTYLE:[],SPATIAL_FILTER:[],XRECORD:[]},header:{},entities:[],classes:[]},d=this.libredwg;this.convertHeader(t,n.header),this.layerPlotFlagSupported=d.dwg_get_version_type(t).version>=22,this.convertClasses(t,n.classes),this.entityConverter.setClasses(n.classes);const _=d.dwg_get_num_objects(t);for(let h=0;h<_;h++){const A=d.dwg_get_object(t,h);if(A){const T=this.safeObjectTio(A);if(T)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_LAYER:{const P=this.convertLayer(T,A);n.tables.LAYER.entries.push(P),this.entityConverter.layers.set(P.handle,P.name)}break;case L.DWG_TYPE_LTYPE:{const P=this.convertLineType(T,A);n.tables.LTYPE.entries.push(P),this.entityConverter.ltypes.set(P.handle,P.name)}break}}}for(let h=0;h<_;h++){const A=d.dwg_get_object(t,h);if(A){const T=this.safeObjectTio(A);if(T)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_APPID:n.tables.APPID.entries.push(this.convertAppId(T));break;case L.DWG_TYPE_BLOCK_HEADER:{const P=this.convertBlockRecord(T,A);n.tables.BLOCK_RECORD.entries.push(P),(Gn(P.name)||No(P.name))&&P.entities.forEach(m=>{n.entities.push(m),m.type==="INSERT"&&m.attribs.forEach(D=>{n.entities.push(D)})})}break;case L.DWG_TYPE_DIMSTYLE:n.tables.DIMSTYLE.entries.push(this.convertDimStyle(T,A));break;case L.DWG_TYPE_STYLE:n.tables.STYLE.entries.push(this.convertStyle(T,A));break;case L.DWG_TYPE_VPORT:n.tables.VPORT.entries.push(this.convertViewport(T,A));break;case L.DWG_TYPE_DICTIONARY:n.objects.DICTIONARY.push(this.convertDictionary(T,A));break;case L.DWG_TYPE_GROUP:n.objects.GROUP.push(this.convertGroup(T,A));break;case L.DWG_TYPE_IMAGEDEF:n.objects.IMAGEDEF.push(this.convertImageDef(T,A));break;case L.DWG_TYPE_LAYERFILTER:n.objects.LAYER_FILTER.push(this.convertLayerFilter(T,A));break;case L.DWG_TYPE_LAYER_INDEX:n.objects.LAYER_INDEX.push(this.convertLayerIndex(T,A));break;case L.DWG_TYPE_LAYOUT:n.objects.LAYOUT.push(this.convertLayout(T,A));break;case L.DWG_TYPE_MLEADERSTYLE:n.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(T,A));break;case L.DWG_TYPE_SPATIAL_FILTER:n.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(T,A));break;case L.DWG_TYPE_XRECORD:n.objects.XRECORD.push(this.convertXRecord(T,A));break}}}const u=n.entities.filter(h=>h.type==="VIEWPORT");u.sort((h,A)=>{const T=parseInt(h.handle,16),v=parseInt(A.handle,16);return T-v}),u.forEach((h,A)=>{h.viewportId=A+1});const f=d.dwg_bmp(t);return(i=f==null?void 0:f.data)!=null&&i.length&&(n.thumbnailImage=f.data),n}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}safeObjectTio(t){const i=this.libredwg;try{if(i.dwg_object_get_supertype(t)!=Yn.DWG_SUPERTYPE_OBJECT)return null;const n=i.dwg_object_to_object_tio(t);return n||null}catch{return null}}convertHeader(t,i){const n=this.libredwg;wo.forEach(d=>{let _=d;(d=="DIMBLK"||d=="DIMBLK1"||d=="DIMBLK2")&&(_=_+"_T");let u=n.dwg_dynapi_header_data(t,_);d=="CELTYPE"||d=="CLAYER"||d=="CLAYER"||d=="DIMSTYLE"||d=="DIMTXSTY"||d=="TEXTSTYLE"?u=u?n.dwg_ref_get_object_name(u):"":d=="DRAGVS"&&(u=u?n.dwg_ref_get_absref(u)??2:2),i[d]=u})}convertClasses(t,i){const n=this.libredwg,d=n.dwg_get_num_classes(t);for(let _=0;_<d;_++){const u=n.dwg_get_class(t,_);i.push({dxfName:u.dxfname,cppName:u.cppname,appName:u.appname,capabilitiesFlag:u.proxyflag,instanceCount:u.num_instances,wasAProxyFlag:u.s_zombie,isAnEntityFlag:u.item_class_id===498})}}convertAppId(t){const i=this.libredwg,n=i.dwg_dynapi_entity_data(t,"name"),d=i.dwg_dynapi_entity_data(t,"flag");return{name:n,standardFlag:d}}convertBlockRecord(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_entity_block_header_get_block(t);_.name&&(d.name=_.name);const u=n.dwg_dynapi_entity_data(t,"num_owned"),f=n.dwg_dynapi_entity_data(t,"flag"),h=n.dwg_dynapi_entity_data(t,"description"),A=n.dwg_dynapi_entity_data(t,"base_pt"),T=n.dwg_dynapi_entity_data(t,"insert_units"),v=n.dwg_dynapi_entity_data(t,"explodable"),P=n.dwg_dynapi_entity_data(t,"block_scaling"),m=n.dwg_dynapi_entity_data(t,"layout"),D=n.dwg_ref_get_id(m)??"";let w;const I=n.dwg_entity_block_header_get_preview(t);I&&I.length>0&&(w=Ke(I));let S=this.convertEntities(i,d.handle);if(!S||S.length==0){S=[];const G=n.dwg_dynapi_entity_data(t,"entities");if(G){const M=n.dwg_ptr_to_object_ref_ptr_array(G,u),b=this.entityConverter;for(let k=0;k<u;k++){const $=n.dwg_ref_get_object(M[k]),q=b.convert($);q&&(q.ownerBlockRecordSoftId=d.handle,S.push(q))}}}if(this.orphanIndexDataPtr!=null){const G=this.convertOrphanOwnedEntities(this.orphanIndexDataPtr,i,d.handle,Gn(d.name)===!0);if(G.length)if(S.length===0)S=G;else{const M=new Set(S.map(b=>b.handle));for(const b of G)M.has(b.handle)||S.push(b)}}return{...d,flags:f,description:h,basePoint:A,layout:D,insertionUnits:T,explodability:v,scalability:P,bmpPreview:w,entities:S}}convertEntities(t,i){const n=this.libredwg,d=this.entityConverter,_=[];let u=n.get_first_owned_entity(t);for(;u;){const f=d.convert(u);f&&(f.ownerBlockRecordSoftId=i,_.push(f)),u=n.get_next_owned_entity(t,u)}return _}convertOrphanOwnedEntities(t,i,n,d){this.ensureOrphanEntityIndex(t);const u=(this.orphanEntitiesByBlock??new Map).get(i)??[],f=d&&this.ownerlessOrphanIndices?this.ownerlessOrphanIndices:[],h=u.length&&f.length?u.concat(f):u.length?u:f;if(h.length===0)return[];const A=this.libredwg,T=this.entityConverter,v=[];for(const P of h){const m=A.dwg_get_object(t,P),D=T.convert(m);D&&(D.ownerBlockRecordSoftId=n,v.push(D))}return v}isOwnedByMissingBlock(t,i){if(!i)return!1;const n=this.libredwg;try{const d=n.dwg_dynapi_common_value(i,"entmode");if(!d.success||Number(d.data)!==0)return!1;const _=n.dwg_dynapi_common_value(i,"ownerhandle");if(!_.success||!_.data)return!1;const u=n.dwg_ref_get_absref(_.data);return u==null?!1:!n.dwg_resolve_handle_silent(t,BigInt(u))}catch{return!1}}ensureOrphanEntityIndex(t){if(this.orphanEntitiesByBlock)return;const i=this.libredwg,n=i.dwg_get_num_objects(t),d=new Map,_=[],u=[],f=new Map;for(let v=0;v<n;v++){const P=i.dwg_get_object(t,v);if(P){if(i.dwg_object_get_supertype(P)===Yn.DWG_SUPERTYPE_ENTITY)_.push(v),d.set(P,v);else if(i.dwg_object_get_fixedtype(P)===L.DWG_TYPE_BLOCK_HEADER){u.push(P);const m=i.dwg_object_to_object_tio(P);m&&f.set(m,P)}}}const h=new Set;for(const v of u){let P=i.get_first_owned_entity(v),m=0;for(;P&&m++<=_.length;){const D=d.get(P);if(D===void 0||h.has(D))break;h.add(D),P=i.get_next_owned_entity(v,P)}}const A=new Map,T=[];for(const v of _){if(h.has(v))continue;const P=i.dwg_get_object(t,v),m=P?i.dwg_object_to_entity_tio(P):0,D=m?i.dwg_entity_owner(m):0,w=D?f.get(D)??0:0;if(w){const I=A.get(w);I?I.push(v):A.set(w,[v])}else this.isOwnedByMissingBlock(t,m)||T.push(v)}this.orphanEntitiesByBlock=A,this.ownerlessOrphanIndices=T}convertDimStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"DIMTOL"),u=n.dwg_dynapi_entity_data(t,"DIMLIM"),f=n.dwg_dynapi_entity_data(t,"DIMTIH"),h=n.dwg_dynapi_entity_data(t,"DIMTOH"),A=n.dwg_dynapi_entity_data(t,"DIMSE1"),T=n.dwg_dynapi_entity_data(t,"DIMSE2"),v=n.dwg_dynapi_entity_data(t,"DIMALT"),P=n.dwg_dynapi_entity_data(t,"DIMTOFL"),m=n.dwg_dynapi_entity_data(t,"DIMSAH"),D=n.dwg_dynapi_entity_data(t,"DIMTIX"),w=n.dwg_dynapi_entity_data(t,"DIMSOXD"),I=n.dwg_dynapi_entity_data(t,"DIMALTD"),S=n.dwg_dynapi_entity_data(t,"DIMZIN"),G=n.dwg_dynapi_entity_data(t,"DIMSD1"),M=n.dwg_dynapi_entity_data(t,"DIMSD2"),b=n.dwg_dynapi_entity_data(t,"DIMTOLJ"),k=n.dwg_dynapi_entity_data(t,"DIMJUST"),$=n.dwg_dynapi_entity_data(t,"DIMFIT"),q=n.dwg_dynapi_entity_data(t,"DIMUPT"),U=n.dwg_dynapi_entity_data(t,"DIMTZIN"),Z=n.dwg_dynapi_entity_data(t,"DIMALTZ"),rt=n.dwg_dynapi_entity_data(t,"DIMALTTZ"),dt=n.dwg_dynapi_entity_data(t,"DIMTAD"),Y=n.dwg_dynapi_entity_data(t,"DIMUNIT"),F=n.dwg_dynapi_entity_data(t,"DIMAUNIT"),ct=n.dwg_dynapi_entity_data(t,"DIMDEC"),it=n.dwg_dynapi_entity_data(t,"DIMTDEC"),Yt=n.dwg_dynapi_entity_data(t,"DIMALTU"),It=n.dwg_dynapi_entity_data(t,"DIMALTTD"),Tt=n.dwg_dynapi_entity_data(t,"DIMSCALE"),wt=n.dwg_dynapi_entity_data(t,"DIMASZ"),xt=n.dwg_dynapi_entity_data(t,"DIMEXO"),Ct=n.dwg_dynapi_entity_data(t,"DIMDLI"),kt=n.dwg_dynapi_entity_data(t,"DIMEXE"),ft=n.dwg_dynapi_entity_data(t,"DIMRND"),Dt=n.dwg_dynapi_entity_data(t,"DIMDLE"),zt=n.dwg_dynapi_entity_data(t,"DIMTP"),Ot=n.dwg_dynapi_entity_data(t,"DIMTM"),Nt=n.dwg_dynapi_entity_data(t,"DIMFXL"),Bt=n.dwg_dynapi_entity_data(t,"DIMJOGANG"),Ft=n.dwg_dynapi_entity_data(t,"DIMTFILL"),ne=n.dwg_dynapi_entity_data(t,"DIMTFILLCLR"),re=n.dwg_dynapi_entity_data(t,"DIMAZIN"),ae=n.dwg_dynapi_entity_data(t,"DIMARCSYM"),Ut=n.dwg_dynapi_entity_data(t,"DIMTXT"),Q=n.dwg_dynapi_entity_data(t,"DIMCEN"),H=n.dwg_dynapi_entity_data(t,"DIMTSZ"),$t=n.dwg_dynapi_entity_data(t,"DIMALTF"),oe=n.dwg_dynapi_entity_data(t,"DIMLFAC"),Vt=n.dwg_dynapi_entity_data(t,"DIMTVP"),he=n.dwg_dynapi_entity_data(t,"DIMTFAC"),Ne=n.dwg_dynapi_entity_data(t,"DIMGAP"),Ge=n.dwg_dynapi_entity_data(t,"DIMPOST"),We=n.dwg_dynapi_entity_data(t,"DIMAPOST"),Me=n.dwg_dynapi_entity_data(t,"DIMBLK_T"),be=n.dwg_dynapi_entity_data(t,"DIMBLK1_T"),ge=n.dwg_dynapi_entity_data(t,"DIMBLK2_T"),Ae=n.dwg_dynapi_entity_data(t,"DIMALTRND"),ye=n.dwg_dynapi_entity_data(t,"DIMCLRD_N"),Te=n.dwg_dynapi_entity_data(t,"DIMCLRE_N"),xe=n.dwg_dynapi_entity_data(t,"DIMCLRT_N"),Jt=n.dwg_dynapi_entity_data(t,"DIMCLRD"),Gt=n.dwg_dynapi_entity_data(t,"DIMCLRE"),z=n.dwg_dynapi_entity_data(t,"DIMCLRT"),pe=n.dwg_dynapi_entity_data(t,"DIMADEC"),Zt=n.dwg_dynapi_entity_data(t,"DIMFRAC"),Rt=n.dwg_dynapi_entity_data(t,"DIMLUNIT"),ie=n.dwg_dynapi_entity_data(t,"DIMDSEP"),St=n.dwg_dynapi_entity_data(t,"DIMTMOVE"),qt=n.dwg_dynapi_entity_data(t,"DIMATFIT"),Wt=n.dwg_dynapi_entity_data(t,"DIMFXLON"),Qt=n.dwg_dynapi_entity_data(t,"DIMTXTDIRECTION"),se=n.dwg_dynapi_entity_data(t,"DIMALTMZF"),Pe=n.dwg_dynapi_entity_data(t,"DIMALTMZS"),pt=n.dwg_dynapi_entity_data(t,"DIMMZF"),ve=n.dwg_dynapi_entity_data(t,"DIMMZS"),_e=n.dwg_dynapi_entity_data(t,"DIMLWD"),B=n.dwg_dynapi_entity_data(t,"DIMLWE"),me=n.dwg_dynapi_entity_data(t,"DIMTXSTY"),Ie=n.dwg_ref_get_absref(me)??void 0,we=n.dwg_dynapi_entity_data(t,"DIMLDRBLK"),Ce=n.dwg_ref_get_absref(we)??void 0;return{...d,DIMPOST:Ge,DIMAPOST:We,DIMBLK:Me,DIMBLK1:be,DIMBLK2:ge,DIMSCALE:Tt,DIMASZ:wt,DIMEXO:xt,DIMDLI:Ct,DIMEXE:kt,DIMRND:ft,DIMDLE:Dt,DIMTP:zt,DIMTM:Ot,DIMTXT:Ut,DIMCEN:Q,DIMTSZ:H,DIMALTF:$t,DIMLFAC:oe,DIMTVP:Vt,DIMTFAC:he,DIMGAP:Ne,DIMALTRND:Ae,DIMTOL:_,DIMLIM:u,DIMTIH:f,DIMTOH:h,DIMSE1:A,DIMSE2:T,DIMTAD:dt,DIMZIN:S,DIMAZIN:re,DIMALT:v,DIMALTD:I,DIMTOFL:P,DIMSAH:m,DIMTIX:D,DIMSOXD:w,DIMCLRD:Jt,DIMCLRE:Gt,DIMCLRT:z,DIMADEC:pe,DIMUNIT:Y,DIMDEC:ct,DIMTDEC:it,DIMALTU:Yt,DIMALTTD:It,DIMAUNIT:F,DIMFRAC:Zt,DIMLUNIT:Rt,DIMDSEP:String.fromCharCode(ie),DIMTMOVE:St,DIMJUST:k,DIMSD1:G,DIMSD2:M,DIMTOLJ:b,DIMTZIN:U,DIMALTZ:Z,DIMALTTZ:rt,DIMFIT:$,DIMUPT:q,DIMATFIT:qt,DIMTXSTY:Ie,DIMLDRBLK:Ce,DIMLWD:_e,DIMLWE:B,DIMFXL:Nt,DIMJOGANG:Bt,DIMTFILL:Ft,DIMTFILLCLR:ne,DIMARCSYM:ae,DIMCLRD_N:ye,DIMCLRE_N:Te,DIMCLRT_N:xe,DIMFXLON:Wt,DIMTXTDIRECTION:Qt,DIMALTMZF:se,DIMALTMZS:Pe,DIMMZF:pt,DIMMZS:ve}}convertLayer(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"frozen"),f=n.dwg_dynapi_entity_data(t,"off"),h=n.dwg_dynapi_entity_data(t,"frozen_in_new"),A=n.dwg_dynapi_entity_data(t,"locked");let T=n.dwg_dynapi_entity_data(t,"plotflag");this.layerPlotFlagSupported||(T=1);const v=n.dwg_dynapi_entity_data(t,"linewt"),P=n.dwg_dynapi_entity_data(t,"color"),m=n.dwg_dynapi_entity_data(t,"ltype");let D="Continuous";if(m)try{D=n.dwg_ref_get_object_name(m)}catch{}const w=P.method;let I=256,S=16777215;return w===195||(P.rgb>>>24&255)===195?I=P.rgb&255:w==194||(P.rgb>>>24&255)===194?S=P.rgb&16777215:P.index>=1&&P.index<=255&&(I=P.index),{...d,standardFlag:_,colorIndex:I,color:S,colorName:P.name,transparency:P.alpha,lineType:D,frozen:u!=0,off:f!=0,frozenInNew:h!=0,locked:A!=0,plotFlag:T,lineweight:v,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"description"),f=n.dwg_dynapi_entity_data(t,"numdashes"),h=n.dwg_dynapi_entity_data(t,"pattern_len"),A=n.dwg_dynapi_entity_data(t,"dashes"),T=A?n.dwg_ptr_to_ltype_dash_array(A,f):[];return{...d,description:u,standardFlag:_,numberOfLineTypes:f,totalPatternLength:h,pattern:this.convertLineTypePattern(T)}}convertLineTypePattern(t){const i=[];return t.forEach(n=>{i.push({elementLength:n.length||0,elementTypeFlag:n.shape_flag||0,shapeNumber:n.complex_shapecode,scale:n.scale,rotation:n.rotation,offsetX:n.x_offset,offsetY:n.y_offset,text:n.text})}),i}convertStyle(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"width_factor"),f=n.dwg_dynapi_entity_data(t,"oblique_angle"),h=n.dwg_dynapi_entity_data(t,"generation"),A=n.dwg_dynapi_entity_data(t,"last_height"),T=n.dwg_dynapi_entity_data(t,"font_file"),v=n.dwg_dynapi_entity_data(t,"bigfont_file");return{...d,standardFlag:_,fixedTextHeight:0,widthFactor:u,obliqueAngle:f,textGenerationFlag:h,lastHeight:A,font:T,bigFont:v}}convertViewport(t,i){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,i),_=n.dwg_dynapi_entity_data(t,"flag"),u=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),f=n.dwg_dynapi_entity_data(t,"aspect_ratio"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"view_target"),T=n.dwg_dynapi_entity_data(t,"VIEWDIR"),v=n.dwg_dynapi_entity_data(t,"view_twist"),P=n.dwg_dynapi_entity_data(t,"lens_length"),m=n.dwg_dynapi_entity_data(t,"front_clip_z"),D=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"VIEWMODE"),I=n.dwg_dynapi_entity_data(t,"render_mode"),S=n.dwg_dynapi_entity_data(t,"use_default_lights")!=0,G=n.dwg_dynapi_entity_data(t,"default_lightning_type"),M=n.dwg_dynapi_entity_data(t,"brightness"),b=n.dwg_dynapi_entity_data(t,"contrast"),k=n.dwg_dynapi_entity_data(t,"ambient_color"),$=n.dwg_dynapi_entity_data(t,"lower_left"),q=n.dwg_dynapi_entity_data(t,"upper_right"),U=n.dwg_dynapi_entity_data(t,"circle_zoom"),Z=n.dwg_dynapi_entity_data(t,"UCSICON"),rt=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),dt=n.dwg_dynapi_entity_data(t,"SNAPANG"),Y=n.dwg_dynapi_entity_data(t,"SNAPBASE"),F=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),ct=n.dwg_dynapi_entity_data(t,"ucsorg"),it=n.dwg_dynapi_entity_data(t,"ucsxdir"),Yt=n.dwg_dynapi_entity_data(t,"ucsydir"),It=n.dwg_dynapi_entity_data(t,"ucs_elevation"),Tt=n.dwg_dynapi_entity_data(t,"grid_major"),wt=n.dwg_dynapi_entity_data(t,"background"),xt=wt?n.dwg_ref_get_id(wt)??"":void 0,Ct=n.dwg_dynapi_entity_data(t,"visualstyle"),kt=Ct?n.dwg_ref_get_id(Ct)??"":void 0;return{...d,standardFlag:_,lowerLeftCorner:$,upperRightCorner:q,center:h,snapBasePoint:Y,snapSpacing:F,gridSpacing:rt,viewDirectionFromTarget:T,viewTarget:A,lensLength:P,frontClippingPlane:m,backClippingPlane:D,viewHeight:u,aspectRatio:f,snapRotationAngle:dt,viewTwistAngle:v,circleSides:U,frozenLayers:[],styleSheet:"",renderMode:I,viewMode:w,ucsIconSetting:Z,ucsOrigin:ct,ucsXAxis:it,ucsYAxis:Yt,orthographicType:0,elevation:It,shadePlotSetting:0,majorGridLines:Tt,backgroundObjectId:xt,visualStyleObjectId:kt,isDefaultLightingOn:S,defaultLightingType:G,brightness:M,contrast:b,ambientColor:k.index}}getCommonTableEntryAttrs(t,i){const n=this.libredwg,d=n.dwg_object_get_tio(i),_=n.dwg_object_object_get_ownerhandle_object(d),u=n.dwg_object_get_handle_object(i);return{handle:yt(u.value),ownerHandle:yt(_.absolute_ref),name:n.dwg_dynapi_entity_data(t,"name")}}convertDictionary(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"is_hardowner"),u=n.dwg_dynapi_entity_data(t,"cloning"),f=n.dwg_dynapi_entity_data(t,"numitems"),h=n.dwg_dynapi_entity_data(t,"itemhandles"),A=n.dwg_ptr_to_object_ref_array(h,f),T=n.dwg_object_dictionary_get_texts(i),v={};return A.forEach((P,m)=>v[T[m]]=yt(P.absolute_ref)),{...d,isHardOwner:!!_,cloningFlag:u,entries:v}}convertImageDef(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"image_size"),u=n.dwg_dynapi_entity_data(t,"file_path"),f=n.dwg_dynapi_entity_data(t,"is_loaded"),h=n.dwg_dynapi_entity_data(t,"pixel_size"),A=n.dwg_dynapi_entity_data(t,"resunits");return{...d,fileName:u,size:_,sizeOfOnePixel:h,isLoaded:f,resolutionUnits:A}}convertLayerFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"num_names")??0,u=n.dwg_dynapi_entity_data(t,"names"),f=u&&_>0?n.dwg_ptr_to_wchar_string_array(u,_).filter(h=>h!=null&&h!==""):[];return{...d,...f.length?{layerNames:f}:{}}}convertLayerIndex(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"last_updated"),u=n.dwg_dynapi_entity_data(t,"num_entries")??0,f=n.dwg_dynapi_entity_data(t,"entries"),h=n.dwg_dynapi_subclass_size("LAYER_entry"),A=[],T=[],v=[];if(f&&h>0)for(let P=0;P<u;P++){const m=f+P*h,D=n.dwg_dynapi_subclass_data(m,"LAYER_entry","name");A.push(D??"");const w=n.dwg_dynapi_subclass_data(m,"LAYER_entry","handle");T.push(w?n.dwg_ref_get_id(w)??"":""),v.push(n.dwg_dynapi_subclass_data(m,"LAYER_entry","numlayers")??0)}return{...d,..._!=null?{timeStamp:_}:{},...A.length?{layerNames:A}:{},...T.length?{idBufferIds:T}:{},...v.length?{idBufferEntryCounts:v}:{}}}convertLayout(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"layout_name"),u=n.dwg_dynapi_entity_data(t,"tab_order"),f=n.dwg_dynapi_entity_data(t,"layout_flags"),h=n.dwg_dynapi_entity_data(t,"INSBASE"),A=n.dwg_dynapi_entity_data(t,"LIMMIN"),T=n.dwg_dynapi_entity_data(t,"LIMMAX"),v=n.dwg_dynapi_entity_data(t,"UCSORG"),P=n.dwg_dynapi_entity_data(t,"UCSXDIR"),m=n.dwg_dynapi_entity_data(t,"UCSYDIR"),D=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),w=n.dwg_dynapi_entity_data(t,"EXTMIN"),I=n.dwg_dynapi_entity_data(t,"EXTMAX"),S=n.dwg_dynapi_entity_data(t,"ucs_elevation"),G=n.dwg_dynapi_entity_data(t,"block_header"),M=n.dwg_ref_get_id(G)??"",b=n.dwg_dynapi_entity_data(t,"active_viewport"),k=n.dwg_ref_get_id(b)??"",$=n.dwg_dynapi_entity_data(t,"named_ucs"),q=$?n.dwg_ref_get_id($)??"":void 0;return{...d,layoutName:_,controlFlag:f,tabOrder:u,minLimit:A,maxLimit:T,insertionPoint:h,minExtent:w,maxExtent:I,elevation:S,ucsOrigin:v,ucsXAxis:P,ucsYAxis:m,orthographicType:D,paperSpaceTableId:M,viewportId:k,namedUcsId:q,shadePlotId:""}}convertMLeaderStyle(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=A=>n.dwg_dynapi_entity_data(t,A),u=A=>n.dwg_ref_get_id(A),f=A=>A>0,h=A=>A!=null?fr(A):void 0;return{...d,subclassMarker:"AcDbMLeaderStyle",unknown1:_("class_version"),contentType:_("content_type"),drawMLeaderOrderType:_("mleader_order"),drawLeaderOrderType:_("leader_order"),maxLeaderSegmentPoints:_("max_points"),firstSegmentAngleConstraint:_("first_seg_angle"),secondSegmentAngleConstraint:_("second_seg_angle"),leaderLineType:_("type"),leaderLineColor:h(_("line_color")),leaderLineTypeId:u(_("line_type")),leaderLineWeight:_("linewt"),landingEnabled:f(_("has_landing")),landingGap:_("landing_gap"),doglegEnabled:f(_("has_dogleg")),doglegLength:_("landing_dist"),description:_("description"),arrowheadId:u(_("arrow_head")),arrowheadSize:_("arrow_head_size"),defaultMTextContents:_("text_default"),textStyleId:u(_("text_style")),textLeftAttachmentType:_("attach_left"),textAngleType:_("text_angle_type"),textAlignmentType:_("text_align_type"),textRightAttachmentType:_("attach_right"),textColor:h(_("text_color")),textHeight:_("text_height"),textFrameEnabled:f(_("has_text_frame")),textAlignAlwaysLeft:f(_("text_always_left")),alignSpace:_("align_space"),blockContentId:u(_("block")),blockContentColor:h(_("block_color")),blockContentScale:_("block_scale"),blockContentScaleEnabled:f(_("use_block_scale")),blockContentRotation:_("block_rotation"),blockContentRotationEnabled:f(_("use_block_rotation")),blockContentConnectionType:_("block_connection"),scale:_("scale"),overwritePropertyValue:f(_("is_changed")),annotative:f(_("is_annotative")),breakGapSize:_("break_size"),textAttachmentDirection:_("attach_dir"),bottomTextAttachmentDirection:_("attach_bottom"),topTextAttachmentDirection:_("attach_top"),unknown2:f(_("text_extended"))}}convertSpatialFilter(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"origin"),u=n.dwg_dynapi_entity_data(t,"num_clip_verts"),f=n.dwg_dynapi_entity_data(t,"clip_verts"),h=n.dwg_ptr_to_point2d_array(f,u),A=n.dwg_dynapi_entity_data(t,"extrusion"),T=n.dwg_dynapi_entity_data(t,"display_boundary_on"),v=n.dwg_dynapi_entity_data(t,"front_clip_on"),P=n.dwg_dynapi_entity_data(t,"front_clip_z"),m=n.dwg_dynapi_entity_data(t,"back_clip_on"),D=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"transform"),I=n.dwg_ptr_to_double_array(w,12),S=n.dwg_dynapi_entity_data(t,"inverse_transform"),G=n.dwg_ptr_to_double_array(S,12);return{...d,origin:_,numberOfPointsOnClipBoundary:u,vertices:h,extrusionDirection:A,clipBoundaryVisible:!!T,frontClippingPlaneFlag:!!v,frontClippingPlaneDistance:P,backClippingPlaneFlag:!!m,backClippingPlaneDistance:D,matrix:I,invertBlockMatrix:G}}convertGroup(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"name")??"",u=!!n.dwg_dynapi_entity_data(t,"unnamed"),f=n.dwg_dynapi_entity_data(t,"selectable"),h=f!=null?!!f:!0,A=n.dwg_dynapi_entity_data(t,"num_groups")??0,T=n.dwg_dynapi_entity_data(t,"groups")??0,P=(A>0&&T?n.dwg_ptr_to_object_ref_array(T,A):[]).map(m=>yt(m.absolute_ref));return{...d,description:_,unnamed:u,selectable:h,objectHandles:P}}convertXRecord(t,i){const n=this.libredwg,d=this.getCommonObjectAttrs(i),_=n.dwg_dynapi_entity_data(t,"cloning"),u=n.dwg_object_xrecord_get_xdata(t)??[],f=n.dwg_object_get_tio(i),h=f?n.dwg_object_object_get_xdicobjhandle_object(f):null,A=h&&h.absolute_ref?yt(h.absolute_ref):void 0;return{...d,..._!=null?{cloning:_}:{},...A?{extensionDictionary:A}:{},data:u}}getCommonObjectAttrs(t){const i=this.libredwg,n=i.dwg_object_get_tio(t),d=i.dwg_object_object_get_ownerhandle_object(n),_=i.dwg_object_get_handle_object(t);return{handle:yt(_.value),ownerHandle:yt(d.absolute_ref)}}}class Pt{constructor(){nt(this,"min"),nt(this,"max"),nt(this,"valid"),this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(t){return this.min.x=Math.min(this.min.x,t.x),this.min.y=Math.min(this.min.y,t.y),this.max.x=Math.max(this.max.x,t.x),this.max.y=Math.max(this.max.y,t.y),this.valid=!0,this}transform(t,i){const n=this.getCorners().map(d=>({x:d.x*t.x+i.x,y:d.y*t.y+i.y}));this.reset();for(const d of n)this.expandByPoint(d);return this}rotate(t,i){const n=Math.cos(t),d=Math.sin(t),_=this.getCorners().map(u=>{const f=u.x-i.x,h=u.y-i.y;return{x:i.x+f*n-h*d,y:i.y+f*d+h*n}});this.reset();for(const u of _)this.expandByPoint(u);return this}clone(){const t=new Pt;return t.min={x:this.min.x,y:this.min.y},t.max={x:this.max.x,y:this.max.y},t.valid=this.valid,t}reset(){this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}getCorners(){return[{x:this.min.x,y:this.min.y},{x:this.min.x,y:this.max.y},{x:this.max.x,y:this.min.y},{x:this.max.x,y:this.max.y}]}}function Mo(a,t,i,n,d){const _=i.length;if(_===0)throw new Error("points must not be empty");const u=i[0].length;if(a<0||a>1)throw new Error(`t out of bounds [0,1]: ${a}`);if(t<1)throw new Error("degree must be at least 1 (linear)");if(t>_-1)throw new Error("degree must be less than or equal to point count - 1");const f=d??new Array(_).fill(1),h=n??(()=>{const w=[];for(let I=0;I<_+t+1;I++)w.push(I);return w})();if(h.length!==_+t+1)throw new Error("bad knot vector length");const A=[t,h.length-1-t],T=h[A[0]],v=h[A[1]];a=a*(v-T)+T,a=Math.max(a,T),a=Math.min(a,v);let P=A[0];for(;P<A[1]&&!(a>=h[P]&&a<=h[P+1]);P++);const m=new Array(_);for(let w=0;w<_;w++){m[w]=new Array(u+1);for(let I=0;I<u;I++)m[w][I]=i[w][I]*f[w];m[w][u]=f[w]}for(let w=1;w<=t+1;w++)for(let I=P;I>P-t-1+w;I--){const S=h[I+t+1-w]-h[I],G=S===0?0:(a-h[I])/S;for(let M=0;M<u+1;M++)m[I][M]=(1-G)*m[I-1][M]+G*m[I][M]}const D=new Array(u);for(let w=0;w<u;w++)D[w]=bo(m[P][w]/m[P][u],-9);return D}function bo(a,t){if(isNaN(a)||!Number.isInteger(t))return NaN;const[i,n="0"]=a.toString().split("e"),d=Math.round(+`${i}e${+n-t}`),[_,u="0"]=d.toString().split("e");return+`${_}e${+u+t}`}const dn={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},Cn=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function Ve(a,t,i){return Math.max(t,Math.min(i,a))}const hr=class gr{constructor(){nt(this,"_colorIndex"),nt(this,"_color"),nt(this,"_colorName"),this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Ve(t,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color!=null?this.color>>16&255:null}get green(){return this.color!=null?this.color>>8&255:null}get blue(){return this.color!=null?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(t){t==null?this._colorIndex=null:(this._colorIndex=Ve(t,0,256),this._color=Cn[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const i=dn[t.toLowerCase()];i!==void 0&&(this._colorName=t,this._color=i,this._colorIndex=this.getColorIndexByValue(this._color))}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(t){return this.setRGB(t,t,t),this}setRGB(t,i,n){const d=Math.round(Ve(t,0,255)),_=Math.round(Ve(i,0,255)),u=Math.round(Ve(n,0,255));return this.color=(d<<16)+(_<<8)+u,this}setColorName(t){const i=dn[t.toLowerCase()];return i!==void 0&&(this.color=i),this}clone(){const t=new gr;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[i,n]of Object.entries(dn))if(n===t)return i;return null}getColorIndexByValue(t){const i=Cn.length-1;for(let n=1;n<i;++n)if(Cn[n]===t)return n;return null}};nt(hr,"NAMES",dn);let xo=hr;class mt{constructor(t,i){nt(this,"x"),nt(this,"y"),this.x=t,this.y=i}add(t){return new mt(this.x+t.x,this.y+t.y)}sub(t){return new mt(this.x-t.x,this.y-t.y)}multiply(t){return new mt(this.x*t,this.y*t)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const t=this.length();return t===0?new mt(0,0):new mt(this.x/t,this.y/t)}}function ko(a,t,i,n=5){let d,_,u;i<0?(d=Math.atan(-i)*4,_=new mt(a.x,a.y),u=new mt(t.x,t.y)):(d=Math.atan(i)*4,_=new mt(t.x,t.y),u=new mt(a.x,a.y));const f=u.sub(_),h=f.length(),A=_.add(f.multiply(.5)),T=Math.abs(h/2/Math.tan(d/2)),v=f.norm(),P=new mt(v.x*Math.cos(Math.PI/2)-v.y*Math.sin(Math.PI/2),v.y*Math.cos(Math.PI/2)+v.x*Math.sin(Math.PI/2)),m=d<Math.PI?A.add(P.multiply(-T)):A.add(P.multiply(T)),D=Math.atan2(u.y-m.y,u.x-m.x)/Math.PI*180;let w=Math.atan2(_.y-m.y,_.x-m.x)/Math.PI*180;w<D&&(w+=360);const I=u.sub(m).length(),S=Math.floor(D/n)*n+n,G=Math.ceil(w/n)*n-n,M=[];for(let b=S;b<=G;b+=n){const k=b/180*Math.PI,$=m.add(new mt(Math.cos(k)*I,Math.sin(k)*I));M.push($)}return i<0&&M.reverse(),M}function Oo(a,t=!1){let i=[];const n=a.vertices.map(d=>({x:d.x,y:d.y,bulge:d.bulge}));t&&n.push(n[0]);for(let d=0,_=n.length;d<_-1;++d){const u=n[d],f=n[d+1];i.push(u),n[d].bulge&&(i=i.concat(ko(u,f,a.vertices[d].bulge))),d===_-2&&i.push(f)}return i}class Bo{constructor(){nt(this,"blockMap",new Map)}rotate(t,i){const n=Math.cos(i),d=Math.sin(i);return{x:t.x*n-t.y*d,y:t.x*d+t.y*n}}interpolateBSpline(t,i,n,d=25,_){const u=[],f=t.map(T=>[T.x,T.y]),h=[n[i]],A=[n[i],n[n.length-1-i]];for(let T=i+1;T<n.length-i;++T)h[h.length-1]!==n[T]&&h.push(n[T]);for(let T=1;T<h.length;++T){const v=h[T-1],P=h[T];for(let m=0;m<=d;++m){let w=(m/d*(P-v)+v-A[0])/(A[1]-A[0]);w=Math.max(0,Math.min(1,w));const I=Mo(w,i,f,n,_);u.push({x:I[0],y:I[1]})}}return u}addFlipXIfApplicable(t,{bbox:i,element:n}){return"extrusionDirection"in t&&t.extrusionDirection.z===-1?{bbox:new Pt().expandByPoint({x:-i.min.x,y:i.min.y}).expandByPoint({x:-i.max.x,y:i.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${n}</g>`}:{bbox:i,element:n}}line(t){const i=new Pt().expandByPoint({x:t.startPoint.x,y:t.startPoint.y}).expandByPoint({x:t.endPoint.x,y:t.endPoint.y}),n=`<line x1="${t.startPoint.x}" y1="${t.startPoint.y}" x2="${t.endPoint.x}" y2="${t.endPoint.y}" />`;return{bbox:i,element:n}}ray(t){const n=t.firstPoint,d={x:n.x+t.unitDirection.x*1e4,y:n.y+t.unitDirection.y*1e4},_=new Pt().expandByPoint(n).expandByPoint(d),u=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:u}}xline(t){const n={x:t.firstPoint.x-t.unitDirection.x*1e4,y:t.firstPoint.y-t.unitDirection.y*1e4},d={x:t.firstPoint.x+t.unitDirection.x*1e4,y:t.firstPoint.y+t.unitDirection.y*1e4},_=new Pt().expandByPoint(n).expandByPoint(d),u=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:u}}extractMTextLines(t){return t.replace(/\\U\+([0-9A-Fa-f]{4})/g,(i,n)=>String.fromCharCode(parseInt(n,16))).replace(/\\P/g,`
|
|
10
|
+
`),D+=`}
|
|
11
|
+
`,new Function(G,D)}function jr(e,a,i,s,u,E){var g=a.length;g<2&&$("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var y=a[1]!==null&&i!==null,P=$n(a),D=!a[0].isVoid,R=a[0],G=a[1],b=[e,$,s,u,An,R.fromWireType.bind(R),G==null?void 0:G.toWireType.bind(G)],Y=2;Y<g;++Y){var F=a[Y];b.push(F.toWireType.bind(F))}if(!P)for(var Y=2;Y<a.length;++Y)a[Y].destructorFunction!==null&&b.push(a[Y].destructorFunction);var rt=Qr(a,y,D,E)(...b);return qe(e,rt)}var ta=(e,a)=>{for(var i=[],s=0;s<e;s++)i.push(B[a+s*4>>>2>>>0]);return i},ea=e=>{e=e.trim();const a=e.indexOf("(");return a===-1?e:e.slice(0,a)};function na(e,a,i,s,u,E,g,y){e>>>=0,i>>>=0,s>>>=0,u>>>=0,E>>>=0;var P=ta(a,i);e=st(e),e=ea(e),u=fe(s,u,g),Be(e,function(){rn(`Cannot call ${e} due to unbound types`,P)},a-1),an([],P,D=>{var R=[D[0],null].concat(D.slice(1));return bn(e,jr(e,R,null,u,E,g),a-1),[]})}var ra=function(e,a,i,s,u){e>>>=0,a>>>=0,i>>>=0,a=st(a);const E=s===0;let g=P=>P;if(E){var y=32-8*i;g=P=>P<<y>>>y,u=g(u)}ot(e,{name:a,fromWireType:g,toWireType:(P,D)=>D,readValueFromPointer:Rt(a,i,s!==0),destructorFunction:null})};function aa(e,a,i){e>>>=0,i>>>=0;var s=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],u=s[a];function E(g){var y=B[g>>>2>>>0],P=B[g+4>>>2>>>0];return new u(z.buffer,P,y)}i=st(i),ot(e,{name:i,fromWireType:E,readValueFromPointer:E},{ignoreDuplicateRegistrations:!0})}var oe=(e,a,i)=>de(e,lt,a,i);function oa(e,a){e>>>=0,a>>>=0,a=st(a),ot(e,{name:a,fromWireType(i){var s=B[i>>>2>>>0],u=i+4,E;return E=te(u,s,!0),ie(i),E},toWireType(i,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,E=typeof s=="string";E||ArrayBuffer.isView(s)&&s.BYTES_PER_ELEMENT==1||$("Cannot pass non-string to std::string"),E?u=Nt(s):u=s.length;var g=sn(4+u+1),y=g+4;return B[g>>>2>>>0]=u,E?oe(s,y,u+1):lt.set(s,y>>>0),i!==null&&i.push(ie,g),g},readValueFromPointer:je,destructorFunction(i){ie(i)}})}var Vn=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,ia=(e,a,i)=>{var s=e>>>1,u=pe(Tt,s,a/2,i);if(u-s>16&&Vn)return Vn.decode(Tt.subarray(s>>>0,u>>>0));for(var E="",g=s;g<u;++g){var y=Tt[g>>>0];E+=String.fromCharCode(y)}return E},sa=(e,a,i)=>{if(i??(i=2147483647),i<2)return 0;i-=2;for(var s=a,u=i<e.length*2?i/2:e.length,E=0;E<u;++E){var g=e.charCodeAt(E);dt[a>>>1>>>0]=g,a+=2}return dt[a>>>1>>>0]=0,a-s},_a=e=>e.length*2,da=(e,a,i)=>{for(var s="",u=e>>>2,E=0;!(E>=a/4);E++){var g=B[u+E>>>0];if(!g&&!i)break;s+=String.fromCodePoint(g)}return s},la=(e,a,i)=>{if(a>>>=0,i??(i=2147483647),i<4)return 0;for(var s=a,u=s+i-4,E=0;E<e.length;++E){var g=e.codePointAt(E);if(g>65535&&E++,O[a>>>2>>>0]=g,a+=4,a+4>u)break}return O[a>>>2>>>0]=0,a-s},ca=e=>{for(var a=0,i=0;i<e.length;++i){var s=e.codePointAt(i);s>65535&&i++,a+=4}return a};function ua(e,a,i){e>>>=0,a>>>=0,i>>>=0,i=st(i);var s,u,E;a===2?(s=ia,u=sa,E=_a):(s=da,u=la,E=ca),ot(e,{name:i,fromWireType:g=>{var y=B[g>>>2>>>0],P=s(g+4,y*a,!0);return ie(g),P},toWireType:(g,y)=>{typeof y!="string"&&$(`Cannot pass non-string to C++ string type ${i}`);var P=E(y),D=sn(4+P+a);return B[D>>>2>>>0]=P/a,u(y,D+4,P+a),g!==null&&g.push(ie,D),D},readValueFromPointer:je,destructorFunction(g){ie(g)}})}var Ea=function(e,a){e>>>=0,a>>>=0,a=st(a),ot(e,{isVoid:!0,name:a,fromWireType:()=>{},toWireType:(i,s)=>{}})},Pn=[],fa=e=>{var a=Pn.length;return Pn.push(e),a},ha=(e,a)=>{for(var i=new Array(e),s=0;s<e;++s)i[s]=Un(B[a+s*4>>>2>>>0],`parameter ${s}`);return i},ga=(e,a,i)=>{var s=[],u=e(s,i);return s.length&&(B[a>>>2>>>0]=pt.toHandle(s)),u},Aa={},Hn=e=>{var a=Aa[e];return a===void 0?st(e):a},Ta=function(e,a,i){a>>>=0;var s=8,[u,...E]=ha(e,a),g=u.toWireType.bind(u),y=E.map(Y=>Y.readValueFromPointer.bind(Y));e--;var P={toValue:pt.toValue},D=y.map((Y,F)=>{var H=`argFromPtr${F}`;return P[H]=Y,`${H}(args${F?"+"+F*s:""})`}),R;switch(i){case 0:R="toValue(handle)";break;case 2:R="new (toValue(handle))";break;case 3:R="";break;case 1:P.getStringOrSymbol=Hn,R="toValue(handle)[getStringOrSymbol(methodName)]";break}R+=`(${D})`,u.isVoid||(P.toReturnWire=g,P.emval_returnValue=ga,R=`return emval_returnValue(toReturnWire, destructorsRef, ${R})`),R=`return function (handle, methodName, destructorsRef, args) {
|
|
12
|
+
${R}
|
|
13
|
+
}`;var G=new Function(Object.keys(P),R)(...Object.values(P)),b=`methodCaller<(${E.map(Y=>Y.name)}) => ${u.name}>`;return fa(qe(b,G))};function ya(e){e>>>=0,e>9&&(ae[e+1]+=1)}function Pa(e,a,i,s,u){return e>>>=0,a>>>=0,i>>>=0,s>>>=0,u>>>=0,Pn[e](a,i,s,u)}function pa(){return pt.toHandle([])}function Ia(e){return e>>>=0,pt.toHandle(Hn(e))}function va(){return pt.toHandle({})}function ma(e){e>>>=0;var a=pt.toValue(e);An(a),Tn(e)}function wa(e,a,i){e>>>=0,a>>>=0,i>>>=0,e=pt.toValue(e),a=pt.toValue(a),i=pt.toValue(i),e[a]=i}function Ca(e,a){e=ye(e),a>>>=0;var i=new Date(e*1e3);O[a>>>2>>>0]=i.getUTCSeconds(),O[a+4>>>2>>>0]=i.getUTCMinutes(),O[a+8>>>2>>>0]=i.getUTCHours(),O[a+12>>>2>>>0]=i.getUTCDate(),O[a+16>>>2>>>0]=i.getUTCMonth(),O[a+20>>>2>>>0]=i.getUTCFullYear()-1900,O[a+24>>>2>>>0]=i.getUTCDay();var s=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),u=(i.getTime()-s)/(1e3*60*60*24)|0;O[a+28>>>2>>>0]=u}var Da=e=>e%4===0&&(e%100!==0||e%400===0),Ra=[0,31,60,91,121,152,182,213,244,274,305,335],Sa=[0,31,59,90,120,151,181,212,243,273,304,334],La=e=>{var a=Da(e.getFullYear()),i=a?Ra:Sa,s=i[e.getMonth()]+e.getDate()-1;return s},Ya=function(e){e>>>=0;var a=(()=>{var i=new Date(O[e+20>>>2>>>0]+1900,O[e+16>>>2>>>0],O[e+12>>>2>>>0],O[e+8>>>2>>>0],O[e+4>>>2>>>0],O[e>>>2>>>0],0);if(isNaN(i.getTime()))return-1;var s=O[e+32>>>2>>>0],u=i.getTimezoneOffset(),E=new Date(i.getFullYear(),0,1),g=new Date(i.getFullYear(),6,1).getTimezoneOffset(),y=E.getTimezoneOffset(),P=Math.min(y,g);if(s<0)O[e+32>>>2>>>0]=+(g!=y&&P==u);else if(s>0!=(P==u)){var D=Math.max(y,g),R=s>0?P:D;i.setTime(i.getTime()+(R-u)*6e4)}O[e+24>>>2>>>0]=i.getDay();var G=La(i)|0;return O[e+28>>>2>>>0]=G,O[e>>>2>>>0]=i.getSeconds(),O[e+4>>>2>>>0]=i.getMinutes(),O[e+8>>>2>>>0]=i.getHours(),O[e+12>>>2>>>0]=i.getDate(),O[e+16>>>2>>>0]=i.getMonth(),O[e+20>>>2>>>0]=i.getYear(),i.getTime()/1e3})();return BigInt(a)},Na=function(e,a,i,s){e>>>=0,a>>>=0,i>>>=0,s>>>=0;var u=new Date().getFullYear(),E=new Date(u,0,1),g=new Date(u,6,1),y=E.getTimezoneOffset(),P=g.getTimezoneOffset(),D=Math.max(y,P);B[e>>>2>>>0]=D*60,O[a>>>2>>>0]=+(y!=P);var R=Y=>{var F=Y>=0?"-":"+",H=Math.abs(Y),rt=String(Math.floor(H/60)).padStart(2,"0"),at=String(H%60).padStart(2,"0");return`UTC${F}${rt}${at}`},G=R(y),b=R(P);P<y?(oe(G,i,17),oe(b,s,17)):(oe(G,s,17),oe(b,i,17))},Wa=()=>Date.now();function Ga(e){return e>>>=0,w(te(e))}var Ma=()=>performance.now(),ba=()=>4294901760,xa=(e,a)=>Math.ceil(e/a)*a,ka=e=>{var a=_n.buffer.byteLength,i=(e-a+65535)/65536|0;try{return _n.grow(i),U(),1}catch{}};function Oa(e){e>>>=0;var a=lt.length,i=ba();if(e>i)return!1;for(var s=1;s<=4;s*=2){var u=a*(1+.2/s);u=Math.min(u,e+100663296);var E=Math.min(i,xa(Math.max(e,u),65536)),g=ka(E);if(g)return!0}return!1}var on={},Ba=()=>f,Fe=()=>{var u;if(!Fe.strings){var e=(((u=globalThis.navigator)==null?void 0:u.language)??"C").replace("-","_")+".UTF-8",a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Ba()};for(var i in on)on[i]===void 0?delete a[i]:a[i]=on[i];var s=[];for(var i in a)s.push(`${i}=${a[i]}`);Fe.strings=s}return Fe.strings};function Fa(e,a){e>>>=0,a>>>=0;var i=0,s=0;for(var u of Fe()){var E=a+i;B[e+s>>>2>>>0]=E,i+=oe(u,E,1/0)+1,s+=4}return 0}function Ua(e,a){e>>>=0,a>>>=0;var i=Fe();B[e>>>2>>>0]=i.length;var s=0;for(var u of i)s+=Nt(u)+1;return B[a>>>2>>>0]=s,0}function $a(e){try{var a=Q.getStreamFromFD(e);return l.close(a),0}catch(i){if(typeof l>"u"||i.name!=="ErrnoError")throw i;return i.errno}}var Va=(e,a,i,s)=>{for(var u=0,E=0;E<i;E++){var g=B[a>>>2>>>0],y=B[a+4>>>2>>>0];a+=8;var P=l.read(e,z,g,y,s);if(P<0)return-1;if(u+=P,P<y)break}return u};function Ha(e,a,i,s){a>>>=0,i>>>=0,s>>>=0;try{var u=Q.getStreamFromFD(e),E=Va(u,a,i);return B[s>>>2>>>0]=E,0}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return g.errno}}function Xa(e,a,i,s){a=ye(a),s>>>=0;try{if(isNaN(a))return 22;var u=Q.getStreamFromFD(e);return l.llseek(u,a,i),tt[s>>>3>>>0]=BigInt(u.position),u.getdents&&a===0&&i===0&&(u.getdents=null),0}catch(E){if(typeof l>"u"||E.name!=="ErrnoError")throw E;return E.errno}}var Ka=(e,a,i,s)=>{for(var u=0,E=0;E<i;E++){var g=B[a>>>2>>>0],y=B[a+4>>>2>>>0];a+=8;var P=l.write(e,z,g,y,s);if(P<0)return-1;if(u+=P,P<y)break}return u};function za(e,a,i,s){a>>>=0,i>>>=0,s>>>=0;try{var u=Q.getStreamFromFD(e),E=Ka(u,a,i);return B[s>>>2>>>0]=E,0}catch(g){if(typeof l>"u"||g.name!=="ErrnoError")throw g;return g.errno}}function Ja(e,a){return e>>>=0,a>>>=0,qt(lt.subarray(e>>>0,e+a>>>0))}var Xn=e=>{var a=o["_"+e];return a},Za=(e,a)=>{z.set(e,a>>>0)},Kn=e=>qn(e),qa=e=>{var a=Nt(e)+1,i=Kn(a);return oe(e,i,a),i},zn=(e,a,i,s,u)=>{var E={string:F=>{var H=0;return F!=null&&F!==0&&(H=qa(F)),H},array:F=>{var H=Kn(F.length);return Za(F,H),H}};function g(F){return a==="string"?te(F):a==="pointer"?F>>>0:a==="boolean"?!!F:F}var y=Xn(e),P=[],D=0;if(s)for(var R=0;R<s.length;R++){var G=E[i[R]];G?(D===0&&(D=Jt()),P[R]=G(s[R])):P[R]=s[R]}var b=y(...P);function Y(F){return D!==0&&V(D),g(F)}return b=Y(b),b},Qa=(e,a,i,s)=>{var u=!i||i.every(g=>g==="number"||g==="boolean"),E=a!=="string";return E&&u&&!s?Xn(e):(...g)=>zn(e,a,i,g)},ja=e=>{var a=Nt(e)+1,i=sn(a);return i&&oe(e,i,a),i};if(l.createPreloadedFile=Xe,l.preloadFile=Ee,l.staticInit(),wr(),Or(),o.noExitRuntime&&o.noExitRuntime,o.preloadPlugins&&(ue=o.preloadPlugins),o.print&&(C=o.print),o.printErr&&(w=o.printErr),o.wasmBinary&&(m=o.wasmBinary),o.arguments&&o.arguments,o.thisProgram&&(f=o.thisProgram),o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.shift()();o.ENV=on,o.ccall=zn,o.cwrap=Qa,o.setValue=q,o.UTF8ToString=te,o.stringToNewUTF8=ja,o.FS=l;var ie,sn,Jn,Zn,qn,Qn,_n,jn;function to(e){o.__Znwm=e._Znwm,o.__ZdlPvm=e._ZdlPvm,ie=e.free,sn=e.malloc,e.realloc,e.calloc,Jn=e.__getTypeName,o._strndup=e.strndup,o.__ZdaPv=e._ZdaPv,o.__ZdaPvm=e._ZdaPvm,o.__ZdlPv=e._ZdlPv,o._emscripten_builtin_malloc=e.emscripten_builtin_malloc,o.__Znam=e._Znam,o.__ZnamSt11align_val_t=e._ZnamSt11align_val_t,o.__ZnwmSt11align_val_t=e._ZnwmSt11align_val_t,o.___libc_calloc=e.__libc_calloc,o.___libc_free=e.__libc_free,o.___libc_malloc=e.__libc_malloc,o.___libc_realloc=e.__libc_realloc,o._emscripten_builtin_calloc=e.emscripten_builtin_calloc,o._emscripten_builtin_free=e.emscripten_builtin_free,o._emscripten_builtin_realloc=e.emscripten_builtin_realloc,o._malloc_size=e.malloc_size,o._malloc_usable_size=e.malloc_usable_size,o._reallocf=e.reallocf,Zn=e._emscripten_stack_restore,qn=e._emscripten_stack_alloc,Qn=e.emscripten_stack_get_current,_n=e.memory,jn=e.__indirect_function_table}var tr={__cxa_throw:Ne,__syscall_fcntl64:cn,__syscall_fstat64:un,__syscall_ioctl:En,__syscall_lstat64:Ke,__syscall_newfstatat:Ge,__syscall_openat:K,__syscall_stat64:j,_abort_js:ee,_embind_register_bigint:Je,_embind_register_bool:fn,_embind_register_class:$r,_embind_register_class_property:Vr,_embind_register_emval:Xr,_embind_register_enum:zr,_embind_register_enum_value:Jr,_embind_register_float:qr,_embind_register_function:na,_embind_register_integer:ra,_embind_register_memory_view:aa,_embind_register_std_string:oa,_embind_register_std_wstring:ua,_embind_register_void:Ea,_emval_create_invoker:Ta,_emval_decref:Tn,_emval_incref:ya,_emval_invoke:Pa,_emval_new_array:pa,_emval_new_cstring:Ia,_emval_new_object:va,_emval_run_destructors:ma,_emval_set_property:wa,_gmtime_js:Ca,_mktime_js:Ya,_tzset_js:Na,emscripten_date_now:Wa,emscripten_err:Ga,emscripten_get_now:Ma,emscripten_resize_heap:Oa,environ_get:Fa,environ_sizes_get:Ua,fd_close:$a,fd_read:Ha,fd_seek:Xa,fd_write:za,random_get:Ja};function eo(e){e=Object.assign({},e);var a=u=>E=>u(E)>>>0,i=u=>(E,g)=>u(E,g)>>>0,s=u=>()=>u()>>>0;return e.malloc=a(e.malloc),e.realloc=i(e.realloc),e.calloc=i(e.calloc),e.__getTypeName=a(e.__getTypeName),e.emscripten_builtin_malloc=a(e.emscripten_builtin_malloc),e.emscripten_builtin_calloc=i(e.emscripten_builtin_calloc),e._emscripten_stack_alloc=a(e._emscripten_stack_alloc),e.emscripten_stack_get_current=s(e.emscripten_stack_get_current),e}function pn(){if(Pt>0){Wt=pn;return}if(J(),Pt>0){Wt=pn;return}function e(){var a;o.calledRun=!0,!S&&(nt(),W==null||W(o),(a=o.onRuntimeInitialized)==null||a.call(o),ft())}o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),e()},1)):e()}var he;return he=await kt(),pn(),k?t=o:t=new Promise((e,a)=>{W=e,M=a}),t}var To=Object.defineProperty,yo=(r,t,o)=>t in r?To(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,et=(r,t,o)=>yo(r,typeof t!="symbol"?t+"":t,o);const Po=["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","euc-kr","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"],_r=r=>Po[r];var ge=(r=>(r[r.TopLeft=1]="TopLeft",r[r.TopCenter=2]="TopCenter",r[r.TopRight=3]="TopRight",r[r.MiddleLeft=4]="MiddleLeft",r[r.MiddleCenter=5]="MiddleCenter",r[r.MiddleRight=6]="MiddleRight",r[r.BottomLeft=7]="BottomLeft",r[r.BottomCenter=8]="BottomCenter",r[r.BottomRight=9]="BottomRight",r))(ge||{}),Cn=(r=>(r[r.PatternFill=0]="PatternFill",r[r.SolidFill=1]="SolidFill",r))(Cn||{}),Dn=(r=>(r[r.NonAssociative=0]="NonAssociative",r[r.Associative=1]="Associative",r))(Dn||{}),Tr=(r=>(r[r.Solid=0]="Solid",r[r.Gradient=1]="Gradient",r))(Tr||{}),Rn=(r=>(r[r.TwoColor=0]="TwoColor",r[r.OneColor=1]="OneColor",r))(Rn||{}),$e=(r=>(r[r.Line=1]="Line",r[r.Circular=2]="Circular",r[r.Elliptic=3]="Elliptic",r[r.Spline=4]="Spline",r))($e||{}),Sn=(r=>(r[r.LEFT=0]="LEFT",r[r.CENTER=1]="CENTER",r[r.RIGHT=2]="RIGHT",r[r.ALIGNED=3]="ALIGNED",r[r.MIDDLE=4]="MIDDLE",r[r.FIT=5]="FIT",r))(Sn||{});const po=Object.freeze(["ACADMAINTVER","ACADVER","ANGBASE","ANGDIR","ATTMODE","AUNITS","AUPREC","CECOLOR","CELTSCALE","CELTYPE","CELWEIGHT","CEPSNID","CEPSNTYPE","CHAMFERA","CHAMFERB","CHAMFERC","CHAMFERD","CLAYER","CMLJUST","CMLSCALE","CMLSTYLE","CSHADOW","DIMADEC","DIMALT","DIMALTD","DIMALTF","DIMALTRND","DIMALTTD","DIMALTTZ","DIMALTU","DIMALTZ","DIMAPOST","DIMASO","DIMASSOC","DIMASZ","DIMATFIT","DIMAUNIT","DIMAZIN","DIMBLK","DIMBLK1","DIMBLK2","DIMCEN","DIMCLRD","DIMCLRE","DIMCLRT","DIMDEC","DIMDLE","DIMDLI","DIMDSEP","DIMEXE","DIMEXO","DIMFAC","DIMGAP","DIMJUST","DIMLDRBLK","DIMLFAC","DIMLIM","DIMLUNIT","DIMLWD","DIMLWE","DIMPOST","DIMRND","DIMSAH","DIMSCALE","DIMSD1","DIMSD2","DIMSE1","DIMSE2","DIMSHO","DIMSOXD","DIMSTYLE","DIMTAD","DIMTDEC","DIMTFAC","DIMTIH","DIMTIX","DIMTM","DIMTMOVE","DIMTOFL","DIMTOH","DIMTOL","DIMTOLJ","DIMTP","DIMTSZ","DIMTVP","DIMTXSTY","DIMTXT","DIMTZIN","DIMUPT","DIMZIN","DISPSILH","DRAGVS","DWGCODEPAGE","ELEVATION","ENDCAPS","EXTMAX","EXTMIN","EXTNAMES","FILLETRAD","FILLMODE","FINGERPRINTGUID","HALOGAP","HANDSEED","HIDETEXT","HYPERLINKBASE","INDEXCTL","INSBASE","INSUNITS","INTERFERECOLOR","INTERFEREOBJVS","INTERFEREVPVS","INTERSECTIONCOLOR","INTERSECTIONDISPLAY","JOINSTYLE","LIMCHECK","LIMMAX","LIMMIN","LTSCALE","LUNITS","LUPREC","LWDISPLAY","MAXACTVP","MEASUREMENT","MENU","MIRRTEXT","OBSCOLOR","OBSLTYPE","ORTHOMODE","PDMODE","PDSIZE","PELEVATION","PEXTMAX","PEXTMIN","PINSBASE","PLIMCHECK","PLIMMAX","PLIMMIN","PLINEGEN","PLINEWID","PROJECTNAME","PROXYGRAPHICS","PSLTSCALE","PSTYLEMODE","PSVPSCALE","PUCSBASE","PUCSNAME","PUCSORG","PUCSORGBACK","PUCSORGBOTTOM","PUCSORGFRONT","PUCSORGLEFT","PUCSORGRIGHT","PUCSORGTOP","PUCSORTHOREF","PUCSORTHOVIEW","PUCSXDIR","PUCSYDIR","QTEXTMODE","REGENMODE","SHADEDGE","SHADEDIF","SHADOWPLANELOCATION","SKETCHINC","SKPOLY","SORTENTS","SPLINESEGS","SPLINETYPE","SURFTAB1","SURFTAB2","SURFTYPE","SURFU","SURFV","TDCREATE","TDINDWG","TDUCREATE","TDUPDATE","TDUSRTIMER","TDUUPDATE","TEXTSIZE","TEXTSTYLE","THICKNESS","TILEMODE","TRACEWID","TREEDEPTH","UCSBASE","UCSNAME","UCSORG","UCSORGBACK","UCSORGBOTTOM","UCSORGFRONT","UCSORGLEFT","UCSORGRIGHT","UCSORGTOP","UCSORTHOREF","UCSORTHOVIEW","UCSXDIR","UCSYDIR","UNITMODE","USERI1","USERI2","USERI3","USERI4","USERI5","USERR1","USERR2","USERR3","USERR4","USERR5","USRTIMER","VERSIONGUID","VISRETAIN","WORLDVIEW","XCLIPFRAME","XEDIT"]),Io=/\\U\+([0-9A-Fa-f]{4})/g;function dr(r){return!r||!r.includes("\\U+")?r:r.replace(Io,(t,o)=>String.fromCharCode(parseInt(o,16)))}const vo=[{type:"invalid",hdr:"INVALI",description:"No DWG",version:0},{type:"r1.1",hdr:"MC0.0",description:"MicroCAD Release 1.1",version:0},{type:"r1.2",hdr:"AC1.2",description:"AutoCAD Release 1.2",version:0},{type:"r1.3",hdr:"AC1.3",description:"AutoCAD Release 1.3",version:1},{type:"r1.4",hdr:"AC1.40",description:"AutoCAD Release 1.4",version:2},{type:"r2.0b",hdr:"AC1.50",description:"AutoCAD 2.0 beta",version:3},{type:"r2.0",hdr:"AC1.50",description:"AutoCAD Release 2.0",version:4},{type:"r2.10",hdr:"AC2.10",description:"AutoCAD Release 2.10",version:5},{type:"r2.21",hdr:"AC2.21",description:"AutoCAD Release 2.21",version:6},{type:"r2.22",hdr:"AC2.22",description:"AutoCAD Release 2.22",version:7},{type:"r2.4",hdr:"AC1001",description:"AutoCAD Release 2.4",version:8},{type:"r2.5",hdr:"AC1002",description:"AutoCAD Release 2.5",version:9},{type:"r2.6",hdr:"AC1003",description:"AutoCAD Release 2.6",version:10},{type:"r9",hdr:"AC1004",description:"AutoCAD Release 9",version:11},{type:"r9c1",hdr:"AC1005",description:"AutoCAD Release 9c1",version:12},{type:"r10",hdr:"AC1006",description:"AutoCAD Release 10",version:13},{type:"r11b1",hdr:"AC1007",description:"AutoCAD 11 beta 1",version:14},{type:"r11b2",hdr:"AC1008",description:"AutoCAD 11 beta 2",version:15},{type:"r11",hdr:"AC1009",description:"AutoCAD Release 11/12 (LT R1/R2)",version:16},{type:"r13b1",hdr:"AC1010",description:"AutoCAD pre-R13 a",version:17},{type:"r13b2",hdr:"AC1011",description:"AutoCAD pre-R13 b",version:18},{type:"r13",hdr:"AC1012",description:"AutoCAD Release 13",version:19},{type:"r13c3",hdr:"AC1013",description:"AutoCAD Release 13c3",version:20},{type:"r14",hdr:"AC1014",description:"AutoCAD Release 14",version:21},{type:"r2000b",hdr:"AC1500",description:"AutoCAD 2000 beta",version:22},{type:"r2000",hdr:"AC1015",description:"AutoCAD Release 2000",version:23},{type:"r2000i",hdr:"AC1016",description:"AutoCAD Release 2000i",version:23},{type:"r2002",hdr:"AC1017",description:"AutoCAD Release 2002",version:23},{type:"r2004a",hdr:"AC402a",description:"AutoCAD 2004 alpha a",version:24},{type:"r2004b",hdr:"AC402b",description:"AutoCAD 2004 alpha b",version:24},{type:"r2004c",hdr:"AC1018",description:"AutoCAD 2004 beta",version:24},{type:"r2004",hdr:"AC1018",description:"AutoCAD Release 2004",version:25},{type:"r2007a",hdr:"AC701a",description:"AutoCAD 2007 alpha",version:26},{type:"r2007b",hdr:"AC1021",description:"AutoCAD 2007 beta",version:26},{type:"r2007",hdr:"AC1021",description:"AutoCAD Release 2007",version:27},{type:"r2010b",hdr:"AC1024",description:"AutoCAD 2010 beta",version:28},{type:"r2010",hdr:"AC1024",description:"AutoCAD Release 2010",version:29},{type:"r2013b",hdr:"AC1027",description:"AutoCAD 2013 beta",version:30},{type:"r2013",hdr:"AC1027",description:"AutoCAD Release 2013",version:31},{type:"r2018b",hdr:"AC1032",description:"AutoCAD 2018 beta",version:32},{type:"r2018",hdr:"AC1032",description:"AutoCAD Release 2018",version:33},{type:"r2022b",hdr:"AC103-4",description:"AutoCAD 2022 beta",version:36},{type:"r>2022",hdr:"",description:"AutoCAD Release >2022",version:0}];var Ln=(r=>(r[r.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",r[r.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT",r))(Ln||{}),Yn=(r=>(r[r.WRONGCRC=1]="WRONGCRC",r[r.NOTYETSUPPORTED=2]="NOTYETSUPPORTED",r[r.UNHANDLEDCLASS=4]="UNHANDLEDCLASS",r[r.INVALIDTYPE=8]="INVALIDTYPE",r[r.INVALIDHANDLE=16]="INVALIDHANDLE",r[r.INVALIDEED=32]="INVALIDEED",r[r.VALUEOUTOFBOUNDS=64]="VALUEOUTOFBOUNDS",r[r.CLASSESNOTFOUND=128]="CLASSESNOTFOUND",r[r.SECTIONNOTFOUND=256]="SECTIONNOTFOUND",r[r.PAGENOTFOUND=512]="PAGENOTFOUND",r[r.INTERNALERROR=1024]="INTERNALERROR",r[r.INVALIDDWG=2048]="INVALIDDWG",r[r.IOERROR=4096]="IOERROR",r[r.OUTOFMEM=8192]="OUTOFMEM",r))(Yn||{}),L=(r=>(r[r.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",r[r.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",r[r.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",r[r.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",r[r.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",r[r.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",r[r.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",r[r.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",r[r.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",r[r.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",r[r.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",r[r.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",r[r.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",r[r.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",r[r.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",r[r.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",r[r.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",r[r.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",r[r.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",r[r.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",r[r.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",r[r.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",r[r.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",r[r.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",r[r.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",r[r.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",r[r.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",r[r.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",r[r.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",r[r.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",r[r.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",r[r.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",r[r.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",r[r.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",r[r.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",r[r.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",r[r.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",r[r.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",r[r.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",r[r.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",r[r.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",r[r.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",r[r.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",r[r.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",r[r.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",r[r.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",r[r.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",r[r.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",r[r.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",r[r.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",r[r.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",r[r.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",r[r.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",r[r.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",r[r.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",r[r.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",r[r.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",r[r.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",r[r.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",r[r.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",r[r.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",r[r.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",r[r.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",r[r.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",r[r.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",r[r.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",r[r.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",r[r.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",r[r.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",r[r.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",r[r.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",r[r.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",r[r.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",r[r.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",r[r.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",r[r.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",r[r.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",r[r.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",r[r.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",r[r.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",r[r.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",r[r.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",r[r.DWG_TYPE_ACIDBLOCKREFERENCE=502]="DWG_TYPE_ACIDBLOCKREFERENCE",r[r.DWG_TYPE_ACMECOMMANDHISTORY=503]="DWG_TYPE_ACMECOMMANDHISTORY",r[r.DWG_TYPE_ACMESCOPE=504]="DWG_TYPE_ACMESCOPE",r[r.DWG_TYPE_ACMESTATEMGR=505]="DWG_TYPE_ACMESTATEMGR",r[r.DWG_TYPE_ACSH_BOOLEAN_CLASS=506]="DWG_TYPE_ACSH_BOOLEAN_CLASS",r[r.DWG_TYPE_ACSH_BOX_CLASS=507]="DWG_TYPE_ACSH_BOX_CLASS",r[r.DWG_TYPE_ACSH_BREP_CLASS=508]="DWG_TYPE_ACSH_BREP_CLASS",r[r.DWG_TYPE_ACSH_CHAMFER_CLASS=509]="DWG_TYPE_ACSH_CHAMFER_CLASS",r[r.DWG_TYPE_ACSH_CONE_CLASS=510]="DWG_TYPE_ACSH_CONE_CLASS",r[r.DWG_TYPE_ACSH_CYLINDER_CLASS=511]="DWG_TYPE_ACSH_CYLINDER_CLASS",r[r.DWG_TYPE_ACSH_EXTRUSION_CLASS=512]="DWG_TYPE_ACSH_EXTRUSION_CLASS",r[r.DWG_TYPE_ACSH_FILLET_CLASS=513]="DWG_TYPE_ACSH_FILLET_CLASS",r[r.DWG_TYPE_ACSH_HISTORY_CLASS=514]="DWG_TYPE_ACSH_HISTORY_CLASS",r[r.DWG_TYPE_ACSH_LOFT_CLASS=515]="DWG_TYPE_ACSH_LOFT_CLASS",r[r.DWG_TYPE_ACSH_PYRAMID_CLASS=516]="DWG_TYPE_ACSH_PYRAMID_CLASS",r[r.DWG_TYPE_ACSH_REVOLVE_CLASS=517]="DWG_TYPE_ACSH_REVOLVE_CLASS",r[r.DWG_TYPE_ACSH_SPHERE_CLASS=518]="DWG_TYPE_ACSH_SPHERE_CLASS",r[r.DWG_TYPE_ACSH_SWEEP_CLASS=519]="DWG_TYPE_ACSH_SWEEP_CLASS",r[r.DWG_TYPE_ACSH_TORUS_CLASS=520]="DWG_TYPE_ACSH_TORUS_CLASS",r[r.DWG_TYPE_ACSH_WEDGE_CLASS=521]="DWG_TYPE_ACSH_WEDGE_CLASS",r[r.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=522]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",r[r.DWG_TYPE_ALIGNMENTPARAMETERENTITY=523]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",r[r.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=524]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",r[r.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=525]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",r[r.DWG_TYPE_ARCALIGNEDTEXT=526]="DWG_TYPE_ARCALIGNEDTEXT",r[r.DWG_TYPE_ARC_DIMENSION=527]="DWG_TYPE_ARC_DIMENSION",r[r.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=528]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",r[r.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=529]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",r[r.DWG_TYPE_ASSOCACTION=530]="DWG_TYPE_ASSOCACTION",r[r.DWG_TYPE_ASSOCACTIONPARAM=531]="DWG_TYPE_ASSOCACTIONPARAM",r[r.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=532]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",r[r.DWG_TYPE_ASSOCARRAYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYACTIONBODY",r[r.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=534]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",r[r.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=535]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",r[r.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",r[r.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",r[r.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=538]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",r[r.DWG_TYPE_ASSOCASMBODYACTIONPARAM=539]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",r[r.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=540]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=541]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",r[r.DWG_TYPE_ASSOCDEPENDENCY=542]="DWG_TYPE_ASSOCDEPENDENCY",r[r.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=543]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",r[r.DWG_TYPE_ASSOCEDGEACTIONPARAM=544]="DWG_TYPE_ASSOCEDGEACTIONPARAM",r[r.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=545]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",r[r.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=546]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",r[r.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=548]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCFACEACTIONPARAM=549]="DWG_TYPE_ASSOCFACEACTIONPARAM",r[r.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=550]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCGEOMDEPENDENCY=551]="DWG_TYPE_ASSOCGEOMDEPENDENCY",r[r.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=552]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCMLEADERACTIONBODY=553]="DWG_TYPE_ASSOCMLEADERACTIONBODY",r[r.DWG_TYPE_ASSOCNETWORK=554]="DWG_TYPE_ASSOCNETWORK",r[r.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=555]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCOBJECTACTIONPARAM=556]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",r[r.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=557]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=558]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",r[r.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=559]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",r[r.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=560]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCPATHACTIONPARAM=561]="DWG_TYPE_ASSOCPATHACTIONPARAM",r[r.DWG_TYPE_ASSOCPERSSUBENTMANAGER=562]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",r[r.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=563]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=564]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",r[r.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=565]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",r[r.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=566]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=567]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",r[r.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=569]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",r[r.DWG_TYPE_ASSOCVALUEDEPENDENCY=570]="DWG_TYPE_ASSOCVALUEDEPENDENCY",r[r.DWG_TYPE_ASSOCVARIABLE=571]="DWG_TYPE_ASSOCVARIABLE",r[r.DWG_TYPE_ASSOCVERTEXACTIONPARAM=572]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",r[r.DWG_TYPE_BASEPOINTPARAMETERENTITY=573]="DWG_TYPE_BASEPOINTPARAMETERENTITY",r[r.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=574]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",r[r.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=575]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKALIGNMENTGRIP=576]="DWG_TYPE_BLOCKALIGNMENTGRIP",r[r.DWG_TYPE_BLOCKALIGNMENTPARAMETER=577]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",r[r.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=578]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKARRAYACTION=579]="DWG_TYPE_BLOCKARRAYACTION",r[r.DWG_TYPE_BLOCKBASEPOINTPARAMETER=580]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",r[r.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=581]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKFLIPACTION=582]="DWG_TYPE_BLOCKFLIPACTION",r[r.DWG_TYPE_BLOCKFLIPGRIP=583]="DWG_TYPE_BLOCKFLIPGRIP",r[r.DWG_TYPE_BLOCKFLIPPARAMETER=584]="DWG_TYPE_BLOCKFLIPPARAMETER",r[r.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=585]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",r[r.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=587]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKLINEARGRIP=588]="DWG_TYPE_BLOCKLINEARGRIP",r[r.DWG_TYPE_BLOCKLINEARPARAMETER=589]="DWG_TYPE_BLOCKLINEARPARAMETER",r[r.DWG_TYPE_BLOCKLOOKUPACTION=590]="DWG_TYPE_BLOCKLOOKUPACTION",r[r.DWG_TYPE_BLOCKLOOKUPGRIP=591]="DWG_TYPE_BLOCKLOOKUPGRIP",r[r.DWG_TYPE_BLOCKLOOKUPPARAMETER=592]="DWG_TYPE_BLOCKLOOKUPPARAMETER",r[r.DWG_TYPE_BLOCKMOVEACTION=593]="DWG_TYPE_BLOCKMOVEACTION",r[r.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=594]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",r[r.DWG_TYPE_BLOCKPOINTPARAMETER=595]="DWG_TYPE_BLOCKPOINTPARAMETER",r[r.DWG_TYPE_BLOCKPOLARGRIP=596]="DWG_TYPE_BLOCKPOLARGRIP",r[r.DWG_TYPE_BLOCKPOLARPARAMETER=597]="DWG_TYPE_BLOCKPOLARPARAMETER",r[r.DWG_TYPE_BLOCKPOLARSTRETCHACTION=598]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",r[r.DWG_TYPE_BLOCKPROPERTIESTABLE=599]="DWG_TYPE_BLOCKPROPERTIESTABLE",r[r.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=600]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",r[r.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=601]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKREPRESENTATION=602]="DWG_TYPE_BLOCKREPRESENTATION",r[r.DWG_TYPE_BLOCKROTATEACTION=603]="DWG_TYPE_BLOCKROTATEACTION",r[r.DWG_TYPE_BLOCKROTATIONGRIP=604]="DWG_TYPE_BLOCKROTATIONGRIP",r[r.DWG_TYPE_BLOCKROTATIONPARAMETER=605]="DWG_TYPE_BLOCKROTATIONPARAMETER",r[r.DWG_TYPE_BLOCKSCALEACTION=606]="DWG_TYPE_BLOCKSCALEACTION",r[r.DWG_TYPE_BLOCKSTRETCHACTION=607]="DWG_TYPE_BLOCKSTRETCHACTION",r[r.DWG_TYPE_BLOCKUSERPARAMETER=608]="DWG_TYPE_BLOCKUSERPARAMETER",r[r.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=609]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",r[r.DWG_TYPE_BLOCKVISIBILITYGRIP=610]="DWG_TYPE_BLOCKVISIBILITYGRIP",r[r.DWG_TYPE_BLOCKVISIBILITYPARAMETER=611]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",r[r.DWG_TYPE_BLOCKXYGRIP=612]="DWG_TYPE_BLOCKXYGRIP",r[r.DWG_TYPE_BLOCKXYPARAMETER=613]="DWG_TYPE_BLOCKXYPARAMETER",r[r.DWG_TYPE_CAMERA=614]="DWG_TYPE_CAMERA",r[r.DWG_TYPE_CELLSTYLEMAP=615]="DWG_TYPE_CELLSTYLEMAP",r[r.DWG_TYPE_CONTEXTDATAMANAGER=616]="DWG_TYPE_CONTEXTDATAMANAGER",r[r.DWG_TYPE_CSACDOCUMENTOPTIONS=617]="DWG_TYPE_CSACDOCUMENTOPTIONS",r[r.DWG_TYPE_CURVEPATH=618]="DWG_TYPE_CURVEPATH",r[r.DWG_TYPE_DATALINK=619]="DWG_TYPE_DATALINK",r[r.DWG_TYPE_DATATABLE=620]="DWG_TYPE_DATATABLE",r[r.DWG_TYPE_DBCOLOR=621]="DWG_TYPE_DBCOLOR",r[r.DWG_TYPE_DETAILVIEWSTYLE=622]="DWG_TYPE_DETAILVIEWSTYLE",r[r.DWG_TYPE_DGNDEFINITION=623]="DWG_TYPE_DGNDEFINITION",r[r.DWG_TYPE_DGNUNDERLAY=624]="DWG_TYPE_DGNUNDERLAY",r[r.DWG_TYPE_DICTIONARYVAR=625]="DWG_TYPE_DICTIONARYVAR",r[r.DWG_TYPE_DICTIONARYWDFLT=626]="DWG_TYPE_DICTIONARYWDFLT",r[r.DWG_TYPE_DIMASSOC=627]="DWG_TYPE_DIMASSOC",r[r.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=628]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",r[r.DWG_TYPE_DWFDEFINITION=629]="DWG_TYPE_DWFDEFINITION",r[r.DWG_TYPE_DWFUNDERLAY=630]="DWG_TYPE_DWFUNDERLAY",r[r.DWG_TYPE_DYNAMICBLOCKPROXYNODE=631]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",r[r.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=632]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",r[r.DWG_TYPE_EVALUATION_GRAPH=633]="DWG_TYPE_EVALUATION_GRAPH",r[r.DWG_TYPE_EXTRUDEDSURFACE=634]="DWG_TYPE_EXTRUDEDSURFACE",r[r.DWG_TYPE_FCFOBJECTCONTEXTDATA=635]="DWG_TYPE_FCFOBJECTCONTEXTDATA",r[r.DWG_TYPE_FIELD=636]="DWG_TYPE_FIELD",r[r.DWG_TYPE_FIELDLIST=637]="DWG_TYPE_FIELDLIST",r[r.DWG_TYPE_FLIPPARAMETERENTITY=638]="DWG_TYPE_FLIPPARAMETERENTITY",r[r.DWG_TYPE_FLIPACTIONENTITY=639]="DWG_TYPE_FLIPACTIONENTITY",r[r.DWG_TYPE_GEODATA=640]="DWG_TYPE_GEODATA",r[r.DWG_TYPE_GEOMAPIMAGE=641]="DWG_TYPE_GEOMAPIMAGE",r[r.DWG_TYPE_GEOPOSITIONMARKER=642]="DWG_TYPE_GEOPOSITIONMARKER",r[r.DWG_TYPE_GRADIENT_BACKGROUND=643]="DWG_TYPE_GRADIENT_BACKGROUND",r[r.DWG_TYPE_GROUND_PLANE_BACKGROUND=644]="DWG_TYPE_GROUND_PLANE_BACKGROUND",r[r.DWG_TYPE_HELIX=645]="DWG_TYPE_HELIX",r[r.DWG_TYPE_IBL_BACKGROUND=646]="DWG_TYPE_IBL_BACKGROUND",r[r.DWG_TYPE_IDBUFFER=647]="DWG_TYPE_IDBUFFER",r[r.DWG_TYPE_IMAGE=648]="DWG_TYPE_IMAGE",r[r.DWG_TYPE_IMAGEDEF=649]="DWG_TYPE_IMAGEDEF",r[r.DWG_TYPE_IMAGEDEF_REACTOR=650]="DWG_TYPE_IMAGEDEF_REACTOR",r[r.DWG_TYPE_IMAGE_BACKGROUND=651]="DWG_TYPE_IMAGE_BACKGROUND",r[r.DWG_TYPE_INDEX=652]="DWG_TYPE_INDEX",r[r.DWG_TYPE_LARGE_RADIAL_DIMENSION=653]="DWG_TYPE_LARGE_RADIAL_DIMENSION",r[r.DWG_TYPE_LAYERFILTER=654]="DWG_TYPE_LAYERFILTER",r[r.DWG_TYPE_LAYER_INDEX=655]="DWG_TYPE_LAYER_INDEX",r[r.DWG_TYPE_LAYOUTPRINTCONFIG=656]="DWG_TYPE_LAYOUTPRINTCONFIG",r[r.DWG_TYPE_LEADEROBJECTCONTEXTDATA=657]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",r[r.DWG_TYPE_LIGHT=658]="DWG_TYPE_LIGHT",r[r.DWG_TYPE_LIGHTLIST=659]="DWG_TYPE_LIGHTLIST",r[r.DWG_TYPE_LINEARPARAMETERENTITY=660]="DWG_TYPE_LINEARPARAMETERENTITY",r[r.DWG_TYPE_LOFTEDSURFACE=661]="DWG_TYPE_LOFTEDSURFACE",r[r.DWG_TYPE_MATERIAL=662]="DWG_TYPE_MATERIAL",r[r.DWG_TYPE_MENTALRAYRENDERSETTINGS=663]="DWG_TYPE_MENTALRAYRENDERSETTINGS",r[r.DWG_TYPE_MESH=664]="DWG_TYPE_MESH",r[r.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=665]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",r[r.DWG_TYPE_MLEADERSTYLE=666]="DWG_TYPE_MLEADERSTYLE",r[r.DWG_TYPE_MOVEACTIONENTITY=667]="DWG_TYPE_MOVEACTIONENTITY",r[r.DWG_TYPE_MOTIONPATH=668]="DWG_TYPE_MOTIONPATH",r[r.DWG_TYPE_MPOLYGON=669]="DWG_TYPE_MPOLYGON",r[r.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",r[r.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=671]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",r[r.DWG_TYPE_MULTILEADER=672]="DWG_TYPE_MULTILEADER",r[r.DWG_TYPE_NAVISWORKSMODEL=673]="DWG_TYPE_NAVISWORKSMODEL",r[r.DWG_TYPE_NAVISWORKSMODELDEF=674]="DWG_TYPE_NAVISWORKSMODELDEF",r[r.DWG_TYPE_NPOCOLLECTION=675]="DWG_TYPE_NPOCOLLECTION",r[r.DWG_TYPE_NURBSURFACE=676]="DWG_TYPE_NURBSURFACE",r[r.DWG_TYPE_OBJECT_PTR=677]="DWG_TYPE_OBJECT_PTR",r[r.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=678]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",r[r.DWG_TYPE_PARTIAL_VIEWING_INDEX=679]="DWG_TYPE_PARTIAL_VIEWING_INDEX",r[r.DWG_TYPE_PDFDEFINITION=680]="DWG_TYPE_PDFDEFINITION",r[r.DWG_TYPE_PDFUNDERLAY=681]="DWG_TYPE_PDFUNDERLAY",r[r.DWG_TYPE_PERSUBENTMGR=682]="DWG_TYPE_PERSUBENTMGR",r[r.DWG_TYPE_PLANESURFACE=683]="DWG_TYPE_PLANESURFACE",r[r.DWG_TYPE_PLOTSETTINGS=684]="DWG_TYPE_PLOTSETTINGS",r[r.DWG_TYPE_POINTCLOUD=685]="DWG_TYPE_POINTCLOUD",r[r.DWG_TYPE_POINTCLOUDCOLORMAP=686]="DWG_TYPE_POINTCLOUDCOLORMAP",r[r.DWG_TYPE_POINTCLOUDDEF=687]="DWG_TYPE_POINTCLOUDDEF",r[r.DWG_TYPE_POINTCLOUDDEFEX=688]="DWG_TYPE_POINTCLOUDDEFEX",r[r.DWG_TYPE_POINTCLOUDDEF_REACTOR=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR",r[r.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=690]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",r[r.DWG_TYPE_POINTCLOUDEX=691]="DWG_TYPE_POINTCLOUDEX",r[r.DWG_TYPE_POINTPARAMETERENTITY=692]="DWG_TYPE_POINTPARAMETERENTITY",r[r.DWG_TYPE_POINTPATH=693]="DWG_TYPE_POINTPATH",r[r.DWG_TYPE_POLARGRIPENTITY=694]="DWG_TYPE_POLARGRIPENTITY",r[r.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",r[r.DWG_TYPE_RADIMOBJECTCONTEXTDATA=696]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",r[r.DWG_TYPE_RAPIDRTRENDERSETTINGS=697]="DWG_TYPE_RAPIDRTRENDERSETTINGS",r[r.DWG_TYPE_RASTERVARIABLES=698]="DWG_TYPE_RASTERVARIABLES",r[r.DWG_TYPE_RENDERENTRY=699]="DWG_TYPE_RENDERENTRY",r[r.DWG_TYPE_RENDERENVIRONMENT=700]="DWG_TYPE_RENDERENVIRONMENT",r[r.DWG_TYPE_RENDERGLOBAL=701]="DWG_TYPE_RENDERGLOBAL",r[r.DWG_TYPE_RENDERSETTINGS=702]="DWG_TYPE_RENDERSETTINGS",r[r.DWG_TYPE_REVOLVEDSURFACE=703]="DWG_TYPE_REVOLVEDSURFACE",r[r.DWG_TYPE_ROTATIONPARAMETERENTITY=704]="DWG_TYPE_ROTATIONPARAMETERENTITY",r[r.DWG_TYPE_ROTATEACTIONENTITY=705]="DWG_TYPE_ROTATEACTIONENTITY",r[r.DWG_TYPE_RTEXT=706]="DWG_TYPE_RTEXT",r[r.DWG_TYPE_SCALE=707]="DWG_TYPE_SCALE",r[r.DWG_TYPE_SCALEACTIONENTITY=708]="DWG_TYPE_SCALEACTIONENTITY",r[r.DWG_TYPE_SECTIONOBJECT=709]="DWG_TYPE_SECTIONOBJECT",r[r.DWG_TYPE_SECTIONVIEWSTYLE=710]="DWG_TYPE_SECTIONVIEWSTYLE",r[r.DWG_TYPE_SECTION_MANAGER=711]="DWG_TYPE_SECTION_MANAGER",r[r.DWG_TYPE_SECTION_SETTINGS=712]="DWG_TYPE_SECTION_SETTINGS",r[r.DWG_TYPE_SKYLIGHT_BACKGROUND=713]="DWG_TYPE_SKYLIGHT_BACKGROUND",r[r.DWG_TYPE_SOLID_BACKGROUND=714]="DWG_TYPE_SOLID_BACKGROUND",r[r.DWG_TYPE_SORTENTSTABLE=715]="DWG_TYPE_SORTENTSTABLE",r[r.DWG_TYPE_SPATIAL_FILTER=716]="DWG_TYPE_SPATIAL_FILTER",r[r.DWG_TYPE_SPATIAL_INDEX=717]="DWG_TYPE_SPATIAL_INDEX",r[r.DWG_TYPE_STRETCHACTIONENTITY=718]="DWG_TYPE_STRETCHACTIONENTITY",r[r.DWG_TYPE_SUN=719]="DWG_TYPE_SUN",r[r.DWG_TYPE_SUNSTUDY=720]="DWG_TYPE_SUNSTUDY",r[r.DWG_TYPE_SWEPTSURFACE=721]="DWG_TYPE_SWEPTSURFACE",r[r.DWG_TYPE_TABLE=722]="DWG_TYPE_TABLE",r[r.DWG_TYPE_TABLECONTENT=723]="DWG_TYPE_TABLECONTENT",r[r.DWG_TYPE_TABLEGEOMETRY=724]="DWG_TYPE_TABLEGEOMETRY",r[r.DWG_TYPE_TABLESTYLE=725]="DWG_TYPE_TABLESTYLE",r[r.DWG_TYPE_TEXTOBJECTCONTEXTDATA=726]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",r[r.DWG_TYPE_TVDEVICEPROPERTIES=727]="DWG_TYPE_TVDEVICEPROPERTIES",r[r.DWG_TYPE_VISIBILITYGRIPENTITY=728]="DWG_TYPE_VISIBILITYGRIPENTITY",r[r.DWG_TYPE_VISIBILITYPARAMETERENTITY=729]="DWG_TYPE_VISIBILITYPARAMETERENTITY",r[r.DWG_TYPE_VISUALSTYLE=730]="DWG_TYPE_VISUALSTYLE",r[r.DWG_TYPE_WIPEOUT=731]="DWG_TYPE_WIPEOUT",r[r.DWG_TYPE_WIPEOUTVARIABLES=732]="DWG_TYPE_WIPEOUTVARIABLES",r[r.DWG_TYPE_XREFPANELOBJECT=733]="DWG_TYPE_XREFPANELOBJECT",r[r.DWG_TYPE_XYPARAMETERENTITY=734]="DWG_TYPE_XYPARAMETERENTITY",r[r.DWG_TYPE_BREAKDATA=735]="DWG_TYPE_BREAKDATA",r[r.DWG_TYPE_BREAKPOINTREF=736]="DWG_TYPE_BREAKPOINTREF",r[r.DWG_TYPE_FLIPGRIPENTITY=737]="DWG_TYPE_FLIPGRIPENTITY",r[r.DWG_TYPE_LINEARGRIPENTITY=738]="DWG_TYPE_LINEARGRIPENTITY",r[r.DWG_TYPE_ROTATIONGRIPENTITY=739]="DWG_TYPE_ROTATIONGRIPENTITY",r[r.DWG_TYPE_XYGRIPENTITY=740]="DWG_TYPE_XYGRIPENTITY",r[r.DWG_TYPE__3DLINE=741]="DWG_TYPE__3DLINE",r[r.DWG_TYPE_REPEAT=742]="DWG_TYPE_REPEAT",r[r.DWG_TYPE_ENDREP=743]="DWG_TYPE_ENDREP",r[r.DWG_TYPE_JUMP=744]="DWG_TYPE_JUMP",r[r.DWG_TYPE_LOAD=745]="DWG_TYPE_LOAD",r[r.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",r[r.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",r[r.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ",r))(L||{});Object.fromEntries(Object.entries(L).map(([r,t])=>[t,r]));var mt=(r=>(r[r.DWG=0]="DWG",r[r.DXF=1]="DXF",r))(mt||{}),Ve=(r=>(r[r.Line=1]="Line",r[r.CircularArc=2]="CircularArc",r[r.EllipticArc=3]="EllipticArc",r[r.Spline=4]="Spline",r))(Ve||{}),wt=(r=>(r[r.ByLayer=192]="ByLayer",r[r.ByBlock=193]="ByBlock",r[r.Entities=194]="Entities",r[r.TrueColor=195]="TrueColor",r[r.ForegroundColor=197]="ForegroundColor",r[r.None=200]="None",r))(wt||{});const lr=192,cr=193,mo=194,mn=195,ur=200;function yr(r){if(r==null)return;const t=r.method,o=r.method!=null&&t!==0?t:r.rgb>>>24&255,n=r.index;if(r.rgb!=null&&o>=lr&&o<=ur&&(r.rgb>>>24&255)===o)return r.rgb>>0;if(o===wt.ByLayer||n===256)return lr<<24>>0;if(o===wt.ByBlock||n===0)return cr<<24>>0;if(o===wt.None)return ur<<24>>0;if(o===wt.TrueColor){const d=r.rgb!=null?r.rgb&16777215:void 0;if(d!=null)return(mo<<24|d)>>0}return o===wt.ForegroundColor?(mn<<24|7)>>0:o===wt.Entities&&n>0&&n<256||n>0&&n<256?(mn<<24|n&255)>>0:cr<<24>>0}function wo(r){if(r==null)return;const t=r.method,o=r.method!=null&&t!==0?t:r.rgb>>>24&255,n=r.index;if(!(o===wt.ByLayer||o===wt.ByBlock||o===wt.None||n===256)){if(o===wt.ForegroundColor)return 7;if(o===wt.TrueColor)return r.rgb==null?void 0:r.rgb&16777215;if(n>=1&&n<=255)return n;if(n!==0&&r.rgb!=null){const d=r.rgb&16777215;if(d!==0)return d}}}const Co="*MODEL_SPACE",Do="*PAPER_SPACE",Nn=r=>r&&r.toUpperCase()==Co,Ro=r=>r&&r.toUpperCase().startsWith(Do),At=r=>r.toString(16).toUpperCase(),He=r=>{const t=new Array(r.length);for(let o=0;o<r.length;o++)t[o]=r[o].toString(16).toUpperCase().padStart(2,"0");return t.join("")},So=r=>{if(!r||r.length<98)return null;const t=new DataView(r.buffer,r.byteOffset,r.byteLength),o=_=>({x:t.getFloat64(_,!0),y:t.getFloat64(_+8,!0),z:t.getFloat64(_+16,!0)}),n=o(2),d=o(50);return[n.x,n.y,n.z,d.x,d.y,d.z].every(Number.isFinite)?{upperLeft:n,lowerRight:d}:null};class Lo{constructor(t){et(this,"libredwg"),et(this,"layers",new Map),et(this,"ltypes",new Map),et(this,"classes",[]),et(this,"unknownEntityCount"),this.libredwg=t,this.unknownEntityCount=0}prepare(t,o=!1){(o||this.layers.size==0)&&(this.layers.clear(),t.tables.LAYER.entries.forEach(n=>{this.layers.set(n.handle,n.name)})),(o||this.ltypes.size==0)&&(this.ltypes.clear(),t.tables.LTYPE.entries.forEach(n=>{this.ltypes.set(n.handle,n.name)})),this.classes=t.classes,this.unknownEntityCount=0}setClasses(t){this.classes=t}clear(){this.layers.clear(),this.ltypes.clear(),this.classes=[],this.unknownEntityCount=0}convert(t){const o=this.libredwg,n=o.dwg_object_to_entity(t),d=o.dwg_object_to_entity_tio(t);if(n&&d){const _=this.getCommonAttrs(n),c=o.dwg_object_get_fixedtype(t);if(c==L.DWG_TYPE_3DFACE)return this.convert3dFace(d,_);if(c==L.DWG_TYPE_3DSOLID)return this.convert3dSolid(d,_);if(c==L.DWG_TYPE_ARC)return this.convertArc(d,_);if(c==L.DWG_TYPE_ARCALIGNEDTEXT)return this.convertArcAlignedText(d,_);if(c==L.DWG_TYPE_ATTDEF)return this.convertAttdef(d,_);if(c==L.DWG_TYPE_CIRCLE)return this.convertCircle(d,_);if(c==L.DWG_TYPE_DIMENSION_ALIGNED)return this.convertAlignedDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_LINEAR)return this.convertRotatedDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_ANG2LN)return this.convert2LineAngularDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(d,_);if(c==L.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(d,_);if(c==L.DWG_TYPE_ELLIPSE)return this.convertEllise(d,_);if(c==L.DWG_TYPE_HATCH)return this.convertHatch(d,_);if(c==L.DWG_TYPE_IMAGE)return this.convertImage(d,_);if(c==L.DWG_TYPE_INSERT||c==L.DWG_TYPE_MINSERT)return this.convertInsert(d,_);if(c==L.DWG_TYPE_LEADER)return this.convertLeader(d,_);if(c==L.DWG_TYPE_LINE)return this.convertLine(d,_);if(c==L.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(d,_);if(c==L.DWG_TYPE_MLINE)return this.convertMLine(d,_);if(c==L.DWG_TYPE_MULTILEADER)return this.convertMultiLeader(d,_);if(c==L.DWG_TYPE_MTEXT)return this.convertMText(d,_);if(c==L.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(d,_);if(c==L.DWG_TYPE_OLEFRAME)return this.convertOleFrame(d,_);if(c==L.DWG_TYPE_POINT)return this.convertPoint(d,_);if(c==L.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(d,_,t);if(c==L.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(d,_,t);if(c==L.DWG_TYPE_PROXY_ENTITY)return this.convertProxyEntity(d,_,t);if(c==L.DWG_TYPE_RAY)return this.convertRay(d,_);if(c==L.DWG_TYPE_SECTIONOBJECT)return this.convertSection(d,_);if(c==L.DWG_TYPE_SHAPE)return this.convertShape(d,_);if(c==L.DWG_TYPE_SOLID)return this.convertSolid(d,_);if(c==L.DWG_TYPE_TRACE)return this.convertTrace(d,_);if(c==L.DWG_TYPE_SPLINE)return this.convertSpline(d,_);if(c==L.DWG_TYPE_TABLE)return this.convertTable(d,_);if(c==L.DWG_TYPE_TEXT)return this.convertText(d,_);if(c==L.DWG_TYPE_TOLERANCE)return this.convertTolerance(d,_);if(c==L.DWG_TYPE_VIEWPORT)return this.convertViewport(d,_);if(c==L.DWG_TYPE_WIPEOUT)return this.convertWipeout(d,_);if(c==L.DWG_TYPE_XLINE)return this.convertXline(d,_);c===L.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),c=n.dwg_dynapi_entity_data(t,"corner3"),f=n.dwg_dynapi_entity_data(t,"corner4"),h=n.dwg_dynapi_entity_data(t,"invis_flags");return{type:"3DFACE",...o,corner1:d,corner2:_,corner3:c,corner4:f,flag:h}}convert3dSolid(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"version"),_=n.dwg_dynapi_entity_data(t,"acis_empty"),c=n.dwg_dynapi_entity_data(t,"acis_data"),f=n.dwg_dynapi_entity_data(t,"has_revision_guid"),h=n.dwg_dynapi_entity_data(t,"history_id"),A=n.dwg_ref_get_id(h),T={type:"3DSOLID",subclassMarker:"AcDb3dSolid",...o};if(d&&(T.version=d),T.satCache=_,c&&(T.data=c),f){const p=n.dwg_dynapi_entity_field_offset(t,"revision_guid");if(p>=0){const I=n.UTF8ToString(t+p,38);I&&(T.guid=I)}}return A&&(T.historyObjectSoftId=A),T}convertArc(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),c=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ARC",...o,thickness:c,center:d,radius:_,startAngle:h,endAngle:A,extrusionDirection:f}}convertArcAlignedText(t,o){const n=this.libredwg,d=(A,T=0)=>{const p=n.dwg_dynapi_entity_data(t,A);if(typeof p=="number"&&Number.isFinite(p))return p;if(typeof p=="string"&&p.trim()!==""){const I=Number(p);if(Number.isFinite(I))return I}return T},_=n.dwg_dynapi_entity_data(t,"center"),c=n.dwg_dynapi_entity_data(t,"extrusion"),f=n.dwg_dynapi_entity_data(t,"arc_handle"),h=d("xscale",1);return{type:"ARCALIGNEDTEXT",...o,text:n.dwg_dynapi_entity_data(t,"text_value")??"",textSize:d("text_size"),xScale:h>0?h:1,characterSpacing:d("char_spacing"),styleName:n.dwg_dynapi_entity_data(t,"style")??"",fontName:n.dwg_dynapi_entity_data(t,"font_name")??"",bigFontName:n.dwg_dynapi_entity_data(t,"bigfont_name")??"",offsetFromArc:d("offset_from_arc"),rightOffset:d("right_offset"),leftOffset:d("left_offset"),center:_??{x:0,y:0,z:0},radius:n.dwg_dynapi_entity_data(t,"radius")??0,startAngle:n.dwg_dynapi_entity_data(t,"start_angle")??0,endAngle:n.dwg_dynapi_entity_data(t,"end_angle")??0,extrusionDirection:c??{x:0,y:0,z:1},rawTextColor:n.dwg_dynapi_entity_data(t,"color")??256,characterSet:n.dwg_dynapi_entity_data(t,"character_set")??0,pitchAndFamily:n.dwg_dynapi_entity_data(t,"pitch_and_family")??0,isShx:(n.dwg_dynapi_entity_data(t,"is_shx")??0)!==0,isBold:(n.dwg_dynapi_entity_data(t,"is_bold")??0)!==0,isItalic:(n.dwg_dynapi_entity_data(t,"is_italic")??0)!==0,isUnderlined:(n.dwg_dynapi_entity_data(t,"is_underlined")??0)!==0,alignment:n.dwg_dynapi_entity_data(t,"alignment")??0,isReverse:(n.dwg_dynapi_entity_data(t,"is_reverse")??0)!==0,wizardFlag:n.dwg_dynapi_entity_data(t,"wizard_flag")??0,textPosition:n.dwg_dynapi_entity_data(t,"text_position")??1,textDirection:n.dwg_dynapi_entity_data(t,"text_direction")??1,arcHandle:f?n.dwg_ref_get_id(f)??"":""}}convertEmbeddedMText(t,o){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,o,"attachment"),_=n.dwg_dynapi_subclass_data(t,o,"ins_pt"),c=n.dwg_dynapi_subclass_data(t,o,"x_axis_dir"),f=n.dwg_dynapi_subclass_data(t,o,"rect_height"),h=n.dwg_dynapi_subclass_data(t,o,"rect_width"),A=n.dwg_dynapi_subclass_data(t,o,"extents_height"),T=n.dwg_dynapi_subclass_data(t,o,"extents_width");return{insertionPoint:_,rectHeight:f,rectWidth:h,extentsHeight:A,extentsWidth:T,attachmentPoint:d,direction:c}}convertAttdef(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"default_value"),_=this.convertTextBase(t);_.text=d;const c=n.dwg_dynapi_entity_data(t,"prompt"),f=n.dwg_dynapi_entity_data(t,"tag"),h=n.dwg_dynapi_entity_data(t,"flags"),A=n.dwg_dynapi_entity_data(t,"field_length"),T=n.dwg_dynapi_entity_data(t,"lock_position_flag"),p=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),I=n.dwg_dynapi_entity_data(t,"is_really_locked"),v=n.dwg_dynapi_entity_data(t,"mtext_type"),C=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTDEF",...o,text:this.convertTextBase(t),prompt:c,tag:f,flags:h,fieldLength:A,lockPositionFlag:T>0,duplicateRecordCloningFlag:p>0,mtextFlag:v,isReallyLocked:I>0,alignmentPoint:C,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertAttrib(t,o){const n=this.libredwg,d=this.convertTextBase(t),_=n.dwg_dynapi_entity_data(t,"tag"),c=n.dwg_dynapi_entity_data(t,"flags"),f=n.dwg_dynapi_entity_data(t,"field_length"),h=n.dwg_dynapi_entity_data(t,"lock_position_flag"),A=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),T=n.dwg_dynapi_entity_data(t,"mtext_type"),p=n.dwg_dynapi_entity_data(t,"is_really_locked"),I=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTRIB",...o,text:d,tag:_,flags:c,fieldLength:f,lockPositionFlag:!!h,duplicateRecordCloningFlag:!!A,mtextFlag:T,isReallyLocked:!!p,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...I,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertCircle(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),c=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"CIRCLE",...o,thickness:c,center:d,radius:_,extrusionDirection:f}}convertAlignedDimension(t,o){return this.convertLinearOrAlignedDimension(t,o,"AcDbAlignedDimension")}convertRotatedDimension(t,o){return this.convertLinearOrAlignedDimension(t,o,"AcDbRotatedDimension")}convertLinearOrAlignedDimension(t,o,n){const d=this.libredwg,_=this.getDimensionCommonAttrs(t),c=d.dwg_dynapi_entity_data(t,"clone_ins_pt"),f=d.dwg_dynapi_entity_data(t,"xline1_pt"),h=d.dwg_dynapi_entity_data(t,"xline2_pt"),A=n==="AcDbRotatedDimension"?d.dwg_dynapi_entity_data(t,"dim_rotation"):0,T=d.dwg_dynapi_entity_data(t,"oblique_angle");return{subclassMarker:n,...o,..._,insertionPoint:c,subDefinitionPoint1:f,subDefinitionPoint2:h,rotationAngle:A??0,obliqueAngle:T}}convert3PointAngularDimension(t,o){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1_pt"),c=n.dwg_dynapi_entity_data(t,"xline2_pt"),f=n.dwg_dynapi_entity_data(t,"center_pt"),h=n.dwg_dynapi_entity_data(t,"xline2end_pt");return{subclassMarker:"AcDb3PointAngularDimension",...o,...d,subDefinitionPoint1:_,subDefinitionPoint2:c,centerPoint:f,arcPoint:h}}convert2LineAngularDimension(t,o){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1start_pt"),c=n.dwg_dynapi_entity_data(t,"xline1end_pt"),f=n.dwg_dynapi_entity_data(t,"xline2start_pt"),h=n.dwg_dynapi_entity_data(t,"xline2end_pt"),A=n.dwg_dynapi_entity_data(t,"def_pt");return h&&(d.definitionPoint=h),{subclassMarker:"AcDb2LineAngularDimension",...o,...d,subDefinitionPoint1:_??c??A??h,subDefinitionPoint2:f??h??A??c,centerPoint:A??f??c??h,arcPoint:h??d.definitionPoint}}convertDiameterDimension(t,o){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),c=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbDiametricDimension",...o,...d,centerPoint:_,leaderLength:c}}convertOrdinateDimension(t,o){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"feature_location_pt"),c=n.dwg_dynapi_entity_data(t,"leader_endpt");return{subclassMarker:"AcDbOrdinateDimension",...o,...d,subDefinitionPoint1:_,subDefinitionPoint2:c}}convertRadiusDimension(t,o){const n=this.libredwg,d=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),c=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbRadialDimension",...o,...d,centerPoint:_,leaderLength:c}}convertEllise(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"sm_axis"),c=n.dwg_dynapi_entity_data(t,"extrusion"),f=n.dwg_dynapi_entity_data(t,"axis_ratio"),h=n.dwg_dynapi_entity_data(t,"start_angle"),A=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ELLIPSE",...o,center:d,majorAxisEndPoint:_,extrusionDirection:c,axisRatio:f,startAngle:h,endAngle:A}}convertHatch(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"extrusion"),_=n.dwg_dynapi_entity_data(t,"name"),c=n.dwg_dynapi_entity_data(t,"is_solid_fill"),f=n.dwg_dynapi_entity_data(t,"is_associative"),h=n.dwg_dynapi_entity_data(t,"num_paths"),A=n.dwg_dynapi_entity_data(t,"paths"),T=n.dwg_ptr_to_hatch_path_array(A,h),p=n.dwg_dynapi_entity_data(t,"style"),I=n.dwg_dynapi_entity_data(t,"pattern_type"),v=n.dwg_dynapi_entity_data(t,"angle"),C=n.dwg_dynapi_entity_data(t,"scale_spacing"),w=n.dwg_dynapi_entity_data(t,"num_deflines"),m=n.dwg_dynapi_entity_data(t,"deflines"),S=n.dwg_ptr_to_hatch_defline_array(m,w),N=n.dwg_dynapi_entity_data(t,"pixel_size"),W=n.dwg_dynapi_entity_data(t,"num_seeds"),M=n.dwg_dynapi_entity_data(t,"seeds"),k=n.dwg_ptr_to_point2d_array(M,W),U={...o,extrusionDirection:d,patternName:_,solidFill:c?Cn.SolidFill:Cn.PatternFill,associativity:f?Dn.Associative:Dn.NonAssociative,numberOfBoundaryPaths:h,boundaryPaths:this.convertHatchBoundaryPaths(T),hatchStyle:p,patternType:I,patternAngle:v,patternScale:C,numberOfDefinitionLines:w,definitionLines:S.map(nt=>({angle:nt.angle,base:nt.pt0,offset:nt.offset,numberOfDashLengths:nt.dashes.length,dashLengths:nt.dashes})),pixelSize:N,numberOfSeedPoints:W,seedPoints:k};if(n.dwg_dynapi_entity_data(t,"is_gradient_fill")>0){const nt=n.dwg_dynapi_entity_data(t,"gradient_name"),ft=n.dwg_dynapi_entity_data(t,"gradient_angle"),Z=n.dwg_dynapi_entity_data(t,"gradient_shift"),ut=n.dwg_dynapi_entity_data(t,"gradient_tint"),Et=n.dwg_dynapi_entity_data(t,"single_color_gradient"),ht=n.dwg_dynapi_entity_data(t,"colors"),gt=n.dwg_ptr_to_hatch_gradient_color_array(ht,Et==1?1:2);return{type:"HATCH",...U,gradientFlag:Tr.Gradient,gradientColorFlag:Et==1?Rn.OneColor:Rn.TwoColor,gradientName:nt,gradientRotation:ft,gradientDefinition:Z,colorTint:ut,gradientColors:gt}}else return{type:"HATCH",...U}}convertHatchBoundaryPaths(t){return t.filter(n=>n.num_segs_or_paths>0).map(n=>{const d={boundaryPathTypeFlag:n.flag};if(n.flag&2)return{...d,hasBulge:n.bulges_present,isClosed:n.closed,numberOfVertices:n.num_segs_or_paths,vertices:n.polyline_paths.map(_=>({x:_.point.x,y:_.point.y,bulge:_.bulge}))};{const _=n.segs.map(c=>{if(c.curve_type==Ve.Line)return{type:$e.Line,start:c.first_endpoint,end:c.second_endpoint};if(c.curve_type==Ve.CircularArc)return{type:$e.Circular,center:c.center,radius:c.radius,startAngle:c.start_angle,endAngle:c.end_angle,isCCW:c.is_ccw};if(c.curve_type==Ve.EllipticArc)return{type:$e.Elliptic,center:c.center,end:c.endpoint,lengthOfMinorAxis:c.minor_major_ratio,startAngle:c.start_angle,endAngle:c.end_angle,isCCW:c.is_ccw};if(c.curve_type==Ve.Spline)return{type:$e.Spline,degree:c.degree,isRational:c.is_rational,isPeriodic:c.is_periodic,numberOfKnots:c.num_knots,numberOfControlPoints:c.num_control_points,knots:c.knots,controlPoints:c.control_points,numberOfFitData:c.num_fitpts,fitDatum:c.fitpts,startTangent:c.start_tangent,endTangent:c.end_tangent}}).filter(c=>c!=null);return{...d,numberOfEdges:_.length,edges:_}}})}convertImage(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),c=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),T=n.dwg_dynapi_entity_data(t,"clipping"),p=n.dwg_dynapi_entity_data(t,"brightness"),I=n.dwg_dynapi_entity_data(t,"contrast"),v=n.dwg_dynapi_entity_data(t,"fade"),C=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),N=n.dwg_ptr_to_point3d_array(S,m),W=n.dwg_dynapi_entity_data(t,"imagedef"),M=n.dwg_ref_get_id(W)??"",k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),U=n.dwg_ref_get_id(k)??"";return{type:"IMAGE",...o,version:d,position:_,uPixel:c,vPixel:f,imageSize:h,imageDefHandle:M,flags:A,clipping:T,brightness:p,contrast:I,fade:v,imageDefReactorHandle:U,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:N,clipMode:C}}convertInsert(t,o){const n=this.libredwg;let d="";const _=n.dwg_dynapi_entity_data(t,"block_header");if(_){const m=n.dwg_ref_get_object(_);if(m){const S=n.dwg_object_to_object_tio(m);S&&(d=n.dwg_entity_block_header_get_block(S).name)}}d||(d=n.dwg_dynapi_entity_data(t,"block_name"));const c=n.dwg_dynapi_entity_data(t,"ins_pt"),f=n.dwg_dynapi_entity_data(t,"scale"),h=n.dwg_dynapi_entity_data(t,"rotation"),A=n.dwg_dynapi_entity_data(t,"num_cols"),T=n.dwg_dynapi_entity_data(t,"num_rows"),p=n.dwg_dynapi_entity_data(t,"col_spacing"),I=n.dwg_dynapi_entity_data(t,"row_spacing"),v=n.dwg_dynapi_entity_data(t,"extrusion"),C=n.dwg_entity_insert_get_attribs(t),w=[];return C.forEach(m=>{const S=n.dwg_object_to_entity(m),N=n.dwg_object_to_entity_tio(m);if(S&&N){const W=this.getCommonAttrs(S);n.dwg_object_get_fixedtype(m)==L.DWG_TYPE_ATTRIB&&w.push(this.convertAttrib(N,W))}}),{type:"INSERT",...o,name:d,insertionPoint:c,xScale:f?f.x:1,yScale:f?f.y:1,zScale:f?f.z:1,rotation:h,columnCount:A||1,rowCount:T||1,columnSpacing:p||0,rowSpacing:I||0,extrusionDirection:v,attribs:w}}convertLeader(t,o){const n=this.libredwg;let d="";try{d=n.dwg_entity_get_dimstyle_name(t)||""}catch{d=""}const c=n.dwg_dynapi_entity_data(t,"arrowhead_on")>0,f=n.dwg_dynapi_entity_data(t,"path_type"),h=n.dwg_dynapi_entity_data(t,"annot_type"),A=n.dwg_dynapi_entity_data(t,"hookline_dir"),T=n.dwg_dynapi_entity_data(t,"hookline_on"),p=n.dwg_dynapi_entity_data(t,"box_height"),I=n.dwg_dynapi_entity_data(t,"box_width"),v=n.dwg_dynapi_entity_data(t,"num_points"),C=n.dwg_dynapi_entity_data(t,"points"),w=v>0?n.dwg_ptr_to_point3d_array(C,v):[],m=n.dwg_dynapi_entity_data(t,"byblock_color"),S=n.dwg_dynapi_entity_data(t,"extrusion"),N=n.dwg_dynapi_entity_data(t,"x_direction"),W=n.dwg_dynapi_entity_data(t,"inspt_offset"),M=n.dwg_dynapi_entity_data(t,"endptproj");return{type:"LEADER",...o,styleName:d,isArrowheadEnabled:c,isSpline:f>0,leaderCreationFlag:h,isHooklineSameDirection:A>0,isHooklineExists:T>0,textHeight:p,textWidth:I,numberOfVertices:v,vertices:w,byBlockColor:m,normal:S,horizontalDirection:N,offsetFromBlock:W,offsetFromAnnotation:M}}convertLine(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"start"),_=n.dwg_dynapi_entity_data(t,"end"),c=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"LINE",...o,thickness:c,startPoint:d,endPoint:_,extrusionDirection:f}}convertLWPolyline(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"num_points"),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"const_width"),f=n.dwg_dynapi_entity_data(t,"elevation"),h=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion"),T=[],p=n.dwg_dynapi_entity_data(t,"num_points"),I=n.dwg_dynapi_entity_data(t,"points"),v=n.dwg_ptr_to_point2d_array(I,p),C=n.dwg_dynapi_entity_data(t,"num_bulges"),w=n.dwg_dynapi_entity_data(t,"bulges"),m=n.dwg_ptr_to_double_array(w,C),S=n.dwg_dynapi_entity_data(t,"num_widths")??0,N=n.dwg_dynapi_entity_data(t,"widths"),W=S>0&&N?n.dwg_ptr_to_double_array(N,S*2):[];return v.forEach((M,k)=>{const U={id:k,x:M.x,y:M.y,bulge:m.length>k?m[k]:0};k<S&&W.length>=(k+1)*2&&(U.startWidth=W[k*2],U.endWidth=W[k*2+1]),T.push(U)}),{type:"LWPOLYLINE",...o,numberOfVertices:d,flag:_,constantWidth:c,elevation:f,thickness:h,extrusionDirection:A,vertices:T}}convertMLine(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"scale"),_=n.dwg_dynapi_entity_data(t,"flags"),c=n.dwg_dynapi_entity_data(t,"justification"),f=n.dwg_dynapi_entity_data(t,"base_point"),h=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"num_lines"),T=n.dwg_dynapi_entity_data(t,"num_verts"),p=n.dwg_dynapi_entity_data(t,"verts"),I=n.dwg_ptr_to_mline_vertex_array(p,T),v=[];return I.forEach(C=>{v.push({vertex:C.vertex,vertexDirection:C.vertex_direction,miterDirection:C.miter_direction,numberOfLines:C.num_lines,lines:C.lines.map(w=>({numberOfSegmentParams:w.num_segparms,segmentParams:w.segparms,numberOfAreaFillParams:w.num_areafillparms,areaFillParams:w.areafillparms}))})}),{type:"MLINE",...o,scale:d,flags:_,justification:c,startPoint:f,extrusionDirection:h,numberOfLines:A,numberOfVertices:T,vertices:v,mlineStyle:""}}convertMultiLeader(t,o){const n=this.libredwg,d=K=>n.dwg_dynapi_entity_data(t,K),_=(K,j,ee)=>n.dwg_dynapi_subclass_data(K,j,ee),c=K=>n.dwg_ref_get_id(K),f=K=>K>0,h=K=>K!=null?yr(K):void 0,A=d("class_version"),T=c(d("mleaderstyle")),p=d("flags"),I=d("type"),v=h(d("line_color")),C=c(d("line_ltype")),w=d("line_linewt"),m=f(d("has_landing")),S=f(d("has_dogleg")),N=d("landing_dist"),W=c(d("arrow_handle")),M=d("arrow_size"),k=d("style_content"),U=c(d("text_style")),J=d("text_left"),nt=d("text_right"),ft=d("text_angletype"),Z=d("text_alignment"),ut=h(d("text_color")),Et=f(d("has_text_frame")),ht=c(d("block_style")),gt=h(d("block_color")),Mt=d("block_scale"),bt=d("block_rotation"),xt=d("style_attachment"),kt=f(d("is_annotative")),dt=f(d("is_neg_textdir")),O=d("ipe_alignment");let tt=d("justification");const z=d("attach_dir"),Ot=d("attach_bottom"),Bt=d("attach_top"),Tt=d("scale_factor"),B=d("num_arrowheads"),Xt=d("arrowheads"),lt=n.dwg_dynapi_subclass_size("LEADER_ArrowHead"),St=[];for(let K=0;K<B;K++){const j=Xt+K*lt;St.push({index:_(j,"LEADER_ArrowHead","is_default"),handle:c(_(j,"LEADER_ArrowHead","arrowhead"))??""})}const Kt=d("num_blocklabels"),se=d("blocklabels"),zt=n.dwg_dynapi_subclass_size("LEADER_BlockLabel"),Ft=[];for(let K=0;K<Kt;K++){const j=se+K*zt;Ft.push({id:c(_(j,"LEADER_BlockLabel","attdef")),index:_(j,"LEADER_BlockLabel","ui_index"),width:_(j,"LEADER_BlockLabel","width"),text:_(j,"LEADER_BlockLabel","label_text")})}const q=t+n.dwg_dynapi_entity_field_offset(t,"ctx"),V=q+n.dwg_dynapi_subclass_field_offset("MLEADER_AnnotContext","content"),Jt=_(q,"MLEADER_AnnotContext","scale_factor"),Te=_(q,"MLEADER_AnnotContext","content_base"),Ut=_(q,"MLEADER_AnnotContext","landing_gap"),Ye=_(q,"MLEADER_AnnotContext","attach_dir"),ye=_(q,"MLEADER_AnnotContext","text_height"),Ne=_(q,"MLEADER_AnnotContext","arrow_size"),Zt=_(q,"MLEADER_AnnotContext","text_left"),Lt=_(q,"MLEADER_AnnotContext","text_right"),X=_(q,"MLEADER_AnnotContext","text_angletype"),We=_(q,"MLEADER_AnnotContext","text_alignment"),qt=f(_(q,"MLEADER_AnnotContext","has_content_txt")),Dt=f(_(q,"MLEADER_AnnotContext","has_content_blk")),Pe=_(q,"MLEADER_AnnotContext","base"),pe=_(q,"MLEADER_AnnotContext","base_dir"),Yt=_(q,"MLEADER_AnnotContext","base_vert"),_e=f(_(q,"MLEADER_AnnotContext","is_normal_reversed"));let Nt,de,Qt,Ie,yt,le,x,ve,ce,jt,me,we,Pt,Wt,Ce,De,ue,Re,Ee,Xe,l;if(qt){const K=_(V,"MLEADER_Content_MText","alignment");K!=null&&K!==0&&(tt=K),de=_(V,"MLEADER_Content_MText","normal"),x=_(V,"MLEADER_Content_MText","location"),Qt=_(V,"MLEADER_Content_MText","rotation"),ve=_(V,"MLEADER_Content_MText","direction"),Ie=_(V,"MLEADER_Content_MText","width"),yt=_(V,"MLEADER_Content_MText","line_spacing_factor"),le=_(V,"MLEADER_Content_MText","line_spacing_style"),Nt=_(V,"MLEADER_Content_MText","flow"),ce=h(_(V,"MLEADER_Content_MText","bg_color")),jt=_(V,"MLEADER_Content_MText","bg_scale"),me=_(V,"MLEADER_Content_MText","bg_transparency"),Pt=f(_(V,"MLEADER_Content_MText","is_bg_fill")),we=f(_(V,"MLEADER_Content_MText","is_bg_mask_fill")),Wt=_(V,"MLEADER_Content_MText","col_type"),Ce=f(_(V,"MLEADER_Content_MText","is_height_auto")),De=_(V,"MLEADER_Content_MText","col_width"),ue=_(V,"MLEADER_Content_MText","col_gutter"),Re=f(_(V,"MLEADER_Content_MText","is_col_flow_reversed"));const j=_(V,"MLEADER_Content_MText","num_col_sizes"),ee=_(V,"MLEADER_Content_MText","col_sizes");j>0&&(Ee=n.dwg_ptr_to_double_array(ee,j)[0]),Xe=f(_(V,"MLEADER_Content_MText","word_break")),l=_(V,"MLEADER_Content_MText","default_text")}let te;if(Dt){const K=_(V,"MLEADER_Content_Block","transform");te={blockContentId:c(_(V,"MLEADER_Content_Block","block_table")),normal:_(V,"MLEADER_Content_Block","normal"),position:_(V,"MLEADER_Content_Block","location"),scale:_(V,"MLEADER_Content_Block","scale"),rotation:_(V,"MLEADER_Content_Block","rotation"),color:h(_(V,"MLEADER_Content_Block","color")),transformationMatrix:K?n.dwg_ptr_to_double_array(K,16):void 0}}const Q=_(q,"MLEADER_AnnotContext","num_leaders"),cn=_(q,"MLEADER_AnnotContext","leaders"),un=n.dwg_dynapi_subclass_size("LEADER_Node"),En=n.dwg_dynapi_subclass_size("LEADER_Line"),Ke=n.dwg_dynapi_subclass_size("LEADER_Break"),Ge=[];for(let K=0;K<Q;K++){const j=cn+K*un,ee=f(_(j,"LEADER_Node","has_lastleaderlinepoint")),st=f(_(j,"LEADER_Node","has_dogleg")),ne=_(j,"LEADER_Node","num_breaks"),$t=_(j,"LEADER_Node","breaks"),re=[];for(let ot=0;ot<ne;ot++){const Rt=$t+ot*Ke;re.push({start:_(Rt,"LEADER_Break","start"),end:_(Rt,"LEADER_Break","end")})}const Se=_(j,"LEADER_Node","num_lines"),$=_(j,"LEADER_Node","lines"),ze=[];for(let ot=0;ot<Se;ot++){const Rt=$+ot*En,Je=_(Rt,"LEADER_Line","num_points"),fn=_(Rt,"LEADER_Line","points"),hn=Je>0?n.dwg_ptr_to_point3d_array(fn,Je):[],Me=_(Rt,"LEADER_Line","num_breaks"),be=_(Rt,"LEADER_Line","breaks"),Le=[];for(let xe=0;xe<Me;xe++){const ke=be+xe*Ke;Le.push({start:_(ke,"LEADER_Break","start"),end:_(ke,"LEADER_Break","end")})}ze.push({vertices:hn,leaderLineIndex:_(Rt,"LEADER_Line","line_index"),breaks:Le.length>0?Le:void 0})}Ge.push({lastLeaderLinePoint:ee?_(j,"LEADER_Node","lastleaderlinepoint"):void 0,lastLeaderLinePointSet:ee,doglegVector:st?_(j,"LEADER_Node","dogleg_vector"):void 0,doglegVectorSet:st,doglegLength:_(j,"LEADER_Node","dogleg_length"),breaks:re.length>0?re:void 0,leaderBranchIndex:_(j,"LEADER_Node","branch_index"),leaderLines:ze})}return{type:"MULTILEADER",...o,subclassMarker:"AcDbMLeader",version:A,leaderStyleId:T,propertyOverrideFlag:p,leaderLineType:I,leaderLineColor:v,leaderLineTypeId:C,leaderLineWeight:w,landingEnabled:m,doglegEnabled:S,doglegLength:N,arrowheadId:W,arrowheadSize:M||Ne,contentType:k,textStyleId:U,textLeftAttachmentType:J||Zt,textRightAttachmentType:nt||Lt,textAngleType:ft||X,textAlignmentType:Z||We,textColor:ut,textFrameEnabled:Et,landingGap:Ut,textAttachment:Ye,textFlowDirection:Nt,blockContentId:ht,blockContentColor:gt,blockContentScale:Mt,blockContentRotation:bt,blockContentConnectionType:xt,annotativeScaleEnabled:kt,arrowheadOverrides:St.length>0?St:void 0,blockAttributes:Ft.length>0?Ft:void 0,textDirectionNegative:dt,textAlignInIPE:O,textAttachmentPoint:tt,textAttachmentDirection:z,bottomTextAttachmentDirection:Ot,topTextAttachmentDirection:Bt,contentScale:Tt||Jt,contentBasePosition:Te,normal:de,textHeight:ye,textRotation:Qt,textWidth:Ie,textLineSpacingFactor:yt,textLineSpacingStyle:le,textAnchor:x,textDirection:ve,textBackgroundColor:ce,textBackgroundScaleFactor:jt,textBackgroundTransparency:me,textBackgroundColorOn:we,textFillOn:Pt,textColumnType:Wt,textUseAutoHeight:Ce,textColumnWidth:De,textColumnGutterWidth:ue,textColumnFlowReversed:Re,textColumnHeight:Ee,textUseWordBreak:Xe,textContent:l,hasMText:qt,hasBlock:Dt,blockContent:te,planeOrigin:Pe,planeXAxisDirection:pe,planeYAxisDirection:Yt,planeNormalReversed:_e,leaderSections:Ge.length>0?Ge:void 0}}convertOle2Frame(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"oleversion"),_=n.dwg_dynapi_entity_data(t,"oleclient"),c=n.dwg_dynapi_entity_data(t,"data_size");let f=n.dwg_dynapi_entity_data(t,"pt1"),h=n.dwg_dynapi_entity_data(t,"pt2");const A=n.dwg_dynapi_entity_data(t,"lock_aspect"),T=n.dwg_dynapi_entity_data(t,"type"),p=n.dwg_dynapi_entity_data(t,"mode"),I=n.dwg_entity_ole2frame_get_data(t),v=I?He(I):"";if(I){const C=So(I);C&&(f=C.upperLeft,h=C.lowerRight)}return{type:"OLE2FRAME",...o,oleVersion:d,oleClient:_,dataSize:c,leftUpPoint:f,rightDownPoint:h,lockAspect:A,oleObjectType:T,tileModeDescriptor:p,binaryData:v}}convertOleFrame(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"flag"),_=n.dwg_dynapi_entity_data(t,"mode"),c=n.dwg_dynapi_entity_data(t,"data_size"),f=n.dwg_entity_oleframe_get_data(t),h=f?He(f):"";return{type:"OLEFRAME",...o,flag:d,mode:_,dataSize:c,binaryData:h}}convertMText(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_height"),c=n.dwg_dynapi_entity_data(t,"rect_height"),f=n.dwg_dynapi_entity_data(t,"rect_width"),h=n.dwg_dynapi_entity_data(t,"extents_width"),A=n.dwg_dynapi_entity_data(t,"extents_height"),T=n.dwg_dynapi_entity_data(t,"attachment"),p=n.dwg_dynapi_entity_data(t,"flow_dir"),I=n.dwg_dynapi_entity_data(t,"text"),v=n.dwg_entity_mtext_get_style_name(t),C=n.dwg_dynapi_entity_data(t,"extrusion"),w=n.dwg_dynapi_entity_data(t,"x_axis_dir"),m=n.dwg_dynapi_entity_data(t,"linespace_style"),S=n.dwg_dynapi_entity_data(t,"linespace_factor"),N=n.dwg_dynapi_entity_data(t,"bg_fill_flag"),W=n.dwg_dynapi_entity_data(t,"bg_fill_scale"),M=n.dwg_dynapi_entity_data(t,"bg_fill_color"),k=n.dwg_dynapi_entity_data(t,"bg_fill_trans"),U=N===1?wo(M):void 0,J=n.dwg_dynapi_entity_data(t,"column_type"),nt=n.dwg_dynapi_entity_data(t,"flow_reversed"),ft=n.dwg_dynapi_entity_data(t,"auto_height"),Z=n.dwg_dynapi_entity_data(t,"column_width"),ut=n.dwg_dynapi_entity_data(t,"gutter"),Et=n.dwg_dynapi_entity_data(t,"num_column_heights"),ht=n.dwg_dynapi_entity_data(t,"column_heights"),gt=n.dwg_ptr_to_double_array(ht,Et);return{type:"MTEXT",...o,insertionPoint:d,textHeight:_,rectHeight:c,rectWidth:f,extentsHeight:A,extentsWidth:h,attachmentPoint:T,drawingDirection:p,text:I,styleName:v,extrusionDirection:C,direction:w,rotation:0,lineSpacingStyle:m,lineSpacing:S,backgroundFill:N,fillBoxScale:W,...U!==void 0?{backgroundFillColor:U}:{},backgroundFillTransparency:k,columnType:J,columnFlowReversed:nt,columnAutoHeight:ft,columnWidth:Z,columnGutter:ut,columnHeightCount:Et,columnHeights:gt}}convertPoint(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"x"),_=n.dwg_dynapi_entity_data(t,"y"),c=n.dwg_dynapi_entity_data(t,"z"),f=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion"),A=n.dwg_dynapi_entity_data(t,"x_ang");return{type:"POINT",...o,position:{x:d,y:_,z:c},thickness:f,extrusionDirection:h,angle:A}}convertPolyline2d(t,o,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),c=d.dwg_dynapi_entity_data(t,"curve_type"),f=d.dwg_dynapi_entity_data(t,"start_width"),h=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"elevation"),T=d.dwg_dynapi_entity_data(t,"thickness"),p=d.dwg_dynapi_entity_data(t,"extrusion"),I=d.dwg_entity_polyline_2d_get_vertices(n)??[];return{type:"POLYLINE2D",...o,flag:_,smoothType:c,startWidth:f,endWidth:h,elevation:A,thickness:T,extrusionDirection:p,vertices:I.map(v=>({x:v.point.x,y:v.point.y,z:v.point.z,startWidth:v.start_width,endWidth:v.end_width,bulge:v.bulge,flag:v.flag,tangentDirection:v.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(t,o,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"flag"),c=d.dwg_dynapi_entity_data(t,"curve_type"),f=d.dwg_dynapi_entity_data(t,"start_width"),h=d.dwg_dynapi_entity_data(t,"end_width"),A=d.dwg_dynapi_entity_data(t,"extrusion"),T=d.dwg_entity_polyline_3d_get_vertices(n)??[];return{type:"POLYLINE3D",...o,flag:_,smoothType:c,startWidth:f,endWidth:h,extrusionDirection:A,vertices:T.map(p=>({x:p.point.x,y:p.point.y,z:p.point.z,flag:p.flag}))}}convertProxyEntity(t,o,n){const d=this.libredwg,_=d.dwg_dynapi_entity_data(t,"proxy_id"),c=d.dwg_dynapi_entity_data(t,"class_id"),f=d.dwg_dynapi_entity_data(t,"data_numbits"),h=d.dwg_dynapi_entity_data(t,"version"),A=d.dwg_dynapi_entity_data(t,"from_dxf"),T=d.dwg_dynapi_entity_data(t,"num_objids"),p=d.dwg_entity_get_preview(n),I=(p==null?void 0:p.length)??0,v=d.dwg_entity_proxy_entity_get_entity_data(t),C=p?He(p):void 0,w=v?He(v):void 0;let m;if(T>0){const W=d.dwg_dynapi_entity_data(t,"objids");W&&(m=d.dwg_ptr_to_object_ref_array(W,T).map(k=>At(k.absolute_ref)))}const S=this.getOriginalDxfName(c),N={type:"ACAD_PROXY_ENTITY",subclassMarker:"AcDbProxyEntity",...o,proxyEntityClassId:_||498,applicationEntityClassId:c};return S&&(N.originalDxfName=S),I>0&&(N.graphicsDataSize=I),C&&(N.graphicsData=C),f>0&&(N.entityDataSize=f),w&&(N.entityData=w),m&&m.length>0&&(N.linkedObjectIds=m),h&&(N.objectDrawingFormat=h),(A===0||A===1)&&(N.originalDataFormat=A),N}getOriginalDxfName(t){if(this.classes.length===0||t<0)return;const o=t>=500?t-500:t;if(o>=0&&o<this.classes.length)return this.classes[o].dxfName}convertRay(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"RAY",...o,firstPoint:d,unitDirection:_}}convertSection(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"state"),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"name"),f=n.dwg_dynapi_entity_data(t,"vert_dir"),h=n.dwg_dynapi_entity_data(t,"top_height"),A=n.dwg_dynapi_entity_data(t,"bottom_height"),T=n.dwg_dynapi_entity_data(t,"indicator_alpha"),p=n.dwg_dynapi_entity_data(t,"indicator_color"),I=n.dwg_dynapi_entity_data(t,"num_verts"),v=n.dwg_dynapi_entity_data(t,"verts"),C=I>0?n.dwg_ptr_to_point3d_array(v,I):[],w=n.dwg_dynapi_entity_data(t,"num_blverts"),m=n.dwg_dynapi_entity_data(t,"blverts"),S=w>0?n.dwg_ptr_to_point3d_array(m,w):[],N=n.dwg_dynapi_entity_data(t,"geometrySettingHardId"),W=n.dwg_ref_get_handle_absolute_ref(N)??0n;return{type:"SECTION",...o,state:d,flags:_,name:c,verticalDirection:f,topHeight:h,bottomHeight:A,indicatorTransparency:T,indicatorColor:p.rgb,numberOfVertices:I,vertices:C,numberOfBackLineVertices:w,backLineVertices:S,geometrySettingHardId:W}}convertShape(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"scale"),c=n.dwg_dynapi_entity_data(t,"rotation"),f=n.dwg_dynapi_entity_data(t,"width_factor"),h=n.dwg_dynapi_entity_data(t,"oblique_angle"),A=n.dwg_dynapi_entity_data(t,"thickness"),T=n.dwg_dynapi_entity_data(t,"extrusion"),p=n.dwg_dynapi_entity_data(t,"style_id"),I=n.dwg_entity_text_get_style_name(t);return{type:"SHAPE",subclassMarker:"AcDbShape",...o,thickness:A,insertionPoint:d,size:_,shapeNumber:p,styleName:I,rotation:c,xScale:f,obliqueAngle:h,extrusionDirection:T}}convertSolid(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),c=n.dwg_dynapi_entity_data(t,"corner3"),f=n.dwg_dynapi_entity_data(t,"corner4"),h=n.dwg_dynapi_entity_data(t,"thickness"),A=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"SOLID",...o,corner1:d,corner2:_,corner3:c,corner4:f,thickness:h,extrusionDirection:A}}convertTrace(t,o){return{...this.convertSolid(t,o),type:"TRACE"}}convertSpline(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"splineflags"),_=n.dwg_dynapi_entity_data(t,"degree"),c=n.dwg_dynapi_entity_data(t,"knot_tol"),f=n.dwg_dynapi_entity_data(t,"num_knots"),h=n.dwg_dynapi_entity_data(t,"knots"),A=n.dwg_ptr_to_double_array(h,f),T=n.dwg_dynapi_entity_data(t,"fit_tol"),p=n.dwg_dynapi_entity_data(t,"num_fit_pts"),I=n.dwg_dynapi_entity_data(t,"fit_pts"),v=n.dwg_ptr_to_point3d_array(I,p),C=n.dwg_dynapi_entity_data(t,"weighted"),w=n.dwg_dynapi_entity_data(t,"ctrl_tol"),m=n.dwg_dynapi_entity_data(t,"num_ctrl_pts"),S=n.dwg_dynapi_entity_data(t,"ctrl_pts"),N=n.dwg_ptr_to_point4d_array(S,m),W=n.dwg_dynapi_entity_data(t,"beg_tan_vec"),M=n.dwg_dynapi_entity_data(t,"end_tan_vec");return{type:"SPLINE",...o,flag:d,degree:_,numberOfKnots:f,numberOfControlPoints:m,numberOfFitPoints:p,knotTolerance:c,controlTolerance:w,fitTolerance:T,startTangent:W,endTangent:M,knots:A,weights:C?N.map(k=>k.w):void 0,controlPoints:N.map(k=>({x:k.x,y:k.y,z:k.z})),fitPoints:v}}convertTable(t,o){const n=this.libredwg,d=n.dwg_dynapi_subclass_data(t,"ldata","name"),_=n.dwg_dynapi_entity_data(t,"ins_pt"),c=n.dwg_dynapi_entity_data(t,"horiz_direction"),f=n.dwg_dynapi_entity_data(t,"flag_for_table_value"),h=n.dwg_dynapi_entity_data(t,"num_rows"),A=n.dwg_dynapi_entity_data(t,"num_cols"),T=n.dwg_dynapi_entity_data(t,"row_heights"),p=n.dwg_ptr_to_double_array(T,h),I=n.dwg_dynapi_entity_data(t,"col_widths"),v=n.dwg_ptr_to_double_array(I,A),C=n.dwg_dynapi_entity_data(t,"tablestyle"),w=n.dwg_ref_get_id(C)??"",m=n.dwg_dynapi_entity_data(t,"block_header"),S=n.dwg_ref_get_id(m)??"",N=n.dwg_dynapi_entity_data(t,"table_flag_override"),W=n.dwg_dynapi_entity_data(t,"border_color_overrides_flag"),M=n.dwg_dynapi_entity_data(t,"border_lineweight_overrides_flag"),k=n.dwg_dynapi_entity_data(t,"border_visibility_overrides_flag"),U=n.dwg_dynapi_entity_data(t,"num_cells"),J=n.dwg_dynapi_entity_data(t,"cells"),nt=n.dwg_ptr_to_table_cell_array(J,U);return{type:"ACAD_TABLE",...o,name:d,startPoint:_,directionVector:c,tableValue:f,rowCount:h,columnCount:A,overrideFlag:N,borderColorOverrideFlag:W,borderLineWeightOverrideFlag:M,borderVisibilityOverrideFlag:k,rowHeightArr:p,columnWidthArr:v,tableStyleId:w,blockRecordHandle:S,cells:this.convertTableCells(nt),bmpPreview:""}}convertTableCells(t){return t.map(o=>{var n,d;return{text:o.text_value,attachmentPoint:o.cell_alignment,textStyle:o.text_style?String(o.text_style):void 0,rotation:o.rotation,cellType:o.type,flagValue:o.flags,mergedValue:o.is_merged_value,autoFit:o.is_autofit_flag,topBorderVisibility:!!o.top_visibility,bottomBorderVisibility:!!o.bottom_visibility,leftBorderVisibility:!!o.left_visibility,rightBorderVisibility:!!o.right_visibility,overrideFlag:o.cell_flag_override,virtualEdgeFlag:o.virtual_edge_flag,blockTableRecordId:o.block_handle?String(o.block_handle.absolute_ref??""):void 0,blockScale:o.block_scale,blockAttrNum:((n=o.attr_defs)==null?void 0:n.length)??0,attrDefineId:(d=o.attr_defs)==null?void 0:d.map(_=>{var c;return String(((c=_.attdef)==null?void 0:c.absolute_ref)??"")}),textHeight:o.text_height??0,extendedCellFlags:o.additional_data_flag}})}convertTextBase(t){const o=this.libredwg,n=o.dwg_dynapi_entity_data(t,"text_value"),d=o.dwg_dynapi_entity_data(t,"thickness"),_=o.dwg_dynapi_entity_data(t,"ins_pt"),c=o.dwg_dynapi_entity_data(t,"alignment_pt"),f=o.dwg_dynapi_entity_data(t,"rotation"),h=o.dwg_dynapi_entity_data(t,"height"),A=o.dwg_dynapi_entity_data(t,"width_factor"),T=o.dwg_dynapi_entity_data(t,"oblique_angle"),p=o.dwg_entity_text_get_style_name(t),I=o.dwg_dynapi_entity_data(t,"generation"),v=o.dwg_dynapi_entity_data(t,"horiz_alignment"),C=o.dwg_dynapi_entity_data(t,"vert_alignment"),w=o.dwg_dynapi_entity_data(t,"elevation"),m=o.dwg_dynapi_entity_data(t,"extrusion");return{text:n,thickness:d,startPoint:_,endPoint:c,textHeight:h,rotation:f,xScale:A,obliqueAngle:T,styleName:p,generationFlag:I,halign:v,valign:C,elevation:w,extrusionDirection:m}}convertText(t,o){return{type:"TEXT",...o,...this.convertTextBase(t)}}convertTolerance(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_value"),c=n.dwg_dynapi_entity_data(t,"x_direction"),f=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_entity_get_dimstyle_name(t);return{type:"TOLERANCE",...o,styleName:h,insertionPoint:d,text:_,extrusionDirection:f,xAxisDirection:c}}convertViewport(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"width"),c=n.dwg_dynapi_entity_data(t,"height"),f=n.dwg_dynapi_entity_data(t,"on_off"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"SNAPBASE"),T=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),p=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),I=n.dwg_dynapi_entity_data(t,"VIEWDIR"),v=n.dwg_dynapi_entity_data(t,"view_target"),C=n.dwg_dynapi_entity_data(t,"lens_length"),w=n.dwg_dynapi_entity_data(t,"front_clip_z"),m=n.dwg_dynapi_entity_data(t,"back_clip_z"),S=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),N=n.dwg_dynapi_entity_data(t,"SNAPANG"),W=n.dwg_dynapi_entity_data(t,"twist_angle"),M=n.dwg_dynapi_entity_data(t,"circle_zoom"),k=n.dwg_dynapi_entity_data(t,"num_frozen_layers");let U;if(k>0){const Jt=n.dwg_dynapi_entity_data(t,"frozen_layers");Jt&&(U=n.dwg_ptr_to_object_ref_ptr_array(Jt,k).map(Ut=>n.dwg_ref_get_id(Ut)).filter(Ut=>!!Ut))}const J=n.dwg_dynapi_entity_data(t,"status_flag"),nt=n.dwg_dynapi_entity_data(t,"clip_boundary"),ft=n.dwg_ref_get_id(nt),Z=n.dwg_dynapi_entity_data(t,"style_sheet"),ut=n.dwg_dynapi_entity_data(t,"render_mode"),Et=n.dwg_dynapi_entity_data(t,"UCSVP"),ht=n.dwg_dynapi_entity_data(t,"ucsorg"),gt=n.dwg_dynapi_entity_data(t,"ucsxdir"),Mt=n.dwg_dynapi_entity_data(t,"ucsydir"),bt=n.dwg_dynapi_entity_data(t,"named_ucs"),xt=n.dwg_ref_get_id(bt),kt=n.dwg_dynapi_entity_data(t,"base_ucs"),dt=n.dwg_ref_get_id(kt),O=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),tt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),z=n.dwg_dynapi_entity_data(t,"shadeplot_mode"),Ot=n.dwg_dynapi_entity_data(t,"use_default_lights"),Bt=n.dwg_dynapi_entity_data(t,"default_lighting_type"),Tt=n.dwg_dynapi_entity_data(t,"brightness"),B=n.dwg_dynapi_entity_data(t,"contrast"),Xt=n.dwg_dynapi_entity_data(t,"grid_major"),lt=n.dwg_dynapi_entity_data(t,"background"),St=n.dwg_ref_get_id(lt),Kt=n.dwg_dynapi_entity_data(t,"shadeplot"),se=n.dwg_ref_get_id(Kt),zt=n.dwg_dynapi_entity_data(t,"visualstyle"),Ft=n.dwg_ref_get_id(zt),q=n.dwg_dynapi_entity_data(t,"sun"),V=n.dwg_ref_get_id(q);return{type:"VIEWPORT",...o,viewportCenter:d,width:_,height:c,status:f,viewportId:0,displayCenter:h,snapBase:A,snapSpacing:T,gridSpacing:p,viewDirection:I,targetPoint:v,perspectiveLensLength:C,frontClipZ:w,backClipZ:m,viewHeight:S,snapAngle:N,viewTwistAngle:W,circleZoomPercent:M,frozenLayerIds:U,statusBitFlags:J,clippingBoundaryId:ft,sheetName:Z,renderMode:ut,ucsPerViewport:Et,ucsOrigin:ht,ucsXAxis:gt,ucsYAxis:Mt,ucsId:xt??"",ucsBaseId:dt??"",orthographicType:O,elevation:tt,shadePlotMode:z,majorGridFrequency:Xt,backgroundId:St??"",shadePlotId:se??"",visualStyleId:Ft??"",isDefaultLighting:!!Ot,defaultLightingType:Bt,brightness:Tt,contrast:B,sunId:V??""}}convertWipeout(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),c=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),A=n.dwg_dynapi_entity_data(t,"display_props"),T=n.dwg_dynapi_entity_data(t,"clipping"),p=n.dwg_dynapi_entity_data(t,"brightness"),I=n.dwg_dynapi_entity_data(t,"contrast"),v=n.dwg_dynapi_entity_data(t,"fade"),C=n.dwg_dynapi_entity_data(t,"clip_mode"),w=n.dwg_dynapi_entity_data(t,"clip_boundary_type"),m=n.dwg_dynapi_entity_data(t,"num_clip_verts"),S=n.dwg_dynapi_entity_data(t,"clip_verts"),N=n.dwg_ptr_to_point2d_array(S,m),W=n.dwg_dynapi_entity_data(t,"imagedef"),M=n.dwg_ref_get_absref(W)??0,k=n.dwg_dynapi_entity_data(t,"imagedefreactor"),U=n.dwg_ref_get_absref(k)??0;return{type:"WIPEOUT",...o,version:d,position:_,uPixel:c,vPixel:f,imageSize:h,imageDefHandle:M,flags:A,clipping:T,brightness:p,contrast:I,fade:v,imageDefReactorHandle:U,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:N,clipMode:C}}convertXline(t,o){const n=this.libredwg,d=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"XLINE",...o,firstPoint:d,unitDirection:_}}getDimensionCommonAttrs(t){const o=this.libredwg,n=o.dwg_dynapi_entity_data(t,"class_version"),d=o.dwg_entity_get_block_name(t,"block"),_=o.dwg_dynapi_entity_data(t,"def_pt"),c=o.dwg_dynapi_entity_data(t,"text_midpt"),f=o.dwg_dynapi_entity_data(t,"attachmentPoint"),h=o.dwg_dynapi_entity_data(t,"flag"),A=o.dwg_dynapi_entity_data(t,"lspace_factor"),T=o.dwg_dynapi_entity_data(t,"lspace_factor"),p=o.dwg_dynapi_entity_data(t,"act_measurement"),I=o.dwg_dynapi_entity_data(t,"user_text"),v=o.dwg_dynapi_entity_data(t,"text_rotation"),C=o.dwg_dynapi_entity_data(t,"ins_rotation"),w=o.dwg_dynapi_entity_data(t,"extrusion"),m=o.dwg_entity_get_dimstyle_name(t);return{type:"DIMENSION",version:n,name:d,definitionPoint:_,textPoint:c,dimensionType:h,attachmentPoint:f,textLineSpacingStyle:A,textLineSpacingFactor:T||1,measurement:p,text:I,textRotation:v,ocsRotation:C,extrusionDirection:w,styleName:m}}getCommonAttrs(t){const o=this.libredwg,n=o.dwg_object_entity_get_color_object(t),d=n.method,_=n.index;let c;(d==194||(n.rgb>>>24&255)===194)&&(c=n.rgb&16777215);const f=this.getLayerName(t),h=o.dwg_object_entity_get_handle_object(t),A=o.dwg_object_entity_get_ownerhandle_object(t),T=o.dwg_object_entity_get_xdicobjhandle_object(t),p=this.getLtypeName(t),I=o.dwg_object_entity_get_line_weight(t),v=o.dwg_object_entity_get_ltype_scale(t),C=!o.dwg_object_entity_get_invisible(t),w=o.dwg_object_entity_get_xdata(t);return{handle:At(h.value),ownerDictionaryHardId:At(T.absolute_ref),ownerBlockRecordSoftId:At(A.absolute_ref),layer:f,color:c,colorIndex:_,colorName:n.name,lineType:p,lineweight:I,lineTypeScale:v,isVisible:C,transparency:n.alpha,transparencyType:n.alpha_type,xdata:w}}getLayerName(t){const n=this.libredwg.dwg_object_entity_get_layer_object_ref(t);return this.layers.get(At(n.handleref.value))??"0"}getLtypeName(t){const n=this.libredwg.dwg_object_entity_get_ltype_object_ref(t);return this.ltypes.get(At(n.handleref.value))??""}}class Er{constructor(t){et(this,"libredwg"),et(this,"entityConverter"),et(this,"orphanEntitiesByBlock",null),et(this,"ownerlessOrphanIndices",null),et(this,"orphanIndexDataPtr",null),et(this,"layerPlotFlagSupported",!0),this.libredwg=t,this.entityConverter=new Lo(t)}convert(t){var o;this.entityConverter.clear(),this.orphanEntitiesByBlock=null,this.ownerlessOrphanIndices=null,this.orphanIndexDataPtr=t,this.layerPlotFlagSupported=!0;const n={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],GROUP:[],IMAGEDEF:[],LAYER_FILTER:[],LAYER_INDEX:[],LAYOUT:[],MLEADERSTYLE:[],SPATIAL_FILTER:[],XRECORD:[]},header:{},entities:[],classes:[]},d=this.libredwg;this.convertHeader(t,n.header),this.layerPlotFlagSupported=d.dwg_get_version_type(t).version>=22,this.convertClasses(t,n.classes),this.entityConverter.setClasses(n.classes);const _=d.dwg_get_num_objects(t);for(let h=0;h<_;h++){const A=d.dwg_get_object(t,h);if(A){const T=this.safeObjectTio(A);if(T)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_LAYER:{const I=this.convertLayer(T,A);n.tables.LAYER.entries.push(I),this.entityConverter.layers.set(I.handle,I.name)}break;case L.DWG_TYPE_LTYPE:{const I=this.convertLineType(T,A);n.tables.LTYPE.entries.push(I),this.entityConverter.ltypes.set(I.handle,I.name)}break}}}for(let h=0;h<_;h++){const A=d.dwg_get_object(t,h);if(A){const T=this.safeObjectTio(A);if(T)switch(d.dwg_object_get_fixedtype(A)){case L.DWG_TYPE_APPID:n.tables.APPID.entries.push(this.convertAppId(T));break;case L.DWG_TYPE_BLOCK_HEADER:{const I=this.convertBlockRecord(T,A);n.tables.BLOCK_RECORD.entries.push(I),(Nn(I.name)||Ro(I.name))&&I.entities.forEach(v=>{n.entities.push(v),v.type==="INSERT"&&v.attribs.forEach(C=>{n.entities.push(C)})})}break;case L.DWG_TYPE_DIMSTYLE:n.tables.DIMSTYLE.entries.push(this.convertDimStyle(T,A));break;case L.DWG_TYPE_STYLE:n.tables.STYLE.entries.push(this.convertStyle(T,A));break;case L.DWG_TYPE_VPORT:n.tables.VPORT.entries.push(this.convertViewport(T,A));break;case L.DWG_TYPE_DICTIONARY:n.objects.DICTIONARY.push(this.convertDictionary(T,A));break;case L.DWG_TYPE_GROUP:n.objects.GROUP.push(this.convertGroup(T,A));break;case L.DWG_TYPE_IMAGEDEF:n.objects.IMAGEDEF.push(this.convertImageDef(T,A));break;case L.DWG_TYPE_LAYERFILTER:n.objects.LAYER_FILTER.push(this.convertLayerFilter(T,A));break;case L.DWG_TYPE_LAYER_INDEX:n.objects.LAYER_INDEX.push(this.convertLayerIndex(T,A));break;case L.DWG_TYPE_LAYOUT:n.objects.LAYOUT.push(this.convertLayout(T,A));break;case L.DWG_TYPE_MLEADERSTYLE:n.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(T,A));break;case L.DWG_TYPE_SPATIAL_FILTER:n.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(T,A));break;case L.DWG_TYPE_XRECORD:n.objects.XRECORD.push(this.convertXRecord(T,A));break}}}const c=n.entities.filter(h=>h.type==="VIEWPORT");c.sort((h,A)=>{const T=parseInt(h.handle,16),p=parseInt(A.handle,16);return T-p}),c.forEach((h,A)=>{h.viewportId=A+1});const f=d.dwg_bmp(t);return(o=f==null?void 0:f.data)!=null&&o.length&&(n.thumbnailImage=f.data),n}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}safeObjectTio(t){const o=this.libredwg;try{if(o.dwg_object_get_supertype(t)!=Ln.DWG_SUPERTYPE_OBJECT)return null;const n=o.dwg_object_to_object_tio(t);return n||null}catch{return null}}convertHeader(t,o){const n=this.libredwg;po.forEach(d=>{let _=d;(d=="DIMBLK"||d=="DIMBLK1"||d=="DIMBLK2")&&(_=_+"_T");let c=n.dwg_dynapi_header_data(t,_);d=="CELTYPE"||d=="CLAYER"||d=="CLAYER"||d=="DIMSTYLE"||d=="DIMTXSTY"||d=="TEXTSTYLE"?c=c?n.dwg_ref_get_object_name(c):"":d=="DRAGVS"&&(c=c?n.dwg_ref_get_absref(c)??2:2),o[d]=c})}convertClasses(t,o){const n=this.libredwg,d=n.dwg_get_num_classes(t);for(let _=0;_<d;_++){const c=n.dwg_get_class(t,_);o.push({dxfName:c.dxfname,cppName:c.cppname,appName:c.appname,capabilitiesFlag:c.proxyflag,instanceCount:c.num_instances,wasAProxyFlag:c.s_zombie,isAnEntityFlag:c.item_class_id===498})}}convertAppId(t){const o=this.libredwg,n=o.dwg_dynapi_entity_data(t,"name"),d=o.dwg_dynapi_entity_data(t,"flag");return{name:n,standardFlag:d}}convertBlockRecord(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_entity_block_header_get_block(t);_.name&&(d.name=_.name);const c=n.dwg_dynapi_entity_data(t,"num_owned"),f=n.dwg_dynapi_entity_data(t,"flag"),h=n.dwg_dynapi_entity_data(t,"description"),A=n.dwg_dynapi_entity_data(t,"base_pt"),T=n.dwg_dynapi_entity_data(t,"insert_units"),p=n.dwg_dynapi_entity_data(t,"explodable"),I=n.dwg_dynapi_entity_data(t,"block_scaling"),v=n.dwg_dynapi_entity_data(t,"layout"),C=n.dwg_ref_get_id(v)??"";let w;const m=n.dwg_entity_block_header_get_preview(t);m&&m.length>0&&(w=He(m));let S=this.convertEntities(o,d.handle);if(!S||S.length==0){S=[];const N=n.dwg_dynapi_entity_data(t,"entities");if(N){const W=n.dwg_ptr_to_object_ref_ptr_array(N,c),M=this.entityConverter;for(let k=0;k<c;k++){const U=n.dwg_ref_get_object(W[k]),J=M.convert(U);J&&(J.ownerBlockRecordSoftId=d.handle,S.push(J))}}}if(this.orphanIndexDataPtr!=null){const N=this.convertOrphanOwnedEntities(this.orphanIndexDataPtr,o,d.handle,Nn(d.name)===!0);if(N.length)if(S.length===0)S=N;else{const W=new Set(S.map(M=>M.handle));for(const M of N)W.has(M.handle)||S.push(M)}}return{...d,flags:f,description:h,basePoint:A,layout:C,insertionUnits:T,explodability:p,scalability:I,bmpPreview:w,entities:S}}convertEntities(t,o){const n=this.libredwg,d=this.entityConverter,_=[];let c=n.get_first_owned_entity(t);for(;c;){const f=d.convert(c);f&&(f.ownerBlockRecordSoftId=o,_.push(f)),c=n.get_next_owned_entity(t,c)}return _}convertOrphanOwnedEntities(t,o,n,d){this.ensureOrphanEntityIndex(t);const c=(this.orphanEntitiesByBlock??new Map).get(o)??[],f=d&&this.ownerlessOrphanIndices?this.ownerlessOrphanIndices:[],h=c.length&&f.length?c.concat(f):c.length?c:f;if(h.length===0)return[];const A=this.libredwg,T=this.entityConverter,p=[];for(const I of h){const v=A.dwg_get_object(t,I),C=T.convert(v);C&&(C.ownerBlockRecordSoftId=n,p.push(C))}return p}isOwnedByMissingBlock(t,o){if(!o)return!1;const n=this.libredwg;try{const d=n.dwg_dynapi_common_value(o,"entmode");if(!d.success||Number(d.data)!==0)return!1;const _=n.dwg_dynapi_common_value(o,"ownerhandle");if(!_.success||!_.data)return!1;const c=n.dwg_ref_get_absref(_.data);return c==null?!1:!n.dwg_resolve_handle_silent(t,BigInt(c))}catch{return!1}}ensureOrphanEntityIndex(t){if(this.orphanEntitiesByBlock)return;const o=this.libredwg,n=o.dwg_get_num_objects(t),d=new Map,_=[],c=[],f=new Map;for(let p=0;p<n;p++){const I=o.dwg_get_object(t,p);if(I){if(o.dwg_object_get_supertype(I)===Ln.DWG_SUPERTYPE_ENTITY)_.push(p),d.set(I,p);else if(o.dwg_object_get_fixedtype(I)===L.DWG_TYPE_BLOCK_HEADER){c.push(I);const v=o.dwg_object_to_object_tio(I);v&&f.set(v,I)}}}const h=new Set;for(const p of c){let I=o.get_first_owned_entity(p),v=0;for(;I&&v++<=_.length;){const C=d.get(I);if(C===void 0||h.has(C))break;h.add(C),I=o.get_next_owned_entity(p,I)}}const A=new Map,T=[];for(const p of _){if(h.has(p))continue;const I=o.dwg_get_object(t,p),v=I?o.dwg_object_to_entity_tio(I):0,C=v?o.dwg_entity_owner(v):0,w=C?f.get(C)??0:0;if(w){const m=A.get(w);m?m.push(p):A.set(w,[p])}else this.isOwnedByMissingBlock(t,v)||T.push(p)}this.orphanEntitiesByBlock=A,this.ownerlessOrphanIndices=T}convertDimStyle(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"DIMTOL"),c=n.dwg_dynapi_entity_data(t,"DIMLIM"),f=n.dwg_dynapi_entity_data(t,"DIMTIH"),h=n.dwg_dynapi_entity_data(t,"DIMTOH"),A=n.dwg_dynapi_entity_data(t,"DIMSE1"),T=n.dwg_dynapi_entity_data(t,"DIMSE2"),p=n.dwg_dynapi_entity_data(t,"DIMALT"),I=n.dwg_dynapi_entity_data(t,"DIMTOFL"),v=n.dwg_dynapi_entity_data(t,"DIMSAH"),C=n.dwg_dynapi_entity_data(t,"DIMTIX"),w=n.dwg_dynapi_entity_data(t,"DIMSOXD"),m=n.dwg_dynapi_entity_data(t,"DIMALTD"),S=n.dwg_dynapi_entity_data(t,"DIMZIN"),N=n.dwg_dynapi_entity_data(t,"DIMSD1"),W=n.dwg_dynapi_entity_data(t,"DIMSD2"),M=n.dwg_dynapi_entity_data(t,"DIMTOLJ"),k=n.dwg_dynapi_entity_data(t,"DIMJUST"),U=n.dwg_dynapi_entity_data(t,"DIMFIT"),J=n.dwg_dynapi_entity_data(t,"DIMUPT"),nt=n.dwg_dynapi_entity_data(t,"DIMTZIN"),ft=n.dwg_dynapi_entity_data(t,"DIMALTZ"),Z=n.dwg_dynapi_entity_data(t,"DIMALTTZ"),ut=n.dwg_dynapi_entity_data(t,"DIMTAD"),Et=n.dwg_dynapi_entity_data(t,"DIMUNIT"),ht=n.dwg_dynapi_entity_data(t,"DIMAUNIT"),gt=n.dwg_dynapi_entity_data(t,"DIMDEC"),Mt=n.dwg_dynapi_entity_data(t,"DIMTDEC"),bt=n.dwg_dynapi_entity_data(t,"DIMALTU"),xt=n.dwg_dynapi_entity_data(t,"DIMALTTD"),kt=n.dwg_dynapi_entity_data(t,"DIMSCALE"),dt=n.dwg_dynapi_entity_data(t,"DIMASZ"),O=n.dwg_dynapi_entity_data(t,"DIMEXO"),tt=n.dwg_dynapi_entity_data(t,"DIMDLI"),z=n.dwg_dynapi_entity_data(t,"DIMEXE"),Ot=n.dwg_dynapi_entity_data(t,"DIMRND"),Bt=n.dwg_dynapi_entity_data(t,"DIMDLE"),Tt=n.dwg_dynapi_entity_data(t,"DIMTP"),B=n.dwg_dynapi_entity_data(t,"DIMTM"),Xt=n.dwg_dynapi_entity_data(t,"DIMFXL"),lt=n.dwg_dynapi_entity_data(t,"DIMJOGANG"),St=n.dwg_dynapi_entity_data(t,"DIMTFILL"),Kt=n.dwg_dynapi_entity_data(t,"DIMTFILLCLR"),se=n.dwg_dynapi_entity_data(t,"DIMAZIN"),zt=n.dwg_dynapi_entity_data(t,"DIMARCSYM"),Ft=n.dwg_dynapi_entity_data(t,"DIMTXT"),q=n.dwg_dynapi_entity_data(t,"DIMCEN"),V=n.dwg_dynapi_entity_data(t,"DIMTSZ"),Jt=n.dwg_dynapi_entity_data(t,"DIMALTF"),Te=n.dwg_dynapi_entity_data(t,"DIMLFAC"),Ut=n.dwg_dynapi_entity_data(t,"DIMTVP"),Ye=n.dwg_dynapi_entity_data(t,"DIMTFAC"),ye=n.dwg_dynapi_entity_data(t,"DIMGAP"),Ne=n.dwg_dynapi_entity_data(t,"DIMPOST"),Zt=n.dwg_dynapi_entity_data(t,"DIMAPOST"),Lt=n.dwg_dynapi_entity_data(t,"DIMBLK_T"),X=n.dwg_dynapi_entity_data(t,"DIMBLK1_T"),We=n.dwg_dynapi_entity_data(t,"DIMBLK2_T"),qt=n.dwg_dynapi_entity_data(t,"DIMALTRND"),Dt=n.dwg_dynapi_entity_data(t,"DIMCLRD_N"),Pe=n.dwg_dynapi_entity_data(t,"DIMCLRE_N"),pe=n.dwg_dynapi_entity_data(t,"DIMCLRT_N"),Yt=n.dwg_dynapi_entity_data(t,"DIMCLRD"),_e=n.dwg_dynapi_entity_data(t,"DIMCLRE"),Nt=n.dwg_dynapi_entity_data(t,"DIMCLRT"),de=n.dwg_dynapi_entity_data(t,"DIMADEC"),Qt=n.dwg_dynapi_entity_data(t,"DIMFRAC"),Ie=n.dwg_dynapi_entity_data(t,"DIMLUNIT"),yt=n.dwg_dynapi_entity_data(t,"DIMDSEP"),le=n.dwg_dynapi_entity_data(t,"DIMTMOVE"),x=n.dwg_dynapi_entity_data(t,"DIMATFIT"),ve=n.dwg_dynapi_entity_data(t,"DIMFXLON"),ce=n.dwg_dynapi_entity_data(t,"DIMTXTDIRECTION"),jt=n.dwg_dynapi_entity_data(t,"DIMALTMZF"),me=n.dwg_dynapi_entity_data(t,"DIMALTMZS"),we=n.dwg_dynapi_entity_data(t,"DIMMZF"),Pt=n.dwg_dynapi_entity_data(t,"DIMMZS"),Wt=n.dwg_dynapi_entity_data(t,"DIMLWD"),Ce=n.dwg_dynapi_entity_data(t,"DIMLWE"),De=n.dwg_dynapi_entity_data(t,"DIMTXSTY"),ue=n.dwg_ref_get_absref(De)??void 0,Re=n.dwg_dynapi_entity_data(t,"DIMLDRBLK"),Ee=n.dwg_ref_get_absref(Re)??void 0;return{...d,DIMPOST:Ne,DIMAPOST:Zt,DIMBLK:Lt,DIMBLK1:X,DIMBLK2:We,DIMSCALE:kt,DIMASZ:dt,DIMEXO:O,DIMDLI:tt,DIMEXE:z,DIMRND:Ot,DIMDLE:Bt,DIMTP:Tt,DIMTM:B,DIMTXT:Ft,DIMCEN:q,DIMTSZ:V,DIMALTF:Jt,DIMLFAC:Te,DIMTVP:Ut,DIMTFAC:Ye,DIMGAP:ye,DIMALTRND:qt,DIMTOL:_,DIMLIM:c,DIMTIH:f,DIMTOH:h,DIMSE1:A,DIMSE2:T,DIMTAD:ut,DIMZIN:S,DIMAZIN:se,DIMALT:p,DIMALTD:m,DIMTOFL:I,DIMSAH:v,DIMTIX:C,DIMSOXD:w,DIMCLRD:Yt,DIMCLRE:_e,DIMCLRT:Nt,DIMADEC:de,DIMUNIT:Et,DIMDEC:gt,DIMTDEC:Mt,DIMALTU:bt,DIMALTTD:xt,DIMAUNIT:ht,DIMFRAC:Qt,DIMLUNIT:Ie,DIMDSEP:String.fromCharCode(yt),DIMTMOVE:le,DIMJUST:k,DIMSD1:N,DIMSD2:W,DIMTOLJ:M,DIMTZIN:nt,DIMALTZ:ft,DIMALTTZ:Z,DIMFIT:U,DIMUPT:J,DIMATFIT:x,DIMTXSTY:ue,DIMLDRBLK:Ee,DIMLWD:Wt,DIMLWE:Ce,DIMFXL:Xt,DIMJOGANG:lt,DIMTFILL:St,DIMTFILLCLR:Kt,DIMARCSYM:zt,DIMCLRD_N:Dt,DIMCLRE_N:Pe,DIMCLRT_N:pe,DIMFXLON:ve,DIMTXTDIRECTION:ce,DIMALTMZF:jt,DIMALTMZS:me,DIMMZF:we,DIMMZS:Pt}}convertLayer(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"frozen"),f=n.dwg_dynapi_entity_data(t,"off"),h=n.dwg_dynapi_entity_data(t,"frozen_in_new"),A=n.dwg_dynapi_entity_data(t,"locked");let T=n.dwg_dynapi_entity_data(t,"plotflag");this.layerPlotFlagSupported||(T=1);const p=n.dwg_dynapi_entity_data(t,"linewt"),I=n.dwg_dynapi_entity_data(t,"color"),v=n.dwg_dynapi_entity_data(t,"ltype");let C="Continuous";if(v)try{C=n.dwg_ref_get_object_name(v)}catch{}const w=I.method;let m=256,S=16777215;return w===195||(I.rgb>>>24&255)===195?m=I.rgb&255:w==194||(I.rgb>>>24&255)===194?S=I.rgb&16777215:I.index>=1&&I.index<=255&&(m=I.index),{...d,standardFlag:_,colorIndex:m,color:S,colorName:I.name,transparency:I.alpha,lineType:C,frozen:c!=0,off:f!=0,frozenInNew:h!=0,locked:A!=0,plotFlag:T,lineweight:p,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"description"),f=n.dwg_dynapi_entity_data(t,"numdashes"),h=n.dwg_dynapi_entity_data(t,"pattern_len"),A=n.dwg_dynapi_entity_data(t,"dashes"),T=A?n.dwg_ptr_to_ltype_dash_array(A,f):[];return{...d,description:c,standardFlag:_,numberOfLineTypes:f,totalPatternLength:h,pattern:this.convertLineTypePattern(T)}}convertLineTypePattern(t){const o=[];return t.forEach(n=>{o.push({elementLength:n.length||0,elementTypeFlag:n.shape_flag||0,shapeNumber:n.complex_shapecode,scale:n.scale,rotation:n.rotation,offsetX:n.x_offset,offsetY:n.y_offset,text:n.text})}),o}convertStyle(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"width_factor"),f=n.dwg_dynapi_entity_data(t,"oblique_angle"),h=n.dwg_dynapi_entity_data(t,"generation"),A=n.dwg_dynapi_entity_data(t,"last_height"),T=n.dwg_dynapi_entity_data(t,"font_file"),p=n.dwg_dynapi_entity_data(t,"bigfont_file");return{...d,standardFlag:_,fixedTextHeight:0,widthFactor:c,obliqueAngle:f,textGenerationFlag:h,lastHeight:A,font:T,bigFont:p}}convertViewport(t,o){const n=this.libredwg,d=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),c=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),f=n.dwg_dynapi_entity_data(t,"aspect_ratio"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),A=n.dwg_dynapi_entity_data(t,"view_target"),T=n.dwg_dynapi_entity_data(t,"VIEWDIR"),p=n.dwg_dynapi_entity_data(t,"view_twist"),I=n.dwg_dynapi_entity_data(t,"lens_length"),v=n.dwg_dynapi_entity_data(t,"front_clip_z"),C=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"VIEWMODE"),m=n.dwg_dynapi_entity_data(t,"render_mode"),S=n.dwg_dynapi_entity_data(t,"use_default_lights")!=0,N=n.dwg_dynapi_entity_data(t,"default_lightning_type"),W=n.dwg_dynapi_entity_data(t,"brightness"),M=n.dwg_dynapi_entity_data(t,"contrast"),k=n.dwg_dynapi_entity_data(t,"ambient_color"),U=n.dwg_dynapi_entity_data(t,"lower_left"),J=n.dwg_dynapi_entity_data(t,"upper_right"),nt=n.dwg_dynapi_entity_data(t,"circle_zoom"),ft=n.dwg_dynapi_entity_data(t,"UCSICON"),Z=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),ut=n.dwg_dynapi_entity_data(t,"SNAPANG"),Et=n.dwg_dynapi_entity_data(t,"SNAPBASE"),ht=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),gt=n.dwg_dynapi_entity_data(t,"ucsorg"),Mt=n.dwg_dynapi_entity_data(t,"ucsxdir"),bt=n.dwg_dynapi_entity_data(t,"ucsydir"),xt=n.dwg_dynapi_entity_data(t,"ucs_elevation"),kt=n.dwg_dynapi_entity_data(t,"grid_major"),dt=n.dwg_dynapi_entity_data(t,"background"),O=dt?n.dwg_ref_get_id(dt)??"":void 0,tt=n.dwg_dynapi_entity_data(t,"visualstyle"),z=tt?n.dwg_ref_get_id(tt)??"":void 0;return{...d,standardFlag:_,lowerLeftCorner:U,upperRightCorner:J,center:h,snapBasePoint:Et,snapSpacing:ht,gridSpacing:Z,viewDirectionFromTarget:T,viewTarget:A,lensLength:I,frontClippingPlane:v,backClippingPlane:C,viewHeight:c,aspectRatio:f,snapRotationAngle:ut,viewTwistAngle:p,circleSides:nt,frozenLayers:[],styleSheet:"",renderMode:m,viewMode:w,ucsIconSetting:ft,ucsOrigin:gt,ucsXAxis:Mt,ucsYAxis:bt,orthographicType:0,elevation:xt,shadePlotSetting:0,majorGridLines:kt,backgroundObjectId:O,visualStyleObjectId:z,isDefaultLightingOn:S,defaultLightingType:N,brightness:W,contrast:M,ambientColor:k.index}}getCommonTableEntryAttrs(t,o){const n=this.libredwg,d=n.dwg_object_get_tio(o),_=n.dwg_object_object_get_ownerhandle_object(d),c=n.dwg_object_get_handle_object(o);return{handle:At(c.value),ownerHandle:At(_.absolute_ref),name:n.dwg_dynapi_entity_data(t,"name")}}convertDictionary(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"is_hardowner"),c=n.dwg_dynapi_entity_data(t,"cloning"),f=n.dwg_dynapi_entity_data(t,"numitems"),h=n.dwg_dynapi_entity_data(t,"itemhandles"),A=n.dwg_ptr_to_object_ref_array(h,f),T=n.dwg_object_dictionary_get_texts(o),p={};return A.forEach((I,v)=>p[T[v]]=At(I.absolute_ref)),{...d,isHardOwner:!!_,cloningFlag:c,entries:p}}convertImageDef(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"image_size"),c=n.dwg_dynapi_entity_data(t,"file_path"),f=n.dwg_dynapi_entity_data(t,"is_loaded"),h=n.dwg_dynapi_entity_data(t,"pixel_size"),A=n.dwg_dynapi_entity_data(t,"resunits");return{...d,fileName:c,size:_,sizeOfOnePixel:h,isLoaded:f,resolutionUnits:A}}convertLayerFilter(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"num_names")??0,c=n.dwg_dynapi_entity_data(t,"names"),f=c&&_>0?n.dwg_ptr_to_wchar_string_array(c,_).filter(h=>h!=null&&h!==""):[];return{...d,...f.length?{layerNames:f}:{}}}convertLayerIndex(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"last_updated"),c=n.dwg_dynapi_entity_data(t,"num_entries")??0,f=n.dwg_dynapi_entity_data(t,"entries"),h=n.dwg_dynapi_subclass_size("LAYER_entry"),A=[],T=[],p=[];if(f&&h>0)for(let I=0;I<c;I++){const v=f+I*h,C=n.dwg_dynapi_subclass_data(v,"LAYER_entry","name");A.push(C??"");const w=n.dwg_dynapi_subclass_data(v,"LAYER_entry","handle");T.push(w?n.dwg_ref_get_id(w)??"":""),p.push(n.dwg_dynapi_subclass_data(v,"LAYER_entry","numlayers")??0)}return{...d,..._!=null?{timeStamp:_}:{},...A.length?{layerNames:A}:{},...T.length?{idBufferIds:T}:{},...p.length?{idBufferEntryCounts:p}:{}}}convertLayout(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"layout_name"),c=n.dwg_dynapi_entity_data(t,"tab_order"),f=n.dwg_dynapi_entity_data(t,"layout_flags"),h=n.dwg_dynapi_entity_data(t,"INSBASE"),A=n.dwg_dynapi_entity_data(t,"LIMMIN"),T=n.dwg_dynapi_entity_data(t,"LIMMAX"),p=n.dwg_dynapi_entity_data(t,"UCSORG"),I=n.dwg_dynapi_entity_data(t,"UCSXDIR"),v=n.dwg_dynapi_entity_data(t,"UCSYDIR"),C=n.dwg_dynapi_entity_data(t,"UCSORTHOVIEW"),w=n.dwg_dynapi_entity_data(t,"EXTMIN"),m=n.dwg_dynapi_entity_data(t,"EXTMAX"),S=n.dwg_dynapi_entity_data(t,"ucs_elevation"),N=n.dwg_dynapi_entity_data(t,"block_header"),W=n.dwg_ref_get_id(N)??"",M=n.dwg_dynapi_entity_data(t,"active_viewport"),k=n.dwg_ref_get_id(M)??"",U=n.dwg_dynapi_entity_data(t,"named_ucs"),J=U?n.dwg_ref_get_id(U)??"":void 0;return{...d,layoutName:_,controlFlag:f,tabOrder:c,minLimit:A,maxLimit:T,insertionPoint:h,minExtent:w,maxExtent:m,elevation:S,ucsOrigin:p,ucsXAxis:I,ucsYAxis:v,orthographicType:C,paperSpaceTableId:W,viewportId:k,namedUcsId:J,shadePlotId:""}}convertMLeaderStyle(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=A=>n.dwg_dynapi_entity_data(t,A),c=A=>n.dwg_ref_get_id(A),f=A=>A>0,h=A=>A!=null?yr(A):void 0;return{...d,subclassMarker:"AcDbMLeaderStyle",unknown1:_("class_version"),contentType:_("content_type"),drawMLeaderOrderType:_("mleader_order"),drawLeaderOrderType:_("leader_order"),maxLeaderSegmentPoints:_("max_points"),firstSegmentAngleConstraint:_("first_seg_angle"),secondSegmentAngleConstraint:_("second_seg_angle"),leaderLineType:_("type"),leaderLineColor:h(_("line_color")),leaderLineTypeId:c(_("line_type")),leaderLineWeight:_("linewt"),landingEnabled:f(_("has_landing")),landingGap:_("landing_gap"),doglegEnabled:f(_("has_dogleg")),doglegLength:_("landing_dist"),description:_("description"),arrowheadId:c(_("arrow_head")),arrowheadSize:_("arrow_head_size"),defaultMTextContents:_("text_default"),textStyleId:c(_("text_style")),textLeftAttachmentType:_("attach_left"),textAngleType:_("text_angle_type"),textAlignmentType:_("text_align_type"),textRightAttachmentType:_("attach_right"),textColor:h(_("text_color")),textHeight:_("text_height"),textFrameEnabled:f(_("has_text_frame")),textAlignAlwaysLeft:f(_("text_always_left")),alignSpace:_("align_space"),blockContentId:c(_("block")),blockContentColor:h(_("block_color")),blockContentScale:_("block_scale"),blockContentScaleEnabled:f(_("use_block_scale")),blockContentRotation:_("block_rotation"),blockContentRotationEnabled:f(_("use_block_rotation")),blockContentConnectionType:_("block_connection"),scale:_("scale"),overwritePropertyValue:f(_("is_changed")),annotative:f(_("is_annotative")),breakGapSize:_("break_size"),textAttachmentDirection:_("attach_dir"),bottomTextAttachmentDirection:_("attach_bottom"),topTextAttachmentDirection:_("attach_top"),unknown2:f(_("text_extended"))}}convertSpatialFilter(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"origin"),c=n.dwg_dynapi_entity_data(t,"num_clip_verts"),f=n.dwg_dynapi_entity_data(t,"clip_verts"),h=n.dwg_ptr_to_point2d_array(f,c),A=n.dwg_dynapi_entity_data(t,"extrusion"),T=n.dwg_dynapi_entity_data(t,"display_boundary_on"),p=n.dwg_dynapi_entity_data(t,"front_clip_on"),I=n.dwg_dynapi_entity_data(t,"front_clip_z"),v=n.dwg_dynapi_entity_data(t,"back_clip_on"),C=n.dwg_dynapi_entity_data(t,"back_clip_z"),w=n.dwg_dynapi_entity_data(t,"transform"),m=n.dwg_ptr_to_double_array(w,12),S=n.dwg_dynapi_entity_data(t,"inverse_transform"),N=n.dwg_ptr_to_double_array(S,12);return{...d,origin:_,numberOfPointsOnClipBoundary:c,vertices:h,extrusionDirection:A,clipBoundaryVisible:!!T,frontClippingPlaneFlag:!!p,frontClippingPlaneDistance:I,backClippingPlaneFlag:!!v,backClippingPlaneDistance:C,matrix:m,invertBlockMatrix:N}}convertGroup(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"name")??"",c=!!n.dwg_dynapi_entity_data(t,"unnamed"),f=n.dwg_dynapi_entity_data(t,"selectable"),h=f!=null?!!f:!0,A=n.dwg_dynapi_entity_data(t,"num_groups")??0,T=n.dwg_dynapi_entity_data(t,"groups")??0,I=(A>0&&T?n.dwg_ptr_to_object_ref_array(T,A):[]).map(v=>At(v.absolute_ref));return{...d,description:_,unnamed:c,selectable:h,objectHandles:I}}convertXRecord(t,o){const n=this.libredwg,d=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"cloning"),c=n.dwg_object_xrecord_get_xdata(t)??[],f=n.dwg_object_get_tio(o),h=f?n.dwg_object_object_get_xdicobjhandle_object(f):null,A=h&&h.absolute_ref?At(h.absolute_ref):void 0;return{...d,..._!=null?{cloning:_}:{},...A?{extensionDictionary:A}:{},data:c}}getCommonObjectAttrs(t){const o=this.libredwg,n=o.dwg_object_get_tio(t),d=o.dwg_object_object_get_ownerhandle_object(n),_=o.dwg_object_get_handle_object(t);return{handle:At(_.value),ownerHandle:At(d.absolute_ref)}}}class vt{constructor(){et(this,"min"),et(this,"max"),et(this,"valid"),this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(t){return this.min.x=Math.min(this.min.x,t.x),this.min.y=Math.min(this.min.y,t.y),this.max.x=Math.max(this.max.x,t.x),this.max.y=Math.max(this.max.y,t.y),this.valid=!0,this}transform(t,o){const n=this.getCorners().map(d=>({x:d.x*t.x+o.x,y:d.y*t.y+o.y}));this.reset();for(const d of n)this.expandByPoint(d);return this}rotate(t,o){const n=Math.cos(t),d=Math.sin(t),_=this.getCorners().map(c=>{const f=c.x-o.x,h=c.y-o.y;return{x:o.x+f*n-h*d,y:o.y+f*d+h*n}});this.reset();for(const c of _)this.expandByPoint(c);return this}clone(){const t=new vt;return t.min={x:this.min.x,y:this.min.y},t.max={x:this.max.x,y:this.max.y},t.valid=this.valid,t}reset(){this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}getCorners(){return[{x:this.min.x,y:this.min.y},{x:this.min.x,y:this.max.y},{x:this.max.x,y:this.min.y},{x:this.max.x,y:this.max.y}]}}function Yo(r,t,o,n,d){const _=o.length;if(_===0)throw new Error("points must not be empty");const c=o[0].length;if(r<0||r>1)throw new Error(`t out of bounds [0,1]: ${r}`);if(t<1)throw new Error("degree must be at least 1 (linear)");if(t>_-1)throw new Error("degree must be less than or equal to point count - 1");const f=d??new Array(_).fill(1),h=n??(()=>{const w=[];for(let m=0;m<_+t+1;m++)w.push(m);return w})();if(h.length!==_+t+1)throw new Error("bad knot vector length");const A=[t,h.length-1-t],T=h[A[0]],p=h[A[1]];r=r*(p-T)+T,r=Math.max(r,T),r=Math.min(r,p);let I=A[0];for(;I<A[1]&&!(r>=h[I]&&r<=h[I+1]);I++);const v=new Array(_);for(let w=0;w<_;w++){v[w]=new Array(c+1);for(let m=0;m<c;m++)v[w][m]=o[w][m]*f[w];v[w][c]=f[w]}for(let w=1;w<=t+1;w++)for(let m=I;m>I-t-1+w;m--){const S=h[m+t+1-w]-h[m],N=S===0?0:(r-h[m])/S;for(let W=0;W<c+1;W++)v[m][W]=(1-N)*v[m-1][W]+N*v[m][W]}const C=new Array(c);for(let w=0;w<c;w++)C[w]=No(v[I][w]/v[I][c],-9);return C}function No(r,t){if(isNaN(r)||!Number.isInteger(t))return NaN;const[o,n="0"]=r.toString().split("e"),d=Math.round(+`${o}e${+n-t}`),[_,c="0"]=d.toString().split("e");return+`${_}e${+c+t}`}const dn={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},wn=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function Ue(r,t,o){return Math.max(t,Math.min(o,r))}const Pr=class pr{constructor(){et(this,"_colorIndex"),et(this,"_color"),et(this,"_colorName"),this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(t){t==null?this._color=null:(this._color=Math.round(Ue(t,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let t=this._color.toString(16).toUpperCase();for(;t.length<6;)t="0"+t;return`0x${t}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color!=null?this.color>>16&255:null}get green(){return this.color!=null?this.color>>8&255:null}get blue(){return this.color!=null?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(t){t==null?this._colorIndex=null:(this._colorIndex=Ue(t,0,256),this._color=wn[t],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(t){if(t){const o=dn[t.toLowerCase()];o!==void 0&&(this._colorName=t,this._color=o,this._colorIndex=this.getColorIndexByValue(this._color))}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(t){return this.setRGB(t,t,t),this}setRGB(t,o,n){const d=Math.round(Ue(t,0,255)),_=Math.round(Ue(o,0,255)),c=Math.round(Ue(n,0,255));return this.color=(d<<16)+(_<<8)+c,this}setColorName(t){const o=dn[t.toLowerCase()];return o!==void 0&&(this.color=o),this}clone(){const t=new pr;return t.colorIndex=this.colorIndex,t.color=this.color,t._colorName=this._colorName,this}copy(t){return this.colorIndex=t.colorIndex,this.color=t.color,this._colorName=t._colorName,this}equals(t){return t.color==this.color&&t.colorIndex==this.colorIndex&&t._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(t){for(const[o,n]of Object.entries(dn))if(n===t)return o;return null}getColorIndexByValue(t){const o=wn.length-1;for(let n=1;n<o;++n)if(wn[n]===t)return n;return null}};et(Pr,"NAMES",dn);let Wo=Pr;class Ct{constructor(t,o){et(this,"x"),et(this,"y"),this.x=t,this.y=o}add(t){return new Ct(this.x+t.x,this.y+t.y)}sub(t){return new Ct(this.x-t.x,this.y-t.y)}multiply(t){return new Ct(this.x*t,this.y*t)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const t=this.length();return t===0?new Ct(0,0):new Ct(this.x/t,this.y/t)}}function Go(r,t,o,n=5){let d,_,c;o<0?(d=Math.atan(-o)*4,_=new Ct(r.x,r.y),c=new Ct(t.x,t.y)):(d=Math.atan(o)*4,_=new Ct(t.x,t.y),c=new Ct(r.x,r.y));const f=c.sub(_),h=f.length(),A=_.add(f.multiply(.5)),T=Math.abs(h/2/Math.tan(d/2)),p=f.norm(),I=new Ct(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)),v=d<Math.PI?A.add(I.multiply(-T)):A.add(I.multiply(T)),C=Math.atan2(c.y-v.y,c.x-v.x)/Math.PI*180;let w=Math.atan2(_.y-v.y,_.x-v.x)/Math.PI*180;w<C&&(w+=360);const m=c.sub(v).length(),S=Math.floor(C/n)*n+n,N=Math.ceil(w/n)*n-n,W=[];for(let M=S;M<=N;M+=n){const k=M/180*Math.PI,U=v.add(new Ct(Math.cos(k)*m,Math.sin(k)*m));W.push(U)}return o<0&&W.reverse(),W}function Mo(r,t=!1){let o=[];const n=r.vertices.map(d=>({x:d.x,y:d.y,bulge:d.bulge}));t&&n.push(n[0]);for(let d=0,_=n.length;d<_-1;++d){const c=n[d],f=n[d+1];o.push(c),n[d].bulge&&(o=o.concat(Go(c,f,r.vertices[d].bulge))),d===_-2&&o.push(f)}return o}class bo{constructor(){et(this,"blockMap",new Map)}rotate(t,o){const n=Math.cos(o),d=Math.sin(o);return{x:t.x*n-t.y*d,y:t.x*d+t.y*n}}interpolateBSpline(t,o,n,d=25,_){const c=[],f=t.map(T=>[T.x,T.y]),h=[n[o]],A=[n[o],n[n.length-1-o]];for(let T=o+1;T<n.length-o;++T)h[h.length-1]!==n[T]&&h.push(n[T]);for(let T=1;T<h.length;++T){const p=h[T-1],I=h[T];for(let v=0;v<=d;++v){let w=(v/d*(I-p)+p-A[0])/(A[1]-A[0]);w=Math.max(0,Math.min(1,w));const m=Yo(w,o,f,n,_);c.push({x:m[0],y:m[1]})}}return c}addFlipXIfApplicable(t,{bbox:o,element:n}){return"extrusionDirection"in t&&t.extrusionDirection.z===-1?{bbox:new vt().expandByPoint({x:-o.min.x,y:o.min.y}).expandByPoint({x:-o.max.x,y:o.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${n}</g>`}:{bbox:o,element:n}}line(t){const o=new vt().expandByPoint({x:t.startPoint.x,y:t.startPoint.y}).expandByPoint({x:t.endPoint.x,y:t.endPoint.y}),n=`<line x1="${t.startPoint.x}" y1="${t.startPoint.y}" x2="${t.endPoint.x}" y2="${t.endPoint.y}" />`;return{bbox:o,element:n}}ray(t){const n=t.firstPoint,d={x:n.x+t.unitDirection.x*1e4,y:n.y+t.unitDirection.y*1e4},_=new vt().expandByPoint(n).expandByPoint(d),c=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:c}}xline(t){const n={x:t.firstPoint.x-t.unitDirection.x*1e4,y:t.firstPoint.y-t.unitDirection.y*1e4},d={x:t.firstPoint.x+t.unitDirection.x*1e4,y:t.firstPoint.y+t.unitDirection.y*1e4},_=new vt().expandByPoint(n).expandByPoint(d),c=`<line x1="${n.x}" y1="${n.y}" x2="${d.x}" y2="${d.y}" />`;return{bbox:_,element:c}}extractMTextLines(t){return t.replace(/\\U\+([0-9A-Fa-f]{4})/g,(o,n)=>String.fromCharCode(parseInt(n,16))).replace(/\\P/g,`
|
|
18
14
|
`).replace(/\\[LOlo]/g,"").replace(/\\[Ff][^;\\]*?(?:\|[^;\\]*)*;/g,"").replace(/\\[KkCcHhWwTtAa][^;\\]*;?/g,"").replace(/\\[a-zA-Z]+;?/g,"").replace(/%%(d|p|c|%)/gi,"").replace(/\\\\/g,"\\").replace(/\\~/g," ").replace(/[{}]/g,"").split(`
|
|
19
|
-
`).map(
|
|
20
|
-
`)}}mtext(t){const
|
|
15
|
+
`).map(o=>o.trim()).filter(o=>o.length>0)}lines(t,o,n,d,_="start"){const c=new vt().expandByPoint({x:n.x,y:n.y}).expandByPoint({x:n.x+d,y:n.y-t.length*o*1.5}),f=t.map((h,A)=>{const T=n.x,p=n.y-A*o*1.5,I=`translate(${T},${p}) scale(1,-1) translate(${-T},${-p})`;return`<text x="${T}" y="${p}" font-size="${o}" text-anchor="${_}" transform="${I}">${h}</text>`});return{bbox:c,element:f.join(`
|
|
16
|
+
`)}}mtext(t){const o=t.textHeight,n=t.insertionPoint,d=this.extractMTextLines(t.text),_=t.attachmentPoint;let c="start";return _==ge.BottomCenter||_==ge.MiddleCenter||_==ge.TopCenter?c="middle":(_==ge.BottomRight||_==ge.MiddleRight||_==ge.TopRight)&&(c="end"),this.lines(d,o,n,t.extentsWidth,c)}table(t){const{rowCount:o,columnCount:n,rowHeightArr:d,columnWidthArr:_,startPoint:c,cells:f}=t,h=c.x,A=c.y,T=[];for(let m=0,S=A;m<o;m++){const N=d[m];let W=h;for(let M=0;M<n;M++){const k=m*n+M,U=f[k],J=_[M];T.push({x:W,y:S,width:J,height:N,cell:U,row:m,col:M}),W+=J}S+=N}const p=T.map(({x:m,y:S,width:N,height:W,cell:M})=>{const k=[];M.topBorderVisibility&&k.push(`<line x1="${m}" y1="${S}" x2="${m+N}" y2="${S}" stroke="black" />`),M.bottomBorderVisibility&&k.push(`<line x1="${m}" y1="${S+W}" x2="${m+N}" y2="${S+W}" stroke="black" />`),M.leftBorderVisibility&&k.push(`<line x1="${m}" y1="${S}" x2="${m}" y2="${S+W}" stroke="black" />`),M.rightBorderVisibility&&k.push(`<line x1="${m+N}" y1="${S}" x2="${m+N}" y2="${S+W}" stroke="black" />`);const U=m+N/2,J=S+W/2+M.textHeight/3,nt=`<text x="${U}" y="${J}" font-size="${M.textHeight}" text-anchor="middle" dominant-baseline="middle">${M.text}</text>`;return[...k,nt].join(`
|
|
21
17
|
`)}).join(`
|
|
22
|
-
`),
|
|
23
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
24
|
-
${
|
|
18
|
+
`),I=_.reduce((m,S)=>m+S,0),v=d.reduce((m,S)=>m+S,0),C=new vt().expandByPoint({x:h,y:A}).expandByPoint({x:h+I,y:A+v}),w=`
|
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${I}" height="${v}" viewBox="${h} ${A} ${I} ${v}">
|
|
20
|
+
${p}
|
|
25
21
|
</svg>
|
|
26
|
-
`.trim();return{bbox:
|
|
27
|
-
`)}</g>`}:null}entityToBoundsAndElement(t){let
|
|
22
|
+
`.trim();return{bbox:C,element:w}}text(t){const o=t.textHeight,n=t.startPoint,d=[t.text];let _=t.endPoint.x-t.endPoint.x;t.halign==0&&(_=t.text.length*o+t.startPoint.x);let c="start";return t.halign==Sn.CENTER?c="middle":t.halign==Sn.RIGHT&&(c="end"),this.lines(d,o,n,_,c)}vertices(t,o=!1){const n=t.reduce((_,c)=>_.expandByPoint(c),new vt);let d=t.reduce((_,c,f)=>(_+=f===0?"M":"L",_+=c.x+","+c.y,_),"");return o&&(d+="Z"),{bbox:n,element:`<path d="${d}" />`}}circle(t){const o=new vt().expandByPoint({x:t.center.x+t.radius,y:t.center.y+t.radius}).expandByPoint({x:t.center.x-t.radius,y:t.center.y-t.radius}),n=`<circle cx="${t.center.x}" cy="${t.center.y}" r="${t.radius}" />`;return{bbox:o,element:n}}ellipseOrArc(t,o,n,d,_,c,f){const h=Math.sqrt(n*n+d*d),A=_*h,T=-Math.atan2(-d,n),p=this.bboxEllipseOrArc(t,o,n,d,_,c,f);if(Math.abs(c-f)<1e-9||Math.abs(c-f+Math.PI*2)<1e-9){const I=`<g transform="rotate(${T/Math.PI*180} ${t}, ${o})"><ellipse cx="${t}" cy="${o}" rx="${h}" ry="${A}" /></g>`;return{bbox:p,element:I}}else{const I=this.rotate({x:Math.cos(c)*h,y:Math.sin(c)*A},T),v={x:t+I.x,y:o+I.y},C=this.rotate({x:Math.cos(f)*h,y:Math.sin(f)*A},T),w={x:t+C.x,y:o+C.y},S=(f<c?f+Math.PI*2:f)-c<Math.PI?0:1,W=`<path d="${`M ${v.x} ${v.y} A ${h} ${A} ${T/Math.PI*180} ${S} 1 ${w.x} ${w.y}`}" />`;return{bbox:p,element:W}}}bboxEllipseOrArc(t,o,n,d,_,c,f){for(;c<0;)c+=Math.PI*2;for(;f<=c;)f+=Math.PI*2;const h=[];if(Math.abs(n)<1e-12||Math.abs(d)<1e-12)for(let v=0;v<4;v++)h.push(v/2*Math.PI);else h[0]=Math.atan(-d*_/n)-Math.PI,h[1]=Math.atan(n*_/d)-Math.PI,h[2]=h[0]-Math.PI,h[3]=h[1]-Math.PI;for(let v=4;v>=0;v--){for(;h[v]<c;)h[v]+=Math.PI*2;h[v]>f&&h.splice(v,1)}h.push(c),h.push(f);const A=h.map(v=>({x:Math.cos(v),y:Math.sin(v)})),T=[[n,-d*_],[d,n*_]];return A.map(v=>({x:v.x*T[0][0]+v.y*T[0][1]+t,y:v.x*T[1][0]+v.y*T[1][1]+o})).reduce((v,C)=>(v.expandByPoint(C),v),new vt)}ellipse(t){const{bbox:o,element:n}=this.ellipseOrArc(t.center.x,t.center.y,t.majorAxisEndPoint.x,t.majorAxisEndPoint.y,t.axisRatio,t.startAngle,t.endAngle);return{bbox:o,element:n}}arc(t){const{bbox:o,element:n}=this.ellipseOrArc(t.center.x,t.center.y,t.radius,0,1,t.startAngle,t.endAngle);return{bbox:o,element:n}}dimension(t){const o=this.blockMap.get(t.name);return o?{bbox:o.bbox,element:`<use href="#${t.name}" />`}:null}insert(t){const o=this.blockMap.get(t.name);if(o){const n=t.insertionPoint,d=t.rotation*(180/Math.PI),_=`translate(${n.x},${n.y}) rotate(${d}) scale(${t.xScale},${t.yScale})`;return{bbox:o.bbox.clone().transform({x:t.xScale,y:t.yScale},{x:n.x,y:n.y}).rotate(t.rotation,n),element:`<use href="#${t.name}" transform="${_}" />`}}return null}block(t,o){const n=t.entities,{bbox:d,elements:_}=n.reduce((c,f)=>{const h=this.entityToBoundsAndElement(f);if(h){const{bbox:A,element:T}=h;A.valid&&(c.bbox.expandByPoint(A.min),c.bbox.expandByPoint(A.max));const p=this.getEntityColor(o.tables.LAYER.entries,f),I=f.type=="TEXT"||f.type=="MTEXT"?p.cssColor:"none";p.isByBlock?c.elements.push(`<g id="${f.handle}">${T}</g>`):c.elements.push(`<g id="${f.handle}" stroke="${p.cssColor}" fill="${I}">${T}</g>`)}return c},{bbox:new vt,elements:[]});return d.valid?{bbox:d,element:`<g id="${t.name}">${_.join(`
|
|
23
|
+
`)}</g>`}:null}entityToBoundsAndElement(t){let o=null;switch(t.type){case"ARC":o=this.arc(t);break;case"CIRCLE":o=this.circle(t);break;case"DIMENSION":o=this.dimension(t);break;case"ELLIPSE":o=this.ellipse(t);break;case"INSERT":o=this.insert(t);break;case"LINE":o=this.line(t);break;case"LWPOLYLINE":{const n=t,d=!!(n.flag&512),_=Mo(n,d);o=this.vertices(_,d);break}case"MTEXT":o=this.mtext(t);break;case"SPLINE":{const n=t;o=this.vertices(this.interpolateBSpline(n.controlPoints,n.degree,n.knots,25,n.weights));break}case"POLYLINE":break;case"RAY":o=this.ray(t);break;case"TABLE":case"ACAD_TABLE":o=this.table(t);break;case"TEXT":o=this.text(t);break;case"XLINE":o=this.xline(t);break;default:o=null;break}return o?this.addFlipXIfApplicable(t,o):null}getEntityColor(t,o){const n=new Wo;if(o.colorIndex!=null?n.colorIndex=o.colorIndex:o.colorName?n.colorName=o.colorName:o.color!=null&&(n.color=o.color),n.colorIndex==7&&(n.colorIndex=256),n.isByLayer){const d=t.find(_=>_.name===o.layer);d!=null&&(n.colorIndex=d.colorIndex)}return n.color==null&&(n.color=16777215),n}convert(t){let o=null;this.blockMap.clear();let n="";t.tables.BLOCK_RECORD.entries.forEach(c=>{if(Nn(c.name))o=c;else{const f=this.block(c,t);f&&(n+=f.element,this.blockMap.set(c.name,f))}});const d=this.block(o,t),_=d&&d.bbox.valid?{x:d.bbox.min.x,y:-d.bbox.max.y,width:d.bbox.max.x-d.bbox.min.x,height:d.bbox.max.y-d.bbox.min.y}:{x:0,y:0,width:0,height:0};return`<?xml version="1.0"?>
|
|
28
24
|
<svg
|
|
29
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
30
26
|
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
|
@@ -36,4 +32,4 @@ return ret;
|
|
|
36
32
|
<g stroke="#000000" stroke-width="0.1%" fill="none" transform="matrix(1,0,0,-1,0,0)">
|
|
37
33
|
${d?d.element:""}
|
|
38
34
|
</g>
|
|
39
|
-
</svg>`}}const Ar=class yr{constructor(t){return nt(this,"wasmInstance"),nt(this,"decoder"),this.wasmInstance=t,new Proxy(this,{get:(i,n,d)=>n in i?Reflect.get(i,n,d):Reflect.get(i.wasmInstance,n,d)})}dwg_read_data(t,i){const n=typeof t=="string"?new TextEncoder().encode(t):new Uint8Array(t);if(i==Lt.DWG){const d="tmp.dwg";try{this.wasmInstance.FS.writeFile(d,n);const _=this.wasmInstance.dwg_read_file(d);if(_.error&Nn.OUTOFMEM)throw this.wasmInstance.dwg_abandon(_.data),new Error("Failed to decode DWG: out of WASM memory. Rebuild with pnpm build:wasm (INITIAL_MEMORY=1GB) or use a smaller file.");return _.error!=0,_.data}finally{this.wasmInstance.FS.analyzePath(d,!1).exists&&this.wasmInstance.FS.unlink(d)}}else if(i==Lt.DXF){const d="tmp.dxf";try{this.wasmInstance.FS.writeFile(d,n);const _=this.wasmInstance.dxf_read_file(d);if(_.error&Nn.OUTOFMEM)throw this.wasmInstance.dwg_abandon(_.data),new Error("Failed to decode DXF: out of WASM memory. Rebuild with pnpm build:wasm (INITIAL_MEMORY=1GB) or use a smaller file.");return _.error!=0,_.data?_.data:void 0}finally{this.wasmInstance.FS.analyzePath(d,!1).exists&&this.wasmInstance.FS.unlink(d)}}}dwg_write_dxf(t){const i="tmp.dwg",n="tmp.dxf";try{return this.wasmInstance.FS.writeFile(i,new Uint8Array(t)),this.wasmInstance.dwg_write_dxf(i,n)!=0?null:this.wasmInstance.FS.readFile(n)}finally{this.wasmInstance.FS.analyzePath(i,!1).exists&&this.wasmInstance.FS.unlink(i),this.wasmInstance.FS.analyzePath(n,!1).exists&&this.wasmInstance.FS.unlink(n)}}dwg_get_version_type(t){const i=this.wasmInstance.dwg_get_version_type(t);return Do[i]}dwg_get_codepage(t){return this.wasmInstance.dwg_get_codepage(t)}dwg_bmp(t){return this.wasmInstance.dwg_bmp(t)}dwg_get_num_classes(t){return this.wasmInstance.dwg_get_num_classes(t)}dwg_get_class(t,i){return this.wasmInstance.dwg_get_class(t,i)}convert(t){const i=this.dwg_get_codepage(t),n=ar(i);return this.decoder=new TextDecoder(n),new dr(this).convert(t)}convertEx(t){const i=this.dwg_get_codepage(t),n=ar(i);this.decoder=new TextDecoder(n);const d=new dr(this);return{database:d.convert(t),stats:d.getConversionStats()}}dwg_to_svg(t){return new Bo().convert(t)}dwg_free(t){if(t)try{this.wasmInstance.dwg_free(t)}catch{try{this.wasmInstance.dwg_abandon(t)}catch{}}}dwg_free_object(t){this.wasmInstance.dwg_free_object(t)}dwg_ref_object(t,i){return this.wasmInstance.dwg_ref_object(t,i)}dwg_ref_object_silent(t,i){return this.wasmInstance.dwg_ref_object_silent(t,i)}dwg_ref_object_relative(t,i,n){return this.wasmInstance.dwg_ref_object_relative(t,i,n)}dwg_resolve_handle(t,i){return this.wasmInstance.dwg_resolve_handle(t,i)}dwg_resolve_handle_silent(t,i){return this.wasmInstance.dwg_resolve_handle_silent(t,i)}dwg_resolve_handleref(t,i){return this.wasmInstance.dwg_resolve_handleref(t,i)}dwg_ref_get_absref(t){if(!t)return null;const i=this.wasmInstance.dwg_ref_get_absref(t);return i===0?null:i}dwg_ref_get_handle_value(t){if(!t)return null;const i=this.wasmInstance.dwg_ref_get_handle_value(t);return i===0n?null:i}dwg_ref_get_handle_absolute_ref(t){if(!t)return null;const i=this.wasmInstance.dwg_ref_get_handle_absolute_ref(t);return i===0n?null:i}dwg_obj_get_handle_value(t){if(!t)return null;const i=this.wasmInstance.dwg_obj_get_handle_value(t);return i===0n?null:i}dwg_ref_get_id(t){const i=this.dwg_ref_get_absref(t);return i==null?void 0:i.toString(16).toUpperCase()}dwg_ref_get_object_name(t){const i=this.wasmInstance,n=i.dwg_ref_get_object(t),d=i.dwg_object_to_object_tio(n);return this.dwg_dynapi_entity_data(d,"name")}dwg_obj_obj_to_object(t){return this.wasmInstance.dwg_obj_obj_to_object(t)}dwg_obj_generic_to_object(t){return this.wasmInstance.dwg_obj_generic_to_object(t)}dwg_object_to_object(t){return this.wasmInstance.dwg_object_to_object(t)}dwg_object_to_object_tio(t){return this.wasmInstance.dwg_object_to_object_tio(t)}dwg_object_to_entity(t){return this.wasmInstance.dwg_object_to_entity(t)}dwg_object_to_entity_tio(t){return this.wasmInstance.dwg_object_to_entity_tio(t)}dwg_getall_entities_in_model_space(t){const i=this.wasmInstance,n=i.dwg_model_space_object(t),d=[];let _=i.get_first_owned_entity(n);for(;_;)d.push(_),_=i.get_next_owned_entity(n,_);return d}dwg_getall_object_by_type(t,i){const n=this.wasmInstance,d=n.dwg_get_num_objects(t),_=[];for(let u=0;u<d;u++){const f=n.dwg_get_object(t,u),h=n.dwg_object_to_object_tio(f);h&&n.dwg_object_get_fixedtype(f)==i&&_.push(h)}return _}dwg_getall_entity_by_type(t,i){const n=this.wasmInstance,d=n.dwg_get_num_objects(t),_=[];for(let u=0;u<d;u++){const f=n.dwg_get_object(t,u),h=n.dwg_object_to_entity_tio(f);h&&n.dwg_object_get_fixedtype(f)==i&&_.push(h)}return _}dwg_getall_LAYER(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LAYER)}dwg_getall_LTYPE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LTYPE)}dwg_getall_STYLE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_LWPOLYLINE)}dwg_ptr_to_object_ref_array(t,i){return this.wasmInstance.dwg_ptr_to_object_ref_array(t,i)}dwg_ptr_to_object_ref_ptr_array(t,i){return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(t,i)}dwg_ptr_to_wchar_string_array(t,i){return this.wasmInstance.dwg_ptr_to_wchar_string_array(t,i)}dwg_ptr_to_unsigned_char_array(t,i){return this.wasmInstance.dwg_ptr_to_unsigned_char_array(t,i)}dwg_ptr_to_signed_char_array(t,i){return this.wasmInstance.dwg_ptr_to_signed_char_array(t,i)}dwg_ptr_to_uint16_t_array(t,i){return this.wasmInstance.dwg_ptr_to_uint16_t_array(t,i)}dwg_ptr_to_int16_t_array(t,i){return this.wasmInstance.dwg_ptr_to_int16_t_array(t,i)}dwg_ptr_to_uint32_t_array(t,i){return this.wasmInstance.dwg_ptr_to_uint32_t_array(t,i)}dwg_ptr_to_int32_t_array(t,i){return this.wasmInstance.dwg_ptr_to_int32_t_array(t,i)}dwg_ptr_to_uint64_t_array(t,i){return this.wasmInstance.dwg_ptr_to_uint64_t_array(t,i)}dwg_ptr_to_int64_t_array(t,i){return this.wasmInstance.dwg_ptr_to_int64_t_array(t,i)}dwg_ptr_to_double_array(t,i){return this.wasmInstance.dwg_ptr_to_double_array(t,i)}dwg_ptr_to_point2d_array(t,i){return this.wasmInstance.dwg_ptr_to_point2d_array(t,i)}dwg_ptr_to_point3d_array(t,i){return this.wasmInstance.dwg_ptr_to_point3d_array(t,i)}dwg_ptr_to_point4d_array(t,i){return this.wasmInstance.dwg_ptr_to_point4d_array(t,i)}dwg_ptr_to_ltype_dash_array(t,i){return this.wasmInstance.dwg_ptr_to_ltype_dash_array(t,i)}dwg_ptr_to_table_cell_array(t,i){return this.wasmInstance.dwg_ptr_to_table_cell_array(t,i)}dwg_ptr_to_hatch_defline_array(t,i){return this.wasmInstance.dwg_ptr_to_hatch_defline_array(t,i)}dwg_ptr_to_hatch_path_array(t,i){return this.wasmInstance.dwg_ptr_to_hatch_path_array(t,i)}dwg_ptr_to_hatch_gradient_color_array(t,i){return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(t,i)}dwg_ptr_to_mline_vertex_array(t,i){return this.wasmInstance.dwg_ptr_to_mline_vertex_array(t,i)}dwg_dynapi_entity_value(t,i){const n=this.wasmInstance.dwg_dynapi_entity_value(t,i);return n.bin&&this.decoder&&(n.data=this.decoder.decode(n.bin)),typeof n.data=="string"&&(n.data=or(n.data)),n}dwg_dynapi_entity_data(t,i){return this.dwg_dynapi_entity_value(t,i).data}dwg_dynapi_header_value(t,i){return this.wasmInstance.dwg_dynapi_header_value(t,i)}dwg_dynapi_header_data(t,i){return this.dwg_dynapi_header_value(t,i).data}dwg_dynapi_common_value(t,i){return this.wasmInstance.dwg_dynapi_common_value(t,i)}dwg_dynapi_common_data(t,i){return this.dwg_dynapi_common_value(t,i).data}dwg_dynapi_subclass_value(t,i,n){const d=this.wasmInstance.dwg_dynapi_subclass_value(t,i,n);return d.bin&&this.decoder&&(d.data=this.decoder.decode(d.bin)),typeof d.data=="string"&&(d.data=or(d.data)),d}dwg_dynapi_subclass_data(t,i,n){return this.dwg_dynapi_subclass_value(t,i,n).data}dwg_dynapi_subclass_size(t){return this.wasmInstance.dwg_dynapi_subclass_size(t)}dwg_dynapi_entity_field_offset(t,i){return this.wasmInstance.dwg_dynapi_entity_field_offset(t,i)}dwg_dynapi_subclass_field_offset(t,i){return this.wasmInstance.dwg_dynapi_subclass_field_offset(t,i)}dwg_object_get_handle_object(t){return this.wasmInstance.dwg_object_get_handle_object(t)}dwg_object_object_get_handle_object(t){return this.wasmInstance.dwg_object_object_get_handle_object(t)}dwg_object_object_get_ownerhandle_object(t){return this.wasmInstance.dwg_object_object_get_ownerhandle_object(t)}dwg_object_entity_get_handle_object(t){return this.wasmInstance.dwg_object_entity_get_handle_object(t)}dwg_object_entity_get_ownerhandle_object(t){return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(t)}dwg_object_entity_get_xdicobjhandle_object(t){return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(t)}dwg_object_entity_get_layer_object_ref(t){return this.wasmInstance.dwg_object_entity_get_layer_object_ref(t)}dwg_object_entity_get_ltype_object_ref(t){return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(t)}dwg_object_entity_get_color_object(t){return this.wasmInstance.dwg_object_entity_get_color_object(t)}dwg_object_entity_get_xdata(t){return this.wasmInstance.dwg_object_entity_get_xdata(t)}dwg_object_object_get_xdicobjhandle_object(t){return this.wasmInstance.dwg_object_object_get_xdicobjhandle_object(t)}dwg_object_xrecord_get_xdata(t){return this.wasmInstance.dwg_object_xrecord_get_xdata(t)??[]}dwg_entity_owner(t){return this.wasmInstance.dwg_entity_owner(t)}dwg_entity_get_block_name(t,i){const n=this.wasmInstance,d=this.dwg_dynapi_entity_data(t,i),_=n.dwg_ref_get_object(d),u=n.dwg_object_to_object_tio(_);return this.dwg_entity_block_header_get_block(u).name}dwg_entity_get_dimstyle_name(t,i="dimstyle"){const n=this.wasmInstance,d=this.dwg_dynapi_entity_data(t,i),_=n.dwg_ref_get_object(d),u=n.dwg_object_to_object_tio(_);return this.dwg_dynapi_entity_data(u,"name")}dwg_entity_block_header_get_block(t){const i=this.wasmInstance,n=this.dwg_dynapi_entity_data(t,"block_entity"),d=i.dwg_ref_get_object(n),_=i.dwg_object_to_entity_tio(d),u=this.dwg_dynapi_entity_data(_,"name"),f=this.dwg_dynapi_entity_data(_,"base_pt");return{name:u,base_pt:f}}dwg_entity_block_header_get_preview(t){const i=this.wasmInstance;if(typeof i.dwg_entity_block_header_get_preview!="function")return null;const n=i.dwg_entity_block_header_get_preview(t);return(n==null?void 0:n.data)??null}dwg_entity_get_preview(t){const i=this.wasmInstance;if(typeof i.dwg_entity_get_preview!="function")return null;const n=i.dwg_entity_get_preview(t);return(n==null?void 0:n.data)??null}dwg_entity_proxy_entity_get_entity_data(t){const i=this.wasmInstance;if(typeof i.dwg_entity_proxy_entity_get_entity_data!="function")return null;const n=i.dwg_entity_proxy_entity_get_entity_data(t);return(n==null?void 0:n.data)??null}dwg_entity_ole2frame_get_data(t){const i=this.wasmInstance;if(typeof i.dwg_entity_ole2frame_get_data!="function")return null;const n=i.dwg_entity_ole2frame_get_data(t);return(n==null?void 0:n.data)??null}dwg_entity_oleframe_get_data(t){const i=this.wasmInstance;if(typeof i.dwg_entity_oleframe_get_data!="function")return null;const n=i.dwg_entity_oleframe_get_data(t);return(n==null?void 0:n.data)??null}get_first_owned_entity(t){return this.wasmInstance.get_first_owned_entity(t)}get_next_owned_entity(t,i){return this.wasmInstance.get_next_owned_entity(t,i)}dwg_entity_mtext_get_style_name(t){const i=this.wasmInstance,n=this.dwg_dynapi_entity_data(t,"style"),d=i.dwg_ref_get_object(n),_=i.dwg_object_to_object_tio(d);return this.dwg_dynapi_entity_data(_,"name")}dwg_entity_text_get_style_name(t){return this.dwg_entity_mtext_get_style_name(t)}dwg_entity_polyline_2d_get_numpoints(t){return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(t).data}dwg_entity_polyline_2d_get_points(t){return this.wasmInstance.dwg_entity_polyline_2d_get_points(t).data}dwg_entity_polyline_2d_get_vertices(t){return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(t).data}dwg_entity_polyline_3d_get_numpoints(t){return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(t).data}dwg_entity_polyline_3d_get_points(t){return this.wasmInstance.dwg_entity_polyline_3d_get_points(t).data}dwg_entity_polyline_3d_get_vertices(t){return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(t).data}dwg_entity_insert_get_attribs(t){return this.wasmInstance.dwg_entity_insert_get_attribs(t).data}dwg_object_dictionary_get_texts(t){return this.wasmInstance.dwg_object_dictionary_get_texts(t).data}static createByWasmInstance(t){return this.instance==null?new yr(t):this.instance}static async create(t){const i=t==null?await rr():await rr({locateFile:n=>`${t}/${n}`});return this.createByWasmInstance(i)}};nt(Ar,"instance");let Fo=Ar;const ln=new Uint8Array([31,37,109,7,212,54,40,40,157,87,202,63,157,68,16,43]);function Uo(a){if(a.length<17)return;const t=new DataView(a.buffer,a.byteOffset,a.byteLength).getUint32(13,!0),i=lr(a,t);if(i)return i;const n=Math.min(a.length,1024*1024);for(let d=0;d+ln.length<=n;d++){if(!Tr(a,d,ln)||d===t)continue;const _=lr(a,d);if(_)return _}}function $o(a,t){var n;if((n=a.thumbnailImage)!=null&&n.length)return;const i=Uo(t);i!=null&&i.length&&(a.thumbnailImage=i)}function lr(a,t){if(t<=0||t>=a.length||!Tr(a,t,ln))return;let i=t+ln.length;if(i+5>a.length)return;const n=new DataView(a.buffer,a.byteOffset,a.byteLength);n.getInt32(i,!0),i+=4;const d=a[i];if(i+=1,d<=0||d>16)return;const _=[];for(let h=0;h<d;h++){if(i+9>a.length)return;const A=a[i];i+=1;const T=n.getInt32(i,!0);i+=4;const v=n.getInt32(i,!0);i+=4,_.push({code:A,start:T,size:v})}const u=i,f=cr(a,_,"absolute");return f||cr(a,_,"sequential",u)}function cr(a,t,i,n=0){let d,_=n;for(const u of t){const f=i==="absolute"?u.start:_;if(i==="sequential"&&(_+=Math.max(0,u.size)),u.code!==2&&u.code!==6)continue;const h=Vo(a,f,u.size);if(h!=null&&h.length){if(u.code===6)return h.slice();d||(d=h.slice())}}return d}function Vo(a,t,i){if(!(t<0||i<=0)&&!(t+i>a.length))return a.subarray(t,t+i)}function Tr(a,t,i){if(t+i.length>a.length)return!1;for(let n=0;n<i.length;n++)if(a[t+n]!==i[n])return!1;return!0}function Ho(a){if(typeof a=="string"){const d=a.slice(0,64);return/AutoCAD Binary DXF/i.test(d),Lt.DXF}const t=a instanceof Uint8Array?a:new Uint8Array(a),i=new TextDecoder("latin1").decode(t.subarray(0,22));if(i.startsWith("AutoCAD Binary DXF"))return Lt.DXF;if(i.startsWith("AC1")||i.startsWith("AC2"))return Lt.DWG;const n=new TextDecoder("utf-8").decode(t.subarray(0,64));return/^\s*(0|999)\b/.test(n)?Lt.DXF:Lt.DWG}async function Xo(a,t){const i=await Fo.create();if(i==null)throw new Error("libredwg is not loaded!");const n=Ho(a),d=i.dwg_read_data(a,n);if(d==null)throw new Error(n===Lt.DXF?"Failed to read dxf data!":"Failed to read dwg data!");const _=i.convertEx(d);return Ko(i,d,_.database),zo(i,d,_.database),i.dwg_free(d),n===Lt.DWG&&typeof a!="string"&&$o(_.database,new Uint8Array(a)),_}function Ko(a,t,i){if(i.header&&!(typeof i.header.ACADVER=="string"&&i.header.ACADVER))try{const n=a.dwg_get_version_type(t);n!=null&&n.hdr&&n.type!=="invalid"&&(i.header.ACADVER=n.hdr)}catch{}}function zo(a,t,i){var f;const n={},d=new Map,_=new Map;for(const h of i.objects.DICTIONARY??[]){const A=fe(h.handle);A&&_.set(A,h)}const u=((f=i.tables.BLOCK_RECORD)==null?void 0:f.entries)??[];for(const h of u)for(const A of h.entities??[]){if(A.type!=="DIMENSION")continue;const T=A.styleName;if(!T||n[T]!=null)continue;const v=Jo(a,t,A,_,d);v!=null&&v>0&&(n[T]=v)}Object.keys(n).length>0&&(i.dimStyleAnnotationScales=n)}function Jo(a,t,i,n,d){var T,v;const _=n.get(fe(i.ownerDictionaryHardId)),u=n.get(fe((T=_==null?void 0:_.entries)==null?void 0:T.AcDbContextDataManager)),f=n.get(fe((v=u==null?void 0:u.entries)==null?void 0:v.ACDB_ANNOTATIONSCALES)),h=f==null?void 0:f.entries;if(!h)return;let A;for(const P of Object.values(h)){const m=qo(a,t,fe(P),d);if(m==null)continue;if(Zo(a,t,fe(P)))return m;A??(A=m)}return A}function Zo(a,t,i){const n=Wn(a,t,i);if(!n)return!1;try{const d=a.dwg_dynapi_entity_value(n,"is_default");return!!(d!=null&&d.success)&&Number(d.data)===1}catch{return!1}}function qo(a,t,i,n){const d=Wn(a,t,i);if(d)try{const _=a.dwg_dynapi_entity_value(d,"scale");if(!(_!=null&&_.success)||_.data==null)return;const u=fe(a.dwg_ref_get_id(_.data));if(!u)return;const f=n.get(u);if(f!=null)return f;const h=Wn(a,t,u);if(!h)return;const A=a.dwg_dynapi_entity_value(h,"paper_units"),T=a.dwg_dynapi_entity_value(h,"drawing_units");if(!(A!=null&&A.success)||!(T!=null&&T.success))return;const v=Number(A.data),P=Number(T.data);if(!(v>0)||!(P>0))return;const m=P/v;return n.set(u,m),m}catch{return}}function Wn(a,t,i){if(!(!i||!/^[0-9A-F]+$/i.test(i)))try{const n=a.dwg_resolve_handle(t,BigInt("0x"+i));return n?a.dwg_object_to_object_tio(n):void 0}catch{return}}function fe(a){return a==null||a===""||a===!1||a===0?"":String(a).trim().toUpperCase()}class Qo extends yo{async executeTask(t){const i=await Xo(t);return{model:i.database,data:i.stats}}}new Qo;const jo={},ti=Object.freeze(Object.defineProperty({__proto__:null,default:jo},Symbol.toStringTag,{value:"Module"}));
|
|
35
|
+
</svg>`}}const Ir=class vr{constructor(t){return et(this,"wasmInstance"),et(this,"decoder"),this.wasmInstance=t,new Proxy(this,{get:(o,n,d)=>n in o?Reflect.get(o,n,d):Reflect.get(o.wasmInstance,n,d)})}dwg_read_data(t,o){const n=typeof t=="string"?new TextEncoder().encode(t):new Uint8Array(t);if(o==mt.DWG){const d="tmp.dwg";try{this.wasmInstance.FS.writeFile(d,n);const _=this.wasmInstance.dwg_read_file(d);if(_.error&Yn.OUTOFMEM)throw this.wasmInstance.dwg_abandon(_.data),new Error("Failed to decode DWG: out of WASM memory. Rebuild with pnpm build:wasm (INITIAL_MEMORY=1GB) or use a smaller file.");return _.error!=0,_.data}finally{this.wasmInstance.FS.analyzePath(d,!1).exists&&this.wasmInstance.FS.unlink(d)}}else if(o==mt.DXF){const d="tmp.dxf";try{this.wasmInstance.FS.writeFile(d,n);const _=this.wasmInstance.dxf_read_file(d);if(_.error&Yn.OUTOFMEM)throw this.wasmInstance.dwg_abandon(_.data),new Error("Failed to decode DXF: out of WASM memory. Rebuild with pnpm build:wasm (INITIAL_MEMORY=1GB) or use a smaller file.");return _.error!=0,_.data?_.data:void 0}finally{this.wasmInstance.FS.analyzePath(d,!1).exists&&this.wasmInstance.FS.unlink(d)}}}dwg_write_dxf(t){const o="tmp.dwg",n="tmp.dxf";try{return this.wasmInstance.FS.writeFile(o,new Uint8Array(t)),this.wasmInstance.dwg_write_dxf(o,n)!=0?null:this.wasmInstance.FS.readFile(n)}finally{this.wasmInstance.FS.analyzePath(o,!1).exists&&this.wasmInstance.FS.unlink(o),this.wasmInstance.FS.analyzePath(n,!1).exists&&this.wasmInstance.FS.unlink(n)}}dwg_get_version_type(t){const o=this.wasmInstance.dwg_get_version_type(t);return vo[o]}dwg_get_codepage(t){return this.wasmInstance.dwg_get_codepage(t)}dwg_bmp(t){return this.wasmInstance.dwg_bmp(t)}dwg_get_num_classes(t){return this.wasmInstance.dwg_get_num_classes(t)}dwg_get_class(t,o){return this.wasmInstance.dwg_get_class(t,o)}convert(t){const o=this.dwg_get_codepage(t),n=_r(o);return this.decoder=new TextDecoder(n),new Er(this).convert(t)}convertEx(t){const o=this.dwg_get_codepage(t),n=_r(o);this.decoder=new TextDecoder(n);const d=new Er(this);return{database:d.convert(t),stats:d.getConversionStats()}}dwg_to_svg(t){return new bo().convert(t)}dwg_free(t){if(t)try{this.wasmInstance.dwg_free(t)}catch{try{this.wasmInstance.dwg_abandon(t)}catch{}}}dwg_free_object(t){this.wasmInstance.dwg_free_object(t)}dwg_ref_object(t,o){return this.wasmInstance.dwg_ref_object(t,o)}dwg_ref_object_silent(t,o){return this.wasmInstance.dwg_ref_object_silent(t,o)}dwg_ref_object_relative(t,o,n){return this.wasmInstance.dwg_ref_object_relative(t,o,n)}dwg_resolve_handle(t,o){return this.wasmInstance.dwg_resolve_handle(t,o)}dwg_resolve_handle_silent(t,o){return this.wasmInstance.dwg_resolve_handle_silent(t,o)}dwg_resolve_handleref(t,o){return this.wasmInstance.dwg_resolve_handleref(t,o)}dwg_ref_get_absref(t){if(!t)return null;const o=this.wasmInstance.dwg_ref_get_absref(t);return o===0?null:o}dwg_ref_get_handle_value(t){if(!t)return null;const o=this.wasmInstance.dwg_ref_get_handle_value(t);return o===0n?null:o}dwg_ref_get_handle_absolute_ref(t){if(!t)return null;const o=this.wasmInstance.dwg_ref_get_handle_absolute_ref(t);return o===0n?null:o}dwg_obj_get_handle_value(t){if(!t)return null;const o=this.wasmInstance.dwg_obj_get_handle_value(t);return o===0n?null:o}dwg_ref_get_id(t){const o=this.dwg_ref_get_absref(t);return o==null?void 0:o.toString(16).toUpperCase()}dwg_ref_get_object_name(t){const o=this.wasmInstance,n=o.dwg_ref_get_object(t),d=o.dwg_object_to_object_tio(n);return this.dwg_dynapi_entity_data(d,"name")}dwg_obj_obj_to_object(t){return this.wasmInstance.dwg_obj_obj_to_object(t)}dwg_obj_generic_to_object(t){return this.wasmInstance.dwg_obj_generic_to_object(t)}dwg_object_to_object(t){return this.wasmInstance.dwg_object_to_object(t)}dwg_object_to_object_tio(t){return this.wasmInstance.dwg_object_to_object_tio(t)}dwg_object_to_entity(t){return this.wasmInstance.dwg_object_to_entity(t)}dwg_object_to_entity_tio(t){return this.wasmInstance.dwg_object_to_entity_tio(t)}dwg_getall_entities_in_model_space(t){const o=this.wasmInstance,n=o.dwg_model_space_object(t),d=[];let _=o.get_first_owned_entity(n);for(;_;)d.push(_),_=o.get_next_owned_entity(n,_);return d}dwg_getall_object_by_type(t,o){const n=this.wasmInstance,d=n.dwg_get_num_objects(t),_=[];for(let c=0;c<d;c++){const f=n.dwg_get_object(t,c),h=n.dwg_object_to_object_tio(f);h&&n.dwg_object_get_fixedtype(f)==o&&_.push(h)}return _}dwg_getall_entity_by_type(t,o){const n=this.wasmInstance,d=n.dwg_get_num_objects(t),_=[];for(let c=0;c<d;c++){const f=n.dwg_get_object(t,c),h=n.dwg_object_to_entity_tio(f);h&&n.dwg_object_get_fixedtype(f)==o&&_.push(h)}return _}dwg_getall_LAYER(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LAYER)}dwg_getall_LTYPE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LTYPE)}dwg_getall_STYLE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(t){return this.dwg_getall_object_by_type(t,L.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(t){return this.dwg_getall_entity_by_type(t,L.DWG_TYPE_LWPOLYLINE)}dwg_ptr_to_object_ref_array(t,o){return this.wasmInstance.dwg_ptr_to_object_ref_array(t,o)}dwg_ptr_to_object_ref_ptr_array(t,o){return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(t,o)}dwg_ptr_to_wchar_string_array(t,o){return this.wasmInstance.dwg_ptr_to_wchar_string_array(t,o)}dwg_ptr_to_unsigned_char_array(t,o){return this.wasmInstance.dwg_ptr_to_unsigned_char_array(t,o)}dwg_ptr_to_signed_char_array(t,o){return this.wasmInstance.dwg_ptr_to_signed_char_array(t,o)}dwg_ptr_to_uint16_t_array(t,o){return this.wasmInstance.dwg_ptr_to_uint16_t_array(t,o)}dwg_ptr_to_int16_t_array(t,o){return this.wasmInstance.dwg_ptr_to_int16_t_array(t,o)}dwg_ptr_to_uint32_t_array(t,o){return this.wasmInstance.dwg_ptr_to_uint32_t_array(t,o)}dwg_ptr_to_int32_t_array(t,o){return this.wasmInstance.dwg_ptr_to_int32_t_array(t,o)}dwg_ptr_to_uint64_t_array(t,o){return this.wasmInstance.dwg_ptr_to_uint64_t_array(t,o)}dwg_ptr_to_int64_t_array(t,o){return this.wasmInstance.dwg_ptr_to_int64_t_array(t,o)}dwg_ptr_to_double_array(t,o){return this.wasmInstance.dwg_ptr_to_double_array(t,o)}dwg_ptr_to_point2d_array(t,o){return this.wasmInstance.dwg_ptr_to_point2d_array(t,o)}dwg_ptr_to_point3d_array(t,o){return this.wasmInstance.dwg_ptr_to_point3d_array(t,o)}dwg_ptr_to_point4d_array(t,o){return this.wasmInstance.dwg_ptr_to_point4d_array(t,o)}dwg_ptr_to_ltype_dash_array(t,o){return this.wasmInstance.dwg_ptr_to_ltype_dash_array(t,o)}dwg_ptr_to_table_cell_array(t,o){return this.wasmInstance.dwg_ptr_to_table_cell_array(t,o)}dwg_ptr_to_hatch_defline_array(t,o){return this.wasmInstance.dwg_ptr_to_hatch_defline_array(t,o)}dwg_ptr_to_hatch_path_array(t,o){return this.wasmInstance.dwg_ptr_to_hatch_path_array(t,o)}dwg_ptr_to_hatch_gradient_color_array(t,o){return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(t,o)}dwg_ptr_to_mline_vertex_array(t,o){return this.wasmInstance.dwg_ptr_to_mline_vertex_array(t,o)}dwg_dynapi_entity_value(t,o){const n=this.wasmInstance.dwg_dynapi_entity_value(t,o);return n.bin&&this.decoder&&(n.data=this.decoder.decode(n.bin)),typeof n.data=="string"&&(n.data=dr(n.data)),n}dwg_dynapi_entity_data(t,o){return this.dwg_dynapi_entity_value(t,o).data}dwg_dynapi_header_value(t,o){return this.wasmInstance.dwg_dynapi_header_value(t,o)}dwg_dynapi_header_data(t,o){return this.dwg_dynapi_header_value(t,o).data}dwg_dynapi_common_value(t,o){return this.wasmInstance.dwg_dynapi_common_value(t,o)}dwg_dynapi_common_data(t,o){return this.dwg_dynapi_common_value(t,o).data}dwg_dynapi_subclass_value(t,o,n){const d=this.wasmInstance.dwg_dynapi_subclass_value(t,o,n);return d.bin&&this.decoder&&(d.data=this.decoder.decode(d.bin)),typeof d.data=="string"&&(d.data=dr(d.data)),d}dwg_dynapi_subclass_data(t,o,n){return this.dwg_dynapi_subclass_value(t,o,n).data}dwg_dynapi_subclass_size(t){return this.wasmInstance.dwg_dynapi_subclass_size(t)}dwg_dynapi_entity_field_offset(t,o){return this.wasmInstance.dwg_dynapi_entity_field_offset(t,o)}dwg_dynapi_subclass_field_offset(t,o){return this.wasmInstance.dwg_dynapi_subclass_field_offset(t,o)}dwg_object_get_handle_object(t){return this.wasmInstance.dwg_object_get_handle_object(t)}dwg_object_object_get_handle_object(t){return this.wasmInstance.dwg_object_object_get_handle_object(t)}dwg_object_object_get_ownerhandle_object(t){return this.wasmInstance.dwg_object_object_get_ownerhandle_object(t)}dwg_object_entity_get_handle_object(t){return this.wasmInstance.dwg_object_entity_get_handle_object(t)}dwg_object_entity_get_ownerhandle_object(t){return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(t)}dwg_object_entity_get_xdicobjhandle_object(t){return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(t)}dwg_object_entity_get_layer_object_ref(t){return this.wasmInstance.dwg_object_entity_get_layer_object_ref(t)}dwg_object_entity_get_ltype_object_ref(t){return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(t)}dwg_object_entity_get_color_object(t){return this.wasmInstance.dwg_object_entity_get_color_object(t)}dwg_object_entity_get_xdata(t){return this.wasmInstance.dwg_object_entity_get_xdata(t)}dwg_object_object_get_xdicobjhandle_object(t){return this.wasmInstance.dwg_object_object_get_xdicobjhandle_object(t)}dwg_object_xrecord_get_xdata(t){return this.wasmInstance.dwg_object_xrecord_get_xdata(t)??[]}dwg_entity_owner(t){return this.wasmInstance.dwg_entity_owner(t)}dwg_entity_get_block_name(t,o){const n=this.wasmInstance,d=this.dwg_dynapi_entity_data(t,o),_=n.dwg_ref_get_object(d),c=n.dwg_object_to_object_tio(_);return this.dwg_entity_block_header_get_block(c).name}dwg_entity_get_dimstyle_name(t,o="dimstyle"){const n=this.wasmInstance,d=this.dwg_dynapi_entity_data(t,o),_=n.dwg_ref_get_object(d),c=n.dwg_object_to_object_tio(_);return this.dwg_dynapi_entity_data(c,"name")}dwg_entity_block_header_get_block(t){const o=this.wasmInstance,n=this.dwg_dynapi_entity_data(t,"block_entity"),d=o.dwg_ref_get_object(n),_=o.dwg_object_to_entity_tio(d),c=this.dwg_dynapi_entity_data(_,"name"),f=this.dwg_dynapi_entity_data(_,"base_pt");return{name:c,base_pt:f}}dwg_entity_block_header_get_preview(t){const o=this.wasmInstance;if(typeof o.dwg_entity_block_header_get_preview!="function")return null;const n=o.dwg_entity_block_header_get_preview(t);return(n==null?void 0:n.data)??null}dwg_entity_get_preview(t){const o=this.wasmInstance;if(typeof o.dwg_entity_get_preview!="function")return null;const n=o.dwg_entity_get_preview(t);return(n==null?void 0:n.data)??null}dwg_entity_proxy_entity_get_entity_data(t){const o=this.wasmInstance;if(typeof o.dwg_entity_proxy_entity_get_entity_data!="function")return null;const n=o.dwg_entity_proxy_entity_get_entity_data(t);return(n==null?void 0:n.data)??null}dwg_entity_ole2frame_get_data(t){const o=this.wasmInstance;if(typeof o.dwg_entity_ole2frame_get_data!="function")return null;const n=o.dwg_entity_ole2frame_get_data(t);return(n==null?void 0:n.data)??null}dwg_entity_oleframe_get_data(t){const o=this.wasmInstance;if(typeof o.dwg_entity_oleframe_get_data!="function")return null;const n=o.dwg_entity_oleframe_get_data(t);return(n==null?void 0:n.data)??null}get_first_owned_entity(t){return this.wasmInstance.get_first_owned_entity(t)}get_next_owned_entity(t,o){return this.wasmInstance.get_next_owned_entity(t,o)}dwg_entity_mtext_get_style_name(t){const o=this.wasmInstance,n=this.dwg_dynapi_entity_data(t,"style"),d=o.dwg_ref_get_object(n),_=o.dwg_object_to_object_tio(d);return this.dwg_dynapi_entity_data(_,"name")}dwg_entity_text_get_style_name(t){return this.dwg_entity_mtext_get_style_name(t)}dwg_entity_polyline_2d_get_numpoints(t){return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(t).data}dwg_entity_polyline_2d_get_points(t){return this.wasmInstance.dwg_entity_polyline_2d_get_points(t).data}dwg_entity_polyline_2d_get_vertices(t){return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(t).data}dwg_entity_polyline_3d_get_numpoints(t){return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(t).data}dwg_entity_polyline_3d_get_points(t){return this.wasmInstance.dwg_entity_polyline_3d_get_points(t).data}dwg_entity_polyline_3d_get_vertices(t){return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(t).data}dwg_entity_insert_get_attribs(t){return this.wasmInstance.dwg_entity_insert_get_attribs(t).data}dwg_object_dictionary_get_texts(t){return this.wasmInstance.dwg_object_dictionary_get_texts(t).data}static createByWasmInstance(t){return this.instance==null?new vr(t):this.instance}static async create(t){const o=t==null?await sr():await sr({locateFile:n=>`${t}/${n}`});return this.createByWasmInstance(o)}};et(Ir,"instance");let xo=Ir;const ln=new Uint8Array([31,37,109,7,212,54,40,40,157,87,202,63,157,68,16,43]);function ko(r){if(r.length<17)return;const t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(13,!0),o=fr(r,t);if(o)return o;const n=Math.min(r.length,1024*1024);for(let d=0;d+ln.length<=n;d++){if(!mr(r,d,ln)||d===t)continue;const _=fr(r,d);if(_)return _}}function Oo(r,t){var n;if((n=r.thumbnailImage)!=null&&n.length)return;const o=ko(t);o!=null&&o.length&&(r.thumbnailImage=o)}function fr(r,t){if(t<=0||t>=r.length||!mr(r,t,ln))return;let o=t+ln.length;if(o+5>r.length)return;const n=new DataView(r.buffer,r.byteOffset,r.byteLength);n.getInt32(o,!0),o+=4;const d=r[o];if(o+=1,d<=0||d>16)return;const _=[];for(let h=0;h<d;h++){if(o+9>r.length)return;const A=r[o];o+=1;const T=n.getInt32(o,!0);o+=4;const p=n.getInt32(o,!0);o+=4,_.push({code:A,start:T,size:p})}const c=o,f=hr(r,_,"absolute");return f||hr(r,_,"sequential",c)}function hr(r,t,o,n=0){let d,_=n;for(const c of t){const f=o==="absolute"?c.start:_;if(o==="sequential"&&(_+=Math.max(0,c.size)),c.code!==2&&c.code!==6)continue;const h=Bo(r,f,c.size);if(h!=null&&h.length){if(c.code===6)return h.slice();d||(d=h.slice())}}return d}function Bo(r,t,o){if(!(t<0||o<=0)&&!(t+o>r.length))return r.subarray(t,t+o)}function mr(r,t,o){if(t+o.length>r.length)return!1;for(let n=0;n<o.length;n++)if(r[t+n]!==o[n])return!1;return!0}const Fo=[0,5,9,13,15,18,20,25,30,35,40,50,53,60,70,80,90,100,106,120,140,158,200,211];function gr(r,t=Ht.ByLayer){return r===29?Ht.ByLayer:r===30?Ht.ByBlock:r===31?Ht.ByLineWeightDefault:Fo[r]??t}function Uo(r,t){var _,c,f,h,A;const o=!t||$o((_=r.header)==null?void 0:_.ACADVER);for(const T of((f=(c=r.tables)==null?void 0:c.LAYER)==null?void 0:f.entries)??[])T.lineweight!=null&&(T.lineweight=o?gr(T.lineweight,Ht.ByLineWeightDefault):Ht.ByLineWeightDefault);const n=new Set,d=T=>{if(T)for(const p of T)n.has(p)||(n.add(p),p.lineweight!=null&&(p.lineweight=o?gr(p.lineweight):Ht.ByLayer),d(p.attribs),d(p.vertices))};d(r.entities);for(const T of((A=(h=r.tables)==null?void 0:h.BLOCK_RECORD)==null?void 0:A.entries)??[])d(T.entities)}function $o(r){const t=typeof r=="string"?/^AC(\d{4})$/.exec(r.trim()):null;return t?Number(t[1])>=1015:!0}function Vo(r){if(typeof r=="string"){const d=r.slice(0,64);return/AutoCAD Binary DXF/i.test(d),mt.DXF}const t=r instanceof Uint8Array?r:new Uint8Array(r),o=new TextDecoder("latin1").decode(t.subarray(0,22));if(o.startsWith("AutoCAD Binary DXF"))return mt.DXF;if(o.startsWith("AC1")||o.startsWith("AC2"))return mt.DWG;const n=new TextDecoder("utf-8").decode(t.subarray(0,64));return/^\s*(0|999)\b/.test(n)?mt.DXF:mt.DWG}async function Ho(r,t){const o=await xo.create();if(o==null)throw new Error("libredwg is not loaded!");const n=Vo(r),d=o.dwg_read_data(r,n);if(d==null)throw new Error(n===mt.DXF?"Failed to read dxf data!":"Failed to read dwg data!");const _=o.convertEx(d);return Xo(o,d,_.database),Ko(o,d,_.database),Uo(_.database,n===mt.DWG),o.dwg_free(d),n===mt.DWG&&typeof r!="string"&&Oo(_.database,new Uint8Array(r)),_}function Xo(r,t,o){if(o.header&&!(typeof o.header.ACADVER=="string"&&o.header.ACADVER))try{const n=r.dwg_get_version_type(t);n!=null&&n.hdr&&n.type!=="invalid"&&(o.header.ACADVER=n.hdr)}catch{}}function Ko(r,t,o){var f;const n={},d=new Map,_=new Map;for(const h of o.objects.DICTIONARY??[]){const A=Ae(h.handle);A&&_.set(A,h)}const c=((f=o.tables.BLOCK_RECORD)==null?void 0:f.entries)??[];for(const h of c)for(const A of h.entities??[]){if(A.type!=="DIMENSION")continue;const T=A.styleName;if(!T||n[T]!=null)continue;const p=zo(r,t,A,_,d);p!=null&&p>0&&(n[T]=p)}Object.keys(n).length>0&&(o.dimStyleAnnotationScales=n)}function zo(r,t,o,n,d){var T,p;const _=n.get(Ae(o.ownerDictionaryHardId)),c=n.get(Ae((T=_==null?void 0:_.entries)==null?void 0:T.AcDbContextDataManager)),f=n.get(Ae((p=c==null?void 0:c.entries)==null?void 0:p.ACDB_ANNOTATIONSCALES)),h=f==null?void 0:f.entries;if(!h)return;let A;for(const I of Object.values(h)){const v=Zo(r,t,Ae(I),d);if(v==null)continue;if(Jo(r,t,Ae(I)))return v;A??(A=v)}return A}function Jo(r,t,o){const n=Wn(r,t,o);if(!n)return!1;try{const d=r.dwg_dynapi_entity_value(n,"is_default");return!!(d!=null&&d.success)&&Number(d.data)===1}catch{return!1}}function Zo(r,t,o,n){const d=Wn(r,t,o);if(d)try{const _=r.dwg_dynapi_entity_value(d,"scale");if(!(_!=null&&_.success)||_.data==null)return;const c=Ae(r.dwg_ref_get_id(_.data));if(!c)return;const f=n.get(c);if(f!=null)return f;const h=Wn(r,t,c);if(!h)return;const A=r.dwg_dynapi_entity_value(h,"paper_units"),T=r.dwg_dynapi_entity_value(h,"drawing_units");if(!(A!=null&&A.success)||!(T!=null&&T.success))return;const p=Number(A.data),I=Number(T.data);if(!(p>0)||!(I>0))return;const v=I/p;return n.set(c,v),v}catch{return}}function Wn(r,t,o){if(!(!o||!/^[0-9A-F]+$/i.test(o)))try{const n=r.dwg_resolve_handle(t,BigInt("0x"+o));return n?r.dwg_object_to_object_tio(n):void 0}catch{return}}function Ae(r){return r==null||r===""||r===!1||r===0?"":String(r).trim().toUpperCase()}class qo extends fo{async executeTask(t){const o=await Ho(t);return{model:o.database,data:o.stats}}}new qo;const Qo={},jo=Object.freeze(Object.defineProperty({__proto__:null,default:Qo},Symbol.toStringTag,{value:"Module"}));
|