nv-log-bw 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,718 @@
1
+ var nvlogbw=(()=>{var w=(c,t)=>()=>(t||c((t={exports:{}}).exports,t),t.exports);var L=w((S,y)=>{var b=class extends HTMLElement{static get observedAttributes(){return["max-logs","theme","show-time","time-format","auto-scroll","show-stats","hide-button","auto-destroy","draggable"]}constructor(){super(),this._state={logs:[],showLogs:!0,filters:{info:!0,success:!0,warning:!0,error:!0,ignore:!0},isOpen:!1,isMinimized:!1,originalPosition:{x:0,y:0},originalSize:{width:"800px",height:"600px"},dragInfo:{isDragging:!1,startX:0,startY:0,initialLeft:0,initialTop:0},isDraggingEnabled:!0},this._eventListeners=new Map,this._createFileInput(),this.attachShadow({mode:"open"}),this._config=this._getConfig(),this._render(),this._setupEventListeners()}attributeChangedCallback(t,e,o){if(e!==o)switch(t){case"max-logs":this._config.maxLogs=Math.max(1,parseInt(o,10)||100),this._trimLogs(),this._updateLogsDisplay(),this._updateStats();break;case"theme":this._config.theme=o==="light"?"light":"dark",this._updateTheme();break;case"show-time":this._config.showTime=o!=="false",this._updateLogsDisplay();break;case"time-format":this._config.timeFormat=o||"HH:mm:ss",this._updateLogsDisplay();break;case"auto-scroll":this._config.autoScroll=o!=="false";break;case"show-stats":this._config.showStats=o!=="false",this._updateStatsVisibility();break;case"hide-button":this._config.hideButton=o!=="false",this._updateButtonsVisibility();break;case"auto-destroy":this._config.autoDestroy=o!=="false",this._updateCloseButton();break;case"draggable":this._config.draggable=o!=="false",this._updateDraggableState();break}}connectedCallback(){this._config=this._getConfig(),this._render(),this._setupEventListeners(),this._config.autoDestroy&&window.addEventListener("beforeunload",()=>this._cleanup())}disconnectedCallback(){this._cleanup()}_createFileInput(){this._fileInput=document.createElement("input"),this._fileInput.type="file",this._fileInput.accept=".json,.txt,.log",this._fileInput.style.position="fixed",this._fileInput.style.top="-1000px",this._fileInput.style.left="-1000px",this._fileInput.style.opacity="0",this._fileInput.style.pointerEvents="none",this._fileInput.style.zIndex="-1000",this._fileInput.addEventListener("change",t=>this._handleFileImport(t)),document.body.appendChild(this._fileInput)}_getConfig(){return{maxLogs:Math.max(1,parseInt(this.getAttribute("max-logs")||100,10)),theme:this.getAttribute("theme")==="light"?"light":"dark",showTime:this.getAttribute("show-time")!=="false",timeFormat:this.getAttribute("time-format")||"HH:mm:ss",autoScroll:this.getAttribute("auto-scroll")!=="false",showStats:this.getAttribute("show-stats")!=="false",hideButton:this.getAttribute("hide-button")==="true",autoDestroy:this.getAttribute("auto-destroy")==="true",draggable:this.getAttribute("draggable")!=="false"}}_trimLogs(){this._state.logs.length>this._config.maxLogs&&(this._state.logs=this._state.logs.slice(-this._config.maxLogs))}_updateLogsDisplay(){let t=this.shadowRoot.querySelector("#logContent");if(!t)return;let e=this._state.logs.filter(o=>this._state.filters[o.type]);if(e.length===0){t.innerHTML='<div class="empty-state">\u{1F4DD} \u6CA1\u6709\u65E5\u5FD7\u8BB0\u5F55</div>';return}t.innerHTML="",e.forEach(o=>{let s=document.createElement("div");s.className=`log-entry ${o.type}`;let r="";if(this._config.showTime){let i=new Date(o.time);if(this._config.timeFormat==="relative")r=this._getRelativeTime(o.time);else if(this._config.timeFormat==="HH:mm:ss")r=i.toLocaleTimeString("zh-CN",{hour12:!1});else if(this._config.timeFormat==="HH:mm:ss.ms"){let n=i.toLocaleTimeString("zh-CN",{hour12:!1}),l=String(i.getMilliseconds()).padStart(3,"0");r=`${n}.${l}`}else r=i.toLocaleString("zh-CN")}s.innerHTML=`
2
+ ${this._config.showTime?`<span class="log-time">${r}</span>`:""}
3
+ <span class="log-message">${this._escapeHtml(String(o.message))}</span>
4
+ `,t.appendChild(s)}),this._config.autoScroll&&(t.scrollTop=t.scrollHeight)}_escapeHtml(t){let e=document.createElement("div");return e.textContent=t,e.innerHTML}_getRelativeTime(t){let o=Date.now()-t;return o<6e4?`${Math.floor(o/1e3)}\u79D2\u524D`:o<36e5?`${Math.floor(o/6e4)}\u5206\u949F\u524D`:o<864e5?`${Math.floor(o/36e5)}\u5C0F\u65F6\u524D`:`${Math.floor(o/864e5)}\u5929\u524D`}_updateDraggableState(){let t=this.shadowRoot.querySelector("#dragHandle"),e=this.shadowRoot.querySelector("#logHeader"),o=this.shadowRoot.querySelector("#minimizedTitle"),s=this.shadowRoot.querySelector("#popupContainer");t&&(this._config.draggable?(t.style.display="block",t.style.cursor="move",e&&(e.style.cursor="move"),o&&(o.style.cursor="move"),s&&(s.style.cursor="default")):(t.style.display="none",t.style.cursor="default",e&&(e.style.cursor="default"),o&&(o.style.cursor="default"),s&&(s.style.cursor="default")))}_render(){let t=document.createElement("style");t.textContent=this._getStyles(),this.shadowRoot.innerHTML="",this.shadowRoot.appendChild(t),this.shadowRoot.innerHTML+=`
5
+ <!-- \u6D6E\u52A8\u6309\u94AE -->
6
+ <div id="floatingContainer" class="floating-container" style="display: ${this._config.hideButton?"none":"block"}">
7
+ ${this._state.isOpen?"":`
8
+ <div class="floating-button" id="floatingButton" title="\u6253\u5F00\u65E5\u5FD7">
9
+ \u{1F4C4}
10
+ </div>
11
+ `}
12
+ </div>
13
+
14
+ <!-- \u5F39\u51FA\u7A97\u53E3 -->
15
+ <div class="popup-container" id="popupContainer" style="display: none;">
16
+ <!-- \u5B8C\u6574\u7684\u65E5\u5FD7\u5BB9\u5668 -->
17
+ <div class="log-container ${this._state.showLogs?"expanded":"collapsed"} ${this._config.theme}">
18
+ <div class="log-header" id="logHeader">
19
+ <div class="log-title">
20
+ ${this._config.draggable?'<span class="drag-handle" id="dragHandle" title="\u62D6\u52A8">\u2194</span>':""}
21
+ <span class="log-icon">\u{1F4C4}</span>
22
+ <h3>\u65E5\u5FD7\u67E5\u770B\u5668</h3>
23
+ <span class="log-count" id="logCount">0</span>
24
+ </div>
25
+ <div class="log-actions">
26
+ <button class="toggle-btn" title="${this._state.showLogs?"\u9690\u85CF\u65E5\u5FD7":"\u663E\u793A\u65E5\u5FD7"}">
27
+ ${this._state.showLogs?"\u{1F441}\uFE0F":"\u{1F441}\uFE0F\u200D\u{1F5E8}\uFE0F"}
28
+ </button>
29
+ <button class="clear-btn" title="\u6E05\u7A7A\u65E5\u5FD7">\u{1F5D1}\uFE0F</button>
30
+ <button class="export-btn" title="\u5BFC\u51FA\u65E5\u5FD7">\u{1F4E5}</button>
31
+ <button class="import-btn" title="\u5BFC\u5165\u65E5\u5FD7">\u{1F4E4}</button>
32
+ <button class="copy-btn" title="\u590D\u5236\u65E5\u5FD7">\u{1F4CB}</button>
33
+ <button class="popup-btn" id="minimizeBtn" title="\u6700\u5C0F\u5316">_</button>
34
+ <button class="popup-btn" id="closeBtn" title="${this._config.autoDestroy?"\u5173\u95ED\u5E76\u9500\u6BC1":"\u9690\u85CF"}">\u2715</button>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="log-content" id="logContent">
39
+ <div class="empty-state">\u{1F4DD} \u6CA1\u6709\u65E5\u5FD7\u8BB0\u5F55</div>
40
+ </div>
41
+
42
+ <div class="log-footer">
43
+ <div class="log-filter">
44
+ <label class="filter-label">
45
+ <input type="checkbox" class="filter-checkbox" data-type="info" checked>
46
+ <span class="filter-badge info">\u4FE1\u606F</span>
47
+ </label>
48
+ <label class="filter-label">
49
+ <input type="checkbox" class="filter-checkbox" data-type="success" checked>
50
+ <span class="filter-badge success">\u6210\u529F</span>
51
+ </label>
52
+ <label class="filter-label">
53
+ <input type="checkbox" class="filter-checkbox" data-type="warning" checked>
54
+ <span class="filter-badge warning">\u8B66\u544A</span>
55
+ </label>
56
+ <label class="filter-label">
57
+ <input type="checkbox" class="filter-checkbox" data-type="error" checked>
58
+ <span class="filter-badge error">\u9519\u8BEF</span>
59
+ </label>
60
+ <label class="filter-label">
61
+ <input type="checkbox" class="filter-checkbox" data-type="ignore" checked>
62
+ <span class="filter-badge ignore">\u5FFD\u7565</span>
63
+ </label>
64
+ </div>
65
+ <div class="log-stats">
66
+ <div class="stat-row">
67
+ <span>\u603B\u8BA1: <span id="totalCount">0</span></span>
68
+ <span>\u4FE1\u606F: <span id="infoCount">0</span></span>
69
+ <span>\u6210\u529F: <span id="successCount">0</span></span>
70
+ <span>\u8B66\u544A: <span id="warningCount">0</span></span>
71
+ <span>\u9519\u8BEF: <span id="errorCount">0</span></span>
72
+ <span>\u5FFD\u7565: <span id="ignoreCount">0</span></span>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ </div>
77
+
78
+ <!-- \u6700\u5C0F\u5316\u65F6\u7684\u6807\u9898\u680F -->
79
+ <div class="minimized-title" id="minimizedTitle" style="display: none;">
80
+ <div class="minimized-title-left">
81
+ <span>\u{1F4C4} \u65E5\u5FD7\u67E5\u770B\u5668</span>
82
+ <span class="minimized-log-count" id="minimizedLogCount">0</span>
83
+ <div class="minimized-actions">
84
+ <button class="minimized-popup-btn" id="maximizeBtn" title="\u6700\u5927\u5316">\u25A1</button>
85
+ <button class="minimized-popup-btn" id="closeMinimizedBtn" title="${this._config.autoDestroy?"\u5173\u95ED\u5E76\u9500\u6BC1":"\u9690\u85CF"}">\u2715</button>
86
+ </div>
87
+ </div>
88
+ </div>
89
+
90
+ <div class="resize-handle" id="resizeHandle"></div>
91
+ </div>
92
+ `,this._updateTheme(),this._updateDraggableState()}_getStyles(){return`
93
+ :host {
94
+ display: block;
95
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
96
+ font-size: 12px;
97
+ width: 100%;
98
+ }
99
+
100
+ /* \u6D6E\u52A8\u6309\u94AE\u6837\u5F0F */
101
+ .floating-container {
102
+ position: fixed;
103
+ bottom: 20px;
104
+ right: 20px;
105
+ z-index: 9998;
106
+ }
107
+
108
+ .floating-button {
109
+ width: 50px;
110
+ height: 50px;
111
+ border-radius: 50%;
112
+ background: #1890ff;
113
+ color: white;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ font-size: 20px;
118
+ cursor: pointer;
119
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
120
+ transition: all 0.3s ease;
121
+ user-select: none;
122
+ }
123
+
124
+ .floating-button:hover {
125
+ background: #40a9ff;
126
+ transform: scale(1.1);
127
+ }
128
+
129
+ .floating-button:active {
130
+ transform: scale(0.95);
131
+ }
132
+
133
+ /* \u5F39\u51FA\u7A97\u53E3\u6837\u5F0F */
134
+ .popup-container {
135
+ position: fixed;
136
+ z-index: 9999;
137
+ width: 800px;
138
+ height: 600px;
139
+ display: none;
140
+ border-radius: 8px;
141
+ overflow: hidden;
142
+ box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
143
+ resize: both;
144
+ min-width: 400px;
145
+ min-height: 300px;
146
+ }
147
+
148
+ .popup-container.open {
149
+ display: block;
150
+ }
151
+
152
+ .popup-container.minimized {
153
+ width: 320px !important;
154
+ height: 40px !important;
155
+ min-height: 40px !important;
156
+ min-width: 320px !important;
157
+ resize: none;
158
+ border-radius: 6px;
159
+ display: block;
160
+ }
161
+
162
+ .popup-container.minimized .log-container {
163
+ display: none !important;
164
+ }
165
+
166
+ .popup-container.minimized .resize-handle {
167
+ display: none;
168
+ }
169
+
170
+ /* \u6700\u5C0F\u5316\u65F6\u7684\u6807\u9898\u680F\u6837\u5F0F */
171
+ .minimized-title {
172
+ position: absolute;
173
+ top: 0;
174
+ left: 0;
175
+ right: 0;
176
+ bottom: 0;
177
+ display: none;
178
+ align-items: center;
179
+ padding: 0 12px;
180
+ background: var(--header-bg);
181
+ color: var(--text-color);
182
+ font-size: 12px;
183
+ font-weight: 600;
184
+ cursor: move;
185
+ border-radius: 6px;
186
+ overflow: hidden;
187
+ z-index: 1000;
188
+ }
189
+
190
+ .popup-container.minimized .minimized-title {
191
+ display: flex;
192
+ }
193
+
194
+ .minimized-title-left {
195
+ display: flex;
196
+ align-items: center;
197
+ gap: 8px;
198
+ flex: 1;
199
+ }
200
+
201
+ .minimized-log-count {
202
+ background: var(--button-bg);
203
+ color: var(--button-text);
204
+ padding: 2px 8px;
205
+ border-radius: 10px;
206
+ font-size: 11px;
207
+ font-weight: 500;
208
+ min-width: 20px;
209
+ text-align: center;
210
+ }
211
+
212
+ .minimized-actions {
213
+ display: flex;
214
+ align-items: center;
215
+ gap: 4px;
216
+ margin-left: auto;
217
+ }
218
+
219
+ .minimized-popup-btn {
220
+ background: var(--button-bg);
221
+ border: none;
222
+ border-radius: 4px;
223
+ color: var(--button-text);
224
+ cursor: pointer;
225
+ font-size: 12px;
226
+ width: 24px;
227
+ height: 24px;
228
+ display: flex;
229
+ align-items: center;
230
+ justify-content: center;
231
+ transition: all 0.2s;
232
+ opacity: 0.8;
233
+ font-family: monospace;
234
+ }
235
+
236
+ .minimized-popup-btn:hover {
237
+ background: var(--button-hover);
238
+ transform: translateY(-1px);
239
+ opacity: 1;
240
+ }
241
+
242
+ .resize-handle {
243
+ position: absolute;
244
+ width: 20px;
245
+ height: 20px;
246
+ right: 0;
247
+ bottom: 0;
248
+ cursor: se-resize;
249
+ z-index: 10000;
250
+ }
251
+
252
+ .popup-container.minimized .resize-handle {
253
+ display: none;
254
+ }
255
+
256
+ /* \u6697\u8272\u4E3B\u9898 */
257
+ .log-container.dark {
258
+ --bg-color: #1e1e1e;
259
+ --header-bg: #252526;
260
+ --border-color: #3e3e42;
261
+ --text-color: #d4d4d4;
262
+ --text-muted: #8c8c8c;
263
+ --log-entry-bg: #2d2d30;
264
+ --hover-bg: #323234;
265
+ --info-color: #3794ff;
266
+ --info-bg: rgba(55, 148, 255, 0.1);
267
+ --success-color: #4ec9b0;
268
+ --success-bg: rgba(78, 201, 176, 0.1);
269
+ --warning-color: #dcdcaa;
270
+ --warning-bg: rgba(220, 220, 170, 0.1);
271
+ --error-color: #f48771;
272
+ --error-bg: rgba(244, 135, 113, 0.1);
273
+ --ignore-color: #8a8a8a;
274
+ --ignore-bg: rgba(138, 138, 138, 0.1);
275
+ --button-bg: #3e3e42;
276
+ --button-hover: #4a4a4e;
277
+ --button-text: #d4d4d4;
278
+ --filter-badge-bg: #3e3e42;
279
+ }
280
+
281
+ /* \u4EAE\u8272\u4E3B\u9898 */
282
+ .log-container.light {
283
+ --bg-color: #ffffff;
284
+ --header-bg: #f5f5f5;
285
+ --border-color: #e0e0e0;
286
+ --text-color: #333333;
287
+ --text-muted: #666666;
288
+ --log-entry-bg: #f9f9f9;
289
+ --hover-bg: #f0f0f0;
290
+ --info-color: #1890ff;
291
+ --info-bg: rgba(24, 144, 255, 0.08);
292
+ --success-color: #52c41a;
293
+ --success-bg: rgba(82, 196, 26, 0.08);
294
+ --warning-color: #faad14;
295
+ --warning-bg: rgba(250, 173, 20, 0.08);
296
+ --error-color: #ff4d4f;
297
+ --error-bg: rgba(255, 77, 79, 0.08);
298
+ --ignore-color: #999999;
299
+ --ignore-bg: rgba(153, 153, 153, 0.08);
300
+ --button-bg: #e8e8e8;
301
+ --button-hover: #d9d9d9;
302
+ --button-text: #595959;
303
+ --filter-badge-bg: #e8e8e8;
304
+ }
305
+
306
+ .log-container {
307
+ border: 1px solid var(--border-color);
308
+ border-radius: 8px;
309
+ overflow: hidden;
310
+ transition: all 0.3s ease;
311
+ background: var(--bg-color);
312
+ color: var(--text-color);
313
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
314
+ width: 100%;
315
+ height: 100%;
316
+ display: flex;
317
+ flex-direction: column;
318
+ }
319
+
320
+ .log-container.collapsed {
321
+ height: auto;
322
+ min-height: 0;
323
+ flex: 0 0 auto;
324
+ }
325
+
326
+ .log-container.collapsed .log-header {
327
+ border-bottom: none;
328
+ }
329
+
330
+ .log-container.collapsed .log-content,
331
+ .log-container.collapsed .log-footer {
332
+ display: none;
333
+ }
334
+
335
+ .log-container.expanded {
336
+ flex: 1;
337
+ min-height: 0;
338
+ }
339
+
340
+ .log-container.expanded .log-content,
341
+ .log-container.expanded .log-footer {
342
+ display: block;
343
+ }
344
+
345
+ .log-header {
346
+ display: flex;
347
+ justify-content: space-between;
348
+ align-items: center;
349
+ padding: 10px 16px;
350
+ background: var(--header-bg);
351
+ border-bottom: 1px solid var(--border-color);
352
+ user-select: none;
353
+ transition: background-color 0.2s;
354
+ flex-shrink: 0;
355
+ }
356
+
357
+ .log-header:hover {
358
+ background: var(--hover-bg);
359
+ }
360
+
361
+ .log-title {
362
+ display: flex;
363
+ align-items: center;
364
+ gap: 10px;
365
+ }
366
+
367
+ .drag-handle {
368
+ cursor: move;
369
+ opacity: 0.6;
370
+ font-size: 16px;
371
+ padding: 4px;
372
+ border-radius: 4px;
373
+ transition: all 0.2s;
374
+ }
375
+
376
+ .drag-handle:hover {
377
+ opacity: 1;
378
+ background: var(--button-bg);
379
+ }
380
+
381
+ .log-icon {
382
+ font-size: 16px;
383
+ opacity: 0.8;
384
+ }
385
+
386
+ .log-title h3 {
387
+ margin: 0;
388
+ font-size: 14px;
389
+ font-weight: 600;
390
+ }
391
+
392
+ .log-count {
393
+ background: var(--button-bg);
394
+ color: var(--button-text);
395
+ padding: 2px 8px;
396
+ border-radius: 10px;
397
+ font-size: 11px;
398
+ font-weight: 500;
399
+ min-width: 20px;
400
+ text-align: center;
401
+ }
402
+
403
+ .log-actions {
404
+ display: flex;
405
+ gap: 6px;
406
+ }
407
+
408
+ /* \u6309\u94AE\u6837\u5F0F */
409
+ .popup-btn,
410
+ .toggle-btn,
411
+ .clear-btn,
412
+ .export-btn,
413
+ .import-btn,
414
+ .copy-btn {
415
+ background: var(--button-bg);
416
+ border: none;
417
+ border-radius: 4px;
418
+ color: var(--button-text);
419
+ cursor: pointer;
420
+ font-size: 13px;
421
+ width: 28px;
422
+ height: 28px;
423
+ display: flex;
424
+ align-items: center;
425
+ justify-content: center;
426
+ transition: all 0.2s;
427
+ opacity: 0.8;
428
+ }
429
+
430
+ .popup-btn:hover,
431
+ .toggle-btn:hover,
432
+ .clear-btn:hover,
433
+ .export-btn:hover,
434
+ .import-btn:hover,
435
+ .copy-btn:hover {
436
+ background: var(--button-hover);
437
+ transform: translateY(-1px);
438
+ opacity: 1;
439
+ }
440
+
441
+ /* \u65E5\u5FD7\u5185\u5BB9\u6837\u5F0F */
442
+ .log-content {
443
+ overflow-y: auto;
444
+ flex: 1;
445
+ padding: 8px;
446
+ font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, 'Courier New', monospace;
447
+ line-height: 1.5;
448
+ word-break: break-word;
449
+ white-space: pre-wrap;
450
+ scroll-behavior: smooth;
451
+ min-height: 0;
452
+ }
453
+
454
+ .log-entry {
455
+ margin-bottom: 4px;
456
+ padding: 8px 10px;
457
+ border-radius: 4px;
458
+ border-left: 3px solid transparent;
459
+ background: var(--log-entry-bg);
460
+ transition: all 0.2s ease;
461
+ animation: fadeIn 0.3s ease;
462
+ position: relative;
463
+ }
464
+
465
+ .log-entry:hover {
466
+ background: var(--hover-bg);
467
+ transform: translateX(2px);
468
+ }
469
+
470
+ .log-entry.info {
471
+ border-left-color: var(--info-color);
472
+ background: var(--info-bg);
473
+ }
474
+
475
+ .log-entry.info:hover {
476
+ background: var(--info-bg);
477
+ filter: brightness(1.1);
478
+ }
479
+
480
+ .log-entry.success {
481
+ border-left-color: var(--success-color);
482
+ background: var(--success-bg);
483
+ }
484
+
485
+ .log-entry.success:hover {
486
+ background: var(--success-bg);
487
+ filter: brightness(1.1);
488
+ }
489
+
490
+ .log-entry.warning {
491
+ border-left-color: var(--warning-color);
492
+ background: var(--warning-bg);
493
+ }
494
+
495
+ .log-entry.warning:hover {
496
+ background: var(--warning-bg);
497
+ filter: brightness(1.1);
498
+ }
499
+
500
+ .log-entry.error {
501
+ border-left-color: var(--error-color);
502
+ background: var(--error-bg);
503
+ }
504
+
505
+ .log-entry.error:hover {
506
+ background: var(--error-bg);
507
+ filter: brightness(1.1);
508
+ }
509
+
510
+ .log-entry.ignore {
511
+ border-left-color: var(--ignore-color);
512
+ background: var(--ignore-bg);
513
+ opacity: 0.7;
514
+ }
515
+
516
+ .log-entry.ignore:hover {
517
+ background: var(--ignore-bg);
518
+ filter: brightness(1.1);
519
+ opacity: 0.9;
520
+ }
521
+
522
+ .log-time {
523
+ color: var(--text-muted);
524
+ font-size: 10px;
525
+ margin-right: 10px;
526
+ user-select: none;
527
+ font-variant-numeric: tabular-nums;
528
+ }
529
+
530
+ .log-message {
531
+ font-size: 12px;
532
+ word-break: break-word;
533
+ }
534
+
535
+ .log-footer {
536
+ padding: 10px 16px;
537
+ border-top: 1px solid var(--border-color);
538
+ background: var(--header-bg);
539
+ font-size: 11px;
540
+ flex-shrink: 0;
541
+ }
542
+
543
+ .log-filter {
544
+ display: flex;
545
+ flex-wrap: wrap;
546
+ gap: 12px;
547
+ margin-bottom: 8px;
548
+ }
549
+
550
+ .filter-label {
551
+ display: flex;
552
+ align-items: center;
553
+ gap: 5px;
554
+ cursor: pointer;
555
+ color: var(--text-muted);
556
+ transition: opacity 0.2s;
557
+ }
558
+
559
+ .filter-label:hover {
560
+ opacity: 0.8;
561
+ }
562
+
563
+ .filter-checkbox {
564
+ margin: 0;
565
+ cursor: pointer;
566
+ }
567
+
568
+ .filter-badge {
569
+ padding: 2px 8px;
570
+ border-radius: 3px;
571
+ font-size: 10px;
572
+ font-weight: 500;
573
+ background: var(--filter-badge-bg);
574
+ }
575
+
576
+ .filter-badge.info {
577
+ background: var(--info-bg);
578
+ color: var(--info-color);
579
+ }
580
+
581
+ .filter-badge.success {
582
+ background: var(--success-bg);
583
+ color: var(--success-color);
584
+ }
585
+
586
+ .filter-badge.warning {
587
+ background: var(--warning-bg);
588
+ color: var(--warning-color);
589
+ }
590
+
591
+ .filter-badge.error {
592
+ background: var(--error-bg);
593
+ color: var(--error-color);
594
+ }
595
+
596
+ .filter-badge.ignore {
597
+ background: var(--ignore-bg);
598
+ color: var(--ignore-color);
599
+ }
600
+
601
+ .log-stats {
602
+ color: var(--text-muted);
603
+ }
604
+
605
+ .stat-row {
606
+ display: flex;
607
+ flex-wrap: wrap;
608
+ gap: 12px;
609
+ justify-content: space-between;
610
+ }
611
+
612
+ .stat-row span {
613
+ display: inline-flex;
614
+ align-items: center;
615
+ gap: 4px;
616
+ }
617
+
618
+ .stat-row #totalCount {
619
+ font-weight: 600;
620
+ color: var(--text-color);
621
+ }
622
+
623
+ .stat-row #infoCount {
624
+ color: var(--info-color);
625
+ font-weight: 600;
626
+ }
627
+
628
+ .stat-row #successCount {
629
+ color: var(--success-color);
630
+ font-weight: 600;
631
+ }
632
+
633
+ .stat-row #warningCount {
634
+ color: var(--warning-color);
635
+ font-weight: 600;
636
+ }
637
+
638
+ .stat-row #errorCount {
639
+ color: var(--error-color);
640
+ font-weight: 600;
641
+ }
642
+
643
+ .stat-row #ignoreCount {
644
+ color: var(--ignore-color);
645
+ font-weight: 600;
646
+ }
647
+
648
+ .empty-state {
649
+ text-align: center;
650
+ color: var(--text-muted);
651
+ padding: 40px 20px;
652
+ font-style: italic;
653
+ user-select: none;
654
+ }
655
+
656
+ .import-notice {
657
+ background: var(--info-bg);
658
+ border-left: 3px solid var(--info-color);
659
+ color: var(--text-color);
660
+ padding: 10px;
661
+ margin: 8px;
662
+ border-radius: 4px;
663
+ font-size: 11px;
664
+ animation: fadeIn 0.3s ease;
665
+ }
666
+
667
+ .import-notice.success {
668
+ background: var(--success-bg);
669
+ border-left-color: var(--success-color);
670
+ }
671
+
672
+ .import-notice.error {
673
+ background: var(--error-bg);
674
+ border-left-color: var(--error-color);
675
+ }
676
+
677
+ @keyframes fadeIn {
678
+ from {
679
+ opacity: 0;
680
+ transform: translateY(-5px);
681
+ }
682
+ to {
683
+ opacity: 1;
684
+ transform: translateY(0);
685
+ }
686
+ }
687
+
688
+ @keyframes pulse {
689
+ 0%, 100% {
690
+ opacity: 1;
691
+ }
692
+ 50% {
693
+ opacity: 0.5;
694
+ }
695
+ }
696
+
697
+ /* \u6EDA\u52A8\u6761\u6837\u5F0F */
698
+ .log-content::-webkit-scrollbar {
699
+ width: 6px;
700
+ }
701
+
702
+ .log-content::-webkit-scrollbar-track {
703
+ background: var(--bg-color);
704
+ }
705
+
706
+ .log-content::-webkit-scrollbar-thumb {
707
+ background: var(--border-color);
708
+ border-radius: 3px;
709
+ }
710
+
711
+ .log-content::-webkit-scrollbar-thumb:hover {
712
+ background: var(--text-muted);
713
+ }
714
+ `}_setupEventListeners(){this._eventListeners.forEach(({type:e,handler:o,target:s})=>{s&&s.removeEventListener&&s.removeEventListener(e,o)}),this._eventListeners.clear();let t=e=>{e.target.classList.contains("toggle-btn")?(e.stopPropagation(),e.preventDefault(),this.toggleVisibility()):e.target.classList.contains("clear-btn")?(e.stopPropagation(),e.preventDefault(),this.clearLogs()):e.target.classList.contains("export-btn")?(e.stopPropagation(),e.preventDefault(),this.exportLogs()):e.target.classList.contains("import-btn")?(e.stopPropagation(),e.preventDefault(),this._triggerImport()):e.target.classList.contains("copy-btn")?(e.stopPropagation(),e.preventDefault(),this.copyLogs()):e.target.classList.contains("filter-checkbox")?(e.stopPropagation(),e.preventDefault(),this._applyFilters()):e.target.id==="minimizeBtn"?(e.stopPropagation(),e.preventDefault(),this._minimize()):e.target.id==="closeBtn"?(e.stopPropagation(),e.preventDefault(),this.clos()):e.target.id==="closeMinimizedBtn"?(e.stopPropagation(),e.preventDefault(),this.clos()):e.target.id==="maximizeBtn"?(e.stopPropagation(),e.preventDefault(),this._restore()):e.target.id==="floatingButton"&&(e.stopPropagation(),e.preventDefault(),this.open())};this.shadowRoot.addEventListener("click",t),this._eventListeners.set("click",{type:"click",handler:t,target:this.shadowRoot}),this._setupFloatingButtonDrag(),this._setupDrag(),this._setupResize()}_setupFloatingButtonDrag(){let t=this.shadowRoot.querySelector("#floatingButton"),e=this.shadowRoot.querySelector("#floatingContainer");if(!t||!e)return;let o=!1,s,r,i,n;t.addEventListener("mousedown",l=>{l.preventDefault(),l.stopPropagation();let a=e.getBoundingClientRect();s=l.clientX,r=l.clientY,i=a.left,n=a.top,o=!0;let g=h=>{if(!o)return;let p=h.clientX-s,u=h.clientY-r,f=i+p,m=n+u,x=window.innerWidth-a.width,v=window.innerHeight-a.height;f=Math.max(0,Math.min(f,x)),m=Math.max(0,Math.min(m,v)),e.style.left=`${f}px`,e.style.top=`${m}px`,e.style.right="auto",e.style.bottom="auto"},d=()=>{o=!1,document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",d)};document.addEventListener("mousemove",g),document.addEventListener("mouseup",d)})}_setupDrag(){if(!this._config.draggable)return;let t=this.shadowRoot.querySelector("#popupContainer"),e=this.shadowRoot.querySelector("#dragHandle"),o=this.shadowRoot.querySelector("#logHeader"),s=this.shadowRoot.querySelector("#minimizedTitle");if(!t)return;let r=i=>{i.preventDefault(),i.stopPropagation();let n=t.getBoundingClientRect();this._state.dragInfo.isDragging=!0,this._state.dragInfo.startX=i.clientX,this._state.dragInfo.startY=i.clientY,this._state.dragInfo.initialLeft=n.left,this._state.dragInfo.initialTop=n.top;let l=g=>{if(!this._state.dragInfo.isDragging)return;let d=g.clientX-this._state.dragInfo.startX,h=g.clientY-this._state.dragInfo.startY,p=this._state.dragInfo.initialLeft+d,u=this._state.dragInfo.initialTop+h,f=window.innerWidth-n.width,m=window.innerHeight-n.height;p=Math.max(0,Math.min(p,f)),u=Math.max(0,Math.min(u,m)),t.style.left=`${p}px`,t.style.top=`${u}px`,t.style.transform="none"},a=()=>{this._state.dragInfo.isDragging=!1,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",a)};e&&e.addEventListener("mousedown",r),o&&o.addEventListener("mousedown",i=>{this._config.draggable&&i.target!==e&&!i.target.classList.contains("toggle-btn")&&!i.target.classList.contains("clear-btn")&&!i.target.classList.contains("export-btn")&&!i.target.classList.contains("import-btn")&&!i.target.classList.contains("copy-btn")&&!i.target.classList.contains("popup-btn")&&r(i)}),s&&s.addEventListener("mousedown",i=>{this._config.draggable&&(i.target.classList.contains("minimized-popup-btn")||r(i))})}_setupResize(){let t=this.shadowRoot.querySelector("#popupContainer"),e=this.shadowRoot.querySelector("#resizeHandle");if(!t||!e)return;let o=!1,s,r,i,n,l=d=>{if(t.classList.contains("minimized"))return;o=!0;let h=t.getBoundingClientRect();s=h.width,r=h.height,i=d.clientX,n=d.clientY,d.preventDefault()},a=d=>{if(!o)return;let h=s+(d.clientX-i),p=r+(d.clientY-n);t.style.width=`${Math.max(400,h)}px`,t.style.height=`${Math.max(300,p)}px`,d.preventDefault()},g=()=>{o=!1};e.addEventListener("mousedown",l),document.addEventListener("mousemove",a),document.addEventListener("mouseup",g)}_cleanup(){this._eventListeners.forEach(({type:t,handler:e,target:o})=>{o&&o.removeEventListener&&o.removeEventListener(t,e)}),this._eventListeners.clear(),this._fileInput&&this._fileInput.parentNode&&this._fileInput.parentNode.removeChild(this._fileInput),this._config.autoDestroy&&this.remove()}_updateTheme(){let t=this.shadowRoot.querySelector(".log-container");t&&(t.className=`log-container ${this._state.showLogs?"expanded":"collapsed"} ${this._config.theme}`)}_updateStatsVisibility(){let t=this.shadowRoot.querySelector(".log-footer");t&&(t.style.display=this._config.showStats?"block":"none")}_updateButtonsVisibility(){let t=this.shadowRoot.querySelector("#floatingContainer");t&&(this._config.hideButton?t.style.display="none":t.style.display=this._state.isOpen?"none":"block")}_updateCloseButton(){let t=this.shadowRoot.querySelector("#closeBtn"),e=this.shadowRoot.querySelector("#closeMinimizedBtn"),o=this._config.autoDestroy?"\u5173\u95ED\u5E76\u9500\u6BC1":"\u9690\u85CF";t&&(t.title=o),e&&(e.title=o)}_updateStats(){let t={total:this._state.logs.length,info:0,success:0,warning:0,error:0,ignore:0};this._state.logs.forEach(g=>{t[g.type]!==void 0&&t[g.type]++});let e=this.shadowRoot.querySelector("#logCount"),o=this.shadowRoot.querySelector("#minimizedLogCount"),s=this.shadowRoot.querySelector("#totalCount"),r=this.shadowRoot.querySelector("#infoCount"),i=this.shadowRoot.querySelector("#successCount"),n=this.shadowRoot.querySelector("#warningCount"),l=this.shadowRoot.querySelector("#errorCount"),a=this.shadowRoot.querySelector("#ignoreCount");e&&(e.textContent=t.total),o&&(o.textContent=t.total),s&&(s.textContent=t.total),r&&(r.textContent=t.info),i&&(i.textContent=t.success),n&&(n.textContent=t.warning),l&&(l.textContent=t.error),a&&(a.textContent=t.ignore)}_applyFilters(){this.shadowRoot.querySelectorAll(".filter-checkbox").forEach(e=>{let o=e.dataset.type;this._state.filters[o]=e.checked}),this._updateLogsDisplay()}_triggerImport(){this._fileInput.click()}async _handleFileImport(t){let e=t.target.files[0];if(e)try{this.addLog("\u5F00\u59CB\u5BFC\u5165\u65E5\u5FD7\u6587\u4EF6...","info");let o=await e.text(),s=[],r="unknown";try{let n=JSON.parse(o);Array.isArray(n)?(s=n,r="json"):typeof n=="object"&&n.logs&&Array.isArray(n.logs)&&(s=n.logs,r="json-with-metadata")}catch{let l=o.split(`
715
+ `).filter(a=>a.trim());s=this._parseTextLogs(l),r="text"}if(s.length===0)throw new Error("\u6587\u4EF6\u4E2D\u6CA1\u6709\u627E\u5230\u6709\u6548\u7684\u65E5\u5FD7\u6570\u636E");let i=s.map(n=>this._normalizeLogEntry(n)).filter(n=>n!==null);if(i.length===0)throw new Error("\u6587\u4EF6\u4E2D\u6CA1\u6709\u6709\u6548\u7684\u65E5\u5FD7\u6761\u76EE");this._state.logs.push(...i),this._trimLogs(),this._updateLogsDisplay(),this._updateStats(),this._showImportNotice(`\u6210\u529F\u5BFC\u5165 ${i.length} \u6761\u65E5\u5FD7 (${r}\u683C\u5F0F)`,"success"),this.addLog(`\u4ECE\u6587\u4EF6\u5BFC\u5165 ${i.length} \u6761\u65E5\u5FD7`,"success"),this.dispatchEvent(new CustomEvent("nv-log-import",{detail:{count:i.length,format:r,logs:i}}))}catch(o){console.error("\u5BFC\u5165\u65E5\u5FD7\u5931\u8D25:",o),this._showImportNotice(`\u5BFC\u5165\u5931\u8D25: ${o.message}`,"error"),this.addLog(`\u5BFC\u5165\u65E5\u5FD7\u5931\u8D25: ${o.message}`,"error")}}_parseTextLogs(t){let e=[],o=/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)?)\]/,s=/^\[(\d{2}:\d{2}:\d{2}(?:\.\d+)?)\]/,r=/\[(INFO|SUCCESS|WARNING|ERROR|IGNORE)\]/i;return t.forEach((i,n)=>{if(!i.trim())return;let l=Date.now(),a="info",g=i,d=i.match(o)||i.match(s);if(d){try{l=new Date(d[1]).getTime()||Date.now()-(t.length-n)*1e3}catch{l=Date.now()-(t.length-n)*1e3}g=i.substring(d[0].length).trim()}let h=g.match(r);if(h){let p=h[1].toLowerCase();["info","success","warning","error","ignore"].includes(p)&&(a=p),g=g.replace(r,"").trim()}e.push({time:l,type:a,message:g})}),e}_normalizeLogEntry(t){if(t==null)return null;if(typeof t=="string")return{time:Date.now(),type:"info",message:t};if(typeof t=="object"){let e={time:t.time||t.timestamp||Date.now(),type:(t.type||t.level||"info").toLowerCase(),message:String(t.message||t.msg||t.text||JSON.stringify(t))};return["info","success","warning","error","ignore"].includes(e.type)||(e.type="info"),(typeof e.time!="number"||isNaN(e.time))&&(e.time=Date.now()),e}return null}_showImportNotice(t,e="info"){let o=this.shadowRoot.querySelector("#logContent");if(!o)return;let s=document.createElement("div");s.className=`import-notice ${e}`,s.textContent=t,o.appendChild(s),setTimeout(()=>{s.parentNode===o&&o.removeChild(s)},3e3)}addLog(t,e="info",o=Date.now()){let s;if(typeof t=="object"&&t!==null){if(s=this._normalizeLogEntry(t),!s){console.warn("\u65E0\u6548\u7684\u65E5\u5FD7\u5BF9\u8C61:",t);return}}else["info","success","warning","error","ignore"].includes(e)||(e="info"),s={message:String(t),type:e,time:o};this._state.logs.push(s),this._trimLogs(),this._updateLogsDisplay(),this._updateStats(),this.dispatchEvent(new CustomEvent("nv-log-add",{detail:{log:s,total:this._state.logs.length,stats:this._getStats()}}))}clearLogs(){let t=this._state.logs.length;this._state.logs=[],this._updateLogsDisplay(),this._updateStats(),this.dispatchEvent(new CustomEvent("nv-log-clear",{detail:{clearedCount:t}}))}toggleVisibility(){this._state.showLogs=!this._state.showLogs;let t=this.shadowRoot.querySelector(".log-container");t&&(t.className=`log-container ${this._state.showLogs?"expanded":"collapsed"} ${this._config.theme}`);let e=this.shadowRoot.querySelector(".toggle-btn");e&&(e.title=this._state.showLogs?"\u9690\u85CF\u65E5\u5FD7":"\u663E\u793A\u65E5\u5FD7",e.textContent=this._state.showLogs?"\u{1F441}\uFE0F":"\u{1F441}\uFE0F\u200D\u{1F5E8}\uFE0F"),this.dispatchEvent(new CustomEvent("nv-log-toggle",{detail:{visible:this._state.showLogs}}))}exportLogs(t="json"){try{if(this._state.logs.length===0){this.addLog("\u6CA1\u6709\u65E5\u5FD7\u53EF\u5BFC\u51FA","warning");return}let e="",o="",s="";if(t==="json"){let a={exportTime:new Date().toISOString(),totalLogs:this._state.logs.length,logs:this._state.logs};e=JSON.stringify(a,null,2),o="application/json",s="json"}else e=this._state.logs.map(a=>`[${new Date(a.time).toLocaleString("zh-CN")}] [${a.type.toUpperCase()}] ${a.message}`).join(`
716
+ `),o="text/plain;charset=utf-8",s="txt";let r=new Blob([e],{type:o}),i=URL.createObjectURL(r),n=document.createElement("a"),l=new Date().toISOString().replace(/[:.]/g,"-");n.href=i,n.download=`logs_${l}.${s}`,n.click(),URL.revokeObjectURL(i),this.addLog(`\u65E5\u5FD7\u5DF2\u5BFC\u51FA (${this._state.logs.length} \u6761, ${t}\u683C\u5F0F)`,"success")}catch(e){this.addLog(`\u5BFC\u51FA\u65E5\u5FD7\u5931\u8D25: ${e.message}`,"error")}}async importLogs(t,e="auto"){try{let o=[],s="unknown";if(e==="auto"||e==="json")try{let i=JSON.parse(t);Array.isArray(i)?(o=i,s="json"):typeof i=="object"&&i.logs&&Array.isArray(i.logs)&&(o=i.logs,s="json-with-metadata")}catch{if(e==="json")throw new Error("JSON\u683C\u5F0F\u89E3\u6790\u5931\u8D25")}if(o.length===0){let i=t.split(`
717
+ `).filter(n=>n.trim());o=this._parseTextLogs(i),s="text"}if(o.length===0)throw new Error("\u6CA1\u6709\u627E\u5230\u6709\u6548\u7684\u65E5\u5FD7\u6570\u636E");let r=o.map(i=>this._normalizeLogEntry(i)).filter(i=>i!==null);if(r.length===0)throw new Error("\u6CA1\u6709\u6709\u6548\u7684\u65E5\u5FD7\u6761\u76EE");return this._state.logs.push(...r),this._trimLogs(),this._updateLogsDisplay(),this._updateStats(),this.addLog(`\u5BFC\u5165 ${r.length} \u6761\u65E5\u5FD7 (${s}\u683C\u5F0F)`,"success"),this.dispatchEvent(new CustomEvent("nv-log-import",{detail:{count:r.length,format:s,logs:r}})),{success:!0,count:r.length,format:s}}catch(o){throw console.error("\u5BFC\u5165\u65E5\u5FD7\u5931\u8D25:",o),this.addLog(`\u5BFC\u5165\u65E5\u5FD7\u5931\u8D25: ${o.message}`,"error"),o}}async copyLogs(){try{let t=this._state.logs.map(e=>`[${new Date(e.time).toLocaleString("zh-CN")}] [${e.type.toUpperCase()}] ${e.message}`).join(`
718
+ `);await navigator.clipboard.writeText(t),this.addLog("\u65E5\u5FD7\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F","success")}catch(t){this.addLog(`\u590D\u5236\u65E5\u5FD7\u5931\u8D25: ${t.message}`,"error")}}getLogs(){return[...this._state.logs]}getLogsByType(t){return Array.isArray(t)||(t=[t]),this._state.logs.filter(e=>t.includes(e.type))}_getStats(){let t={total:this._state.logs.length,info:0,success:0,warning:0,error:0,ignore:0};return this._state.logs.forEach(e=>{t[e.type]!==void 0&&t[e.type]++}),t}setMaxLogs(t){this._config.maxLogs=Math.max(1,parseInt(t,10)||100),this._trimLogs(),this._updateLogsDisplay(),this._updateStats()}setTheme(t){this._config.theme=t==="light"?"light":"dark",this._updateTheme()}setShowTime(t){this._config.showTime=!!t,this._updateLogsDisplay()}setTimeFormat(t){this._config.timeFormat=t,this._updateLogsDisplay()}setAutoScroll(t){this._config.autoScroll=!!t}setShowStats(t){this._config.showStats=!!t,this._updateStatsVisibility()}setHideButton(t){this._config.hideButton=!!t,this._updateButtonsVisibility()}setAutoDestroy(t){this._config.autoDestroy=!!t,this._updateCloseButton()}setDraggable(t){this._config.draggable=!!t,this._updateDraggableState()}open(){if(!this._state.isOpen){let t=this.shadowRoot.querySelector("#popupContainer");if(t){t.style.display="block",t.classList.add("open"),t.classList.remove("minimized");let e=this.shadowRoot.querySelector("#minimizedTitle");e&&(e.style.display="none");let o=800,s=600,r=Math.max(0,(window.innerWidth-o)/2),i=Math.max(0,(window.innerHeight-s)/2);if(t.style.width=`${o}px`,t.style.height=`${s}px`,t.style.left=`${r}px`,t.style.top=`${i}px`,t.style.transform="none",this._state.isMinimized=!1,this._state.showLogs=!0,this._updateLogsDisplay(),this._updateTheme(),this._updateDraggableState(),!this._config.hideButton){let n=this.shadowRoot.querySelector("#floatingContainer");n&&(n.style.display="none")}}this._state.isOpen=!0,this.addLog("\u{1F4C1} \u65E5\u5FD7\u67E5\u770B\u5668\u5DF2\u6253\u5F00","info")}}clos(){if(this._state.isOpen){let t=this.shadowRoot.querySelector("#popupContainer");if(t){this._state.originalPosition={x:parseInt(t.style.left)||0,y:parseInt(t.style.top)||0},t.classList.remove("open"),t.style.display="none";let e=this.shadowRoot.querySelector("#minimizedTitle");e&&(e.style.display="none")}if(this._state.isOpen=!1,!this._config.hideButton){let e=this.shadowRoot.querySelector("#floatingContainer");e&&(e.style.display="block")}this.addLog("\u{1F4C1} \u65E5\u5FD7\u67E5\u770B\u5668\u5DF2\u5173\u95ED","info"),this._config.autoDestroy&&setTimeout(()=>{this._cleanup()},100)}}_minimize(){let t=this.shadowRoot.querySelector("#popupContainer"),e=this.shadowRoot.querySelector("#minimizedTitle");t&&e&&(this._state.originalSize={width:t.style.width||"800px",height:t.style.height||"600px",minHeight:t.style.minHeight},t.classList.add("minimized"),t.style.width="320px",t.style.height="40px",t.style.minHeight="40px",t.style.minWidth="320px",e.style.display="flex",this._state.isMinimized=!0,this.addLog("\u{1F4F1} \u65E5\u5FD7\u67E5\u770B\u5668\u5DF2\u6700\u5C0F\u5316","info"))}_restore(){let t=this.shadowRoot.querySelector("#popupContainer"),e=this.shadowRoot.querySelector("#minimizedTitle");t&&e&&(t.classList.remove("minimized"),e.style.display="none",this._state.originalSize?(t.style.width=this._state.originalSize.width,t.style.height=this._state.originalSize.height,this._state.originalSize.minHeight?t.style.minHeight=this._state.originalSize.minHeight:t.style.minHeight="300px"):(t.style.width="800px",t.style.height="600px",t.style.minHeight="300px"),t.style.minWidth="400px",this._state.isMinimized=!1,this.addLog("\u{1F4F1} \u65E5\u5FD7\u67E5\u770B\u5668\u5DF2\u6062\u590D","info"))}};b.ELEMENT_NAME="nv-log-viewer";var _=async(c={})=>{let t=document.createElement("nv-log-viewer");return t.setAttribute("hide-button",c.hideButton!==!1?"true":"false"),t.setAttribute("auto-destroy",c.autoDestroy!==!1?"true":"false"),c.maxLogs&&t.setAttribute("max-logs",c.maxLogs),c.theme&&t.setAttribute("theme",c.theme),c.showTime!==void 0&&t.setAttribute("show-time",c.showTime),c.timeFormat&&t.setAttribute("time-format",c.timeFormat),c.showStats!==void 0&&t.setAttribute("show-stats",c.showStats),c.autoScroll!==void 0&&t.setAttribute("auto-scroll",c.autoScroll),document.body.appendChild(t),await new Promise(e=>setTimeout(e,100)),t.open(),t};customElements.get("nv-log-viewer")||customElements.define("nv-log-viewer",b);typeof y<"u"&&y.exports&&(y.exports={NvLogViewer:b,once:_})});return L();})();