lineadraw 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,141 @@
1
+ // src/bridge.ts
2
+ import { existsSync, readFileSync } from "fs";
3
+ import { homedir } from "os";
4
+ import { isAbsolute, join, resolve } from "path";
5
+ var APP_ID = "com.lineadraw.desktop";
6
+ var DEFAULT_BRIDGE_PORT = 7431;
7
+ var BridgeError = class extends Error {
8
+ code;
9
+ status;
10
+ /** The rest of the error body (e.g. `candidates` for `ambiguous`). */
11
+ details;
12
+ constructor(message, opts = {}) {
13
+ super(message, { cause: opts.cause });
14
+ this.name = "BridgeError";
15
+ this.code = opts.code;
16
+ this.status = opts.status;
17
+ this.details = opts.details;
18
+ }
19
+ };
20
+ var bridgeFilePath = () => {
21
+ const home = homedir();
22
+ if (process.platform === "win32")
23
+ return join(
24
+ process.env.APPDATA ?? join(home, "AppData", "Roaming"),
25
+ APP_ID,
26
+ "bridge.json"
27
+ );
28
+ if (process.platform === "darwin")
29
+ return join(home, "Library", "Application Support", APP_ID, "bridge.json");
30
+ return join(
31
+ process.env.XDG_DATA_HOME ?? join(home, ".local", "share"),
32
+ APP_ID,
33
+ "bridge.json"
34
+ );
35
+ };
36
+ var readBridgeFile = (path) => {
37
+ if (path === false || !existsSync(path)) return {};
38
+ try {
39
+ return JSON.parse(readFileSync(path, "utf8"));
40
+ } catch {
41
+ return {};
42
+ }
43
+ };
44
+ var connectEditors = async (opts = {}) => {
45
+ const bridge = createBridge(opts);
46
+ await bridge.status();
47
+ return bridge;
48
+ };
49
+ var createBridge = (opts = {}) => {
50
+ const file = readBridgeFile(opts.bridgeFile ?? bridgeFilePath());
51
+ const port = opts.port ?? file.port ?? DEFAULT_BRIDGE_PORT;
52
+ const token = opts.token ?? process.env.LINEA_BRIDGE_TOKEN ?? file.token;
53
+ const doFetch = opts.fetch ?? fetch;
54
+ const url = `http://127.0.0.1:${port}`;
55
+ const headers = {
56
+ "content-type": "application/json"
57
+ };
58
+ if (token) headers.authorization = `Bearer ${token}`;
59
+ const request = async (method, path, body) => {
60
+ let response;
61
+ try {
62
+ response = await doFetch(`${url}${path}`, {
63
+ method,
64
+ headers,
65
+ body: body === void 0 ? void 0 : JSON.stringify(body)
66
+ });
67
+ } catch (e) {
68
+ const c = e?.cause;
69
+ const cause = c?.code ?? c?.message ?? e?.message ?? e;
70
+ throw new BridgeError(
71
+ `Nothing answers on ${url} (${cause}). Is the Linea desktop app running?`,
72
+ { code: "unreachable", cause: e }
73
+ );
74
+ }
75
+ const text = await response.text();
76
+ let parsed = text;
77
+ try {
78
+ parsed = JSON.parse(text);
79
+ } catch {
80
+ }
81
+ if (!response.ok) {
82
+ const error = parsed?.error;
83
+ const { code, message, ...details } = error ?? {};
84
+ throw new BridgeError(
85
+ typeof message === "string" ? message : `HTTP ${response.status}: ${text.slice(0, 200)}`,
86
+ {
87
+ code: typeof code === "string" ? code : void 0,
88
+ status: response.status,
89
+ details
90
+ }
91
+ );
92
+ }
93
+ return parsed;
94
+ };
95
+ const call = (operation, args = {}, o = {}) => request(
96
+ "POST",
97
+ `/api/${encodeURIComponent(operation)}${o.editor ? `?editor=${encodeURIComponent(o.editor)}` : ""}`,
98
+ args
99
+ );
100
+ const editor = (ref) => ({
101
+ ref: ref ?? "",
102
+ call: (operation, args) => call(operation, args, { editor: ref }),
103
+ runScript: (source, so = {}) => call(
104
+ "linea_run_script",
105
+ {
106
+ source,
107
+ ...so.inputs && { inputs: so.inputs },
108
+ ...so.params && { params: so.params }
109
+ },
110
+ { editor: ref }
111
+ ),
112
+ close: (co = {}) => call(
113
+ "linea_close_document",
114
+ { discard: co.discard === true },
115
+ { editor: ref }
116
+ )
117
+ });
118
+ return {
119
+ url,
120
+ status: () => request("GET", "/status"),
121
+ editors: () => request("GET", "/api/editors"),
122
+ tools: async () => (await request(
123
+ "GET",
124
+ "/api/tools"
125
+ )).tools?.map(({ name, description }) => ({ name, description })) ?? [],
126
+ open: (path) => request("POST", "/api/linea_open_editor", {
127
+ path: isAbsolute(path) ? path : resolve(path)
128
+ }),
129
+ editor,
130
+ call
131
+ };
132
+ };
133
+
134
+ export {
135
+ DEFAULT_BRIDGE_PORT,
136
+ BridgeError,
137
+ bridgeFilePath,
138
+ connectEditors,
139
+ createBridge
140
+ };
141
+ //# sourceMappingURL=chunk-L2CWZAKW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bridge.ts"],"sourcesContent":["// A client for RUNNING Linea editors: the desktop app serves the bridge on\n// 127.0.0.1:7431 (docs/desktop-bridge.md in the linea repo) and every open\n// window — plus any paired web tab — registers with it. Operations are the\n// shared `linea_*` tool catalog, each one undo step in that editor;\n// `runScript` sends a whole `defineCommand` module, which runs inside the\n// editor against the real Drawing API as ONE step and ONE round trip.\n//\n// Deliberately dependency-free (node: built-ins + fetch): the `lineadraw`\n// CLI loads it on its own (dist/bridge.js) without the rest of the SDK.\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { isAbsolute, join, resolve } from \"node:path\";\n\n/** Where the desktop app keeps its bridge settings (`bridge.json`). */\nconst APP_ID = \"com.lineadraw.desktop\";\nexport const DEFAULT_BRIDGE_PORT = 7431;\n\n/** A running editor as the bridge lists it. */\nexport interface EditorInfo {\n /** The drawing's document id — the stable way to address it. */\n id: string;\n name: string;\n /** The file it is bound to; absent for an unsaved drawing / a web tab. */\n path?: string | null;\n kind: \"desktop\" | \"web\";\n readOnly: boolean;\n /** Changed since the last file save. */\n dirty: boolean;\n}\n\n/** `GET /status`: the app's version, the bridge port, the open editors. */\nexport interface BridgeStatus {\n version: string;\n port: number;\n editors: EditorInfo[];\n}\n\nexport interface BridgeOptions {\n /** Default: bridge.json's port, else 7431. */\n port?: number;\n /** Agent token, when the app requires one. Default: LINEA_BRIDGE_TOKEN,\n * else bridge.json's token. */\n token?: string;\n /** The bridge.json to read, or `false` to read none. Default: the\n * desktop app's own (per-OS app-data folder). */\n bridgeFile?: string | false;\n /** Injected fetch (tests, proxies). Default: the global one. */\n fetch?: typeof fetch;\n}\n\n/** A bridge or editor refusal: `code` is the bridge's (`ambiguous`,\n * `noSuchEditor`, `readOnly`, `validation`, `fileNotFound`…). */\nexport class BridgeError extends Error {\n readonly code?: string;\n readonly status?: number;\n /** The rest of the error body (e.g. `candidates` for `ambiguous`). */\n readonly details?: Record<string, unknown>;\n constructor(\n message: string,\n opts: {\n code?: string;\n status?: number;\n details?: Record<string, unknown>;\n cause?: unknown;\n } = {},\n ) {\n super(message, { cause: opts.cause });\n this.name = \"BridgeError\";\n this.code = opts.code;\n this.status = opts.status;\n this.details = opts.details;\n }\n}\n\n/** The desktop app's bridge.json path on this OS. */\nexport const bridgeFilePath = (): string => {\n const home = homedir();\n if (process.platform === \"win32\")\n return join(\n process.env.APPDATA ?? join(home, \"AppData\", \"Roaming\"),\n APP_ID,\n \"bridge.json\",\n );\n if (process.platform === \"darwin\")\n return join(home, \"Library\", \"Application Support\", APP_ID, \"bridge.json\");\n return join(\n process.env.XDG_DATA_HOME ?? join(home, \".local\", \"share\"),\n APP_ID,\n \"bridge.json\",\n );\n};\n\nconst readBridgeFile = (\n path: string | false,\n): { port?: number; token?: string } => {\n if (path === false || !existsSync(path)) return {};\n try {\n return JSON.parse(readFileSync(path, \"utf8\"));\n } catch {\n return {};\n }\n};\n\n/** One editor, addressed by document id, file path or (unique) name. */\nexport interface EditorHandle {\n /** How this handle addresses the editor. */\n readonly ref: string;\n /** Run one `linea_*` operation; resolves its result. */\n call<T = unknown>(\n operation: string,\n args?: Record<string, unknown>,\n ): Promise<T>;\n /**\n * Run a `defineCommand` module inside the editor as ONE undo step —\n * loops, reads and edits against the full Drawing API, one round trip.\n * `inputs` / `params` answer the module's declared ones (the user is\n * never asked).\n */\n runScript<T = unknown>(\n source: string,\n opts?: {\n inputs?: readonly (readonly [number, number])[];\n params?: Record<string, unknown>;\n },\n ): Promise<T>;\n /** Close it like its window's x; a dirty desktop drawing is refused\n * unless `discard`. */\n close(opts?: { discard?: boolean }): Promise<unknown>;\n}\n\n/** The running app: its editors and the operations they offer. */\nexport interface LineaBridge {\n /** The bridge's address, e.g. http://127.0.0.1:7431. */\n readonly url: string;\n status(): Promise<BridgeStatus>;\n /** The open editors. */\n editors(): Promise<EditorInfo[]>;\n /** The operations the bridge offers (name + description). */\n tools(): Promise<{ name: string; description?: string }[]>;\n /** Open a `.linea` file in a window of its own (an absolute path, or one\n * relative to the current directory); resolves once it has loaded. */\n open(path: string): Promise<EditorInfo>;\n /** A handle on one editor (id, path or unique name). Omitted: the only\n * open editor — with several, calls fail as `ambiguous`. */\n editor(ref?: string): EditorHandle;\n /** One operation on an editor (`editor` as for `editor()`). */\n call<T = unknown>(\n operation: string,\n args?: Record<string, unknown>,\n opts?: { editor?: string },\n ): Promise<T>;\n}\n\n/**\n * Connect to the running Linea desktop app's bridge: reads its bridge.json\n * (port, agent token), checks that it answers, and returns the client.\n * Rejects with a BridgeError when nothing answers.\n */\nexport const connectEditors = async (\n opts: BridgeOptions = {},\n): Promise<LineaBridge> => {\n const bridge = createBridge(opts);\n await bridge.status(); // fail fast, with the \"is it running?\" message\n return bridge;\n};\n\n/** The client without the reachability check (the CLI's one-shot calls). */\nexport const createBridge = (opts: BridgeOptions = {}): LineaBridge => {\n const file = readBridgeFile(opts.bridgeFile ?? bridgeFilePath());\n const port = opts.port ?? file.port ?? DEFAULT_BRIDGE_PORT;\n const token = opts.token ?? process.env.LINEA_BRIDGE_TOKEN ?? file.token;\n const doFetch = opts.fetch ?? fetch;\n const url = `http://127.0.0.1:${port}`;\n const headers: Record<string, string> = {\n \"content-type\": \"application/json\",\n };\n if (token) headers.authorization = `Bearer ${token}`;\n\n const request = async <T>(\n method: \"GET\" | \"POST\",\n path: string,\n body?: unknown,\n ): Promise<T> => {\n let response: Response;\n try {\n response = await doFetch(`${url}${path}`, {\n method,\n headers,\n body: body === undefined ? undefined : JSON.stringify(body),\n });\n } catch (e) {\n const c = (e as { cause?: { code?: string; message?: string } })?.cause;\n const cause = c?.code ?? c?.message ?? (e as Error)?.message ?? e;\n throw new BridgeError(\n `Nothing answers on ${url} (${cause}). Is the Linea desktop app running?`,\n { code: \"unreachable\", cause: e },\n );\n }\n const text = await response.text();\n let parsed: unknown = text;\n try {\n parsed = JSON.parse(text);\n } catch {\n // not JSON: keep the text\n }\n if (!response.ok) {\n const error = (parsed as { error?: Record<string, unknown> })?.error;\n const { code, message, ...details } = error ?? {};\n throw new BridgeError(\n typeof message === \"string\"\n ? message\n : `HTTP ${response.status}: ${text.slice(0, 200)}`,\n {\n code: typeof code === \"string\" ? code : undefined,\n status: response.status,\n details,\n },\n );\n }\n return parsed as T;\n };\n\n const call = <T>(\n operation: string,\n args: Record<string, unknown> = {},\n o: { editor?: string } = {},\n ): Promise<T> =>\n request<T>(\n \"POST\",\n `/api/${encodeURIComponent(operation)}${\n o.editor ? `?editor=${encodeURIComponent(o.editor)}` : \"\"\n }`,\n args,\n );\n\n const editor = (ref?: string): EditorHandle => ({\n ref: ref ?? \"\",\n call: (operation, args) => call(operation, args, { editor: ref }),\n runScript: (source, so = {}) =>\n call(\n \"linea_run_script\",\n {\n source,\n ...(so.inputs && { inputs: so.inputs }),\n ...(so.params && { params: so.params }),\n },\n { editor: ref },\n ),\n close: (co = {}) =>\n call(\n \"linea_close_document\",\n { discard: co.discard === true },\n { editor: ref },\n ),\n });\n\n return {\n url,\n status: () => request<BridgeStatus>(\"GET\", \"/status\"),\n editors: () => request<EditorInfo[]>(\"GET\", \"/api/editors\"),\n tools: async () =>\n (\n await request<{ tools?: { name: string; description?: string }[] }>(\n \"GET\",\n \"/api/tools\",\n )\n ).tools?.map(({ name, description }) => ({ name, description })) ?? [],\n open: (path) =>\n request<EditorInfo>(\"POST\", \"/api/linea_open_editor\", {\n path: isAbsolute(path) ? path : resolve(path),\n }),\n editor,\n call,\n };\n};\n"],"mappings":";AAUA,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACx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 {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -59,6 +59,44 @@ function __wbg_get_imports() {
59
59
  __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
60
60
  const ret = Error(getStringFromWasm0(arg0, arg1));
61
61
  return addHeapObject(ret);
62
+ },
63
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
64
+ const ret = getObject(arg0) === void 0;
65
+ return ret;
66
+ },
67
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
68
+ throw new Error(getStringFromWasm0(arg0, arg1));
69
+ },
70
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
71
+ const ret = getObject(arg0).now();
72
+ return ret;
73
+ },
74
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
75
+ const ret = getObject(arg0).performance;
76
+ return addHeapObject(ret);
77
+ },
78
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
79
+ const ret = typeof global === "undefined" ? null : global;
80
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
81
+ },
82
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
83
+ const ret = typeof globalThis === "undefined" ? null : globalThis;
84
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
85
+ },
86
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
87
+ const ret = typeof self === "undefined" ? null : self;
88
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
89
+ },
90
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
91
+ const ret = typeof window === "undefined" ? null : window;
92
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
93
+ },
94
+ __wbindgen_object_clone_ref: function(arg0) {
95
+ const ret = getObject(arg0);
96
+ return addHeapObject(ret);
97
+ },
98
+ __wbindgen_object_drop_ref: function(arg0) {
99
+ takeObject(arg0);
62
100
  }
63
101
  };
64
102
  return {
@@ -252,4 +290,4 @@ var loadDwg = () => ready ??= __wbg_init({
252
290
  export {
253
291
  loadDwg
254
292
  };
255
- //# sourceMappingURL=node-2RH2EKXG.js.map
293
+ //# sourceMappingURL=node-PLO3I6OZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../dwg-wasm/node.js","../../dwg-wasm/pkg/linea_dwg.js"],"sourcesContent":["// Node entry (selected by the \"node\" export condition): fetch() can't load\n// file:// URLs, so read the wasm from disk and hand init the bytes directly.\nimport { readFileSync } from \"node:fs\";\nimport init, { dwg_to_dxf, dxf_to_dwg } from \"./pkg/linea_dwg.js\";\n\nlet ready;\n\n/** Instantiate the transcoder once; concurrent callers share the load. */\nexport const loadDwg = () =>\n (ready ??= init({\n module_or_path: readFileSync(\n new URL(\"./pkg/linea_dwg_bg.wasm\", import.meta.url),\n ),\n })\n .then(() => ({ dwg_to_dxf, dxf_to_dwg }))\n .catch((err) => {\n ready = undefined;\n throw err;\n }));\n","/* @ts-self-types=\"./linea_dwg.d.ts\" */\n\n/**\n * DWG bytes -> ASCII DXF text (feed the result to Linea's dxfToModel).\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nexport function dwg_to_dxf(bytes) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.dwg_to_dxf(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n var ptr2 = r0;\n var len2 = r1;\n if (r3) {\n ptr2 = 0; len2 = 0;\n throw takeObject(r2);\n }\n deferred3_0 = ptr2;\n deferred3_1 = len2;\n return getStringFromWasm0(ptr2, len2);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * DXF text (e.g. Linea's buildDxf output) -> DWG bytes.\n * `version` is optional: \"AC1015\" | \"AC1018\" | \"AC1021\" | \"AC1024\" |\n * \"AC1027\" | \"AC1032\"; defaults to AC1027 (AutoCAD 2013) when the DXF\n * carries no usable $ACADVER.\n * @param {string} dxf_text\n * @param {string | null} [version]\n * @returns {Uint8Array}\n */\nexport function dxf_to_dwg(dxf_text, version) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(dxf_text, wasm.__wbindgen_export, wasm.__wbindgen_export3);\n const len0 = WASM_VECTOR_LEN;\n var ptr1 = isLikeNone(version) ? 0 : passStringToWasm0(version, wasm.__wbindgen_export, wasm.__wbindgen_export3);\n var len1 = WASM_VECTOR_LEN;\n wasm.dxf_to_dwg(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v3 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export2(r0, r1 * 1, 1);\n return v3;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {\n const ret = getObject(arg0) === undefined;\n return ret;\n },\n __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_now_e7c6795a7f81e10f: function(arg0) {\n const ret = getObject(arg0).now();\n return ret;\n },\n __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {\n const ret = getObject(arg0).performance;\n return addHeapObject(ret);\n },\n __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n },\n __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n },\n __wbg_static_accessor_SELF_146583524fe1469b: function() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n },\n __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {\n const ret = typeof window === 'undefined' ? null : window;\n return isLikeNone(ret) ? 0 : addHeapObject(ret);\n },\n __wbindgen_object_clone_ref: function(arg0) {\n const ret = getObject(arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./linea_dwg_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasmInstance, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasmInstance = instance;\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('linea_dwg_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n"],"mappings":";;;AAEA,SAAS,oBAAoB;;;ACKtB,SAAS,WAAW,OAAO;AAC9B,MAAI;AACJ,MAAI;AACJ,MAAI;AACA,UAAM,SAAS,KAAK,gCAAgC,GAAG;AACvD,UAAM,OAAO,kBAAkB,OAAO,KAAK,iBAAiB;AAC5D,UAAM,OAAO;AACb,SAAK,WAAW,QAAQ,MAAM,IAAI;AAClC,QAAI,KAAK,mBAAmB,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI;AAC3D,QAAI,KAAK,mBAAmB,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI;AAC3D,QAAI,KAAK,mBAAmB,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI;AAC3D,QAAI,KAAK,mBAAmB,EAAE,SAAS,SAAS,IAAI,GAAG,IAAI;AAC3D,QAAI,OAAO;AACX,QAAI,OAAO;AACX,QAAI,IAAI;AACJ,aAAO;AAAG,aAAO;AACjB,YAAM,WAAW,EAAE;AAAA,IACv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