@mlightcad/libredwg-converter 3.16.2 → 3.16.4
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 +17 -17
- package/dist/libredwg-web.wasm +0 -0
- package/lib/AcDbLibreDwgAssocConverter.d.ts +34 -0
- package/lib/AcDbLibreDwgAssocConverter.d.ts.map +1 -0
- package/lib/AcDbLibreDwgAssocConverter.js +336 -0
- package/lib/AcDbLibreDwgAssocConverter.js.map +1 -0
- package/lib/AcDbLibreDwgConverter.d.ts.map +1 -1
- package/lib/AcDbLibreDwgConverter.js +30 -1
- package/lib/AcDbLibreDwgConverter.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,26 +1,26 @@
|
|
|
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}) {
|
|
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 s(_){return _ instanceof o?_:new o(function(l){l(_)})}return new(o||(o=Promise))(function(_,l){function f(y){try{g(n.next(y))}catch(P){l(P)}}function h(y){try{g(n.throw(y))}catch(P){l(P)}}function g(y){y.done?_(y.value):s(y.value).then(f,h)}g((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,s,_,l;return l={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function f(g){return function(y){return h([g,y])}}function h(g){if(n)throw new TypeError("Generator is already executing.");for(;l&&(l=0,g[0]&&(o=0)),o;)try{if(n=1,s&&(_=g[0]&2?s.return:g[0]?s.throw||((_=s.return)&&_.call(s),0):s.next)&&!(_=_.call(s,g[1])).done)return _;switch(s=0,_&&(g=[g[0]&2,_.value]),g[0]){case 0:case 1:_=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,s=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(_=o.trys,!(_=_.length>0&&_[_.length-1])&&(g[0]===6||g[0]===2)){o=0;continue}if(g[0]===3&&(!_||g[1]>_[0]&&g[1]<_[3])){o.label=g[1];break}if(g[0]===6&&o.label<_[1]){o.label=_[1],_=g;break}if(_&&o.label<_[2]){o.label=_[2],o.ops.push(g);break}_[2]&&o.ops.pop(),o.trys.pop();continue}g=t.call(r,o)}catch(y){g=[6,y],s=0}finally{n=_=0}if(g[0]&5)throw g[1];return{value:g[0]?g[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 In(){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;In().onmessage=function(o){return lo(t,void 0,void 0,function(){var n,s,_,l,f,h,g;return co(this,function(y){switch(y.label){case 0:n=o,s=n.data,_=s.id,l=s.input,y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.executeTask(l)];case 2:return f=y.sent(),this.sendResponse(_,!0,f),[3,4];case 3:return h=y.sent(),g=h instanceof Error?h.message:String(h),this.sendResponse(_,!1,void 0,g,this.classifyTaskError(h,g)),[3,4];case 4:return[2]}})})}},r.prototype.sendResponse=function(t,o,n,s,_){var l={id:t,success:o,data:n,error:s,errorCode:_};try{In().postMessage(l)}catch(h){var f=h instanceof Error?h.message:String(h);In().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 s=Ar(o);return s||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 s=Promise.resolve();if(o&&o.length>0){let l=function(y){return Promise.all(y.map(P=>Promise.resolve(P).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const f=document.getElementsByTagName("link"),h=document.querySelector("meta[property=csp-nonce]"),g=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));s=l(o.map(y=>{if(y=go(y,n),y in ir)return;ir[y]=!0;const P=y.endsWith(".css"),p=P?'[rel="stylesheet"]':"";if(!!n)for(let w=f.length-1;w>=0;w--){const m=f[w];if(m.href===y&&(!P||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${p}`))return;const C=document.createElement("link");if(C.rel=P?"stylesheet":ho,P||(C.as="script"),C.crossOrigin="",C.href=y,g&&C.setAttribute("nonce",g),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 ${y}`)))})}))}function _(l){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=l,window.dispatchEvent(f),!f.defaultPrevented)throw l}return s.then(l=>{for(const f of l||[])f.status==="rejected"&&_(f.reason);return t().catch(_)})};async function sr(r={}){var er,nr,rr;var t,o=r,n=!!globalThis.window,s=!!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 l=e(import.meta.url)}var f="./this.program",h=import.meta.url,g="";function y(e){return o.locateFile?o.locateFile(e,g):g+e}var P,p;if(_){var I=l("node:fs");h.startsWith("file:")&&(g=l("node:path").dirname(l("node:url").fileURLToPath(h))+"/"),p=e=>{e=N(e)?new URL(e):e;var a=I.readFileSync(e);return a},P=async(e,a=!0)=>{e=N(e)?new URL(e):e;var i=I.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||s){try{g=new URL(".",h).href}catch{}s&&(p=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,d)=>{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}d(u.status)},u.onerror=d,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,O=!1;function U(){var e=_n.buffer;z=new Int8Array(e),dt=new Int16Array(e),lt=new Uint8Array(e),yt=new Uint16Array(e),k=new Int32Array(e),B=new Uint32Array(e),kt=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(){O=!0,!o.noFSInit&&!c.initialized&&c.init(),he.__wasm_call_ctors(),c.ignorePermissions=!1}function ht(){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?y("libredwg-web.wasm"):new URL(""+new URL("libredwg-web.wasm",import.meta.url).href,import.meta.url).href}function gt(e){if(e==ut&&m)return new Uint8Array(m);if(p)return p(e);throw"both async and sync fetching of the wasm failed"}async function At(e){if(!m)try{var a=await P(e);return new Uint8Array(a)}catch{}return gt(e)}async function Mt(e,a){try{var i=await At(e),d=await WebAssembly.instantiate(i,a);return d}catch(u){w(`failed to asynchronously prepare wasm: ${u}`),Z(u)}}async function bt(e,a,i){if(!e&&!N(a)&&!_)try{var d=fetch(a,{credentials:"same-origin"}),u=await WebAssembly.instantiateStreaming(d,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 Ot(){function e(E,A){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,A)=>{o.instantiateWasm(i,(T,v)=>{E(e(T))})});ut??(ut=Et());var d=await bt(m,ut,i),u=a(d);return u}var dt,k,tt,z,kt,Bt,yt,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":k[e>>>2>>>0]=a;break;case"i64":tt[e>>>3>>>0]=BigInt(a);break;case"float":kt[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 ye{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,Te=e=>e<Ye||e>Ut?NaN:Number(e);function Ne(e,a,i){e>>>=0,a>>>=0,i>>>=0;var d=new ye(e);d.init(a,i),Z()}var Zt=()=>{var e=k[+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,d=e.length-1;d>=0;d--){var u=e[d];u==="."?e.splice(d,1):u===".."?(e.splice(d,1),i++):i&&(e.splice(d,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(d=>!!d),!a).join("/"),!e&&!a&&(e="."),e&&i&&(e+="/"),(a?"/":"")+e},dirname:e=>{var a=X.splitPath(e),i=a[0],d=a[1];return!i&&!d?".":(d&&(d=d.slice(0,-1)),i+d)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>X.normalize(e.join("/")),join2:(e,a)=>X.normalize(e+"/"+a)},We=()=>{if(_){var e=l("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,d=e.length-1;d>=-1&&!i;d--){var u=d>=0?e[d]:c.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 L=0;L<D.length&&D[L]==="";L++);for(var G=D.length-1;G>=0&&D[G]==="";G--);return L>G?[]:D.slice(L,G-L+1)}for(var d=i(e.split("/")),u=i(a.split("/")),E=Math.min(d.length,u.length),A=E,T=0;T<E;T++)if(d[T]!==u[T]){A=T;break}for(var v=[],T=A;T<d.length;T++)v.push("..");return v=v.concat(u.slice(A)),v.join("/")}},Pe=globalThis.TextDecoder&&new TextDecoder,pe=(e,a,i,d)=>{var u=a+i;if(d)return u;for(;e[a]&&!(a>=u);)++a;return a},Yt=(e,a=0,i,d)=>{a>>>=0;var u=pe(e,a,i,d);if(u-a>16&&e.buffer&&Pe)return Pe.decode(e.subarray(a,u));for(var E="";a<u;){var A=e[a++];if(!(A&128)){E+=String.fromCharCode(A);continue}var T=e[a++]&63;if((A&224)==192){E+=String.fromCharCode((A&31)<<6|T);continue}var v=e[a++]&63;if((A&240)==224?A=(A&15)<<12|T<<6|v:A=(A&7)<<18|T<<12|v<<6|e[a++]&63,A<65536)E+=String.fromCharCode(A);else{var D=A-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 d=e.charCodeAt(i);d<=127?a++:d<=2047?a+=2:d>=55296&&d<=57343?(a+=4,++i):a+=3}return a},de=(e,a,i,d)=>{if(i>>>=0,!(d>0))return 0;for(var u=i,E=i+d-1,A=0;A<e.length;++A){var T=e.codePointAt(A);if(T<=127){if(i>=E)break;a[i++>>>0]=T}else if(T<=2047){if(i+1>=E)break;a[i++>>>0]=192|T>>6,a[i++>>>0]=128|T&63}else if(T<=65535){if(i+2>=E)break;a[i++>>>0]=224|T>>12,a[i++>>>0]=128|T>>6&63,a[i++>>>0]=128|T&63}else{if(i+3>=E)break;a[i++>>>0]=240|T>>18,a[i++>>>0]=128|T>>12&63,a[i++>>>0]=128|T>>6&63,a[i++>>>0]=128|T&63,A++}}return a[i>>>0]=0,i-u},Qt=(e,a,i)=>{var d=Nt(e)+1,u=new Array(d),E=de(e,u,0,u.length);return u.length=E,u},ve=()=>{var E;if(!_e.length){var e=null;if(_){var a=256,i=Buffer.alloc(a),d=0,u=process.stdin.fd;try{d=I.readSync(u,i,0,a)}catch(A){if(A.toString().includes("EOF"))d=0;else throw A}d>0&&(e=i.slice(0,d).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()},Tt={ttys:[],init(){},shutdown(){},register(e,a){Tt.ttys[e]={input:[],output:[],ops:a},c.registerDevice(e,Tt.stream_ops)},stream_ops:{open(e){var a=Tt.ttys[e.node.rdev];if(!a)throw new c.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,d,u){if(!e.tty||!e.tty.ops.get_char)throw new c.ErrnoError(60);for(var E=0,A=0;A<d;A++){var T;try{T=e.tty.ops.get_char(e.tty)}catch{throw new c.ErrnoError(29)}if(T===void 0&&E===0)throw new c.ErrnoError(6);if(T==null)break;E++,a[i+A]=T}return E&&(e.node.atime=Date.now()),E},write(e,a,i,d,u){if(!e.tty||!e.tty.ops.put_char)throw new c.ErrnoError(60);try{for(var E=0;E<d;E++)e.tty.ops.put_char(e.tty,a[i+E])}catch{throw new c.ErrnoError(29)}return d&&(e.node.mtime=e.node.ctime=Date.now()),E}},default_tty_ops:{get_char(e){return ve()},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,d){if(c.isBlkdev(i)||c.isFIFO(i))throw new c.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:c.chrdev_stream_ops}});var u=c.createNode(e,a,i,d);return c.isDir(u.mode)?(u.node_ops=x.ops_table.dir.node,u.stream_ops=x.ops_table.dir.stream,u.contents={}):c.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))):c.isLink(u.mode)?(u.node_ops=x.ops_table.link.node,u.stream_ops=x.ops_table.link.stream):c.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 d=1024*1024;a=Math.max(a,i*(i<d?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=c.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,c.isDir(e.mode)?a.size=4096:c.isFile(e.mode)?a.size=e.usedBytes:c.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 c.ErrnoError(44),x.doesNotExistError.stack="<generic error, no stack>"),x.doesNotExistError},mknod(e,a,i,d){return x.createNode(e,a,i,d)},rename(e,a,i){var d;try{d=c.lookupNode(a,i)}catch{}if(d){if(c.isDir(e.mode))for(var u in d.contents)throw new c.ErrnoError(55);c.hashRemoveNode(d)}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=c.lookupNode(e,a);for(var d in i.contents)throw new c.ErrnoError(55);delete e.contents[a],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,a,i){var d=x.createNode(e,a,41471,0);return d.link=i,d},readlink(e){if(!c.isLink(e.mode))throw new c.ErrnoError(28);return e.link}},stream_ops:{read(e,a,i,d,u){var E=e.node.contents;if(u>=e.node.usedBytes)return 0;var A=Math.min(e.node.usedBytes-u,d);return a.set(E.subarray(u,u+A),i),A},write(e,a,i,d,u,E){if(a.buffer===z.buffer&&(E=!1),!d)return 0;var A=e.node;return A.mtime=A.ctime=Date.now(),E?(A.contents=a.subarray(i,i+d),A.usedBytes=d):A.usedBytes===0&&u===0?(A.contents=a.slice(i,i+d),A.usedBytes=d):(x.expandFileStorage(A,u+d),A.contents.set(a.subarray(i,i+d),u),A.usedBytes=Math.max(A.usedBytes,u+d)),d},llseek(e,a,i){var d=a;if(i===1?d+=e.position:i===2&&c.isFile(e.node.mode)&&(d+=e.node.usedBytes),d<0)throw new c.ErrnoError(28);return d},mmap(e,a,i,d,u){if(!c.isFile(e.node.mode))throw new c.ErrnoError(43);var E,A,T=e.node.contents;if(!(u&2)&&T.buffer===z.buffer)A=!1,E=T.byteOffset;else{if(A=!0,E=le(),!E)throw new c.ErrnoError(48);T&&((i>0||i+a<T.length)&&(T.subarray?T=T.subarray(i,i+a):T=Array.prototype.slice.call(T,i,i+a)),z.set(T,E>>>0))}return{ptr:E,allocated:A}},msync(e,a,i,d,u){return x.stream_ops.write(e,a,0,d,i,!1),0}}},Ie=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)=>c.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,d,u,E,A,T)=>{var v=a?Dt.resolve(X.join2(e,a)):e;De();try{var D=i;typeof i=="string"&&(D=await me(i)),D=await Re(D,v),T==null||T(),E||we(e,a,D,d,u,A)}finally{Ce()}},Xe=(e,a,i,d,u,E,A,T,v,D)=>{Ee(e,a,i,d,u,T,v,D).then(E).catch(A)},c={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,d){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=c.nextInode++,this.name=a,this.mode=i,this.rdev=d,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 c.isDir(this.mode)}get isDevice(){return c.isChrdev(this.mode)}},lookupPath(e,a={}){if(!e)throw new c.ErrnoError(44);a.follow_mount??(a.follow_mount=!0),X.isAbs(e)||(e=c.cwd()+"/"+e);t:for(var i=0;i<40;i++){for(var d=e.split("/").filter(D=>!!D),u=c.root,E="/",A=0;A<d.length;A++){var T=A===d.length-1;if(T&&a.parent)break;if(d[A]!=="."){if(d[A]===".."){if(E=X.dirname(E),c.isRoot(u)){e=E+"/"+d.slice(A+1).join("/"),i--;continue t}else u=u.parent;continue}E=X.join2(E,d[A]);try{u=c.lookupNode(u,d[A])}catch(D){if((D==null?void 0:D.errno)===44&&T&&a.noent_okay)return{path:E};throw D}if(c.isMountpoint(u)&&(!T||a.follow_mount)&&(u=u.mounted.root),c.isLink(u.mode)&&(!T||a.follow)){if(!u.node_ops.readlink)throw new c.ErrnoError(52);var v=u.node_ops.readlink(u);X.isAbs(v)||(v=X.dirname(E)+"/"+v),e=v+"/"+d.slice(A+1).join("/");continue t}}}return{path:E,node:u}}throw new c.ErrnoError(32)},getPath(e){for(var a;;){if(c.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,d=0;d<a.length;d++)i=(i<<5)-i+a.charCodeAt(d)|0;return(e+i>>>0)%c.nameTable.length},hashAddNode(e){var a=c.hashName(e.parent.id,e.name);e.name_next=c.nameTable[a],c.nameTable[a]=e},hashRemoveNode(e){var a=c.hashName(e.parent.id,e.name);if(c.nameTable[a]===e)c.nameTable[a]=e.name_next;else for(var i=c.nameTable[a];i;){if(i.name_next===e){i.name_next=e.name_next;break}i=i.name_next}},lookupNode(e,a){var i=c.mayLookup(e);if(i)throw new c.ErrnoError(i);for(var d=c.hashName(e.id,a),u=c.nameTable[d];u;u=u.name_next){var E=u.name;if(u.parent.id===e.id&&E===a)return u}return c.lookup(e,a)},createNode(e,a,i,d){var u=new c.FSNode(e,a,i,d);return c.hashAddNode(u),u},destroyNode(e){c.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 c.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(!c.isDir(e.mode))return 54;var a=c.nodePermissions(e,"x");return a||(e.node_ops.lookup?0:2)},mayCreate(e,a){if(!c.isDir(e.mode))return 54;try{var i=c.lookupNode(e,a);return 20}catch{}return c.nodePermissions(e,"wx")},mayDelete(e,a,i){var d;try{d=c.lookupNode(e,a)}catch(E){return E.errno}var u=c.nodePermissions(e,"wx");if(u)return u;if(i){if(!c.isDir(d.mode))return 54;if(c.isRoot(d)||c.getPath(d)===c.cwd())return 10}else if(c.isDir(d.mode))return 31;return 0},mayOpen(e,a){if(!e)return 44;if(c.isLink(e.mode))return 32;var i=c.flagsToPermissionString(a);return c.isDir(e.mode)&&(i!=="r"||a&576)?31:c.nodePermissions(e,i)},checkOpExists(e,a){if(!e)throw new c.ErrnoError(a);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=c.MAX_OPEN_FDS;e++)if(!c.streams[e])return e;throw new c.ErrnoError(33)},getStreamChecked(e){var a=c.getStream(e);if(!a)throw new c.ErrnoError(8);return a},getStream:e=>c.streams[e],createStream(e,a=-1){return e=Object.assign(new c.FSStream,e),a==-1&&(a=c.nextfd()),e.fd=a,c.streams[a]=e,e},closeStream(e){c.streams[e]=null},dupStream(e,a=-1){var d,u;var i=c.createStream(e,a);return(u=(d=i.stream_ops)==null?void 0:d.dup)==null||u.call(d,i),i},doSetAttr(e,a,i){var d=e==null?void 0:e.stream_ops.setattr,u=d?e:a;d??(d=a.node_ops.setattr),c.checkOpExists(d,63);try{d(u,i)}catch(E){throw E instanceof RangeError?new c.ErrnoError(22):E}},chrdev_stream_ops:{open(e){var i,d;var a=c.getDevice(e.node.rdev);e.stream_ops=a.stream_ops,(d=(i=e.stream_ops).open)==null||d.call(i,e)},llseek(){throw new c.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,a)=>e<<8|a,registerDevice(e,a){c.devices[e]={stream_ops:a}},getDevice:e=>c.devices[e],getMounts(e){for(var a=[],i=[e];i.length;){var d=i.pop();a.push(d),i.push(...d.mounts)}return a},syncfs(e,a){typeof e=="function"&&(a=e,e=!1),c.syncFSRequests++,c.syncFSRequests>1&&w(`warning: ${c.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var i=c.getMounts(c.root.mount),d=0;function u(T){return c.syncFSRequests--,a(T)}function E(T){if(T)return E.errored?void 0:(E.errored=!0,u(T));++d>=i.length&&u(null)}for(var A of i)A.type.syncfs?A.type.syncfs(A,e,E):E(null)},mount(e,a,i){var d=i==="/",u=!i,E;if(d&&c.root)throw new c.ErrnoError(10);if(!d&&!u){var A=c.lookupPath(i,{follow_mount:!1});if(i=A.path,E=A.node,c.isMountpoint(E))throw new c.ErrnoError(10);if(!c.isDir(E.mode))throw new c.ErrnoError(54)}var T={type:e,opts:a,mountpoint:i,mounts:[]},v=e.mount(T);return v.mount=T,T.root=v,d?c.root=v:E&&(E.mounted=T,E.mount&&E.mount.mounts.push(T)),v},unmount(e){var a=c.lookupPath(e,{follow_mount:!1});if(!c.isMountpoint(a.node))throw new c.ErrnoError(28);var i=a.node,d=i.mounted,u=c.getMounts(d);for(var[E,A]of Object.entries(c.nameTable))for(;A;){var T=A.name_next;u.includes(A.mount)&&c.destroyNode(A),A=T}i.mounted=null;var v=i.mount.mounts.indexOf(d);i.mount.mounts.splice(v,1)},lookup(e,a){return e.node_ops.lookup(e,a)},mknod(e,a,i){var d=c.lookupPath(e,{parent:!0}),u=d.node,E=X.basename(e);if(!E)throw new c.ErrnoError(28);if(E==="."||E==="..")throw new c.ErrnoError(20);var A=c.mayCreate(u,E);if(A)throw new c.ErrnoError(A);if(!u.node_ops.mknod)throw new c.ErrnoError(63);return u.node_ops.mknod(u,E,a,i)},statfs(e){return c.statfsNode(c.lookupPath(e,{follow:!0}).node)},statfsStream(e){return c.statfsNode(e.node)},statfsNode(e){var a={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:c.nextInode,ffree:c.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,c.mknod(e,a,0)},mkdir(e,a=511){return a&=1023,a|=16384,c.mknod(e,a,0)},mkdirTree(e,a){var i=e.split("/"),d="";for(var u of i)if(u){(d||X.isAbs(e))&&(d+="/"),d+=u;try{c.mkdir(d,a)}catch(E){if(E.errno!=20)throw E}}},mkdev(e,a,i){return typeof i>"u"&&(i=a,a=438),a|=8192,c.mknod(e,a,i)},symlink(e,a){if(!Dt.resolve(e))throw new c.ErrnoError(44);var i=c.lookupPath(a,{parent:!0}),d=i.node;if(!d)throw new c.ErrnoError(44);var u=X.basename(a),E=c.mayCreate(d,u);if(E)throw new c.ErrnoError(E);if(!d.node_ops.symlink)throw new c.ErrnoError(63);return d.node_ops.symlink(d,u,e)},rename(e,a){var i=X.dirname(e),d=X.dirname(a),u=X.basename(e),E=X.basename(a),A,T,v;if(A=c.lookupPath(e,{parent:!0}),T=A.node,A=c.lookupPath(a,{parent:!0}),v=A.node,!T||!v)throw new c.ErrnoError(44);if(T.mount!==v.mount)throw new c.ErrnoError(75);var D=c.lookupNode(T,u),L=Dt.relative(e,d);if(L.charAt(0)!==".")throw new c.ErrnoError(28);if(L=Dt.relative(a,i),L.charAt(0)!==".")throw new c.ErrnoError(55);var G;try{G=c.lookupNode(v,E)}catch{}if(D!==G){var b=c.isDir(D.mode),Y=c.mayDelete(T,u,b);if(Y)throw new c.ErrnoError(Y);if(Y=G?c.mayDelete(v,E,b):c.mayCreate(v,E),Y)throw new c.ErrnoError(Y);if(!T.node_ops.rename)throw new c.ErrnoError(63);if(c.isMountpoint(D)||G&&c.isMountpoint(G))throw new c.ErrnoError(10);if(v!==T&&(Y=c.nodePermissions(T,"w"),Y))throw new c.ErrnoError(Y);c.hashRemoveNode(D);try{T.node_ops.rename(D,v,E),D.parent=v}catch(F){throw F}finally{c.hashAddNode(D)}}},rmdir(e){var a=c.lookupPath(e,{parent:!0}),i=a.node,d=X.basename(e),u=c.lookupNode(i,d),E=c.mayDelete(i,d,!0);if(E)throw new c.ErrnoError(E);if(!i.node_ops.rmdir)throw new c.ErrnoError(63);if(c.isMountpoint(u))throw new c.ErrnoError(10);i.node_ops.rmdir(i,d),c.destroyNode(u)},readdir(e){var a=c.lookupPath(e,{follow:!0}),i=a.node,d=c.checkOpExists(i.node_ops.readdir,54);return d(i)},unlink(e){var a=c.lookupPath(e,{parent:!0}),i=a.node;if(!i)throw new c.ErrnoError(44);var d=X.basename(e),u=c.lookupNode(i,d),E=c.mayDelete(i,d,!1);if(E)throw new c.ErrnoError(E);if(!i.node_ops.unlink)throw new c.ErrnoError(63);if(c.isMountpoint(u))throw new c.ErrnoError(10);i.node_ops.unlink(i,d),c.destroyNode(u)},readlink(e){var a=c.lookupPath(e),i=a.node;if(!i)throw new c.ErrnoError(44);if(!i.node_ops.readlink)throw new c.ErrnoError(28);return i.node_ops.readlink(i)},stat(e,a){var i=c.lookupPath(e,{follow:!a}),d=i.node,u=c.checkOpExists(d.node_ops.getattr,63);return u(d)},fstat(e){var a=c.getStreamChecked(e),i=a.node,d=a.stream_ops.getattr,u=d?a:i;return d??(d=i.node_ops.getattr),c.checkOpExists(d,63),d(u)},lstat(e){return c.stat(e,!0)},doChmod(e,a,i,d){c.doSetAttr(e,a,{mode:i&4095|a.mode&-4096,ctime:Date.now(),dontFollow:d})},chmod(e,a,i){var d;if(typeof e=="string"){var u=c.lookupPath(e,{follow:!i});d=u.node}else d=e;c.doChmod(null,d,a,i)},lchmod(e,a){c.chmod(e,a,!0)},fchmod(e,a){var i=c.getStreamChecked(e);c.doChmod(i,i.node,a,!1)},doChown(e,a,i){c.doSetAttr(e,a,{timestamp:Date.now(),dontFollow:i})},chown(e,a,i,d){var u;if(typeof e=="string"){var E=c.lookupPath(e,{follow:!d});u=E.node}else u=e;c.doChown(null,u,d)},lchown(e,a,i){c.chown(e,a,i,!0)},fchown(e,a,i){var d=c.getStreamChecked(e);c.doChown(d,d.node,!1)},doTruncate(e,a,i){if(c.isDir(a.mode))throw new c.ErrnoError(31);if(!c.isFile(a.mode))throw new c.ErrnoError(28);var d=c.nodePermissions(a,"w");if(d)throw new c.ErrnoError(d);c.doSetAttr(e,a,{size:i,timestamp:Date.now()})},truncate(e,a){if(a<0)throw new c.ErrnoError(28);var i;if(typeof e=="string"){var d=c.lookupPath(e,{follow:!0});i=d.node}else i=e;c.doTruncate(null,i,a)},ftruncate(e,a){var i=c.getStreamChecked(e);if(a<0||(i.flags&2097155)===0)throw new c.ErrnoError(28);c.doTruncate(i,i.node,a)},utime(e,a,i){var d=c.lookupPath(e,{follow:!0}),u=d.node,E=c.checkOpExists(u.node_ops.setattr,63);E(u,{atime:a,mtime:i})},open(e,a,i=438){if(e==="")throw new c.ErrnoError(44);a=Ie(a),a&64?i=i&4095|32768:i=0;var d,u;if(typeof e=="object")d=e;else{u=e.endsWith("/");var E=c.lookupPath(e,{follow:!(a&131072),noent_okay:!0});d=E.node,e=E.path}var A=!1;if(a&64)if(d){if(a&128)throw new c.ErrnoError(20)}else{if(u)throw new c.ErrnoError(31);d=c.mknod(e,i|511,0),A=!0}if(!d)throw new c.ErrnoError(44);if(c.isChrdev(d.mode)&&(a&=-513),a&65536&&!c.isDir(d.mode))throw new c.ErrnoError(54);if(!A){var T=c.mayOpen(d,a);if(T)throw new c.ErrnoError(T)}a&512&&!A&&c.truncate(d,0),a&=-131713;var v=c.createStream({node:d,path:c.getPath(d),flags:a,seekable:!0,position:0,stream_ops:d.stream_ops,ungotten:[],error:!1});return v.stream_ops.open&&v.stream_ops.open(v),A&&c.chmod(d,i&511),v},close(e){if(c.isClosed(e))throw new c.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(a){throw a}finally{c.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,a,i){if(c.isClosed(e))throw new c.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new c.ErrnoError(70);if(i!=0&&i!=1&&i!=2)throw new c.ErrnoError(28);return e.position=e.stream_ops.llseek(e,a,i),e.ungotten=[],e.position},read(e,a,i,d,u){if(d<0||u<0)throw new c.ErrnoError(28);if(c.isClosed(e))throw new c.ErrnoError(8);if((e.flags&2097155)===1)throw new c.ErrnoError(8);if(c.isDir(e.node.mode))throw new c.ErrnoError(31);if(!e.stream_ops.read)throw new c.ErrnoError(28);var E=typeof u<"u";if(!E)u=e.position;else if(!e.seekable)throw new c.ErrnoError(70);var A=e.stream_ops.read(e,a,i,d,u);return E||(e.position+=A),A},write(e,a,i,d,u,E){if(d<0||u<0)throw new c.ErrnoError(28);if(c.isClosed(e))throw new c.ErrnoError(8);if((e.flags&2097155)===0)throw new c.ErrnoError(8);if(c.isDir(e.node.mode))throw new c.ErrnoError(31);if(!e.stream_ops.write)throw new c.ErrnoError(28);e.seekable&&e.flags&1024&&c.llseek(e,0,2);var A=typeof u<"u";if(!A)u=e.position;else if(!e.seekable)throw new c.ErrnoError(70);var T=e.stream_ops.write(e,a,i,d,u,E);return A||(e.position+=T),T},mmap(e,a,i,d,u){if((d&2)!==0&&(u&2)===0&&(e.flags&2097155)!==2)throw new c.ErrnoError(2);if((e.flags&2097155)===1)throw new c.ErrnoError(2);if(!e.stream_ops.mmap)throw new c.ErrnoError(43);if(!a)throw new c.ErrnoError(28);return e.stream_ops.mmap(e,a,i,d,u)},msync(e,a,i,d,u){return e.stream_ops.msync?e.stream_ops.msync(e,a,i,d,u):0},ioctl(e,a,i){if(!e.stream_ops.ioctl)throw new c.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=c.open(e,a.flags),d=c.stat(e),u=d.size,E=new Uint8Array(u);return c.read(i,E,0,u,0),a.encoding==="utf8"&&(E=Yt(E)),c.close(i),E},writeFile(e,a,i={}){i.flags=i.flags??577;var d=c.open(e,i.flags,i.mode);a=ce(a),c.write(d,a,0,a.byteLength,void 0,i.canOwn),c.close(d)},cwd:()=>c.currentPath,chdir(e){var a=c.lookupPath(e,{follow:!0});if(a.node===null)throw new c.ErrnoError(44);if(!c.isDir(a.node.mode))throw new c.ErrnoError(54);var i=c.nodePermissions(a.node,"x");if(i)throw new c.ErrnoError(i);c.currentPath=a.path},createDefaultDirectories(){c.mkdir("/tmp"),c.mkdir("/home"),c.mkdir("/home/web_user")},createDefaultDevices(){c.mkdir("/dev"),c.registerDevice(c.makedev(1,3),{read:()=>0,write:(d,u,E,A,T)=>A,llseek:()=>0}),c.mkdev("/dev/null",c.makedev(1,3)),Tt.register(c.makedev(5,0),Tt.default_tty_ops),Tt.register(c.makedev(6,0),Tt.default_tty1_ops),c.mkdev("/dev/tty",c.makedev(5,0)),c.mkdev("/dev/tty1",c.makedev(6,0));var e=new Uint8Array(1024),a=0,i=()=>(a===0&&(qt(e),a=e.byteLength),e[--a]);c.createDevice("/dev","random",i),c.createDevice("/dev","urandom",i),c.mkdir("/dev/shm"),c.mkdir("/dev/shm/tmp")},createSpecialDirectories(){c.mkdir("/proc");var e=c.mkdir("/proc/self");c.mkdir("/proc/self/fd"),c.mount({mount(){var a=c.createNode(e,"fd",16895,73);return a.stream_ops={llseek:x.stream_ops.llseek},a.node_ops={lookup(i,d){var u=+d,E=c.getStreamChecked(u),A={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>E.path},id:u+1};return A.parent=A,A},readdir(){return Array.from(c.streams.entries()).filter(([i,d])=>d).map(([i,d])=>i.toString())}},a}},{},"/proc/self/fd")},createStandardStreams(e,a,i){e?c.createDevice("/dev","stdin",e):c.symlink("/dev/tty","/dev/stdin"),a?c.createDevice("/dev","stdout",null,a):c.symlink("/dev/tty","/dev/stdout"),i?c.createDevice("/dev","stderr",null,i):c.symlink("/dev/tty1","/dev/stderr"),c.open("/dev/stdin",0),c.open("/dev/stdout",1),c.open("/dev/stderr",1)},staticInit(){c.nameTable=new Array(4096),c.mount(x,{},"/"),c.createDefaultDirectories(),c.createDefaultDevices(),c.createSpecialDirectories(),c.filesystems={MEMFS:x}},init(e,a,i){c.initialized=!0,e??(e=o.stdin),a??(a=o.stdout),i??(i=o.stderr),c.createStandardStreams(e,a,i)},quit(){c.initialized=!1;for(var e of c.streams)e&&c.close(e)},findObject(e,a){var i=c.analyzePath(e,a);return i.exists?i.object:null},analyzePath(e,a){try{var i=c.lookupPath(e,{follow:!a});e=i.path}catch{}var d={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=c.lookupPath(e,{parent:!0});d.parentExists=!0,d.parentPath=i.path,d.parentObject=i.node,d.name=X.basename(e),i=c.lookupPath(e,{follow:!a}),d.exists=!0,d.path=i.path,d.object=i.node,d.name=i.node.name,d.isRoot=i.path==="/"}catch(u){d.error=u.errno}return d},createPath(e,a,i,d){e=typeof e=="string"?e:c.getPath(e);for(var u=a.split("/").reverse();u.length;){var E=u.pop();if(E){var A=X.join2(e,E);try{c.mkdir(A)}catch(T){if(T.errno!=20)throw T}e=A}}return A},createFile(e,a,i,d,u){var E=X.join2(typeof e=="string"?e:c.getPath(e),a),A=jt(d,u);return c.create(E,A)},createDataFile(e,a,i,d,u,E){var A=a;e&&(e=typeof e=="string"?e:c.getPath(e),A=a?X.join2(e,a):e);var T=jt(d,u),v=c.create(A,T);if(i){i=ce(i),c.chmod(v,T|146);var D=c.open(v,577);c.write(D,i,0,i.length,0,E),c.close(D),c.chmod(v,T)}},createDevice(e,a,i,d){var T;var u=X.join2(typeof e=="string"?e:c.getPath(e),a),E=jt(!!i,!!d);(T=c.createDevice).major??(T.major=64);var A=c.makedev(c.createDevice.major++,0);return c.registerDevice(A,{open(v){v.seekable=!1},close(v){var D;(D=d==null?void 0:d.buffer)!=null&&D.length&&d(10)},read(v,D,L,G,b){for(var Y=0,F=0;F<G;F++){var H;try{H=i()}catch{throw new c.ErrnoError(29)}if(H===void 0&&Y===0)throw new c.ErrnoError(6);if(H==null)break;Y++,D[L+F]=H}return Y&&(v.node.atime=Date.now()),Y},write(v,D,L,G,b){for(var Y=0;Y<G;Y++)try{d(D[L+Y])}catch{throw new c.ErrnoError(29)}return G&&(v.node.mtime=v.node.ctime=Date.now()),Y}}),c.mkdev(u,E,A)},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=p(e.url)}catch{throw new c.ErrnoError(29)}},createLazyFile(e,a,i,d,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=(vt,Vt)=>{vt>Vt&&Z(`invalid range (${vt}, ${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="+vt+"-"+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(vt=>{var Vt=vt*at,it=(vt+1)*at-1;return it=Math.min(it,Y-1),typeof _t.chunks[vt]>"u"&&(_t.chunks[vt]=ct(Vt,it)),typeof _t.chunks[vt]>"u"&&Z("doXHR failed!"),_t.chunks[vt]}),(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){s||Z("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var A=new E,T={isDevice:!1,contents:A}}else var T={isDevice:!1,url:i};var v=c.createFile(e,a,T,d,u);T.contents?v.contents=T.contents:T.url&&(v.contents=null,v.url=T.url),Object.defineProperties(v,{usedBytes:{get:function(){return this.contents.length}}});var D={};for(const[G,b]of Object.entries(v.stream_ops))D[G]=(...Y)=>(c.forceLoadFile(v),b(...Y));function L(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)=>(c.forceLoadFile(v),L(G,b,Y,F,H)),D.mmap=(G,b,Y,F,H)=>{c.forceLoadFile(v);var rt=le();if(!rt)throw new c.ErrnoError(48);return L(G,z,rt,b,Y),{ptr:rt,allocated:!0}},v.stream_ops=D,v}},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 d;if(e===-100)d=c.cwd();else{var u=Q.getStreamFromFD(e);d=u.path}if(a.length==0){if(!i)throw new c.ErrnoError(44);return d}return d+"/"+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),k[e+32>>>2>>>0]=4096,k[e+36>>>2>>>0]=a.blocks;var i=a.atime.getTime(),d=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(d/1e3)),B[e+64>>>2>>>0]=d%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,d,u){if(!c.isFile(a.node.mode))throw new c.ErrnoError(43);if(d&2)return 0;var E=lt.slice(e,e+i);c.msync(a,E,u,i,d)},getStreamFromFD(e){var a=c.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 d=Q.getStreamFromFD(e);switch(a){case 0:{var u=Zt();if(u<0)return-28;for(;c.streams[u];)u++;var E;return E=c.dupStream(d,u),E.fd}case 1:case 2:return 0;case 3:return d.flags;case 4:{var u=Zt(),A=289792;return d.flags=d.flags&~A|u&A,0}case 12:{var u=Lt(),T=0;return dt[u+T>>>1>>>0]=2,0}case 13:case 14:return 0}return-28}catch(v){if(typeof c>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function un(e,a){a>>>=0;try{return Q.writeStat(a,c.fstat(e))}catch(i){if(typeof c>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function En(e,a,i){i>>>=0,Q.varargs=i;try{var d=Q.getStreamFromFD(e);switch(a){case 21509:return d.tty?0:-59;case 21505:{if(!d.tty)return-59;if(d.tty.ops.ioctl_tcgets){var u=d.tty.ops.ioctl_tcgets(d),E=Lt();k[E>>>2>>>0]=u.c_iflag||0,k[E+4>>>2>>>0]=u.c_oflag||0,k[E+8>>>2>>>0]=u.c_cflag||0,k[E+12>>>2>>>0]=u.c_lflag||0;for(var A=0;A<32;A++)z[E+A+17>>>0]=u.c_cc[A]||0;return 0}return 0}case 21510:case 21511:case 21512:return d.tty?0:-59;case 21506:case 21507:case 21508:{if(!d.tty)return-59;if(d.tty.ops.ioctl_tcsets){for(var E=Lt(),T=k[E>>>2>>>0],v=k[E+4>>>2>>>0],D=k[E+8>>>2>>>0],L=k[E+12>>>2>>>0],G=[],A=0;A<32;A++)G.push(z[E+A+17>>>0]);return d.tty.ops.ioctl_tcsets(d.tty,a,{c_iflag:T,c_oflag:v,c_cflag:D,c_lflag:L,c_cc:G})}return 0}case 21519:{if(!d.tty)return-59;var E=Lt();return k[E>>>2>>>0]=0,0}case 21520:return d.tty?-28:-59;case 21537:case 21531:{var E=Lt();return c.ioctl(d,a,E)}case 21523:{if(!d.tty)return-59;if(d.tty.ops.ioctl_tiocgwinsz){var b=d.tty.ops.ioctl_tiocgwinsz(d.tty),E=Lt();dt[E>>>1>>>0]=b[0],dt[E+2>>>1>>>0]=b[1]}return 0}case 21524:return d.tty?0:-59;case 21515:return d.tty?0:-59;default:return-28}}catch(Y){if(typeof c>"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,c.lstat(e))}catch(i){if(typeof c>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Ge(e,a,i,d){a>>>=0,i>>>=0;try{a=Q.getStr(a);var u=d&256,E=d&4096;return d=d&-6401,a=Q.calculateAt(e,a,E),Q.writeStat(i,u?c.lstat(a):c.stat(a))}catch(A){if(typeof c>"u"||A.name!=="ErrnoError")throw A;return-A.errno}}function K(e,a,i,d){a>>>=0,d>>>=0,Q.varargs=d;try{a=Q.getStr(a),a=Q.calculateAt(e,a);var u=d?Zt():0;return i&64&&(u&=~Q.currentUmask),c.open(a,i,u).fd}catch(E){if(typeof c>"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,c.stat(e))}catch(i){if(typeof c>"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 d=a.name;if(e||$(`type "${d}" must have a positive integer typeid pointer`),$t.hasOwnProperty(e)){if(i.ignoreDuplicateRegistrations)return;$(`Cannot register type '${d}' 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?d=>z[d>>>0]:d=>lt[d>>>0];case 2:return i?d=>dt[d>>>1>>>0]:d=>yt[d>>>1>>>0];case 4:return i?d=>k[d>>>2>>>0]:d=>B[d>>>2>>>0];case 8:return i?d=>tt[d>>>3>>>0]:d=>Xt[d>>>3>>>0];default:throw new TypeError(`invalid integer width (${a}): ${e}`)}},Je=function(e,a,i,d,u){e>>>=0,a>>>=0,i>>>=0,a=st(a);const E=d===0n;let A=T=>T;if(E){const T=i*8;A=v=>BigInt.asUintN(T,v),u=A(u)}ot(e,{name:a,fromWireType:A,toWireType:(T,v)=>(typeof v=="number"&&(v=BigInt(v)),v),readValueFromPointer:Rt(a,i,!E),destructorFunction:null})};function fn(e,a,i,d){e>>>=0,a>>>=0,a=st(a),ot(e,{name:a,fromWireType:function(u){return!!u},toWireType:function(u,E){return E?i:d},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)},Oe=e=>{e.count.value-=1;var a=e.count.value===0;a&&xe(e)},ke=e=>globalThis.FinalizationRegistry?(be=new FinalizationRegistry(a=>{Oe(a.$$)}),ke=a=>{var i=a.$$,d=!!i.smartPtr;if(d){var u={$$:i};be.register(a,u,a)}return a},Le=a=>be.unregister(a),ke(e)):(ke=a=>a,e),wr=()=>{let e=Ze.prototype;Object.assign(e,{isAliasOf(i){if(!(this instanceof Ze)||!(i instanceof Ze))return!1;var d=this.$$.ptrType.registeredClass,u=this.$$.ptr;i.$$=i.$$;for(var E=i.$$.ptrType.registeredClass,A=i.$$.ptr;d.baseClass;)u=d.upcast(u),d=d.baseClass;for(;E.baseClass;)A=E.upcast(A),E=E.baseClass;return d===E&&u===A},clone(){if(this.$$.ptr||Me(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var i=ke(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),Oe(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 d=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[d.argCount]=d}},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,d,u,E,A,T){this.name=e,this.constructor=a,this.instancePrototype=i,this.rawDestructor=d,this.baseClass=u,this.getActualType=E,this.upcast=A,this.downcast=T,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,d=Qe(a.$$.ptr,i,this.registeredClass);return d}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 d=a.$$.ptrType.registeredClass;if(i=Qe(a.$$.ptr,d,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,d=Qe(a.$$.ptr,i,this.registeredClass);return d}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 d=Mn(e,a,i.baseClass);return d===null?null:i.downcast(d)},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,d=!!a.smartPtr;return i!==d&&tn("Both smartPtrType and smartPtr must be specified"),a.count={value:1},ke(Object.create(e,{$$:{value:a,writable:!0}}))};function Or(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 d=i.clone();return this.destructor(e),d}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),A=Gn[E];if(!A)return u.call(this);var T;this.isConst?T=A.constPointerType:T=A.pointerType;var v=Mn(a,this.registeredClass,T.registeredClass);return v===null?u.call(this):this.isSmartPointer?en(T.registeredClass.instancePrototype,{ptrType:T,ptr:v,smartPtrType:this,smartPtr:e}):en(T.registeredClass.instancePrototype,{ptrType:T,ptr:v})}var kr=()=>{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:Or})};function nn(e,a,i,d,u,E,A,T,v,D,L){this.name=e,this.registeredClass=a,this.isReference=i,this.isConst=d,this.isSmartPointer=u,this.pointeeType=E,this.sharingPolicy=A,this.rawGetPointee=T,this.rawConstructor=v,this.rawShare=D,this.rawDestructor=L,!u&&a.baseClass===void 0?d?(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=[],On=e=>{var a=xn[e];return a||(xn[e]=a=jn.get(e)),a},Br=(e,a,i=[],d=!1)=>{var u=On(a),E=u(...i);function A(T){return e[0]=="p"?T>>>0:T}return A(E)},Fr=(e,a,i=!1)=>(...d)=>Br(e,a,d,i),fe=(e,a,i=!1)=>{e=st(e);function d(){if(e.includes("p"))return Fr(e,a,i);var E=On(a);return E}var u=d();return typeof u!="function"&&$(`unknown function pointer with signature ${e}: ${a}`),u};class Ur extends Error{}var kn=e=>{var a=Jn(e),i=st(a);return ie(a),i},rn=(e,a)=>{var i=[],d={};function u(E){if(!d[E]&&!$t[E]){if(re[E]){re[E].forEach(u);return}i.push(E),d[E]=!0}}throw a.forEach(u),new Ur(`${e}: `+i.map(kn).join([", "]))},an=(e,a,i)=>{e.forEach(T=>re[T]=a);function d(T){var v=i(T);v.length!==e.length&&tn("Mismatched type converter count");for(var D=0;D<e.length;++D)ot(e[D],v[D])}var u=new Array(a.length),E=[],A=0;for(let[T,v]of a.entries())$t.hasOwnProperty(v)?u[T]=$t[v]:(E.push(v),ne.hasOwnProperty(v)||(ne[v]=[]),ne[v].push(()=>{u[T]=$t[v],++A,A===E.length&&d(u)}));E.length===0&&d(u)};function $r(e,a,i,d,u,E,A,T,v,D,L,G,b){e>>>=0,a>>>=0,i>>>=0,d>>>=0,u>>>=0,E>>>=0,A>>>=0,T>>>=0,v>>>=0,D>>>=0,L>>>=0,G>>>=0,b>>>=0,L=st(L),E=fe(u,E),T&&(T=fe(A,T)),D&&(D=fe(v,D)),b=fe(G,b);var Y=Sr(L);Be(Y,function(){rn(`Cannot construct ${L} due to unbound types`,[d])}),an([e,a,i],d?[d]:[],F=>{var ar;F=F[0];var H,rt;d?(H=F.registeredClass,rt=H.instancePrototype):rt=Ze.prototype;var at=qe(L,function(...vn){if(Object.getPrototypeOf(this)!==ct)throw new Se(`Use 'new' to construct ${L}`);if(_t.constructor_body===void 0)throw new Se(`${L} has no accessible constructor`);var or=_t.constructor_body[vn.length];if(or===void 0)throw new Se(`Tried to invoke ctor of ${L} with invalid number of parameters (${vn.length}) - expected (${Object.keys(_t.constructor_body).toString()}) parameters instead!`);return or.apply(this,vn)}),ct=Object.create(rt,{constructor:{value:at}});at.prototype=ct;var _t=new Lr(L,at,ct,b,H,E,T,D);_t.baseClass&&((ar=_t.baseClass).__derivedClasses??(ar.__derivedClasses=[]),_t.baseClass.__derivedClasses.push(_t));var vt=new nn(L,_t,!0,!1,!1),Vt=new nn(L+"*",_t,!1,!1,!1),it=new nn(L+" const*",_t,!1,!0,!1);return Gn[e]={pointerType:Vt,constPointerType:it},bn(Y,at),[vt,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,d,u,E,A,T,v,D){e>>>=0,a>>>=0,i>>>=0,d>>>=0,u>>>=0,E>>>=0,A>>>=0,T>>>=0,v>>>=0,D>>>=0,a=st(a),u=fe(d,u),an([],[e],L=>{L=L[0];var G=`${L.name}.${a}`,b={get(){rn(`Cannot access ${G} due to unbound types`,[i,A])},enumerable:!0,configurable:!0};return v?b.set=()=>rn(`Cannot access ${G} due to unbound types`,[i,A]):b.set=Y=>$(G+" is a read-only property"),Object.defineProperty(L.registeredClass.instancePrototype,a,b),an([],v?[i,A]:[i],Y=>{var F=Y[0],H={get(){var at=Bn(this,L,G+" getter");return F.fromWireType(u(E,at))},enumerable:!0};if(v){v=fe(T,v);var rt=Y[1];H.set=function(at){var ct=Bn(this,L,G+" setter"),_t=[];v(D,ct,rt.toWireType(_t,at)),An(_t)}}return Object.defineProperty(L.registeredClass.instancePrototype,a,H),[]}),[]})},Fn=[],ae=[0,1,,1,null,1,!0,1,!1,1];function yn(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 yn(e),a},toWireType:(e,a)=>pt.toHandle(a),readValueFromPointer:je,destructorFunction:null};function Xr(e){return e>>>=0,ot(e,Hr)}var Tn=(e,a,i)=>{switch(a){case 1:return i?function(d){return this.fromWireType(z[d>>>0])}:function(d){return this.fromWireType(lt[d>>>0])};case 2:return i?function(d){return this.fromWireType(dt[d>>>1>>>0])}:function(d){return this.fromWireType(yt[d>>>1>>>0])};case 4:return i?function(d){return this.fromWireType(k[d>>>2>>>0])}:function(d){return this.fromWireType(B[d>>>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,d,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(L){return this.constructor.values[L]},toWireType:(L,G)=>G.value,readValueFromPointer:Tn(a,i,d),destructorFunction:null}),Be(a,D);break}case"number":{var A={};ot(e,{name:a,keysMap:A,valueType:E,fromWireType:D=>D,toWireType:(D,L)=>L,readValueFromPointer:Tn(a,i,d),destructorFunction:null}),Be(a,A),delete o[a].argCount;break}case"string":{var T={},v={},A={};ot(e,{name:a,valuesMap:T,reverseMap:v,keysMap:A,valueType:E,fromWireType:function(L){return this.reverseMap[L]},toWireType:function(L,G){return this.valuesMap[G]},readValueFromPointer:Tn(a,i,d),destructorFunction:null}),Be(a,A),delete o[a].argCount;break}}}var Un=(e,a)=>{var i=$t[e];return i===void 0&&$(`${a} has unknown type ${kn(e)}`),i};function Jr(e,a,i){e>>>=0,a>>>=0;var d=Un(e,"enum");switch(a=st(a),d.valueType){case"object":{var u=d.constructor,E=Object.create(d.constructor.prototype,{value:{value:i},constructor:{value:qe(`${d.name}_${a}`,function(){})}});u.values[i]=E,u[a]=E;break}case"number":{d.keysMap[a]=i;break}case"string":{d.valuesMap[a]=i,d.reverseMap[i]=a,d.keysMap[a]=a;break}}}var Zr=(e,a)=>{switch(a){case 4:return function(i){return this.fromWireType(kt[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:d=>d,toWireType:(d,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,d){for(var u=$n(e),E=e.length-2,A=[],T=["fn"],v=0;v<E;++v)A.push(`arg${v}`),T.push(`arg${v}Wired`);A=A.join(","),T=T.join(",");var D=`return function (${A}) {
|
|
3
3
|
`;u&&(D+=`var destructors = [];
|
|
4
|
-
`);for(var
|
|
5
|
-
`,G.push(b)}if(D+=(i||
|
|
4
|
+
`);for(var L=u?"destructors":"null",G=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"],v=0;v<E;++v){var b=`toArg${v}Wire`;D+=`var arg${v}Wired = ${b}(${L}, arg${v});
|
|
5
|
+
`,G.push(b)}if(D+=(i||d?"var rv = ":"")+`invoker(${T});
|
|
6
6
|
`,u)D+=`runDestructors(destructors);
|
|
7
|
-
`;else for(var
|
|
7
|
+
`;else for(var v=2;v<e.length;++v){var Y=v===1?"thisWired":"arg"+(v-2)+"Wired";e[v].destructorFunction!==null&&(D+=`${Y}_dtor(${Y});
|
|
8
8
|
`,G.push(`${Y}_dtor`))}return i&&(D+=`var ret = fromRetWire(rv);
|
|
9
9
|
return ret;
|
|
10
10
|
`),D+=`}
|
|
11
|
-
`,new Function(G,D)}function jr(e,a,i,
|
|
12
|
-
${
|
|
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,`
|
|
11
|
+
`,new Function(G,D)}function jr(e,a,i,d,u,E){var A=a.length;A<2&&$("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var T=a[1]!==null&&i!==null,v=$n(a),D=!a[0].isVoid,L=a[0],G=a[1],b=[e,$,d,u,An,L.fromWireType.bind(L),G==null?void 0:G.toWireType.bind(G)],Y=2;Y<A;++Y){var F=a[Y];b.push(F.toWireType.bind(F))}if(!v)for(var Y=2;Y<a.length;++Y)a[Y].destructorFunction!==null&&b.push(a[Y].destructorFunction);var rt=Qr(a,T,D,E)(...b);return qe(e,rt)}var ta=(e,a)=>{for(var i=[],d=0;d<e;d++)i.push(B[a+d*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,d,u,E,A,T){e>>>=0,i>>>=0,d>>>=0,u>>>=0,E>>>=0;var v=ta(a,i);e=st(e),e=ea(e),u=fe(d,u,A),Be(e,function(){rn(`Cannot call ${e} due to unbound types`,v)},a-1),an([],v,D=>{var L=[D[0],null].concat(D.slice(1));return bn(e,jr(e,L,null,u,E,A),a-1),[]})}var ra=function(e,a,i,d,u){e>>>=0,a>>>=0,i>>>=0,a=st(a);const E=d===0;let A=v=>v;if(E){var T=32-8*i;A=v=>v<<T>>>T,u=A(u)}ot(e,{name:a,fromWireType:A,toWireType:(v,D)=>D,readValueFromPointer:Rt(a,i,d!==0),destructorFunction:null})};function aa(e,a,i){e>>>=0,i>>>=0;var d=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],u=d[a];function E(A){var T=B[A>>>2>>>0],v=B[A+4>>>2>>>0];return new u(z.buffer,v,T)}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 d=B[i>>>2>>>0],u=i+4,E;return E=te(u,d,!0),ie(i),E},toWireType(i,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var u,E=typeof d=="string";E||ArrayBuffer.isView(d)&&d.BYTES_PER_ELEMENT==1||$("Cannot pass non-string to std::string"),E?u=Nt(d):u=d.length;var A=sn(4+u+1),T=A+4;return B[A>>>2>>>0]=u,E?oe(d,T,u+1):lt.set(d,T>>>0),i!==null&&i.push(ie,A),A},readValueFromPointer:je,destructorFunction(i){ie(i)}})}var Vn=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,ia=(e,a,i)=>{var d=e>>>1,u=pe(yt,d,a/2,i);if(u-d>16&&Vn)return Vn.decode(yt.subarray(d>>>0,u>>>0));for(var E="",A=d;A<u;++A){var T=yt[A>>>0];E+=String.fromCharCode(T)}return E},sa=(e,a,i)=>{if(i??(i=2147483647),i<2)return 0;i-=2;for(var d=a,u=i<e.length*2?i/2:e.length,E=0;E<u;++E){var A=e.charCodeAt(E);dt[a>>>1>>>0]=A,a+=2}return dt[a>>>1>>>0]=0,a-d},_a=e=>e.length*2,da=(e,a,i)=>{for(var d="",u=e>>>2,E=0;!(E>=a/4);E++){var A=B[u+E>>>0];if(!A&&!i)break;d+=String.fromCodePoint(A)}return d},la=(e,a,i)=>{if(a>>>=0,i??(i=2147483647),i<4)return 0;for(var d=a,u=d+i-4,E=0;E<e.length;++E){var A=e.codePointAt(E);if(A>65535&&E++,k[a>>>2>>>0]=A,a+=4,a+4>u)break}return k[a>>>2>>>0]=0,a-d},ca=e=>{for(var a=0,i=0;i<e.length;++i){var d=e.codePointAt(i);d>65535&&i++,a+=4}return a};function ua(e,a,i){e>>>=0,a>>>=0,i>>>=0,i=st(i);var d,u,E;a===2?(d=ia,u=sa,E=_a):(d=da,u=la,E=ca),ot(e,{name:i,fromWireType:A=>{var T=B[A>>>2>>>0],v=d(A+4,T*a,!0);return ie(A),v},toWireType:(A,T)=>{typeof T!="string"&&$(`Cannot pass non-string to C++ string type ${i}`);var v=E(T),D=sn(4+v+a);return B[D>>>2>>>0]=v/a,u(T,D+4,v+a),A!==null&&A.push(ie,D),D},readValueFromPointer:je,destructorFunction(A){ie(A)}})}var Ea=function(e,a){e>>>=0,a>>>=0,a=st(a),ot(e,{isVoid:!0,name:a,fromWireType:()=>{},toWireType:(i,d)=>{}})},Pn=[],fa=e=>{var a=Pn.length;return Pn.push(e),a},ha=(e,a)=>{for(var i=new Array(e),d=0;d<e;++d)i[d]=Un(B[a+d*4>>>2>>>0],`parameter ${d}`);return i},ga=(e,a,i)=>{var d=[],u=e(d,i);return d.length&&(B[a>>>2>>>0]=pt.toHandle(d)),u},Aa={},Hn=e=>{var a=Aa[e];return a===void 0?st(e):a},ya=function(e,a,i){a>>>=0;var d=8,[u,...E]=ha(e,a),A=u.toWireType.bind(u),T=E.map(Y=>Y.readValueFromPointer.bind(Y));e--;var v={toValue:pt.toValue},D=T.map((Y,F)=>{var H=`argFromPtr${F}`;return v[H]=Y,`${H}(args${F?"+"+F*d:""})`}),L;switch(i){case 0:L="toValue(handle)";break;case 2:L="new (toValue(handle))";break;case 3:L="";break;case 1:v.getStringOrSymbol=Hn,L="toValue(handle)[getStringOrSymbol(methodName)]";break}L+=`(${D})`,u.isVoid||(v.toReturnWire=A,v.emval_returnValue=ga,L=`return emval_returnValue(toReturnWire, destructorsRef, ${L})`),L=`return function (handle, methodName, destructorsRef, args) {
|
|
12
|
+
${L}
|
|
13
|
+
}`;var G=new Function(Object.keys(v),L)(...Object.values(v)),b=`methodCaller<(${E.map(Y=>Y.name)}) => ${u.name}>`;return fa(qe(b,G))};function Ta(e){e>>>=0,e>9&&(ae[e+1]+=1)}function Pa(e,a,i,d,u){return e>>>=0,a>>>=0,i>>>=0,d>>>=0,u>>>=0,Pn[e](a,i,d,u)}function pa(){return pt.toHandle([])}function va(e){return e>>>=0,pt.toHandle(Hn(e))}function Ia(){return pt.toHandle({})}function ma(e){e>>>=0;var a=pt.toValue(e);An(a),yn(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=Te(e),a>>>=0;var i=new Date(e*1e3);k[a>>>2>>>0]=i.getUTCSeconds(),k[a+4>>>2>>>0]=i.getUTCMinutes(),k[a+8>>>2>>>0]=i.getUTCHours(),k[a+12>>>2>>>0]=i.getUTCDate(),k[a+16>>>2>>>0]=i.getUTCMonth(),k[a+20>>>2>>>0]=i.getUTCFullYear()-1900,k[a+24>>>2>>>0]=i.getUTCDay();var d=Date.UTC(i.getUTCFullYear(),0,1,0,0,0,0),u=(i.getTime()-d)/(1e3*60*60*24)|0;k[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,d=i[e.getMonth()]+e.getDate()-1;return d},Ya=function(e){e>>>=0;var a=(()=>{var i=new Date(k[e+20>>>2>>>0]+1900,k[e+16>>>2>>>0],k[e+12>>>2>>>0],k[e+8>>>2>>>0],k[e+4>>>2>>>0],k[e>>>2>>>0],0);if(isNaN(i.getTime()))return-1;var d=k[e+32>>>2>>>0],u=i.getTimezoneOffset(),E=new Date(i.getFullYear(),0,1),A=new Date(i.getFullYear(),6,1).getTimezoneOffset(),T=E.getTimezoneOffset(),v=Math.min(T,A);if(d<0)k[e+32>>>2>>>0]=+(A!=T&&v==u);else if(d>0!=(v==u)){var D=Math.max(T,A),L=d>0?v:D;i.setTime(i.getTime()+(L-u)*6e4)}k[e+24>>>2>>>0]=i.getDay();var G=La(i)|0;return k[e+28>>>2>>>0]=G,k[e>>>2>>>0]=i.getSeconds(),k[e+4>>>2>>>0]=i.getMinutes(),k[e+8>>>2>>>0]=i.getHours(),k[e+12>>>2>>>0]=i.getDate(),k[e+16>>>2>>>0]=i.getMonth(),k[e+20>>>2>>>0]=i.getYear(),i.getTime()/1e3})();return BigInt(a)},Na=function(e,a,i,d){e>>>=0,a>>>=0,i>>>=0,d>>>=0;var u=new Date().getFullYear(),E=new Date(u,0,1),A=new Date(u,6,1),T=E.getTimezoneOffset(),v=A.getTimezoneOffset(),D=Math.max(T,v);B[e>>>2>>>0]=D*60,k[a>>>2>>>0]=+(T!=v);var L=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=L(T),b=L(v);v<T?(oe(G,i,17),oe(b,d,17)):(oe(G,d,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,Oa=e=>{var a=_n.buffer.byteLength,i=(e-a+65535)/65536|0;try{return _n.grow(i),U(),1}catch{}};function ka(e){e>>>=0;var a=lt.length,i=ba();if(e>i)return!1;for(var d=1;d<=4;d*=2){var u=a*(1+.2/d);u=Math.min(u,e+100663296);var E=Math.min(i,xa(Math.max(e,u),65536)),A=Oa(E);if(A)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 d=[];for(var i in a)d.push(`${i}=${a[i]}`);Fe.strings=d}return Fe.strings};function Fa(e,a){e>>>=0,a>>>=0;var i=0,d=0;for(var u of Fe()){var E=a+i;B[e+d>>>2>>>0]=E,i+=oe(u,E,1/0)+1,d+=4}return 0}function Ua(e,a){e>>>=0,a>>>=0;var i=Fe();B[e>>>2>>>0]=i.length;var d=0;for(var u of i)d+=Nt(u)+1;return B[a>>>2>>>0]=d,0}function $a(e){try{var a=Q.getStreamFromFD(e);return c.close(a),0}catch(i){if(typeof c>"u"||i.name!=="ErrnoError")throw i;return i.errno}}var Va=(e,a,i,d)=>{for(var u=0,E=0;E<i;E++){var A=B[a>>>2>>>0],T=B[a+4>>>2>>>0];a+=8;var v=c.read(e,z,A,T,d);if(v<0)return-1;if(u+=v,v<T)break}return u};function Ha(e,a,i,d){a>>>=0,i>>>=0,d>>>=0;try{var u=Q.getStreamFromFD(e),E=Va(u,a,i);return B[d>>>2>>>0]=E,0}catch(A){if(typeof c>"u"||A.name!=="ErrnoError")throw A;return A.errno}}function Xa(e,a,i,d){a=Te(a),d>>>=0;try{if(isNaN(a))return 22;var u=Q.getStreamFromFD(e);return c.llseek(u,a,i),tt[d>>>3>>>0]=BigInt(u.position),u.getdents&&a===0&&i===0&&(u.getdents=null),0}catch(E){if(typeof c>"u"||E.name!=="ErrnoError")throw E;return E.errno}}var Ka=(e,a,i,d)=>{for(var u=0,E=0;E<i;E++){var A=B[a>>>2>>>0],T=B[a+4>>>2>>>0];a+=8;var v=c.write(e,z,A,T,d);if(v<0)return-1;if(u+=v,v<T)break}return u};function za(e,a,i,d){a>>>=0,i>>>=0,d>>>=0;try{var u=Q.getStreamFromFD(e),E=Ka(u,a,i);return B[d>>>2>>>0]=E,0}catch(A){if(typeof c>"u"||A.name!=="ErrnoError")throw A;return A.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,d,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 A(F){return a==="string"?te(F):a==="pointer"?F>>>0:a==="boolean"?!!F:F}var T=Xn(e),v=[],D=0;if(d)for(var L=0;L<d.length;L++){var G=E[i[L]];G?(D===0&&(D=Jt()),v[L]=G(d[L])):v[L]=d[L]}var b=T(...v);function Y(F){return D!==0&&V(D),A(F)}return b=Y(b),b},Qa=(e,a,i,d)=>{var u=!i||i.every(A=>A==="number"||A==="boolean"),E=a!=="string";return E&&u&&!d?Xn(e):(...A)=>zn(e,a,i,A)},ja=e=>{var a=Nt(e)+1,i=sn(a);return i&&oe(e,i,a),i};if(c.createPreloadedFile=Xe,c.preloadFile=Ee,c.staticInit(),wr(),kr(),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=c;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:ya,_emval_decref:yn,_emval_incref:Ta,_emval_invoke:Pa,_emval_new_array:pa,_emval_new_cstring:va,_emval_new_object:Ia,_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:ka,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,A)=>u(E,A)>>>0,d=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=d(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),ht())}o.setStatus?(o.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>o.setStatus(""),1),e()},1)):e()}var he;return he=await Ot(),pn(),O?t=o:t=new Promise((e,a)=>{W=e,M=a}),t}var yo=Object.defineProperty,To=(r,t,o)=>t in r?yo(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,et=(r,t,o)=>To(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||{}),yr=(r=>(r[r.Solid=0]="Solid",r[r.Gradient=1]="Gradient",r))(yr||{}),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"]),vo=/\\U\+([0-9A-Fa-f]{4})/g;function dr(r){return!r||!r.includes("\\U+")?r:r.replace(vo,(t,o)=>String.fromCharCode(parseInt(o,16)))}const Io=[{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||{}),R=(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))(R||{});Object.fromEntries(Object.entries(R).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 Tr(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 s=r.rgb!=null?r.rgb&16777215:void 0;if(s!=null)return(mo<<24|s)>>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 s=r.rgb&16777215;if(s!==0)return s}}}const Co="*MODEL_SPACE",Do="*PAPER_SPACE",Nn=r=>r&&r.toUpperCase()==Co,Ro=r=>r&&r.toUpperCase().startsWith(Do),ft=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),s=o(50);return[n.x,n.y,n.z,s.x,s.y,s.z].every(Number.isFinite)?{upperLeft:n,lowerRight:s}: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),s=o.dwg_object_to_entity_tio(t);if(n&&s){const _=this.getCommonAttrs(n),l=o.dwg_object_get_fixedtype(t);if(l==R.DWG_TYPE_3DFACE)return this.convert3dFace(s,_);if(l==R.DWG_TYPE_3DSOLID)return this.convert3dSolid(s,_);if(l==R.DWG_TYPE_ARC)return this.convertArc(s,_);if(l==R.DWG_TYPE_ARCALIGNEDTEXT)return this.convertArcAlignedText(s,_);if(l==R.DWG_TYPE_ATTDEF)return this.convertAttdef(s,_);if(l==R.DWG_TYPE_CIRCLE)return this.convertCircle(s,_);if(l==R.DWG_TYPE_DIMENSION_ALIGNED)return this.convertAlignedDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_LINEAR)return this.convertRotatedDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_ANG2LN)return this.convert2LineAngularDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(s,_);if(l==R.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(s,_);if(l==R.DWG_TYPE_ELLIPSE)return this.convertEllise(s,_);if(l==R.DWG_TYPE_HATCH)return this.convertHatch(s,_);if(l==R.DWG_TYPE_IMAGE)return this.convertImage(s,_);if(l==R.DWG_TYPE_INSERT||l==R.DWG_TYPE_MINSERT)return this.convertInsert(s,_);if(l==R.DWG_TYPE_LEADER)return this.convertLeader(s,_);if(l==R.DWG_TYPE_LINE)return this.convertLine(s,_);if(l==R.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(s,_);if(l==R.DWG_TYPE_MLINE)return this.convertMLine(s,_);if(l==R.DWG_TYPE_MULTILEADER)return this.convertMultiLeader(s,_);if(l==R.DWG_TYPE_MTEXT)return this.convertMText(s,_);if(l==R.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(s,_);if(l==R.DWG_TYPE_OLEFRAME)return this.convertOleFrame(s,_);if(l==R.DWG_TYPE_POINT)return this.convertPoint(s,_);if(l==R.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(s,_,t);if(l==R.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(s,_,t);if(l==R.DWG_TYPE_PROXY_ENTITY)return this.convertProxyEntity(s,_,t);if(l==R.DWG_TYPE_RAY)return this.convertRay(s,_);if(l==R.DWG_TYPE_SECTIONOBJECT)return this.convertSection(s,_);if(l==R.DWG_TYPE_SHAPE)return this.convertShape(s,_);if(l==R.DWG_TYPE_SOLID)return this.convertSolid(s,_);if(l==R.DWG_TYPE_TRACE)return this.convertTrace(s,_);if(l==R.DWG_TYPE_SPLINE)return this.convertSpline(s,_);if(l==R.DWG_TYPE_TABLE)return this.convertTable(s,_);if(l==R.DWG_TYPE_TEXT)return this.convertText(s,_);if(l==R.DWG_TYPE_TOLERANCE)return this.convertTolerance(s,_);if(l==R.DWG_TYPE_VIEWPORT)return this.convertViewport(s,_);if(l==R.DWG_TYPE_WIPEOUT)return this.convertWipeout(s,_);if(l==R.DWG_TYPE_XLINE)return this.convertXline(s,_);l===R.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),l=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:s,corner2:_,corner3:l,corner4:f,flag:h}}convert3dSolid(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"version"),_=n.dwg_dynapi_entity_data(t,"acis_empty"),l=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"),g=n.dwg_ref_get_id(h),y={type:"3DSOLID",subclassMarker:"AcDb3dSolid",...o};if(s&&(y.version=s),y.satCache=_,l&&(y.data=l),f){const P=n.dwg_dynapi_entity_field_offset(t,"revision_guid");if(P>=0){const p=n.UTF8ToString(t+P,38);p&&(y.guid=p)}}return g&&(y.historyObjectSoftId=g),y}convertArc(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),l=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion"),h=n.dwg_dynapi_entity_data(t,"start_angle"),g=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ARC",...o,thickness:l,center:s,radius:_,startAngle:h,endAngle:g,extrusionDirection:f}}convertArcAlignedText(t,o){const n=this.libredwg,s=(g,y=0)=>{const P=n.dwg_dynapi_entity_data(t,g);if(typeof P=="number"&&Number.isFinite(P))return P;if(typeof P=="string"&&P.trim()!==""){const p=Number(P);if(Number.isFinite(p))return p}return y},_=n.dwg_dynapi_entity_data(t,"center"),l=n.dwg_dynapi_entity_data(t,"extrusion"),f=n.dwg_dynapi_entity_data(t,"arc_handle"),h=s("xscale",1);return{type:"ARCALIGNEDTEXT",...o,text:n.dwg_dynapi_entity_data(t,"text_value")??"",textSize:s("text_size"),xScale:h>0?h:1,characterSpacing:s("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:s("offset_from_arc"),rightOffset:s("right_offset"),leftOffset:s("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:l??{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,s=n.dwg_dynapi_subclass_data(t,o,"attachment"),_=n.dwg_dynapi_subclass_data(t,o,"ins_pt"),l=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"),g=n.dwg_dynapi_subclass_data(t,o,"extents_height"),y=n.dwg_dynapi_subclass_data(t,o,"extents_width");return{insertionPoint:_,rectHeight:f,rectWidth:h,extentsHeight:g,extentsWidth:y,attachmentPoint:s,direction:l}}convertAttdef(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"default_value"),_=this.convertTextBase(t);_.text=s;const l=n.dwg_dynapi_entity_data(t,"prompt"),f=n.dwg_dynapi_entity_data(t,"tag"),h=n.dwg_dynapi_entity_data(t,"flags"),g=n.dwg_dynapi_entity_data(t,"field_length"),y=n.dwg_dynapi_entity_data(t,"lock_position_flag"),P=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),p=n.dwg_dynapi_entity_data(t,"is_really_locked"),I=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:l,tag:f,flags:h,fieldLength:g,lockPositionFlag:y>0,duplicateRecordCloningFlag:P>0,mtextFlag:I,isReallyLocked:p>0,alignmentPoint:C,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertAttrib(t,o){const n=this.libredwg,s=this.convertTextBase(t),_=n.dwg_dynapi_entity_data(t,"tag"),l=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"),g=n.dwg_dynapi_entity_data(t,"keep_duplicate_records"),y=n.dwg_dynapi_entity_data(t,"mtext_type"),P=n.dwg_dynapi_entity_data(t,"is_really_locked"),p=n.dwg_dynapi_entity_data(t,"alignment_pt");return{type:"ATTRIB",...o,text:s,tag:_,flags:l,fieldLength:f,lockPositionFlag:!!h,duplicateRecordCloningFlag:!!g,mtextFlag:y,isReallyLocked:!!P,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...p,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(t,"ATTDEF_mtext")}}convertCircle(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"radius"),l=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"CIRCLE",...o,thickness:l,center:s,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 s=this.libredwg,_=this.getDimensionCommonAttrs(t),l=s.dwg_dynapi_entity_data(t,"clone_ins_pt"),f=s.dwg_dynapi_entity_data(t,"xline1_pt"),h=s.dwg_dynapi_entity_data(t,"xline2_pt"),g=n==="AcDbRotatedDimension"?s.dwg_dynapi_entity_data(t,"dim_rotation"):0,y=s.dwg_dynapi_entity_data(t,"oblique_angle");return{subclassMarker:n,...o,..._,insertionPoint:l,subDefinitionPoint1:f,subDefinitionPoint2:h,rotationAngle:g??0,obliqueAngle:y}}convert3PointAngularDimension(t,o){const n=this.libredwg,s=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1_pt"),l=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,...s,subDefinitionPoint1:_,subDefinitionPoint2:l,centerPoint:f,arcPoint:h}}convert2LineAngularDimension(t,o){const n=this.libredwg,s=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"xline1start_pt"),l=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"),g=n.dwg_dynapi_entity_data(t,"def_pt");return h&&(s.definitionPoint=h),{subclassMarker:"AcDb2LineAngularDimension",...o,...s,subDefinitionPoint1:_??l??g??h,subDefinitionPoint2:f??h??g??l,centerPoint:g??f??l??h,arcPoint:h??s.definitionPoint}}convertDiameterDimension(t,o){const n=this.libredwg,s=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),l=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbDiametricDimension",...o,...s,centerPoint:_,leaderLength:l}}convertOrdinateDimension(t,o){const n=this.libredwg,s=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"feature_location_pt"),l=n.dwg_dynapi_entity_data(t,"leader_endpt");return{subclassMarker:"AcDbOrdinateDimension",...o,...s,subDefinitionPoint1:_,subDefinitionPoint2:l}}convertRadiusDimension(t,o){const n=this.libredwg,s=this.getDimensionCommonAttrs(t),_=n.dwg_dynapi_entity_data(t,"first_arc_pt"),l=n.dwg_dynapi_entity_data(t,"leader_len");return{subclassMarker:"AcDbRadialDimension",...o,...s,centerPoint:_,leaderLength:l}}convertEllise(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"sm_axis"),l=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"),g=n.dwg_dynapi_entity_data(t,"end_angle");return{type:"ELLIPSE",...o,center:s,majorAxisEndPoint:_,extrusionDirection:l,axisRatio:f,startAngle:h,endAngle:g}}convertHatch(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"extrusion"),_=n.dwg_dynapi_entity_data(t,"name"),l=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"),g=n.dwg_dynapi_entity_data(t,"paths"),y=n.dwg_ptr_to_hatch_path_array(g,h),P=n.dwg_dynapi_entity_data(t,"style"),p=n.dwg_dynapi_entity_data(t,"pattern_type"),I=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"),O=n.dwg_ptr_to_point2d_array(M,W),U={...o,extrusionDirection:s,patternName:_,solidFill:l?Cn.SolidFill:Cn.PatternFill,associativity:f?Dn.Associative:Dn.NonAssociative,numberOfBoundaryPaths:h,boundaryPaths:this.convertHatchBoundaryPaths(y),hatchStyle:P,patternType:p,patternAngle:I,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:O};if(n.dwg_dynapi_entity_data(t,"is_gradient_fill")>0){const nt=n.dwg_dynapi_entity_data(t,"gradient_name"),ht=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"),gt=n.dwg_dynapi_entity_data(t,"colors"),At=n.dwg_ptr_to_hatch_gradient_color_array(gt,Et==1?1:2);return{type:"HATCH",...U,gradientFlag:yr.Gradient,gradientColorFlag:Et==1?Rn.OneColor:Rn.TwoColor,gradientName:nt,gradientRotation:ht,gradientDefinition:Z,colorTint:ut,gradientColors:At}}else return{type:"HATCH",...U}}convertHatchBoundaryPaths(t){return t.filter(n=>n.num_segs_or_paths>0).map(n=>{const s={boundaryPathTypeFlag:n.flag};if(n.flag&2)return{...s,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(l=>{if(l.curve_type==Ve.Line)return{type:$e.Line,start:l.first_endpoint,end:l.second_endpoint};if(l.curve_type==Ve.CircularArc)return{type:$e.Circular,center:l.center,radius:l.radius,startAngle:l.start_angle,endAngle:l.end_angle,isCCW:l.is_ccw};if(l.curve_type==Ve.EllipticArc)return{type:$e.Elliptic,center:l.center,end:l.endpoint,lengthOfMinorAxis:l.minor_major_ratio,startAngle:l.start_angle,endAngle:l.end_angle,isCCW:l.is_ccw};if(l.curve_type==Ve.Spline)return{type:$e.Spline,degree:l.degree,isRational:l.is_rational,isPeriodic:l.is_periodic,numberOfKnots:l.num_knots,numberOfControlPoints:l.num_control_points,knots:l.knots,controlPoints:l.control_points,numberOfFitData:l.num_fitpts,fitDatum:l.fitpts,startTangent:l.start_tangent,endTangent:l.end_tangent}}).filter(l=>l!=null);return{...s,numberOfEdges:_.length,edges:_}}})}convertImage(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),l=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),g=n.dwg_dynapi_entity_data(t,"display_props"),y=n.dwg_dynapi_entity_data(t,"clipping"),P=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=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)??"",O=n.dwg_dynapi_entity_data(t,"imagedefreactor"),U=n.dwg_ref_get_id(O)??"";return{type:"IMAGE",...o,version:s,position:_,uPixel:l,vPixel:f,imageSize:h,imageDefHandle:M,flags:g,clipping:y,brightness:P,contrast:p,fade:I,imageDefReactorHandle:U,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:N,clipMode:C}}convertInsert(t,o){const n=this.libredwg;let s="";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&&(s=n.dwg_entity_block_header_get_block(S).name)}}s||(s=n.dwg_dynapi_entity_data(t,"block_name"));const l=n.dwg_dynapi_entity_data(t,"ins_pt"),f=n.dwg_dynapi_entity_data(t,"scale"),h=n.dwg_dynapi_entity_data(t,"rotation"),g=n.dwg_dynapi_entity_data(t,"num_cols"),y=n.dwg_dynapi_entity_data(t,"num_rows"),P=n.dwg_dynapi_entity_data(t,"col_spacing"),p=n.dwg_dynapi_entity_data(t,"row_spacing"),I=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)==R.DWG_TYPE_ATTRIB&&w.push(this.convertAttrib(N,W))}}),{type:"INSERT",...o,name:s,insertionPoint:l,xScale:f?f.x:1,yScale:f?f.y:1,zScale:f?f.z:1,rotation:h,columnCount:g||1,rowCount:y||1,columnSpacing:P||0,rowSpacing:p||0,extrusionDirection:I,attribs:w}}convertLeader(t,o){const n=this.libredwg;let s="";try{s=n.dwg_entity_get_dimstyle_name(t)||""}catch{s=""}const l=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"),g=n.dwg_dynapi_entity_data(t,"hookline_dir"),y=n.dwg_dynapi_entity_data(t,"hookline_on"),P=n.dwg_dynapi_entity_data(t,"box_height"),p=n.dwg_dynapi_entity_data(t,"box_width"),I=n.dwg_dynapi_entity_data(t,"num_points"),C=n.dwg_dynapi_entity_data(t,"points"),w=I>0?n.dwg_ptr_to_point3d_array(C,I):[],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:s,isArrowheadEnabled:l,isSpline:f>0,leaderCreationFlag:h,isHooklineSameDirection:g>0,isHooklineExists:y>0,textHeight:P,textWidth:p,numberOfVertices:I,vertices:w,byBlockColor:m,normal:S,horizontalDirection:N,offsetFromBlock:W,offsetFromAnnotation:M}}convertLine(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"start"),_=n.dwg_dynapi_entity_data(t,"end"),l=n.dwg_dynapi_entity_data(t,"thickness"),f=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"LINE",...o,thickness:l,startPoint:s,endPoint:_,extrusionDirection:f}}convertLWPolyline(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"num_points"),_=n.dwg_dynapi_entity_data(t,"flag"),l=n.dwg_dynapi_entity_data(t,"const_width"),f=n.dwg_dynapi_entity_data(t,"elevation"),h=n.dwg_dynapi_entity_data(t,"thickness"),g=n.dwg_dynapi_entity_data(t,"extrusion"),y=[],P=n.dwg_dynapi_entity_data(t,"num_points"),p=n.dwg_dynapi_entity_data(t,"points"),I=n.dwg_ptr_to_point2d_array(p,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 I.forEach((M,O)=>{const U={id:O,x:M.x,y:M.y,bulge:m.length>O?m[O]:0};O<S&&W.length>=(O+1)*2&&(U.startWidth=W[O*2],U.endWidth=W[O*2+1]),y.push(U)}),{type:"LWPOLYLINE",...o,numberOfVertices:s,flag:_,constantWidth:l,elevation:f,thickness:h,extrusionDirection:g,vertices:y}}convertMLine(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"scale"),_=n.dwg_dynapi_entity_data(t,"flags"),l=n.dwg_dynapi_entity_data(t,"justification"),f=n.dwg_dynapi_entity_data(t,"base_point"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_dynapi_entity_data(t,"num_lines"),y=n.dwg_dynapi_entity_data(t,"num_verts"),P=n.dwg_dynapi_entity_data(t,"verts"),p=n.dwg_ptr_to_mline_vertex_array(P,y),I=[];return p.forEach(C=>{I.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:s,flags:_,justification:l,startPoint:f,extrusionDirection:h,numberOfLines:g,numberOfVertices:y,vertices:I,mlineStyle:""}}convertMultiLeader(t,o){const n=this.libredwg,s=K=>n.dwg_dynapi_entity_data(t,K),_=(K,j,ee)=>n.dwg_dynapi_subclass_data(K,j,ee),l=K=>n.dwg_ref_get_id(K),f=K=>K>0,h=K=>K!=null?Tr(K):void 0,g=s("class_version"),y=l(s("mleaderstyle")),P=s("flags"),p=s("type"),I=h(s("line_color")),C=l(s("line_ltype")),w=s("line_linewt"),m=f(s("has_landing")),S=f(s("has_dogleg")),N=s("landing_dist"),W=l(s("arrow_handle")),M=s("arrow_size"),O=s("style_content"),U=l(s("text_style")),J=s("text_left"),nt=s("text_right"),ht=s("text_angletype"),Z=s("text_alignment"),ut=h(s("text_color")),Et=f(s("has_text_frame")),gt=l(s("block_style")),At=h(s("block_color")),Mt=s("block_scale"),bt=s("block_rotation"),xt=s("style_attachment"),Ot=f(s("is_annotative")),dt=f(s("is_neg_textdir")),k=s("ipe_alignment");let tt=s("justification");const z=s("attach_dir"),kt=s("attach_bottom"),Bt=s("attach_top"),yt=s("scale_factor"),B=s("num_arrowheads"),Xt=s("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:l(_(j,"LEADER_ArrowHead","arrowhead"))??""})}const Kt=s("num_blocklabels"),se=s("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:l(_(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"),ye=_(q,"MLEADER_AnnotContext","content_base"),Ut=_(q,"MLEADER_AnnotContext","landing_gap"),Ye=_(q,"MLEADER_AnnotContext","attach_dir"),Te=_(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,ve,Tt,le,x,Ie,ce,jt,me,we,Pt,Wt,Ce,De,ue,Re,Ee,Xe,c;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"),Ie=_(V,"MLEADER_Content_MText","direction"),ve=_(V,"MLEADER_Content_MText","width"),Tt=_(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")),c=_(V,"MLEADER_Content_MText","default_text")}let te;if(Dt){const K=_(V,"MLEADER_Content_Block","transform");te={blockContentId:l(_(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 Oe=be+xe*Ke;Le.push({start:_(Oe,"LEADER_Break","start"),end:_(Oe,"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:g,leaderStyleId:y,propertyOverrideFlag:P,leaderLineType:p,leaderLineColor:I,leaderLineTypeId:C,leaderLineWeight:w,landingEnabled:m,doglegEnabled:S,doglegLength:N,arrowheadId:W,arrowheadSize:M||Ne,contentType:O,textStyleId:U,textLeftAttachmentType:J||Zt,textRightAttachmentType:nt||Lt,textAngleType:ht||X,textAlignmentType:Z||We,textColor:ut,textFrameEnabled:Et,landingGap:Ut,textAttachment:Ye,textFlowDirection:Nt,blockContentId:gt,blockContentColor:At,blockContentScale:Mt,blockContentRotation:bt,blockContentConnectionType:xt,annotativeScaleEnabled:Ot,arrowheadOverrides:St.length>0?St:void 0,blockAttributes:Ft.length>0?Ft:void 0,textDirectionNegative:dt,textAlignInIPE:k,textAttachmentPoint:tt,textAttachmentDirection:z,bottomTextAttachmentDirection:kt,topTextAttachmentDirection:Bt,contentScale:yt||Jt,contentBasePosition:ye,normal:de,textHeight:Te,textRotation:Qt,textWidth:ve,textLineSpacingFactor:Tt,textLineSpacingStyle:le,textAnchor:x,textDirection:Ie,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:c,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,s=n.dwg_dynapi_entity_data(t,"oleversion"),_=n.dwg_dynapi_entity_data(t,"oleclient"),l=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 g=n.dwg_dynapi_entity_data(t,"lock_aspect"),y=n.dwg_dynapi_entity_data(t,"type"),P=n.dwg_dynapi_entity_data(t,"mode"),p=n.dwg_entity_ole2frame_get_data(t),I=p?He(p):"";if(p){const C=So(p);C&&(f=C.upperLeft,h=C.lowerRight)}return{type:"OLE2FRAME",...o,oleVersion:s,oleClient:_,dataSize:l,leftUpPoint:f,rightDownPoint:h,lockAspect:g,oleObjectType:y,tileModeDescriptor:P,binaryData:I}}convertOleFrame(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"flag"),_=n.dwg_dynapi_entity_data(t,"mode"),l=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:s,mode:_,dataSize:l,binaryData:h}}convertMText(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_height"),l=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"),g=n.dwg_dynapi_entity_data(t,"extents_height"),y=n.dwg_dynapi_entity_data(t,"attachment"),P=n.dwg_dynapi_entity_data(t,"flow_dir"),p=n.dwg_dynapi_entity_data(t,"text"),I=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"),O=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"),ht=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"),gt=n.dwg_dynapi_entity_data(t,"column_heights"),At=n.dwg_ptr_to_double_array(gt,Et);return{type:"MTEXT",...o,insertionPoint:s,textHeight:_,rectHeight:l,rectWidth:f,extentsHeight:g,extentsWidth:h,attachmentPoint:y,drawingDirection:P,text:p,styleName:I,extrusionDirection:C,direction:w,rotation:0,lineSpacingStyle:m,lineSpacing:S,backgroundFill:N,fillBoxScale:W,...U!==void 0?{backgroundFillColor:U}:{},backgroundFillTransparency:O,columnType:J,columnFlowReversed:nt,columnAutoHeight:ht,columnWidth:Z,columnGutter:ut,columnHeightCount:Et,columnHeights:At}}convertPoint(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"x"),_=n.dwg_dynapi_entity_data(t,"y"),l=n.dwg_dynapi_entity_data(t,"z"),f=n.dwg_dynapi_entity_data(t,"thickness"),h=n.dwg_dynapi_entity_data(t,"extrusion"),g=n.dwg_dynapi_entity_data(t,"x_ang");return{type:"POINT",...o,position:{x:s,y:_,z:l},thickness:f,extrusionDirection:h,angle:g}}convertPolyline2d(t,o,n){const s=this.libredwg,_=s.dwg_dynapi_entity_data(t,"flag"),l=s.dwg_dynapi_entity_data(t,"curve_type"),f=s.dwg_dynapi_entity_data(t,"start_width"),h=s.dwg_dynapi_entity_data(t,"end_width"),g=s.dwg_dynapi_entity_data(t,"elevation"),y=s.dwg_dynapi_entity_data(t,"thickness"),P=s.dwg_dynapi_entity_data(t,"extrusion"),p=s.dwg_entity_polyline_2d_get_vertices(n)??[];return{type:"POLYLINE2D",...o,flag:_,smoothType:l,startWidth:f,endWidth:h,elevation:g,thickness:y,extrusionDirection:P,vertices:p.map(I=>({x:I.point.x,y:I.point.y,z:I.point.z,startWidth:I.start_width,endWidth:I.end_width,bulge:I.bulge,flag:I.flag,tangentDirection:I.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(t,o,n){const s=this.libredwg,_=s.dwg_dynapi_entity_data(t,"flag"),l=s.dwg_dynapi_entity_data(t,"curve_type"),f=s.dwg_dynapi_entity_data(t,"start_width"),h=s.dwg_dynapi_entity_data(t,"end_width"),g=s.dwg_dynapi_entity_data(t,"extrusion"),y=s.dwg_entity_polyline_3d_get_vertices(n)??[];return{type:"POLYLINE3D",...o,flag:_,smoothType:l,startWidth:f,endWidth:h,extrusionDirection:g,vertices:y.map(P=>({x:P.point.x,y:P.point.y,z:P.point.z,flag:P.flag}))}}convertProxyEntity(t,o,n){const s=this.libredwg,_=s.dwg_dynapi_entity_data(t,"proxy_id"),l=s.dwg_dynapi_entity_data(t,"class_id"),f=s.dwg_dynapi_entity_data(t,"data_numbits"),h=s.dwg_dynapi_entity_data(t,"version"),g=s.dwg_dynapi_entity_data(t,"from_dxf"),y=s.dwg_dynapi_entity_data(t,"num_objids"),P=s.dwg_entity_get_preview(n),p=(P==null?void 0:P.length)??0,I=s.dwg_entity_proxy_entity_get_entity_data(t),C=P?He(P):void 0,w=I?He(I):void 0;let m;if(y>0){const W=s.dwg_dynapi_entity_data(t,"objids");W&&(m=s.dwg_ptr_to_object_ref_array(W,y).map(O=>ft(O.absolute_ref)))}const S=this.getOriginalDxfName(l),N={type:"ACAD_PROXY_ENTITY",subclassMarker:"AcDbProxyEntity",...o,proxyEntityClassId:_||498,applicationEntityClassId:l};return S&&(N.originalDxfName=S),p>0&&(N.graphicsDataSize=p),C&&(N.graphicsData=C),f>0&&(N.entityDataSize=f),w&&(N.entityData=w),m&&m.length>0&&(N.linkedObjectIds=m),h&&(N.objectDrawingFormat=h),(g===0||g===1)&&(N.originalDataFormat=g),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,s=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"RAY",...o,firstPoint:s,unitDirection:_}}convertSection(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"state"),_=n.dwg_dynapi_entity_data(t,"flag"),l=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"),g=n.dwg_dynapi_entity_data(t,"bottom_height"),y=n.dwg_dynapi_entity_data(t,"indicator_alpha"),P=n.dwg_dynapi_entity_data(t,"indicator_color"),p=n.dwg_dynapi_entity_data(t,"num_verts"),I=n.dwg_dynapi_entity_data(t,"verts"),C=p>0?n.dwg_ptr_to_point3d_array(I,p):[],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:s,flags:_,name:l,verticalDirection:f,topHeight:h,bottomHeight:g,indicatorTransparency:y,indicatorColor:P.rgb,numberOfVertices:p,vertices:C,numberOfBackLineVertices:w,backLineVertices:S,geometrySettingHardId:W}}convertShape(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"scale"),l=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"),g=n.dwg_dynapi_entity_data(t,"thickness"),y=n.dwg_dynapi_entity_data(t,"extrusion"),P=n.dwg_dynapi_entity_data(t,"style_id"),p=n.dwg_entity_text_get_style_name(t);return{type:"SHAPE",subclassMarker:"AcDbShape",...o,thickness:g,insertionPoint:s,size:_,shapeNumber:P,styleName:p,rotation:l,xScale:f,obliqueAngle:h,extrusionDirection:y}}convertSolid(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"corner1"),_=n.dwg_dynapi_entity_data(t,"corner2"),l=n.dwg_dynapi_entity_data(t,"corner3"),f=n.dwg_dynapi_entity_data(t,"corner4"),h=n.dwg_dynapi_entity_data(t,"thickness"),g=n.dwg_dynapi_entity_data(t,"extrusion");return{type:"SOLID",...o,corner1:s,corner2:_,corner3:l,corner4:f,thickness:h,extrusionDirection:g}}convertTrace(t,o){return{...this.convertSolid(t,o),type:"TRACE"}}convertSpline(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"splineflags"),_=n.dwg_dynapi_entity_data(t,"degree"),l=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"),g=n.dwg_ptr_to_double_array(h,f),y=n.dwg_dynapi_entity_data(t,"fit_tol"),P=n.dwg_dynapi_entity_data(t,"num_fit_pts"),p=n.dwg_dynapi_entity_data(t,"fit_pts"),I=n.dwg_ptr_to_point3d_array(p,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:s,degree:_,numberOfKnots:f,numberOfControlPoints:m,numberOfFitPoints:P,knotTolerance:l,controlTolerance:w,fitTolerance:y,startTangent:W,endTangent:M,knots:g,weights:C?N.map(O=>O.w):void 0,controlPoints:N.map(O=>({x:O.x,y:O.y,z:O.z})),fitPoints:I}}convertTable(t,o){const n=this.libredwg,s=n.dwg_dynapi_subclass_data(t,"ldata","name"),_=n.dwg_dynapi_entity_data(t,"ins_pt"),l=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"),g=n.dwg_dynapi_entity_data(t,"num_cols"),y=n.dwg_dynapi_entity_data(t,"row_heights"),P=n.dwg_ptr_to_double_array(y,h),p=n.dwg_dynapi_entity_data(t,"col_widths"),I=n.dwg_ptr_to_double_array(p,g),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"),O=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:s,startPoint:_,directionVector:l,tableValue:f,rowCount:h,columnCount:g,overrideFlag:N,borderColorOverrideFlag:W,borderLineWeightOverrideFlag:M,borderVisibilityOverrideFlag:O,rowHeightArr:P,columnWidthArr:I,tableStyleId:w,blockRecordHandle:S,cells:this.convertTableCells(nt),bmpPreview:""}}convertTableCells(t){return t.map(o=>{var n,s;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:(s=o.attr_defs)==null?void 0:s.map(_=>{var l;return String(((l=_.attdef)==null?void 0:l.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"),s=o.dwg_dynapi_entity_data(t,"thickness"),_=o.dwg_dynapi_entity_data(t,"ins_pt"),l=o.dwg_dynapi_entity_data(t,"alignment_pt"),f=o.dwg_dynapi_entity_data(t,"rotation"),h=o.dwg_dynapi_entity_data(t,"height"),g=o.dwg_dynapi_entity_data(t,"width_factor"),y=o.dwg_dynapi_entity_data(t,"oblique_angle"),P=o.dwg_entity_text_get_style_name(t),p=o.dwg_dynapi_entity_data(t,"generation"),I=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:s,startPoint:_,endPoint:l,textHeight:h,rotation:f,xScale:g,obliqueAngle:y,styleName:P,generationFlag:p,halign:I,valign:C,elevation:w,extrusionDirection:m}}convertText(t,o){return{type:"TEXT",...o,...this.convertTextBase(t)}}convertTolerance(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"ins_pt"),_=n.dwg_dynapi_entity_data(t,"text_value"),l=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:s,text:_,extrusionDirection:f,xAxisDirection:l}}convertViewport(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"center"),_=n.dwg_dynapi_entity_data(t,"width"),l=n.dwg_dynapi_entity_data(t,"height"),f=n.dwg_dynapi_entity_data(t,"on_off"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),g=n.dwg_dynapi_entity_data(t,"SNAPBASE"),y=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),P=n.dwg_dynapi_entity_data(t,"GRIDUNIT"),p=n.dwg_dynapi_entity_data(t,"VIEWDIR"),I=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"),O=n.dwg_dynapi_entity_data(t,"num_frozen_layers");let U;if(O>0){const Jt=n.dwg_dynapi_entity_data(t,"frozen_layers");Jt&&(U=n.dwg_ptr_to_object_ref_ptr_array(Jt,O).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"),ht=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"),gt=n.dwg_dynapi_entity_data(t,"ucsorg"),At=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),Ot=n.dwg_dynapi_entity_data(t,"base_ucs"),dt=n.dwg_ref_get_id(Ot),k=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"),kt=n.dwg_dynapi_entity_data(t,"use_default_lights"),Bt=n.dwg_dynapi_entity_data(t,"default_lighting_type"),yt=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:s,width:_,height:l,status:f,viewportId:0,displayCenter:h,snapBase:g,snapSpacing:y,gridSpacing:P,viewDirection:p,targetPoint:I,perspectiveLensLength:C,frontClipZ:w,backClipZ:m,viewHeight:S,snapAngle:N,viewTwistAngle:W,circleZoomPercent:M,frozenLayerIds:U,statusBitFlags:J,clippingBoundaryId:ht,sheetName:Z,renderMode:ut,ucsPerViewport:Et,ucsOrigin:gt,ucsXAxis:At,ucsYAxis:Mt,ucsId:xt??"",ucsBaseId:dt??"",orthographicType:k,elevation:tt,shadePlotMode:z,majorGridFrequency:Xt,backgroundId:St??"",shadePlotId:se??"",visualStyleId:Ft??"",isDefaultLighting:!!kt,defaultLightingType:Bt,brightness:yt,contrast:B,sunId:V??""}}convertWipeout(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"class_version"),_=n.dwg_dynapi_entity_data(t,"pt0"),l=n.dwg_dynapi_entity_data(t,"uvec"),f=n.dwg_dynapi_entity_data(t,"vvec"),h=n.dwg_dynapi_entity_data(t,"image_size"),g=n.dwg_dynapi_entity_data(t,"display_props"),y=n.dwg_dynapi_entity_data(t,"clipping"),P=n.dwg_dynapi_entity_data(t,"brightness"),p=n.dwg_dynapi_entity_data(t,"contrast"),I=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,O=n.dwg_dynapi_entity_data(t,"imagedefreactor"),U=n.dwg_ref_get_absref(O)??0;return{type:"WIPEOUT",...o,version:s,position:_,uPixel:l,vPixel:f,imageSize:h,imageDefHandle:M,flags:g,clipping:y,brightness:P,contrast:p,fade:I,imageDefReactorHandle:U,clippingBoundaryType:w,countBoundaryPoints:m,clippingBoundaryPath:N,clipMode:C}}convertXline(t,o){const n=this.libredwg,s=n.dwg_dynapi_entity_data(t,"point"),_=n.dwg_dynapi_entity_data(t,"vector");return{type:"XLINE",...o,firstPoint:s,unitDirection:_}}getDimensionCommonAttrs(t){const o=this.libredwg,n=o.dwg_dynapi_entity_data(t,"class_version"),s=o.dwg_entity_get_block_name(t,"block"),_=o.dwg_dynapi_entity_data(t,"def_pt"),l=o.dwg_dynapi_entity_data(t,"text_midpt"),f=o.dwg_dynapi_entity_data(t,"attachmentPoint"),h=o.dwg_dynapi_entity_data(t,"flag"),g=o.dwg_dynapi_entity_data(t,"lspace_factor"),y=o.dwg_dynapi_entity_data(t,"lspace_factor"),P=o.dwg_dynapi_entity_data(t,"act_measurement"),p=o.dwg_dynapi_entity_data(t,"user_text"),I=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:s,definitionPoint:_,textPoint:l,dimensionType:h,attachmentPoint:f,textLineSpacingStyle:g,textLineSpacingFactor:y||1,measurement:P,text:p,textRotation:I,ocsRotation:C,extrusionDirection:w,styleName:m}}getCommonAttrs(t){const o=this.libredwg,n=o.dwg_object_entity_get_color_object(t),s=n.method,_=n.index;let l;(s==194||(n.rgb>>>24&255)===194)&&(l=n.rgb&16777215);const f=this.getLayerName(t),h=o.dwg_object_entity_get_handle_object(t),g=o.dwg_object_entity_get_ownerhandle_object(t),y=o.dwg_object_entity_get_xdicobjhandle_object(t),P=this.getLtypeName(t),p=o.dwg_object_entity_get_line_weight(t),I=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:ft(h.value),ownerDictionaryHardId:ft(y.absolute_ref),ownerBlockRecordSoftId:ft(g.absolute_ref),layer:f,color:l,colorIndex:_,colorName:n.name,lineType:P,lineweight:p,lineTypeScale:I,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(ft(n.handleref.value))??"0"}getLtypeName(t){const n=this.libredwg.dwg_object_entity_get_ltype_object_ref(t);return this.ltypes.get(ft(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:{ASSOCNETWORK:[],ASSOCACTION:[],ASSOCDEPENDENCY:[],ASSOCARRAYACTIONBODY:[],ASSOCVERTEXACTIONPARAM:[],ASSOCEDGEACTIONPARAM:[],DICTIONARY:[],GROUP:[],IMAGEDEF:[],LAYER_FILTER:[],LAYER_INDEX:[],LAYOUT:[],MLEADERSTYLE:[],SPATIAL_FILTER:[],XRECORD:[]},header:{},entities:[],classes:[]},s=this.libredwg;this.convertHeader(t,n.header),this.layerPlotFlagSupported=s.dwg_get_version_type(t).version>=22,this.convertClasses(t,n.classes),this.entityConverter.setClasses(n.classes);const _=s.dwg_get_num_objects(t);for(let h=0;h<_;h++){const g=s.dwg_get_object(t,h);if(g){const y=this.safeObjectTio(g);if(y)switch(s.dwg_object_get_fixedtype(g)){case R.DWG_TYPE_LAYER:{const p=this.convertLayer(y,g);n.tables.LAYER.entries.push(p),this.entityConverter.layers.set(p.handle,p.name)}break;case R.DWG_TYPE_LTYPE:{const p=this.convertLineType(y,g);n.tables.LTYPE.entries.push(p),this.entityConverter.ltypes.set(p.handle,p.name)}break}}}for(let h=0;h<_;h++){const g=s.dwg_get_object(t,h);if(g){const y=this.safeObjectTio(g);if(y)switch(s.dwg_object_get_fixedtype(g)){case R.DWG_TYPE_APPID:n.tables.APPID.entries.push(this.convertAppId(y));break;case R.DWG_TYPE_BLOCK_HEADER:{const p=this.convertBlockRecord(y,g);n.tables.BLOCK_RECORD.entries.push(p),(Nn(p.name)||Ro(p.name))&&p.entities.forEach(I=>{n.entities.push(I),I.type==="INSERT"&&I.attribs.forEach(C=>{n.entities.push(C)})})}break;case R.DWG_TYPE_DIMSTYLE:n.tables.DIMSTYLE.entries.push(this.convertDimStyle(y,g));break;case R.DWG_TYPE_STYLE:n.tables.STYLE.entries.push(this.convertStyle(y,g));break;case R.DWG_TYPE_VPORT:n.tables.VPORT.entries.push(this.convertViewport(y,g));break;case R.DWG_TYPE_DICTIONARY:n.objects.DICTIONARY.push(this.convertDictionary(y,g));break;case R.DWG_TYPE_GROUP:n.objects.GROUP.push(this.convertGroup(y,g));break;case R.DWG_TYPE_IMAGEDEF:n.objects.IMAGEDEF.push(this.convertImageDef(y,g));break;case R.DWG_TYPE_LAYERFILTER:n.objects.LAYER_FILTER.push(this.convertLayerFilter(y,g));break;case R.DWG_TYPE_LAYER_INDEX:n.objects.LAYER_INDEX.push(this.convertLayerIndex(y,g));break;case R.DWG_TYPE_LAYOUT:n.objects.LAYOUT.push(this.convertLayout(y,g));break;case R.DWG_TYPE_MLEADERSTYLE:n.objects.MLEADERSTYLE.push(this.convertMLeaderStyle(y,g));break;case R.DWG_TYPE_SPATIAL_FILTER:n.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(y,g));break;case R.DWG_TYPE_XRECORD:n.objects.XRECORD.push(this.convertXRecord(y,g));break;case R.DWG_TYPE_ASSOCNETWORK:n.objects.ASSOCNETWORK.push(this.convertAssocNetwork(y,g));break;case R.DWG_TYPE_ASSOCACTION:n.objects.ASSOCACTION.push(this.convertAssocAction(y,g));break;case R.DWG_TYPE_ASSOCDEPENDENCY:n.objects.ASSOCDEPENDENCY.push(this.convertAssocDependency(y,g));break;case R.DWG_TYPE_ASSOCARRAYACTIONBODY:n.objects.ASSOCARRAYACTIONBODY.push(this.convertAssocArrayActionBody(y,g));break;case R.DWG_TYPE_ASSOCVERTEXACTIONPARAM:n.objects.ASSOCVERTEXACTIONPARAM.push(this.convertAssocVertexActionParam(y,g));break;case R.DWG_TYPE_ASSOCEDGEACTIONPARAM:n.objects.ASSOCEDGEACTIONPARAM.push(this.convertAssocEdgeActionParam(y,g));break}}}const l=n.entities.filter(h=>h.type==="VIEWPORT");l.sort((h,g)=>{const y=parseInt(h.handle,16),P=parseInt(g.handle,16);return y-P}),l.forEach((h,g)=>{h.viewportId=g+1});const f=s.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(s=>{let _=s;(s=="DIMBLK"||s=="DIMBLK1"||s=="DIMBLK2")&&(_=_+"_T");let l=n.dwg_dynapi_header_data(t,_);s=="CELTYPE"||s=="CLAYER"||s=="CLAYER"||s=="DIMSTYLE"||s=="DIMTXSTY"||s=="TEXTSTYLE"?l=l?n.dwg_ref_get_object_name(l):"":s=="DRAGVS"&&(l=l?n.dwg_ref_get_absref(l)??2:2),o[s]=l})}convertClasses(t,o){const n=this.libredwg,s=n.dwg_get_num_classes(t);for(let _=0;_<s;_++){const l=n.dwg_get_class(t,_);o.push({dxfName:l.dxfname,cppName:l.cppname,appName:l.appname,capabilitiesFlag:l.proxyflag,instanceCount:l.num_instances,wasAProxyFlag:l.s_zombie,isAnEntityFlag:l.item_class_id===498})}}convertAppId(t){const o=this.libredwg,n=o.dwg_dynapi_entity_data(t,"name"),s=o.dwg_dynapi_entity_data(t,"flag");return{name:n,standardFlag:s}}convertBlockRecord(t,o){const n=this.libredwg,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_entity_block_header_get_block(t);_.name&&(s.name=_.name);const l=n.dwg_dynapi_entity_data(t,"num_owned"),f=n.dwg_dynapi_entity_data(t,"flag"),h=n.dwg_dynapi_entity_data(t,"description"),g=n.dwg_dynapi_entity_data(t,"base_pt"),y=n.dwg_dynapi_entity_data(t,"insert_units"),P=n.dwg_dynapi_entity_data(t,"explodable"),p=n.dwg_dynapi_entity_data(t,"block_scaling"),I=n.dwg_dynapi_entity_data(t,"layout"),C=n.dwg_ref_get_id(I)??"";let w;const m=n.dwg_entity_block_header_get_preview(t);m&&m.length>0&&(w=He(m));let S=this.convertEntities(o,s.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,l),M=this.entityConverter;for(let O=0;O<l;O++){const U=n.dwg_ref_get_object(W[O]),J=M.convert(U);J&&(J.ownerBlockRecordSoftId=s.handle,S.push(J))}}}if(this.orphanIndexDataPtr!=null){const N=this.convertOrphanOwnedEntities(this.orphanIndexDataPtr,o,s.handle,Nn(s.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{...s,flags:f,description:h,basePoint:g,layout:C,insertionUnits:y,explodability:P,scalability:p,bmpPreview:w,entities:S}}convertEntities(t,o){const n=this.libredwg,s=this.entityConverter,_=[];let l=n.get_first_owned_entity(t);for(;l;){const f=s.convert(l);f&&(f.ownerBlockRecordSoftId=o,_.push(f)),l=n.get_next_owned_entity(t,l)}return _}convertOrphanOwnedEntities(t,o,n,s){this.ensureOrphanEntityIndex(t);const l=(this.orphanEntitiesByBlock??new Map).get(o)??[],f=s&&this.ownerlessOrphanIndices?this.ownerlessOrphanIndices:[],h=l.length&&f.length?l.concat(f):l.length?l:f;if(h.length===0)return[];const g=this.libredwg,y=this.entityConverter,P=[];for(const p of h){const I=g.dwg_get_object(t,p),C=y.convert(I);C&&(C.ownerBlockRecordSoftId=n,P.push(C))}return P}isOwnedByMissingBlock(t,o){if(!o)return!1;const n=this.libredwg;try{const s=n.dwg_dynapi_common_value(o,"entmode");if(!s.success||Number(s.data)!==0)return!1;const _=n.dwg_dynapi_common_value(o,"ownerhandle");if(!_.success||!_.data)return!1;const l=n.dwg_ref_get_absref(_.data);return l==null?!1:!n.dwg_resolve_handle_silent(t,BigInt(l))}catch{return!1}}ensureOrphanEntityIndex(t){if(this.orphanEntitiesByBlock)return;const o=this.libredwg,n=o.dwg_get_num_objects(t),s=new Map,_=[],l=[],f=new Map;for(let P=0;P<n;P++){const p=o.dwg_get_object(t,P);if(p){if(o.dwg_object_get_supertype(p)===Ln.DWG_SUPERTYPE_ENTITY)_.push(P),s.set(p,P);else if(o.dwg_object_get_fixedtype(p)===R.DWG_TYPE_BLOCK_HEADER){l.push(p);const I=o.dwg_object_to_object_tio(p);I&&f.set(I,p)}}}const h=new Set;for(const P of l){let p=o.get_first_owned_entity(P),I=0;for(;p&&I++<=_.length;){const C=s.get(p);if(C===void 0||h.has(C))break;h.add(C),p=o.get_next_owned_entity(P,p)}}const g=new Map,y=[];for(const P of _){if(h.has(P))continue;const p=o.dwg_get_object(t,P),I=p?o.dwg_object_to_entity_tio(p):0,C=I?o.dwg_entity_owner(I):0,w=C?f.get(C)??0:0;if(w){const m=g.get(w);m?m.push(P):g.set(w,[P])}else this.isOwnedByMissingBlock(t,I)||y.push(P)}this.orphanEntitiesByBlock=g,this.ownerlessOrphanIndices=y}convertDimStyle(t,o){const n=this.libredwg,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"DIMTOL"),l=n.dwg_dynapi_entity_data(t,"DIMLIM"),f=n.dwg_dynapi_entity_data(t,"DIMTIH"),h=n.dwg_dynapi_entity_data(t,"DIMTOH"),g=n.dwg_dynapi_entity_data(t,"DIMSE1"),y=n.dwg_dynapi_entity_data(t,"DIMSE2"),P=n.dwg_dynapi_entity_data(t,"DIMALT"),p=n.dwg_dynapi_entity_data(t,"DIMTOFL"),I=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"),O=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"),ht=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"),gt=n.dwg_dynapi_entity_data(t,"DIMAUNIT"),At=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"),Ot=n.dwg_dynapi_entity_data(t,"DIMSCALE"),dt=n.dwg_dynapi_entity_data(t,"DIMASZ"),k=n.dwg_dynapi_entity_data(t,"DIMEXO"),tt=n.dwg_dynapi_entity_data(t,"DIMDLI"),z=n.dwg_dynapi_entity_data(t,"DIMEXE"),kt=n.dwg_dynapi_entity_data(t,"DIMRND"),Bt=n.dwg_dynapi_entity_data(t,"DIMDLE"),yt=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"),ye=n.dwg_dynapi_entity_data(t,"DIMLFAC"),Ut=n.dwg_dynapi_entity_data(t,"DIMTVP"),Ye=n.dwg_dynapi_entity_data(t,"DIMTFAC"),Te=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"),ve=n.dwg_dynapi_entity_data(t,"DIMLUNIT"),Tt=n.dwg_dynapi_entity_data(t,"DIMDSEP"),le=n.dwg_dynapi_entity_data(t,"DIMTMOVE"),x=n.dwg_dynapi_entity_data(t,"DIMATFIT"),Ie=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{...s,DIMPOST:Ne,DIMAPOST:Zt,DIMBLK:Lt,DIMBLK1:X,DIMBLK2:We,DIMSCALE:Ot,DIMASZ:dt,DIMEXO:k,DIMDLI:tt,DIMEXE:z,DIMRND:kt,DIMDLE:Bt,DIMTP:yt,DIMTM:B,DIMTXT:Ft,DIMCEN:q,DIMTSZ:V,DIMALTF:Jt,DIMLFAC:ye,DIMTVP:Ut,DIMTFAC:Ye,DIMGAP:Te,DIMALTRND:qt,DIMTOL:_,DIMLIM:l,DIMTIH:f,DIMTOH:h,DIMSE1:g,DIMSE2:y,DIMTAD:ut,DIMZIN:S,DIMAZIN:se,DIMALT:P,DIMALTD:m,DIMTOFL:p,DIMSAH:I,DIMTIX:C,DIMSOXD:w,DIMCLRD:Yt,DIMCLRE:_e,DIMCLRT:Nt,DIMADEC:de,DIMUNIT:Et,DIMDEC:At,DIMTDEC:Mt,DIMALTU:bt,DIMALTTD:xt,DIMAUNIT:gt,DIMFRAC:Qt,DIMLUNIT:ve,DIMDSEP:String.fromCharCode(Tt),DIMTMOVE:le,DIMJUST:O,DIMSD1:N,DIMSD2:W,DIMTOLJ:M,DIMTZIN:nt,DIMALTZ:ht,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:Ie,DIMTXTDIRECTION:ce,DIMALTMZF:jt,DIMALTMZS:me,DIMMZF:we,DIMMZS:Pt}}convertLayer(t,o){const n=this.libredwg,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),l=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"),g=n.dwg_dynapi_entity_data(t,"locked");let y=n.dwg_dynapi_entity_data(t,"plotflag");this.layerPlotFlagSupported||(y=1);const P=n.dwg_dynapi_entity_data(t,"linewt"),p=n.dwg_dynapi_entity_data(t,"color"),I=n.dwg_dynapi_entity_data(t,"ltype");let C="Continuous";if(I)try{C=n.dwg_ref_get_object_name(I)}catch{}const w=p.method;let m=256,S=16777215;return w===195||(p.rgb>>>24&255)===195?m=p.rgb&255:w==194||(p.rgb>>>24&255)===194?S=p.rgb&16777215:p.index>=1&&p.index<=255&&(m=p.index),{...s,standardFlag:_,colorIndex:m,color:S,colorName:p.name,transparency:p.alpha,lineType:C,frozen:l!=0,off:f!=0,frozenInNew:h!=0,locked:g!=0,plotFlag:y,lineweight:P,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(t,o){const n=this.libredwg,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),l=n.dwg_dynapi_entity_data(t,"description"),f=n.dwg_dynapi_entity_data(t,"numdashes"),h=n.dwg_dynapi_entity_data(t,"pattern_len"),g=n.dwg_dynapi_entity_data(t,"dashes"),y=g?n.dwg_ptr_to_ltype_dash_array(g,f):[];return{...s,description:l,standardFlag:_,numberOfLineTypes:f,totalPatternLength:h,pattern:this.convertLineTypePattern(y)}}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,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),l=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"),g=n.dwg_dynapi_entity_data(t,"last_height"),y=n.dwg_dynapi_entity_data(t,"font_file"),P=n.dwg_dynapi_entity_data(t,"bigfont_file");return{...s,standardFlag:_,fixedTextHeight:0,widthFactor:l,obliqueAngle:f,textGenerationFlag:h,lastHeight:g,font:y,bigFont:P}}convertViewport(t,o){const n=this.libredwg,s=this.getCommonTableEntryAttrs(t,o),_=n.dwg_dynapi_entity_data(t,"flag"),l=n.dwg_dynapi_entity_data(t,"VIEWSIZE"),f=n.dwg_dynapi_entity_data(t,"aspect_ratio"),h=n.dwg_dynapi_entity_data(t,"VIEWCTR"),g=n.dwg_dynapi_entity_data(t,"view_target"),y=n.dwg_dynapi_entity_data(t,"VIEWDIR"),P=n.dwg_dynapi_entity_data(t,"view_twist"),p=n.dwg_dynapi_entity_data(t,"lens_length"),I=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"),O=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"),ht=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"),gt=n.dwg_dynapi_entity_data(t,"SNAPUNIT"),At=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"),Ot=n.dwg_dynapi_entity_data(t,"grid_major"),dt=n.dwg_dynapi_entity_data(t,"background"),k=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{...s,standardFlag:_,lowerLeftCorner:U,upperRightCorner:J,center:h,snapBasePoint:Et,snapSpacing:gt,gridSpacing:Z,viewDirectionFromTarget:y,viewTarget:g,lensLength:p,frontClippingPlane:I,backClippingPlane:C,viewHeight:l,aspectRatio:f,snapRotationAngle:ut,viewTwistAngle:P,circleSides:nt,frozenLayers:[],styleSheet:"",renderMode:m,viewMode:w,ucsIconSetting:ht,ucsOrigin:At,ucsXAxis:Mt,ucsYAxis:bt,orthographicType:0,elevation:xt,shadePlotSetting:0,majorGridLines:Ot,backgroundObjectId:k,visualStyleObjectId:z,isDefaultLightingOn:S,defaultLightingType:N,brightness:W,contrast:M,ambientColor:O.index}}getCommonTableEntryAttrs(t,o){const n=this.libredwg,s=n.dwg_object_get_tio(o),_=n.dwg_object_object_get_ownerhandle_object(s),l=n.dwg_object_get_handle_object(o);return{handle:ft(l.value),ownerHandle:ft(_.absolute_ref),name:n.dwg_dynapi_entity_data(t,"name")}}convertDictionary(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"is_hardowner"),l=n.dwg_dynapi_entity_data(t,"cloning"),f=n.dwg_dynapi_entity_data(t,"numitems"),h=n.dwg_dynapi_entity_data(t,"itemhandles"),g=n.dwg_ptr_to_object_ref_array(h,f),y=n.dwg_object_dictionary_get_texts(o),P={};return g.forEach((p,I)=>P[y[I]]=ft(p.absolute_ref)),{...s,isHardOwner:!!_,cloningFlag:l,entries:P}}convertImageDef(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"image_size"),l=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"),g=n.dwg_dynapi_entity_data(t,"resunits");return{...s,fileName:l,size:_,sizeOfOnePixel:h,isLoaded:f,resolutionUnits:g}}convertLayerFilter(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"num_names")??0,l=n.dwg_dynapi_entity_data(t,"names"),f=l&&_>0?n.dwg_ptr_to_wchar_string_array(l,_).filter(h=>h!=null&&h!==""):[];return{...s,...f.length?{layerNames:f}:{}}}convertLayerIndex(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"last_updated"),l=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"),g=[],y=[],P=[];if(f&&h>0)for(let p=0;p<l;p++){const I=f+p*h,C=n.dwg_dynapi_subclass_data(I,"LAYER_entry","name");g.push(C??"");const w=n.dwg_dynapi_subclass_data(I,"LAYER_entry","handle");y.push(w?n.dwg_ref_get_id(w)??"":""),P.push(n.dwg_dynapi_subclass_data(I,"LAYER_entry","numlayers")??0)}return{...s,..._!=null?{timeStamp:_}:{},...g.length?{layerNames:g}:{},...y.length?{idBufferIds:y}:{},...P.length?{idBufferEntryCounts:P}:{}}}convertLayout(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"layout_name"),l=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"),g=n.dwg_dynapi_entity_data(t,"LIMMIN"),y=n.dwg_dynapi_entity_data(t,"LIMMAX"),P=n.dwg_dynapi_entity_data(t,"UCSORG"),p=n.dwg_dynapi_entity_data(t,"UCSXDIR"),I=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"),O=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{...s,layoutName:_,controlFlag:f,tabOrder:l,minLimit:g,maxLimit:y,insertionPoint:h,minExtent:w,maxExtent:m,elevation:S,ucsOrigin:P,ucsXAxis:p,ucsYAxis:I,orthographicType:C,paperSpaceTableId:W,viewportId:O,namedUcsId:J,shadePlotId:""}}convertMLeaderStyle(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=g=>n.dwg_dynapi_entity_data(t,g),l=g=>n.dwg_ref_get_id(g),f=g=>g>0,h=g=>g!=null?Tr(g):void 0;return{...s,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:l(_("line_type")),leaderLineWeight:_("linewt"),landingEnabled:f(_("has_landing")),landingGap:_("landing_gap"),doglegEnabled:f(_("has_dogleg")),doglegLength:_("landing_dist"),description:_("description"),arrowheadId:l(_("arrow_head")),arrowheadSize:_("arrow_head_size"),defaultMTextContents:_("text_default"),textStyleId:l(_("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:l(_("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,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"origin"),l=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,l),g=n.dwg_dynapi_entity_data(t,"extrusion"),y=n.dwg_dynapi_entity_data(t,"display_boundary_on"),P=n.dwg_dynapi_entity_data(t,"front_clip_on"),p=n.dwg_dynapi_entity_data(t,"front_clip_z"),I=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{...s,origin:_,numberOfPointsOnClipBoundary:l,vertices:h,extrusionDirection:g,clipBoundaryVisible:!!y,frontClippingPlaneFlag:!!P,frontClippingPlaneDistance:p,backClippingPlaneFlag:!!I,backClippingPlaneDistance:C,matrix:m,invertBlockMatrix:N}}convertGroup(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"name")??"",l=!!n.dwg_dynapi_entity_data(t,"unnamed"),f=n.dwg_dynapi_entity_data(t,"selectable"),h=f!=null?!!f:!0,g=n.dwg_dynapi_entity_data(t,"num_groups")??0,y=n.dwg_dynapi_entity_data(t,"groups")??0,p=(g>0&&y?n.dwg_ptr_to_object_ref_array(y,g):[]).map(I=>ft(I.absolute_ref));return{...s,description:_,unnamed:l,selectable:h,objectHandles:p}}convertXRecord(t,o){const n=this.libredwg,s=this.getCommonObjectAttrs(o),_=n.dwg_dynapi_entity_data(t,"cloning"),l=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,g=h&&h.absolute_ref?ft(h.absolute_ref):void 0;return{...s,..._!=null?{cloning:_}:{},...g?{extensionDictionary:g}:{},data:l}}refId(t){return t?this.libredwg.dwg_ref_get_id(t)??"0":"0"}refIds(t,o){return!t||o<=0?[]:this.libredwg.dwg_ptr_to_object_ref_array(t,o).map(n=>ft(n.absolute_ref))}assocHandleRefs(t,o){const n=this.libredwg,s=n.dwg_dynapi_subclass_size("ASSOCACTION_Deps"),_=[];if(!t||s<=0)return _;for(let l=0;l<o;l++){const f=t+l*s;_.push({handle:this.refId(n.dwg_dynapi_subclass_data(f,"ASSOCACTION_Deps","dep")),isOwned:!!n.dwg_dynapi_subclass_data(f,"ASSOCACTION_Deps","is_owned")})}return _}assocVariant(t){const o=this.libredwg,n=o.dwg_dynapi_subclass_data(t,"EvalVariant","code")??0,s=f=>o.dwg_dynapi_subclass_data(t,"EvalVariant",f),_=(f,h)=>n>=f&&n<=h;let l=null;return _(38,59)||_(140,149)||_(460,469)||_(1040,1042)?l=s("u.bd"):_(90,99)||_(420,429)||_(440,459)||n===1071?l=s("u.bl")|0:_(60,79)||_(170,179)||_(270,279)||_(370,389)||_(400,409)||n===1070?l=s("u.bs")<<16>>16:_(280,289)?l=s("u.rc"):(_(1,4)||_(6,9)||_(100,102)||_(300,309)||_(410,419)||_(430,439)||_(470,479)||n===999||_(1e3,1009))&&(l=null),{code:n,value:l}}assocValueParams(t,o){const n=this.libredwg,s=n.dwg_dynapi_subclass_size("VALUEPARAM"),_=n.dwg_dynapi_subclass_size("VALUEPARAM_vars"),l=[];if(!t||s<=0)return l;for(let f=0;f<o;f++){const h=t+f*s,g=I=>n.dwg_dynapi_subclass_data(h,"VALUEPARAM",I),y=g("num_vars")??0,P=g("vars"),p=[];for(let I=0;P&&_>0&&I<y;I++){const C=P+I*_;p.push({...this.assocVariant(C),variableHandle:this.refId(n.dwg_dynapi_subclass_data(C,"VALUEPARAM_vars","handle"))})}l.push({classVersion:g("class_version")??0,name:g("name")??"",unitType:g("unit_type")??0,values:p,controlledObjectDependencyHandle:this.refId(g("controlled_objdep"))})}return l}convertAssocAction(t,o){const n=this.libredwg,s=_=>n.dwg_dynapi_entity_data(t,_);return{...this.getCommonObjectAttrs(o),classVersion:s("class_version")??0,status:s("geometry_status")??0,owningNetworkHandle:this.refId(s("owningnetwork")),actionBodyHandle:this.refId(s("actionbody")),actionIndex:s("action_index")??0,maxDependencyIndex:s("max_assoc_dep_index")??0,dependencies:this.assocHandleRefs(s("deps"),s("num_deps")??0),ownedParamHandles:this.refIds(s("owned_params"),s("num_owned_params")??0),valueParams:this.assocValueParams(s("values"),s("num_values")??0)}}convertAssocNetwork(t,o){const n=this.libredwg,s=_=>n.dwg_dynapi_entity_data(t,_);return{...this.convertAssocAction(t,o),networkVersion:s("network_version")??0,maxActionIndex:s("network_action_index")??0,actions:this.assocHandleRefs(s("actions"),s("num_actions")??0),ownedActionHandles:this.refIds(s("owned_actions"),s("num_owned_actions")??0)}}convertAssocDependency(t,o){const n=this.libredwg,s=_=>n.dwg_dynapi_entity_data(t,_);return{...this.getCommonObjectAttrs(o),classVersion:s("class_version")??0,status:s("status")??0,isReadDependency:!!s("is_read_dep"),isWriteDependency:!!s("is_write_dep"),isAttachedToObject:!!s("is_attached_to_object"),isDelegatingToOwningAction:!!s("is_delegating_to_owning_action"),order:(s("order")??0)|0,name:s("has_name")?s("name")??"":"",dependentOnHandle:this.refId(s("dep_on")),prevDependencyHandle:this.refId(s("readdep")),nextDependencyHandle:this.refId(s("node")),dependencyBodyHandle:this.refId(s("dep_body")),dependencyIndex:(s("depbodyid")??0)|0}}convertAssocArrayActionBody(t,o){const n=this.libredwg,s=y=>n.dwg_dynapi_entity_data(t,y),_=y=>y?n.dwg_ptr_to_double_array(y,16):[],l=[],f=s("num_arrayitems")??0,h=s("arrayitems"),g=n.dwg_dynapi_subclass_size("ASSOCARRAYITEM");for(let y=0;h&&g>0&&y<f;y++){const P=h+y*g,p=(m,S=P)=>n.dwg_dynapi_subclass_data(S,"ASSOCARRAYITEM",m),I=p("flags")??0;let C;if(I&4)C=_(p("transmatrix"));else{const m=p("x_dir")??{x:0,y:0,z:0};C=[1,0,0,m.x,0,1,0,m.y,0,0,1,m.z,0,0,0,1]}const w=I&2?_(p("rel_transform")):void 0;l.push({...w?{relativeMatrix:w}:{},...I&16?{secondaryEntityHandle:this.refId(p("h2"))}:{},classVersion:p("class_version")??0,itemIndex:p("itemloc")??0,rowIndex:p("itemloc",P+4)??0,levelIndex:p("itemloc",P+8)??0,flags:I,matrix:C,entityHandle:this.refId(p("h1"))})}return{...this.getCommonObjectAttrs(o),actionBodyVersion:s("aab_version")??0,classVersion:s("aaab_version")??0,parametersClassName:s("paramblock")??"",parametersVersion:s("aap_version")??0,items:l,arrayTransform:_(s("transmatrix"))}}convertAssocActionParamBase(t,o){const n=this.libredwg,s=_=>n.dwg_dynapi_entity_data(t,_);return{...this.getCommonObjectAttrs(o),classVersion:s("is_r2013")??0,paramVersion:s("aap_version")??0,name:s("name")??"",singleDependencyVersion:s("asdap_class_version")??0,dependencyHandle:this.refId(s("dep"))}}convertAssocVertexActionParam(t,o){const n=this.libredwg;return{...this.convertAssocActionParamBase(t,o),vertexVersion:n.dwg_dynapi_entity_data(t,"class_version")??0,point:n.dwg_dynapi_entity_data(t,"pt")??{x:0,y:0,z:0}}}convertAssocEdgeActionParam(t,o){const n=this.libredwg,s=_=>n.dwg_dynapi_entity_data(t,_);return{...this.convertAssocActionParamBase(t,o),edgeVersion:s("class_version")??0,hasCachedCurve:!!s("has_action"),curveType:s("action_type")??0}}getCommonObjectAttrs(t){const o=this.libredwg,n=o.dwg_object_get_tio(t),s=o.dwg_object_object_get_ownerhandle_object(n),_=o.dwg_object_get_handle_object(t);return{handle:ft(_.value),ownerHandle:ft(s.absolute_ref)}}}class It{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(s=>({x:s.x*t.x+o.x,y:s.y*t.y+o.y}));this.reset();for(const s of n)this.expandByPoint(s);return this}rotate(t,o){const n=Math.cos(t),s=Math.sin(t),_=this.getCorners().map(l=>{const f=l.x-o.x,h=l.y-o.y;return{x:o.x+f*n-h*s,y:o.y+f*s+h*n}});this.reset();for(const l of _)this.expandByPoint(l);return this}clone(){const t=new It;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,s){const _=o.length;if(_===0)throw new Error("points must not be empty");const l=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=s??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 g=[t,h.length-1-t],y=h[g[0]],P=h[g[1]];r=r*(P-y)+y,r=Math.max(r,y),r=Math.min(r,P);let p=g[0];for(;p<g[1]&&!(r>=h[p]&&r<=h[p+1]);p++);const I=new Array(_);for(let w=0;w<_;w++){I[w]=new Array(l+1);for(let m=0;m<l;m++)I[w][m]=o[w][m]*f[w];I[w][l]=f[w]}for(let w=1;w<=t+1;w++)for(let m=p;m>p-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<l+1;W++)I[m][W]=(1-N)*I[m-1][W]+N*I[m][W]}const C=new Array(l);for(let w=0;w<l;w++)C[w]=No(I[p][w]/I[p][l],-9);return C}function No(r,t){if(isNaN(r)||!Number.isInteger(t))return NaN;const[o,n="0"]=r.toString().split("e"),s=Math.round(+`${o}e${+n-t}`),[_,l="0"]=s.toString().split("e");return+`${_}e${+l+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 s=Math.round(Ue(t,0,255)),_=Math.round(Ue(o,0,255)),l=Math.round(Ue(n,0,255));return this.color=(s<<16)+(_<<8)+l,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 s,_,l;o<0?(s=Math.atan(-o)*4,_=new Ct(r.x,r.y),l=new Ct(t.x,t.y)):(s=Math.atan(o)*4,_=new Ct(t.x,t.y),l=new Ct(r.x,r.y));const f=l.sub(_),h=f.length(),g=_.add(f.multiply(.5)),y=Math.abs(h/2/Math.tan(s/2)),P=f.norm(),p=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)),I=s<Math.PI?g.add(p.multiply(-y)):g.add(p.multiply(y)),C=Math.atan2(l.y-I.y,l.x-I.x)/Math.PI*180;let w=Math.atan2(_.y-I.y,_.x-I.x)/Math.PI*180;w<C&&(w+=360);const m=l.sub(I).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 O=M/180*Math.PI,U=I.add(new Ct(Math.cos(O)*m,Math.sin(O)*m));W.push(U)}return o<0&&W.reverse(),W}function Mo(r,t=!1){let o=[];const n=r.vertices.map(s=>({x:s.x,y:s.y,bulge:s.bulge}));t&&n.push(n[0]);for(let s=0,_=n.length;s<_-1;++s){const l=n[s],f=n[s+1];o.push(l),n[s].bulge&&(o=o.concat(Go(l,f,r.vertices[s].bulge))),s===_-2&&o.push(f)}return o}class bo{constructor(){et(this,"blockMap",new Map)}rotate(t,o){const n=Math.cos(o),s=Math.sin(o);return{x:t.x*n-t.y*s,y:t.x*s+t.y*n}}interpolateBSpline(t,o,n,s=25,_){const l=[],f=t.map(y=>[y.x,y.y]),h=[n[o]],g=[n[o],n[n.length-1-o]];for(let y=o+1;y<n.length-o;++y)h[h.length-1]!==n[y]&&h.push(n[y]);for(let y=1;y<h.length;++y){const P=h[y-1],p=h[y];for(let I=0;I<=s;++I){let w=(I/s*(p-P)+P-g[0])/(g[1]-g[0]);w=Math.max(0,Math.min(1,w));const m=Yo(w,o,f,n,_);l.push({x:m[0],y:m[1]})}}return l}addFlipXIfApplicable(t,{bbox:o,element:n}){return"extrusionDirection"in t&&t.extrusionDirection.z===-1?{bbox:new It().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 It().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,s={x:n.x+t.unitDirection.x*1e4,y:n.y+t.unitDirection.y*1e4},_=new It().expandByPoint(n).expandByPoint(s),l=`<line x1="${n.x}" y1="${n.y}" x2="${s.x}" y2="${s.y}" />`;return{bbox:_,element:l}}xline(t){const n={x:t.firstPoint.x-t.unitDirection.x*1e4,y:t.firstPoint.y-t.unitDirection.y*1e4},s={x:t.firstPoint.x+t.unitDirection.x*1e4,y:t.firstPoint.y+t.unitDirection.y*1e4},_=new It().expandByPoint(n).expandByPoint(s),l=`<line x1="${n.x}" y1="${n.y}" x2="${s.x}" y2="${s.y}" />`;return{bbox:_,element:l}}extractMTextLines(t){return t.replace(/\\U\+([0-9A-Fa-f]{4})/g,(o,n)=>String.fromCharCode(parseInt(n,16))).replace(/\\P/g,`
|
|
14
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(`
|
|
15
|
-
`).map(o=>o.trim()).filter(o=>o.length>0)}lines(t,o,n,
|
|
16
|
-
`)}}mtext(t){const o=t.textHeight,n=t.insertionPoint,
|
|
15
|
+
`).map(o=>o.trim()).filter(o=>o.length>0)}lines(t,o,n,s,_="start"){const l=new It().expandByPoint({x:n.x,y:n.y}).expandByPoint({x:n.x+s,y:n.y-t.length*o*1.5}),f=t.map((h,g)=>{const y=n.x,P=n.y-g*o*1.5,p=`translate(${y},${P}) scale(1,-1) translate(${-y},${-P})`;return`<text x="${y}" y="${P}" font-size="${o}" text-anchor="${_}" transform="${p}">${h}</text>`});return{bbox:l,element:f.join(`
|
|
16
|
+
`)}}mtext(t){const o=t.textHeight,n=t.insertionPoint,s=this.extractMTextLines(t.text),_=t.attachmentPoint;let l="start";return _==ge.BottomCenter||_==ge.MiddleCenter||_==ge.TopCenter?l="middle":(_==ge.BottomRight||_==ge.MiddleRight||_==ge.TopRight)&&(l="end"),this.lines(s,o,n,t.extentsWidth,l)}table(t){const{rowCount:o,columnCount:n,rowHeightArr:s,columnWidthArr:_,startPoint:l,cells:f}=t,h=l.x,g=l.y,y=[];for(let m=0,S=g;m<o;m++){const N=s[m];let W=h;for(let M=0;M<n;M++){const O=m*n+M,U=f[O],J=_[M];y.push({x:W,y:S,width:J,height:N,cell:U,row:m,col:M}),W+=J}S+=N}const P=y.map(({x:m,y:S,width:N,height:W,cell:M})=>{const O=[];M.topBorderVisibility&&O.push(`<line x1="${m}" y1="${S}" x2="${m+N}" y2="${S}" stroke="black" />`),M.bottomBorderVisibility&&O.push(`<line x1="${m}" y1="${S+W}" x2="${m+N}" y2="${S+W}" stroke="black" />`),M.leftBorderVisibility&&O.push(`<line x1="${m}" y1="${S}" x2="${m}" y2="${S+W}" stroke="black" />`),M.rightBorderVisibility&&O.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[...O,nt].join(`
|
|
17
17
|
`)}).join(`
|
|
18
|
-
`),
|
|
19
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${
|
|
20
|
-
${
|
|
18
|
+
`),p=_.reduce((m,S)=>m+S,0),I=s.reduce((m,S)=>m+S,0),C=new It().expandByPoint({x:h,y:g}).expandByPoint({x:h+p,y:g+I}),w=`
|
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${p}" height="${I}" viewBox="${h} ${g} ${p} ${I}">
|
|
20
|
+
${P}
|
|
21
21
|
</svg>
|
|
22
|
-
`.trim();return{bbox:C,element:w}}text(t){const o=t.textHeight,n=t.startPoint,
|
|
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,
|
|
22
|
+
`.trim();return{bbox:C,element:w}}text(t){const o=t.textHeight,n=t.startPoint,s=[t.text];let _=t.endPoint.x-t.endPoint.x;t.halign==0&&(_=t.text.length*o+t.startPoint.x);let l="start";return t.halign==Sn.CENTER?l="middle":t.halign==Sn.RIGHT&&(l="end"),this.lines(s,o,n,_,l)}vertices(t,o=!1){const n=t.reduce((_,l)=>_.expandByPoint(l),new It);let s=t.reduce((_,l,f)=>(_+=f===0?"M":"L",_+=l.x+","+l.y,_),"");return o&&(s+="Z"),{bbox:n,element:`<path d="${s}" />`}}circle(t){const o=new It().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,s,_,l,f){const h=Math.sqrt(n*n+s*s),g=_*h,y=-Math.atan2(-s,n),P=this.bboxEllipseOrArc(t,o,n,s,_,l,f);if(Math.abs(l-f)<1e-9||Math.abs(l-f+Math.PI*2)<1e-9){const p=`<g transform="rotate(${y/Math.PI*180} ${t}, ${o})"><ellipse cx="${t}" cy="${o}" rx="${h}" ry="${g}" /></g>`;return{bbox:P,element:p}}else{const p=this.rotate({x:Math.cos(l)*h,y:Math.sin(l)*g},y),I={x:t+p.x,y:o+p.y},C=this.rotate({x:Math.cos(f)*h,y:Math.sin(f)*g},y),w={x:t+C.x,y:o+C.y},S=(f<l?f+Math.PI*2:f)-l<Math.PI?0:1,W=`<path d="${`M ${I.x} ${I.y} A ${h} ${g} ${y/Math.PI*180} ${S} 1 ${w.x} ${w.y}`}" />`;return{bbox:P,element:W}}}bboxEllipseOrArc(t,o,n,s,_,l,f){for(;l<0;)l+=Math.PI*2;for(;f<=l;)f+=Math.PI*2;const h=[];if(Math.abs(n)<1e-12||Math.abs(s)<1e-12)for(let I=0;I<4;I++)h.push(I/2*Math.PI);else h[0]=Math.atan(-s*_/n)-Math.PI,h[1]=Math.atan(n*_/s)-Math.PI,h[2]=h[0]-Math.PI,h[3]=h[1]-Math.PI;for(let I=4;I>=0;I--){for(;h[I]<l;)h[I]+=Math.PI*2;h[I]>f&&h.splice(I,1)}h.push(l),h.push(f);const g=h.map(I=>({x:Math.cos(I),y:Math.sin(I)})),y=[[n,-s*_],[s,n*_]];return g.map(I=>({x:I.x*y[0][0]+I.y*y[0][1]+t,y:I.x*y[1][0]+I.y*y[1][1]+o})).reduce((I,C)=>(I.expandByPoint(C),I),new It)}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,s=t.rotation*(180/Math.PI),_=`translate(${n.x},${n.y}) rotate(${s}) 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:s,elements:_}=n.reduce((l,f)=>{const h=this.entityToBoundsAndElement(f);if(h){const{bbox:g,element:y}=h;g.valid&&(l.bbox.expandByPoint(g.min),l.bbox.expandByPoint(g.max));const P=this.getEntityColor(o.tables.LAYER.entries,f),p=f.type=="TEXT"||f.type=="MTEXT"?P.cssColor:"none";P.isByBlock?l.elements.push(`<g id="${f.handle}">${y}</g>`):l.elements.push(`<g id="${f.handle}" stroke="${P.cssColor}" fill="${p}">${y}</g>`)}return l},{bbox:new It,elements:[]});return s.valid?{bbox:s,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,s=!!(n.flag&512),_=Mo(n,s);o=this.vertices(_,s);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 s=t.find(_=>_.name===o.layer);s!=null&&(n.colorIndex=s.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(l=>{if(Nn(l.name))o=l;else{const f=this.block(l,t);f&&(n+=f.element,this.blockMap.set(l.name,f))}});const s=this.block(o,t),_=s&&s.bbox.valid?{x:s.bbox.min.x,y:-s.bbox.max.y,width:s.bbox.max.x-s.bbox.min.x,height:s.bbox.max.y-s.bbox.min.y}:{x:0,y:0,width:0,height:0};return`<?xml version="1.0"?>
|
|
24
24
|
<svg
|
|
25
25
|
xmlns="http://www.w3.org/2000/svg"
|
|
26
26
|
xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
|
|
@@ -30,6 +30,6 @@ ${R}
|
|
|
30
30
|
>
|
|
31
31
|
<defs>${n}</defs>
|
|
32
32
|
<g stroke="#000000" stroke-width="0.1%" fill="none" transform="matrix(1,0,0,-1,0,0)">
|
|
33
|
-
${
|
|
33
|
+
${s?s.element:""}
|
|
34
34
|
</g>
|
|
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"}));
|
|
35
|
+
</svg>`}}const vr=class Ir{constructor(t){return et(this,"wasmInstance"),et(this,"decoder"),this.wasmInstance=t,new Proxy(this,{get:(o,n,s)=>n in o?Reflect.get(o,n,s):Reflect.get(o.wasmInstance,n,s)})}dwg_read_data(t,o){const n=typeof t=="string"?new TextEncoder().encode(t):new Uint8Array(t);if(o==mt.DWG){const s="tmp.dwg";try{this.wasmInstance.FS.writeFile(s,n);const _=this.wasmInstance.dwg_read_file(s);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(s,!1).exists&&this.wasmInstance.FS.unlink(s)}}else if(o==mt.DXF){const s="tmp.dxf";try{this.wasmInstance.FS.writeFile(s,n);const _=this.wasmInstance.dxf_read_file(s);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(s,!1).exists&&this.wasmInstance.FS.unlink(s)}}}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 Io[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 s=new Er(this);return{database:s.convert(t),stats:s.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),s=o.dwg_object_to_object_tio(n);return this.dwg_dynapi_entity_data(s,"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),s=[];let _=o.get_first_owned_entity(n);for(;_;)s.push(_),_=o.get_next_owned_entity(n,_);return s}dwg_getall_object_by_type(t,o){const n=this.wasmInstance,s=n.dwg_get_num_objects(t),_=[];for(let l=0;l<s;l++){const f=n.dwg_get_object(t,l),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,s=n.dwg_get_num_objects(t),_=[];for(let l=0;l<s;l++){const f=n.dwg_get_object(t,l),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,R.DWG_TYPE_LAYER)}dwg_getall_LTYPE(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_LTYPE)}dwg_getall_STYLE(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(t){return this.dwg_getall_object_by_type(t,R.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(t){return this.dwg_getall_entity_by_type(t,R.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(t){return this.dwg_getall_entity_by_type(t,R.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(t){return this.dwg_getall_entity_by_type(t,R.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(t){return this.dwg_getall_entity_by_type(t,R.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(t){return this.dwg_getall_entity_by_type(t,R.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(t){return this.dwg_getall_entity_by_type(t,R.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 s=this.wasmInstance.dwg_dynapi_subclass_value(t,o,n);return s.bin&&this.decoder&&(s.data=this.decoder.decode(s.bin)),typeof s.data=="string"&&(s.data=dr(s.data)),s}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,s=this.dwg_dynapi_entity_data(t,o),_=n.dwg_ref_get_object(s),l=n.dwg_object_to_object_tio(_);return this.dwg_entity_block_header_get_block(l).name}dwg_entity_get_dimstyle_name(t,o="dimstyle"){const n=this.wasmInstance,s=this.dwg_dynapi_entity_data(t,o),_=n.dwg_ref_get_object(s),l=n.dwg_object_to_object_tio(_);return this.dwg_dynapi_entity_data(l,"name")}dwg_entity_block_header_get_block(t){const o=this.wasmInstance,n=this.dwg_dynapi_entity_data(t,"block_entity"),s=o.dwg_ref_get_object(n),_=o.dwg_object_to_entity_tio(s),l=this.dwg_dynapi_entity_data(_,"name"),f=this.dwg_dynapi_entity_data(_,"base_pt");return{name:l,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"),s=o.dwg_ref_get_object(n),_=o.dwg_object_to_object_tio(s);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 Ir(t):this.instance}static async create(t){const o=t==null?await sr():await sr({locateFile:n=>`${t}/${n}`});return this.createByWasmInstance(o)}};et(vr,"instance");let xo=vr;const ln=new Uint8Array([31,37,109,7,212,54,40,40,157,87,202,63,157,68,16,43]);function Oo(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 s=0;s+ln.length<=n;s++){if(!mr(r,s,ln)||s===t)continue;const _=fr(r,s);if(_)return _}}function ko(r,t){var n;if((n=r.thumbnailImage)!=null&&n.length)return;const o=Oo(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 s=r[o];if(o+=1,s<=0||s>16)return;const _=[];for(let h=0;h<s;h++){if(o+9>r.length)return;const g=r[o];o+=1;const y=n.getInt32(o,!0);o+=4;const P=n.getInt32(o,!0);o+=4,_.push({code:g,start:y,size:P})}const l=o,f=hr(r,_,"absolute");return f||hr(r,_,"sequential",l)}function hr(r,t,o,n=0){let s,_=n;for(const l of t){const f=o==="absolute"?l.start:_;if(o==="sequential"&&(_+=Math.max(0,l.size)),l.code!==2&&l.code!==6)continue;const h=Bo(r,f,l.size);if(h!=null&&h.length){if(l.code===6)return h.slice();s||(s=h.slice())}}return s}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 _,l,f,h,g;const o=!t||$o((_=r.header)==null?void 0:_.ACADVER);for(const y of((f=(l=r.tables)==null?void 0:l.LAYER)==null?void 0:f.entries)??[])y.lineweight!=null&&(y.lineweight=o?gr(y.lineweight,Ht.ByLineWeightDefault):Ht.ByLineWeightDefault);const n=new Set,s=y=>{if(y)for(const P of y)n.has(P)||(n.add(P),P.lineweight!=null&&(P.lineweight=o?gr(P.lineweight):Ht.ByLayer),s(P.attribs),s(P.vertices))};s(r.entities);for(const y of((g=(h=r.tables)==null?void 0:h.BLOCK_RECORD)==null?void 0:g.entries)??[])s(y.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 s=r.slice(0,64);return/AutoCAD Binary DXF/i.test(s),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),s=o.dwg_read_data(r,n);if(s==null)throw new Error(n===mt.DXF?"Failed to read dxf data!":"Failed to read dwg data!");const _=o.convertEx(s);return Xo(o,s,_.database),Ko(o,s,_.database),Uo(_.database,n===mt.DWG),o.dwg_free(s),n===mt.DWG&&typeof r!="string"&&ko(_.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={},s=new Map,_=new Map;for(const h of o.objects.DICTIONARY??[]){const g=Ae(h.handle);g&&_.set(g,h)}const l=((f=o.tables.BLOCK_RECORD)==null?void 0:f.entries)??[];for(const h of l)for(const g of h.entities??[]){if(g.type!=="DIMENSION")continue;const y=g.styleName;if(!y||n[y]!=null)continue;const P=zo(r,t,g,_,s);P!=null&&P>0&&(n[y]=P)}Object.keys(n).length>0&&(o.dimStyleAnnotationScales=n)}function zo(r,t,o,n,s){var y,P;const _=n.get(Ae(o.ownerDictionaryHardId)),l=n.get(Ae((y=_==null?void 0:_.entries)==null?void 0:y.AcDbContextDataManager)),f=n.get(Ae((P=l==null?void 0:l.entries)==null?void 0:P.ACDB_ANNOTATIONSCALES)),h=f==null?void 0:f.entries;if(!h)return;let g;for(const p of Object.values(h)){const I=Zo(r,t,Ae(p),s);if(I==null)continue;if(Jo(r,t,Ae(p)))return I;g??(g=I)}return g}function Jo(r,t,o){const n=Wn(r,t,o);if(!n)return!1;try{const s=r.dwg_dynapi_entity_value(n,"is_default");return!!(s!=null&&s.success)&&Number(s.data)===1}catch{return!1}}function Zo(r,t,o,n){const s=Wn(r,t,o);if(s)try{const _=r.dwg_dynapi_entity_value(s,"scale");if(!(_!=null&&_.success)||_.data==null)return;const l=Ae(r.dwg_ref_get_id(_.data));if(!l)return;const f=n.get(l);if(f!=null)return f;const h=Wn(r,t,l);if(!h)return;const g=r.dwg_dynapi_entity_value(h,"paper_units"),y=r.dwg_dynapi_entity_value(h,"drawing_units");if(!(g!=null&&g.success)||!(y!=null&&y.success))return;const P=Number(g.data),p=Number(y.data);if(!(P>0)||!(p>0))return;const I=p/P;return n.set(l,I),I}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"}));
|