@mlightcad/cad-simple-viewer 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -6
- package/dist/index.js +0 -33474
- package/dist/index.umd.cjs +0 -294
- package/dist/libredwg-parser-worker.js +0 -15411
- package/dist/mtext-renderer-worker.js +0 -29938
- package/lib/app/AcApContext.d.ts +0 -57
- package/lib/app/AcApContext.d.ts.map +0 -1
- package/lib/app/AcApContext.js +0 -106
- package/lib/app/AcApContext.js.map +0 -1
- package/lib/app/AcApDocManager.d.ts +0 -291
- package/lib/app/AcApDocManager.d.ts.map +0 -1
- package/lib/app/AcApDocManager.js +0 -498
- package/lib/app/AcApDocManager.js.map +0 -1
- package/lib/app/AcApDocument.d.ts +0 -101
- package/lib/app/AcApDocument.d.ts.map +0 -1
- package/lib/app/AcApDocument.js +0 -237
- package/lib/app/AcApDocument.js.map +0 -1
- package/lib/app/AcApFontLoader.d.ts +0 -54
- package/lib/app/AcApFontLoader.d.ts.map +0 -1
- package/lib/app/AcApFontLoader.js +0 -151
- package/lib/app/AcApFontLoader.js.map +0 -1
- package/lib/app/AcApGlobalFunc.d.ts +0 -26
- package/lib/app/AcApGlobalFunc.d.ts.map +0 -1
- package/lib/app/AcApGlobalFunc.js +0 -66
- package/lib/app/AcApGlobalFunc.js.map +0 -1
- package/lib/app/AcApSettingManager.d.ts +0 -232
- package/lib/app/AcApSettingManager.d.ts.map +0 -1
- package/lib/app/AcApSettingManager.js +0 -283
- package/lib/app/AcApSettingManager.js.map +0 -1
- package/lib/app/index.d.ts +0 -6
- package/lib/app/index.d.ts.map +0 -1
- package/lib/app/index.js +0 -6
- package/lib/app/index.js.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.d.ts +0 -32
- package/lib/command/AcApConvertToSvgCmd.d.ts.map +0 -1
- package/lib/command/AcApConvertToSvgCmd.js +0 -56
- package/lib/command/AcApConvertToSvgCmd.js.map +0 -1
- package/lib/command/AcApOpenCmd.d.ts +0 -37
- package/lib/command/AcApOpenCmd.d.ts.map +0 -1
- package/lib/command/AcApOpenCmd.js +0 -60
- package/lib/command/AcApOpenCmd.js.map +0 -1
- package/lib/command/AcApPanCmd.d.ts +0 -31
- package/lib/command/AcApPanCmd.d.ts.map +0 -1
- package/lib/command/AcApPanCmd.js +0 -55
- package/lib/command/AcApPanCmd.js.map +0 -1
- package/lib/command/AcApQNewCmd.d.ts +0 -32
- package/lib/command/AcApQNewCmd.d.ts.map +0 -1
- package/lib/command/AcApQNewCmd.js +0 -56
- package/lib/command/AcApQNewCmd.js.map +0 -1
- package/lib/command/AcApRegenCmd.d.ts +0 -21
- package/lib/command/AcApRegenCmd.d.ts.map +0 -1
- package/lib/command/AcApRegenCmd.js +0 -45
- package/lib/command/AcApRegenCmd.js.map +0 -1
- package/lib/command/AcApSelectCmd.d.ts +0 -32
- package/lib/command/AcApSelectCmd.d.ts.map +0 -1
- package/lib/command/AcApSelectCmd.js +0 -56
- package/lib/command/AcApSelectCmd.js.map +0 -1
- package/lib/command/AcApSvgConvertor.d.ts +0 -53
- package/lib/command/AcApSvgConvertor.d.ts.map +0 -1
- package/lib/command/AcApSvgConvertor.js +0 -103
- package/lib/command/AcApSvgConvertor.js.map +0 -1
- package/lib/command/AcApZoomCmd.d.ts +0 -35
- package/lib/command/AcApZoomCmd.d.ts.map +0 -1
- package/lib/command/AcApZoomCmd.js +0 -57
- package/lib/command/AcApZoomCmd.js.map +0 -1
- package/lib/command/AcApZoomToBoxCmd.d.ts +0 -68
- package/lib/command/AcApZoomToBoxCmd.d.ts.map +0 -1
- package/lib/command/AcApZoomToBoxCmd.js +0 -158
- package/lib/command/AcApZoomToBoxCmd.js.map +0 -1
- package/lib/command/index.d.ts +0 -11
- package/lib/command/index.d.ts.map +0 -1
- package/lib/command/index.js +0 -11
- package/lib/command/index.js.map +0 -1
- package/lib/editor/command/AcEdCommand.d.ts +0 -151
- package/lib/editor/command/AcEdCommand.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommand.js +0 -164
- package/lib/editor/command/AcEdCommand.js.map +0 -1
- package/lib/editor/command/AcEdCommandIterator.d.ts +0 -36
- package/lib/editor/command/AcEdCommandIterator.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommandIterator.js +0 -65
- package/lib/editor/command/AcEdCommandIterator.js.map +0 -1
- package/lib/editor/command/AcEdCommandStack.d.ts +0 -120
- package/lib/editor/command/AcEdCommandStack.d.ts.map +0 -1
- package/lib/editor/command/AcEdCommandStack.js +0 -235
- package/lib/editor/command/AcEdCommandStack.js.map +0 -1
- package/lib/editor/command/index.d.ts +0 -3
- package/lib/editor/command/index.d.ts.map +0 -1
- package/lib/editor/command/index.js +0 -3
- package/lib/editor/command/index.js.map +0 -1
- package/lib/editor/global/AcEdConditionWaiter.d.ts +0 -51
- package/lib/editor/global/AcEdConditionWaiter.d.ts.map +0 -1
- package/lib/editor/global/AcEdConditionWaiter.js +0 -87
- package/lib/editor/global/AcEdConditionWaiter.js.map +0 -1
- package/lib/editor/global/AcEdGlobalFunc.d.ts +0 -8
- package/lib/editor/global/AcEdGlobalFunc.d.ts.map +0 -1
- package/lib/editor/global/AcEdGlobalFunc.js +0 -14
- package/lib/editor/global/AcEdGlobalFunc.js.map +0 -1
- package/lib/editor/global/AcEdMessage.d.ts +0 -5
- package/lib/editor/global/AcEdMessage.d.ts.map +0 -1
- package/lib/editor/global/AcEdMessage.js +0 -6
- package/lib/editor/global/AcEdMessage.js.map +0 -1
- package/lib/editor/global/eventBus.d.ts +0 -103
- package/lib/editor/global/eventBus.d.ts.map +0 -1
- package/lib/editor/global/eventBus.js +0 -41
- package/lib/editor/global/eventBus.js.map +0 -1
- package/lib/editor/global/index.d.ts +0 -4
- package/lib/editor/global/index.d.ts.map +0 -1
- package/lib/editor/global/index.js +0 -4
- package/lib/editor/global/index.js.map +0 -1
- package/lib/editor/index.d.ts +0 -5
- package/lib/editor/index.d.ts.map +0 -1
- package/lib/editor/index.js +0 -5
- package/lib/editor/index.js.map +0 -1
- package/lib/editor/input/AcEdBaseInput.d.ts +0 -89
- package/lib/editor/input/AcEdBaseInput.d.ts.map +0 -1
- package/lib/editor/input/AcEdBaseInput.js +0 -166
- package/lib/editor/input/AcEdBaseInput.js.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.d.ts +0 -108
- package/lib/editor/input/AcEdBoxSelector.d.ts.map +0 -1
- package/lib/editor/input/AcEdBoxSelector.js +0 -220
- package/lib/editor/input/AcEdBoxSelector.js.map +0 -1
- package/lib/editor/input/AcEdCursorManager.d.ts +0 -130
- package/lib/editor/input/AcEdCursorManager.d.ts.map +0 -1
- package/lib/editor/input/AcEdCursorManager.js +0 -155
- package/lib/editor/input/AcEdCursorManager.js.map +0 -1
- package/lib/editor/input/AcEdInputPoint.d.ts +0 -51
- package/lib/editor/input/AcEdInputPoint.d.ts.map +0 -1
- package/lib/editor/input/AcEdInputPoint.js +0 -78
- package/lib/editor/input/AcEdInputPoint.js.map +0 -1
- package/lib/editor/input/AcEdJig.d.ts +0 -180
- package/lib/editor/input/AcEdJig.d.ts.map +0 -1
- package/lib/editor/input/AcEdJig.js +0 -256
- package/lib/editor/input/AcEdJig.js.map +0 -1
- package/lib/editor/input/AcEdJigLoop.d.ts +0 -63
- package/lib/editor/input/AcEdJigLoop.d.ts.map +0 -1
- package/lib/editor/input/AcEdJigLoop.js +0 -91
- package/lib/editor/input/AcEdJigLoop.js.map +0 -1
- package/lib/editor/input/AcEdSelectionSet.d.ts +0 -146
- package/lib/editor/input/AcEdSelectionSet.d.ts.map +0 -1
- package/lib/editor/input/AcEdSelectionSet.js +0 -179
- package/lib/editor/input/AcEdSelectionSet.js.map +0 -1
- package/lib/editor/input/AcEditor.d.ts +0 -111
- package/lib/editor/input/AcEditor.d.ts.map +0 -1
- package/lib/editor/input/AcEditor.js +0 -183
- package/lib/editor/input/AcEditor.js.map +0 -1
- package/lib/editor/input/index.d.ts +0 -5
- package/lib/editor/input/index.d.ts.map +0 -1
- package/lib/editor/input/index.js +0 -5
- package/lib/editor/input/index.js.map +0 -1
- package/lib/editor/view/AcEdBaseView.d.ts +0 -457
- package/lib/editor/view/AcEdBaseView.d.ts.map +0 -1
- package/lib/editor/view/AcEdBaseView.js +0 -349
- package/lib/editor/view/AcEdBaseView.js.map +0 -1
- package/lib/editor/view/AcEdLayerInfo.d.ts +0 -21
- package/lib/editor/view/AcEdLayerInfo.d.ts.map +0 -1
- package/lib/editor/view/AcEdLayerInfo.js +0 -2
- package/lib/editor/view/AcEdLayerInfo.js.map +0 -1
- package/lib/editor/view/index.d.ts +0 -3
- package/lib/editor/view/index.d.ts.map +0 -1
- package/lib/editor/view/index.js +0 -3
- package/lib/editor/view/index.js.map +0 -1
- package/lib/index.d.ts +0 -5
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
- package/lib/util/AcTrGeometryUtil.d.ts +0 -92
- package/lib/util/AcTrGeometryUtil.d.ts.map +0 -1
- package/lib/util/AcTrGeometryUtil.js +0 -109
- package/lib/util/AcTrGeometryUtil.js.map +0 -1
- package/lib/util/index.d.ts +0 -2
- package/lib/util/index.d.ts.map +0 -1
- package/lib/util/index.js +0 -2
- package/lib/util/index.js.map +0 -1
- package/lib/view/AcTrLayer.d.ts +0 -132
- package/lib/view/AcTrLayer.d.ts.map +0 -1
- package/lib/view/AcTrLayer.js +0 -199
- package/lib/view/AcTrLayer.js.map +0 -1
- package/lib/view/AcTrLayout.d.ts +0 -218
- package/lib/view/AcTrLayout.d.ts.map +0 -1
- package/lib/view/AcTrLayout.js +0 -437
- package/lib/view/AcTrLayout.js.map +0 -1
- package/lib/view/AcTrLayoutView.d.ts +0 -115
- package/lib/view/AcTrLayoutView.d.ts.map +0 -1
- package/lib/view/AcTrLayoutView.js +0 -200
- package/lib/view/AcTrLayoutView.js.map +0 -1
- package/lib/view/AcTrLayoutViewManager.d.ts +0 -89
- package/lib/view/AcTrLayoutViewManager.d.ts.map +0 -1
- package/lib/view/AcTrLayoutViewManager.js +0 -118
- package/lib/view/AcTrLayoutViewManager.js.map +0 -1
- package/lib/view/AcTrScene.d.ts +0 -162
- package/lib/view/AcTrScene.d.ts.map +0 -1
- package/lib/view/AcTrScene.js +0 -370
- package/lib/view/AcTrScene.js.map +0 -1
- package/lib/view/AcTrView2d.d.ts +0 -262
- package/lib/view/AcTrView2d.d.ts.map +0 -1
- package/lib/view/AcTrView2d.js +0 -772
- package/lib/view/AcTrView2d.js.map +0 -1
- package/lib/view/index.d.ts +0 -2
- package/lib/view/index.d.ts.map +0 -1
- package/lib/view/index.js +0 -2
- package/lib/view/index.js.map +0 -1
package/lib/app/AcApDocument.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { AcDbDatabase, AcDbFileType } from '@mlightcad/data-model';
|
|
38
|
-
import { eventBus } from '../editor';
|
|
39
|
-
/**
|
|
40
|
-
* Represents a CAD document that manages a drawing database and associated metadata.
|
|
41
|
-
*
|
|
42
|
-
* This class handles:
|
|
43
|
-
* - Opening CAD files from URIs or file content (DWG/DXF formats)
|
|
44
|
-
* - Managing document properties (title, read-only state)
|
|
45
|
-
* - Providing access to the underlying database
|
|
46
|
-
* - Handling file loading errors through event emission
|
|
47
|
-
*/
|
|
48
|
-
var AcApDocument = /** @class */ (function () {
|
|
49
|
-
/**
|
|
50
|
-
* Creates a new document instance with an empty database.
|
|
51
|
-
*
|
|
52
|
-
* The document is initialized with an "Untitled" title and read-only mode enabled.
|
|
53
|
-
*/
|
|
54
|
-
function AcApDocument() {
|
|
55
|
-
/** The file name of the document */
|
|
56
|
-
this._fileName = '';
|
|
57
|
-
/** The display title of the document */
|
|
58
|
-
this._docTitle = '';
|
|
59
|
-
/** Whether the document is opened in read-only mode */
|
|
60
|
-
this._isReadOnly = true;
|
|
61
|
-
this._database = new AcDbDatabase();
|
|
62
|
-
this.docTitle = 'Untitled';
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Opens a CAD document from a URI.
|
|
66
|
-
*
|
|
67
|
-
* @param uri - The URI of the CAD file to open
|
|
68
|
-
* @param options - Options for opening the database, including read-only mode
|
|
69
|
-
* @returns Promise resolving to true if successful, false if failed
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* const success = await document.openUri('https://example.com/drawing.dwg', {
|
|
74
|
-
* readOnly: true
|
|
75
|
-
* });
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
AcApDocument.prototype.openUri = function (uri, options) {
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
var isSuccess, _1;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0:
|
|
84
|
-
this._uri = uri;
|
|
85
|
-
this._isReadOnly = (options && options.readOnly) || false;
|
|
86
|
-
this._fileName = this.getFileNameFromUri(uri);
|
|
87
|
-
isSuccess = true;
|
|
88
|
-
_a.label = 1;
|
|
89
|
-
case 1:
|
|
90
|
-
_a.trys.push([1, 3, , 4]);
|
|
91
|
-
return [4 /*yield*/, this._database.openUri(uri, options)];
|
|
92
|
-
case 2:
|
|
93
|
-
_a.sent();
|
|
94
|
-
this.docTitle = this._fileName;
|
|
95
|
-
return [3 /*break*/, 4];
|
|
96
|
-
case 3:
|
|
97
|
-
_1 = _a.sent();
|
|
98
|
-
isSuccess = false;
|
|
99
|
-
eventBus.emit('failed-to-open-file', { fileName: uri });
|
|
100
|
-
return [3 /*break*/, 4];
|
|
101
|
-
case 4: return [2 /*return*/, isSuccess];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Opens a CAD document from file content.
|
|
108
|
-
*
|
|
109
|
-
* @param fileName - The name of the file (used to determine file type from extension)
|
|
110
|
-
* @param content - The file content as string or ArrayBuffer
|
|
111
|
-
* @param options - Options for opening the database, including read-only mode
|
|
112
|
-
* @returns Promise resolving to true if successful, false if failed
|
|
113
|
-
*
|
|
114
|
-
* @example
|
|
115
|
-
* ```typescript
|
|
116
|
-
* const fileContent = await fetch('drawing.dwg').then(r => r.arrayBuffer());
|
|
117
|
-
* const success = await document.openDocument('drawing.dwg', fileContent, {
|
|
118
|
-
* readOnly: false
|
|
119
|
-
* });
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
AcApDocument.prototype.openDocument = function (fileName, content, options) {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
-
var isSuccess, fileExtension, e_1;
|
|
125
|
-
var _a;
|
|
126
|
-
return __generator(this, function (_b) {
|
|
127
|
-
switch (_b.label) {
|
|
128
|
-
case 0:
|
|
129
|
-
isSuccess = true;
|
|
130
|
-
this._fileName = fileName;
|
|
131
|
-
_b.label = 1;
|
|
132
|
-
case 1:
|
|
133
|
-
_b.trys.push([1, 3, , 4]);
|
|
134
|
-
fileExtension = (_a = fileName.split('.').pop()) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase();
|
|
135
|
-
return [4 /*yield*/, this._database.read(content, options, fileExtension == 'dwg' ? AcDbFileType.DWG : AcDbFileType.DXF)];
|
|
136
|
-
case 2:
|
|
137
|
-
_b.sent();
|
|
138
|
-
this.docTitle = this._fileName;
|
|
139
|
-
return [3 /*break*/, 4];
|
|
140
|
-
case 3:
|
|
141
|
-
e_1 = _b.sent();
|
|
142
|
-
isSuccess = false;
|
|
143
|
-
eventBus.emit('failed-to-open-file', { fileName: fileName });
|
|
144
|
-
console.error(e_1);
|
|
145
|
-
return [3 /*break*/, 4];
|
|
146
|
-
case 4: return [2 /*return*/, isSuccess];
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
Object.defineProperty(AcApDocument.prototype, "uri", {
|
|
152
|
-
/**
|
|
153
|
-
* Gets the URI of the document if opened from a URI.
|
|
154
|
-
*
|
|
155
|
-
* @returns The document URI, or undefined if not opened from URI
|
|
156
|
-
*/
|
|
157
|
-
get: function () {
|
|
158
|
-
return this._uri;
|
|
159
|
-
},
|
|
160
|
-
enumerable: false,
|
|
161
|
-
configurable: true
|
|
162
|
-
});
|
|
163
|
-
Object.defineProperty(AcApDocument.prototype, "database", {
|
|
164
|
-
/**
|
|
165
|
-
* Gets the database object containing all drawing data.
|
|
166
|
-
*
|
|
167
|
-
* @returns The underlying CAD database instance
|
|
168
|
-
*/
|
|
169
|
-
get: function () {
|
|
170
|
-
return this._database;
|
|
171
|
-
},
|
|
172
|
-
enumerable: false,
|
|
173
|
-
configurable: true
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(AcApDocument.prototype, "docTitle", {
|
|
176
|
-
/**
|
|
177
|
-
* Gets the display title of the document.
|
|
178
|
-
*
|
|
179
|
-
* @returns The document title displayed in the window/tab
|
|
180
|
-
*/
|
|
181
|
-
get: function () {
|
|
182
|
-
return this._docTitle;
|
|
183
|
-
},
|
|
184
|
-
/**
|
|
185
|
-
* Sets the display title of the document.
|
|
186
|
-
*
|
|
187
|
-
* Also updates the browser tab title if running in a browser environment.
|
|
188
|
-
*
|
|
189
|
-
* @param value - The new document title
|
|
190
|
-
*/
|
|
191
|
-
set: function (value) {
|
|
192
|
-
this._docTitle = value;
|
|
193
|
-
// Update browser title when document title changes
|
|
194
|
-
if (typeof document !== 'undefined') {
|
|
195
|
-
document.title = value;
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
enumerable: false,
|
|
199
|
-
configurable: true
|
|
200
|
-
});
|
|
201
|
-
Object.defineProperty(AcApDocument.prototype, "isReadOnly", {
|
|
202
|
-
/**
|
|
203
|
-
* Gets whether the document is opened in read-only mode.
|
|
204
|
-
*
|
|
205
|
-
* @returns True if the document is read-only, false if editable
|
|
206
|
-
*/
|
|
207
|
-
get: function () {
|
|
208
|
-
return this._isReadOnly;
|
|
209
|
-
},
|
|
210
|
-
enumerable: false,
|
|
211
|
-
configurable: true
|
|
212
|
-
});
|
|
213
|
-
/**
|
|
214
|
-
* Extracts the file name from a URI.
|
|
215
|
-
*
|
|
216
|
-
* @param uri - The URI to extract the file name from
|
|
217
|
-
* @returns The extracted file name, or empty string if extraction fails
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
AcApDocument.prototype.getFileNameFromUri = function (uri) {
|
|
221
|
-
try {
|
|
222
|
-
// Create a new URL object
|
|
223
|
-
var url = new URL(uri);
|
|
224
|
-
// Get the pathname from the URL
|
|
225
|
-
var pathParts = url.pathname.split('/');
|
|
226
|
-
// Return the last part of the pathname as the file name
|
|
227
|
-
return pathParts[pathParts.length - 1] || '';
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
console.error('Invalid URI:', error);
|
|
231
|
-
return '';
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
return AcApDocument;
|
|
235
|
-
}());
|
|
236
|
-
export { AcApDocument };
|
|
237
|
-
//# sourceMappingURL=AcApDocument.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApDocument.js","sourceRoot":"","sources":["../../src/app/AcApDocument.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ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M,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;YACxB,gCAAgC;YAChC,IAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACzC,wDAAwD;YACxD,OAAO,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;QAC9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;YACpC,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IACH,mBAAC;AAAD,CAAC,AAjKD,IAiKC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AcDbFontInfo, AcDbFontLoader } from '@mlightcad/data-model';
|
|
2
|
-
/**
|
|
3
|
-
* Font loader implementation for CAD text rendering.
|
|
4
|
-
*
|
|
5
|
-
* This class implements the {@link AcDbFontLoader} interface and provides functionality to:
|
|
6
|
-
* - Fetch available font metadata from a CDN
|
|
7
|
-
* - Load required fonts for CAD text rendering
|
|
8
|
-
* - Handle font loading errors and emit appropriate events
|
|
9
|
-
* - Manage font availability checking
|
|
10
|
-
*
|
|
11
|
-
* The font loader works with a Three.js renderer to load fonts that are used
|
|
12
|
-
* for rendering CAD text entities like MText and Text.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const renderer = new AcTrRenderer();
|
|
17
|
-
* const fontLoader = new AcApFontLoader(renderer);
|
|
18
|
-
*
|
|
19
|
-
* // Load specific fonts
|
|
20
|
-
* await fontLoader.load(['Arial', 'SimSun']);
|
|
21
|
-
*
|
|
22
|
-
* // Get all available fonts
|
|
23
|
-
* const fonts = await fontLoader.getAvaiableFonts();
|
|
24
|
-
* console.log('Available fonts:', fonts);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare class AcApFontLoader implements AcDbFontLoader {
|
|
28
|
-
/** Font loader in mtext-render */
|
|
29
|
-
private _loader;
|
|
30
|
-
/**
|
|
31
|
-
* Creates a new font loader instance.
|
|
32
|
-
*
|
|
33
|
-
* @param renderer - The Three.js renderer that will use the loaded fonts
|
|
34
|
-
*/
|
|
35
|
-
constructor();
|
|
36
|
-
/**
|
|
37
|
-
* Base URL to load fonts
|
|
38
|
-
*/
|
|
39
|
-
get baseUrl(): string;
|
|
40
|
-
set baseUrl(value: string);
|
|
41
|
-
/**
|
|
42
|
-
* Avaiable fonts to load.
|
|
43
|
-
*/
|
|
44
|
-
get avaiableFonts(): AcDbFontInfo[];
|
|
45
|
-
/**
|
|
46
|
-
* @inheritdoc
|
|
47
|
-
*/
|
|
48
|
-
getAvaiableFonts(): Promise<AcDbFontInfo[]>;
|
|
49
|
-
/**
|
|
50
|
-
* @inheritdoc
|
|
51
|
-
*/
|
|
52
|
-
load(fontNames: string[]): Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=AcApFontLoader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApFontLoader.d.ts","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAKpE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,cAAe,YAAW,cAAc;IACnD,kCAAkC;IAClC,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;;OAIG;;IAKH;;OAEG;IACH,IAAI,OAAO,IAGQ,MAAM,CADxB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAExB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,YAAY,EAAE,CAElC;IAED;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAIjD;;OAEG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE;CAyB/B"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { AcTrFontLoader } from '@mlightcad/three-renderer';
|
|
38
|
-
import { eventBus } from '../editor';
|
|
39
|
-
/**
|
|
40
|
-
* Font loader implementation for CAD text rendering.
|
|
41
|
-
*
|
|
42
|
-
* This class implements the {@link AcDbFontLoader} interface and provides functionality to:
|
|
43
|
-
* - Fetch available font metadata from a CDN
|
|
44
|
-
* - Load required fonts for CAD text rendering
|
|
45
|
-
* - Handle font loading errors and emit appropriate events
|
|
46
|
-
* - Manage font availability checking
|
|
47
|
-
*
|
|
48
|
-
* The font loader works with a Three.js renderer to load fonts that are used
|
|
49
|
-
* for rendering CAD text entities like MText and Text.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* const renderer = new AcTrRenderer();
|
|
54
|
-
* const fontLoader = new AcApFontLoader(renderer);
|
|
55
|
-
*
|
|
56
|
-
* // Load specific fonts
|
|
57
|
-
* await fontLoader.load(['Arial', 'SimSun']);
|
|
58
|
-
*
|
|
59
|
-
* // Get all available fonts
|
|
60
|
-
* const fonts = await fontLoader.getAvaiableFonts();
|
|
61
|
-
* console.log('Available fonts:', fonts);
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
var AcApFontLoader = /** @class */ (function () {
|
|
65
|
-
/**
|
|
66
|
-
* Creates a new font loader instance.
|
|
67
|
-
*
|
|
68
|
-
* @param renderer - The Three.js renderer that will use the loaded fonts
|
|
69
|
-
*/
|
|
70
|
-
function AcApFontLoader() {
|
|
71
|
-
this._loader = new AcTrFontLoader();
|
|
72
|
-
}
|
|
73
|
-
Object.defineProperty(AcApFontLoader.prototype, "baseUrl", {
|
|
74
|
-
/**
|
|
75
|
-
* Base URL to load fonts
|
|
76
|
-
*/
|
|
77
|
-
get: function () {
|
|
78
|
-
return this._loader.baseUrl;
|
|
79
|
-
},
|
|
80
|
-
set: function (value) {
|
|
81
|
-
this._loader.baseUrl = value;
|
|
82
|
-
},
|
|
83
|
-
enumerable: false,
|
|
84
|
-
configurable: true
|
|
85
|
-
});
|
|
86
|
-
Object.defineProperty(AcApFontLoader.prototype, "avaiableFonts", {
|
|
87
|
-
/**
|
|
88
|
-
* Avaiable fonts to load.
|
|
89
|
-
*/
|
|
90
|
-
get: function () {
|
|
91
|
-
return this._loader.avaiableFonts;
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* @inheritdoc
|
|
98
|
-
*/
|
|
99
|
-
AcApFontLoader.prototype.getAvaiableFonts = function () {
|
|
100
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
-
return __generator(this, function (_a) {
|
|
102
|
-
switch (_a.label) {
|
|
103
|
-
case 0: return [4 /*yield*/, this._loader.getAvailableFonts()];
|
|
104
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* @inheritdoc
|
|
111
|
-
*/
|
|
112
|
-
AcApFontLoader.prototype.load = function (fontNames) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
-
var loadStatus, fontsNotFound, fontsNotLoaded;
|
|
115
|
-
return __generator(this, function (_a) {
|
|
116
|
-
switch (_a.label) {
|
|
117
|
-
case 0: return [4 /*yield*/, this._loader.load(fontNames)];
|
|
118
|
-
case 1:
|
|
119
|
-
loadStatus = _a.sent();
|
|
120
|
-
fontsNotFound = [];
|
|
121
|
-
fontsNotLoaded = [];
|
|
122
|
-
loadStatus.forEach(function (item) {
|
|
123
|
-
if (item.status === 'NotFound') {
|
|
124
|
-
fontsNotFound.push(item.fontName);
|
|
125
|
-
}
|
|
126
|
-
else if (item.status === 'FailedToLoad') {
|
|
127
|
-
fontsNotLoaded.push({
|
|
128
|
-
fontName: item.fontName,
|
|
129
|
-
url: item.url
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (fontsNotFound.length > 0) {
|
|
134
|
-
eventBus.emit('fonts-not-found', {
|
|
135
|
-
fonts: fontsNotFound
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
if (fontsNotLoaded.length > 0) {
|
|
139
|
-
eventBus.emit('fonts-not-loaded', {
|
|
140
|
-
fonts: fontsNotLoaded
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
return [2 /*return*/];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
return AcApFontLoader;
|
|
149
|
-
}());
|
|
150
|
-
export { AcApFontLoader };
|
|
151
|
-
//# sourceMappingURL=AcApFontLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApFontLoader.js","sourceRoot":"","sources":["../../src/app/AcApFontLoader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE1D,OAAO,EAAyB,QAAQ,EAAE,MAAM,WAAW,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAIE;;;;OAIG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aAAa;6BACrB,CAAC,CAAA;wBACJ,CAAC;wBACD,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BAC9B,QAAQ,CAAC,IAAI,CAAC,kBAAkB,EAAE;gCAChC,KAAK,EAAE,cAAc;6BACtB,CAAC,CAAA;wBACJ,CAAC;;;;;KACF;IACH,qBAAC;AAAD,CAAC,AAjED,IAiEC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registers file format converters for CAD file processing.
|
|
3
|
-
*
|
|
4
|
-
* This function initializes and registers both DXF and DWG converters with the
|
|
5
|
-
* global database converter manager. Each converter is configured to use web workers
|
|
6
|
-
* for improved performance during file parsing operations.
|
|
7
|
-
*
|
|
8
|
-
* The function handles registration errors gracefully by logging them to the console
|
|
9
|
-
* without throwing exceptions, ensuring that the application can continue to function
|
|
10
|
-
* even if one or more converters fail to register.
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerConverters(): void;
|
|
13
|
-
/**
|
|
14
|
-
* Initializes background workers used by the viewer runtime.
|
|
15
|
-
*
|
|
16
|
-
* This function performs two tasks:
|
|
17
|
-
* - Ensures DXF/DWG converters are registered with worker-based parsers for
|
|
18
|
-
* off-main-thread file processing.
|
|
19
|
-
* - Initializes the MText renderer by pointing it to its dedicated Web Worker
|
|
20
|
-
* script for text layout and shaping.
|
|
21
|
-
*
|
|
22
|
-
* The function is safe to call during application startup. Errors during
|
|
23
|
-
* initialization are handled inside the respective registration routines.
|
|
24
|
-
*/
|
|
25
|
-
export declare function registerWorkers(): void;
|
|
26
|
-
//# sourceMappingURL=AcApGlobalFunc.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApGlobalFunc.d.ts","sourceRoot":"","sources":["../../src/app/AcApGlobalFunc.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,SAwBjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,SAc9B"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { AcDbDatabaseConverterManager, AcDbDxfConverter, AcDbFileType } from '@mlightcad/data-model';
|
|
2
|
-
import { AcDbLibreDwgConverter } from '@mlightcad/libredwg-converter';
|
|
3
|
-
import { AcTrMTextRenderer } from '@mlightcad/three-renderer';
|
|
4
|
-
/**
|
|
5
|
-
* Registers file format converters for CAD file processing.
|
|
6
|
-
*
|
|
7
|
-
* This function initializes and registers both DXF and DWG converters with the
|
|
8
|
-
* global database converter manager. Each converter is configured to use web workers
|
|
9
|
-
* for improved performance during file parsing operations.
|
|
10
|
-
*
|
|
11
|
-
* The function handles registration errors gracefully by logging them to the console
|
|
12
|
-
* without throwing exceptions, ensuring that the application can continue to function
|
|
13
|
-
* even if one or more converters fail to register.
|
|
14
|
-
*/
|
|
15
|
-
export function registerConverters() {
|
|
16
|
-
// Register DXF converter
|
|
17
|
-
try {
|
|
18
|
-
var converter = new AcDbDxfConverter({
|
|
19
|
-
convertByEntityType: false,
|
|
20
|
-
useWorker: true,
|
|
21
|
-
parserWorkerUrl: './assets/dxf-parser-worker.js'
|
|
22
|
-
});
|
|
23
|
-
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DXF, converter);
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
console.error('Failed to register dxf converter: ', error);
|
|
27
|
-
}
|
|
28
|
-
// Register DWG converter
|
|
29
|
-
try {
|
|
30
|
-
var converter = new AcDbLibreDwgConverter({
|
|
31
|
-
convertByEntityType: false,
|
|
32
|
-
useWorker: true,
|
|
33
|
-
parserWorkerUrl: './assets/libredwg-parser-worker.js'
|
|
34
|
-
});
|
|
35
|
-
AcDbDatabaseConverterManager.instance.register(AcDbFileType.DWG, converter);
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.error('Failed to register dwg converter: ', error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Initializes background workers used by the viewer runtime.
|
|
43
|
-
*
|
|
44
|
-
* This function performs two tasks:
|
|
45
|
-
* - Ensures DXF/DWG converters are registered with worker-based parsers for
|
|
46
|
-
* off-main-thread file processing.
|
|
47
|
-
* - Initializes the MText renderer by pointing it to its dedicated Web Worker
|
|
48
|
-
* script for text layout and shaping.
|
|
49
|
-
*
|
|
50
|
-
* The function is safe to call during application startup. Errors during
|
|
51
|
-
* initialization are handled inside the respective registration routines.
|
|
52
|
-
*/
|
|
53
|
-
export function registerWorkers() {
|
|
54
|
-
registerConverters();
|
|
55
|
-
var isDev = typeof window !== 'undefined' &&
|
|
56
|
-
!!window.location &&
|
|
57
|
-
(window.location.hostname === 'localhost' ||
|
|
58
|
-
window.location.hostname === '127.0.0.1');
|
|
59
|
-
if (isDev) {
|
|
60
|
-
AcTrMTextRenderer.getInstance().initialize('/assets/mtext-renderer-worker.js');
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
AcTrMTextRenderer.getInstance().initialize('./mtext-renderer-worker.js');
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=AcApGlobalFunc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AcApGlobalFunc.js","sourceRoot":"","sources":["../../src/app/AcApGlobalFunc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB;IAChC,yBAAyB;IACzB,IAAI,CAAC;QACH,IAAM,SAAS,GAAG,IAAI,gBAAgB,CAAC;YACrC,mBAAmB,EAAE,KAAK;YAC1B,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,+BAA+B;SACjD,CAAC,CAAA;QACF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