dellweb3 commited on
Commit
6972dac
·
verified ·
1 Parent(s): 9f5863d

Deploy browser-only DWG and 3DM reader with private-file isolation

Browse files
.dockerignore ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **
2
+ !Dockerfile
3
+ !package.json
4
+ !package-lock.json
5
+ !tsconfig.json
6
+ !vite.config.ts
7
+ !index.html
8
+ !LICENSE
9
+ !src/
10
+ !src/**
11
+ !deploy/
12
+ !deploy/serve.py
13
+ **/.local/**
14
+ **/*.[dD][wW][gG]
15
+ **/*.[dD][xX][fF]
16
+ **/*.[3][dD][mM]*
17
+ **/*.png
18
+ **/*.jpg
19
+ **/*.pdf
20
+ **/*.dpapi
21
+ **/.env*
.gitignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules/
2
+ dist/
3
+ .local/
4
+ *.log
5
+ *.dwg
6
+ *.dxf
7
+ *.[dD][wW][gG]
8
+ *.[dD][xX][fF]
9
+ *.[dD][wW][tT]
10
+ *.[dD][wW][sS]
11
+ *.[dD][wW][fF]
12
+ *.[dD][wW][lL]*
13
+ *.[bB][aA][kK]
14
+ *.sv$
15
+ *.[3][dD][mM]
16
+ *.[3][dD][mM][bB][aA][kK]
17
+ .env
18
+ .env.*
19
+ *.dpapi
20
+ *.pem
21
+ *.key
22
+ __pycache__/
23
+ *.pyc
AGENTS.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 项目约定
2
+
3
+ 项目:图阅 DWG / 3DM 阅读器。
4
+ 指定远端:https://github.com/delltom2000/dwgreadder.git。
5
+
6
+ ## 用户明确要求:防止私人图纸和信息泄露
7
+
8
+ - 用户于 2026-11-09 明确要求:DWG 等私有文件不得上传,避免泄密。此要求对后续工作持续有效。
9
+ - GitHub 仅同步程序源码、测试和通用项目文档。原始 DWG/DXF/3DM、模型与 CAD 模板/备份、图纸副本、浏览器历史内容、图纸或模型截图/预览、提取的图形数据或文字、实际项目路径、凭据和日志都留在本机,不放进提交、PR、Issue 或公开文档。
10
+ - `.local/` 存放本机资料与验收输出,必须保持忽略。测试读取用户图纸时使用忽略的本机配置,不把图纸或其提取结果做成仓库 fixture。
11
+ - 上传前运行 `npm run check:upload` 检查暂存内容,并检查 `git diff --cached --stat`。不要用 `git add -f` 绕过忽略规则。
12
+ - GitHub 凭据仅通过受限的本机认证流程使用,不把令牌放进 URL、Git 配置、源码或聊天。
13
+ - 不改变仓库可见性,不强制推送;已有远端历史必须保留。
14
+
15
+ ## 验证
16
+
17
+ 代码改动按范围运行 `npm test` / `npm run build`;浏览器读取真实图纸的验证资料仅写入 `.local/`。
18
+
19
+ ## 界面与读取方式
20
+
21
+ - 三栏布局:左侧最近打开的文件,中间图纸/模型,右侧对象目录与相关属性;左右面板均可展开、收起。
22
+ - DWG 使用二维拖动平移、滚轮缩放和对象定位。
23
+ - 3DM 使用三维旋转、平移、缩放,点击目录部件或模型几何对象自动聚焦,显示相关属性。没有名称时使用类型和序号,不虚构业务部件名称。
24
+ - 两种格式都在本机解析,3DM 依赖资源随项目构建,不从外部 CDN 加载,不追踪模型内外部资源链接。
25
+
26
+ ## HF 发布
27
+
28
+ - 用户于 2026-11-09 授权发布到既有 Space `dellweb3/dwgreader`;当前是公开 Docker Space、cpu-basic,保持配置与可见性,不升级付费硬件。
29
+ - 只部署经核对的程序源码与静态运行资源,私有图纸、模型及相关资料的禁传要求同样适用于 HF。
30
+ - Docker 构建上下文必须使用 `.dockerignore` 白名单;运行阶段仅含程序静态文件,不提供文件上传接口。
31
+ - Space 根 README 使用 `deploy/SPACE_README.md`;项目说明另存为 `PROJECT_README.md`。凭据不进入源文件、镜像或 Space Secrets。
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-alpine AS build
2
+ WORKDIR /app
3
+ COPY package.json package-lock.json ./
4
+ RUN npm ci --no-audit --no-fund
5
+ COPY tsconfig.json vite.config.ts index.html ./
6
+ COPY src ./src
7
+ RUN npm run build
8
+
9
+ FROM python:3.12-slim
10
+ RUN useradd --create-home --uid 1000 reader
11
+ WORKDIR /app
12
+ COPY --from=build /app/dist /app/site
13
+ COPY deploy/serve.py /app/serve.py
14
+ COPY LICENSE /app/LICENSE
15
+ RUN python -c "from pathlib import Path; import gzip; files=[p for p in Path('/app/site').rglob('*') if p.is_file() and p.suffix in ('.js','.css','.wasm','.html')]; [(p.with_name(p.name+'.gz').write_bytes(gzip.compress(p.read_bytes(),compresslevel=6))) for p in files]"
16
+ USER reader
17
+ ENV PORT=7860
18
+ EXPOSE 7860
19
+ CMD ["python", "-u", "/app/serve.py"]
LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
PROJECT_README.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 图阅 · DWG / 3DM 阅读器
2
+
3
+ 一个在本机运行的图纸与模型阅读器:DWG 采用二维平移缩放,Rhino 3DM 采用三维旋转、平移与部件聚焦。文件在浏览器中解析,不发送到外部服务,也不会修改原文件。
4
+
5
+ ## 启动
6
+
7
+ 需要 Node.js 20.19+ 或 22.12+。首次使用先在项目目录运行 `npm ci`。Windows 用户随后双击 **启动阅读器.cmd**,浏览器会打开 <http://127.0.0.1:5173/>。
8
+
9
+ 也可在本目录运行:
10
+
11
+ ```powershell
12
+ npm run dev
13
+ ```
14
+
15
+ 启动器仅监听 `127.0.0.1`,后台服务日志位于 `.local/server.log` 和 `.local/server-error.log`。关闭浏览器后本地服务继续运行。开发时可以在运行 `npm run dev` 的终端按 Ctrl+C 停止。
16
+
17
+ ## 三个核心功能
18
+
19
+ 1. **打开文件**:点击“打开文件”,或把 DWG / 3DM 拖入窗口。支持 100 MB 以内的文件,读取过程中可以取消。左侧列出打开过的文件,可直接重开。
20
+ 2. **查看主图或模型**:DWG 用鼠标左键拖动平移,滚轮缩放。3DM 用左键旋转,右键或 Shift 加左键拖动平移,滚轮缩放。双击或按 F / Home 显示全部。
21
+ 3. **结构定位与属性**:右侧按图层、图块/部件或文字浏览和搜索。点击目录对象自动定位并高亮;3DM 也支持直接点击模型几何对象聚焦。属性区显示文件信息,选中后显示对应的类型、图层、尺寸等。没有命名的三维对象以类型和序号标识。图层眼睛可临时隐藏图层;DWG 可切换模型/布局空间。
22
+
23
+ 界面采用三栏布局:左侧文件,中间主视图,右侧结构与属性。顶部两个面板按钮可展开、收起左右两侧,并在当前浏览器记住状态。
24
+
25
+ 快捷键:Ctrl+O 打开文件,`/` 搜索;焦点在主图时 `+` / `-` 缩放,Esc 取消图中高亮。
26
+
27
+ 界面和主图采用浅蓝色底色,原图浅色线条会自动调整为更适合浅色背景的颜色,保持可读性。
28
+
29
+ 左侧文件面板自动保存成功读取过的 DWG 和 3DM,刷新或关闭页面后可在同一浏览器、同一地址直接重新打开。历史记录使用 IndexedDB 保留文件副本,最多 10 份、合计 250 MB,超出时移除较早的记录。可单独移除或清空。历史副本反映上次读取的版本,原文件有修改时应重新选择文件;清理浏览器数据也会清除历史,浏览器存储不可用或空间不足时会提示。
30
+
31
+ 指定示例文件路径保存在被 Git 忽略的 `.local/sample-path.json` 中。双击启动器后首页可直接打开这份文件,文件本身没有复制进项目。开发终端如需同样入口,可以先设置 `$env:DWG_SAMPLE='完整DWG路径'` 再运行 `npm run dev`。
32
+
33
+ ## 读取范围与限制
34
+
35
+ DWG 支持直线、多段线及凸度圆弧、圆、圆弧、椭圆、样条曲线、文字/属性文字、嵌套图块和已有标注图块。处理图块基点、二维旋转缩放、继承图层以及标注图块插入偏移。
36
+
37
+ 3DM 显示文件内的网格、曲线、点、带显示网格的曲面/拉伸体等对象。需要浏览器支持 WebGL。部分 NURBS 曲面没有预存显示网格时无法显示,应在 Rhino 中启用保存显示网格后另存。三维目录反映文件已有对象和组合关系,不自动推断“柜门、柜体”等语义。模型的非嵌入外部纹理或环境资源不会联网读取,材质和灯光与 Rhino 的最终渲染可能不同。
38
+
39
+ - 图案填充目前显示边界;实体填充显示实心区域,多环填充的孔洞可能不精确。
40
+ - WIPEOUT 遮罩、外部图片、三维实体、自定义代理实体、布局视口的模型投影尚不支持。布局切换仅显示该布局自身的实体。缺少外部参照内容时不会自动寻找其他文件。
41
+ - 使用系统中文字体替代 CAD 的 SHX 字体,复杂多行文字的格式、宽度、字间距和线型/线宽可能与 AutoCAD 不一致。
42
+ - 解析告警和未完整显示的对象会汇总在左下角,点击状态可查看详情;不能将此版本视为 AutoCAD 的精确打印或审图替代品。
43
+
44
+ 真实图纸和模型的本机验证资料仅留在忽略目录。出现解析告警时会显示兼容提示,不能将部分读取视为完整还原。
45
+
46
+ ## 开发和验证
47
+
48
+ ```powershell
49
+ npm test
50
+ npm run build
51
+ npm run preview
52
+ ```
53
+
54
+ 几何测试覆盖嵌套图块坐标、标注偏移、模型/布局隔离、隐藏实体、循环引用及圆弧。`scripts/browser-check.mjs` 检查 DWG;`scripts/model-check.mjs` 检查 3DM 聚焦、旋转、平移、面板折叠、DWG 切换与历史重开。浏览器脚本默认使用 Playwright 的 Chromium,也可通过 `PLAYWRIGHT_EXECUTABLE_PATH` 指定浏览器;实际文件路径从忽略的 `.local/sample-path.json` / `.local/model-path.json` 读取。截图和结果仅写入 `.local/`。
55
+
56
+ 源码:`src/geometry.ts` 构建 DWG 结构和坐标;`src/parser.worker.ts` 解析 DWG;`src/viewer.ts` 绘制二维图;`src/model-viewer.ts` 读取三维模型与控制相机;`src/main.ts` 组织界面。
57
+
58
+ ## ���有资料保护
59
+
60
+ 本仓库只保存源码、测试和通用文档。DWG/DXF/3DM、模型和图纸副本、截图、提取数据、历史记录、日志与凭据均不上传。上传前运行 `npm run check:upload` 检查 Git 暂存区。该检查是额外防线,不能替代提交内容的人工核对。
61
+
62
+ ## 第三方组件与许可证
63
+
64
+ DWG 解析使用 [MLightCAD LibreDWG-Web](https://github.com/mlightcad/libredwg-web) 0.8.7(GPL-3.0),其底层为 [GNU LibreDWG](https://www.gnu.org/software/libredwg/)。本项目按 GPL-3.0-or-later 标记。Vite 使用 MIT 许可证,TypeScript 使用 Apache-2.0 许可证。重新分发时应保留对应许可证和源代码要求。
65
+
66
+ 三维渲染使用 [Three.js](https://threejs.org/) 的 Rhino3dmLoader 与 OrbitControls,3DM 解析使用 [rhino3dm](https://github.com/mcneel/rhino3dm),均为 MIT 许可证。解析用的 JS / WASM 由本机依赖构建并提供,不使用外部 CDN。
67
+
68
+ ## HF 部署
69
+
70
+ `Dockerfile` 使用 Node 构建前端,运行阶段仅提供 `dist` 的静态文件,监听 7860 端口,不提供模型上传接口。`.dockerignore` 只允许构建所需源码进入构建上下文。Space 元数据模板为 `deploy/SPACE_README.md`,上传时映射为目标 Space 的根 `README.md`,项目说明映射为 `PROJECT_README.md`。
71
+
72
+ 发布只从核对后的 Git 文件清单选取源码,不能上传整个工作目录。部署凭据与实际文件路径只在本机忽略目录或用户指定的本机位置使用,不能写入镜像、Space Secrets 或仓库。HF 上的浏览器历史与本机开发地址各自独立。
README.md CHANGED
@@ -1,12 +1,25 @@
1
  ---
2
- title: Dwgreader
3
- emoji: 🐠
4
- colorFrom: green
5
- colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
- license: mit
9
- short_description: 阅读器
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: 图阅 DWG / 3DM
3
+ emoji: 📐
4
+ colorFrom: blue
5
+ colorTo: indigo
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
+ license: gpl-3.0
10
+ short_description: 本机解析 DWG / 3DM,支持结构定位、三维旋转和部件聚焦
11
  ---
12
 
13
+ # 图阅 · DWG / 3DM 阅读器
14
+
15
+ 打开 DWG 浏览二维图纸,打开 Rhino 3DM 旋转查看三维模型。
16
+
17
+ - 左侧:最近打开的文件,可展开或收起。
18
+ - 中间:DWG 平移缩放;3DM 左键旋转、右键或 Shift 拖动平移、滚轮缩放。
19
+ - 右侧:图层、对象/部件目录和属性,可展开或收起。点击目录项目或三维几何对象自动聚焦。
20
+
21
+ **文件仅在你的浏览器中解析,不上传到此 Space 的服务器。** 最近打开记录保存于当前浏览器本机存储,可单条移除或清空。Space 不包含用户的私有图纸、模型、历史副本或截图。
22
+
23
+ 支持 100 MB 以内的 DWG / 3DM。部分 CAD 自定义对象、图案填充和没有显示网格的 Rhino 曲面可能不能完整显示;需要时请在 Rhino 中保存显示网格后另存。
24
+
25
+ 源码及构建说明:[GitHub](https://github.com/delltom2000/dwgreadder)。部署仓库包含同版程序源码与 GPL 许可证,技术说明见 `PROJECT_README.md`。
deploy/SPACE_README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: 图阅 DWG / 3DM
3
+ emoji: 📐
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ license: gpl-3.0
10
+ short_description: 本机解析 DWG / 3DM,支持结构定位、三维旋转和部件聚焦
11
+ ---
12
+
13
+ # 图阅 · DWG / 3DM 阅读器
14
+
15
+ 打开 DWG 浏览二维图纸,打开 Rhino 3DM 旋转查看三维模型。
16
+
17
+ - 左侧:最近打开的文件,可展开或收起。
18
+ - 中间:DWG 平移缩放;3DM 左键旋转、右键或 Shift 拖动平移、滚轮缩放。
19
+ - 右侧:图层、对象/部件目录和属性,可展开或收起。点击目录项目或三维几何对象自动聚焦。
20
+
21
+ **文件仅在你的浏览器中解析,不上传到此 Space 的服务器。** 最近打开记录保存于当前浏览器本机存储,可单条移除或清空。Space 不包含用户的私有图纸、模型、历史副本或截图。
22
+
23
+ 支持 100 MB 以内的 DWG / 3DM。部分 CAD 自定义对象、图案填充和没有显示网格的 Rhino 曲面可能不能完整显示;需要时请在 Rhino 中保存显示网格后另存。
24
+
25
+ 源码及构建说明:[GitHub](https://github.com/delltom2000/dwgreadder)。部署仓库包含同版程序源码与 GPL 许可证,技术说明见 `PROJECT_README.md`。
deploy/serve.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Serve bundled application assets only. There is no file-upload endpoint."""
2
+ from functools import partial
3
+ from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
4
+ from pathlib import Path
5
+ import os
6
+
7
+ SITE = Path(os.environ.get('READER_SITE', '/app/site')).resolve()
8
+
9
+ class ReaderHandler(SimpleHTTPRequestHandler):
10
+ extensions_map = {**SimpleHTTPRequestHandler.extensions_map, '.wasm': 'application/wasm', '.js': 'application/javascript'}
11
+
12
+ def list_directory(self, path):
13
+ self.send_error(404)
14
+ return None
15
+
16
+ def end_headers(self):
17
+ self.send_header('X-Content-Type-Options', 'nosniff')
18
+ self.send_header('Referrer-Policy', 'same-origin')
19
+ self.send_header('Cache-Control', 'no-cache')
20
+ super().end_headers()
21
+
22
+ def send_head(self):
23
+ path = Path(self.translate_path(self.path)).resolve()
24
+ if not path.is_relative_to(SITE):
25
+ self.send_error(404)
26
+ return None
27
+ if path.is_dir():
28
+ path = path / 'index.html'
29
+ if not path.is_file():
30
+ self.send_error(404)
31
+ return None
32
+ compressed = path.with_name(path.name + '.gz')
33
+ accepts_gzip = any(part.split(';')[0].strip() == 'gzip' and 'q=0' not in part for part in self.headers.get('Accept-Encoding', '').split(','))
34
+ use_gzip = accepts_gzip and compressed.is_file()
35
+ file = (compressed if use_gzip else path).open('rb')
36
+ self.send_response(200)
37
+ self.send_header('Content-Type', self.guess_type(str(path)))
38
+ self.send_header('Content-Length', str(os.fstat(file.fileno()).st_size))
39
+ self.send_header('Vary', 'Accept-Encoding')
40
+ if use_gzip:
41
+ self.send_header('Content-Encoding', 'gzip')
42
+ self.end_headers()
43
+ return file
44
+
45
+ if __name__ == '__main__':
46
+ server = ThreadingHTTPServer(('0.0.0.0', int(os.environ.get('PORT', '7860'))), partial(ReaderHandler, directory=str(SITE)))
47
+ print('Reader static server ready', flush=True)
48
+ server.serve_forever()
index.html ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ <!doctype html>
2
+ <html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>图阅 · DWG / 3DM 阅读器</title></head><body><div id="app"></div><script type="module" src="/src/main.ts"></script></body></html>
package-lock.json ADDED
@@ -0,0 +1,2061 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "dwgreader",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "dwgreader",
9
+ "version": "1.0.0",
10
+ "license": "GPL-3.0-or-later",
11
+ "dependencies": {
12
+ "@mlightcad/libredwg-web": "^0.8.7",
13
+ "@types/node": "^26.6.6",
14
+ "rhino3dm": "^8.35.0",
15
+ "three": "^0.187.0",
16
+ "typescript": "^7.0.2",
17
+ "vite": "^6.4.5"
18
+ },
19
+ "devDependencies": {
20
+ "@playwright/test": "^1.65.0",
21
+ "@types/three": "^0.187.0",
22
+ "tsx": "^4.23.15"
23
+ }
24
+ },
25
+ "node_modules/@dimforge/rapier3d-compat": {
26
+ "version": "0.12.0",
27
+ "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz",
28
+ "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==",
29
+ "dev": true,
30
+ "license": "Apache-2.0"
31
+ },
32
+ "node_modules/@esbuild/aix-ppc64": {
33
+ "version": "0.25.12",
34
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
35
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
36
+ "cpu": [
37
+ "ppc64"
38
+ ],
39
+ "license": "MIT",
40
+ "optional": true,
41
+ "os": [
42
+ "aix"
43
+ ],
44
+ "engines": {
45
+ "node": ">=18"
46
+ }
47
+ },
48
+ "node_modules/@esbuild/android-arm": {
49
+ "version": "0.25.12",
50
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
51
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
52
+ "cpu": [
53
+ "arm"
54
+ ],
55
+ "license": "MIT",
56
+ "optional": true,
57
+ "os": [
58
+ "android"
59
+ ],
60
+ "engines": {
61
+ "node": ">=18"
62
+ }
63
+ },
64
+ "node_modules/@esbuild/android-arm64": {
65
+ "version": "0.25.12",
66
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
67
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
68
+ "cpu": [
69
+ "arm64"
70
+ ],
71
+ "license": "MIT",
72
+ "optional": true,
73
+ "os": [
74
+ "android"
75
+ ],
76
+ "engines": {
77
+ "node": ">=18"
78
+ }
79
+ },
80
+ "node_modules/@esbuild/android-x64": {
81
+ "version": "0.25.12",
82
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
83
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
84
+ "cpu": [
85
+ "x64"
86
+ ],
87
+ "license": "MIT",
88
+ "optional": true,
89
+ "os": [
90
+ "android"
91
+ ],
92
+ "engines": {
93
+ "node": ">=18"
94
+ }
95
+ },
96
+ "node_modules/@esbuild/darwin-arm64": {
97
+ "version": "0.25.12",
98
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
99
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
100
+ "cpu": [
101
+ "arm64"
102
+ ],
103
+ "license": "MIT",
104
+ "optional": true,
105
+ "os": [
106
+ "darwin"
107
+ ],
108
+ "engines": {
109
+ "node": ">=18"
110
+ }
111
+ },
112
+ "node_modules/@esbuild/darwin-x64": {
113
+ "version": "0.25.12",
114
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
115
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
116
+ "cpu": [
117
+ "x64"
118
+ ],
119
+ "license": "MIT",
120
+ "optional": true,
121
+ "os": [
122
+ "darwin"
123
+ ],
124
+ "engines": {
125
+ "node": ">=18"
126
+ }
127
+ },
128
+ "node_modules/@esbuild/freebsd-arm64": {
129
+ "version": "0.25.12",
130
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
131
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
132
+ "cpu": [
133
+ "arm64"
134
+ ],
135
+ "license": "MIT",
136
+ "optional": true,
137
+ "os": [
138
+ "freebsd"
139
+ ],
140
+ "engines": {
141
+ "node": ">=18"
142
+ }
143
+ },
144
+ "node_modules/@esbuild/freebsd-x64": {
145
+ "version": "0.25.12",
146
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
147
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
148
+ "cpu": [
149
+ "x64"
150
+ ],
151
+ "license": "MIT",
152
+ "optional": true,
153
+ "os": [
154
+ "freebsd"
155
+ ],
156
+ "engines": {
157
+ "node": ">=18"
158
+ }
159
+ },
160
+ "node_modules/@esbuild/linux-arm": {
161
+ "version": "0.25.12",
162
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
163
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
164
+ "cpu": [
165
+ "arm"
166
+ ],
167
+ "license": "MIT",
168
+ "optional": true,
169
+ "os": [
170
+ "linux"
171
+ ],
172
+ "engines": {
173
+ "node": ">=18"
174
+ }
175
+ },
176
+ "node_modules/@esbuild/linux-arm64": {
177
+ "version": "0.25.12",
178
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
179
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
180
+ "cpu": [
181
+ "arm64"
182
+ ],
183
+ "license": "MIT",
184
+ "optional": true,
185
+ "os": [
186
+ "linux"
187
+ ],
188
+ "engines": {
189
+ "node": ">=18"
190
+ }
191
+ },
192
+ "node_modules/@esbuild/linux-ia32": {
193
+ "version": "0.25.12",
194
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
195
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
196
+ "cpu": [
197
+ "ia32"
198
+ ],
199
+ "license": "MIT",
200
+ "optional": true,
201
+ "os": [
202
+ "linux"
203
+ ],
204
+ "engines": {
205
+ "node": ">=18"
206
+ }
207
+ },
208
+ "node_modules/@esbuild/linux-loong64": {
209
+ "version": "0.25.12",
210
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
211
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
212
+ "cpu": [
213
+ "loong64"
214
+ ],
215
+ "license": "MIT",
216
+ "optional": true,
217
+ "os": [
218
+ "linux"
219
+ ],
220
+ "engines": {
221
+ "node": ">=18"
222
+ }
223
+ },
224
+ "node_modules/@esbuild/linux-mips64el": {
225
+ "version": "0.25.12",
226
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
227
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
228
+ "cpu": [
229
+ "mips64el"
230
+ ],
231
+ "license": "MIT",
232
+ "optional": true,
233
+ "os": [
234
+ "linux"
235
+ ],
236
+ "engines": {
237
+ "node": ">=18"
238
+ }
239
+ },
240
+ "node_modules/@esbuild/linux-ppc64": {
241
+ "version": "0.25.12",
242
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
243
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
244
+ "cpu": [
245
+ "ppc64"
246
+ ],
247
+ "license": "MIT",
248
+ "optional": true,
249
+ "os": [
250
+ "linux"
251
+ ],
252
+ "engines": {
253
+ "node": ">=18"
254
+ }
255
+ },
256
+ "node_modules/@esbuild/linux-riscv64": {
257
+ "version": "0.25.12",
258
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
259
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
260
+ "cpu": [
261
+ "riscv64"
262
+ ],
263
+ "license": "MIT",
264
+ "optional": true,
265
+ "os": [
266
+ "linux"
267
+ ],
268
+ "engines": {
269
+ "node": ">=18"
270
+ }
271
+ },
272
+ "node_modules/@esbuild/linux-s390x": {
273
+ "version": "0.25.12",
274
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
275
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
276
+ "cpu": [
277
+ "s390x"
278
+ ],
279
+ "license": "MIT",
280
+ "optional": true,
281
+ "os": [
282
+ "linux"
283
+ ],
284
+ "engines": {
285
+ "node": ">=18"
286
+ }
287
+ },
288
+ "node_modules/@esbuild/linux-x64": {
289
+ "version": "0.25.12",
290
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
291
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
292
+ "cpu": [
293
+ "x64"
294
+ ],
295
+ "license": "MIT",
296
+ "optional": true,
297
+ "os": [
298
+ "linux"
299
+ ],
300
+ "engines": {
301
+ "node": ">=18"
302
+ }
303
+ },
304
+ "node_modules/@esbuild/netbsd-arm64": {
305
+ "version": "0.25.12",
306
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
307
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
308
+ "cpu": [
309
+ "arm64"
310
+ ],
311
+ "license": "MIT",
312
+ "optional": true,
313
+ "os": [
314
+ "netbsd"
315
+ ],
316
+ "engines": {
317
+ "node": ">=18"
318
+ }
319
+ },
320
+ "node_modules/@esbuild/netbsd-x64": {
321
+ "version": "0.25.12",
322
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
323
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
324
+ "cpu": [
325
+ "x64"
326
+ ],
327
+ "license": "MIT",
328
+ "optional": true,
329
+ "os": [
330
+ "netbsd"
331
+ ],
332
+ "engines": {
333
+ "node": ">=18"
334
+ }
335
+ },
336
+ "node_modules/@esbuild/openbsd-arm64": {
337
+ "version": "0.25.12",
338
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
339
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
340
+ "cpu": [
341
+ "arm64"
342
+ ],
343
+ "license": "MIT",
344
+ "optional": true,
345
+ "os": [
346
+ "openbsd"
347
+ ],
348
+ "engines": {
349
+ "node": ">=18"
350
+ }
351
+ },
352
+ "node_modules/@esbuild/openbsd-x64": {
353
+ "version": "0.25.12",
354
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
355
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
356
+ "cpu": [
357
+ "x64"
358
+ ],
359
+ "license": "MIT",
360
+ "optional": true,
361
+ "os": [
362
+ "openbsd"
363
+ ],
364
+ "engines": {
365
+ "node": ">=18"
366
+ }
367
+ },
368
+ "node_modules/@esbuild/openharmony-arm64": {
369
+ "version": "0.25.12",
370
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
371
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
372
+ "cpu": [
373
+ "arm64"
374
+ ],
375
+ "license": "MIT",
376
+ "optional": true,
377
+ "os": [
378
+ "openharmony"
379
+ ],
380
+ "engines": {
381
+ "node": ">=18"
382
+ }
383
+ },
384
+ "node_modules/@esbuild/sunos-x64": {
385
+ "version": "0.25.12",
386
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
387
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
388
+ "cpu": [
389
+ "x64"
390
+ ],
391
+ "license": "MIT",
392
+ "optional": true,
393
+ "os": [
394
+ "sunos"
395
+ ],
396
+ "engines": {
397
+ "node": ">=18"
398
+ }
399
+ },
400
+ "node_modules/@esbuild/win32-arm64": {
401
+ "version": "0.25.12",
402
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
403
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
404
+ "cpu": [
405
+ "arm64"
406
+ ],
407
+ "license": "MIT",
408
+ "optional": true,
409
+ "os": [
410
+ "win32"
411
+ ],
412
+ "engines": {
413
+ "node": ">=18"
414
+ }
415
+ },
416
+ "node_modules/@esbuild/win32-ia32": {
417
+ "version": "0.25.12",
418
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
419
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
420
+ "cpu": [
421
+ "ia32"
422
+ ],
423
+ "license": "MIT",
424
+ "optional": true,
425
+ "os": [
426
+ "win32"
427
+ ],
428
+ "engines": {
429
+ "node": ">=18"
430
+ }
431
+ },
432
+ "node_modules/@esbuild/win32-x64": {
433
+ "version": "0.25.12",
434
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
435
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
436
+ "cpu": [
437
+ "x64"
438
+ ],
439
+ "license": "MIT",
440
+ "optional": true,
441
+ "os": [
442
+ "win32"
443
+ ],
444
+ "engines": {
445
+ "node": ">=18"
446
+ }
447
+ },
448
+ "node_modules/@mlightcad/libredwg-web": {
449
+ "version": "0.8.7",
450
+ "resolved": "https://registry.npmjs.org/@mlightcad/libredwg-web/-/libredwg-web-0.8.7.tgz",
451
+ "integrity": "sha512-vVAHQLv6K2Q1dBOM8UI1YcdU8JFmHQ5tW4nwbMlhyuZyRXORTxsFyz9590CRKEFaFBqkUjymFf5lTA1CqEJHyw==",
452
+ "license": "GPL-3.0",
453
+ "engines": {
454
+ "node": ">=20"
455
+ }
456
+ },
457
+ "node_modules/@playwright/test": {
458
+ "version": "1.65.0",
459
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.0.tgz",
460
+ "integrity": "sha512-iGURLGuKDLakSEl7Pgfv8h7f+XLT+V861Wfhz0zlEl5nyFuKUopdkFBPKqTllTUp06aOwPuH8iuUEb3yp3MpbQ==",
461
+ "dev": true,
462
+ "license": "Apache-2.0",
463
+ "dependencies": {
464
+ "playwright": "1.65.0"
465
+ },
466
+ "bin": {
467
+ "playwright": "cli.js"
468
+ },
469
+ "engines": {
470
+ "node": ">=20"
471
+ }
472
+ },
473
+ "node_modules/@rollup/rollup-android-arm-eabi": {
474
+ "version": "4.68.0",
475
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.68.0.tgz",
476
+ "integrity": "sha512-Ta2n0ntLfzP0LqwwcXOIh2z0mnHjlxMS+h4Y9lo+w33Quyf9KFKEi9QZ2IKqeEBKr0qxNpXc/DQjz5KVIs8AEA==",
477
+ "cpu": [
478
+ "arm"
479
+ ],
480
+ "license": "MIT",
481
+ "optional": true,
482
+ "os": [
483
+ "android"
484
+ ]
485
+ },
486
+ "node_modules/@rollup/rollup-android-arm64": {
487
+ "version": "4.68.0",
488
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.68.0.tgz",
489
+ "integrity": "sha512-iFDtS0oMaBvKbtrRKXmRcBSsI0UaWL2bWpd62iHzb0A8RSPrVz47mUGE0CfrrD0c/7/7dUhNtoN3cc6aEUn1Ow==",
490
+ "cpu": [
491
+ "arm64"
492
+ ],
493
+ "license": "MIT",
494
+ "optional": true,
495
+ "os": [
496
+ "android"
497
+ ]
498
+ },
499
+ "node_modules/@rollup/rollup-android-x64": {
500
+ "version": "4.68.0",
501
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-x64/-/rollup-android-x64-4.68.0.tgz",
502
+ "integrity": "sha512-OnYETr+cZYSbesBD1tCvUjrBUTkjSaOcewRUoIHqD0XI3yn5i9WpdFaE3LZwrMlq0yeJNU0N5sxfHK/fNVMqlQ==",
503
+ "cpu": [
504
+ "x64"
505
+ ],
506
+ "license": "MIT",
507
+ "optional": true,
508
+ "os": [
509
+ "android"
510
+ ]
511
+ },
512
+ "node_modules/@rollup/rollup-darwin-arm64": {
513
+ "version": "4.68.0",
514
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.68.0.tgz",
515
+ "integrity": "sha512-2qavWZtFeon/6oMkjsBF3OH7ENKgRTW4xRTwmz9VJeNUYhmPitpR9Jd4sAAc2OZJryHs2neoovMTCYnNvhvANQ==",
516
+ "cpu": [
517
+ "arm64"
518
+ ],
519
+ "license": "MIT",
520
+ "optional": true,
521
+ "os": [
522
+ "darwin"
523
+ ]
524
+ },
525
+ "node_modules/@rollup/rollup-darwin-x64": {
526
+ "version": "4.68.0",
527
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.68.0.tgz",
528
+ "integrity": "sha512-QpgJO+GwNQDPt6uYcFSjZTFVyHNIeumN2am7RISDR9Nf3e/h8sur9cIfplPGihZPUn+sTw9j3JErZIUkHg8+Pw==",
529
+ "cpu": [
530
+ "x64"
531
+ ],
532
+ "license": "MIT",
533
+ "optional": true,
534
+ "os": [
535
+ "darwin"
536
+ ]
537
+ },
538
+ "node_modules/@rollup/rollup-freebsd-arm64": {
539
+ "version": "4.68.0",
540
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.68.0.tgz",
541
+ "integrity": "sha512-TERqEn6P9bp4lsTyoFjT3nLKV6G++76HhGb4k6dRGcs+jvhVcTGaS2zkeRdLLRjwKxpBtdCZe11kUQ2hNGgFSA==",
542
+ "cpu": [
543
+ "arm64"
544
+ ],
545
+ "license": "MIT",
546
+ "optional": true,
547
+ "os": [
548
+ "freebsd"
549
+ ]
550
+ },
551
+ "node_modules/@rollup/rollup-freebsd-x64": {
552
+ "version": "4.68.0",
553
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.68.0.tgz",
554
+ "integrity": "sha512-RBjDrqb7h5l6Xgdgz5eKYvbpnUkii/z5ejWuZmHJsXORi0X0tTtFzEEgJj2DX995kW18c6T9LGFn/deEAMXDcQ==",
555
+ "cpu": [
556
+ "x64"
557
+ ],
558
+ "license": "MIT",
559
+ "optional": true,
560
+ "os": [
561
+ "freebsd"
562
+ ]
563
+ },
564
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
565
+ "version": "4.68.0",
566
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.68.0.tgz",
567
+ "integrity": "sha512-HtLgXBqjF1Ampt9eJjzSmoGDvNb4LP8Y2aPXQZeQ5qhyExXLmoXJB9Jfm/nPi/8fJ3UFn4sZ7pQKyr8V+oTN8g==",
568
+ "cpu": [
569
+ "arm"
570
+ ],
571
+ "license": "MIT",
572
+ "optional": true,
573
+ "os": [
574
+ "linux"
575
+ ]
576
+ },
577
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
578
+ "version": "4.68.0",
579
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.68.0.tgz",
580
+ "integrity": "sha512-q51xJyqjaqCNtDjYD7xNVwsPa2TcVfAIBeP6E20wicKZ6XYp8Taz9SUPYhIENojAQIAoV7cO3mUdMUgWYEAuhQ==",
581
+ "cpu": [
582
+ "arm"
583
+ ],
584
+ "license": "MIT",
585
+ "optional": true,
586
+ "os": [
587
+ "linux"
588
+ ]
589
+ },
590
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
591
+ "version": "4.68.0",
592
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.68.0.tgz",
593
+ "integrity": "sha512-wejnVabl92oFC/o4sr/EEJuJZMHtMq4C+LBIPphN4EUiVHe9qvZNw+biqhVHpX2ggs1+Z3ugXGwJxT+qhyaaYQ==",
594
+ "cpu": [
595
+ "arm64"
596
+ ],
597
+ "license": "MIT",
598
+ "optional": true,
599
+ "os": [
600
+ "linux"
601
+ ]
602
+ },
603
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
604
+ "version": "4.68.0",
605
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.68.0.tgz",
606
+ "integrity": "sha512-tyu+hrsCWHHqV6+2tligV/recJH+HVvNV2Sp4nS1C+MKQPkNXRovKIzyHy0V0xXjm6igCLgsT2vTky5CvWP37g==",
607
+ "cpu": [
608
+ "arm64"
609
+ ],
610
+ "license": "MIT",
611
+ "optional": true,
612
+ "os": [
613
+ "linux"
614
+ ]
615
+ },
616
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
617
+ "version": "4.68.0",
618
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.68.0.tgz",
619
+ "integrity": "sha512-5gjJNglKDfgs3OmnGi/RVZQPhEfRoCIHxwSAP9ngmdnxreu0Vl9lI4gxmFBXOhKdftpS82xRdc/7Dp5/A1F0qg==",
620
+ "cpu": [
621
+ "loong64"
622
+ ],
623
+ "license": "MIT",
624
+ "optional": true,
625
+ "os": [
626
+ "linux"
627
+ ]
628
+ },
629
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
630
+ "version": "4.68.0",
631
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.68.0.tgz",
632
+ "integrity": "sha512-2IBxTUds33rFYwOIEyf77wfW8WQThwiQQ1ofXSraZQG7PiIq7BnQBf/ge0qEI/Ny/2cSc7SKkGO/wUDqmYXqTg==",
633
+ "cpu": [
634
+ "loong64"
635
+ ],
636
+ "license": "MIT",
637
+ "optional": true,
638
+ "os": [
639
+ "linux"
640
+ ]
641
+ },
642
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
643
+ "version": "4.68.0",
644
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.68.0.tgz",
645
+ "integrity": "sha512-mE/Pj2PPTZIVHkNNuHq+eYoU3td8LCm73zjrXoBWkNlnuULJS2l/fxwgGPpN4WUCNZgKZ1IXwrnnETPyOcWPmg==",
646
+ "cpu": [
647
+ "ppc64"
648
+ ],
649
+ "license": "MIT",
650
+ "optional": true,
651
+ "os": [
652
+ "linux"
653
+ ]
654
+ },
655
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
656
+ "version": "4.68.0",
657
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.68.0.tgz",
658
+ "integrity": "sha512-dYuykUkAiTv+RQdP3Ib47XcFiImkBWiRpTGSQWAMfZPQyoQYGe8Je4IUeZYNUQWIojmRCUnt5xsH4BbUb2uqSw==",
659
+ "cpu": [
660
+ "ppc64"
661
+ ],
662
+ "license": "MIT",
663
+ "optional": true,
664
+ "os": [
665
+ "linux"
666
+ ]
667
+ },
668
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
669
+ "version": "4.68.0",
670
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.68.0.tgz",
671
+ "integrity": "sha512-OnPDDFXLqJewY56T6ow8sA4wuzbqlliD7QJgkrx2KX+pWOpjI3usYXgB0pwK3nsgTF2odCw9IuJs0Uis/jy2qA==",
672
+ "cpu": [
673
+ "riscv64"
674
+ ],
675
+ "license": "MIT",
676
+ "optional": true,
677
+ "os": [
678
+ "linux"
679
+ ]
680
+ },
681
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
682
+ "version": "4.68.0",
683
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.68.0.tgz",
684
+ "integrity": "sha512-CqoQf06cK0brrRfDqH7Mt8G4MdteFGbjBdC61zEMaSVna6xo6QMUixa9bAkAD4a92g3ElPbQAkLMUzdf+Lk8dg==",
685
+ "cpu": [
686
+ "riscv64"
687
+ ],
688
+ "license": "MIT",
689
+ "optional": true,
690
+ "os": [
691
+ "linux"
692
+ ]
693
+ },
694
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
695
+ "version": "4.68.0",
696
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.68.0.tgz",
697
+ "integrity": "sha512-LPHNmE8GwiyELGLUTkqj4zsP1YEHzGdtwnKxAcdP/swsNxXsfxPtpe5nrD/KGxr136xPB+eWv2r/SGj9md0pnQ==",
698
+ "cpu": [
699
+ "s390x"
700
+ ],
701
+ "license": "MIT",
702
+ "optional": true,
703
+ "os": [
704
+ "linux"
705
+ ]
706
+ },
707
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
708
+ "version": "4.68.0",
709
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.68.0.tgz",
710
+ "integrity": "sha512-GDOmvgephpRCNyNGRQOZh0KD2gTyRVM1Bb1iOo759xeCUpCAoRCmJioOOSu2MwyWfNOocGd0V5I9vYLfteC6/A==",
711
+ "cpu": [
712
+ "x64"
713
+ ],
714
+ "license": "MIT",
715
+ "optional": true,
716
+ "os": [
717
+ "linux"
718
+ ]
719
+ },
720
+ "node_modules/@rollup/rollup-linux-x64-musl": {
721
+ "version": "4.68.0",
722
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.68.0.tgz",
723
+ "integrity": "sha512-HADRxkvl5eg3hbemCmv81UwTfdQy/CiSJDOabLE+p5tpm3OTjuRtzpLXy5zPfGY9FQD4Qv7qHptXmG/YjmNmyw==",
724
+ "cpu": [
725
+ "x64"
726
+ ],
727
+ "license": "MIT",
728
+ "optional": true,
729
+ "os": [
730
+ "linux"
731
+ ]
732
+ },
733
+ "node_modules/@rollup/rollup-openbsd-x64": {
734
+ "version": "4.68.0",
735
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.68.0.tgz",
736
+ "integrity": "sha512-iERrpqu1VEfyX736HLKiXRbwGDkCV/iybARY/mn14KcI6oKhJGBx1e+bU+g+umTKghtiGSPaHkwwpII4/N3RjA==",
737
+ "cpu": [
738
+ "x64"
739
+ ],
740
+ "license": "MIT",
741
+ "optional": true,
742
+ "os": [
743
+ "openbsd"
744
+ ]
745
+ },
746
+ "node_modules/@rollup/rollup-openharmony-arm64": {
747
+ "version": "4.68.0",
748
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.68.0.tgz",
749
+ "integrity": "sha512-hBn57IqAbpXpyktckonwePTaFOQS6THph8ZnpRO3eZHY4LncuZGjSsseigBnKuSMKKpLnJJ7PemDvXEzniXC+A==",
750
+ "cpu": [
751
+ "arm64"
752
+ ],
753
+ "license": "MIT",
754
+ "optional": true,
755
+ "os": [
756
+ "openharmony"
757
+ ]
758
+ },
759
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
760
+ "version": "4.68.0",
761
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.68.0.tgz",
762
+ "integrity": "sha512-pJWb7mIw9Z25Hl3Q6nHFjl7AnczfOpm2gbOFYguSRv6TiH7DzsoAk/thymb/URSQu9OUEK7uaDMC5Xfm+7TAww==",
763
+ "cpu": [
764
+ "arm64"
765
+ ],
766
+ "license": "MIT",
767
+ "optional": true,
768
+ "os": [
769
+ "win32"
770
+ ]
771
+ },
772
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
773
+ "version": "4.68.0",
774
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.68.0.tgz",
775
+ "integrity": "sha512-pnrhmoyF2otH2Mezol14/ELUFGuRddOCz6+I+J0pq2Itnp4UxkjABQcXawCNMaKNsCRiuL90BtNzbEd0fHjpIg==",
776
+ "cpu": [
777
+ "ia32"
778
+ ],
779
+ "license": "MIT",
780
+ "optional": true,
781
+ "os": [
782
+ "win32"
783
+ ]
784
+ },
785
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
786
+ "version": "4.68.0",
787
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.68.0.tgz",
788
+ "integrity": "sha512-1dJ3U+ktdtaIdPaOZKwIX57+bKQk4iAjs5M1wQWLKRB6Wglp98qf8LUeuN4u6bGlIYouZKaySZJ5Qd4OalUMnA==",
789
+ "cpu": [
790
+ "x64"
791
+ ],
792
+ "license": "MIT",
793
+ "optional": true,
794
+ "os": [
795
+ "win32"
796
+ ]
797
+ },
798
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
799
+ "version": "4.68.0",
800
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.68.0.tgz",
801
+ "integrity": "sha512-e/NRJFl48wL5DFNSzQrvm4kaB5dzNNmqWjIJ6And2Sjuw4klO3w3TXMvCAEF1tHTrQQgpOD4QVkBE/92/yBGrQ==",
802
+ "cpu": [
803
+ "x64"
804
+ ],
805
+ "license": "MIT",
806
+ "optional": true,
807
+ "os": [
808
+ "win32"
809
+ ]
810
+ },
811
+ "node_modules/@tweenjs/tween.js": {
812
+ "version": "23.1.3",
813
+ "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz",
814
+ "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==",
815
+ "dev": true,
816
+ "license": "MIT"
817
+ },
818
+ "node_modules/@types/estree": {
819
+ "version": "1.0.10",
820
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz",
821
+ "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==",
822
+ "license": "MIT"
823
+ },
824
+ "node_modules/@types/node": {
825
+ "version": "26.6.6",
826
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz",
827
+ "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==",
828
+ "license": "MIT",
829
+ "dependencies": {
830
+ "undici-types": "~8.9.0"
831
+ }
832
+ },
833
+ "node_modules/@types/stats.js": {
834
+ "version": "0.17.4",
835
+ "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz",
836
+ "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==",
837
+ "dev": true,
838
+ "license": "MIT"
839
+ },
840
+ "node_modules/@types/three": {
841
+ "version": "0.187.0",
842
+ "resolved": "https://registry.npmjs.org/@types/three/-/three-0.187.0.tgz",
843
+ "integrity": "sha512-v+vKNarUtk4n2QRZ4+CN5ygMM0ARUjXjIQl0R/unMUfmStFeVqGbgqarbrpoGTXRZoulSH16ePrVJVxPJEbMUA==",
844
+ "dev": true,
845
+ "license": "MIT",
846
+ "dependencies": {
847
+ "@dimforge/rapier3d-compat": "~0.12.0",
848
+ "@tweenjs/tween.js": "~23.1.3",
849
+ "@types/stats.js": "*",
850
+ "@types/webxr": ">=0.5.17",
851
+ "fflate": "~0.8.3",
852
+ "meshoptimizer": "~1.1.1"
853
+ }
854
+ },
855
+ "node_modules/@types/webxr": {
856
+ "version": "0.5.24",
857
+ "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz",
858
+ "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==",
859
+ "dev": true,
860
+ "license": "MIT"
861
+ },
862
+ "node_modules/@typescript/typescript-aix-ppc64": {
863
+ "version": "7.0.2",
864
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
865
+ "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
866
+ "cpu": [
867
+ "ppc64"
868
+ ],
869
+ "license": "Apache-2.0",
870
+ "optional": true,
871
+ "os": [
872
+ "aix"
873
+ ],
874
+ "engines": {
875
+ "node": ">=16.20.0"
876
+ }
877
+ },
878
+ "node_modules/@typescript/typescript-darwin-arm64": {
879
+ "version": "7.0.2",
880
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
881
+ "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
882
+ "cpu": [
883
+ "arm64"
884
+ ],
885
+ "license": "Apache-2.0",
886
+ "optional": true,
887
+ "os": [
888
+ "darwin"
889
+ ],
890
+ "engines": {
891
+ "node": ">=16.20.0"
892
+ }
893
+ },
894
+ "node_modules/@typescript/typescript-darwin-x64": {
895
+ "version": "7.0.2",
896
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
897
+ "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
898
+ "cpu": [
899
+ "x64"
900
+ ],
901
+ "license": "Apache-2.0",
902
+ "optional": true,
903
+ "os": [
904
+ "darwin"
905
+ ],
906
+ "engines": {
907
+ "node": ">=16.20.0"
908
+ }
909
+ },
910
+ "node_modules/@typescript/typescript-freebsd-arm64": {
911
+ "version": "7.0.2",
912
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
913
+ "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
914
+ "cpu": [
915
+ "arm64"
916
+ ],
917
+ "license": "Apache-2.0",
918
+ "optional": true,
919
+ "os": [
920
+ "freebsd"
921
+ ],
922
+ "engines": {
923
+ "node": ">=16.20.0"
924
+ }
925
+ },
926
+ "node_modules/@typescript/typescript-freebsd-x64": {
927
+ "version": "7.0.2",
928
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
929
+ "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
930
+ "cpu": [
931
+ "x64"
932
+ ],
933
+ "license": "Apache-2.0",
934
+ "optional": true,
935
+ "os": [
936
+ "freebsd"
937
+ ],
938
+ "engines": {
939
+ "node": ">=16.20.0"
940
+ }
941
+ },
942
+ "node_modules/@typescript/typescript-linux-arm": {
943
+ "version": "7.0.2",
944
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
945
+ "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
946
+ "cpu": [
947
+ "arm"
948
+ ],
949
+ "license": "Apache-2.0",
950
+ "optional": true,
951
+ "os": [
952
+ "linux"
953
+ ],
954
+ "engines": {
955
+ "node": ">=16.20.0"
956
+ }
957
+ },
958
+ "node_modules/@typescript/typescript-linux-arm64": {
959
+ "version": "7.0.2",
960
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
961
+ "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
962
+ "cpu": [
963
+ "arm64"
964
+ ],
965
+ "license": "Apache-2.0",
966
+ "optional": true,
967
+ "os": [
968
+ "linux"
969
+ ],
970
+ "engines": {
971
+ "node": ">=16.20.0"
972
+ }
973
+ },
974
+ "node_modules/@typescript/typescript-linux-loong64": {
975
+ "version": "7.0.2",
976
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
977
+ "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
978
+ "cpu": [
979
+ "loong64"
980
+ ],
981
+ "license": "Apache-2.0",
982
+ "optional": true,
983
+ "os": [
984
+ "linux"
985
+ ],
986
+ "engines": {
987
+ "node": ">=16.20.0"
988
+ }
989
+ },
990
+ "node_modules/@typescript/typescript-linux-mips64el": {
991
+ "version": "7.0.2",
992
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
993
+ "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
994
+ "cpu": [
995
+ "mips64el"
996
+ ],
997
+ "license": "Apache-2.0",
998
+ "optional": true,
999
+ "os": [
1000
+ "linux"
1001
+ ],
1002
+ "engines": {
1003
+ "node": ">=16.20.0"
1004
+ }
1005
+ },
1006
+ "node_modules/@typescript/typescript-linux-ppc64": {
1007
+ "version": "7.0.2",
1008
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
1009
+ "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
1010
+ "cpu": [
1011
+ "ppc64"
1012
+ ],
1013
+ "license": "Apache-2.0",
1014
+ "optional": true,
1015
+ "os": [
1016
+ "linux"
1017
+ ],
1018
+ "engines": {
1019
+ "node": ">=16.20.0"
1020
+ }
1021
+ },
1022
+ "node_modules/@typescript/typescript-linux-riscv64": {
1023
+ "version": "7.0.2",
1024
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
1025
+ "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
1026
+ "cpu": [
1027
+ "riscv64"
1028
+ ],
1029
+ "license": "Apache-2.0",
1030
+ "optional": true,
1031
+ "os": [
1032
+ "linux"
1033
+ ],
1034
+ "engines": {
1035
+ "node": ">=16.20.0"
1036
+ }
1037
+ },
1038
+ "node_modules/@typescript/typescript-linux-s390x": {
1039
+ "version": "7.0.2",
1040
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
1041
+ "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
1042
+ "cpu": [
1043
+ "s390x"
1044
+ ],
1045
+ "license": "Apache-2.0",
1046
+ "optional": true,
1047
+ "os": [
1048
+ "linux"
1049
+ ],
1050
+ "engines": {
1051
+ "node": ">=16.20.0"
1052
+ }
1053
+ },
1054
+ "node_modules/@typescript/typescript-linux-x64": {
1055
+ "version": "7.0.2",
1056
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
1057
+ "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
1058
+ "cpu": [
1059
+ "x64"
1060
+ ],
1061
+ "license": "Apache-2.0",
1062
+ "optional": true,
1063
+ "os": [
1064
+ "linux"
1065
+ ],
1066
+ "engines": {
1067
+ "node": ">=16.20.0"
1068
+ }
1069
+ },
1070
+ "node_modules/@typescript/typescript-netbsd-arm64": {
1071
+ "version": "7.0.2",
1072
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
1073
+ "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
1074
+ "cpu": [
1075
+ "arm64"
1076
+ ],
1077
+ "license": "Apache-2.0",
1078
+ "optional": true,
1079
+ "os": [
1080
+ "netbsd"
1081
+ ],
1082
+ "engines": {
1083
+ "node": ">=16.20.0"
1084
+ }
1085
+ },
1086
+ "node_modules/@typescript/typescript-netbsd-x64": {
1087
+ "version": "7.0.2",
1088
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
1089
+ "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
1090
+ "cpu": [
1091
+ "x64"
1092
+ ],
1093
+ "license": "Apache-2.0",
1094
+ "optional": true,
1095
+ "os": [
1096
+ "netbsd"
1097
+ ],
1098
+ "engines": {
1099
+ "node": ">=16.20.0"
1100
+ }
1101
+ },
1102
+ "node_modules/@typescript/typescript-openbsd-arm64": {
1103
+ "version": "7.0.2",
1104
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
1105
+ "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
1106
+ "cpu": [
1107
+ "arm64"
1108
+ ],
1109
+ "license": "Apache-2.0",
1110
+ "optional": true,
1111
+ "os": [
1112
+ "openbsd"
1113
+ ],
1114
+ "engines": {
1115
+ "node": ">=16.20.0"
1116
+ }
1117
+ },
1118
+ "node_modules/@typescript/typescript-openbsd-x64": {
1119
+ "version": "7.0.2",
1120
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
1121
+ "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
1122
+ "cpu": [
1123
+ "x64"
1124
+ ],
1125
+ "license": "Apache-2.0",
1126
+ "optional": true,
1127
+ "os": [
1128
+ "openbsd"
1129
+ ],
1130
+ "engines": {
1131
+ "node": ">=16.20.0"
1132
+ }
1133
+ },
1134
+ "node_modules/@typescript/typescript-sunos-x64": {
1135
+ "version": "7.0.2",
1136
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
1137
+ "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
1138
+ "cpu": [
1139
+ "x64"
1140
+ ],
1141
+ "license": "Apache-2.0",
1142
+ "optional": true,
1143
+ "os": [
1144
+ "sunos"
1145
+ ],
1146
+ "engines": {
1147
+ "node": ">=16.20.0"
1148
+ }
1149
+ },
1150
+ "node_modules/@typescript/typescript-win32-arm64": {
1151
+ "version": "7.0.2",
1152
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
1153
+ "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
1154
+ "cpu": [
1155
+ "arm64"
1156
+ ],
1157
+ "license": "Apache-2.0",
1158
+ "optional": true,
1159
+ "os": [
1160
+ "win32"
1161
+ ],
1162
+ "engines": {
1163
+ "node": ">=16.20.0"
1164
+ }
1165
+ },
1166
+ "node_modules/@typescript/typescript-win32-x64": {
1167
+ "version": "7.0.2",
1168
+ "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
1169
+ "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
1170
+ "cpu": [
1171
+ "x64"
1172
+ ],
1173
+ "license": "Apache-2.0",
1174
+ "optional": true,
1175
+ "os": [
1176
+ "win32"
1177
+ ],
1178
+ "engines": {
1179
+ "node": ">=16.20.0"
1180
+ }
1181
+ },
1182
+ "node_modules/esbuild": {
1183
+ "version": "0.25.12",
1184
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
1185
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
1186
+ "hasInstallScript": true,
1187
+ "license": "MIT",
1188
+ "bin": {
1189
+ "esbuild": "bin/esbuild"
1190
+ },
1191
+ "engines": {
1192
+ "node": ">=18"
1193
+ },
1194
+ "optionalDependencies": {
1195
+ "@esbuild/aix-ppc64": "0.25.12",
1196
+ "@esbuild/android-arm": "0.25.12",
1197
+ "@esbuild/android-arm64": "0.25.12",
1198
+ "@esbuild/android-x64": "0.25.12",
1199
+ "@esbuild/darwin-arm64": "0.25.12",
1200
+ "@esbuild/darwin-x64": "0.25.12",
1201
+ "@esbuild/freebsd-arm64": "0.25.12",
1202
+ "@esbuild/freebsd-x64": "0.25.12",
1203
+ "@esbuild/linux-arm": "0.25.12",
1204
+ "@esbuild/linux-arm64": "0.25.12",
1205
+ "@esbuild/linux-ia32": "0.25.12",
1206
+ "@esbuild/linux-loong64": "0.25.12",
1207
+ "@esbuild/linux-mips64el": "0.25.12",
1208
+ "@esbuild/linux-ppc64": "0.25.12",
1209
+ "@esbuild/linux-riscv64": "0.25.12",
1210
+ "@esbuild/linux-s390x": "0.25.12",
1211
+ "@esbuild/linux-x64": "0.25.12",
1212
+ "@esbuild/netbsd-arm64": "0.25.12",
1213
+ "@esbuild/netbsd-x64": "0.25.12",
1214
+ "@esbuild/openbsd-arm64": "0.25.12",
1215
+ "@esbuild/openbsd-x64": "0.25.12",
1216
+ "@esbuild/openharmony-arm64": "0.25.12",
1217
+ "@esbuild/sunos-x64": "0.25.12",
1218
+ "@esbuild/win32-arm64": "0.25.12",
1219
+ "@esbuild/win32-ia32": "0.25.12",
1220
+ "@esbuild/win32-x64": "0.25.12"
1221
+ }
1222
+ },
1223
+ "node_modules/fdir": {
1224
+ "version": "6.5.0",
1225
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
1226
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
1227
+ "license": "MIT",
1228
+ "engines": {
1229
+ "node": ">=12.0.0"
1230
+ },
1231
+ "peerDependencies": {
1232
+ "picomatch": "^3 || ^4"
1233
+ },
1234
+ "peerDependenciesMeta": {
1235
+ "picomatch": {
1236
+ "optional": true
1237
+ }
1238
+ }
1239
+ },
1240
+ "node_modules/fflate": {
1241
+ "version": "0.8.3",
1242
+ "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
1243
+ "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
1244
+ "dev": true,
1245
+ "license": "MIT"
1246
+ },
1247
+ "node_modules/fsevents": {
1248
+ "version": "2.3.3",
1249
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
1250
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
1251
+ "hasInstallScript": true,
1252
+ "license": "MIT",
1253
+ "optional": true,
1254
+ "os": [
1255
+ "darwin"
1256
+ ],
1257
+ "engines": {
1258
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
1259
+ }
1260
+ },
1261
+ "node_modules/meshoptimizer": {
1262
+ "version": "1.1.1",
1263
+ "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.1.1.tgz",
1264
+ "integrity": "sha512-oRFNWJRDA/WTrVj7NWvqa5HqE1t9MYDj2VaWirQCzCCrAd2GHrqR/sQezCxiWATPNlKTcRaPRHPJwIRoPBAp5g==",
1265
+ "dev": true,
1266
+ "license": "MIT"
1267
+ },
1268
+ "node_modules/nanoid": {
1269
+ "version": "3.3.20",
1270
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
1271
+ "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==",
1272
+ "funding": [
1273
+ {
1274
+ "type": "github",
1275
+ "url": "https://github.com/sponsors/ai"
1276
+ }
1277
+ ],
1278
+ "license": "MIT",
1279
+ "bin": {
1280
+ "nanoid": "bin/nanoid.cjs"
1281
+ },
1282
+ "engines": {
1283
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
1284
+ }
1285
+ },
1286
+ "node_modules/picocolors": {
1287
+ "version": "1.1.1",
1288
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
1289
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
1290
+ "license": "ISC"
1291
+ },
1292
+ "node_modules/picomatch": {
1293
+ "version": "4.0.7",
1294
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
1295
+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
1296
+ "license": "MIT",
1297
+ "engines": {
1298
+ "node": ">=12"
1299
+ },
1300
+ "funding": {
1301
+ "url": "https://github.com/sponsors/jonschlinkert"
1302
+ }
1303
+ },
1304
+ "node_modules/playwright": {
1305
+ "version": "1.65.0",
1306
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.0.tgz",
1307
+ "integrity": "sha512-F3AMWcR44qMBt4kq+6Kb6mX7bjGXshktKFOPULd7reED6ZJWevjbNRqysP7q+AATE9kdPEZBibex1BYsvpVoeA==",
1308
+ "dev": true,
1309
+ "license": "Apache-2.0",
1310
+ "dependencies": {
1311
+ "playwright-core": "1.65.0"
1312
+ },
1313
+ "bin": {
1314
+ "playwright": "cli.js"
1315
+ },
1316
+ "engines": {
1317
+ "node": ">=20"
1318
+ }
1319
+ },
1320
+ "node_modules/playwright-core": {
1321
+ "version": "1.65.0",
1322
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.0.tgz",
1323
+ "integrity": "sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==",
1324
+ "dev": true,
1325
+ "license": "Apache-2.0",
1326
+ "bin": {
1327
+ "playwright-core": "cli.js"
1328
+ },
1329
+ "engines": {
1330
+ "node": ">=20"
1331
+ }
1332
+ },
1333
+ "node_modules/postcss": {
1334
+ "version": "8.5.32",
1335
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz",
1336
+ "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==",
1337
+ "funding": [
1338
+ {
1339
+ "type": "opencollective",
1340
+ "url": "https://opencollective.com/postcss/"
1341
+ },
1342
+ {
1343
+ "type": "tidelift",
1344
+ "url": "https://tidelift.com/funding/github/npm/postcss"
1345
+ },
1346
+ {
1347
+ "type": "github",
1348
+ "url": "https://github.com/sponsors/ai"
1349
+ }
1350
+ ],
1351
+ "license": "MIT",
1352
+ "dependencies": {
1353
+ "nanoid": "^3.3.20",
1354
+ "picocolors": "^1.1.1",
1355
+ "source-map-js": "^1.2.2"
1356
+ },
1357
+ "engines": {
1358
+ "node": "^10 || ^12 || >=14"
1359
+ }
1360
+ },
1361
+ "node_modules/rhino3dm": {
1362
+ "version": "8.35.0",
1363
+ "resolved": "https://registry.npmjs.org/rhino3dm/-/rhino3dm-8.35.0.tgz",
1364
+ "integrity": "sha512-YcMDgOT7m132Zd/Nw1AAMFkrtpx2SD30V7Mq3P7jfab6ItURXCOdS8dHe+bMGiNQPRJuYEX+Nvos6c9T1xJ6tA==",
1365
+ "license": "MIT"
1366
+ },
1367
+ "node_modules/rollup": {
1368
+ "version": "4.68.0",
1369
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.68.0.tgz",
1370
+ "integrity": "sha512-BIHWnc1Qjdy+WLfOdcSd67sxO4iW6pTnhdZosg+7ywSaiMWxxzKldkkNpUJqeXYAiJzyB14P2cIjqC6tlb6xzw==",
1371
+ "license": "MIT",
1372
+ "dependencies": {
1373
+ "@types/estree": "^1.0.10"
1374
+ },
1375
+ "bin": {
1376
+ "rollup": "dist/bin/rollup"
1377
+ },
1378
+ "engines": {
1379
+ "node": ">=18.0.0",
1380
+ "npm": ">=8.0.0"
1381
+ },
1382
+ "optionalDependencies": {
1383
+ "@rollup/rollup-android-arm-eabi": "4.68.0",
1384
+ "@rollup/rollup-android-arm64": "4.68.0",
1385
+ "@rollup/rollup-android-x64": "4.68.0",
1386
+ "@rollup/rollup-darwin-arm64": "4.68.0",
1387
+ "@rollup/rollup-darwin-x64": "4.68.0",
1388
+ "@rollup/rollup-freebsd-arm64": "4.68.0",
1389
+ "@rollup/rollup-freebsd-x64": "4.68.0",
1390
+ "@rollup/rollup-linux-arm-gnueabihf": "4.68.0",
1391
+ "@rollup/rollup-linux-arm-musleabihf": "4.68.0",
1392
+ "@rollup/rollup-linux-arm64-gnu": "4.68.0",
1393
+ "@rollup/rollup-linux-arm64-musl": "4.68.0",
1394
+ "@rollup/rollup-linux-loong64-gnu": "4.68.0",
1395
+ "@rollup/rollup-linux-loong64-musl": "4.68.0",
1396
+ "@rollup/rollup-linux-ppc64-gnu": "4.68.0",
1397
+ "@rollup/rollup-linux-ppc64-musl": "4.68.0",
1398
+ "@rollup/rollup-linux-riscv64-gnu": "4.68.0",
1399
+ "@rollup/rollup-linux-riscv64-musl": "4.68.0",
1400
+ "@rollup/rollup-linux-s390x-gnu": "4.68.0",
1401
+ "@rollup/rollup-linux-x64-gnu": "4.68.0",
1402
+ "@rollup/rollup-linux-x64-musl": "4.68.0",
1403
+ "@rollup/rollup-openbsd-x64": "4.68.0",
1404
+ "@rollup/rollup-openharmony-arm64": "4.68.0",
1405
+ "@rollup/rollup-win32-arm64-msvc": "4.68.0",
1406
+ "@rollup/rollup-win32-ia32-msvc": "4.68.0",
1407
+ "@rollup/rollup-win32-x64-gnu": "4.68.0",
1408
+ "@rollup/rollup-win32-x64-msvc": "4.68.0",
1409
+ "fsevents": "~2.3.2"
1410
+ }
1411
+ },
1412
+ "node_modules/source-map-js": {
1413
+ "version": "1.2.2",
1414
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz",
1415
+ "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==",
1416
+ "license": "BSD-3-Clause",
1417
+ "engines": {
1418
+ "node": ">=0.10.0"
1419
+ }
1420
+ },
1421
+ "node_modules/three": {
1422
+ "version": "0.187.0",
1423
+ "resolved": "https://registry.npmjs.org/three/-/three-0.187.0.tgz",
1424
+ "integrity": "sha512-Qiu7R+Cmh8CstZsY1uJOSWnVlfo7ZtNLV7mF8Jltk3LB3AtDu9cRZlcnRKkAk8Y4z6KKw35z7Y7Urd7jWY8etA==",
1425
+ "license": "MIT"
1426
+ },
1427
+ "node_modules/tinyglobby": {
1428
+ "version": "0.2.17",
1429
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
1430
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
1431
+ "license": "MIT",
1432
+ "dependencies": {
1433
+ "fdir": "^6.5.0",
1434
+ "picomatch": "^4.0.4"
1435
+ },
1436
+ "engines": {
1437
+ "node": ">=12.0.0"
1438
+ },
1439
+ "funding": {
1440
+ "url": "https://github.com/sponsors/SuperchupuDev"
1441
+ }
1442
+ },
1443
+ "node_modules/tsx": {
1444
+ "version": "4.23.15",
1445
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz",
1446
+ "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==",
1447
+ "devOptional": true,
1448
+ "license": "MIT",
1449
+ "dependencies": {
1450
+ "esbuild": "~0.28.0"
1451
+ },
1452
+ "bin": {
1453
+ "tsx": "dist/cli.mjs"
1454
+ },
1455
+ "engines": {
1456
+ "node": ">=18.0.0"
1457
+ },
1458
+ "optionalDependencies": {
1459
+ "fsevents": "~2.3.3"
1460
+ }
1461
+ },
1462
+ "node_modules/tsx/node_modules/@esbuild/aix-ppc64": {
1463
+ "version": "0.28.2",
1464
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz",
1465
+ "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==",
1466
+ "cpu": [
1467
+ "ppc64"
1468
+ ],
1469
+ "dev": true,
1470
+ "license": "MIT",
1471
+ "optional": true,
1472
+ "os": [
1473
+ "aix"
1474
+ ],
1475
+ "engines": {
1476
+ "node": ">=18"
1477
+ }
1478
+ },
1479
+ "node_modules/tsx/node_modules/@esbuild/android-arm": {
1480
+ "version": "0.28.2",
1481
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz",
1482
+ "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==",
1483
+ "cpu": [
1484
+ "arm"
1485
+ ],
1486
+ "dev": true,
1487
+ "license": "MIT",
1488
+ "optional": true,
1489
+ "os": [
1490
+ "android"
1491
+ ],
1492
+ "engines": {
1493
+ "node": ">=18"
1494
+ }
1495
+ },
1496
+ "node_modules/tsx/node_modules/@esbuild/android-arm64": {
1497
+ "version": "0.28.2",
1498
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz",
1499
+ "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==",
1500
+ "cpu": [
1501
+ "arm64"
1502
+ ],
1503
+ "dev": true,
1504
+ "license": "MIT",
1505
+ "optional": true,
1506
+ "os": [
1507
+ "android"
1508
+ ],
1509
+ "engines": {
1510
+ "node": ">=18"
1511
+ }
1512
+ },
1513
+ "node_modules/tsx/node_modules/@esbuild/android-x64": {
1514
+ "version": "0.28.2",
1515
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz",
1516
+ "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==",
1517
+ "cpu": [
1518
+ "x64"
1519
+ ],
1520
+ "dev": true,
1521
+ "license": "MIT",
1522
+ "optional": true,
1523
+ "os": [
1524
+ "android"
1525
+ ],
1526
+ "engines": {
1527
+ "node": ">=18"
1528
+ }
1529
+ },
1530
+ "node_modules/tsx/node_modules/@esbuild/darwin-arm64": {
1531
+ "version": "0.28.2",
1532
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz",
1533
+ "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==",
1534
+ "cpu": [
1535
+ "arm64"
1536
+ ],
1537
+ "dev": true,
1538
+ "license": "MIT",
1539
+ "optional": true,
1540
+ "os": [
1541
+ "darwin"
1542
+ ],
1543
+ "engines": {
1544
+ "node": ">=18"
1545
+ }
1546
+ },
1547
+ "node_modules/tsx/node_modules/@esbuild/darwin-x64": {
1548
+ "version": "0.28.2",
1549
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz",
1550
+ "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==",
1551
+ "cpu": [
1552
+ "x64"
1553
+ ],
1554
+ "dev": true,
1555
+ "license": "MIT",
1556
+ "optional": true,
1557
+ "os": [
1558
+ "darwin"
1559
+ ],
1560
+ "engines": {
1561
+ "node": ">=18"
1562
+ }
1563
+ },
1564
+ "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": {
1565
+ "version": "0.28.2",
1566
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz",
1567
+ "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==",
1568
+ "cpu": [
1569
+ "arm64"
1570
+ ],
1571
+ "dev": true,
1572
+ "license": "MIT",
1573
+ "optional": true,
1574
+ "os": [
1575
+ "freebsd"
1576
+ ],
1577
+ "engines": {
1578
+ "node": ">=18"
1579
+ }
1580
+ },
1581
+ "node_modules/tsx/node_modules/@esbuild/freebsd-x64": {
1582
+ "version": "0.28.2",
1583
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz",
1584
+ "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==",
1585
+ "cpu": [
1586
+ "x64"
1587
+ ],
1588
+ "dev": true,
1589
+ "license": "MIT",
1590
+ "optional": true,
1591
+ "os": [
1592
+ "freebsd"
1593
+ ],
1594
+ "engines": {
1595
+ "node": ">=18"
1596
+ }
1597
+ },
1598
+ "node_modules/tsx/node_modules/@esbuild/linux-arm": {
1599
+ "version": "0.28.2",
1600
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz",
1601
+ "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==",
1602
+ "cpu": [
1603
+ "arm"
1604
+ ],
1605
+ "dev": true,
1606
+ "license": "MIT",
1607
+ "optional": true,
1608
+ "os": [
1609
+ "linux"
1610
+ ],
1611
+ "engines": {
1612
+ "node": ">=18"
1613
+ }
1614
+ },
1615
+ "node_modules/tsx/node_modules/@esbuild/linux-arm64": {
1616
+ "version": "0.28.2",
1617
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz",
1618
+ "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==",
1619
+ "cpu": [
1620
+ "arm64"
1621
+ ],
1622
+ "dev": true,
1623
+ "license": "MIT",
1624
+ "optional": true,
1625
+ "os": [
1626
+ "linux"
1627
+ ],
1628
+ "engines": {
1629
+ "node": ">=18"
1630
+ }
1631
+ },
1632
+ "node_modules/tsx/node_modules/@esbuild/linux-ia32": {
1633
+ "version": "0.28.2",
1634
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz",
1635
+ "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==",
1636
+ "cpu": [
1637
+ "ia32"
1638
+ ],
1639
+ "dev": true,
1640
+ "license": "MIT",
1641
+ "optional": true,
1642
+ "os": [
1643
+ "linux"
1644
+ ],
1645
+ "engines": {
1646
+ "node": ">=18"
1647
+ }
1648
+ },
1649
+ "node_modules/tsx/node_modules/@esbuild/linux-loong64": {
1650
+ "version": "0.28.2",
1651
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz",
1652
+ "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==",
1653
+ "cpu": [
1654
+ "loong64"
1655
+ ],
1656
+ "dev": true,
1657
+ "license": "MIT",
1658
+ "optional": true,
1659
+ "os": [
1660
+ "linux"
1661
+ ],
1662
+ "engines": {
1663
+ "node": ">=18"
1664
+ }
1665
+ },
1666
+ "node_modules/tsx/node_modules/@esbuild/linux-mips64el": {
1667
+ "version": "0.28.2",
1668
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz",
1669
+ "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==",
1670
+ "cpu": [
1671
+ "mips64el"
1672
+ ],
1673
+ "dev": true,
1674
+ "license": "MIT",
1675
+ "optional": true,
1676
+ "os": [
1677
+ "linux"
1678
+ ],
1679
+ "engines": {
1680
+ "node": ">=18"
1681
+ }
1682
+ },
1683
+ "node_modules/tsx/node_modules/@esbuild/linux-ppc64": {
1684
+ "version": "0.28.2",
1685
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz",
1686
+ "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==",
1687
+ "cpu": [
1688
+ "ppc64"
1689
+ ],
1690
+ "dev": true,
1691
+ "license": "MIT",
1692
+ "optional": true,
1693
+ "os": [
1694
+ "linux"
1695
+ ],
1696
+ "engines": {
1697
+ "node": ">=18"
1698
+ }
1699
+ },
1700
+ "node_modules/tsx/node_modules/@esbuild/linux-riscv64": {
1701
+ "version": "0.28.2",
1702
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz",
1703
+ "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==",
1704
+ "cpu": [
1705
+ "riscv64"
1706
+ ],
1707
+ "dev": true,
1708
+ "license": "MIT",
1709
+ "optional": true,
1710
+ "os": [
1711
+ "linux"
1712
+ ],
1713
+ "engines": {
1714
+ "node": ">=18"
1715
+ }
1716
+ },
1717
+ "node_modules/tsx/node_modules/@esbuild/linux-s390x": {
1718
+ "version": "0.28.2",
1719
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz",
1720
+ "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==",
1721
+ "cpu": [
1722
+ "s390x"
1723
+ ],
1724
+ "dev": true,
1725
+ "license": "MIT",
1726
+ "optional": true,
1727
+ "os": [
1728
+ "linux"
1729
+ ],
1730
+ "engines": {
1731
+ "node": ">=18"
1732
+ }
1733
+ },
1734
+ "node_modules/tsx/node_modules/@esbuild/linux-x64": {
1735
+ "version": "0.28.2",
1736
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz",
1737
+ "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==",
1738
+ "cpu": [
1739
+ "x64"
1740
+ ],
1741
+ "dev": true,
1742
+ "license": "MIT",
1743
+ "optional": true,
1744
+ "os": [
1745
+ "linux"
1746
+ ],
1747
+ "engines": {
1748
+ "node": ">=18"
1749
+ }
1750
+ },
1751
+ "node_modules/tsx/node_modules/@esbuild/netbsd-arm64": {
1752
+ "version": "0.28.2",
1753
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz",
1754
+ "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==",
1755
+ "cpu": [
1756
+ "arm64"
1757
+ ],
1758
+ "dev": true,
1759
+ "license": "MIT",
1760
+ "optional": true,
1761
+ "os": [
1762
+ "netbsd"
1763
+ ],
1764
+ "engines": {
1765
+ "node": ">=18"
1766
+ }
1767
+ },
1768
+ "node_modules/tsx/node_modules/@esbuild/netbsd-x64": {
1769
+ "version": "0.28.2",
1770
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz",
1771
+ "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==",
1772
+ "cpu": [
1773
+ "x64"
1774
+ ],
1775
+ "dev": true,
1776
+ "license": "MIT",
1777
+ "optional": true,
1778
+ "os": [
1779
+ "netbsd"
1780
+ ],
1781
+ "engines": {
1782
+ "node": ">=18"
1783
+ }
1784
+ },
1785
+ "node_modules/tsx/node_modules/@esbuild/openbsd-arm64": {
1786
+ "version": "0.28.2",
1787
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz",
1788
+ "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==",
1789
+ "cpu": [
1790
+ "arm64"
1791
+ ],
1792
+ "dev": true,
1793
+ "license": "MIT",
1794
+ "optional": true,
1795
+ "os": [
1796
+ "openbsd"
1797
+ ],
1798
+ "engines": {
1799
+ "node": ">=18"
1800
+ }
1801
+ },
1802
+ "node_modules/tsx/node_modules/@esbuild/openbsd-x64": {
1803
+ "version": "0.28.2",
1804
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz",
1805
+ "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==",
1806
+ "cpu": [
1807
+ "x64"
1808
+ ],
1809
+ "dev": true,
1810
+ "license": "MIT",
1811
+ "optional": true,
1812
+ "os": [
1813
+ "openbsd"
1814
+ ],
1815
+ "engines": {
1816
+ "node": ">=18"
1817
+ }
1818
+ },
1819
+ "node_modules/tsx/node_modules/@esbuild/openharmony-arm64": {
1820
+ "version": "0.28.2",
1821
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz",
1822
+ "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==",
1823
+ "cpu": [
1824
+ "arm64"
1825
+ ],
1826
+ "dev": true,
1827
+ "license": "MIT",
1828
+ "optional": true,
1829
+ "os": [
1830
+ "openharmony"
1831
+ ],
1832
+ "engines": {
1833
+ "node": ">=18"
1834
+ }
1835
+ },
1836
+ "node_modules/tsx/node_modules/@esbuild/sunos-x64": {
1837
+ "version": "0.28.2",
1838
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz",
1839
+ "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==",
1840
+ "cpu": [
1841
+ "x64"
1842
+ ],
1843
+ "dev": true,
1844
+ "license": "MIT",
1845
+ "optional": true,
1846
+ "os": [
1847
+ "sunos"
1848
+ ],
1849
+ "engines": {
1850
+ "node": ">=18"
1851
+ }
1852
+ },
1853
+ "node_modules/tsx/node_modules/@esbuild/win32-arm64": {
1854
+ "version": "0.28.2",
1855
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz",
1856
+ "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==",
1857
+ "cpu": [
1858
+ "arm64"
1859
+ ],
1860
+ "dev": true,
1861
+ "license": "MIT",
1862
+ "optional": true,
1863
+ "os": [
1864
+ "win32"
1865
+ ],
1866
+ "engines": {
1867
+ "node": ">=18"
1868
+ }
1869
+ },
1870
+ "node_modules/tsx/node_modules/@esbuild/win32-ia32": {
1871
+ "version": "0.28.2",
1872
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz",
1873
+ "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==",
1874
+ "cpu": [
1875
+ "ia32"
1876
+ ],
1877
+ "dev": true,
1878
+ "license": "MIT",
1879
+ "optional": true,
1880
+ "os": [
1881
+ "win32"
1882
+ ],
1883
+ "engines": {
1884
+ "node": ">=18"
1885
+ }
1886
+ },
1887
+ "node_modules/tsx/node_modules/@esbuild/win32-x64": {
1888
+ "version": "0.28.2",
1889
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz",
1890
+ "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==",
1891
+ "cpu": [
1892
+ "x64"
1893
+ ],
1894
+ "dev": true,
1895
+ "license": "MIT",
1896
+ "optional": true,
1897
+ "os": [
1898
+ "win32"
1899
+ ],
1900
+ "engines": {
1901
+ "node": ">=18"
1902
+ }
1903
+ },
1904
+ "node_modules/tsx/node_modules/esbuild": {
1905
+ "version": "0.28.2",
1906
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz",
1907
+ "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==",
1908
+ "devOptional": true,
1909
+ "hasInstallScript": true,
1910
+ "license": "MIT",
1911
+ "bin": {
1912
+ "esbuild": "bin/esbuild"
1913
+ },
1914
+ "engines": {
1915
+ "node": ">=18"
1916
+ },
1917
+ "optionalDependencies": {
1918
+ "@esbuild/aix-ppc64": "0.28.2",
1919
+ "@esbuild/android-arm": "0.28.2",
1920
+ "@esbuild/android-arm64": "0.28.2",
1921
+ "@esbuild/android-x64": "0.28.2",
1922
+ "@esbuild/darwin-arm64": "0.28.2",
1923
+ "@esbuild/darwin-x64": "0.28.2",
1924
+ "@esbuild/freebsd-arm64": "0.28.2",
1925
+ "@esbuild/freebsd-x64": "0.28.2",
1926
+ "@esbuild/linux-arm": "0.28.2",
1927
+ "@esbuild/linux-arm64": "0.28.2",
1928
+ "@esbuild/linux-ia32": "0.28.2",
1929
+ "@esbuild/linux-loong64": "0.28.2",
1930
+ "@esbuild/linux-mips64el": "0.28.2",
1931
+ "@esbuild/linux-ppc64": "0.28.2",
1932
+ "@esbuild/linux-riscv64": "0.28.2",
1933
+ "@esbuild/linux-s390x": "0.28.2",
1934
+ "@esbuild/linux-x64": "0.28.2",
1935
+ "@esbuild/netbsd-arm64": "0.28.2",
1936
+ "@esbuild/netbsd-x64": "0.28.2",
1937
+ "@esbuild/openbsd-arm64": "0.28.2",
1938
+ "@esbuild/openbsd-x64": "0.28.2",
1939
+ "@esbuild/openharmony-arm64": "0.28.2",
1940
+ "@esbuild/sunos-x64": "0.28.2",
1941
+ "@esbuild/win32-arm64": "0.28.2",
1942
+ "@esbuild/win32-ia32": "0.28.2",
1943
+ "@esbuild/win32-x64": "0.28.2"
1944
+ }
1945
+ },
1946
+ "node_modules/typescript": {
1947
+ "version": "7.0.2",
1948
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
1949
+ "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
1950
+ "license": "Apache-2.0",
1951
+ "bin": {
1952
+ "tsc": "bin/tsc"
1953
+ },
1954
+ "engines": {
1955
+ "node": ">=16.20.0"
1956
+ },
1957
+ "optionalDependencies": {
1958
+ "@typescript/typescript-aix-ppc64": "7.0.2",
1959
+ "@typescript/typescript-darwin-arm64": "7.0.2",
1960
+ "@typescript/typescript-darwin-x64": "7.0.2",
1961
+ "@typescript/typescript-freebsd-arm64": "7.0.2",
1962
+ "@typescript/typescript-freebsd-x64": "7.0.2",
1963
+ "@typescript/typescript-linux-arm": "7.0.2",
1964
+ "@typescript/typescript-linux-arm64": "7.0.2",
1965
+ "@typescript/typescript-linux-loong64": "7.0.2",
1966
+ "@typescript/typescript-linux-mips64el": "7.0.2",
1967
+ "@typescript/typescript-linux-ppc64": "7.0.2",
1968
+ "@typescript/typescript-linux-riscv64": "7.0.2",
1969
+ "@typescript/typescript-linux-s390x": "7.0.2",
1970
+ "@typescript/typescript-linux-x64": "7.0.2",
1971
+ "@typescript/typescript-netbsd-arm64": "7.0.2",
1972
+ "@typescript/typescript-netbsd-x64": "7.0.2",
1973
+ "@typescript/typescript-openbsd-arm64": "7.0.2",
1974
+ "@typescript/typescript-openbsd-x64": "7.0.2",
1975
+ "@typescript/typescript-sunos-x64": "7.0.2",
1976
+ "@typescript/typescript-win32-arm64": "7.0.2",
1977
+ "@typescript/typescript-win32-x64": "7.0.2"
1978
+ }
1979
+ },
1980
+ "node_modules/undici-types": {
1981
+ "version": "8.9.0",
1982
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
1983
+ "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
1984
+ "license": "MIT"
1985
+ },
1986
+ "node_modules/vite": {
1987
+ "version": "6.4.5",
1988
+ "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz",
1989
+ "integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==",
1990
+ "license": "MIT",
1991
+ "dependencies": {
1992
+ "esbuild": "^0.25.0",
1993
+ "fdir": "^6.4.4",
1994
+ "picomatch": "^4.0.2",
1995
+ "postcss": "^8.5.3",
1996
+ "rollup": "^4.34.9",
1997
+ "tinyglobby": "^0.2.13"
1998
+ },
1999
+ "bin": {
2000
+ "vite": "bin/vite.js"
2001
+ },
2002
+ "engines": {
2003
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
2004
+ },
2005
+ "funding": {
2006
+ "url": "https://github.com/vitejs/vite?sponsor=1"
2007
+ },
2008
+ "optionalDependencies": {
2009
+ "fsevents": "~2.3.3"
2010
+ },
2011
+ "peerDependencies": {
2012
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
2013
+ "jiti": ">=1.21.0",
2014
+ "less": "*",
2015
+ "lightningcss": "^1.21.0",
2016
+ "sass": "*",
2017
+ "sass-embedded": "*",
2018
+ "stylus": "*",
2019
+ "sugarss": "*",
2020
+ "terser": "^5.16.0",
2021
+ "tsx": "^4.8.1",
2022
+ "yaml": "^2.4.2"
2023
+ },
2024
+ "peerDependenciesMeta": {
2025
+ "@types/node": {
2026
+ "optional": true
2027
+ },
2028
+ "jiti": {
2029
+ "optional": true
2030
+ },
2031
+ "less": {
2032
+ "optional": true
2033
+ },
2034
+ "lightningcss": {
2035
+ "optional": true
2036
+ },
2037
+ "sass": {
2038
+ "optional": true
2039
+ },
2040
+ "sass-embedded": {
2041
+ "optional": true
2042
+ },
2043
+ "stylus": {
2044
+ "optional": true
2045
+ },
2046
+ "sugarss": {
2047
+ "optional": true
2048
+ },
2049
+ "terser": {
2050
+ "optional": true
2051
+ },
2052
+ "tsx": {
2053
+ "optional": true
2054
+ },
2055
+ "yaml": {
2056
+ "optional": true
2057
+ }
2058
+ }
2059
+ }
2060
+ }
2061
+ }
package.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "dwgreader",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "vite --host 127.0.0.1",
8
+ "build": "tsc --noEmit && vite build",
9
+ "preview": "vite preview --host 127.0.0.1",
10
+ "test": "tsx --test tests/geometry.test.ts",
11
+ "check:upload": "node scripts/check-upload.mjs"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "GPL-3.0-or-later",
16
+ "description": "",
17
+ "dependencies": {
18
+ "@mlightcad/libredwg-web": "^0.8.7",
19
+ "@types/node": "^26.6.6",
20
+ "rhino3dm": "^8.35.0",
21
+ "three": "^0.187.0",
22
+ "typescript": "^7.0.2",
23
+ "vite": "^6.4.5"
24
+ },
25
+ "devDependencies": {
26
+ "@playwright/test": "^1.65.0",
27
+ "@types/three": "^0.187.0",
28
+ "tsx": "^4.23.15"
29
+ }
30
+ }
scripts/browser-check.mjs ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {chromium} from '@playwright/test';
2
+ import fs from 'node:fs';
3
+ const browser=await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_EXECUTABLE_PATH||undefined});
4
+ const page=await browser.newPage({viewport:{width:1440,height:960},deviceScaleFactor:1});
5
+ const errors=[];page.on('pageerror',e=>errors.push(e.message));page.on('console',m=>{if(m.type()==='error')console.log('console:',m.text());});
6
+ await page.goto('http://127.0.0.1:5173/');
7
+ await page.screenshot({path:'.local/welcome.png'});
8
+ await page.locator('#sample').click();
9
+ await page.waitForFunction(()=>document.querySelector('#welcome').hidden,{},{timeout:90000});
10
+ await page.screenshot({path:'.local/drawing.png'});
11
+ console.log('loaded:',await page.locator('#stats').textContent(),await page.locator('#status').textContent());
12
+ await page.locator('[data-tab=texts]').click();
13
+ await page.locator('#search').fill('客厅');
14
+ console.log('text results',await page.locator('.row-label').count());
15
+ await page.locator('.row-label').first().click();
16
+ await page.screenshot({path:'.local/focus.png'});
17
+ console.log('selection',await page.locator('#selection-text').textContent());
18
+ const canvas=page.locator('#canvas');const b=await canvas.boundingBox();const start=await canvas.screenshot();
19
+ await page.mouse.move(b.x+b.width/2,b.y+b.height/2);await page.mouse.down();await page.mouse.move(b.x+b.width/2+120,b.y+b.height/2+90,{steps:10});await page.mouse.up();
20
+ await page.waitForTimeout(200);const moved=await canvas.screenshot();if(start.equals(moved))throw new Error('Pan did not change canvas');
21
+ const zoom=await page.locator('#zoom-label').textContent();await page.mouse.wheel(0,-350);await page.waitForTimeout(200);if(zoom===await page.locator('#zoom-label').textContent())throw new Error('Zoom did not change scale');
22
+ await page.locator('#spaces').selectOption('*Paper_Space');await page.waitForFunction(()=>document.querySelector('#loading').hidden);await page.screenshot({path:'.local/layout.png'});console.log('layout',await page.locator('#stats').textContent());
23
+ await page.locator('#file').setInputFiles({name:'invalid.dwg',mimeType:'application/octet-stream',buffer:Buffer.from('not a dwg')});await page.waitForFunction(()=>!document.querySelector('#toast').hidden);console.log('invalid',await page.locator('#toast').textContent());
24
+ fs.writeFileSync('.local/browser-result.json',JSON.stringify({errors,pan:true,zoom:true,layout:true,invalid:true},null,2));
25
+ await browser.close();if(errors.length)throw new Error(errors.join('\n'));
scripts/check-upload.mjs ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {execFileSync} from 'node:child_process';
2
+ import path from 'node:path';
3
+ const root=process.cwd();
4
+ const git=(...args)=>execFileSync('git',['-c',`safe.directory=${root.replaceAll('\\','/')}`,...args],{encoding:'utf8',maxBuffer:8*1024*1024});
5
+ const files=git('ls-files','--cached','-z').split('\0').filter(Boolean);
6
+ const allowed=new Set(['.ts','.css','.html','.json','.js','.mjs','.cjs','.ps1','.cmd','.md','.txt','.py']);
7
+ const special=new Set(['.gitignore','.gitattributes','.dockerignore','Dockerfile','LICENSE','NOTICE']);
8
+ const issues=[];
9
+ for(const file of files){
10
+ if(/(^|\/)(\.local|node_modules|dist|credentials|screenshots|previews|\.aws|\.git)(\/|$)/i.test(file)||(!allowed.has(path.extname(file).toLowerCase())&&!special.has(file))){issues.push(`${file}: non-source or private asset`);continue;}
11
+ const text=git('show',`:${file}`);
12
+ if(/gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,}|-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/.test(text))issues.push(`${file}: credential material`);
13
+ if(/(?<![A-Za-z])[A-Za-z]:[\\/]/.test(text))issues.push(`${file}: machine-specific absolute path`);
14
+ if(/"BLOCK_RECORD"\s*:\s*\{|"ownerBlockRecordSoftId"\s*:/.test(text))issues.push(`${file}: extracted drawing database`);
15
+ }
16
+ if(!files.length)throw new Error('No staged project files to inspect.');
17
+ if(issues.length){console.error('Upload check blocked:\n'+issues.join('\n'));process.exitCode=1;}else console.log(`Upload check passed: ${files.length} source/document files; no drawings, private assets or detected credentials.`);
scripts/deploy-check.mjs ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {chromium} from '@playwright/test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ const base=process.env.READER_URL||'http://127.0.0.1:7861/';
5
+ const browser=await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_EXECUTABLE_PATH||undefined,args:['--enable-unsafe-swiftshader']});
6
+ try{
7
+ const context=await browser.newContext({viewport:{width:1440,height:960}}),page=await context.newPage(),errors=[],modelRequests=[];
8
+ page.on('pageerror',e=>errors.push(e.message));page.on('request',r=>{if(r.method()!=='GET'||r.url().includes('generated-smoke.3dm'))modelRequests.push(r.method()+' '+r.url());});
9
+ await page.goto(base);await page.locator('#choose').waitFor();
10
+ const wasm=await context.request.get(new URL('libredwg-web.wasm',base).href);assert.equal(wasm.status(),200);assert.match(wasm.headers()['content-type'],/application\/wasm/);assert.deepEqual((await wasm.body()).subarray(0,4),Buffer.from([0,97,115,109]));
11
+ // This is a generated two-cube test fixture, never a private user model.
12
+ await page.locator('#file').setInputFiles({name:'generated-smoke.3dm',mimeType:'application/octet-stream',buffer:fs.readFileSync('.local/generated-smoke.3dm')});
13
+ await page.waitForFunction(()=>document.querySelector('#space-label').textContent.includes('3DM'),{},{timeout:120000});
14
+ assert.equal(await page.locator('[data-part]').count(),2);await page.locator('[data-part] .row-label').first().click();await page.waitForTimeout(500);assert.match(await page.locator('#properties').textContent(),/Test cube 1/);
15
+ await page.locator('#toggle-files').click();assert.equal(await page.locator('#files-panel').isHidden(),true);await page.locator('#toggle-properties').click();assert.equal(await page.locator('#properties-panel').isHidden(),true);
16
+ for(const route of ['.local/model-path.json','api/sample','src/main.ts','package.json','deploy/serve.py'])assert.equal((await context.request.get(new URL(route,base).href)).status(),404);
17
+ assert.equal((await context.request.post(new URL('upload',base).href,{data:'synthetic test'})).status(),501);
18
+ assert.deepEqual(errors,[]);assert.deepEqual(modelRequests,[]);console.log('PASS: static deployment, DWG WASM MIME, synthetic 3DM rendering/focus, collapsible panels; private paths unavailable, no upload endpoint and no model network request.');
19
+ }finally{await browser.close();}
scripts/generate-smoke.mjs ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // A synthetic fixture only: no user drawing/model is read or copied.
2
+ import fs from 'node:fs';
3
+ import rhino3dm from 'rhino3dm';
4
+ const rhino=await rhino3dm(),doc=new rhino.File3dm();
5
+ for(let n=0;n<2;n++){
6
+ const mesh=new rhino.Mesh();
7
+ for(const [x,y,z] of [[0,0,0],[1,0,0],[1,1,0],[0,1,0],[0,0,1],[1,0,1],[1,1,1],[0,1,1]])mesh.vertices().add(x+n*1.8,y,z);
8
+ for(const face of [[0,3,2,1],[4,5,6,7],[0,1,5,4],[1,2,6,5],[2,3,7,6],[3,0,4,7]])mesh.faces().addQuadFace(...face);
9
+ const attributes=new rhino.ObjectAttributes();attributes.name=`Test cube ${n+1}`;doc.objects().add(mesh,attributes);attributes.delete();mesh.delete();
10
+ }
11
+ fs.mkdirSync('.local',{recursive:true});fs.writeFileSync('.local/generated-smoke.3dm',Buffer.from(doc.toByteArray()));doc.delete();
12
+ console.log('Generated synthetic two-cube fixture in ignored local directory.');
scripts/history-check.mjs ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {chromium} from '@playwright/test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ const config=JSON.parse(fs.readFileSync('.local/sample-path.json','utf8').replace(/^\uFEFF/,''));
5
+ const browser=await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_EXECUTABLE_PATH||undefined});
6
+ try{
7
+ const context=await browser.newContext({viewport:{width:1440,height:960}}),page=await context.newPage(),errors=[];
8
+ page.on('pageerror',e=>errors.push(e.message));
9
+ await page.goto('http://127.0.0.1:5173/');
10
+ assert.equal(await page.locator('#workspace').evaluate(e=>getComputedStyle(e).backgroundColor),'rgb(232, 242, 251)');
11
+ await page.locator('#recent').click();await page.locator('.history-empty').waitFor();
12
+ await page.locator('#file').setInputFiles(config.path);
13
+ await page.waitForFunction(()=>document.querySelector('#welcome').hidden,{},{timeout:90000});
14
+ await page.locator('[data-tab=texts]').click();await page.locator('#search').fill('客厅');await page.locator('.row-label').first().click();
15
+ await page.screenshot({path:'.local/light-blue-focus.png'});
16
+ await page.locator('#recent').click();await page.locator('.history-open').waitFor();assert.equal(await page.locator('.history-open').count(),1);
17
+ await page.screenshot({path:'.local/history.png'});
18
+ // Reload the page and reopen only from IndexedDB; no fresh file selection or sample request.
19
+ await page.reload();await page.locator('#recent').click();await page.locator('.history-open').waitFor();
20
+ await page.locator('.history-open').click();await page.waitForFunction(()=>document.querySelector('#welcome').hidden,{},{timeout:90000});
21
+ assert.match(await page.locator('#stats').textContent(),/个图元/);
22
+ await page.locator('#recent').click();await page.locator('.history-open').waitFor();assert.equal(await page.locator('.history-open').count(),1);
23
+ await page.locator('#file').setInputFiles({name:'bad.dwg',mimeType:'application/octet-stream',buffer:Buffer.from('bad')});await page.locator('#toast').waitFor({state:'visible'});
24
+ await page.locator('#recent').click();await page.locator('.history-open').waitFor();assert.equal(await page.locator('.history-open').count(),1);
25
+ await page.locator('.history-remove').click();await page.locator('.history-empty').waitFor();
26
+ // Exercise the retention policy with small local fixtures in the isolated browser context.
27
+ await page.evaluate(async()=>{const history=await import('/src/history.ts');for(let n=0;n<12;n++)await history.rememberDrawing(new File([`fixture-${n}`],`${n}.dwg`,{lastModified:n}));});
28
+ await page.locator('#recent').click();await page.waitForFunction(()=>document.querySelectorAll('.history-open').length===10);
29
+ await page.locator('#file-history-clear').click();await page.locator('.history-empty').waitFor();await page.reload();await page.locator('#recent').click();await page.locator('.history-empty').waitFor();
30
+ assert.deepEqual(errors,[]);console.log('PASS: light blue theme, persisted DWG reopening, deduplication, invalid-file exclusion, 10-file retention, removal and clearing across reload.');
31
+ }finally{await browser.close();}
scripts/model-check.mjs ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {chromium} from '@playwright/test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ const modelConfig=JSON.parse(fs.readFileSync('.local/model-path.json','utf8').replace(/^\uFEFF/,''));
5
+ const drawingConfig=JSON.parse(fs.readFileSync('.local/sample-path.json','utf8').replace(/^\uFEFF/,''));
6
+ const browser=await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_EXECUTABLE_PATH||undefined,args:['--enable-unsafe-swiftshader']});
7
+ try{
8
+ const context=await browser.newContext({viewport:{width:1600,height:1000}}),page=await context.newPage(),errors=[],external=[];
9
+ page.on('pageerror',e=>errors.push(e.message));page.on('request',r=>{if(/^https?:/.test(r.url())&&!r.url().startsWith('http://127.0.0.1:'))external.push(r.url());});
10
+ await page.goto(process.env.READER_URL||'http://127.0.0.1:5173/');
11
+ await page.locator('#file').setInputFiles(modelConfig.path);
12
+ await page.waitForFunction(()=>document.querySelector('#space-label').textContent.includes('3DM'),{},{timeout:120000});
13
+ await page.locator('#model-host canvas').waitFor();await page.waitForTimeout(700);
14
+ console.log('Model loaded:',await page.locator('#stats').textContent(),await page.locator('#status').textContent());
15
+ await page.screenshot({path:'.local/model.png'});
16
+ assert.ok(await page.locator('[data-part]').count()>0);await page.locator('[data-part] .row-label').first().click();await page.waitForTimeout(600);
17
+ assert.ok((await page.locator('#properties').textContent()).includes('尺寸 Z'));await page.screenshot({path:'.local/model-focus.png'});
18
+ await page.locator('#fit').click();await page.waitForTimeout(600);
19
+ const canvas=page.locator('#model-host canvas'),box=await canvas.boundingBox();
20
+ await canvas.click({position:{x:box.width*.5,y:box.height*.5}});await page.waitForTimeout(500);assert.equal(await page.locator('#selection').isVisible(),true,'Clicking model geometry selects and focuses a part');
21
+ await page.locator('#fit').click();await page.waitForTimeout(500);
22
+ const before=await canvas.screenshot();await page.mouse.move(box.x+box.width*.5,box.y+box.height*.5);await page.mouse.down();await page.mouse.move(box.x+box.width*.65,box.y+box.height*.6,{steps:15});await page.mouse.up();await page.waitForTimeout(500);assert.ok(!before.equals(await canvas.screenshot()),'Rotation changed rendered model');
23
+ const afterRotate=await canvas.screenshot();await page.mouse.down({button:'right'});await page.mouse.move(box.x+box.width*.72,box.y+box.height*.65,{steps:10});await page.mouse.up({button:'right'});await page.waitForTimeout(500);assert.ok(!afterRotate.equals(await canvas.screenshot()),'Panning changed rendered model');
24
+ await page.locator('#toggle-files').click();assert.equal(await page.locator('#files-panel').isHidden(),true);await page.locator('#toggle-properties').click();assert.equal(await page.locator('#properties-panel').isHidden(),true);await page.screenshot({path:'.local/model-panels-closed.png'});await page.locator('#toggle-files').click();await page.locator('#toggle-properties').click();
25
+ console.log('Rotation, pan and panel checks completed. Opening DWG...');
26
+ await page.locator('#file').setInputFiles(drawingConfig.path);console.log('DWG file selected.');await page.waitForFunction(()=>document.querySelector('#space-label').textContent==='模型空间',{},{timeout:90000});assert.equal(await page.locator('#model-host').isHidden(),true);assert.equal(await page.locator('#canvas').isVisible(),true);
27
+ await page.waitForFunction(()=>{const canvas=document.querySelector('#canvas'),pixels=canvas.getContext('2d').getImageData(0,0,canvas.width,canvas.height).data;for(let i=3;i<pixels.length;i+=4)if(pixels[i])return true;return false;});
28
+ assert.ok(!(await page.locator('#zoom-label').textContent()).includes('∞'));await page.screenshot({path:'.local/three-column-dwg.png'});console.log('DWG switch completed with visible geometry.');
29
+ await page.waitForFunction(()=>document.querySelectorAll('#history-list .history-open').length===2);
30
+ await page.reload();await page.waitForFunction(()=>document.querySelectorAll('#history-list .history-open').length===2);
31
+ const modelEntry=page.locator('.history-open').filter({has:page.locator('.history-name').filter({hasText:/\.3dm$/i})});await modelEntry.click();await page.waitForFunction(()=>document.querySelector('#space-label').textContent.includes('3DM'),{},{timeout:120000});
32
+ assert.deepEqual(errors,[]);assert.deepEqual(external,[]);console.log('PASS: 3DM parsing, sidebar and geometry-click focus, rotation, panning, collapsible panels, DWG switch and persisted model reopening; no external requests.');
33
+ }finally{await browser.close();}
scripts/production-check.mjs ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {chromium} from '@playwright/test';
2
+ import fs from 'node:fs';
3
+ const config=JSON.parse(fs.readFileSync('.local/sample-path.json','utf8').replace(/^\uFEFF/,''));
4
+ const browser=await chromium.launch({headless:true,executablePath:process.env.PLAYWRIGHT_EXECUTABLE_PATH||undefined});
5
+ try{
6
+ const page=await browser.newPage({viewport:{width:1440,height:960}});const errors=[];page.on('pageerror',e=>errors.push(e.message));
7
+ await page.goto('http://127.0.0.1:5174/');
8
+ await page.locator('#file').setInputFiles(config.path);
9
+ await page.waitForFunction(()=>document.querySelector('#welcome').hidden,{},{timeout:90000});
10
+ console.log('Production DWG:',await page.locator('#stats').textContent());
11
+ await page.locator('[data-tab=blocks]').click();const expand=page.locator('.expand').first();await expand.click();
12
+ if(await expand.getAttribute('aria-expanded')!=='true')throw new Error('Block tree did not expand');
13
+ await page.locator('.row-label').nth(1).click();
14
+ if(await page.locator('#selection').isHidden())throw new Error('Nested item not focused');
15
+ await page.locator('[data-tab=layers]').click();const eye=page.locator('.eye').first();await eye.click();
16
+ if(await eye.getAttribute('aria-pressed')!=='false')throw new Error('Layer did not hide');
17
+ await eye.click();if(errors.length)throw new Error(errors.join('\n'));
18
+ console.log('Production worker/WASM, nested tree focus and layer visibility passed.');
19
+ }finally{await browser.close();}
scripts/start.ps1 ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $ErrorActionPreference = 'Stop'
2
+ $projectRoot = Split-Path -Parent $PSScriptRoot
3
+ Set-Location -LiteralPath $projectRoot
4
+ if (-not (Test-Path -LiteralPath (Join-Path $projectRoot 'node_modules/vite/bin/vite.js'))) {
5
+ throw 'Dependencies missing. Run npm install in this folder first.'
6
+ }
7
+ $localDir = Join-Path $projectRoot '.local'
8
+ New-Item -ItemType Directory -Force -Path $localDir | Out-Null
9
+ $url = 'http://127.0.0.1:5173/'
10
+ $running = $false
11
+ try { $probe = Invoke-WebRequest -Uri ($url + 'api/reader-health') -UseBasicParsing -TimeoutSec 2; $running = $probe.Content -eq 'dwg-reader' } catch { }
12
+ if (-not $running) {
13
+ $sampleConfig = Join-Path $localDir 'sample-path.json'
14
+ if (Test-Path -LiteralPath $sampleConfig) { $env:DWG_SAMPLE = (Get-Content -LiteralPath $sampleConfig -Raw | ConvertFrom-Json).path }
15
+ $nodePath = (Get-Command node -ErrorAction Stop).Source
16
+ $server = Start-Process -FilePath $nodePath -ArgumentList @('node_modules/vite/bin/vite.js', '--host', '127.0.0.1') -WorkingDirectory $projectRoot -WindowStyle Hidden -PassThru -RedirectStandardOutput (Join-Path $localDir 'server.log') -RedirectStandardError (Join-Path $localDir 'server-error.log')
17
+ $server.Id | Set-Content -LiteralPath (Join-Path $localDir 'server.pid')
18
+ for ($attempt = 0; $attempt -lt 30; $attempt++) {
19
+ Start-Sleep -Milliseconds 500
20
+ try { $probe = Invoke-WebRequest -Uri ($url + 'api/reader-health') -UseBasicParsing -TimeoutSec 1; if ($probe.Content -eq 'dwg-reader') { $running = $true; break } } catch { }
21
+ if ($server.HasExited) { break }
22
+ }
23
+ if (-not $running) { throw 'Unable to start reader. See .local/server-error.log. Port 5173 may be in use.' }
24
+ }
25
+ Start-Process $url
26
+ Write-Host 'DWG reader opened at http://127.0.0.1:5173/'
src/colors.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const cache=new Map<string,string>();
2
+ // Keep CAD hues while giving pale lines enough contrast on the light blue canvas.
3
+ export function drawingColor(color:string):string{
4
+ const cached=cache.get(color);if(cached)return cached;
5
+ let rgb:number[];
6
+ if(color.startsWith('hsl')){
7
+ const [h,s,l]=color.match(/[\d.]+/g)!.map(Number),a=s/100*Math.min(l/100,1-l/100);
8
+ rgb=[0,8,4].map(n=>{const k=(n+h/30)%12;return 255*(l/100-a*Math.max(-1,Math.min(k-3,9-k,1)));});
9
+ }else if(/^#[0-9a-f]{6}$/i.test(color))rgb=[1,3,5].map(n=>parseInt(color.slice(n,n+2),16));else return '#344b62';
10
+ const luminance=(values:number[])=>values.map(v=>{v/=255;return v<=.04045?v/12.92:((v+.055)/1.055)**2.4;}).reduce((sum,v,i)=>sum+v*[.2126,.7152,.0722][i],0);
11
+ const background=luminance([232,242,251]);
12
+ while((background+.05)/(luminance(rgb)+.05)<3.5)rgb=rgb.map(v=>v*.9);
13
+ const adapted=`#${rgb.map(v=>Math.round(v).toString(16).padStart(2,'0')).join('')}`;cache.set(color,adapted);return adapted;
14
+ }
src/env.d.ts ADDED
@@ -0,0 +1 @@
 
 
1
+ /// <reference types="vite/client" />
src/geometry.ts ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type {Bounds,Point,Matrix,Primitive,Item,Scene} from './types';
2
+ export const identity:Matrix=[1,0,0,1,0,0];
3
+ export const emptyBounds=():Bounds=>({minX:Infinity,minY:Infinity,maxX:-Infinity,maxY:-Infinity});
4
+ export const valid=(b:Bounds)=>[b.minX,b.minY,b.maxX,b.maxY].every(Number.isFinite);
5
+ export function union(a:Bounds,b:Bounds){if(valid(b)){a.minX=Math.min(a.minX,b.minX);a.minY=Math.min(a.minY,b.minY);a.maxX=Math.max(a.maxX,b.maxX);a.maxY=Math.max(a.maxY,b.maxY);}return a;}
6
+ export function transform(p:Point,m:Matrix):Point{return{x:m[0]*p.x+m[2]*p.y+m[4],y:m[1]*p.x+m[3]*p.y+m[5]};}
7
+ export function multiply(a:Matrix,b:Matrix):Matrix{return[a[0]*b[0]+a[2]*b[1],a[1]*b[0]+a[3]*b[1],a[0]*b[2]+a[2]*b[3],a[1]*b[2]+a[3]*b[3],a[0]*b[4]+a[2]*b[5]+a[4],a[1]*b[4]+a[3]*b[5]+a[5]];}
8
+ export function cleanText(t:unknown):string{return String(t??'').replace(/\\U\+([0-9a-f]{4})/gi,(_,n)=>String.fromCharCode(parseInt(n,16))).replace(/%%d/gi,'°').replace(/%%p/gi,'±').replace(/%%c/gi,'Ø').replace(/%%[uo]/gi,'').replace(/\\P/g,'\n').replace(/\\~/g,' ').replace(/\\S([^;]*);/g,(_,s)=>s.replace(/[\^#]/g,'/')).replace(/\\[ACcFfHhQqTtWwp][^;]*;/g,'').replace(/\\[LlOoKk]/g,'').replace(/[{}]/g,'').trim();}
9
+ export function aci(index:number):string{
10
+ const base=['#d9e1ed','#ff6767','#f4da61','#73dc90','#61dce9','#809aff','#e888e5','#d9e1ed','#8792a5','#a6b0bf'];index=Math.abs(index);
11
+ if(index<10)return base[index];if(index>=250)return['#657082','#808b9d','#9da7b7','#b8c1ce','#d0d7e1','#eef1f7'][Math.min(index-250,5)];
12
+ const hue=Math.floor((index-10)/10)*15,slot=(index-10)%10;return`hsl(${hue} ${slot%2?65:85}% ${[65,76,54,66,45,58,37,48,30,42][slot]}%)`;
13
+ }
14
+ export function arcPoints(c:Point,rx:number,ry:number,start:number,end:number,rotation=0):Point[]{
15
+ while(end<=start)end+=Math.PI*2;const n=Math.max(8,Math.ceil((end-start)*24));return Array.from({length:n+1},(_,i)=>{const t=start+(end-start)*i/n,x=rx*Math.cos(t),y=ry*Math.sin(t);return{x:c.x+x*Math.cos(rotation)-y*Math.sin(rotation),y:c.y+x*Math.sin(rotation)+y*Math.cos(rotation)};});
16
+ }
17
+ export function polyline(vertices:any[],closed:boolean):Point[]{
18
+ const out:Point[]=[];for(let i=0;i<vertices.length;i++){
19
+ const a=vertices[i],b=vertices[(i+1)%vertices.length];out.push({x:a.x,y:a.y});if((i===vertices.length-1&&!closed)||!a.bulge||!b)continue;
20
+ const chord=Math.hypot(b.x-a.x,b.y-a.y);if(!chord)continue;const theta=4*Math.atan(a.bulge),offset=chord*(1-a.bulge*a.bulge)/(4*a.bulge);
21
+ const c={x:(a.x+b.x)/2-(b.y-a.y)/chord*offset,y:(a.y+b.y)/2+(b.x-a.x)/chord*offset},r=Math.hypot(a.x-c.x,a.y-c.y),start=Math.atan2(a.y-c.y,a.x-c.x),n=Math.ceil(Math.abs(theta)*24);
22
+ for(let j=1;j<n;j++)out.push({x:c.x+r*Math.cos(start+theta*j/n),y:c.y+r*Math.sin(start+theta*j/n)});
23
+ }return out;
24
+ }
25
+ function spline(e:any):Point[]{
26
+ const cp=e.controlPoints??[],p=e.degree,k=e.knots??[];if(cp.length<=p||k.length<cp.length+p+1)return e.fitPoints??[];
27
+ const start=k[p],end=k[cp.length],out:Point[]=[],n=Math.min(1024,cp.length*16);
28
+ for(let j=0;j<=n;j++){
29
+ const t=start+(end-start)*j/n;let span=p;while(span<cp.length-1&&t>=k[span+1])span++;
30
+ const d=Array.from({length:p+1},(_,i)=>{const idx=span-p+i,w=e.weights?.[idx]??1;return[cp[idx].x*w,cp[idx].y*w,w];});
31
+ for(let r=1;r<=p;r++)for(let i=p;i>=r;i--){const idx=span-p+i,den=k[idx+p-r+1]-k[idx],a=den?(t-k[idx])/den:0;d[i]=d[i].map((v,q)=>(1-a)*d[i-1][q]+a*v);}
32
+ if(d[p][2])out.push({x:d[p][0]/d[p][2],y:d[p][1]/d[p][2]});
33
+ }return out;
34
+ }
35
+ // Drawing contents are treated as data. Never insert CAD text as HTML.
36
+ export function buildScene(db:any,space='*Model_Space',unknown=0):Scene{
37
+ const blocks=new Map<string,any>(db.tables.BLOCK_RECORD.entries.map((b:any)=>[b.name,b]));
38
+ const layerMap=new Map<string,any>(db.tables.LAYER.entries.map((l:any)=>[l.name,l]));
39
+ const primitives:Primitive[]=[],items:Item[]=[],unsupported:Record<string,number>={};let seq=0;
40
+ const colorOf=(e:any,layer:string,inherited:string)=>e.colorIndex===0?inherited:e.color?`#${e.color.toString(16).padStart(6,'0')}`:aci(e.colorIndex!=null&&e.colorIndex!==256?e.colorIndex:layerMap.get(layer)?.colorIndex??7);
41
+ function visit(e:any,parent:Matrix,inheritedLayer='0',inheritedColor='#d9e1ed',stack:string[]=[]):Item|null{
42
+ const layer=e.layer==='0'?inheritedLayer:(e.layer||inheritedLayer),l=layerMap.get(layer);
43
+ if(e.isVisible===false||l?.off||l?.frozen||e.type==='ATTDEF'||(e.type==='ATTRIB'&&(e.flags&1)))return null;
44
+ const color=colorOf(e,layer,inheritedColor),id=`n${++seq}`,item:Item={id,label:'',type:e.type,layer,bounds:emptyBounds(),children:[],primitives:[]};
45
+ const add=(points:Point[],closed=false,fill=false,text?:string,height?:number,matrix?:Matrix)=>{
46
+ if(!points.length)return;points=points.map(p=>transform(p,parent));const bounds=emptyBounds();for(const p of points)union(bounds,{minX:p.x,minY:p.y,maxX:p.x,maxY:p.y});if(!valid(bounds))return;
47
+ item.primitives.push(primitives.length);primitives.push({points,color,layer,closed,fill,text,height,matrix,bounds,node:id});union(item.bounds,bounds);
48
+ };
49
+ if(e.extrusionDirection?.z<0&&['ARC','CIRCLE','LWPOLYLINE','TEXT','ATTRIB','SOLID','INSERT'].includes(e.type))parent=multiply(parent,[-1,0,0,1,0,0]);
50
+ const m=parent;
51
+ if(e.type==='INSERT'||e.type==='DIMENSION'){
52
+ const block=blocks.get(e.name);item.label=e.name||e.type;
53
+ if(block&&!stack.includes(e.name)&&stack.length<32){
54
+ let next=m;if(e.type==='DIMENSION'&&e.insertionPoint)next=multiply(m,[1,0,0,1,e.insertionPoint.x,e.insertionPoint.y]);if(e.type==='INSERT'){
55
+ const a=e.rotation||0,sx=e.xScale??1,sy=e.yScale??1,b=block.basePoint??{x:0,y:0};
56
+ const local:Matrix=[Math.cos(a)*sx,Math.sin(a)*sx,-Math.sin(a)*sy,Math.cos(a)*sy,e.insertionPoint.x,e.insertionPoint.y];next=multiply(m,multiply(local,[1,0,0,1,-b.x,-b.y]));
57
+ }
58
+ for(const child of block.entities){const n=visit(child,next,layer,color,[...stack,e.name]);if(n){item.children.push(n);union(item.bounds,n.bounds);}}
59
+ for(const attr of e.attribs??[]){const n=visit(attr,m,layer,color,stack);if(n){item.children.push(n);union(item.bounds,n.bounds);}}
60
+ const title=item.children.find(n=>n.type==='ATTRIB'&&/图|平面|系统/.test(n.label));if(title)item.label=`${title.label} · ${e.name}`;
61
+ }else{const key=block?'循环图块':'缺失图块';unsupported[key]=(unsupported[key]||0)+1;}
62
+ }else if(['TEXT','MTEXT','ATTRIB'].includes(e.type)){
63
+ const t=e.type==='ATTRIB'?{...e,...e.text}:e,text=cleanText(t.text),h=t.textHeight||1,pos=t.insertionPoint??t.startPoint??{x:0,y:0},a=e.type==='MTEXT'&&t.direction?Math.atan2(t.direction.y,t.direction.x):(t.rotation||0),sx=t.xScale||1;
64
+ const tm:Matrix=multiply(m,[Math.cos(a)*sx,Math.sin(a)*sx,-Math.sin(a),Math.cos(a),pos.x,pos.y]);
65
+ const lines=text.split('\n'),w=Math.max(...lines.map(s=>Array.from(s).reduce((n,c)=>n+(/[\u2e80-\uffff]/.test(c)?1:0.62),0)))*h;
66
+ let x=t.halign===1?-w/2:t.halign===2?-w:0,y=0;
67
+ if(e.type==='MTEXT'){const at=t.attachmentPoint||1;x=(at-1)%3===1?-w/2:(at-1)%3===2?-w:0;y=at<=3?-h:at<=6?lines.length*h*.65:lines.length*h*1.3;}
68
+ else if(t.valign)y=t.valign===2?-h/2:t.valign===3?-h:0;
69
+ if(t.halign&&t.endPoint&&(t.endPoint.x||t.endPoint.y)){const p=transform(t.endPoint,m);tm[4]=p.x;tm[5]=p.y;}
70
+ const textMatrix=multiply(tm,[1,0,0,1,x,y]);
71
+ const corners=[{x:0,y:h},{x:w,y:h},{x:w,y:-h*1.3*(lines.length-1)},{x:0,y:-h*1.3*(lines.length-1)}].map(p=>transform(p,textMatrix));
72
+ parent=identity;add(corners,false,false,text,h,textMatrix);item.label=text.replace(/\n/g,' ');
73
+ }else{
74
+ let points:Point[]=[],closed=false,fill=false;
75
+ switch(e.type){
76
+ case 'LINE':points=[e.startPoint,e.endPoint];break;
77
+ case 'LWPOLYLINE':case 'POLYLINE':case 'POLYLINE2D':case 'POLYLINE3D':closed=!!(e.flag&(e.type==='LWPOLYLINE'?512:1));points=polyline(e.vertices??[],closed);break;
78
+ case 'CIRCLE':points=arcPoints(e.center,e.radius,e.radius,0,Math.PI*2);closed=true;break;
79
+ case 'ARC':points=arcPoints(e.center,e.radius,e.radius,e.startAngle,e.endAngle);break;
80
+ case 'ELLIPSE':{const v=e.majorAxisEndPoint,r=Math.hypot(v.x,v.y);points=arcPoints(e.center,r,r*e.axisRatio,e.startAngle,e.endAngle,Math.atan2(v.y,v.x));break;}
81
+ case 'SOLID':case 'TRACE':points=[e.corner1,e.corner2,e.corner4,e.corner3].filter(Boolean);closed=true;fill=true;break;
82
+ case '3DFACE':points=[e.firstCorner,e.secondCorner,e.thirdCorner,e.fourthCorner].filter(Boolean);closed=true;break;
83
+ case 'LEADER':points=e.vertices??[];break;
84
+ case 'SPLINE':points=spline(e);break;
85
+ case 'POINT':{const p=e.position??e.point;if(p)points=[p];break;}
86
+ case 'HATCH':for(const path of e.boundaryPaths??[]){
87
+ if(path.vertices)add(polyline(path.vertices,true),true,!!e.solidFill);
88
+ else{
89
+ const contour:Point[]=[];
90
+ for(const edge of path.edges??[]){
91
+ let part:Point[]=[];
92
+ if(edge.type===1)part=[edge.start,edge.end];
93
+ else if(edge.type===2){part=arcPoints(edge.center,edge.radius,edge.radius,edge.isCCW===false?edge.endAngle:edge.startAngle,edge.isCCW===false?edge.startAngle:edge.endAngle);if(edge.isCCW===false)part.reverse();}
94
+ else if(edge.type===3){const r=Math.hypot(edge.end.x,edge.end.y);part=arcPoints(edge.center,r,edge.lengthOfMinorAxis,edge.startAngle,edge.endAngle,Math.atan2(edge.end.y,edge.end.x));}
95
+ else if(edge.type===4)part=spline({...edge,fitPoints:edge.fitDatum,weights:edge.controlPoints?.map((p:any)=>p.weight??1)});
96
+ else unsupported['填充边界']=(unsupported['填充边界']||0)+1;
97
+ contour.push(...part);
98
+ }add(contour,true,!!e.solidFill);
99
+ }
100
+ }if(!e.solidFill)unsupported['图案填充仅显示边界']=(unsupported['图案填充仅显示边界']||0)+1;break;
101
+ case 'VIEWPORT':unsupported['布局视口投影']=(unsupported['布局视口投影']||0)+1;return null;
102
+ case 'SEQEND':return null;
103
+ default:unsupported[e.type]=(unsupported[e.type]||0)+1;
104
+ }
105
+ if(points.length)add(points,closed,fill);item.label=`${({LINE:'直线',LWPOLYLINE:'多段线',CIRCLE:'圆',ARC:'圆弧',HATCH:'填充'} as Record<string,string>)[e.type]??e.type} · ${e.handle}`;
106
+ }
107
+ return valid(item.bounds)?item:null;
108
+ }
109
+ const model=blocks.get(space),roots=model?.entities??db.entities.filter((e:any)=>!e.isInPaperSpace);
110
+ for(const e of roots){if(e.type==='ATTRIB')continue;const n=visit(e,identity);if(n)items.push(n);}
111
+ const bounds=emptyBounds();items.forEach(n=>union(bounds,n.bounds));const used=new Set(primitives.map(p=>p.layer));
112
+ return{primitives,items,bounds,space,spaces:[...blocks.keys()].filter(n=>/^\*.*space/i.test(n)),layers:[...layerMap.values()].filter(l=>used.has(l.name)).map(l=>({name:l.name,color:aci(l.colorIndex),off:!!(l.off||l.frozen)})),unsupported,unknown};
113
+ }
src/history.ts ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export type RecentDrawing = {id:string;name:string;size:number;lastModified:number;openedAt:number;blob:Blob};
2
+ const MAX_FILES=10;
3
+ const MAX_BYTES=250*1024*1024;
4
+ let database:Promise<IDBDatabase>|undefined;
5
+ function db(){
6
+ return database??=new Promise<IDBDatabase>((resolve,reject)=>{
7
+ const request=indexedDB.open('dwg-reader-history',1);
8
+ request.onupgradeneeded=()=>request.result.createObjectStore('drawings',{keyPath:'id'});
9
+ request.onsuccess=()=>resolve(request.result);
10
+ request.onerror=()=>reject(request.error);
11
+ });
12
+ }
13
+ function result<T>(request:IDBRequest<T>):Promise<T>{return new Promise((resolve,reject)=>{request.onsuccess=()=>resolve(request.result);request.onerror=()=>reject(request.error);});}
14
+ function completed(transaction:IDBTransaction){return new Promise<void>((resolve,reject)=>{transaction.oncomplete=()=>resolve();transaction.onerror=()=>reject(transaction.error);transaction.onabort=()=>reject(transaction.error??new Error('历史记录保存中断'));});}
15
+ export async function listHistory():Promise<RecentDrawing[]>{
16
+ const database=await db();return (await result(database.transaction('drawings').objectStore('drawings').getAll()) as RecentDrawing[]).sort((a,b)=>b.openedAt-a.openedAt);
17
+ }
18
+ export async function rememberDrawing(file:File){
19
+ const database=await db(),tx=database.transaction('drawings','readwrite'),done=completed(tx),store=tx.objectStore('drawings');
20
+ const drawing:RecentDrawing={id:JSON.stringify([file.name,file.size,file.lastModified]),name:file.name,size:file.size,lastModified:file.lastModified,openedAt:Date.now(),blob:file};
21
+ // Read and prune within one transaction so concurrent openings cannot exceed the limit.
22
+ const request=store.getAll();request.onsuccess=()=>{
23
+ const drawings=(request.result as RecentDrawing[]).filter(d=>d.id!==drawing.id);drawings.unshift(drawing);drawings.sort((a,b)=>b.openedAt-a.openedAt);
24
+ let bytes=0;drawings.forEach((d,i)=>{bytes+=d.size;if(i>=MAX_FILES||bytes>MAX_BYTES)store.delete(d.id);else if(d.id===drawing.id)store.put(d);});
25
+ };
26
+ await done;
27
+ }
28
+ export async function deleteHistory(id?:string){const database=await db(),tx=database.transaction('drawings','readwrite'),done=completed(tx);if(id)tx.objectStore('drawings').delete(id);else tx.objectStore('drawings').clear();await done;}
src/main.ts ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import './style.css';
2
+ import {Viewer} from './viewer';
3
+ import {emptyBounds,union,valid} from './geometry';
4
+ import type {Scene,Item,Bounds} from './types';
5
+ import {listHistory,rememberDrawing,deleteHistory} from './history';
6
+ import {drawingColor} from './colors';
7
+ import type {ModelViewer,ModelPart} from './model-viewer';
8
+
9
+ const icon=(name:string)=>{const paths:Record<string,string>={file:'<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v5h5M9 12h6M9 16h6"/>',folder:'<path d="M3 7V5h7l2 3h9l-3 12H3z"/>',layers:'<path d="m12 3 10 6-10 6L2 9zM3 13l9 5 9-5M3 17l9 5 9-5"/>',search:'<circle cx="10" cy="10" r="6"/><path d="m15 15 5 5"/>',fit:'<path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5"/><rect x="8" y="8" width="8" height="8"/>',cross:'<path d="M12 2v6m0 8v6M2 12h6m8 0h6"/><circle cx="12" cy="12" r="4"/>',chevron:'<path d="m9 5 7 7-7 7"/>',check:'<path d="m5 12 4 4L19 6"/>',eye:'<path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/>'};return`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths[name]??paths.file}</svg>`;};
10
+ document.querySelector('#app')!.innerHTML=`
11
+ <header><div class="brand"><span class="brand-icon">${icon('layers')}</span><strong>图阅</strong><span class="brand-separator"></span><span class="brand-sub">DWG READER</span></div><div class="header-file" id="file-name">轻量图纸阅读器</div><div class="header-actions"><button class="recent-button" id="recent">${icon('file')}最近打开</button><button class="primary" id="open">${icon('folder')}打开图纸<span class="key">Ctrl O</span></button></div></header>
12
+ <main><aside><div class="aside-heading"><span>图纸结构</span><span id="item-count" class="badge">—</span></div><div class="search">${icon('search')}<input id="search" placeholder="搜索图层、图块、文字" aria-label="搜索图纸结构"><kbd>/</kbd></div><div class="tabs" role="tablist"><button role="tab" data-tab="layers" aria-selected="true">图层</button><button role="tab" data-tab="blocks" aria-selected="false">图块</button><button role="tab" data-tab="texts" aria-selected="false">文字</button></div><div class="tree" id="tree"><div class="tree-empty">打开图纸后<br>在这里浏览图纸结构</div></div><div class="aside-footer">${icon('cross')}<span>点击项目,自动定位到图中</span></div></aside>
13
+ <section class="workspace" id="workspace"><div class="canvas-heading"><div class="crumb"><span class="live-dot"></span><span id="space-label">绘图空间</span><span id="drawing-state">等待打开文件</span></div><select id="spaces" aria-label="绘图空间" hidden></select></div><canvas id="canvas" tabindex="0" aria-label="图纸主视图,可拖动平移、滚轮缩放"></canvas>
14
+ <div class="welcome" id="welcome"><div class="welcome-art">${icon('layers')}<span class="art-corner a"></span><span class="art-corner b"></span><span class="art-corner c"></span><span class="art-corner d"></span></div><div class="eyebrow">YOUR DRAWING, IN FOCUS</div><h1>打开图纸,看清每个细节。</h1><p>拖入 DWG 文件,开始阅读。<br>从左侧结构目录,直达图中的每一处。</p><button class="primary large" id="choose">${icon('folder')}选择 DWG 文件</button><button id="sample" class="sample" hidden>打开你的 128 户型示例图纸 →</button><div class="local-note"><span class="live-dot"></span>本机解析 · 文件无需上传</div></div>
15
+ <div class="selection" id="selection" hidden>${icon('cross')}<span id="selection-text"></span><button id="clear-selection" aria-label="取消高亮">×</button></div>
16
+ <div class="view-tools"><button id="zoom-in" title="放大" aria-label="放大">+</button><button id="zoom-out" title="缩小" aria-label="缩小">−</button><span></span><button id="fit" title="显示全图(F)" aria-label="显示全图">${icon('fit')}</button></div><div class="axis"><span class="y">Y</span><i></i><span class="x">X</span></div><div class="canvas-hint">拖动平移<span>·</span>滚轮缩放<span>·</span>双击显示全图</div><div class="drop-mask" id="drop-mask">松开,打开这份图纸</div>
17
+ <div class="loading" id="loading" hidden><span class="spinner"></span><strong id="progress">正在读取图纸…</strong><span>图纸正在本机处理</span><button id="cancel">取消读取</button></div></section></main>
18
+ <footer><span><i id="status-dot"></i><span id="status">就绪</span></span><span id="stats">DWG · 二维图纸阅读</span><span id="zoom-label">—</span></footer><div id="toast" role="alert" hidden></div><input id="file" type="file" accept=".dwg" hidden>
19
+ <dialog class="history-dialog" id="history-dialog" aria-labelledby="history-title"><div class="history-heading"><h2 id="history-title">最近打开的图纸</h2><button id="history-close" aria-label="关闭历史记录">×</button></div><p class="history-note">自动保留最近 10 份图纸的本机副本,点击即可重新打开。<br>记录只保存在当前浏览器中,重新打开的是上次读取时的版本。</p><div id="history-list" class="history-list"></div><div class="history-footer"><span id="history-count">本机历史记录</span><button id="history-clear">清空记录</button></div></dialog>`;
20
+ const $=<T extends HTMLElement=HTMLElement>(id:string)=>document.getElementById(id) as T;
21
+ // Codex-style workspace: file history on the left, structure and properties on the right.
22
+ const propertiesPanel=document.querySelector('main > aside') as HTMLElement;
23
+ propertiesPanel.id='properties-panel';propertiesPanel.classList.add('properties-panel');
24
+ document.querySelector('main')!.append(propertiesPanel);
25
+ propertiesPanel.querySelector('.aside-heading > span')!.textContent='结构与属性';
26
+ propertiesPanel.querySelector('.aside-heading')!.insertAdjacentHTML('afterend','<div id="properties" class="property-summary"><span class="property-placeholder">打开文件后显示属性</span></div>');
27
+ document.querySelector('main')!.insertAdjacentHTML('afterbegin',`<aside id="files-panel" class="files-panel"><div class="panel-heading"><strong>文件</strong><span class="badge">本机</span></div><button id="file-panel-open" class="new-file">${icon('folder')}打开图纸或模型<span>+</span></button><div class="files-section-title">最近打开</div><div id="file-history-host" class="files-list"></div><div class="files-footer"><span>历史副本仅保存在本机</span><button id="file-history-clear">清空记录</button></div></aside>`);
28
+ $('file-history-host').append($('history-list'));
29
+ document.querySelector('.header-actions')!.insertAdjacentHTML('afterbegin','<button id="toggle-files" class="panel-toggle" aria-label="展开或收起文件面板" title="展开或收起文件面板" aria-expanded="true">☰</button>');
30
+ document.querySelector('.header-actions')!.insertAdjacentHTML('beforeend','<button id="toggle-properties" class="panel-toggle" aria-label="展开或收起属性面板" title="展开或收起属性面板" aria-expanded="true">◧</button>');
31
+ $('canvas').insertAdjacentHTML('afterend','<div id="model-host" hidden></div>');
32
+ $('file').setAttribute('accept','.dwg,.3dm');document.querySelector('.brand-sub')!.textContent='DWG / 3DM';
33
+ $('file-name').textContent='图纸与模型阅读器';$('stats').textContent='DWG 二维 / 3DM 三维';
34
+ document.querySelector('h1')!.textContent='从图纸,到空间。';
35
+ document.querySelector('.welcome p')!.textContent='DWG 浏览二维图纸,3DM 旋转查看模型。从右侧目录直达对应对象。';
36
+ $('choose').innerHTML=`${icon('folder')}选择 DWG / 3DM 文件`;
37
+ $('open').innerHTML=`${icon('folder')}打开文件<span class="key">Ctrl O</span>`;
38
+ document.querySelector('.history-note')!.textContent='历史副本保存在当前浏览器,可重开 DWG 图纸和 3DM 模型。';
39
+ let mode:'dwg'|'3dm'='dwg',model:ModelViewer|null=null,modelController:AbortController|null=null,activeFile:File|null=null;
40
+ const viewer=new Viewer($<HTMLCanvasElement>('canvas'));
41
+ let scene:Scene|null=null,worker:Worker|null=null,tab='layers',busy=false,fileName='',timer:ReturnType<typeof setTimeout>|null=null,requestId=0;
42
+ const nodes=new Map<string,Item>();let allNodes:Item[]=[];
43
+ let pendingHistoryFile:File|null=null;
44
+ viewer.onChange=()=>{if(mode==='dwg')$('zoom-label').textContent=scene?`1 px ≈ ${(1/viewer.scale).toLocaleString('zh-CN',{maximumFractionDigits:2})} 图纸单位`: '—';};
45
+ function setMode(next:'dwg'|'3dm'){
46
+ mode=next;$('canvas').hidden=next==='3dm';model?.setActive(next==='3dm');(document.querySelector('.axis') as HTMLElement).hidden=next==='3dm';
47
+ document.querySelector('.canvas-hint')!.textContent=next==='3dm'?'左键旋转 · 右键 / Shift 拖动平移 · 滚轮缩放 · 点击部件聚焦':'拖动平移 · 滚轮缩放 · 双击显示全图';
48
+ document.querySelector('[data-tab=blocks]')!.textContent=next==='3dm'?'部件':'图块';(document.querySelector('[data-tab=texts]') as HTMLElement).hidden=next==='3dm';
49
+ tab=next==='3dm'?'blocks':'layers';document.querySelectorAll<HTMLButtonElement>('[data-tab]').forEach(b=>b.setAttribute('aria-selected',String(b.dataset.tab===tab)));
50
+ $<HTMLInputElement>('search').value='';$('search').setAttribute('placeholder',next==='3dm'?'搜索图层、部件名称':'搜索图层、图块、文字');$('selection').hidden=true;
51
+ }
52
+ function showProperties(rows:[string,string][]){const root=$('properties');root.replaceChildren();for(const [label,value] of rows){const row=document.createElement('div');row.className='property-row';const key=document.createElement('span'),val=document.createElement('span');key.textContent=label;val.textContent=value;val.title=value;row.append(key,val);root.append(row);}}
53
+ const number=(n:number)=>n.toLocaleString('zh-CN',{maximumFractionDigits:2});
54
+ function fileProperties(){if(activeFile)showProperties([['文件',activeFile.name],['格式',mode==='3dm'?'Rhino 3DM · 三维':'AutoCAD DWG · 二维'],['大小',`${(activeFile.size/1024/1024).toFixed(2)} MB`],['操作',mode==='3dm'?'旋转 / 平移 / 部件聚焦':'平移 / 缩放 / 对象定位']]);}
55
+ function toast(message:string){$('toast').textContent=message;$('toast').hidden=false;setTimeout(()=>$('toast').hidden=true,7000);}
56
+ function loading(value:boolean){busy=value;$('loading').hidden=!value;$<HTMLButtonElement>('open').disabled=value;$<HTMLButtonElement>('recent').disabled=value;$<HTMLSelectElement>('spaces').disabled=value;}
57
+ function failure(message:string){pendingHistoryFile=null;loading(false);if(timer)clearTimeout(timer);toast(message);$('status').textContent=activeFile?'读取失败 · 保留当前文件':'读取失败';$('status-dot').classList.add('warn');}
58
+ function makeWorker(){worker?.terminate();worker=new Worker(new URL('./parser.worker.ts',import.meta.url),{type:'module'});worker.onmessage=e=>{
59
+ if(e.data.progress)$('progress').textContent=e.data.progress;
60
+ if(e.data.error)failure(e.data.error);
61
+ if(e.data.scene){if(timer)clearTimeout(timer);scene=e.data.scene;loading(false);nodes.clear();allNodes=[];
62
+ const walk=(items:Item[])=>items.forEach(n=>{nodes.set(n.id,n);allNodes.push(n);walk(n.children);});walk(scene!.items);
63
+ setMode('dwg');model?.clear();viewer.load(scene!);$('welcome').hidden=true;$('file-name').textContent=fileName;$('file-name').title=fileName;
64
+ if(pendingHistoryFile){const savedFile=pendingHistoryFile;activeFile=savedFile;pendingHistoryFile=null;void rememberDrawing(savedFile).then(renderHistory).catch(()=>toast('文件已打开,但浏览器未能保存历史副本。'));}fileProperties();
65
+ $('drawing-state').textContent='只读预览';$('space-label').textContent=scene!.space.toLowerCase().includes('model')?'模型空间':'布局空间';$('item-count').textContent=allNodes.length.toLocaleString();
66
+ const spaces=$<HTMLSelectElement>('spaces');spaces.replaceChildren(...scene!.spaces.map(s=>{const o=document.createElement('option');o.value=s;o.textContent=s.toLowerCase().includes('model')?'模型空间':`布局空间 · ${s}`;return o;}));spaces.value=scene!.space;spaces.hidden=scene!.spaces.length<2;
67
+ const unsupported=Object.entries(scene!.unsupported),missing=unsupported.reduce((n,[,v])=>n+v,0)+scene!.unknown;
68
+ $('status').textContent=missing?`已读取 · ${missing} 项兼容提示`:(scene!.warnings?.length?'已读取 · 有兼容提示':'已读取');$('status').title=unsupported.map(([t,n])=>`${t}:${n}`).join(';')+(scene!.unknown?`;解析器未知对象:${scene!.unknown}`:'')+(scene!.warnings?.length?`;DWG 解析告警:${scene!.warnings.join(', ')},部分自定义对象可能不完整`:'');$('status-dot').classList.toggle('warn',!!missing||!!scene!.warnings?.length);
69
+ $('stats').textContent=`${scene!.items.length.toLocaleString()} 个顶层对象 · ${scene!.layers.length} 个可见图层 · ${scene!.primitives.length.toLocaleString()} 个图元`;
70
+ $('selection').hidden=true;renderTree();if(!valid(scene!.bounds))toast('当前空间没有可显示的图形,请切换空间。');
71
+ }
72
+ };worker.onerror=e=>failure(`解析失败:${e.message||'解析器异常,请重新打开文件'}`);return worker;}
73
+ function timeout(){if(timer)clearTimeout(timer);timer=setTimeout(()=>{requestId++;worker?.terminate();worker=null;modelController?.abort();failure('读取超过 120 秒,已停止。请尝试较小文件,或在原软件中保存显示网格后重试。');},120000);}
74
+ async function openFile(file:File){if(busy)return;if(!/\.(dwg|3dm)$/i.test(file.name)){toast('请选择 DWG 图纸或 3DM 模型。');return;}if(file.size>100*1024*1024){toast('当前版本支持 100 MB 以内的文件。');return;}
75
+ const current=++requestId;loading(true);$('progress').textContent='正在读取文件…';timeout();try{
76
+ const buffer=await file.arrayBuffer();if(current!==requestId)return;const isModel=/\.3dm$/i.test(file.name),header=new TextDecoder().decode(buffer.slice(0,32));
77
+ if(isModel?!header.startsWith('3D Geometry File Format'):!header.startsWith('AC10'))throw new Error('文件头与格式不匹配,请确认文件未损坏。');
78
+ fileName=file.name;pendingHistoryFile=file;
79
+ if(!isModel){makeWorker().postMessage({buffer,wasmUrl:new URL('./',location.href).href},[buffer]);return;}
80
+ $('progress').textContent='正在解析 3DM 几何与部件…';modelController=new AbortController();const signal=modelController.signal;
81
+ if(!model){const module=await import('./model-viewer');if(current!==requestId)return;model=new module.ModelViewer($('model-host'));model.onSelect=part=>selectedModel(part,false);model.onChange=()=>{if(mode==='3dm')$('zoom-label').textContent='3DM · 透视视图';};}
82
+ await model.load(buffer,signal);if(current!==requestId)return;if(timer)clearTimeout(timer);worker?.terminate();worker=null;scene=null;allNodes=[];nodes.clear();setMode('3dm');
83
+ activeFile=file;pendingHistoryFile=null;void rememberDrawing(file).then(renderHistory).catch(()=>toast('模型已打开,但未能保存历史副本。'));
84
+ $('welcome').hidden=true;$('file-name').textContent=file.name;$('file-name').title=file.name;fileProperties();$('spaces').hidden=true;$('space-label').textContent='3DM · 三维模型';$('drawing-state').textContent='只读预览';$('item-count').textContent=model.parts.length.toLocaleString();
85
+ $('stats').textContent=`${model.parts.length.toLocaleString()} 个对象 · ${model.layers.length} 个图层`;$('status').textContent=model.warnings.length?`已读取 · ${model.warnings.length} 项兼容提示`:'已读取';$('status').title=model.warnings.length?'部分对象没有显示网格或暂不支持,可能未完整显示。请在 Rhino 中保存显示网格后重试。':'';$('status-dot').classList.toggle('warn',!!model.warnings.length);loading(false);renderTree();
86
+ }catch(e){if(current===requestId)failure(e instanceof Error?e.message:String(e));}
87
+ }
88
+ function indexes(item:Item):number[]{return[...item.primitives,...item.children.flatMap(indexes)];}
89
+ function focus(label:string,bounds:Bounds,ids:number[],element?:HTMLElement,item?:Item){if(!valid(bounds))return;viewer.focus(bounds,ids);document.querySelectorAll('.row.active').forEach(e=>e.classList.remove('active'));element?.classList.add('active');$('selection-text').textContent=label;$('selection').hidden=false;showProperties([['对象',label],['类型',item?.type??'图层'],['图层',item?.layer??label],['图元数',String(ids.length)],['宽 × 高',`${number(bounds.maxX-bounds.minX)} × ${number(bounds.maxY-bounds.minY)}`],['中心 X / Y',`${number((bounds.minX+bounds.maxX)/2)} / ${number((bounds.minY+bounds.maxY)/2)}`]]);}
90
+ function renderTree(){
91
+ if(mode==='3dm'){renderModelTree();return;}const root=$('tree');root.replaceChildren();if(!scene)return;const query=$<HTMLInputElement>('search').value.trim().toLowerCase();
92
+ const makeRow=(label:string,detail:string,onClick:()=>void,depth=0)=>{
93
+ const row=document.createElement('div');row.className='row';row.style.paddingLeft=`${14+depth*16}px`;
94
+ const button=document.createElement('button');button.className='row-label';button.title=label;button.innerHTML=`<span class="row-icon">${icon(tab==='layers'?'layers':'file')}</span><span class="label"></span><span class="row-detail"></span>`;
95
+ button.querySelector('.label')!.textContent=label;button.querySelector('.row-detail')!.textContent=detail;button.onclick=()=>{onClick();document.querySelectorAll('.row.active').forEach(e=>e.classList.remove('active'));row.classList.add('active');};row.append(button);return row;
96
+ };
97
+ const appendItems=(parent:HTMLElement,items:Item[],depth=0)=>{
98
+ let shown=0;const more=document.createElement('button');more.className='more';
99
+ const append=()=>{more.remove();const end=Math.min(shown+80,items.length);for(;shown<end;shown++){
100
+ const n=items[shown],row=makeRow(n.label,n.type,()=>focus(n.label,n.bounds,indexes(n),undefined,n),depth);parent.append(row);
101
+ if(n.children.length){const expand=document.createElement('button');expand.className='expand';expand.innerHTML=icon('chevron');expand.setAttribute('aria-label',`展开 ${n.label}`);expand.setAttribute('aria-expanded','false');row.prepend(expand);const sub=document.createElement('div');sub.hidden=true;parent.append(sub);expand.onclick=()=>{sub.hidden=!sub.hidden;expand.classList.toggle('expanded',!sub.hidden);expand.setAttribute('aria-expanded',String(!sub.hidden));if(!sub.hidden&&!sub.children.length)appendItems(sub,n.children,depth+1);};}
102
+ }if(shown<items.length){more.textContent=`再显示 ${Math.min(80,items.length-shown)} 项(剩余 ${items.length-shown})`;more.onclick=append;parent.append(more);}};append();
103
+ };
104
+ if(tab==='layers'){
105
+ const layerItems=scene.layers.filter(l=>!query||l.name.toLowerCase().includes(query));
106
+ for(const layer of layerItems){const ids:number[]=[],bounds=emptyBounds();scene.primitives.forEach((p,i)=>{if(p.layer===layer.name){ids.push(i);union(bounds,p.bounds);}});
107
+ const row=makeRow(layer.name,String(ids.length),()=>focus(layer.name,bounds,ids));const dot=row.querySelector<HTMLElement>('.row-icon')!;dot.style.color=drawingColor(layer.color);
108
+ const eye=document.createElement('button');eye.className='eye';eye.title='显示 / 隐藏图层';eye.setAttribute('aria-label',`显示或隐藏 ${layer.name}`);eye.setAttribute('aria-pressed',String(!viewer.hidden.has(layer.name)));eye.innerHTML=icon('eye');eye.onclick=()=>{viewer.hidden.has(layer.name)?viewer.hidden.delete(layer.name):viewer.hidden.add(layer.name);eye.classList.toggle('muted',viewer.hidden.has(layer.name));eye.setAttribute('aria-pressed',String(!viewer.hidden.has(layer.name)));viewer.draw();};row.append(eye);
109
+ const expand=document.createElement('button');expand.className='expand';expand.innerHTML=icon('chevron');expand.setAttribute('aria-label',`展开图层 ${layer.name}`);row.prepend(expand);root.append(row);const sub=document.createElement('div');sub.hidden=true;root.append(sub);expand.onclick=()=>{sub.hidden=!sub.hidden;expand.classList.toggle('expanded',!sub.hidden);expand.setAttribute('aria-expanded',String(!sub.hidden));if(!sub.hidden&&!sub.children.length)appendItems(sub,allNodes.filter(n=>n.layer===layer.name&&n.primitives.length>0),1);};
110
+ }
111
+ }else{
112
+ const items=allNodes.filter(n=>(tab==='blocks'?n.type==='INSERT':['TEXT','MTEXT','ATTRIB'].includes(n.type))&&(!query||`${n.label} ${n.layer}`.toLowerCase().includes(query)));appendItems(root,items);
113
+ }
114
+ if(!root.children.length){const empty=document.createElement('div');empty.className='tree-empty';empty.textContent='没有匹配的项目';root.append(empty);}
115
+ }
116
+ $('open').onclick=$('choose').onclick=()=>$<HTMLInputElement>('file').click();
117
+ $<HTMLInputElement>('file').onchange=e=>{const input=e.target as HTMLInputElement;if(input.files?.[0])void openFile(input.files[0]);input.value='';};
118
+ $('cancel').onclick=()=>{requestId++;pendingHistoryFile=null;modelController?.abort();worker?.terminate();worker=null;if(timer)clearTimeout(timer);loading(false);$('status').textContent=activeFile?'已取消 · 保留当前文件':'已取消';};
119
+ $('zoom-in').onclick=()=>mode==='3dm'?model?.zoom(1.4):viewer.zoom(1.4);$('zoom-out').onclick=()=>mode==='3dm'?model?.zoom(1/1.4):viewer.zoom(1/1.4);$('fit').onclick=()=>{if(mode==='3dm'){model?.fit();$('selection').hidden=true;fileProperties();}else viewer.fit();};
120
+ $('clear-selection').onclick=()=>{if(mode==='3dm')model?.clearSelection();else{viewer.selected.clear();viewer.selection=null;viewer.draw();}$('selection').hidden=true;fileProperties();};
121
+ $('status').onclick=()=>{if($('status').title)toast($('status').title);};
122
+ $<HTMLInputElement>('search').oninput=()=>renderTree();
123
+ document.querySelectorAll<HTMLButtonElement>('[data-tab]').forEach(b=>b.onclick=()=>{tab=b.dataset.tab!;document.querySelectorAll('[data-tab]').forEach(t=>t.setAttribute('aria-selected',String(t===b)));renderTree();});
124
+ $<HTMLSelectElement>('spaces').onchange=e=>{if(!worker||busy)return;loading(true);worker.postMessage({space:(e.target as HTMLSelectElement).value});timeout();};
125
+ document.addEventListener('keydown',e=>{if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()==='o'){e.preventDefault();if(!busy)$<HTMLInputElement>('file').click();}if(e.key==='/'&&!(e.target instanceof HTMLInputElement)){e.preventDefault();$('search').focus();}});
126
+ let dragDepth=0;window.addEventListener('dragenter',e=>{e.preventDefault();dragDepth++;if(!busy)$('drop-mask').classList.add('visible');});window.addEventListener('dragover',e=>e.preventDefault());window.addEventListener('dragleave',()=>{dragDepth=Math.max(0,dragDepth-1);if(!dragDepth)$('drop-mask').classList.remove('visible');});window.addEventListener('drop',e=>{e.preventDefault();dragDepth=0;$('drop-mask').classList.remove('visible');if(e.dataTransfer?.files[0])void openFile(e.dataTransfer.files[0]);});
127
+ fetch('/api/sample-info').then(r=>r.ok?r.json():null).then(info=>{if(!info)return;$('sample').hidden=false;$('sample').onclick=async()=>{try{const r=await fetch('/api/sample');if(!r.ok)throw new Error('读取示例失败');await openFile(new File([await r.arrayBuffer()],info.name,{lastModified:0}));}catch(e){toast(String(e));}};}).catch(()=>{});
128
+
129
+ async function renderHistory(){
130
+ const root=$('history-list');root.replaceChildren();
131
+ try{
132
+ const drawings=await listHistory();$('history-count').textContent=`${drawings.length} / 10 份 · 最多 250 MB`;$<HTMLButtonElement>('history-clear').disabled=!drawings.length;
133
+ if(!drawings.length){const empty=document.createElement('div');empty.className='history-empty';empty.textContent='还没有历史记录,打开一份图纸后会自动保存。';root.append(empty);return;}
134
+ for(const drawing of drawings){
135
+ const row=document.createElement('div');row.className='history-row';row.classList.toggle('current',activeFile?.name===drawing.name&&activeFile?.lastModified===drawing.lastModified);const open=document.createElement('button');open.className='history-open';open.title=drawing.name;open.innerHTML=`${icon('file')}<span class="history-file"><span class="history-name"></span><span class="history-meta"></span></span>`;
136
+ open.querySelector('.history-name')!.textContent=drawing.name;
137
+ open.querySelector('.history-meta')!.textContent=`${(drawing.size/1024/1024).toFixed(2)} MB · ${new Date(drawing.openedAt).toLocaleString('zh-CN',{month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hour12:false})} 打开`;
138
+ open.onclick=()=>{$<HTMLDialogElement>('history-dialog').close();void openFile(new File([drawing.blob],drawing.name,{lastModified:drawing.lastModified}));};
139
+ const remove=document.createElement('button');remove.className='history-remove';remove.textContent='移除';remove.setAttribute('aria-label',`移除历史记录 ${drawing.name}`);remove.onclick=async()=>{try{await deleteHistory(drawing.id);await renderHistory();}catch{toast('移除历史记录失败,请重试。');}};row.append(open,remove);root.append(row);
140
+ }
141
+ }catch{root.textContent='当前浏览器无法使用本机存储,历史记录暂不可用。';$<HTMLButtonElement>('history-clear').disabled=true;}
142
+ }
143
+ $('recent').onclick=()=>{if(busy)return;togglePanel('files',true);void renderHistory();};
144
+ $('history-close').onclick=()=>$<HTMLDialogElement>('history-dialog').close();
145
+ $('history-clear').onclick=async()=>{try{await deleteHistory();await renderHistory();}catch{toast('清空历史记录失败,请重试。');}};
146
+ $('file-history-clear').onclick=$('history-clear').onclick;
147
+ $('file-panel-open').onclick=()=>$<HTMLInputElement>('file').click();
148
+ function togglePanel(name:'files'|'properties',force?:boolean){const panel=$(`${name}-panel`),expanded=force??panel.hidden;panel.hidden=!expanded;$(`toggle-${name}`).setAttribute('aria-expanded',String(expanded));try{localStorage.setItem(`reader-panel-${name}`,String(expanded));}catch{}}
149
+ for(const name of ['files','properties'] as const){$(`toggle-${name}`).onclick=()=>togglePanel(name);try{if(localStorage.getItem(`reader-panel-${name}`)==='false')togglePanel(name,false);}catch{}}
150
+ void renderHistory();
151
+
152
+ function selectedModel(part:ModelPart,move=true){if(move)model!.focus([part]);$('selection-text').textContent=part.label;$('selection').hidden=false;const size=part.bounds.getSize(part.object.position.clone());showProperties([['对象',part.label],['类型',part.kind],['图层',part.layer],['尺寸 X',number(size.x)],['尺寸 Y',number(size.y)],['尺寸 Z',number(size.z)],['坐标单位','模型原始单位']]);document.querySelectorAll('.row.active').forEach(e=>e.classList.remove('active'));document.querySelectorAll<HTMLElement>('[data-part]').forEach(e=>{if(e.dataset.part===part.id)e.classList.add('active');});}
153
+ function renderModelTree(){
154
+ const root=$('tree');root.replaceChildren();if(!model)return;const query=$<HTMLInputElement>('search').value.trim().toLowerCase();
155
+ const make=(label:string,detail:string,click:()=>void,depth=0)=>{const row=document.createElement('div');row.className='row';row.style.paddingLeft=`${14+depth*14}px`;const button=document.createElement('button');button.className='row-label';button.title=label;button.innerHTML=`<span class="row-icon">${icon('file')}</span><span class="label"></span><span class="row-detail"></span>`;button.querySelector('.label')!.textContent=label;button.querySelector('.row-detail')!.textContent=detail;button.onclick=()=>{click();document.querySelectorAll('.row.active').forEach(e=>e.classList.remove('active'));row.classList.add('active');};row.append(button);return row;};
156
+ const expandable=(row:HTMLElement,parent:HTMLElement,fill:(sub:HTMLElement)=>void)=>{const button=document.createElement('button');button.className='expand';button.innerHTML=icon('chevron');button.setAttribute('aria-label',`展开 ${row.textContent}`);button.setAttribute('aria-expanded','false');row.prepend(button);const sub=document.createElement('div');sub.hidden=true;parent.append(row,sub);button.onclick=()=>{sub.hidden=!sub.hidden;button.classList.toggle('expanded',!sub.hidden);button.setAttribute('aria-expanded',String(!sub.hidden));if(!sub.hidden&&!sub.children.length)fill(sub);};};
157
+ const append=(parent:HTMLElement,parts:ModelPart[],depth=0)=>{let count=0;const more=document.createElement('button');more.className='more';const batch=()=>{more.remove();const end=Math.min(count+80,parts.length);for(;count<end;count++){const part=parts[count],row=make(part.label,part.kind,()=>selectedModel(part),depth);row.dataset.part=part.id;if(part.children.length)expandable(row,parent,sub=>append(sub,part.children,depth+1));else parent.append(row);}if(count<parts.length){more.textContent=`再显示 ${Math.min(80,parts.length-count)} 项`;more.onclick=batch;parent.append(more);}};batch();};
158
+ if(tab==='layers')for(const layer of model.layers.filter(l=>l.toLowerCase().includes(query))){const parts=model.parts.filter(p=>p.layer===layer);const row=make(layer,String(parts.length),()=>{model!.focus(parts);$('selection-text').textContent=layer;$('selection').hidden=false;showProperties([['类型','模型图层'],['图层',layer],['对象数',String(parts.length)]]);});const eye=document.createElement('button');eye.className='eye';eye.innerHTML=icon('eye');eye.setAttribute('aria-label',`显示或隐藏 ${layer}`);eye.setAttribute('aria-pressed',String(model.layerVisible(layer)));eye.onclick=()=>{const visible=model!.toggleLayer(layer);eye.classList.toggle('muted',!visible);eye.setAttribute('aria-pressed',String(visible));};row.append(eye);expandable(row,root,sub=>append(sub,parts,1));}
159
+ else append(root,query?model.parts.filter(p=>`${p.label} ${p.layer} ${p.kind}`.toLowerCase().includes(query)):model.roots);
160
+ if(!root.children.length){const empty=document.createElement('div');empty.className='tree-empty';empty.textContent='没有匹配的项目';root.append(empty);}
161
+ }
src/model-viewer.ts ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as THREE from 'three';
2
+ import {OrbitControls} from 'three/addons/controls/OrbitControls.js';
3
+ import {Rhino3dmLoader} from 'three/addons/loaders/3DMLoader.js';
4
+
5
+ export type ModelPart={id:string;label:string;kind:string;layer:string;object:THREE.Object3D;bounds:THREE.Box3;children:ModelPart[]};
6
+ export class ModelViewer{
7
+ readonly scene=new THREE.Scene();
8
+ readonly camera=new THREE.PerspectiveCamera(42,1,.01,1e8);
9
+ readonly renderer:THREE.WebGLRenderer;
10
+ readonly controls:OrbitControls;
11
+ parts:ModelPart[]=[];roots:ModelPart[]=[];layers:string[]=[];warnings:string[]=[];root:THREE.Object3D|null=null;
12
+ onSelect:(part:ModelPart)=>void=()=>{};onChange:()=>void=()=>{};
13
+ private objectParts=new Map<THREE.Object3D,ModelPart>();private frame=0;private active=false;
14
+ private originalMaterials=new Map<THREE.Object3D,THREE.Material|THREE.Material[]>();
15
+ private helper:THREE.Box3Helper|null=null;
16
+ private animation:{start:number;from:THREE.Vector3;to:THREE.Vector3;targetFrom:THREE.Vector3;targetTo:THREE.Vector3}|null=null;
17
+ constructor(readonly host:HTMLElement){
18
+ this.renderer=new THREE.WebGLRenderer({antialias:true,alpha:false});this.renderer.setPixelRatio(Math.min(devicePixelRatio,2));this.renderer.setClearColor('#e8f2fb');
19
+ this.renderer.domElement.tabIndex=0;this.renderer.domElement.setAttribute('aria-label','三维模型,左键旋转,右键拖动,滚轮缩放,点击部件聚焦');host.append(this.renderer.domElement);
20
+ this.camera.up.set(0,0,1);this.controls=new OrbitControls(this.camera,this.renderer.domElement);this.controls.enableDamping=true;
21
+ this.controls.addEventListener('change',()=>this.draw());this.controls.addEventListener('start',()=>{this.animation=null;});
22
+ this.scene.add(new THREE.HemisphereLight(0xffffff,0x6c7c99,2.5));
23
+ const light=new THREE.DirectionalLight(0xffffff,2.3);light.position.set(1,-2,4);this.scene.add(light);
24
+ const fill=new THREE.DirectionalLight(0xb8d7ff,1.6);fill.position.set(-2,3,1);this.scene.add(fill);
25
+ new ResizeObserver(()=>{const w=host.clientWidth,h=host.clientHeight;if(!w||!h)return;this.renderer.setSize(w,h);this.camera.aspect=w/h;this.camera.updateProjectionMatrix();this.draw();}).observe(host);
26
+ let down:{x:number;y:number}|null=null;
27
+ this.renderer.domElement.addEventListener('pointerdown',e=>{down=e.button===0?{x:e.clientX,y:e.clientY}:null;});
28
+ this.renderer.domElement.addEventListener('pointerup',e=>{if(!down||Math.hypot(e.clientX-down.x,e.clientY-down.y)>4)return;down=null;this.pick(e);});
29
+ this.renderer.domElement.addEventListener('contextmenu',e=>e.preventDefault());
30
+ this.renderer.domElement.addEventListener('dblclick',()=>this.fit());
31
+ this.renderer.domElement.addEventListener('keydown',e=>{if(e.key==='Home'||e.key.toLowerCase()==='f'){e.preventDefault();this.fit();}if(e.key==='Escape')this.clearSelection();if(e.key==='+'||e.key==='=')this.zoom(1.3);if(e.key==='-')this.zoom(1/1.3);});
32
+ }
33
+ setActive(value:boolean){this.active=value;this.controls.enabled=value;this.host.hidden=!value;if(value){const w=this.host.clientWidth,h=this.host.clientHeight;if(w&&h){this.renderer.setSize(w,h);this.camera.aspect=w/h;this.camera.updateProjectionMatrix();}if(this.root)this.fit(true);this.draw();}else{cancelAnimationFrame(this.frame);this.frame=0;}}
34
+ async load(buffer:ArrayBuffer,signal:AbortSignal){
35
+ const manager=new THREE.LoadingManager();
36
+ manager.setURLModifier(url=>{
37
+ if(url.startsWith('data:')||url.startsWith('blob:'))return url;
38
+ const parsed=new URL(url,location.href);
39
+ if(parsed.origin!==location.origin||!parsed.pathname.includes('/rhino/'))throw new Error('模型引用了外部资源,已阻止联网读取。请把显示网格和纹理嵌入 3DM。');
40
+ return parsed.href;
41
+ });
42
+ const loader=new Rhino3dmLoader(manager).setLibraryPath(new URL('./rhino/',location.href).href).setWorkerLimit(1);
43
+ const object=await new Promise<THREE.Object3D>((resolve,reject)=>{
44
+ const abort=()=>{loader.dispose();reject(new DOMException('已取消读取','AbortError'));};signal.addEventListener('abort',abort,{once:true});
45
+ if(signal.aborted){abort();return;}
46
+ loader.parse(buffer,result=>{signal.removeEventListener('abort',abort);loader.dispose();if(signal.aborted){this.disposeObject(result);reject(new DOMException('已取消读取','AbortError'));}else resolve(result);},error=>{signal.removeEventListener('abort',abort);loader.dispose();reject(new Error(error?.message||'无法解析 3DM,请检查文件是否损坏。'));});
47
+ });
48
+ if(signal.aborted){this.disposeObject(object);throw new DOMException('已取消读取','AbortError');}
49
+ object.updateMatrixWorld(true);
50
+ const initialBox=new THREE.Box3();object.traverseVisible(o=>{const g=(o as THREE.Mesh).geometry;if(g){if(!g.boundingBox)g.computeBoundingBox();if(g.boundingBox)initialBox.union(g.boundingBox.clone().applyMatrix4(o.matrixWorld));}});
51
+ if(initialBox.isEmpty()||!Number.isFinite(initialBox.min.length()+initialBox.max.length())){this.disposeObject(object);throw new Error('此 3DM 没有可显示的几何对象。请在 Rhino 中开启保存显示网格后另存。');}
52
+ const center=initialBox.getCenter(new THREE.Vector3());object.position.sub(center);object.updateMatrixWorld(true);
53
+ const parts:ModelPart[]=[],map=new Map<THREE.Object3D,ModelPart>();
54
+ const layerInfo=object.userData.layers??[];let number=0;
55
+ const walk=(o:THREE.Object3D):ModelPart|null=>{
56
+ const children=o.children.map(walk).filter((n):n is ModelPart=>n!==null);
57
+ const geometry=(o as THREE.Mesh).geometry;if(!geometry&&!children.length)return null;
58
+ const bounds=new THREE.Box3().setFromObject(o);if(bounds.isEmpty())return null;
59
+ const attr=o.userData.attributes??{},type=o.userData.objectType??(children.length?'InstanceReference':o.type);
60
+ const labels:Record<string,string>={Brep:'曲面部件',Extrusion:'拉伸体',Mesh:'网格',Curve:'曲线',Point:'点',PointSet:'点云',SubD:'细分曲面',InstanceReference:'组合部件'};
61
+ const layer=layerInfo[attr.layerIndex]?.fullPath||layerInfo[attr.layerIndex]?.name||'未分层';
62
+ const part:ModelPart={id:o.uuid,label:attr.name||o.name||`${labels[type]??type} ${String(++number).padStart(3,'0')}`,kind:labels[type]??type,layer,object:o,bounds,children};
63
+ map.set(o,part);parts.push(part);return part;
64
+ };
65
+ const priority=(p:ModelPart)=>p.children.length?0:p.kind==='曲线'?10:p.kind==='点'||p.kind==='点云'?20:1;
66
+ const roots=object.children.map(walk).filter((n):n is ModelPart=>n!==null).sort((a,b)=>priority(a)-priority(b));
67
+ this.clear();this.parts=parts;this.roots=roots;this.objectParts=map;this.layers=[...new Set(parts.map(p=>p.layer))];
68
+ this.warnings=(object.userData.warnings??[]).map((w:{type?:string;message?:string})=>w.type||w.message||'未知对象');
69
+ // Retain the original geometry/materials; Rhino lights do not control the reader lighting.
70
+ object.traverse(o=>{if((o as THREE.Light).isLight)o.visible=false;});
71
+ this.root=object;this.scene.add(object);this.fit(true);
72
+ }
73
+ private visibleBounds(){const bounds=new THREE.Box3();this.root?.traverseVisible(o=>{const g=(o as THREE.Mesh).geometry;if(g){if(!g.boundingBox)g.computeBoundingBox();if(g.boundingBox)bounds.union(g.boundingBox.clone().applyMatrix4(o.matrixWorld));}});return bounds;}
74
+ fit(initial=false){const b=this.visibleBounds();if(b.isEmpty())return;this.clearSelection();this.frameBox(b,initial);}
75
+ private frameBox(bounds:THREE.Box3,initial=false){
76
+ const center=bounds.getCenter(new THREE.Vector3()),size=bounds.getSize(new THREE.Vector3()),radius=Math.max(size.length()/2,.001);
77
+ const vFov=THREE.MathUtils.degToRad(this.camera.fov),hFov=2*Math.atan(Math.tan(vFov/2)*this.camera.aspect),distance=radius/Math.sin(Math.min(vFov,hFov)/2)*1.2;
78
+ const direction=initial?new THREE.Vector3(1,-1,.7).normalize():this.camera.position.clone().sub(this.controls.target).normalize();if(!direction.lengthSq())direction.set(1,-1,1).normalize();
79
+ const all=this.root?new THREE.Box3().setFromObject(this.root).getSize(new THREE.Vector3()).length():radius*2;
80
+ this.camera.near=Math.max(distance/10000,.00001);this.camera.far=Math.max(distance*100,all*30);this.camera.updateProjectionMatrix();
81
+ this.controls.minDistance=Math.max(radius*.001,.00001);this.controls.maxDistance=Math.max(all*100,distance*100);
82
+ const to=center.clone().addScaledVector(direction,distance);
83
+ if(initial){this.animation=null;this.controls.target.copy(center);this.camera.position.copy(to);this.controls.update();}else this.animation={start:performance.now(),from:this.camera.position.clone(),to,targetFrom:this.controls.target.clone(),targetTo:center};
84
+ this.draw();
85
+ }
86
+ focus(parts:ModelPart[]){
87
+ this.clearSelection();const bounds=new THREE.Box3();const selected=new Set<THREE.Object3D>();
88
+ for(const part of parts){for(let o:THREE.Object3D|null=part.object;o&&o!==this.scene;o=o.parent)o.visible=true;bounds.union(part.bounds);part.object.traverse(o=>selected.add(o));}
89
+ if(bounds.isEmpty())return;
90
+ selected.forEach(o=>{const mesh=o as THREE.Mesh;if(!mesh.material)return;this.originalMaterials.set(o,mesh.material);const highlight=(m:THREE.Material)=>{const clone=m.clone() as THREE.MeshStandardMaterial;if(clone.color)clone.color.set('#3799cf');if(clone.emissive)clone.emissive.set('#16374b');return clone;};mesh.material=Array.isArray(mesh.material)?mesh.material.map(highlight):highlight(mesh.material);});
91
+ this.helper=new THREE.Box3Helper(bounds,0x177db4);this.scene.add(this.helper);this.frameBox(bounds);this.draw();
92
+ }
93
+ clearSelection(){this.originalMaterials.forEach((material,o)=>{const current=(o as THREE.Mesh).material;for(const m of Array.isArray(current)?current:[current])m.dispose();(o as THREE.Mesh).material=material;});this.originalMaterials.clear();if(this.helper){this.scene.remove(this.helper);this.helper.geometry.dispose();(this.helper.material as THREE.Material).dispose();this.helper=null;}this.draw();}
94
+ toggleLayer(layer:string){const parts=this.parts.filter(p=>p.layer===layer),visible=parts.some(p=>p.object.visible);parts.forEach(p=>p.object.visible=!visible);this.draw();return !visible;}
95
+ layerVisible(layer:string){return this.parts.some(p=>p.layer===layer&&p.object.visible);}
96
+ zoom(factor:number){this.animation=null;this.camera.position.sub(this.controls.target).multiplyScalar(1/factor).add(this.controls.target);this.controls.update();this.draw();}
97
+ private pick(event:PointerEvent){if(!this.root)return;const rect=this.renderer.domElement.getBoundingClientRect(),mouse=new THREE.Vector2((event.clientX-rect.left)/rect.width*2-1,-(event.clientY-rect.top)/rect.height*2+1),ray=new THREE.Raycaster();ray.setFromCamera(mouse,this.camera);ray.params.Line.threshold=this.camera.position.distanceTo(this.controls.target)*.001;ray.params.Points.threshold=ray.params.Line.threshold;
98
+ const hits=ray.intersectObject(this.root,true).filter(hit=>{for(let p:THREE.Object3D|null=hit.object;p;p=p.parent)if(!p.visible)return false;return true;});
99
+ if(hits[0]){let o:THREE.Object3D|null=hits[0].object;while(o&&!this.objectParts.has(o))o=o.parent;if(o){const part=this.objectParts.get(o)!;this.focus([part]);this.onSelect(part);}}
100
+ }
101
+ draw(){if(!this.active||this.frame)return;this.frame=requestAnimationFrame(()=>{this.frame=0;if(this.animation){const a=this.animation,t=Math.min(1,(performance.now()-a.start)/380),s=1-(1-t)**3;this.camera.position.lerpVectors(a.from,a.to,s);this.controls.target.lerpVectors(a.targetFrom,a.targetTo,s);if(t===1)this.animation=null;}const changed=this.controls.update();this.renderer.render(this.scene,this.camera);this.onChange();if(this.animation||changed)this.draw();});}
102
+ clear(){this.clearSelection();if(this.root){this.scene.remove(this.root);this.disposeObject(this.root);}this.root=null;this.parts=[];this.roots=[];this.layers=[];this.objectParts.clear();}
103
+ private disposeObject(object:THREE.Object3D){const materials=new Set<THREE.Material>(),geometries=new Set<THREE.BufferGeometry>(),textures=new Set<THREE.Texture>();object.traverse(o=>{const mesh=o as THREE.Mesh;if(mesh.geometry)geometries.add(mesh.geometry);if(mesh.material)for(const m of Array.isArray(mesh.material)?mesh.material:[mesh.material])materials.add(m);});materials.forEach(m=>{Object.values(m).forEach(v=>{if(v instanceof THREE.Texture)textures.add(v);});m.dispose();});textures.forEach(t=>t.dispose());geometries.forEach(g=>g.dispose());}
104
+ }
src/parser.worker.ts ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {LibreDwg,Dwg_File_Type} from '@mlightcad/libredwg-web';
2
+ import {buildScene} from './geometry';
3
+ let engine:Awaited<ReturnType<typeof LibreDwg.create>>;
4
+ let database:any,unknown=0,warnings:number[]=[];
5
+ self.onmessage=async(event)=>{
6
+ try{
7
+ const {buffer,space,wasmUrl}=event.data;
8
+ if(buffer){
9
+ self.postMessage({progress:'正在解析 DWG 数据…'});
10
+ engine??=await LibreDwg.create(wasmUrl.replace(/\/$/,''));
11
+ warnings=[];const originalWarn=console.warn;let pointer:number|undefined;
12
+ try{console.warn=(...args:unknown[])=>{if(String(args[0]).includes('Open dwg file with error code:'))warnings.push(Number(args[1]));originalWarn(...args);};pointer=engine.dwg_read_data(buffer,Dwg_File_Type.DWG);}finally{console.warn=originalWarn;}
13
+ if(!pointer)throw new Error('无法读取此 DWG。文件可能损坏,或使用了暂不支持的版本。');
14
+ try{const result=engine.convertEx(pointer);database=result.database;unknown=result.stats.unknownEntityCount;}finally{engine.dwg_free(pointer);}
15
+ }
16
+ if(!database)throw new Error('请先打开图纸');
17
+ self.postMessage({progress:'正在构建图纸和定位目录…'});
18
+ self.postMessage({scene:{...buildScene(database,space,unknown),warnings}});
19
+ }catch(error){self.postMessage({error:error instanceof Error?error.message:String(error)});}
20
+ };
src/style.css ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root{font-family:Inter,"Microsoft YaHei",system-ui,sans-serif;color:#dbe4ef;background:#0e141e;font-synthesis:none;font-size:13px;color-scheme:dark}*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}button{border:0;background:transparent;color:inherit}button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid #65debd;outline-offset:2px}svg{width:18px;height:18px;flex-shrink:0}[hidden]{display:none!important}#app{height:100dvh;min-height:460px;display:flex;flex-direction:column}header{height:72px;flex-shrink:0;display:flex;align-items:center;gap:24px;border-bottom:1px solid #27303e;padding:0 24px;background:#151d29}.brand{display:flex;align-items:center;gap:10px;white-space:nowrap}.brand-icon{width:34px;height:34px;background:#61dcba;color:#102a27;border-radius:9px;display:grid;place-items:center}.brand strong{font-size:21px;letter-spacing:2px}.brand-separator{height:18px;width:1px;background:#354050;margin:0 3px}.brand-sub{font-size:10px;color:#8b98aa;letter-spacing:1.8px}.header-file{flex:1;min-width:0;text-align:center;color:#91a0b4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.primary{border-radius:7px;background:#61dcba;color:#112d28;display:flex;align-items:center;justify-content:center;gap:9px;padding:11px 16px;font-weight:600}.primary:hover{background:#7ce9cb}.key{font-size:10px;opacity:.6;padding-left:10px}.large{padding:13px 24px;font-size:14px}main{display:flex;flex:1;min-height:0}aside{width:300px;flex-shrink:0;border-right:1px solid #27303e;background:#151d29;display:flex;flex-direction:column}.aside-heading{padding:25px 20px 20px;display:flex;justify-content:space-between;align-items:center;font-size:14px;font-weight:600}.badge{font-size:10px;color:#8a9bb1;background:#202b3b;padding:3px 7px;border-radius:4px}.search{margin:0 16px;height:38px;border:1px solid #303b4b;border-radius:6px;background:#101823;display:flex;align-items:center;gap:8px;padding:0 10px;color:#74859c}.search svg{width:15px}.search input{background:none;border:0;outline:none;color:#dce7f3;width:100%;min-width:0;font-size:12px}.search input::placeholder{color:#758298}.search kbd{border:1px solid #354051;border-radius:3px;font:11px monospace;padding:0 4px}.tabs{display:flex;padding:0 16px;margin-top:20px;border-bottom:1px solid #27303e;gap:24px}.tabs button{padding:0 3px 13px;font-size:12px;color:#8291a6;border-bottom:2px solid transparent}.tabs button[aria-selected=true]{color:#6fe0c0;border-color:#6fe0c0}.tree{flex:1;overflow:auto;padding:10px 0;scrollbar-width:thin;scrollbar-color:#364355 transparent}.tree-empty{text-align:center;margin-top:65px;color:#728197;font-size:12px;line-height:2}.row{display:flex;min-height:37px;padding-right:8px;align-items:center;position:relative}.row:hover{background:#1e2b3a}.row.active{background:#203c3c;color:#84e8cc}.row-label{display:flex;align-items:center;gap:9px;flex:1;min-width:0;text-align:left;padding:9px 2px}.row-icon{display:flex;align-items:center;flex-shrink:0}.row-icon svg{width:14px;height:14px}.label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:11px;flex:1;min-width:0}.row-detail{font-size:9px;color:#7b8ca3;max-width:54px;overflow:hidden;text-overflow:ellipsis}.expand{padding:4px 3px;display:flex;color:#8090a5;margin-left:-6px}.expand svg{width:11px;height:11px}.expand.expanded svg{transform:rotate(90deg)}.eye{padding:5px;display:flex;color:#7e91a9}.eye svg{width:14px;height:14px}.eye.muted{opacity:.25}.more{font-size:11px;color:#73cfb7;padding:12px 20px;width:100%;text-align:left}.aside-footer{padding:16px;display:flex;align-items:center;gap:9px;border-top:1px solid #27303e;color:#7e8ea4;font-size:10px}.aside-footer svg{width:14px;height:14px;color:#65ceaf}.workspace{flex:1;min-width:0;position:relative;overflow:hidden;background-color:#0e151f;background-image:radial-gradient(#36435475 .65px,transparent .65px);background-size:22px 22px}.canvas-heading{position:absolute;top:0;left:0;right:0;display:flex;justify-content:space-between;align-items:center;padding:20px 24px;pointer-events:none;z-index:2}.crumb{display:flex;gap:9px;align-items:center;font-size:11px;color:#c0ccda}.live-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#66dab6;flex-shrink:0}#drawing-state{color:#61738d;font-size:10px;border-left:1px solid #344153;padding-left:10px;margin-left:4px}select{pointer-events:auto;background:#182231;border:1px solid #354255;color:#aebcd0;border-radius:5px;padding:6px}canvas{width:100%;height:100%;display:block;cursor:grab;outline:none}canvas.dragging{cursor:grabbing}.welcome{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none;padding-bottom:30px}.welcome button{pointer-events:auto}.welcome-art{position:relative;width:115px;height:105px;margin-bottom:28px;display:grid;place-items:center;background:radial-gradient(ellipse,#3e9b7e20,transparent 70%)}.welcome-art>svg{width:55px;height:55px;color:#69d7b7;stroke-width:1}.art-corner{position:absolute;width:14px;height:14px;border-color:#40586b;border-style:solid}.art-corner.a{top:0;left:0;border-width:1px 0 0 1px}.art-corner.b{top:0;right:0;border-width:1px 1px 0 0}.art-corner.c{bottom:0;left:0;border-width:0 0 1px 1px}.art-corner.d{bottom:0;right:0;border-width:0 1px 1px 0}.eyebrow{font-size:9px;letter-spacing:3px;color:#78a598}h1{font-size:26px;font-weight:500;letter-spacing:1px;margin:17px 0 10px}.welcome p{font-size:12px;color:#7f90a6;text-align:center;line-height:2;margin:0 0 28px}.sample{font-size:11px;color:#9eafbf;margin-top:17px}.sample:hover{color:#6bdfbb}.local-note{display:flex;align-items:center;gap:7px;margin-top:28px;color:#65788e;font-size:10px}.local-note .live-dot{width:4px;height:4px}.view-tools{position:absolute;right:22px;bottom:63px;background:#1b2533;border:1px solid #344052;display:flex;flex-direction:column;border-radius:8px;box-shadow:0 4px 20px #0002}.view-tools button{width:38px;height:39px;font-size:23px;display:grid;place-items:center;color:#bfcbda}.view-tools button:hover{color:#78dfc2;background:#2b3b48}.view-tools button:last-child{font-size:12px}.view-tools span{height:1px;background:#354052;margin:0 7px}.canvas-hint{position:absolute;bottom:22px;left:50%;transform:translateX(-50%);font-size:10px;color:#60738c;white-space:nowrap}.canvas-hint span{margin:0 11px}.axis{position:absolute;bottom:24px;left:25px;width:35px;height:35px;color:#8797ad;font:9px monospace;pointer-events:none}.axis i{position:absolute;left:9px;bottom:5px;width:23px;height:24px;border-left:1px solid #6ad0af;border-bottom:1px solid #de7d85}.axis .y{position:absolute;left:6px;top:-9px;color:#6ad0af}.axis .x{position:absolute;right:-7px;bottom:1px;color:#de7d85}footer{height:32px;flex-shrink:0;background:#151d29;border-top:1px solid #283241;display:flex;align-items:center;justify-content:space-between;padding:0 17px;font-size:10px;color:#7b8da4}footer>span:first-child{display:flex;align-items:center;gap:7px}#status-dot{width:5px;height:5px;background:#69d6b4;border-radius:50%}#status-dot.warn{background:#f0bc6a}.loading{position:absolute;inset:0;background:#101925ee;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;z-index:6}.loading strong{font-weight:500}.loading>span:not(.spinner){color:#8093ad;font-size:11px}.loading button{border:1px solid #47566a;border-radius:5px;padding:7px 18px;font-size:12px}.spinner{width:28px;height:28px;border:2px solid #334c4c;border-top-color:#71e1bf;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.selection{position:absolute;left:22px;top:64px;display:flex;align-items:center;gap:9px;max-width:70%;background:#183830ed;border:1px solid #326451;color:#9debcf;padding:9px 12px;border-radius:6px;font-size:11px}.selection>svg{width:13px;height:13px}.selection span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.selection button{font-size:19px;padding-left:8px}.drop-mask{display:none;position:absolute;inset:12px;z-index:10;border:2px dashed #6bdfbb;background:#122b28ed;color:#94ecd0;align-items:center;justify-content:center;font-size:22px;border-radius:12px;pointer-events:none}.drop-mask.visible{display:flex}#toast{position:fixed;bottom:55px;left:50%;transform:translateX(-50%);max-width:650px;background:#3e3024;color:#f5dcbb;border:1px solid #8a6945;padding:14px 22px;border-radius:8px;z-index:30;box-shadow:0 6px 25px #0004;font-size:12px}@media(max-width:850px){aside{width:240px}.brand-sub,.brand-separator,.key{display:none}header{padding:0 16px;gap:12px}.header-file{font-size:11px}h1{font-size:21px}.canvas-hint{display:none}}@media(max-width:580px){aside{width:185px}.tabs{gap:17px}.aside-footer{font-size:9px}.header-file{display:none}header{justify-content:space-between}.workspace .welcome h1{font-size:16px}.welcome p{font-size:10px}.canvas-heading{padding:15px}.crumb #drawing-state{display:none}footer #stats{display:none}.welcome-art{width:80px;height:75px}.eyebrow{font-size:7px;letter-spacing:1px}.selection{left:10px;max-width:90%}}
2
+
3
+ /* Soft blue theme */
4
+ :root{color:#304b65;background:#e8f2fb;color-scheme:light}
5
+ header,aside,footer{background:#f4f9fe;border-color:#ccdfef}
6
+ .brand-icon{background:#c2e3f9;color:#246d9b}.brand-separator{background:#c5daea}.brand-sub,.header-file{color:#5d7892}
7
+ .primary{background:#bedff6;color:#204f73;border:1px solid #a1cbe8}.primary:hover{background:#acd5f1}
8
+ .badge{color:#476d8e;background:#dfedf9}.search{background:#eaf3fc;border-color:#c6dced;color:#6687a4}.search input{color:#304e6b}.search input::placeholder{color:#6e89a1}.search kbd{border-color:#bfd4e5}
9
+ .tabs{border-color:#ccdfef}.tabs button{color:#637f99}.tabs button[aria-selected=true]{color:#216eaa;border-color:#428ec3}.tree{scrollbar-color:#b4ccdf transparent}.tree-empty{color:#728ba2}
10
+ .row:hover{background:#e4f0fb}.row.active{background:#d2e8f9;color:#1d6397}.row-detail,.expand,.eye{color:#607f9a}.more{color:#246fa6}.aside-footer{border-color:#ccdfef;color:#627e98}.aside-footer svg{color:#387caa}
11
+ .workspace{background-color:#e8f2fb;background-image:radial-gradient(#87afd332 .65px,transparent .65px)}.crumb{color:#3e607d}.live-dot{background:#4e9bb8}#drawing-state{color:#6b87a0;border-color:#bed5e7}
12
+ select{background:#f3f9ff;border-color:#bed5e7;color:#3e6280}.welcome-art{background:radial-gradient(ellipse,#a8d4f655,transparent 70%)}.welcome-art>svg{color:#5d9bc7}.art-corner{border-color:#94b8d5}.eyebrow{color:#6691af}.welcome p,.sample{color:#66829b}.sample:hover{color:#216eaa}.local-note{color:#6e8ba2}
13
+ .view-tools{background:#f4f9fe;border-color:#c1d8eb;box-shadow:0 4px 20px #487c9e12}.view-tools button{color:#456c8b}.view-tools button:hover{color:#246a9d;background:#dceefa}.view-tools span{background:#c7dceb}.canvas-hint{color:#6d8aa2}.axis i{border-color:#478ba6 #478ba6 #ba6976}.axis .y{color:#397e99}.axis .x{color:#a95566}
14
+ footer{color:#607f9c}#status-dot{background:#4d9b9b}#status-dot.warn{background:#a57626}.loading{background:#e8f2fbf5}.loading>span:not(.spinner){color:#66829b}.loading button{border-color:#a6c4db}.spinner{border-color:#c3daeb;border-top-color:#458bbc}
15
+ .selection{background:#e0f0fcf5;border-color:#a6cbe5;color:#24699a}.drop-mask{background:#e0effbf2;border-color:#5c9dca;color:#2d729f}#toast{background:#fff4de;color:#765a2c;border-color:#dcc593;box-shadow:0 6px 25px #5c7d961c}
16
+ button:focus-visible,input:focus-visible,select:focus-visible{outline-color:#408ac0}
17
+ .header-actions{display:flex;align-items:center;gap:10px}.recent-button{display:flex;align-items:center;gap:7px;border:1px solid #bcd4e7;border-radius:7px;padding:11px 13px;color:#456b89;background:#edf6fe;white-space:nowrap}.recent-button:hover{background:#dceefa}.recent-button svg{width:16px}
18
+ .history-dialog{width:min(660px,calc(100vw - 32px));max-height:80dvh;padding:0;border:1px solid #b9d2e6;border-radius:14px;background:#f4f9fe;color:#304b65;box-shadow:0 16px 70px #315d8133}.history-dialog::backdrop{background:#456e944d;backdrop-filter:blur(3px)}.history-heading{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid #d2e3f0}.history-heading h2{font-size:17px;margin:0;font-weight:600}.history-heading button{font-size:24px;color:#6d89a0}.history-note{margin:16px 24px;color:#67829b;font-size:12px;line-height:1.8}.history-list{padding:0 14px;max-height:45dvh;overflow:auto}.history-row{display:flex;align-items:center;gap:8px;border-radius:7px;margin-bottom:5px}.history-row:hover{background:#e1effa}.history-open{flex:1;min-width:0;display:flex;align-items:center;gap:12px;padding:12px 10px;text-align:left}.history-open>svg{color:#4387b7;width:24px;height:24px}.history-file{flex:1;min-width:0}.history-name{display:block;font-size:12px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.history-meta{display:block;color:#6d89a0;font-size:10px;margin-top:7px}.history-remove{color:#7590a5;font-size:11px;padding:10px}.history-remove:hover{color:#a65151}.history-empty{text-align:center;color:#7890a5;padding:30px 15px 45px}.history-footer{display:flex;justify-content:space-between;align-items:center;padding:16px 24px;border-top:1px solid #d2e3f0;color:#7290a7;font-size:11px}.history-footer button{color:#527b9b;padding:6px}.history-footer button:hover{color:#a65151}
19
+ @media(max-width:580px){.recent-button{font-size:11px;padding:11px 9px}.recent-button svg{display:none}.header-actions{gap:6px}.primary{padding:11px}.history-note{font-size:11px}}
20
+
21
+ /* Three-column workspace */
22
+ header{height:60px;padding:0 18px;gap:16px}.brand strong{font-size:19px}.brand-sub{letter-spacing:1px;font-size:10px}.brand-separator{display:none}.header-file{font-size:12px}.primary{padding:9px 13px}.panel-toggle{width:33px;height:33px;display:grid;place-items:center;font-size:18px;border-radius:6px;color:#517898}.panel-toggle:hover{background:#dcecf9}.panel-toggle[aria-expanded=false]{color:#92a8ba;background:#e6f0f8}
23
+ aside.files-panel{width:240px;border-right:1px solid #ccdfef;border-left:0;background:#f0f6fc}.properties-panel{width:300px;border-left:1px solid #ccdfef;border-right:0;background:#f6faff}.panel-heading{height:62px;display:flex;align-items:center;justify-content:space-between;padding:0 18px;font-size:13px}.properties-panel .aside-heading{padding:20px 18px 16px}.new-file{margin:0 12px 23px;display:flex;align-items:center;gap:9px;padding:11px 10px;border:1px solid #c4dced;border-radius:7px;background:#e5f1fb;font-size:12px;color:#3c698b}.new-file span{margin-left:auto}.new-file svg{width:16px}.new-file:hover{background:#d7eaf9}.files-section-title{padding:0 18px 12px;color:#718ba0;font-size:11px}.files-list{flex:1;min-height:0;overflow:auto}.files-list .history-list{padding:0 8px;max-height:none;overflow:visible}.files-list .history-row{gap:0;margin-bottom:5px;border-radius:7px;align-items:center}.files-list .history-row.current{background:#d5e9f8}.files-list .history-open{gap:8px;padding:12px 7px}.files-list .history-open>svg{width:16px;height:16px;flex-shrink:0}.files-list .history-name{font-size:11px}.files-list .history-meta{font-size:9px;line-height:1.6}.files-list .history-remove{font-size:10px;padding:8px 5px}.files-list .history-empty{font-size:11px;line-height:1.8;padding:25px 10px}.files-footer{border-top:1px solid #ccdfef;padding:15px 12px;display:flex;align-items:center;justify-content:space-between;font-size:9px;color:#718ba0;gap:8px}.files-footer button{font-size:10px;color:#4e7798}.property-summary{padding:0 18px 16px;border-bottom:1px solid #d7e6f2;flex-shrink:0;margin-bottom:18px;max-height:245px;overflow:auto}.property-row{display:grid;grid-template-columns:72px minmax(0,1fr);gap:8px;padding:6px 0;font-size:10px}.property-row>span:first-child{color:#7890a5}.property-row>span:last-child{color:#3d5f7c;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.property-placeholder{font-size:11px;color:#839aac}.properties-panel .tabs{margin-top:17px}.properties-panel .tree-empty{margin-top:35px}.workspace{min-width:150px}#model-host{position:absolute;inset:0}#model-host canvas{width:100%;height:100%;cursor:grab}.welcome{z-index:1}.canvas-heading{z-index:2;padding:17px}.selection,.view-tools,.axis,.canvas-hint{z-index:2}.welcome p{max-width:390px;padding:0 20px}.canvas-hint{font-size:9px;bottom:20px}.selection{top:58px;left:17px}.view-tools{right:16px}.canvas-heading select{max-width:160px}.canvas-heading .crumb{font-size:10px;gap:6px}#drawing-state{font-size:9px;padding-left:7px;margin-left:0}
24
+ @media(max-width:1100px){aside.files-panel{width:205px}.properties-panel{width:265px}.brand-sub{display:none}.key{display:none}.header-actions{gap:5px}.canvas-heading #drawing-state{display:none}.canvas-hint{display:none}}
25
+ @media(max-width:760px){aside.files-panel{width:185px}.properties-panel{width:230px}.header-file{font-size:10px}.recent-button{display:none}.welcome h1{font-size:19px}.welcome p{font-size:11px}.welcome-art{width:75px;height:70px}.welcome-art>svg{width:40px}.eyebrow{font-size:8px;letter-spacing:1px}.canvas-heading select{max-width:105px}.workspace{min-width:120px}.property-row{grid-template-columns:58px minmax(0,1fr)}}
src/types.ts ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ export type Point={x:number;y:number};
2
+ export type Matrix=[number,number,number,number,number,number];
3
+ export type Bounds={minX:number;minY:number;maxX:number;maxY:number};
4
+ export type Primitive={points:Point[];color:string;layer:string;closed?:boolean;fill?:boolean;text?:string;height?:number;matrix?:Matrix;bounds:Bounds;node:string};
5
+ export type Item={id:string;label:string;type:string;layer:string;bounds:Bounds;children:Item[];primitives:number[]};
6
+ export type Scene={primitives:Primitive[];items:Item[];bounds:Bounds;layers:{name:string;color:string;off:boolean}[];spaces:string[];space:string;unsupported:Record<string,number>;unknown:number;warnings?:number[]};
src/viewer.ts ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type {Bounds,Scene,Primitive,Point} from './types';
2
+ import {valid} from './geometry';
3
+ import {drawingColor} from './colors';
4
+ export class Viewer {
5
+ scene:Scene|null=null;scale=1;cx=0;cy=0;w=0;h=0;selected=new Set<number>();hidden=new Set<string>();selection:Bounds|null=null;
6
+ private ctx:CanvasRenderingContext2D;private frame=0;private drag:{x:number;y:number;cx:number;cy:number}|null=null;
7
+ onChange:()=>void=()=>{};
8
+ constructor(public canvas:HTMLCanvasElement){
9
+ this.ctx=canvas.getContext('2d')!;
10
+ new ResizeObserver(()=>{this.w=canvas.clientWidth;this.h=canvas.clientHeight;canvas.width=Math.round(this.w*devicePixelRatio);canvas.height=Math.round(this.h*devicePixelRatio);this.draw();}).observe(canvas);
11
+ canvas.addEventListener('pointerdown',e=>{if(e.button!==0&&e.button!==1)return;canvas.focus();this.drag={x:e.clientX,y:e.clientY,cx:this.cx,cy:this.cy};canvas.setPointerCapture(e.pointerId);canvas.classList.add('dragging');});
12
+ canvas.addEventListener('pointermove',e=>{if(this.drag){this.cx=this.drag.cx-(e.clientX-this.drag.x)/this.scale;this.cy=this.drag.cy+(e.clientY-this.drag.y)/this.scale;this.draw();}});
13
+ const release=()=>{this.drag=null;canvas.classList.remove('dragging');};canvas.addEventListener('pointerup',release);canvas.addEventListener('pointercancel',release);canvas.addEventListener('lostpointercapture',release);
14
+ canvas.addEventListener('wheel',e=>{e.preventDefault();const r=canvas.getBoundingClientRect();this.zoom(Math.exp(-Math.max(-200,Math.min(200,e.deltaY))*.002),{x:e.clientX-r.left,y:e.clientY-r.top});},{passive:false});
15
+ canvas.addEventListener('dblclick',()=>this.fit());
16
+ canvas.addEventListener('keydown',e=>{if(e.key==='Home'||e.key.toLowerCase()==='f'){e.preventDefault();this.fit();}if(e.key==='Escape'){this.selected.clear();this.selection=null;this.draw();}if(e.key==='+'||e.key==='=')this.zoom(1.3);if(e.key==='-')this.zoom(1/1.3);});
17
+ }
18
+ load(scene:Scene){this.scene=scene;this.hidden.clear();this.selected.clear();this.selection=null;this.fit();}
19
+ fit(bounds=this.scene?.bounds){if(!bounds||!valid(bounds))return;this.w=this.canvas.clientWidth;this.h=this.canvas.clientHeight;if(!this.w||!this.h)return;this.cx=(bounds.minX+bounds.maxX)/2;this.cy=(bounds.minY+bounds.maxY)/2;this.scale=Math.min(this.w/Math.max(bounds.maxX-bounds.minX,1),this.h/Math.max(bounds.maxY-bounds.minY,1))*.82;this.draw();}
20
+ focus(bounds:Bounds,ids:number[]){this.selected=new Set(ids);this.selection=bounds;ids.forEach(i=>this.hidden.delete(this.scene!.primitives[i].layer));const global=this.scene?.bounds;
21
+ const minSpan=global?Math.max(global.maxX-global.minX,global.maxY-global.minY)*.015:10;
22
+ const width=Math.max((bounds.maxX-bounds.minX)*2.2,minSpan),height=Math.max((bounds.maxY-bounds.minY)*2.2,minSpan);
23
+ this.fit({minX:(bounds.minX+bounds.maxX-width)/2,maxX:(bounds.minX+bounds.maxX+width)/2,minY:(bounds.minY+bounds.maxY-height)/2,maxY:(bounds.minY+bounds.maxY+height)/2});
24
+ }
25
+ zoom(factor:number,p:Point={x:this.w/2,y:this.h/2}){const before=this.world(p),next=Math.max(1e-8,Math.min(1e5,this.scale*factor));this.scale=next;const after=this.world(p);this.cx+=before.x-after.x;this.cy+=before.y-after.y;this.draw();}
26
+ world(p:Point){return{x:this.cx+(p.x-this.w/2)/this.scale,y:this.cy-(p.y-this.h/2)/this.scale};}
27
+ draw(){if(this.frame)return;this.frame=requestAnimationFrame(()=>{this.frame=0;this.render();this.onChange();});}
28
+ private render(){
29
+ const c=this.ctx,d=devicePixelRatio;c.setTransform(d,0,0,d,0,0);c.clearRect(0,0,this.w,this.h);
30
+ if(!this.scene)return;
31
+ c.save();c.translate(this.w/2,this.h/2);c.scale(this.scale,-this.scale);c.translate(-this.cx,-this.cy);c.lineWidth=1/this.scale;c.lineJoin='round';c.lineCap='round';
32
+ const left=this.cx-this.w/2/this.scale,right=this.cx+this.w/2/this.scale,bottom=this.cy-this.h/2/this.scale,top=this.cy+this.h/2/this.scale;
33
+ const paint=(p:Primitive,highlight=false)=>{
34
+ if(this.hidden.has(p.layer)||p.bounds.maxX<left||p.bounds.minX>right||p.bounds.maxY<bottom||p.bounds.minY>top)return;
35
+ c.globalAlpha=this.selected.size&&!highlight ? .65:1;
36
+ const color=highlight?'#0069ab':drawingColor(p.color);c.strokeStyle=color;c.fillStyle=color;c.lineWidth=(highlight?2:1)/this.scale;
37
+ if(p.text!==undefined&&p.matrix){
38
+ const m=p.matrix,h=p.height!;if(h*Math.hypot(m[2],m[3])*this.scale<2)return;c.save();c.transform(...m);c.scale(1,-1);c.font=`${h}px "Microsoft YaHei", "SimSun", sans-serif`;c.textBaseline='alphabetic';
39
+ p.text.split('\n').forEach((line,i)=>c.fillText(line,0,i*h*1.3));c.restore();
40
+ }else{c.beginPath();p.points.forEach((v,i)=>i?c.lineTo(v.x,v.y):c.moveTo(v.x,v.y));if(p.points.length===1){const p0=p.points[0];c.lineTo(p0.x+2/this.scale,p0.y);}if(p.closed)c.closePath();if(p.fill)c.fill('evenodd');else c.stroke();}
41
+ };
42
+ this.scene.primitives.forEach(p=>paint(p));this.selected.forEach(i=>paint(this.scene!.primitives[i],true));c.restore();
43
+ if(this.selection){const b=this.selection,x=(b.minX-this.cx)*this.scale+this.w/2,y=(this.cy-b.maxY)*this.scale+this.h/2,w=(b.maxX-b.minX)*this.scale,h=(b.maxY-b.minY)*this.scale;c.strokeStyle='#0069ab';c.lineWidth=1;c.setLineDash([5,5]);c.strokeRect(x-7,y-7,w+14,h+14);c.setLineDash([]);}
44
+ }
45
+ }
tests/geometry.test.ts ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {test} from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import {buildScene,cleanText,polyline} from '../src/geometry.ts';
4
+ const line={type:'LINE',handle:'l',layer:'0',startPoint:{x:0,y:0},endPoint:{x:10,y:0},isVisible:true};
5
+ const block=(name:string,entities:any[],basePoint={x:0,y:0})=>({name,entities,basePoint});
6
+ const db=(blocks:any[])=>({tables:{BLOCK_RECORD:{entries:blocks},LAYER:{entries:[{name:'0',colorIndex:7},{name:'WALL',colorIndex:3}]}}});
7
+ test('nested inserts honor base point, rotation, scaling, layer inheritance and focus bounds',()=>{
8
+ const inner=block('inner',[line],{x:2,y:0});
9
+ const outer=block('outer',[{type:'INSERT',name:'inner',layer:'0',insertionPoint:{x:10,y:0},rotation:Math.PI/2,xScale:2,yScale:2}]);
10
+ const model=block('*Model_Space',[{type:'INSERT',name:'outer',layer:'WALL',insertionPoint:{x:100,y:200},xScale:1,yScale:1}]);
11
+ const scene=buildScene(db([model,outer,inner]));
12
+ assert.equal(scene.primitives.length,1);const p=scene.primitives[0];assert.equal(p.layer,'WALL');assert.deepEqual(p.points,[{x:110,y:196},{x:110,y:216}]);assert.deepEqual(scene.items[0].bounds,p.bounds);
13
+ });
14
+ test('dimension picture insertion offset is applied inside its parent block',()=>{
15
+ const dim=block('*D1',[{...line,startPoint:{x:1000,y:1000},endPoint:{x:1010,y:1000}}]);
16
+ const outer=block('outer',[{type:'DIMENSION',name:'*D1',layer:'0',insertionPoint:{x:-1000,y:-1000}}]);
17
+ const model=block('*Model_Space',[{type:'INSERT',name:'outer',layer:'0',insertionPoint:{x:100,y:200}}]);
18
+ assert.deepEqual(buildScene(db([model,outer,dim])).primitives[0].points,[{x:100,y:200},{x:110,y:200}]);
19
+ });
20
+ test('model and paper space stay separate; hidden entities stay hidden',()=>{
21
+ const scene=buildScene(db([block('*Model_Space',[line,{...line,isVisible:false}]),block('*Paper_Space',[{...line,endPoint:{x:99,y:99}}])]));assert.equal(scene.primitives.length,1);assert.equal(scene.bounds.maxX,10);
22
+ });
23
+ test('recursive block references stop and are reported',()=>{
24
+ const insert={type:'INSERT',name:'loop',layer:'0',insertionPoint:{x:0,y:0}};
25
+ const scene=buildScene(db([block('*Model_Space',[insert]),block('loop',[line,insert])]));assert.equal(scene.primitives.length,1);assert.equal(scene.unsupported['循环图块'],1);
26
+ });
27
+ test('bulged polyline retains its arc rather than a straight chord',()=>{
28
+ const p=polyline([{x:-1,y:0,bulge:1},{x:1,y:0}],false);assert.ok(p.length>20);assert.ok(p.some(v=>v.y<-.99));assert.deepEqual(p.at(-1),{x:1,y:0});
29
+ });
30
+ test('CAD formatting is cleaned while document text stays plain data',()=>{
31
+ assert.equal(cleanText('{\\fSimSun;客厅\\P35.2%%d}'),'客厅\n35.2°');assert.equal(cleanText('<script>alert(1)</script>'),'<script>alert(1)</script>');
32
+ });
tsconfig.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"compilerOptions":{"target":"ES2022","module":"ESNext","moduleResolution":"Bundler","lib":["ES2022","DOM","WebWorker"],"strict":true,"skipLibCheck":true,"noEmit":true,"allowImportingTsExtensions":true},"include":["src","vite.config.ts","tests"]}
vite.config.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {defineConfig} from 'vite';
2
+ import {readFileSync} from 'node:fs';
3
+ import {resolve} from 'node:path';
4
+ const sample = process.env.DWG_SAMPLE;
5
+ export default defineConfig({base:'./',plugins:[{name:'local-assets',configureServer(server){
6
+ server.middlewares.use((req,res,next)=>{
7
+ if(req.url==='/rhino/rhino3dm.js'||req.url==='/rhino/rhino3dm.wasm'){const name=req.url.split('/').pop()!;res.setHeader('Content-Type',name.endsWith('.wasm')?'application/wasm':'application/javascript');res.end(readFileSync(resolve('node_modules/rhino3dm',name)));return;}
8
+ if(req.url==='/api/reader-health'){res.setHeader('Content-Type','text/plain');res.end('dwg-reader');return;}
9
+ if(req.url==='/libredwg-web.wasm'){res.setHeader('Content-Type','application/wasm');res.end(readFileSync(resolve('node_modules/@mlightcad/libredwg-web/wasm/libredwg-web.wasm')));return;}
10
+ if(req.url==='/api/sample-info'){res.setHeader('Content-Type','application/json');res.end(JSON.stringify(sample?{name:sample.split(/[\\/]/).pop()}:null));return;}
11
+ if(req.url==='/api/sample'&&sample){try{res.setHeader('Content-Type','application/octet-stream');res.end(readFileSync(sample));}catch{res.statusCode=404;res.end('文件不存在');}return;}next();
12
+ });
13
+ },generateBundle(){this.emitFile({type:'asset',fileName:'libredwg-web.wasm',source:readFileSync(resolve('node_modules/@mlightcad/libredwg-web/wasm/libredwg-web.wasm'))});for(const name of ['rhino3dm.js','rhino3dm.wasm'])this.emitFile({type:'asset',fileName:`rhino/${name}`,source:readFileSync(resolve('node_modules/rhino3dm',name))});}}],server:{port:5173,strictPort:true},worker:{format:'es'}});
启动阅读器.cmd ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ @echo off
2
+ powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0scripts\start.ps1"
3
+ if errorlevel 1 pause