dsh-explorer 0.0.0-stage → 0.1.1

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.
Files changed (37) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +106 -2
  3. package/cordis.patch.yml +5 -0
  4. package/icon.svg +7 -0
  5. package/lib/client.js +859 -0
  6. package/lib/index.js +854 -0
  7. package/package.json +91 -4
  8. package/src/client/ExplorerView.tsx +981 -0
  9. package/src/client/components/ExplorerContextMenu.tsx +157 -0
  10. package/src/client/components/ExplorerDeleteModal.tsx +124 -0
  11. package/src/client/components/ExplorerEmptyContextMenu.tsx +125 -0
  12. package/src/client/components/ExplorerHeader.tsx +81 -0
  13. package/src/client/components/ExplorerOptionsModal.tsx +230 -0
  14. package/src/client/components/ExplorerRow.tsx +258 -0
  15. package/src/client/components/ExplorerSearch.tsx +55 -0
  16. package/src/client/components/TreeNode.tsx +384 -0
  17. package/src/client/css-modules.d.ts +5 -0
  18. package/src/client/explorer.module.css +833 -0
  19. package/src/client/hooks/useKeyboardNav.ts +89 -0
  20. package/src/client/hooks/useLiveSync.ts +81 -0
  21. package/src/client/index.tsx +238 -0
  22. package/src/client/utils/api.ts +251 -0
  23. package/src/client/utils/conversation-draft.ts +644 -0
  24. package/src/client/utils/drag-drop.ts +209 -0
  25. package/src/client/utils/open-tab.ts +69 -0
  26. package/src/client/utils/options.ts +59 -0
  27. package/src/client/utils/vscode-theme.tsx +250 -0
  28. package/src/config.ts +11 -0
  29. package/src/fs-operations.ts +116 -0
  30. package/src/fs-search.ts +116 -0
  31. package/src/fs-tree.ts +155 -0
  32. package/src/fs-watch.ts +179 -0
  33. package/src/git-status.ts +167 -0
  34. package/src/index.ts +177 -0
  35. package/src/path-security.ts +22 -0
  36. package/src/session-path.ts +35 -0
  37. package/src/wire.ts +63 -0
package/lib/client.js ADDED
@@ -0,0 +1,859 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-explorer",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+
7
+ "use strict";var wn=Object.create;var dt=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Sn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty;var Ln=(e,n)=>{for(var o in n)dt(e,o,{get:n[o],enumerable:!0})},jt=(e,n,o,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of En(n))!kn.call(e,s)&&s!==o&&dt(e,s,{get:()=>n[s],enumerable:!(t=Cn(n,s))||t.enumerable});return e};var Nn=(e,n,o)=>(o=e!=null?wn(Sn(e)):{},jt(n||!e||!e.__esModule?dt(o,"default",{value:e,enumerable:!0}):o,e)),Dn=e=>jt(dt({},"__esModule",{value:!0}),e);var On={};Ln(On,{apply:()=>$n,inject:()=>In});module.exports=Dn(On);var ot=require("react");var y=require("react");var Rn=`.dsh-exp-container {
8
+ display: flex;
9
+ flex-direction: column;
10
+ height: 100%;
11
+ width: 100%;
12
+ background-color: var(--dsh-bg-base, #181818);
13
+ color: var(--dsh-fg-base, #cccccc);
14
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
15
+ font-size: var(--dsh-font-size, 13px);
16
+ user-select: none;
17
+ overflow: hidden;
18
+ box-sizing: border-box;
19
+ position: relative;
20
+ }
21
+
22
+ .dsh-exp-header {
23
+ display: flex;
24
+ align-items: center;
25
+ justify-content: space-between;
26
+ padding: 8px 10px;
27
+ min-height: 38px;
28
+ font-size: 11.5px;
29
+ font-weight: 600;
30
+ color: var(--dsh-fg-muted, #858585);
31
+ border-bottom: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.08));
32
+ flex-shrink: 0;
33
+ gap: 8px;
34
+ }
35
+
36
+ .dsh-exp-headerTitle {
37
+ overflow: hidden;
38
+ text-overflow: ellipsis;
39
+ white-space: nowrap;
40
+ min-width: 0;
41
+ flex: 1;
42
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
43
+ font-size: 11px;
44
+ color: var(--dsh-fg-base, #cccccc);
45
+ letter-spacing: normal;
46
+ }
47
+
48
+ .dsh-exp-headerActions {
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 3px;
52
+ flex-shrink: 0;
53
+ }
54
+
55
+ .dsh-exp-iconBtn {
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ width: 26px;
60
+ height: 26px;
61
+ border-radius: 5px;
62
+ border: none;
63
+ background: transparent;
64
+ color: inherit;
65
+ cursor: pointer;
66
+ opacity: 0.8;
67
+ transition: opacity 0.15s cubic-bezier(0.2, 0, 0, 1), background-color 0.15s cubic-bezier(0.2, 0, 0, 1), transform 0.12s ease;
68
+ }
69
+
70
+ .dsh-exp-iconBtn:hover {
71
+ opacity: 1;
72
+ background-color: var(--dsh-bg-hover, rgba(255, 255, 255, 0.1));
73
+ }
74
+
75
+ .dsh-exp-iconBtn:active {
76
+ transform: scale(0.92);
77
+ }
78
+
79
+ .dsh-exp-iconBtnActive {
80
+ background-color: var(--dsh-bg-active, rgba(255, 255, 255, 0.15));
81
+ opacity: 1;
82
+ }
83
+
84
+ .dsh-exp-searchBar {
85
+ padding: 6px 10px;
86
+ border-bottom: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.06));
87
+ background-color: var(--dsh-bg-subtle, rgba(0, 0, 0, 0.15));
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 6px;
91
+ flex-shrink: 0;
92
+ animation: searchSlide 0.16s cubic-bezier(0, 0, 0.2, 1);
93
+ }
94
+
95
+ @keyframes searchSlide {
96
+ from {
97
+ opacity: 0;
98
+ transform: translateY(-6px);
99
+ }
100
+ to {
101
+ opacity: 1;
102
+ transform: translateY(0);
103
+ }
104
+ }
105
+
106
+ .dsh-exp-searchInput {
107
+ flex: 1;
108
+ background: var(--dsh-input-bg, rgba(255, 255, 255, 0.06));
109
+ border: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.12));
110
+ border-radius: 4px;
111
+ color: inherit;
112
+ padding: 4px 8px;
113
+ font-size: 12px;
114
+ outline: none;
115
+ transition: border-color 0.15s ease;
116
+ }
117
+
118
+ .dsh-exp-searchInput:focus {
119
+ border-color: #007fd4;
120
+ }
121
+
122
+ .dsh-exp-clearSearchBtn {
123
+ background: transparent;
124
+ border: none;
125
+ color: inherit;
126
+ cursor: pointer;
127
+ opacity: 0.6;
128
+ font-size: 11px;
129
+ transition: opacity 0.12s ease;
130
+ }
131
+
132
+ .dsh-exp-clearSearchBtn:hover {
133
+ opacity: 1;
134
+ }
135
+
136
+ .dsh-exp-searchSpinner {
137
+ width: 13px;
138
+ height: 13px;
139
+ border: 2px solid rgba(255, 255, 255, 0.2);
140
+ border-top-color: #007fd4;
141
+ border-radius: 50%;
142
+ animation: searchSpin 0.6s linear infinite;
143
+ flex-shrink: 0;
144
+ }
145
+
146
+ @keyframes searchSpin {
147
+ to {
148
+ transform: rotate(360deg);
149
+ }
150
+ }
151
+
152
+ .dsh-exp-matchCountBadge {
153
+ font-size: 11px;
154
+ opacity: 0.7;
155
+ background: var(--dsh-badge-bg, rgba(255, 255, 255, 0.08));
156
+ border-radius: 3px;
157
+ padding: 1px 6px;
158
+ font-variant-numeric: tabular-nums;
159
+ white-space: nowrap;
160
+ }
161
+
162
+ .dsh-exp-treeBody {
163
+ flex: 1;
164
+ overflow-y: auto;
165
+ overflow-x: hidden;
166
+ padding: 4px 0;
167
+ outline: none;
168
+ }
169
+
170
+ .dsh-exp-row {
171
+ display: flex;
172
+ align-items: center;
173
+ height: var(--dsh-row-height, 24px);
174
+ line-height: var(--dsh-row-height, 24px);
175
+ padding-right: 8px;
176
+ cursor: pointer;
177
+ position: relative;
178
+ transition: background-color 0.12s cubic-bezier(0.2, 0, 0, 1);
179
+ }
180
+
181
+ .dsh-exp-row:hover {
182
+ background-color: var(--dsh-row-hover, rgba(255, 255, 255, 0.05));
183
+ }
184
+
185
+ .dsh-exp-rowSelected {
186
+ background-color: var(--dsh-row-selected, rgba(0, 122, 204, 0.25)) !important;
187
+ }
188
+
189
+ .dsh-exp-rowFocused {
190
+ outline: 1px solid #007fd4;
191
+ outline-offset: -1px;
192
+ }
193
+
194
+ .dsh-exp-indentGuide {
195
+ position: absolute;
196
+ top: 0;
197
+ bottom: 0;
198
+ width: 1px;
199
+ background-color: rgba(255, 255, 255, 0.06);
200
+ }
201
+
202
+ .dsh-exp-chevron {
203
+ display: inline-flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ width: var(--dsh-icon-size, 16px);
207
+ height: var(--dsh-icon-size, 16px);
208
+ margin-right: 2px;
209
+ color: inherit;
210
+ opacity: 0.6;
211
+ transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), opacity 0.15s ease;
212
+ flex-shrink: 0;
213
+ will-change: transform;
214
+ }
215
+
216
+ .dsh-exp-chevronExpanded {
217
+ transform: rotate(90deg);
218
+ }
219
+
220
+ .dsh-exp-chevronHidden {
221
+ visibility: hidden;
222
+ }
223
+
224
+ /* Motion Collapse: CSS Grid animation for silky smooth folder expanding & collapsing */
225
+ .dsh-exp-folderGroup {
226
+ display: flex;
227
+ flex-direction: column;
228
+ }
229
+
230
+ .dsh-exp-folderChildren {
231
+ display: grid;
232
+ grid-template-rows: 0fr;
233
+ transition: grid-template-rows 0.22s cubic-bezier(0.2, 0, 0, 1), opacity 0.18s ease;
234
+ opacity: 0;
235
+ overflow: hidden;
236
+ will-change: grid-template-rows, opacity;
237
+ }
238
+
239
+ .dsh-exp-folderChildrenOpen {
240
+ grid-template-rows: 1fr;
241
+ opacity: 1;
242
+ }
243
+
244
+ .dsh-exp-folderChildrenClosed {
245
+ grid-template-rows: 0fr;
246
+ opacity: 0;
247
+ pointer-events: none;
248
+ }
249
+
250
+ .dsh-exp-folderChildrenInner {
251
+ overflow: hidden;
252
+ min-height: 0;
253
+ }
254
+
255
+ .dsh-exp-iconWrap {
256
+ display: inline-flex;
257
+ align-items: center;
258
+ justify-content: center;
259
+ width: var(--dsh-icon-size, 18px);
260
+ height: var(--dsh-icon-size, 18px);
261
+ margin-right: 6px;
262
+ flex-shrink: 0;
263
+ }
264
+
265
+ .dsh-exp-label {
266
+ flex: 1;
267
+ overflow: hidden;
268
+ text-overflow: ellipsis;
269
+ white-space: nowrap;
270
+ font-size: var(--dsh-font-size, 13px);
271
+ }
272
+
273
+ .dsh-exp-labelDimmed {
274
+ opacity: 0.5;
275
+ }
276
+
277
+ .dsh-exp-gitBadge {
278
+ font-size: 10px;
279
+ font-weight: 700;
280
+ margin-left: auto;
281
+ margin-right: 4px;
282
+ padding: 1px 5px;
283
+ border-radius: 3px;
284
+ line-height: 1;
285
+ display: inline-flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ flex-shrink: 0;
289
+ letter-spacing: 0.04em;
290
+ }
291
+
292
+ .dsh-exp-gitModified {
293
+ color: #e2c08d !important;
294
+ }
295
+
296
+ .dsh-exp-gitUntracked {
297
+ color: #73c991 !important;
298
+ }
299
+
300
+ .dsh-exp-gitDeleted {
301
+ color: #e5534b !important;
302
+ }
303
+
304
+ .dsh-exp-gitBadge.dsh-exp-gitModified {
305
+ background-color: rgba(226, 192, 141, 0.18);
306
+ }
307
+
308
+ .dsh-exp-gitBadge.dsh-exp-gitUntracked {
309
+ background-color: rgba(115, 201, 145, 0.18);
310
+ }
311
+
312
+ .dsh-exp-gitBadge.dsh-exp-gitDeleted {
313
+ background-color: rgba(229, 83, 75, 0.18);
314
+ }
315
+
316
+ .dsh-exp-hoverActions {
317
+ display: none;
318
+ align-items: center;
319
+ gap: 2px;
320
+ margin-left: 4px;
321
+ flex-shrink: 0;
322
+ animation: actionsFadeIn 0.12s ease;
323
+ }
324
+
325
+ @keyframes actionsFadeIn {
326
+ from {
327
+ opacity: 0;
328
+ transform: translateX(4px);
329
+ }
330
+ to {
331
+ opacity: 1;
332
+ transform: translateX(0);
333
+ }
334
+ }
335
+
336
+ .dsh-exp-row:hover .dsh-exp-hoverActions {
337
+ display: flex;
338
+ }
339
+
340
+ .dsh-exp-actionBtn {
341
+ display: flex;
342
+ align-items: center;
343
+ justify-content: center;
344
+ width: 20px;
345
+ height: 20px;
346
+ border-radius: 3px;
347
+ border: none;
348
+ background: transparent;
349
+ color: inherit;
350
+ cursor: pointer;
351
+ opacity: 0.7;
352
+ padding: 0;
353
+ transition: opacity 0.12s ease, background-color 0.12s ease, transform 0.12s ease;
354
+ }
355
+
356
+ .dsh-exp-actionBtn:hover {
357
+ opacity: 1;
358
+ background-color: rgba(255, 255, 255, 0.15);
359
+ transform: scale(1.08);
360
+ }
361
+
362
+ .dsh-exp-actionBtn:active {
363
+ transform: scale(0.92);
364
+ }
365
+
366
+ .dsh-exp-inlineInput {
367
+ flex: 1;
368
+ background: var(--dsh-input-bg, #252526);
369
+ border: 1px solid #007fd4;
370
+ border-radius: 2px;
371
+ color: inherit;
372
+ padding: 1px 4px;
373
+ font-size: 12px;
374
+ outline: none;
375
+ height: 20px;
376
+ }
377
+
378
+ .dsh-exp-contextMenu {
379
+ position: fixed;
380
+ background: var(--dsh-menu-bg, #252526);
381
+ border: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.1));
382
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
383
+ border-radius: 6px;
384
+ padding: 4px 0;
385
+ z-index: 10000;
386
+ min-width: 180px;
387
+ font-size: 12px;
388
+ color: var(--dsh-fg-base, #cccccc);
389
+ animation: contextMenuPop 0.12s cubic-bezier(0, 0, 0.2, 1);
390
+ transform-origin: top left;
391
+ }
392
+
393
+ @keyframes contextMenuPop {
394
+ from {
395
+ opacity: 0;
396
+ transform: scale(0.96) translateY(-4px);
397
+ }
398
+ to {
399
+ opacity: 1;
400
+ transform: scale(1) translateY(0);
401
+ }
402
+ }
403
+
404
+ .dsh-exp-menuItem {
405
+ display: flex;
406
+ align-items: center;
407
+ justify-content: space-between;
408
+ padding: 5px 12px;
409
+ cursor: pointer;
410
+ transition: background-color 0.1s ease;
411
+ }
412
+
413
+ .dsh-exp-menuItem:hover {
414
+ background-color: var(--dsh-menu-hover, #094771);
415
+ color: #ffffff;
416
+ }
417
+
418
+ .dsh-exp-menuDivider {
419
+ height: 1px;
420
+ background-color: var(--dsh-border, rgba(255, 255, 255, 0.08));
421
+ margin: 4px 0;
422
+ }
423
+
424
+ .dsh-exp-menuShortcut {
425
+ font-size: 10px;
426
+ opacity: 0.6;
427
+ margin-left: 16px;
428
+ }
429
+
430
+ .dsh-exp-emptyState {
431
+ padding: 24px 16px;
432
+ text-align: center;
433
+ opacity: 0.6;
434
+ font-size: 12px;
435
+ }
436
+
437
+ /* Motion disable override */
438
+ .dsh-exp-noMotion,
439
+ .dsh-exp-noMotion * {
440
+ transition: none !important;
441
+ animation: none !important;
442
+ }
443
+
444
+ .dsh-exp-noMotion .dsh-exp-chevron,
445
+ .dsh-exp-noMotion .dsh-exp-folderChildren,
446
+ .dsh-exp-noMotion .dsh-exp-actionBtn,
447
+ .dsh-exp-noMotion .dsh-exp-hoverActions,
448
+ .dsh-exp-noMotion .dsh-exp-optionsPopover,
449
+ .dsh-exp-noMotion .dsh-exp-contextMenu {
450
+ transition: none !important;
451
+ animation: none !important;
452
+ }
453
+
454
+ /* Options Popover */
455
+ .dsh-exp-optionsPopover {
456
+ position: absolute;
457
+ top: 36px;
458
+ right: 8px;
459
+ width: 280px;
460
+ max-width: calc(100% - 16px);
461
+ max-height: calc(100% - 48px);
462
+ background-color: var(--dsh-bg-elevated, #202020);
463
+ border: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.14));
464
+ border-radius: 6px;
465
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
466
+ display: flex;
467
+ flex-direction: column;
468
+ z-index: 1000;
469
+ overflow: hidden;
470
+ animation: popoverFadeIn 0.15s cubic-bezier(0, 0, 0.2, 1);
471
+ }
472
+
473
+ @keyframes popoverFadeIn {
474
+ from {
475
+ opacity: 0;
476
+ transform: translateY(-6px) scale(0.97);
477
+ }
478
+ to {
479
+ opacity: 1;
480
+ transform: translateY(0) scale(1);
481
+ }
482
+ }
483
+
484
+ .dsh-exp-optionsHeader {
485
+ display: flex;
486
+ align-items: center;
487
+ justify-content: space-between;
488
+ padding: 8px 12px;
489
+ background-color: rgba(0, 0, 0, 0.25);
490
+ border-bottom: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.08));
491
+ }
492
+
493
+ .dsh-exp-optionsHeaderTitle {
494
+ display: flex;
495
+ align-items: center;
496
+ font-size: 11px;
497
+ font-weight: 700;
498
+ letter-spacing: 0.05em;
499
+ color: var(--dsh-fg-muted, #999999);
500
+ }
501
+
502
+ .dsh-exp-optionsIconBtn {
503
+ background: transparent;
504
+ border: none;
505
+ color: inherit;
506
+ opacity: 0.7;
507
+ cursor: pointer;
508
+ display: flex;
509
+ align-items: center;
510
+ justify-content: center;
511
+ padding: 3px;
512
+ border-radius: 3px;
513
+ transition: opacity 0.15s ease, background-color 0.15s ease;
514
+ }
515
+
516
+ .dsh-exp-optionsIconBtn:hover {
517
+ opacity: 1;
518
+ background-color: rgba(255, 255, 255, 0.1);
519
+ }
520
+
521
+ .dsh-exp-optionsBody {
522
+ overflow-y: auto;
523
+ padding: 10px 12px;
524
+ display: flex;
525
+ flex-direction: column;
526
+ gap: 14px;
527
+ }
528
+
529
+ .dsh-exp-optionsSection {
530
+ display: flex;
531
+ flex-direction: column;
532
+ gap: 6px;
533
+ }
534
+
535
+ .dsh-exp-optionsSectionTitle {
536
+ font-size: 10.5px;
537
+ font-weight: 700;
538
+ text-transform: uppercase;
539
+ letter-spacing: 0.04em;
540
+ color: var(--dsh-fg-muted, #858585);
541
+ margin-bottom: 2px;
542
+ }
543
+
544
+ .dsh-exp-optionsRow {
545
+ display: flex;
546
+ align-items: center;
547
+ justify-content: space-between;
548
+ gap: 8px;
549
+ }
550
+
551
+ .dsh-exp-optionsLabelWrap {
552
+ display: flex;
553
+ flex-direction: column;
554
+ gap: 1px;
555
+ }
556
+
557
+ .dsh-exp-optionsLabel {
558
+ font-size: 12px;
559
+ font-weight: 500;
560
+ color: var(--dsh-fg-base, #cccccc);
561
+ }
562
+
563
+ .dsh-exp-optionsSubLabel {
564
+ font-size: 10.5px;
565
+ color: var(--dsh-fg-muted, #808080);
566
+ }
567
+
568
+ .dsh-exp-optionsBadge {
569
+ font-size: 11px;
570
+ font-weight: 600;
571
+ padding: 1px 6px;
572
+ border-radius: 3px;
573
+ background-color: rgba(255, 255, 255, 0.08);
574
+ color: var(--dsh-fg-base, #cccccc);
575
+ font-family: monospace;
576
+ }
577
+
578
+ .dsh-exp-optionsMiniBtn {
579
+ background: rgba(255, 255, 255, 0.08);
580
+ border: none;
581
+ color: inherit;
582
+ font-size: 10px;
583
+ padding: 1px 5px;
584
+ border-radius: 3px;
585
+ cursor: pointer;
586
+ opacity: 0.8;
587
+ transition: opacity 0.12s ease;
588
+ }
589
+
590
+ .dsh-exp-optionsMiniBtn:hover {
591
+ opacity: 1;
592
+ background: rgba(255, 255, 255, 0.16);
593
+ }
594
+
595
+ .dsh-exp-optionsSlider {
596
+ width: 100%;
597
+ accent-color: #007fd4;
598
+ cursor: pointer;
599
+ margin-top: 4px;
600
+ height: 4px;
601
+ }
602
+
603
+ .dsh-exp-segmentGroup {
604
+ display: flex;
605
+ background: rgba(0, 0, 0, 0.25);
606
+ border-radius: 4px;
607
+ padding: 2px;
608
+ gap: 2px;
609
+ border: 1px solid rgba(255, 255, 255, 0.06);
610
+ }
611
+
612
+ .dsh-exp-segmentBtn {
613
+ flex: 1;
614
+ border: none;
615
+ background: transparent;
616
+ color: inherit;
617
+ padding: 4px 6px;
618
+ font-size: 11px;
619
+ border-radius: 3px;
620
+ cursor: pointer;
621
+ text-align: center;
622
+ opacity: 0.75;
623
+ transition: all 0.15s ease;
624
+ }
625
+
626
+ .dsh-exp-segmentBtn:hover {
627
+ opacity: 1;
628
+ background: rgba(255, 255, 255, 0.06);
629
+ }
630
+
631
+ .dsh-exp-segmentBtnActive {
632
+ background: var(--dsh-bg-active, #007fd4) !important;
633
+ color: #ffffff !important;
634
+ opacity: 1;
635
+ font-weight: 600;
636
+ }
637
+
638
+ .dsh-exp-switch {
639
+ position: relative;
640
+ width: 32px;
641
+ height: 18px;
642
+ border-radius: 9px;
643
+ background: rgba(255, 255, 255, 0.16);
644
+ cursor: pointer;
645
+ transition: background 0.2s ease;
646
+ flex-shrink: 0;
647
+ }
648
+
649
+ .dsh-exp-switchActive {
650
+ background: #007fd4;
651
+ }
652
+
653
+ .dsh-exp-switchKnob {
654
+ position: absolute;
655
+ top: 2px;
656
+ left: 2px;
657
+ width: 14px;
658
+ height: 14px;
659
+ border-radius: 50%;
660
+ background: #ffffff;
661
+ transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
662
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
663
+ }
664
+
665
+ .dsh-exp-switchKnobActive {
666
+ transform: translateX(14px);
667
+ }
668
+
669
+ .dsh-exp-modalOverlay {
670
+ position: absolute;
671
+ inset: 0;
672
+ background-color: rgba(0, 0, 0, 0.65);
673
+ backdrop-filter: blur(2px);
674
+ display: flex;
675
+ align-items: center;
676
+ justify-content: center;
677
+ z-index: 1200;
678
+ padding: 16px;
679
+ animation: modalFadeIn 0.15s cubic-bezier(0, 0, 0.2, 1);
680
+ }
681
+
682
+ @keyframes modalFadeIn {
683
+ from {
684
+ opacity: 0;
685
+ }
686
+ to {
687
+ opacity: 1;
688
+ }
689
+ }
690
+
691
+ .dsh-exp-modalCard {
692
+ background-color: var(--dsh-bg-elevated, #202020);
693
+ border: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.14));
694
+ border-radius: 8px;
695
+ width: 100%;
696
+ max-width: 320px;
697
+ box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.45);
698
+ overflow: hidden;
699
+ display: flex;
700
+ flex-direction: column;
701
+ animation: modalCardScale 0.16s cubic-bezier(0.16, 1, 0.3, 1);
702
+ }
703
+
704
+ @keyframes modalCardScale {
705
+ from {
706
+ opacity: 0;
707
+ transform: scale(0.95) translateY(-4px);
708
+ }
709
+ to {
710
+ opacity: 1;
711
+ transform: scale(1) translateY(0);
712
+ }
713
+ }
714
+
715
+ .dsh-exp-modalHeader {
716
+ display: flex;
717
+ align-items: center;
718
+ justify-content: space-between;
719
+ padding: 10px 14px;
720
+ background-color: rgba(0, 0, 0, 0.25);
721
+ border-bottom: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.08));
722
+ }
723
+
724
+ .dsh-exp-modalTitleWrap {
725
+ display: flex;
726
+ align-items: center;
727
+ gap: 7px;
728
+ font-size: 12px;
729
+ font-weight: 600;
730
+ color: #ff5252;
731
+ letter-spacing: 0.02em;
732
+ }
733
+
734
+ .dsh-exp-modalBody {
735
+ padding: 14px;
736
+ display: flex;
737
+ flex-direction: column;
738
+ gap: 10px;
739
+ font-size: 12px;
740
+ color: var(--dsh-fg-base, #cccccc);
741
+ line-height: 1.45;
742
+ }
743
+
744
+ .dsh-exp-modalItemPreview {
745
+ display: flex;
746
+ align-items: center;
747
+ gap: 8px;
748
+ padding: 8px 10px;
749
+ background-color: rgba(0, 0, 0, 0.25);
750
+ border: 1px solid rgba(255, 255, 255, 0.08);
751
+ border-radius: 6px;
752
+ }
753
+
754
+ .dsh-exp-modalItemInfo {
755
+ display: flex;
756
+ flex-direction: column;
757
+ gap: 2px;
758
+ min-width: 0;
759
+ flex: 1;
760
+ }
761
+
762
+ .dsh-exp-modalItemName {
763
+ font-weight: 600;
764
+ color: #ffffff;
765
+ overflow: hidden;
766
+ text-overflow: ellipsis;
767
+ white-space: nowrap;
768
+ }
769
+
770
+ .dsh-exp-modalItemPath {
771
+ font-size: 10.5px;
772
+ color: var(--dsh-fg-muted, #858585);
773
+ overflow: hidden;
774
+ text-overflow: ellipsis;
775
+ white-space: nowrap;
776
+ }
777
+
778
+ .dsh-exp-modalWarning {
779
+ font-size: 11px;
780
+ color: #e0a443;
781
+ line-height: 1.35;
782
+ }
783
+
784
+ .dsh-exp-modalErrorBanner {
785
+ padding: 6px 10px;
786
+ border-radius: 4px;
787
+ background-color: rgba(244, 67, 54, 0.15);
788
+ border: 1px solid rgba(244, 67, 54, 0.3);
789
+ color: #ff8a80;
790
+ font-size: 11.5px;
791
+ }
792
+
793
+ .dsh-exp-modalFooter {
794
+ display: flex;
795
+ align-items: center;
796
+ justify-content: flex-end;
797
+ gap: 8px;
798
+ padding: 10px 14px;
799
+ background-color: rgba(0, 0, 0, 0.2);
800
+ border-top: 1px solid var(--dsh-border, rgba(255, 255, 255, 0.06));
801
+ }
802
+
803
+ .dsh-exp-modalBtnCancel {
804
+ padding: 5px 12px;
805
+ font-size: 12px;
806
+ font-weight: 500;
807
+ border-radius: 4px;
808
+ border: 1px solid rgba(255, 255, 255, 0.15);
809
+ background: transparent;
810
+ color: var(--dsh-fg-base, #cccccc);
811
+ cursor: pointer;
812
+ transition: all 0.15s ease;
813
+ }
814
+
815
+ .dsh-exp-modalBtnCancel:hover {
816
+ background-color: rgba(255, 255, 255, 0.08);
817
+ color: #ffffff;
818
+ }
819
+
820
+ .dsh-exp-modalBtnDanger {
821
+ padding: 5px 14px;
822
+ font-size: 12px;
823
+ font-weight: 600;
824
+ border-radius: 4px;
825
+ border: none;
826
+ background-color: #d32f2f;
827
+ color: #ffffff;
828
+ cursor: pointer;
829
+ transition: background-color 0.15s ease, opacity 0.15s ease;
830
+ }
831
+
832
+ .dsh-exp-modalBtnDanger:hover {
833
+ background-color: #e53935;
834
+ }
835
+
836
+ .dsh-exp-modalBtnDanger:disabled {
837
+ opacity: 0.6;
838
+ cursor: not-allowed;
839
+ }
840
+ `;if(typeof document<"u"){let e=document.getElementById("dsh-explorer-styles");e||(e=document.createElement("style"),e.id="dsh-explorer-styles",e.textContent=Rn,document.head.appendChild(e))}var r={folderChildrenClosed:"dsh-exp-folderChildrenClosed",folderChildrenInner:"dsh-exp-folderChildrenInner",optionsSectionTitle:"dsh-exp-optionsSectionTitle",folderChildrenOpen:"dsh-exp-folderChildrenOpen",optionsHeaderTitle:"dsh-exp-optionsHeaderTitle",optionsLabelWrap:"dsh-exp-optionsLabelWrap",segmentBtnActive:"dsh-exp-segmentBtnActive",switchKnobActive:"dsh-exp-switchKnobActive",modalItemPreview:"dsh-exp-modalItemPreview",modalErrorBanner:"dsh-exp-modalErrorBanner",matchCountBadge:"dsh-exp-matchCountBadge",chevronExpanded:"dsh-exp-chevronExpanded",optionsSubLabel:"dsh-exp-optionsSubLabel",clearSearchBtn:"dsh-exp-clearSearchBtn",folderChildren:"dsh-exp-folderChildren",optionsPopover:"dsh-exp-optionsPopover",optionsIconBtn:"dsh-exp-optionsIconBtn",optionsSection:"dsh-exp-optionsSection",optionsMiniBtn:"dsh-exp-optionsMiniBtn",modalTitleWrap:"dsh-exp-modalTitleWrap",modalBtnCancel:"dsh-exp-modalBtnCancel",modalBtnDanger:"dsh-exp-modalBtnDanger",headerActions:"dsh-exp-headerActions",iconBtnActive:"dsh-exp-iconBtnActive",searchSpinner:"dsh-exp-searchSpinner",chevronHidden:"dsh-exp-chevronHidden",optionsHeader:"dsh-exp-optionsHeader",optionsSlider:"dsh-exp-optionsSlider",modalItemInfo:"dsh-exp-modalItemInfo",modalItemName:"dsh-exp-modalItemName",modalItemPath:"dsh-exp-modalItemPath",gitUntracked:"dsh-exp-gitUntracked",hoverActions:"dsh-exp-hoverActions",menuShortcut:"dsh-exp-menuShortcut",optionsLabel:"dsh-exp-optionsLabel",optionsBadge:"dsh-exp-optionsBadge",segmentGroup:"dsh-exp-segmentGroup",switchActive:"dsh-exp-switchActive",modalOverlay:"dsh-exp-modalOverlay",modalWarning:"dsh-exp-modalWarning",headerTitle:"dsh-exp-headerTitle",searchInput:"dsh-exp-searchInput",rowSelected:"dsh-exp-rowSelected",indentGuide:"dsh-exp-indentGuide",folderGroup:"dsh-exp-folderGroup",labelDimmed:"dsh-exp-labelDimmed",gitModified:"dsh-exp-gitModified",inlineInput:"dsh-exp-inlineInput",contextMenu:"dsh-exp-contextMenu",menuDivider:"dsh-exp-menuDivider",optionsBody:"dsh-exp-optionsBody",modalHeader:"dsh-exp-modalHeader",modalFooter:"dsh-exp-modalFooter",rowFocused:"dsh-exp-rowFocused",gitDeleted:"dsh-exp-gitDeleted",emptyState:"dsh-exp-emptyState",optionsRow:"dsh-exp-optionsRow",segmentBtn:"dsh-exp-segmentBtn",switchKnob:"dsh-exp-switchKnob",container:"dsh-exp-container",searchBar:"dsh-exp-searchBar",actionBtn:"dsh-exp-actionBtn",modalCard:"dsh-exp-modalCard",modalBody:"dsh-exp-modalBody",treeBody:"dsh-exp-treeBody",iconWrap:"dsh-exp-iconWrap",gitBadge:"dsh-exp-gitBadge",menuItem:"dsh-exp-menuItem",noMotion:"dsh-exp-noMotion",iconBtn:"dsh-exp-iconBtn",chevron:"dsh-exp-chevron",header:"dsh-exp-header",switch:"dsh-exp-switch",label:"dsh-exp-label",row:"dsh-exp-row"};async function et(e,n){let o=new URLSearchParams;e&&o.set("sessionId",e),n&&o.set("dir",n);let t=await fetch(`/dsh-explorer/api/tree?${o.toString()}`);if(!t.ok){let a=await t.text().catch(()=>"");throw new Error(`HTTP ${t.status}: ${a||t.statusText}`)}let s=await t.json();if(!s.ok)throw new Error(s.message||"Failed to fetch directory");return s.listing}async function ht(e){let o=await(await fetch("/dsh-explorer/api/batch-tree",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:e})})).json();if(!o.ok)throw new Error(o.message||"Failed to fetch batch trees");return o.results}async function Vt(e,n){let o=new URLSearchParams;typeof e=="object"&&e!==null?(e.dir&&o.set("dir",e.dir),e.sessionId&&o.set("sessionId",e.sessionId)):(e&&o.set("dir",e),n&&o.set("sessionId",n));let t=await fetch(`/dsh-explorer/api/git-status?${o.toString()}`);if(!t.ok)return{isRepo:!1,entries:[]};let s=await t.json();return s.ok?s.git:{isRepo:!1,entries:[]}}async function pt(e,n,o,t,s=250){let a=n.trim().toLowerCase();if(!a)return{query:n,matches:[],totalMatches:0,truncated:!1};let l=[],x=[e],h=new Set,c=new Set(["node_modules",".agent",".git","dist","target","build",".system_generated",".cache",".dsh",".gemini",".vscode",".idea"]),m=0,f=1500;for(;x.length>0&&l.length<s&&m<f&&!t?.aborted;){let v=x.shift();if(!h.has(v)){h.add(v);try{let C=await et(o,v);if(!C?.entries)continue;for(let d of C.entries){if(!d||d.name.startsWith("."))continue;m++;let u=e.replace(/\\/g,"/").replace(/\/+$/,""),E=d.path.replace(/\\/g,"/"),k=E.toLowerCase().startsWith(`${u.toLowerCase()}/`)?E.slice(u.length+1):d.path,F=d.name.toLowerCase(),X=k.toLowerCase();if((F.includes(a)||X.includes(a))&&(l.push({name:d.name,path:d.path,relativePath:k,isDir:d.isDir}),l.length>=s))break;d.isDir&&!c.has(d.name)&&x.push(d.path)}}catch{continue}}}return{query:n,matches:l,totalMatches:l.length,truncated:m>=f}}async function Wt(e,n,o,t){let s=new URLSearchParams({dir:e,q:n});o&&s.set("sessionId",o);try{let a=await fetch(`/dsh-explorer/api/search?${s.toString()}`,{signal:t});if(a.status===404||!a.ok)return pt(e,n,o,t);let l=await a.json();return!l.ok||!l.result?pt(e,n,o,t):l.result}catch(a){if(a?.name==="AbortError")throw a;return pt(e,n,o,t)}}async function ft(e){let n=new URLSearchParams({path:e}),t=await(await fetch(`/dsh-explorer/api/read-file?${n.toString()}`)).json();if(!t.ok)throw new Error(t.message||"Failed to read file");return t.text}async function Kt(e,n){let t=await(await fetch("/dsh-explorer/api/new-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e,name:n})})).json();if(!t.ok)throw new Error(t.message||"Failed to create file");return t}async function Gt(e,n){let t=await(await fetch("/dsh-explorer/api/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:e,name:n})})).json();if(!t.ok)throw new Error(t.message||"Failed to create folder");return t}async function Ut(e,n){let t=await(await fetch("/dsh-explorer/api/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,newName:n})})).json();if(!t.ok)throw new Error(t.message||"Failed to rename");return t}async function qt(e){let o=await(await fetch("/dsh-explorer/api/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})).json();if(!o.ok)throw new Error(o.message||"Failed to delete")}var $=require("react/jsx-runtime"),Zt=({title:e,searchOpen:n,optionsOpen:o,onToggleSearch:t,onToggleOptions:s,onNewFile:a,onNewFolder:l,onRefresh:x,onExpandAll:h,onCollapseAll:c})=>(0,$.jsxs)("div",{className:r.header,children:[(0,$.jsx)("span",{className:r.headerTitle,title:e,children:e}),(0,$.jsxs)("div",{className:r.headerActions,children:[(0,$.jsx)("button",{className:`${r.iconBtn} ${n?r.iconBtnActive:""}`,title:"Search files and folders",onClick:t,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"})})}),(0,$.jsx)("button",{className:r.iconBtn,title:"New File",onClick:a,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M9 1H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6L9 1zm0 1.5L12.5 6H9V2.5zM8 8.5V11h1V8.5h2.5v-1H9V5H8v2.5H5.5v1H8z"})})}),(0,$.jsx)("button",{className:r.iconBtn,title:"New Folder",onClick:l,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M7 2l2 2h5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h5zm2.5 6.5H8V6H7v2.5H4.5v1H7V12h1V9.5h2.5v-1z"})})}),(0,$.jsx)("button",{className:r.iconBtn,title:"Refresh",onClick:x,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M13.65 2.35A7.958 7.958 0 0 0 8 0a8 8 0 1 0 8 8h-2a6 6 0 1 1-1.76-4.24l-2.24 2.24H16V0l-2.35 2.35z"})})}),(0,$.jsx)("button",{className:r.iconBtn,title:"Expand All",onClick:h,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M4.646 5.854a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8 3.207 5.354 5.854a.5.5 0 0 1-.708 0zm0 4.292a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8 12.793l-2.646-2.647a.5.5 0 0 0-.708 0z"})})}),(0,$.jsx)("button",{className:r.iconBtn,title:"Collapse All",onClick:c,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M4.646 2.854a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8 5.293 5.354 2.854a.5.5 0 0 0-.708 0zm0 10.292a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8 10.707l-2.646 2.647a.5.5 0 0 1-.708 0z"})})}),(0,$.jsx)("button",{className:`${r.iconBtn} ${o?r.iconBtnActive:""}`,title:"Explorer display preferences",onClick:s,children:(0,$.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,$.jsx)("path",{d:"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"})})})]})]});var ut=require("react");var $e=require("react/jsx-runtime"),Xt=({value:e,loading:n=!1,matchCount:o=null,onChange:t,onClose:s})=>{let a=(0,ut.useRef)(null);(0,ut.useEffect)(()=>{a.current?.focus()},[]);let l=x=>{x.key==="Escape"&&s()};return(0,$e.jsxs)("div",{className:r.searchBar,children:[(0,$e.jsx)("input",{ref:a,type:"text",className:r.searchInput,placeholder:"Search files and folders by name...",value:e,onChange:x=>t(x.target.value),onKeyDown:l}),n&&(0,$e.jsx)("div",{className:r.searchSpinner,title:"Searching workspace..."}),!n&&o!==null&&e.trim()!==""&&(0,$e.jsx)("span",{className:r.matchCountBadge,title:`${o} matches found`,children:o}),e&&(0,$e.jsx)("button",{className:r.clearSearchBtn,title:"Clear search (Esc)",onClick:()=>t(""),children:"\u2715"})]})};var mt=require("react");var R=require("react/jsx-runtime"),_t=({x:e,y:n,entry:o,relativePath:t,onClose:s,onOpenFile:a,onInsertReference:l,onInsertSnippet:x,onCopyPath:h,onCopyRelativePath:c,onNewFile:m,onNewFolder:f,onRename:v,onDelete:C})=>{let d=(0,mt.useRef)(null);(0,mt.useEffect)(()=>{let k=F=>{d.current&&!d.current.contains(F.target)&&s()};return window.addEventListener("mousedown",k),()=>window.removeEventListener("mousedown",k)},[s]);let u=Math.min(n,window.innerHeight-260),E=Math.min(e,window.innerWidth-200);return(0,R.jsxs)("div",{ref:d,className:r.contextMenu,style:{top:u,left:E},children:[!o.isDir&&a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("div",{className:r.menuItem,onClick:()=>{a(),s()},children:[(0,R.jsx)("span",{children:"Open in New Tab"}),(0,R.jsx)("span",{className:r.menuShortcut,children:"Double-Click"})]}),(0,R.jsx)("div",{className:r.menuDivider})]}),(0,R.jsxs)("div",{className:r.menuItem,onClick:()=>{l(),s()},children:[(0,R.jsx)("span",{children:"Insert Mention to Chat"}),(0,R.jsx)("span",{className:r.menuShortcut,children:"@"})]}),!o.isDir&&(0,R.jsxs)("div",{className:r.menuItem,onClick:()=>{x(),s()},children:[(0,R.jsx)("span",{children:"Insert Code to Chat"}),(0,R.jsx)("span",{className:r.menuShortcut,children:"Alt+Drop"})]}),(0,R.jsx)("div",{className:r.menuDivider}),o.isDir&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("div",{className:r.menuItem,onClick:()=>{m(),s()},children:(0,R.jsx)("span",{children:"New File..."})}),(0,R.jsx)("div",{className:r.menuItem,onClick:()=>{f(),s()},children:(0,R.jsx)("span",{children:"New Folder..."})}),(0,R.jsx)("div",{className:r.menuDivider})]}),(0,R.jsx)("div",{className:r.menuItem,onClick:()=>{c(),s()},children:(0,R.jsx)("span",{children:"Copy Relative Path"})}),(0,R.jsx)("div",{className:r.menuItem,onClick:()=>{h(),s()},children:(0,R.jsx)("span",{children:"Copy Path"})}),(0,R.jsx)("div",{className:r.menuDivider}),(0,R.jsxs)("div",{className:r.menuItem,onClick:()=>{v(),s()},children:[(0,R.jsx)("span",{children:"Rename..."}),(0,R.jsx)("span",{className:r.menuShortcut,children:"F2"})]}),(0,R.jsxs)("div",{className:r.menuItem,onClick:()=>{C(),s()},children:[(0,R.jsx)("span",{style:{color:"#f44336"},children:"Delete"}),(0,R.jsx)("span",{className:r.menuShortcut,children:"Del"})]})]})};var gt=require("react");var G=require("react/jsx-runtime"),Yt=({x:e,y:n,onClose:o,onNewFile:t,onNewFolder:s,onToggleSearch:a,onExpandAll:l,onCollapseAll:x,onRefresh:h,onOpenOptions:c})=>{let m=(0,gt.useRef)(null);(0,gt.useEffect)(()=>{let C=u=>{m.current&&!m.current.contains(u.target)&&o()},d=u=>{u.key==="Escape"&&o()};return window.addEventListener("mousedown",C),window.addEventListener("keydown",d),()=>{window.removeEventListener("mousedown",C),window.removeEventListener("keydown",d)}},[o]);let f=Math.min(n,window.innerHeight-250),v=Math.min(e,window.innerWidth-200);return(0,G.jsxs)("div",{ref:m,className:r.contextMenu,style:{top:f,left:v},children:[(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{t(),o()},children:(0,G.jsx)("span",{children:"New File..."})}),(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{s(),o()},children:(0,G.jsx)("span",{children:"New Folder..."})}),(0,G.jsx)("div",{className:r.menuDivider}),(0,G.jsxs)("div",{className:r.menuItem,onClick:()=>{a(),o()},children:[(0,G.jsx)("span",{children:"Search Files..."}),(0,G.jsx)("span",{className:r.menuShortcut,children:"Ctrl+F"})]}),(0,G.jsx)("div",{className:r.menuDivider}),(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{l(),o()},children:(0,G.jsx)("span",{children:"Expand All"})}),(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{x(),o()},children:(0,G.jsx)("span",{children:"Collapse All"})}),(0,G.jsx)("div",{className:r.menuDivider}),(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{h(),o()},children:(0,G.jsx)("span",{children:"Refresh"})}),(0,G.jsx)("div",{className:r.menuDivider}),(0,G.jsx)("div",{className:r.menuItem,onClick:()=>{c(),o()},children:(0,G.jsx)("span",{children:"Display Preferences..."})})]})};var xt=require("react");var g=require("react/jsx-runtime"),Jt=({options:e,onChange:n,onReset:o,onClose:t})=>{let s=(0,xt.useRef)(null);(0,xt.useEffect)(()=>{let h=m=>{s.current&&!s.current.contains(m.target)&&t()},c=m=>{m.key==="Escape"&&t()};return document.addEventListener("mousedown",h,!0),document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("mousedown",h,!0),document.removeEventListener("keydown",c,!0)}},[t]);let a=h=>{n({density:h})},l=h=>{let c=parseFloat(h.target.value);Number.isNaN(c)||n({scale:Math.round(c*100)/100})},x=h=>{n({singleClickAction:h})};return(0,g.jsxs)("div",{ref:s,className:r.optionsPopover,children:[(0,g.jsxs)("div",{className:r.optionsHeader,children:[(0,g.jsxs)("div",{className:r.optionsHeaderTitle,children:[(0,g.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"currentColor",style:{marginRight:"6px"},children:(0,g.jsx)("path",{d:"M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z"})}),"EXPLORER OPTIONS"]}),(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,g.jsx)("button",{className:r.optionsIconBtn,title:"Reset to defaults",onClick:o,children:(0,g.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:(0,g.jsx)("path",{d:"M13.65 2.35A7.958 7.958 0 0 0 8 0a8 8 0 1 0 8 8h-2a6 6 0 1 1-1.76-4.24l-2.24 2.24H16V0l-2.35 2.35z"})})}),(0,g.jsx)("button",{className:r.optionsIconBtn,title:"Close",onClick:t,children:(0,g.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:(0,g.jsx)("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})})})]})]}),(0,g.jsxs)("div",{className:r.optionsBody,children:[(0,g.jsxs)("div",{className:r.optionsSection,children:[(0,g.jsx)("div",{className:r.optionsSectionTitle,children:"Scale & Density"}),(0,g.jsxs)("div",{className:r.segmentGroup,children:[(0,g.jsx)("button",{type:"button",className:`${r.segmentBtn} ${e.density==="compact"?r.segmentBtnActive:""}`,onClick:()=>a("compact"),children:"Compact"}),(0,g.jsx)("button",{type:"button",className:`${r.segmentBtn} ${e.density==="normal"?r.segmentBtnActive:""}`,onClick:()=>a("normal"),children:"Normal"}),(0,g.jsx)("button",{type:"button",className:`${r.segmentBtn} ${e.density==="relaxed"?r.segmentBtnActive:""}`,onClick:()=>a("relaxed"),children:"Relaxed"})]}),(0,g.jsxs)("div",{className:r.optionsRow,style:{marginTop:"6px"},children:[(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"Zoom Scale"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Resize tree text and icons"})]}),(0,g.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,g.jsxs)("span",{className:r.optionsBadge,children:[Math.round(e.scale*100),"%"]}),e.scale!==1&&(0,g.jsx)("button",{type:"button",className:r.optionsMiniBtn,title:"Reset scale to 100%",onClick:()=>n({scale:1}),children:"1x"})]})]}),(0,g.jsx)("input",{type:"range",min:"0.75",max:"1.35",step:"0.05",value:e.scale,onChange:l,className:r.optionsSlider})]}),(0,g.jsxs)("div",{className:r.optionsSection,children:[(0,g.jsx)("div",{className:r.optionsSectionTitle,children:"Motion & Transitions"}),(0,g.jsxs)("div",{className:r.optionsRow,children:[(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"Smooth Animations"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Fluid folder collapse & icon turns"})]}),(0,g.jsx)("div",{className:`${r.switch} ${e.enableMotion?r.switchActive:""}`,onClick:()=>n({enableMotion:!e.enableMotion}),role:"switch","aria-checked":e.enableMotion,children:(0,g.jsx)("div",{className:`${r.switchKnob} ${e.enableMotion?r.switchKnobActive:""}`})})]})]}),(0,g.jsxs)("div",{className:r.optionsSection,children:[(0,g.jsx)("div",{className:r.optionsSectionTitle,children:"Workspace View"}),(0,g.jsxs)("div",{className:r.optionsRow,children:[(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"Show Hidden Files"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Include dotfiles and config directories"})]}),(0,g.jsx)("div",{className:`${r.switch} ${e.showHiddenFiles?r.switchActive:""}`,onClick:()=>n({showHiddenFiles:!e.showHiddenFiles}),role:"switch","aria-checked":e.showHiddenFiles,children:(0,g.jsx)("div",{className:`${r.switchKnob} ${e.showHiddenFiles?r.switchKnobActive:""}`})})]}),(0,g.jsxs)("div",{className:r.optionsRow,children:[(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"Git Status Indicators"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Highlight modified & untracked files"})]}),(0,g.jsx)("div",{className:`${r.switch} ${e.showGitBadges?r.switchActive:""}`,onClick:()=>n({showGitBadges:!e.showGitBadges}),role:"switch","aria-checked":e.showGitBadges,children:(0,g.jsx)("div",{className:`${r.switchKnob} ${e.showGitBadges?r.switchKnobActive:""}`})})]}),(0,g.jsxs)("div",{className:r.optionsRow,children:[(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"Compact Folders"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Chain single-child directory paths"})]}),(0,g.jsx)("div",{className:`${r.switch} ${e.compactFolders?r.switchActive:""}`,onClick:()=>n({compactFolders:!e.compactFolders}),role:"switch","aria-checked":e.compactFolders,children:(0,g.jsx)("div",{className:`${r.switchKnob} ${e.compactFolders?r.switchKnobActive:""}`})})]})]}),(0,g.jsxs)("div",{className:r.optionsSection,children:[(0,g.jsx)("div",{className:r.optionsSectionTitle,children:"Interaction"}),(0,g.jsx)("div",{className:r.optionsRow,children:(0,g.jsxs)("div",{className:r.optionsLabelWrap,children:[(0,g.jsx)("span",{className:r.optionsLabel,children:"File Click Behavior"}),(0,g.jsx)("span",{className:r.optionsSubLabel,children:"Direct action when clicking a file"})]})}),(0,g.jsxs)("div",{className:r.segmentGroup,style:{marginTop:"4px"},children:[(0,g.jsx)("button",{type:"button",className:`${r.segmentBtn} ${e.singleClickAction==="select"?r.segmentBtnActive:""}`,onClick:()=>x("select"),children:"Select / Focus"}),(0,g.jsx)("button",{type:"button",className:`${r.segmentBtn} ${e.singleClickAction==="mention"?r.segmentBtnActive:""}`,onClick:()=>x("mention"),children:"Insert @Mention"})]})]})]})]})};var Te=require("react");var w=require("react/jsx-runtime");function Qt(e){let n=e.lastIndexOf(".");return n<=0?"":e.slice(n+1).toLowerCase()}function Mn(e,n){if(n)return"#dcb67a";let o=Qt(e),t=e.toLowerCase();if(t==="dockerfile"||t.startsWith("dockerfile."))return"#2496ed";if(t===".gitignore"||t===".gitattributes")return"#f14e32";if(t==="package.json")return"#cb3837";if(t.startsWith(".env"))return"#ecd53f";switch(o){case"ts":case"mts":case"cts":return"#3178c6";case"tsx":return"#3178c6";case"js":case"mjs":case"cjs":return"#f7df1e";case"jsx":return"#00d8ff";case"py":case"pyw":return"#3572a5";case"rs":return"#dea584";case"go":return"#00add8";case"c":case"h":return"#a8b9cc";case"cpp":case"cc":case"cxx":case"hpp":return"#00599c";case"cs":return"#178600";case"java":case"jar":return"#b07219";case"kt":case"kts":return"#a97bff";case"swift":return"#f05138";case"php":return"#777bb4";case"rb":return"#cc342d";case"html":case"htm":return"#e34c26";case"css":return"#42a5f5";case"scss":case"sass":return"#cd6799";case"less":return"#1d365d";case"json":case"jsonc":case"json5":return"#cbcb41";case"yaml":case"yml":return"#cb171e";case"toml":return"#9c4221";case"md":case"markdown":case"mdx":return"#519aba";case"sql":return"#e38c00";case"sh":case"bash":case"zsh":return"#89e051";case"ps1":case"psm1":return"#012456";case"svg":return"#ff9800";case"png":case"jpg":case"jpeg":case"gif":case"webp":case"ico":return"#ab47bc";case"zip":case"tar":case"gz":case"7z":case"rar":return"#ec407a";default:return"#90a4ae"}}function vt(e,n,o=!1,t=16){if(n){let h=o?"#e5c07b":"#dcb67a";return o?(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("path",{d:"M1.5 2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H6.29289C6.5581 1.5 6.81249 1.60536 7 1.79289L8.20711 3H13.5C14.0523 3 14.5 3.44772 14.5 4V5H2.5L1.5 2.5Z",fill:h,opacity:"0.8"}),(0,w.jsx)("path",{d:"M1.5 5.5H14.5L13.5 13.5C13.5 14.0523 13.0523 14.5 12.5 14.5H3.5C2.94772 14.5 2.5 14.0523 2.5 13.5L1.5 5.5Z",fill:h}),(0,w.jsx)("path",{d:"M1.5 5.5L2.8 14H13.2L14.5 5.5H1.5Z",fill:"#ffe082",fillOpacity:"0.25"})]}):(0,w.jsx)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:(0,w.jsx)("path",{d:"M1.5 2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H6.29289C6.5581 1.5 6.81249 1.60536 7 1.79289L8.20711 3H13.5C14.0523 3 14.5 3.44772 14.5 4V13.5C14.5 14.0523 14.0523 14.5 13.5 14.5H2.5C1.94772 14.5 1.5 14.0523 1.5 13.5V2.5Z",fill:h})})}let s=Qt(e),a=e.toLowerCase(),l=Mn(e,!1);if(s==="ts")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{width:"16",height:"16",rx:"2.5",fill:"#3178c6"}),(0,w.jsx)("text",{x:"3",y:"12",fill:"#ffffff",fontSize:"9.5",fontWeight:"bold",fontFamily:"monospace",children:"TS"})]});if(s==="tsx")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{width:"16",height:"16",rx:"2.5",fill:"#3178c6"}),(0,w.jsx)("circle",{cx:"8",cy:"8",r:"2",fill:"#00d8ff"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none",transform:"rotate(60 8 8)"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none",transform:"rotate(120 8 8)"})]});if(s==="js"||s==="mjs"||s==="cjs")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{width:"16",height:"16",rx:"2.5",fill:"#f7df1e"}),(0,w.jsx)("text",{x:"3.5",y:"12",fill:"#000000",fontSize:"9.5",fontWeight:"bold",fontFamily:"monospace",children:"JS"})]});if(s==="jsx")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{width:"16",height:"16",rx:"2.5",fill:"#20232a"}),(0,w.jsx)("circle",{cx:"8",cy:"8",r:"2",fill:"#00d8ff"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none",transform:"rotate(60 8 8)"}),(0,w.jsx)("ellipse",{cx:"8",cy:"8",rx:"5",ry:"2.2",stroke:"#00d8ff",strokeWidth:"0.9",fill:"none",transform:"rotate(120 8 8)"})]});if(s==="py")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("path",{d:"M7.9 1.5C5.2 1.5 5.3 2.7 5.3 2.7V4H8V4.4H3.8C2.5 4.4 1.5 5.5 1.5 7.2C1.5 8.9 2.3 9.4 3.3 9.4H4.3V8.1C4.3 6.6 5.5 5.5 7 5.5H9.6C10.5 5.5 11.2 4.8 11.2 3.9V2.7C11.2 1.8 10.3 1.5 7.9 1.5ZM6.5 2.6C6.9 2.6 7.2 2.9 7.2 3.3C7.2 3.7 6.9 4 6.5 4C6.1 4 5.8 3.7 5.8 3.3C5.8 2.9 6.1 2.6 6.5 2.6Z",fill:"#3572a5"}),(0,w.jsx)("path",{d:"M8.1 14.5C10.8 14.5 10.7 13.3 10.7 13.3V12H8V11.6H12.2C13.5 11.6 14.5 10.5 14.5 8.8C14.5 7.1 13.7 6.6 12.7 6.6H11.7V7.9C11.7 9.4 10.5 10.5 9 10.5H6.4C5.5 10.5 4.8 11.2 4.8 12.1V13.3C4.8 14.2 5.7 14.5 8.1 14.5ZM9.5 13.4C9.1 13.4 8.8 13.1 8.8 12.7C8.8 12.3 9.1 12 9.5 12C9.9 12 10.2 12.3 10.2 12.7C10.2 13.1 9.9 13.4 9.5 13.4Z",fill:"#ffd43b"})]});if(s==="rs")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("circle",{cx:"8",cy:"8",r:"6.5",stroke:"#dea584",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,w.jsx)("path",{d:"M5.5 5H9C9.8 5 10.5 5.5 10.5 6.3C10.5 7 10 7.6 9.3 7.8L10.8 11H9.3L8 8.2H7V11H5.5V5ZM7 7.1H8.8C9.2 7.1 9.5 6.8 9.5 6.4C9.5 6 9.2 5.8 8.8 5.8H7V7.1Z",fill:"#dea584"})]});if(s==="go")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{width:"16",height:"16",rx:"2.5",fill:"#00add8"}),(0,w.jsx)("text",{x:"2",y:"11.5",fill:"#ffffff",fontSize:"8",fontWeight:"bold",fontFamily:"sans-serif",children:"GO"})]});if(s==="json")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("path",{d:"M2.5 2C2.5 1.44772 2.94772 1 3.5 1H10L14 5V14C14 14.5523 13.5523 15 13 15H3.5C2.94772 15 2.5 14.5523 2.5 14V2Z",fill:"#2d3748"}),(0,w.jsx)("text",{x:"4",y:"11",fill:"#cbcb41",fontSize:"9",fontWeight:"bold",fontFamily:"monospace",children:"{}"})]});if(s==="md"||s==="markdown")return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("rect",{x:"1",y:"3",width:"14",height:"10",rx:"1.5",stroke:"#519aba",strokeWidth:"1.2",fill:"#1e1e1e"}),(0,w.jsx)("path",{d:"M3.5 10V6L5.5 8.5L7.5 6V10",stroke:"#519aba",strokeWidth:"1.1",strokeLinecap:"round",strokeLinejoin:"round"}),(0,w.jsx)("path",{d:"M11 6V10M9.5 8.5L11 10L12.5 8.5",stroke:"#519aba",strokeWidth:"1.1",strokeLinecap:"round",strokeLinejoin:"round"})]});if(a===".gitignore"||a===".gitattributes")return(0,w.jsx)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:(0,w.jsx)("path",{d:"M14.6 7.4L8.6 1.4C8.2 1 7.6 1 7.2 1.4L1.4 7.2C1 7.6 1 8.2 1.4 8.6L7.4 14.6C7.8 15 8.4 15 8.8 14.6L14.6 8.8C15 8.4 15 7.8 14.6 7.4ZM8.5 10.8V8.3C7.4 8.4 6.8 9 6.8 9.5C6.8 9.7 6.6 9.8 6.4 9.8C6.2 9.8 6 9.6 6 9.4C6 8.3 7 7.3 8.5 7.1V5.5C8.1 5.4 7.8 5 7.8 4.5C7.8 3.9 8.2 3.5 8.8 3.5C9.4 3.5 9.8 3.9 9.8 4.5C9.8 5 9.4 5.4 9.1 5.5V10.8C9.4 10.9 9.8 11.3 9.8 11.8C9.8 12.4 9.4 12.8 8.8 12.8C8.2 12.8 7.8 12.4 7.8 11.8C7.8 11.3 8.1 10.9 8.5 10.8Z",fill:"#f14e32"})});if(a==="dockerfile"||a.startsWith("dockerfile."))return(0,w.jsx)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:(0,w.jsx)("path",{d:"M14.5 7.5C14 7.5 13.5 7.8 13.2 8.2C12.4 7.7 11.2 7.7 10.5 8.2V5H8.5V7H9.5V8.5H5.5V6H3.5V8.5H2V7H1V8.5C0.4 8.8 0 9.4 0 10C0 12.2 2.5 14 6.5 14C11.5 14 14.8 11.2 15 8.5C15 8 14.8 7.5 14.5 7.5Z",fill:"#2496ed"})});let x=s.slice(0,3).toUpperCase();return(0,w.jsxs)("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",style:{flexShrink:0},children:[(0,w.jsx)("path",{d:"M3 2C3 1.44772 3.44772 1 4 1H10L14 5V14C14 14.5523 13.5523 15 13 15H4C3.44772 15 3 14.5523 3 14V2Z",fill:"#2b313c",stroke:"#3e4451",strokeWidth:"0.8"}),(0,w.jsx)("path",{d:"M10 1V5H14",fill:"#3e4451",opacity:"0.6"}),x?(0,w.jsx)("text",{x:"4",y:"11",fill:l,fontSize:"6",fontWeight:"bold",fontFamily:"monospace",children:x}):(0,w.jsx)("circle",{cx:"8",cy:"9",r:"1.8",fill:l})]})}var V=require("react/jsx-runtime"),en=({entry:e,relativePath:n,onConfirm:o,onClose:t})=>{let[s,a]=(0,Te.useState)(!1),[l,x]=(0,Te.useState)(null),h=(0,Te.useRef)(null),c=(0,Te.useRef)(null);(0,Te.useEffect)(()=>{h.current?.focus();let f=C=>{C.key==="Escape"&&(C.preventDefault(),t())},v=C=>{c.current&&!c.current.contains(C.target)&&t()};return document.addEventListener("keydown",f),document.addEventListener("mousedown",v),()=>{document.removeEventListener("keydown",f),document.removeEventListener("mousedown",v)}},[t]);let m=async()=>{if(!s){a(!0),x(null);try{await o(),t()}catch(f){x(f?.message||"Failed to delete"),a(!1)}}};return(0,V.jsx)("div",{className:r.modalOverlay,children:(0,V.jsxs)("div",{ref:c,className:r.modalCard,role:"dialog","aria-modal":"true",children:[(0,V.jsxs)("div",{className:r.modalHeader,children:[(0,V.jsxs)("div",{className:r.modalTitleWrap,children:[(0,V.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 16 16",fill:"currentColor",children:(0,V.jsx)("path",{d:"M6.5 1h3a.5.5 0 0 1 .5.5v1H14a.5.5 0 0 1 0 1h-.6l-.8 11.2A2 2 0 0 1 10.6 16H5.4a2 2 0 0 1-2-1.8L2.6 3.5H2a.5.5 0 0 1 0-1h4v-1a.5.5 0 0 1 .5-.5zM7 2v.5h2V2H7zm-2.4 12.4a1 1 0 0 0 1 .6h5.2a1 1 0 0 0 1-.9L12.4 3.5H3.6l.8 10.9h.2zm2.9-9.9a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zm3 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5z"})}),(0,V.jsx)("span",{children:e.isDir?"Delete Folder":"Delete File"})]}),(0,V.jsx)("button",{className:r.optionsIconBtn,title:"Close",onClick:t,children:(0,V.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:(0,V.jsx)("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"})})})]}),(0,V.jsxs)("div",{className:r.modalBody,children:[(0,V.jsxs)("div",{children:["Are you sure you want to permanently delete this ",e.isDir?"directory":"file","?"]}),(0,V.jsxs)("div",{className:r.modalItemPreview,children:[(0,V.jsx)("span",{className:r.iconWrap,children:vt(e.name,e.isDir,!1,16)}),(0,V.jsxs)("div",{className:r.modalItemInfo,children:[(0,V.jsx)("div",{className:r.modalItemName,children:e.name}),(0,V.jsx)("div",{className:r.modalItemPath,children:n})]})]}),e.isDir&&(0,V.jsx)("div",{className:r.modalWarning,children:"Warning: All nested files and subdirectories inside this folder will be permanently removed."}),l&&(0,V.jsx)("div",{className:r.modalErrorBanner,children:l})]}),(0,V.jsxs)("div",{className:r.modalFooter,children:[(0,V.jsx)("button",{ref:h,type:"button",className:r.modalBtnCancel,onClick:t,disabled:s,children:"Cancel"}),(0,V.jsx)("button",{type:"button",className:r.modalBtnDanger,onClick:m,disabled:s,children:s?"Deleting...":"Delete"})]})]})})};var Be=Nn(require("react"),1);var Xe=require("react");var ye="",Fe=null;function tn(e){e&&(ye=e)}function tt(e,n){try{return e?.get?e.get(n):e?.reflect?.get?e.reflect.get(n,!1):e?.[n]}catch{try{return e?.reflect?.get?.(n,!1)}catch{return}}}function yt(e,n){if(n)return ye=n,n;if(ye)return ye;try{let o=tt(e,"sessions");if(o){let t=o.list?.getSnapshot?.();if(t?.byId){for(let[a,l]of Object.entries(t.byId))if((l?.retainedBy?.mainView??0)>0)return ye=a,a;if(t.activeId)return ye=t.activeId,t.activeId;if(Array.isArray(t.ids)&&t.ids.length>0){let a=t.ids[t.ids.length-1];return ye=a,a}let s=Object.keys(t.byId);if(s.length>0){let a=s[s.length-1];return ye=a,a}}if(o.active?.id)return ye=o.active.id,o.active.id;if(o.current?.id)return ye=o.current.id,o.current.id}}catch{}return""}function Ze(){if(typeof document>"u")return null;let e=document.querySelector('[data-composer-input="true"]')??document.querySelector("[data-composer-input]");if(e)return e;let n=document.querySelector('[data-slot="conversation"]')??document.querySelector('[data-slot*="conversation"]')??document.body,o=n.querySelector('[contenteditable="true"][role="textbox"]')??n.querySelector('[contenteditable="true"]');return o||(document.querySelector("textarea[data-phase]")??document.querySelector("textarea")??document.querySelector('[contenteditable="true"]')??null)}function bt(){try{if(typeof document>"u")return;let e=Ze();if(!e)return;if(e.tagName==="TEXTAREA"||e.tagName==="INPUT"){let n=e,o=n.selectionStart,t=n.selectionEnd;typeof o=="number"&&typeof t=="number"&&Number.isFinite(o)&&Number.isFinite(t)&&(Fe={start:Math.max(0,Math.min(o,n.value.length)),end:Math.max(o,Math.min(t,n.value.length)),draft:n.value,timestamp:Date.now()})}else if(e.isContentEditable){let n=window.getSelection();if(n&&n.rangeCount>0&&n.anchorNode&&e.contains(n.anchorNode)){let o=n.getRangeAt(0);if(o&&o.startContainer&&e.contains(o.startContainer)){let t=o.startContainer.nodeType===Node.TEXT_NODE?o.startContainer.nodeValue?.length??0:o.startContainer.childNodes.length,s=Math.max(0,Math.min(o.startOffset,t)),a=o.cloneRange();a.selectNodeContents(e),a.setEnd(o.startContainer,s);let l=a.toString().length,x=o.toString().length;Fe={start:l,end:l+x,draft:e.innerText??e.textContent??"",timestamp:Date.now()}}}}}catch{}}var St=!1;function nn(){if(St||typeof document>"u")return()=>{};St=!0;let e=()=>bt();return document.addEventListener("selectionchange",e,{passive:!0}),document.addEventListener("keyup",e,{passive:!0}),document.addEventListener("mouseup",e,{passive:!0}),document.addEventListener("input",e,{passive:!0}),document.addEventListener("focusin",e,{passive:!0}),()=>{document.removeEventListener("selectionchange",e),document.removeEventListener("keyup",e),document.removeEventListener("mouseup",e),document.removeEventListener("input",e),document.removeEventListener("focusin",e),St=!1}}function Tn(e,n){if(!n||e.length===0)return n;let{start:o,end:t}=n,s=a=>!!(a&&!/[\s\r\n\t]/.test(a));if(o===t&&o>0&&o<e.length){let a=e[o-1],l=e[o];if(s(a)&&s(l)){for(;o<e.length&&s(e[o]);)o++;t=o}}return{start:o,end:t}}function kt(e,n){let o=Ze();if(o&&(o.tagName==="TEXTAREA"||o.tagName==="INPUT")){let t=o;if(!t.disabled&&!t.readOnly){let s=t.selectionStart,a=t.selectionEnd;if(typeof s=="number"&&typeof a=="number"&&Number.isFinite(s)&&Number.isFinite(a)&&(document.activeElement===t||t.value===e)){let l=Math.max(0,Math.min(s,e.length)),x=Math.max(l,Math.min(a,e.length));return Fe={start:l,end:x,draft:e,timestamp:Date.now()},{start:l,end:x}}}}if(Fe){let t=Math.max(0,Math.min(Fe.start,e.length)),s=Math.max(t,Math.min(Fe.end,e.length));return{start:t,end:s}}return null}function Lt(e,n){let o=3,t=()=>{o-=1;let s=Ze();if(s){if(s.tagName==="TEXTAREA"||s.tagName==="INPUT"){let a=s;if(a.disabled||a.readOnly)return;let l=Math.max(0,Math.min(n,a.value.length));a.focus(),a.setSelectionRange(l,l),Fe={start:l,end:l,draft:a.value,timestamp:Date.now()};return}else if(s.isContentEditable){s.focus(),Fe={start:n,end:n,draft:e,timestamp:Date.now()};return}o>0&&(typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(t,16))}};typeof requestAnimationFrame=="function"?requestAnimationFrame(t):setTimeout(t,16)}function Nt(e,n,o){let t=Tn(e,o);if(!t||e===""){let m=e.trim()===""?n:`${e}${/\s$/.test(e)?"":" "}${n}`;return{draft:m,caretAfter:m.length}}let s=e.slice(0,t.start),a=e.slice(t.end),l=s===""||/\s$/.test(s)?"":" ",x=a===""||/^\s/.test(a)||/\s$/.test(n)?"":" ",h=`${s}${l}${n}${x}${a}`,c=s.length+l.length+n.length;return{draft:h,caretAfter:c}}function Fn(e,n){let o=e.replace(/[\\/]+$/,"").replace(/\\/g,"/"),t=n?`${o}/`:o;return/\s/.test(t)?`@"${t}"`:`@${t}`}function Dt(e){let n=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return n===-1?e:e.slice(n+1)}function Oe(e,n,o,t,s){try{let a=Fn(o,t),l=Dt(o),x=t?`${l}/`:l,h=t?"folder":"file";if(s&&typeof document<"u"){let d=Ze();if(d){let u=null;if(typeof document.caretRangeFromPoint=="function")u=document.caretRangeFromPoint(s.x,s.y);else if(typeof document.caretPositionFromPoint=="function"){let E=document.caretPositionFromPoint(s.x,s.y);E&&E.offsetNode&&(u=document.createRange(),u.setStart(E.offsetNode,E.offset),u.collapse(!0))}if(u&&d.contains(u.startContainer)){let E=window.getSelection();E?.removeAllRanges(),E?.addRange(u),d.focus({preventScroll:!0})}}}let c=tt(e,"sessions"),m=yt(e,n),f=m&&c?.scope?c.scope(m):void 0,v=tt(e,"conversation");if(v&&f){let d=v.input?.for(f);if(d){if(d.draftEditor&&typeof d.draftEditor.insertFileReferences=="function")try{let E=d.rev??d.state?.getSnapshot?.()?.draftRev??0,k=d.draftEditor.insertFileReferences([{source:"reference",ref:a,label:x,appearance:h,clipboardText:a}]),F=d.rev??d.state?.getSnapshot?.()?.draftRev??0;if(k||F!==E)return d.focus?.(),!0}catch(E){console.warn("[dsh-explorer] draftEditor.insertFileReferences failed, trying actx.bail:",E)}let u=d.actions?.captureInsertion?.()??d.captureInsertion?.();if(u&&u.draftRev!==void 0){let E=d.projection?.detectText??"",k=u.start>0?E[u.start-1]??"":"";if(!k)try{let P=window.getSelection();if(P&&P.anchorNode){let we=P.anchorNode.textContent??"",J=P.anchorOffset;J>0&&(k=we[J-1]??"")}}catch{}if(!k){let P=d.state?.getSnapshot?.()?.draft??"";u.start>0&&u.start<=P.length&&(k=P[u.start-1]??"")}if(k&&!/\s/.test(k)){if(typeof d.actions?.insertText=="function")try{d.actions.insertText(" ",u)}catch{}else if(typeof d.insertText=="function")try{d.insertText(" ",u)}catch{}let P=d.actions?.captureInsertion?.()??d.captureInsertion?.();P&&P.draftRev!==void 0&&(u=P)}let F=d.rev??d.state?.getSnapshot?.()?.draftRev??0,X=!1;try{typeof f.bail=="function"&&(X=!!f.bail(f,"slash/input-insert-reference",{reference:{source:"reference",ref:a,label:x,appearance:h,clipboardText:a},span:u}))}catch{}if(!X)try{f.emit?.("slash/input-insert-reference",{reference:{source:"reference",ref:a,label:x,appearance:h,clipboardText:a},span:u})}catch{}let ve=d.rev??d.state?.getSnapshot?.()?.draftRev??0;if(X||ve!==F)return d.focus?.(),!0;let Y="";k&&!/\s/.test(k)&&(Y=" ");let le=`${Y}${a} `;if(typeof d.actions?.insertText=="function")try{if(d.actions.insertText(le,u))return d.focus?.(),!0}catch{}if(typeof d.insertText=="function")try{if(d.insertText(le,u))return d.focus?.(),!0}catch{}}}}let C=Ze();if(C){if(C.isContentEditable){C.focus();let d=!1;try{let E=window.getSelection();if(E&&E.rangeCount>0){let k=E.getRangeAt(0);if(k.startContainer.nodeType===Node.TEXT_NODE){let F=k.startContainer.textContent??"";k.startOffset>0&&!/\s/.test(F[k.startOffset-1])&&(d=!0)}else if(k.startContainer.previousSibling){let F=k.startContainer.previousSibling.textContent??"";F&&!/\s/.test(F.slice(-1))&&(d=!0)}}}catch{}let u=`${d?" ":""}${a} `;try{if(document.execCommand("insertText",!1,u))return bt(),!0}catch{}try{let E=window.getSelection();if(E&&E.rangeCount>0){let k=E.getRangeAt(0);k.deleteContents();let F=document.createTextNode(u);return k.insertNode(F),k.collapse(!1),E.removeAllRanges(),E.addRange(k),C.dispatchEvent(new Event("input",{bubbles:!0})),bt(),!0}}catch{}}if(C.tagName==="TEXTAREA"||C.tagName==="INPUT"){let d=C,u=d.value,E=kt(u,s)??{start:d.selectionStart??u.length,end:d.selectionEnd??u.length},{draft:k,caretAfter:F}=Nt(u,`${a} `,E);return d.value=k,d.dispatchEvent(new Event("input",{bubbles:!0})),Lt(k,F),!0}}if(v&&f){let d=v.input?.for(f);if(d?.setDraft){let u=d.state?.getSnapshot?.()?.draft??"",E=kt(u,s),{draft:k,caretAfter:F}=Nt(u,`${a} `,E);return d.setDraft(k),Lt(k,F),!0}}return!1}catch(a){return console.warn("[dsh-explorer] insertMentionToComposer failed:",a),!1}}function wt(e,n,o,t,s){try{let l=`
841
+ \`\`\`${o.slice(o.lastIndexOf(".")+1)||"text"} title="${o}"
842
+ ${t}
843
+ \`\`\`
844
+ `,x=yt(e,n),h=tt(e,"sessions"),c=x&&h?.scope?h.scope(x):void 0,m=tt(e,"conversation");if(m&&c){let v=m.input?.for(c);if(v){let C=v.actions?.captureInsertion?.()??v.captureInsertion?.();if(C&&C.draftRev!==void 0){if(typeof v.actions?.insertText=="function")try{if(v.actions.insertText(l,C))return v.focus?.(),!0}catch{}if(typeof v.insertText=="function")try{if(v.insertText(l,C))return v.focus?.(),!0}catch{}}}}let f=Ze();if(f){if(f.isContentEditable){f.focus();try{if(document.execCommand("insertText",!1,l))return bt(),!0}catch{}}if(f.tagName==="TEXTAREA"||f.tagName==="INPUT"){let v=f,C=v.value,d=kt(C,s)??{start:v.selectionStart??C.length,end:v.selectionEnd??C.length},{draft:u,caretAfter:E}=Nt(C,l,d);return v.value=u,v.dispatchEvent(new Event("input",{bubbles:!0})),Lt(u,E),!0}}return!1}catch(a){return console.warn("[dsh-explorer] insertSnippetToComposer failed:",a),!1}}var Rt="application/vnd.dsh.explorer-items",nt=null;function on(e,n){nt=n;let o=JSON.stringify(n);try{e.dataTransfer.setData(Rt,o)}catch{}let t=n.map(s=>s.isDir?`@${s.relativePath}/`:`@${s.relativePath}`).join(" ");try{e.dataTransfer.setData("text/plain",t)}catch{}e.dataTransfer.effectAllowed="copy"}function rn(){setTimeout(()=>{nt=null},200)}var ze=null;function Bn(e){if(ze&&document.body.contains(ze))return ze;let n=document.createElement("div");return n.style.position="absolute",n.style.inset="0",n.style.backgroundColor="rgba(33, 150, 243, 0.08)",n.style.border="2px dashed #007fd4",n.style.borderRadius="8px",n.style.zIndex="9999",n.style.pointerEvents="none",n.style.display="flex",n.style.flexDirection="column",n.style.alignItems="center",n.style.justifyContent="center",n.style.gap="8px",n.style.backdropFilter="blur(2px)",n.style.transition="opacity 0.15s cubic-bezier(0.2, 0, 0, 1)",n.innerHTML=`
845
+ <div style="font-weight: 600; font-size: 13px; color: #58a6ff; background: rgba(22, 27, 34, 0.85); border: 1px solid rgba(88, 166, 255, 0.3); padding: 8px 16px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 8px;">
846
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
847
+ <path d="M8 2a.75.75 0 0 1 .75.75v8.69l3.22-3.22a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 1 1 1.06-1.06l3.22 3.22V2.75A.75.75 0 0 1 8 2z"/>
848
+ </svg>
849
+ Drop at cursor to mention
850
+ </div>
851
+ <div style="font-size: 11px; opacity: 0.9; color: #8b949e; background: rgba(22, 27, 34, 0.7); padding: 3px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.06);">
852
+ Hold <b>Alt</b> or <b>Shift</b> to embed code snippet
853
+ </div>
854
+ `,ze=n,n}function an(e){let n=0,o=h=>{if(nt&&nt.length>0)return!0;try{let c=Array.from(h.dataTransfer?.types??[]);return c.includes(Rt)||c.includes("text/plain")}catch{return!1}},t=()=>document.querySelector('[data-slot="conversation.session"]')??document.querySelector('[data-slot="conversation.shell"]')??document.querySelector('[data-slot*="conversation"]')??document.querySelector(".an3WzG_root")??document.querySelector(".conversation-main")??document.querySelector("main")??document.querySelector("#root > div")??null,s=h=>{if(!o(h))return;let c=t();if(!c)return;n+=1;let m=Bn(c);c.contains(m)||(getComputedStyle(c).position==="static"&&(c.style.position="relative"),c.appendChild(m))},a=h=>{o(h)&&(h.preventDefault(),h.dataTransfer&&(h.dataTransfer.dropEffect="copy"))},l=h=>{o(h)&&(n-=1,n<=0&&(n=0,ze?.remove()))},x=async h=>{if(!o(h))return;h.preventDefault(),h.stopPropagation(),n=0,ze?.remove();let c=nt;if(!c||c.length===0)try{let m=h.dataTransfer?.getData(Rt);m&&(c=JSON.parse(m))}catch{}if(!c||c.length===0){let m=h.dataTransfer?.getData("text/plain");if(m&&m.startsWith("@")){let f=m.replace(/^@"?/,"").replace(/"?$/,"");c=[{path:f,relativePath:f,isDir:f.endsWith("/"),name:f}]}}if(!(!c||c.length===0))try{let m=yt(e),f=h.altKey||h.shiftKey,v={x:h.clientX,y:h.clientY};for(let C of c){if(f&&!C.isDir)try{let d=await ft(C.path);wt(e,m,C.relativePath,d,v)}catch{Oe(e,m,C.relativePath,C.isDir,v)}else Oe(e,m,C.relativePath,C.isDir,v);v=void 0,c.length>1&&await new Promise(d=>setTimeout(d,40))}}catch(m){console.warn("[dsh-explorer] drop failed:",m)}};return document.addEventListener("dragenter",s,!0),document.addEventListener("dragover",a,!0),document.addEventListener("dragleave",l,!0),document.addEventListener("drop",x,!0),()=>{document.removeEventListener("dragenter",s,!0),document.removeEventListener("dragover",a,!0),document.removeEventListener("dragleave",l,!0),document.removeEventListener("drop",x,!0),ze?.remove()}}var U=require("react/jsx-runtime"),Mt=({entry:e,depth:n,isExpanded:o,isSelected:t,isFocused:s,isRenaming:a=!1,gitStatus:l,relativePath:x,compactChain:h,indentStep:c=16,iconSize:m=16,enableMotion:f=!0,showGitBadges:v=!0,compactFolders:C=!0,singleClickAction:d="select",onToggle:u,onSelect:E,onDoubleClick:k,onContextMenu:F,onInsertReference:X,onCopyRelativePath:ve,onStartRename:Y,onCancelRename:le,onRenameSubmit:P,onDelete:we})=>{let[J,fe]=(0,Xe.useState)(e.name),ae=(0,Xe.useRef)(null);(0,Xe.useEffect)(()=>{a&&(fe(e.name),requestAnimationFrame(()=>{if(ae.current){ae.current.focus();let N=e.isDir?-1:e.name.lastIndexOf(".");N>0?ae.current.setSelectionRange(0,N):ae.current.select()}}))},[a,e.name,e.isDir]);let Ce=N=>{let se={path:e.path,relativePath:x,isDir:e.isDir,name:e.name};on(N,[se])},Le=N=>{if(N.key==="Enter"){N.stopPropagation();let se=J.trim();se&&se!==e.name?P(se):le?.()}else N.key==="Escape"&&(N.stopPropagation(),fe(e.name),le?.())},H=()=>{let N=J.trim();N&&N!==e.name?P(N):le?.()},Ae=C&&h&&h.length>1?h.map(N=>N.name).join("/"):C&&e.compactName?e.compactName:e.name,de="",Q="";l&&(l.includes("M")?(de=r.gitModified,Q="M"):l.includes("?")||l.includes("A")?(de=r.gitUntracked,Q="U"):l.includes("D")?(de=r.gitDeleted,Q="D"):l.includes("R")&&(de=r.gitModified,Q="R"));let Pe=l?.includes("!");return(0,U.jsxs)("div",{className:`${r.row} ${t?r.rowSelected:""} ${s?r.rowFocused:""}`,style:{paddingLeft:`${n*c+8}px`},onClick:N=>{a||(E(N),e.isDir?u():d==="mention"&&X())},onDoubleClick:N=>{a||e.isDir||(N.stopPropagation(),k?.())},onContextMenu:F,draggable:!a,onDragStart:Ce,onDragEnd:rn,children:[Array.from({length:n}).map((N,se)=>(0,U.jsx)("span",{className:r.indentGuide,style:{left:`${se*c+15}px`}},se)),(0,U.jsx)("span",{className:`${r.chevron} ${o?r.chevronExpanded:""} ${e.isDir?"":r.chevronHidden}`,style:f?void 0:{transition:"none"},onClick:N=>{N.stopPropagation(),u()},children:(0,U.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",children:(0,U.jsx)("path",{d:"M6 3.5L10.5 8 6 12.5V3.5Z"})})}),(0,U.jsx)("span",{className:r.iconWrap,children:vt(e.name,e.isDir,o,m)}),a?(0,U.jsx)("input",{ref:ae,type:"text",className:r.inlineInput,value:J,onChange:N=>fe(N.target.value),onKeyDown:Le,onBlur:H,onClick:N=>N.stopPropagation()}):(0,U.jsx)("span",{className:`${r.label} ${Pe?r.labelDimmed:""} ${v?de:""}`,title:x,children:Ae}),v&&Q&&(0,U.jsx)("span",{className:`${r.gitBadge} ${de}`,children:Q}),!a&&(0,U.jsxs)("div",{className:r.hoverActions,onClick:N=>N.stopPropagation(),children:[(0,U.jsx)("button",{className:r.actionBtn,title:"Mention in Chat (@)",onClick:N=>{N.stopPropagation(),X()},children:(0,U.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:(0,U.jsx)("path",{d:"M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2zM7 5h2v2h2v2H9v2H7V9H5V7h2V5z"})})}),(0,U.jsx)("button",{className:r.actionBtn,title:"Copy Relative Path",onClick:N=>{N.stopPropagation(),ve()},children:(0,U.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:(0,U.jsx)("path",{d:"M4 4h6v1H4v9h7v-4h1v5H3V4h1zm3-2h7v7h-1V3.7L7.7 9 7 8.3 12.3 3H7V2z"})})}),(0,U.jsx)("button",{className:r.actionBtn,title:"Rename (F2)",onClick:N=>{N.stopPropagation(),Y?.()},children:(0,U.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"currentColor",children:(0,U.jsx)("path",{d:"M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"})})})]})]})};var he=require("react/jsx-runtime"),Tt=Be.default.memo(({entry:e,depth:n,rootPath:o,levels:t,expanded:s,selected:a,focusedPath:l,renamingPath:x,gitStatusMap:h,filterText:c,matchingPaths:m,ancestorPaths:f,creating:v,creatingName:C,createInputRef:d,options:u,indentStep:E,iconSize:k,reloadDirectory:F,onToggle:X,onSelect:ve,onOpenFile:Y,onContextMenu:le,onInsertReference:P,onCopyRelativePath:we,onStartRename:J,onCancelRename:fe,onRenameSubmit:ae,onDelete:Ce,onCreatingNameChange:Le,onCreatingKeyDown:H,onCreatingBlur:Ae,getRelativePath:de})=>{let Q=de(e?.path??""),Pe=(e?.path??"").replace(/\\/g,"/").toLowerCase(),se=(t[e?.path??""]??t[(e?.path??"").replace(/\\/g,"/")]??t[(e?.path??"").replace(/\//g,"\\")]??(Pe?Object.entries(t).find(([D])=>D.replace(/\\/g,"/").toLowerCase()===Pe)?.[1]:void 0))!==void 0,Ne=(0,Be.useMemo)(()=>{if(!u.compactFolders||!e?.isDir)return;let D=[e],Se=e,ke=t[Se.path]??t[Se.path.replace(/\\/g,"/")]??t[Se.path.replace(/\//g,"\\")];for(;ke&&Array.isArray(ke.entries);){let Ue=u.showHiddenFiles?ke.entries:ke.entries.filter(te=>te&&!te.hidden&&!te.name.startsWith("."));if(Ue.length===1&&Ue[0].isDir){let te=Ue[0];D.push(te),Se=te,ke=t[Se.path]??t[Se.path.replace(/\\/g,"/")]??t[Se.path.replace(/\//g,"\\")]}else break}return D.length>1?D:void 0},[u.compactFolders,u.showHiddenFiles,e,t]),oe=Ne!==void 0&&Ne.length>1,L=(oe?Ne[Ne.length-1]:e)?.path??"",ee=de(L)||"",_e=ee.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase(),Ee=(Q||"").replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase(),pe=(L||"").replace(/\\/g,"/").toLowerCase(),De=(e?.path||"").replace(/\\/g,"/").toLowerCase(),z=!!(c&&m),je=!!(z&&m&&(m.has(_e)||m.has(Ee)||m.has(pe)||m.has(De)||e?.path&&m.has(e.path)||e?.path&&m.has(e.path.toLowerCase())||L&&m.has(L)||L&&m.has(L.toLowerCase()))),Ve=!!(z&&f&&(f.has(_e)||f.has(Ee)||f.has(pe)||f.has(De)||e?.path&&f.has(e.path)||e?.path&&f.has(e.path.toLowerCase())||L&&f.has(L)||L&&f.has(L.toLowerCase()))),We=(L||"").replace(/\\/g,"/").toLowerCase(),Re=t[L]??t[L.replace(/\\/g,"/")]??t[L.replace(/\//g,"\\")]??(We?Object.entries(t).find(([D])=>D.replace(/\\/g,"/").toLowerCase()===We)?.[1]:void 0),He=Re!==void 0,Ke=!!(e?.isDir&&(Ve||s.has(e.path)||s.has(L)||De&&s.has(De)||pe&&s.has(pe)||e?.path&&s.has(e.path.toLowerCase())||L&&s.has(L.toLowerCase()))),me=!0;!e||!u.showHiddenFiles&&(e.hidden||e.name.startsWith("."))?me=!1:z?e.isDir?!je&&!Ve&&(me=!1):je||(me=!1):c&&!(e.name.toLowerCase().includes(c.toLowerCase())||Q.toLowerCase().includes(c.toLowerCase()))&&!e.isDir&&(me=!1);let Ge=Be.default.useRef(null);if((0,Be.useEffect)(()=>{!me||!e||!e.isDir||Ke&&!He&&Ge.current!==L&&(Ge.current=L,F(L).finally(()=>{Ge.current===L&&(Ge.current=null)}))},[me,Ke,L,e,He,F]),(0,Be.useEffect)(()=>{!me||!e||u.compactFolders&&e.isDir&&e.compact&&!se&&F(e.path)},[me,u.compactFolders,e,se,F]),!e||!me)return null;let rt=a.has(e.path)||a.has(L),at=l===e.path||l===L,st=h?.get(_e)??h?.get(Ee)??h?.get(pe)??h?.get(De),it=()=>{oe&&L!==e.path?s.has(e.path)||s.has(L)?(s.has(e.path)&&X(e.path),s.has(L)&&X(L)):(X(e.path),X(L)):X(e.path)};if(!e.isDir)return(0,he.jsx)(Mt,{entry:e,depth:n,isExpanded:!1,isSelected:rt,isFocused:at,isRenaming:x===e.path,gitStatus:st,relativePath:Q,indentStep:E,iconSize:k,enableMotion:u.enableMotion,showGitBadges:u.showGitBadges,compactFolders:u.compactFolders,singleClickAction:u.singleClickAction,onToggle:()=>{},onSelect:D=>ve(e.path,D),onDoubleClick:()=>Y(e.path,Q),onContextMenu:D=>le(e,Q,D),onInsertReference:()=>P(Q,!1),onCopyRelativePath:()=>we(Q),onStartRename:()=>J(e.path),onCancelRename:fe,onRenameSubmit:D=>ae(e.path,D),onDelete:()=>Ce(e,Q)});let Ye=He&&Array.isArray(Re?.entries)?u.showHiddenFiles?Re.entries:Re.entries.filter(D=>D&&!D.hidden&&!D.name.startsWith(".")):[],Je=x===e.path||oe&&x===L;return(0,he.jsxs)("div",{className:r.folderGroup,children:[(0,he.jsx)(Mt,{entry:e,depth:n,isExpanded:Ke,isSelected:rt,isFocused:at,isRenaming:Je,gitStatus:st,relativePath:ee,compactChain:Ne,indentStep:E,iconSize:k,enableMotion:u.enableMotion,showGitBadges:u.showGitBadges,compactFolders:u.compactFolders,singleClickAction:u.singleClickAction,onToggle:it,onSelect:D=>ve(L,D),onContextMenu:D=>le(e,ee,D),onInsertReference:()=>P(ee,!0),onCopyRelativePath:()=>we(ee),onStartRename:()=>J(oe?L:e.path),onCancelRename:fe,onRenameSubmit:D=>ae(oe?L:e.path,D),onDelete:()=>Ce(e,ee)}),(0,he.jsx)("div",{className:`${r.folderChildren} ${Ke?r.folderChildrenOpen:r.folderChildrenClosed}`,style:u.enableMotion?void 0:{transition:"none"},children:(0,he.jsxs)("div",{className:r.folderChildrenInner,children:[v&&(v.parentDir===e.path||v.parentDir===L)&&(0,he.jsxs)("div",{className:r.row,style:{paddingLeft:`${(n+1)*E+8}px`},children:[(0,he.jsx)("span",{className:r.iconWrap,children:v.isDir?"\u{1F4C1}":"\u{1F4C4}"}),(0,he.jsx)("input",{ref:d,autoFocus:!0,type:"text",className:r.inlineInput,placeholder:v.isDir?"Folder name...":"File name...",value:C,onChange:D=>Le(D.target.value),onKeyDown:H,onBlur:Ae})]}),Ye.length>0?Ye.map(D=>(0,he.jsx)(Tt,{entry:D,depth:n+1,parentDir:L,rootPath:o,levels:t,expanded:s,selected:a,focusedPath:l,renamingPath:x,gitStatusMap:h,filterText:c,matchingPaths:m,ancestorPaths:f,creating:v,creatingName:C,createInputRef:d,options:u,indentStep:E,iconSize:k,reloadDirectory:F,onToggle:X,onSelect:ve,onOpenFile:Y,onContextMenu:le,onInsertReference:P,onCopyRelativePath:we,onStartRename:J,onCancelRename:fe,onRenameSubmit:ae,onDelete:Ce,onCreatingNameChange:Le,onCreatingKeyDown:H,onCreatingBlur:Ae,getRelativePath:de},D.path)):!z&&He&&Re.entries&&Re.entries.length===0?(0,he.jsx)("div",{className:r.row,style:{paddingLeft:`${(n+1)*E+8}px`,opacity:.45,fontStyle:"italic",fontSize:"12px"},children:"Empty folder"}):null]})})]})});var sn=require("react");function ln({rootPath:e,onRefresh:n}){(0,sn.useEffect)(()=>{if(!e)return;let o=null,t=()=>{o&&clearTimeout(o),o=setTimeout(()=>{n()},100)},s=null;try{let c=`/dsh-explorer/api/events?dir=${encodeURIComponent(e)}`;s=new EventSource(c),s.onmessage=m=>{try{if(JSON.parse(m.data).type==="connected")return}catch{}t()}}catch(c){console.warn("[dsh-explorer] SSE init error:",c)}let a=null;try{let c=window.location,m=c.host||(c.port?`127.0.0.1:${c.port}`:"127.0.0.1"),v=`${c.protocol==="https:"?"wss:":"ws:"}//${m}/dsh-explorer/api/watch?dir=${encodeURIComponent(e)}`;a=new WebSocket(v),a.onmessage=()=>{t()}}catch{}let l=()=>{t()},x=()=>{document.visibilityState==="visible"&&t()};window.addEventListener("focus",l),document.addEventListener("visibilitychange",x);let h=setInterval(()=>{document.visibilityState==="visible"&&t()},3e3);return()=>{if(o&&clearTimeout(o),clearInterval(h),window.removeEventListener("focus",l),document.removeEventListener("visibilitychange",x),s)try{s.close()}catch{}if(a)try{a.close()}catch{}}},[e,n])}function cn({visibleFlatRows:e,focusedPath:n,expanded:o,setFocusedPath:t,setSelected:s,toggleExpand:a,onMention:l,onStartRename:x,onDelete:h}){return c=>{if(e.length===0)return;let m=e.findIndex(f=>f.entry.path===n);if(c.key==="ArrowDown"){c.preventDefault();let f=m<e.length-1?m+1:0,v=e[f];v&&(t(v.entry.path),s(new Set([v.entry.path])))}else if(c.key==="ArrowUp"){c.preventDefault();let f=m>0?m-1:e.length-1,v=e[f];v&&(t(v.entry.path),s(new Set([v.entry.path])))}else if(c.key==="ArrowRight"){let f=e[m];f?.entry.isDir&&!o.has(f.entry.path)&&(c.preventDefault(),a(f.entry.path))}else if(c.key==="ArrowLeft"){let f=e[m];f?.entry.isDir&&o.has(f.entry.path)&&(c.preventDefault(),a(f.entry.path))}else if(c.key==="Enter"){let f=e[m];f&&(c.preventDefault(),f.entry.isDir?a(f.entry.path):l(f.relativePath))}else if(c.key==="F2")n&&(c.preventDefault(),x(n));else if(c.key==="Delete"&&n){c.preventDefault();let f=e.find(v=>v.entry.path===n);f&&h(f.entry,f.relativePath)}}}var xe={scale:1,density:"normal",enableMotion:!0,showHiddenFiles:!0,showGitBadges:!0,compactFolders:!1,singleClickAction:"select"},dn="dsh_explorer_options_v1";function pn(){if(typeof window>"u"||!window.localStorage)return{...xe};try{let e=window.localStorage.getItem(dn);if(!e)return{...xe};let n=JSON.parse(e);return{scale:typeof n.scale=="number"&&Number.isFinite(n.scale)?Math.max(.75,Math.min(1.35,Math.round(n.scale*100)/100)):xe.scale,density:n.density==="compact"||n.density==="relaxed"?n.density:"normal",enableMotion:typeof n.enableMotion=="boolean"?n.enableMotion:xe.enableMotion,showHiddenFiles:typeof n.showHiddenFiles=="boolean"?n.showHiddenFiles:xe.showHiddenFiles,showGitBadges:typeof n.showGitBadges=="boolean"?n.showGitBadges:xe.showGitBadges,compactFolders:typeof n.compactFolders=="boolean"?n.compactFolders:xe.compactFolders,singleClickAction:n.singleClickAction==="mention"?"mention":"select"}}catch{return{...xe}}}function Ft(e){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(dn,JSON.stringify(e))}catch{}}function Ie(e,n){if(e)try{if(typeof e.get=="function"){let o=e.get(n);if(o!==void 0)return o}return e[n]}catch{return}}function hn(e,n,o,t){let s=o.replace(/\\/g,"/"),a=Dt(o);try{let l=Ie(e,"betterSidebar");if(l&&typeof l.openTab=="function"){l.openTab({type:"editor",title:a,path:o,id:`editor:${o}`});return}}catch{}try{let l=Ie(e,"sidebarRight");if(l&&typeof l.openResource=="function"){let x=t.replace(/\\/g,"/"),h=m=>m.split("/").map(f=>encodeURIComponent(f).replace(/%3A/gi,":")).join("/"),c=n?`dsh-resource://file/session/${encodeURIComponent(n)}/${h(x)}`:`dsh-resource://file/absolute/${h(s.replace(/^\/+/,""))}`;l.openResource(c);return}}catch{}try{let l=Ie(e,"tabs");if(l&&typeof l.open=="function"){l.open({path:o,title:a});return}}catch{}try{let l=e?.remote?.session;if(l&&typeof l.openWorkspacePath=="function"){l.openWorkspacePath({path:o});return}}catch{}try{window.open(`/dsh-explorer/api/read-file?path=${encodeURIComponent(o)}`,"_blank")}catch{}}var re=require("react/jsx-runtime");var fn=({ctx:e,sessionId:n,initialCwd:o})=>{let[t,s]=(0,y.useState)(o??""),[a,l]=(0,y.useState)({}),[x,h]=(0,y.useState)(()=>new Set),[c,m]=(0,y.useState)(()=>new Set),[f,v]=(0,y.useState)(null),[C,d]=(0,y.useState)(""),[u,E]=(0,y.useState)(""),[k,F]=(0,y.useState)(!1),[X,ve]=(0,y.useState)(null),[Y,le]=(0,y.useState)(null),[P,we]=(0,y.useState)(null),J=(0,y.useRef)(null),[fe,ae]=(0,y.useState)(!1),[Ce,Le]=(0,y.useState)(!1),[H,Ae]=(0,y.useState)(()=>pn()),[de,Q]=(0,y.useState)(!1),[Pe,N]=(0,y.useState)(null),[se,Ne]=(0,y.useState)({isRepo:!1,entries:[]}),[oe,ue]=(0,y.useState)(null),[L,ee]=(0,y.useState)(""),[_e,Ee]=(0,y.useState)(null),[pe,De]=(0,y.useState)(null),[z,je]=(0,y.useState)(null),[Ve,We]=(0,y.useState)(null),Re=(0,y.useRef)(null),He=(0,y.useRef)(null),Ke=(0,y.useCallback)(i=>{Ae(p=>{let b={...p,...i};return Ft(b),b})},[]),me=(0,y.useCallback)(()=>{Ae({...xe}),Ft({...xe})},[]),Ge=H.density==="compact"?20:H.density==="relaxed"?28:24,rt=H.density==="compact"?11.5:H.density==="relaxed"?14:13,at=H.density==="compact"?14:H.density==="relaxed"?18:16,st=H.density==="compact"?12:H.density==="relaxed"?20:16,it=Math.round(Ge*H.scale),Ye=Math.round(rt*H.scale),Je=Math.round(at*H.scale),D=Math.round(st*H.scale),Se=(0,y.useMemo)(()=>({"--dsh-row-height":`${it}px`,"--dsh-font-size":`${Ye}px`,"--dsh-icon-size":`${Je}px`,"--dsh-indent-step":`${D}px`}),[it,Ye,Je,D]);(0,y.useEffect)(()=>{n&&tn(n)},[n]),(0,y.useEffect)(()=>{if(o&&!t){s(o);return}if(!t){let i=!0;return et(n).then(p=>{i&&p&&p.path&&(s(p.path),l({[p.path]:p}))}).catch(p=>{i&&N(p?.message||"Failed to connect to file service")}),()=>{i=!1}}},[n,o,t]);let ke=(0,y.useCallback)(async i=>{try{N(null);let p=await et(n,i);l(b=>{let S=i.replace(/\\/g,"/"),A=i.replace(/\//g,"\\");return{...b,[i]:p,[S]:p,[A]:p}})}catch(p){N(p?.message||"Failed to load directory")}},[n]),Ue=(0,y.useCallback)(async i=>{let p=i||t;if(!(!p&&!n))try{let b=await Vt(p,n);Ne(b)}catch{Ne({isRepo:!1,entries:[]})}},[t,n]),te=(0,y.useCallback)(async()=>{if(t){Ue(t);try{let i=Array.from(x),p=Array.from(new Set([t,...i])),b=await ht(p),S={};for(let[I,B]of Object.entries(b))S[I]=B,S[I.replace(/\\/g,"/")]=B;let A=t.replace(/\\/g,"/").toLowerCase();l(I=>{let B={...I,...S};for(let O of Object.keys(I))O.replace(/\\/g,"/").toLowerCase()!==A&&!S[O]&&!S[O.replace(/\\/g,"/")]&&!S[O.replace(/\//g,"\\")]&&delete B[O];return B}),h(I=>{let B=!1,O=new Set(I);for(let M of I)M.replace(/\\/g,"/").toLowerCase()!==A&&!S[M]&&!S[M.replace(/\\/g,"/")]&&!S[M.replace(/\//g,"\\")]&&(O.delete(M),B=!0);return B?O:I})}catch(i){console.warn("[dsh-explorer] refreshAll failed:",i)}}},[t,x,Ue]);(0,y.useEffect)(()=>{t&&(te(),h(i=>new Set(i).add(t)))},[t]),ln({rootPath:t,onRefresh:te});let At=(0,y.useCallback)(async i=>{h(p=>{let b=new Set(p);if(b.has(i))b.delete(i);else{b.add(i);let S=i.replace(/\\/g,"/");!a[i]&&!a[S]&&ke(i)}return b})},[a,ke]),Me=(0,y.useCallback)(i=>{if(!t)return i;let p=t.replace(/\\/g,"/").replace(/\/+$/,""),b=i.replace(/\\/g,"/");return b.toLowerCase().startsWith(`${p.toLowerCase()}/`)?b.slice(p.length+1):i},[t]),Pt=(0,y.useRef)(a);(0,y.useEffect)(()=>{Pt.current=a},[a]),(0,y.useEffect)(()=>{let i=setTimeout(()=>{E(C)},200);return()=>clearTimeout(i)},[C]),(0,y.useEffect)(()=>{let i=u.trim();if(!i||!t){le(null),we(null),ve(null),F(!1),J.current&&(h(J.current),J.current=null);return}J.current||(J.current=new Set(x));let p=!1,b=new AbortController;return F(!0),(async()=>{try{let A=await Wt(t,i,n,b.signal);if(p)return;let I=Pt.current,B=new Set,O=new Set,M=new Set,qe=t.replace(/\\/g,"/").replace(/\/+$/,""),Qe=t.replace(/\//g,"\\").replace(/\\+$/,"");for(let W of A.matches){let K=W.path.replace(/\\/g,"/").toLowerCase(),_=W.path.replace(/\//g,"\\").toLowerCase(),T=W.relativePath.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase(),j=W.relativePath.replace(/\//g,"\\").toLowerCase();if(B.add(K),B.add(_),B.add(T),B.add(j),B.add(W.path),B.add(W.path.toLowerCase()),B.add(W.relativePath),B.add(W.relativePath.toLowerCase()),W.isDir){let ge=W.path.replace(/\\/g,"/"),ie=W.path.replace(/\//g,"\\");!I[W.path]&&!I[ge]&&!I[ie]&&M.add(ie)}let q=T.split("/"),Z=q.length-1,ce="";for(let ge=0;ge<Z;ge++){ce=ce?`${ce}/${q[ge]}`:q[ge],O.add(ce.toLowerCase());let ie=`${qe}/${ce}`,be=`${Qe}\\${ce.replace(/\//g,"\\")}`;O.add(ie.toLowerCase()),O.add(be.toLowerCase()),O.add(ie),O.add(be),!I[ie]&&!I[be]&&!I[ie.toLowerCase()]&&!I[be.toLowerCase()]&&M.add(be)}}for(let[,W]of Object.entries(I))if(W?.entries)for(let K of W.entries){let _=Me(K.path),T=K.path.replace(/\\/g,"/").toLowerCase(),j=K.path.replace(/\//g,"\\").toLowerCase(),q=_.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase(),Z=_.replace(/\//g,"\\").toLowerCase();if(K.name.toLowerCase().includes(i.toLowerCase())||q.includes(i.toLowerCase())){B.add(T),B.add(j),B.add(q),B.add(Z),B.add(K.path),B.add(K.path.toLowerCase()),B.add(_),B.add(_.toLowerCase());let ce=q.split("/"),ge=ce.length-1,ie="";for(let be=0;be<ge;be++){ie=ie?`${ie}/${ce[be]}`:ce[be],O.add(ie.toLowerCase());let Et=`${qe}/${ie}`,ct=`${Qe}\\${ie.replace(/\//g,"\\")}`;O.add(Et.toLowerCase()),O.add(ct.toLowerCase()),O.add(Et),O.add(ct),!I[Et]&&!I[ct]&&M.add(ct)}}}if(M.size>0&&!p){let W=Array.from(new Set(Array.from(M).map(T=>T.replace(/\//g,"\\")))),K={};try{let T=await ht(W.slice(0,100));T&&typeof T=="object"&&(K=T)}catch{K={}}let _=W.filter(T=>!K[T]&&!K[T.replace(/\\/g,"/")]&&!K[T.replace(/\//g,"\\")]);if(_.length>0&&!p){let T=await Promise.all(_.slice(0,60).map(async j=>{try{let q=await et(n,j);return{dir:j,listing:q}}catch{return null}}));for(let j of T)j&&j.listing&&(K[j.dir]=j.listing)}!p&&Object.keys(K).length>0&&l(T=>{let j={...T};for(let[q,Z]of Object.entries(K)){if(!Z)continue;let ce=q.replace(/\\/g,"/"),ge=q.replace(/\//g,"\\");j[q]=Z,j[ce]=Z,j[ge]=Z,j[ce.toLowerCase()]=Z,j[ge.toLowerCase()]=Z}return j})}p||(le(B),we(O),ve(A.matches.length),F(!1),h(W=>{let K=new Set(W);for(let _ of O)K.add(_);return K}))}catch(A){!p&&A?.name!=="AbortError"&&F(!1)}})(),()=>{p=!0,b.abort()}},[u,t,n,Me]);let un=(0,y.useMemo)(()=>{let i=new Map,p=t?t.replace(/\\/g,"/").replace(/\/+$/,"").toLowerCase():"";for(let b of se?.entries??[]){if(!b||!b.path)continue;let S=b.path.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase();i.set(S,b.xy),p&&i.set(`${p}/${S}`,b.xy);let A=S;for(;;){let I=A.lastIndexOf("/");if(I===-1||(A=A.slice(0,I),!A))break;let B=i.get(A);B?b.xy.includes("M")&&!B.includes("M")&&(i.set(A," M"),p&&i.set(`${p}/${A}`," M")):(i.set(A,b.xy),p&&i.set(`${p}/${A}`,b.xy))}}return i},[se,t]),Ht=(0,y.useMemo)(()=>{if(!t)return[];let i=t.replace(/\\/g,"/").toLowerCase(),p=a[t]??a[t.replace(/\\/g,"/")]??a[t.replace(/\//g,"\\")]??Object.entries(a).find(([I])=>I.replace(/\\/g,"/").toLowerCase()===i)?.[1];if(!p||!Array.isArray(p.entries))return[];let b=[],S=!!(u&&Y),A=I=>{let B=I.replace(/\\/g,"/").toLowerCase(),O=a[I]??a[I.replace(/\\/g,"/")]??a[I.replace(/\//g,"\\")]??Object.entries(a).find(([M])=>M.replace(/\\/g,"/").toLowerCase()===B)?.[1];if(!(!O||!Array.isArray(O.entries)))for(let M of O.entries){if(!M||!H.showHiddenFiles&&(M.hidden||M.name.startsWith(".")))continue;let qe=Me(M.path),Qe=qe.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").toLowerCase(),W=M.path.replace(/\\/g,"/").toLowerCase();if(S&&Y&&P){let _=Y.has(Qe)||Y.has(W)||Y.has(M.path)||Y.has(M.path.toLowerCase());if(M.isDir){let T=P.has(Qe)||P.has(W)||P.has(M.path)||P.has(M.path.toLowerCase());if(!_&&!T)continue}else if(!_)continue}if(H.compactFolders&&M.isDir){let _=[M],T=M,j=a[T.path]??a[T.path.replace(/\\/g,"/")]??a[T.path.replace(/\//g,"\\")];for(;j&&Array.isArray(j.entries);){let q=H.showHiddenFiles?j.entries:j.entries.filter(Z=>Z&&!Z.hidden&&!Z.name.startsWith("."));if(q.length===1&&q[0].isDir){let Z=q[0];_.push(Z),T=Z,j=a[T.path]??a[T.path.replace(/\\/g,"/")]??a[T.path.replace(/\//g,"\\")]}else break}if(_.length>1){let q=Me(T.path);b.push({entry:T,relativePath:q}),(S||x.has(M.path)||x.has(T.path))&&A(T.path);continue}}b.push({entry:M,relativePath:qe});let K=S||x.has(M.path);M.isDir&&K&&A(M.path)}};return A(t),b},[t,a,x,u,Y,P,Me,H.showHiddenFiles,H.compactFolders]),$t=(0,y.useCallback)(async()=>{let i=new Set;t&&i.add(t);for(let[b,S]of Object.entries(a))if(i.add(b),S?.entries)for(let A of S.entries)A.isDir&&i.add(A.path);h(i);let p=Array.from(i).filter(b=>{let S=b.replace(/\\/g,"/");return!a[b]&&!a[S]});if(p.length>0)try{let b=await ht(p);l(S=>({...S,...b}))}catch{}},[t,a]),Ct=(0,y.useCallback)((i,p)=>{let b=p??Me(i.path);De({entry:i,relativePath:b})},[Me]),mn=(0,y.useCallback)(async()=>{pe&&(await qt(pe.entry.path),te())},[pe,te]),gn=cn({visibleFlatRows:Ht,focusedPath:f,expanded:x,setFocusedPath:v,setSelected:m,toggleExpand:At,onMention:i=>{let p=n??Ie(e,"sessions")?.active?.id??"";Oe(e,p,i,!1)},onStartRename:i=>Ee(i),onDelete:(i,p)=>Ct(i,p)}),xn=(i,p)=>{v(i),p.ctrlKey||p.metaKey?m(b=>{let S=new Set(b);return S.has(i)?S.delete(i):S.add(i),S}):m(new Set([i]))},lt=async()=>{if(!oe||!L.trim()){ue(null);return}let i=L.trim(),p=oe.parentDir;try{oe.isDir?await Gt(p,i):await Kt(p,i),te(),h(b=>new Set(b).add(p))}catch(b){console.error("[dsh-explorer] Operation failed:",b)}finally{ue(null),ee("")}},vn=async(i,p)=>{Ee(null);try{await Ut(i,p),te()}catch(b){console.error("[dsh-explorer] Rename failed:",b)}},bn=async i=>{if(i.dataTransfer.files&&i.dataTransfer.files.length>0){i.preventDefault(),i.stopPropagation();let p=t;for(let b=0;b<i.dataTransfer.files.length;b++){let S=i.dataTransfer.files[b],A=`/dsh-explorer/api/upload?dir=${encodeURIComponent(p)}&relativePath=${encodeURIComponent(S.name)}`;await fetch(A,{method:"POST",body:S})}te()}},Ot=(0,y.useCallback)((i,p)=>{hn(e,n??"",i,p)},[e,n]),zt=t?t.replace(/\\/g,"/").toLowerCase():"",yn=a[t]??a[t.replace(/\\/g,"/")]??a[t.replace(/\//g,"\\")]??(zt?Object.entries(a).find(([i])=>i.replace(/\\/g,"/").toLowerCase()===zt)?.[1]:void 0);return(0,re.jsxs)("div",{className:`${r.container} ${H.enableMotion?"":r.noMotion}`,style:Se,children:[(0,re.jsx)(Zt,{title:t||"EXPLORER",searchOpen:fe,optionsOpen:Ce,onToggleSearch:()=>{fe?(d(""),E(""),ae(!1)):ae(!0)},onToggleOptions:()=>Le(!Ce),onNewFile:()=>{ue({parentDir:t,isDir:!1}),ee("")},onNewFolder:()=>{ue({parentDir:t,isDir:!0}),ee("")},onRefresh:()=>{te()},onExpandAll:$t,onCollapseAll:()=>{h(new Set)}}),Ce&&(0,re.jsx)(Jt,{options:H,onChange:Ke,onReset:me,onClose:()=>Le(!1)}),fe&&(0,re.jsx)(Xt,{value:C,loading:k,matchCount:X,onChange:d,onClose:()=>{d(""),E(""),ae(!1)}}),(0,re.jsxs)("div",{ref:Re,className:r.treeBody,tabIndex:0,onKeyDown:gn,onContextMenu:i=>{i.preventDefault(),je(null),We({x:i.clientX,y:i.clientY})},onDragOver:i=>{i.preventDefault(),i.dataTransfer.dropEffect="copy"},onDrop:bn,children:[oe&&oe.parentDir===t&&(0,re.jsxs)("div",{className:r.row,style:{paddingLeft:`${D+8}px`},children:[(0,re.jsx)("span",{className:r.iconWrap,children:oe.isDir?"\u{1F4C1}":"\u{1F4C4}"}),(0,re.jsx)("input",{ref:He,autoFocus:!0,type:"text",className:r.inlineInput,placeholder:oe.isDir?"Folder name...":"File name...",value:L,onChange:i=>ee(i.target.value),onKeyDown:i=>{i.key==="Enter"?lt():i.key==="Escape"&&ue(null)},onBlur:lt})]}),(yn?.entries??[]).map(i=>(0,re.jsx)(Tt,{entry:i,depth:0,parentDir:t,rootPath:t,levels:a,expanded:x,selected:c,focusedPath:f,renamingPath:_e,gitStatusMap:un,filterText:u,matchingPaths:Y,ancestorPaths:P,creating:oe,creatingName:L,createInputRef:He,options:H,indentStep:D,iconSize:Je,reloadDirectory:ke,onToggle:At,onSelect:xn,onOpenFile:Ot,onContextMenu:(p,b,S)=>{S.preventDefault(),S.stopPropagation(),We(null),je({x:S.clientX,y:S.clientY,entry:p,relativePath:b})},onInsertReference:(p,b)=>{let S=n??Ie(e,"sessions")?.active?.id??"";Oe(e,S,p,b)},onCopyRelativePath:p=>{navigator.clipboard.writeText(p)},onStartRename:p=>Ee(p),onCancelRename:()=>Ee(null),onRenameSubmit:(p,b)=>vn(p,b),onDelete:Ct,onCreatingNameChange:ee,onCreatingKeyDown:p=>{p.key==="Enter"?lt():p.key==="Escape"&&ue(null)},onCreatingBlur:lt,getRelativePath:Me},i.path)),Ht.length===0&&!oe&&(0,re.jsx)("div",{className:r.emptyState,children:de||k?"Searching workspace files...":Pe?`Error: ${Pe}`:u?`No files matching "${u}"`:H.showHiddenFiles?"Empty directory":"Only hidden files present (enable in options)"})]}),z&&(0,re.jsx)(_t,{x:z.x,y:z.y,entry:z.entry,relativePath:z.relativePath,onClose:()=>je(null),onOpenFile:()=>Ot(z.entry.path,z.relativePath),onInsertReference:()=>{let i=n??Ie(e,"sessions")?.active?.id??"";Oe(e,i,z.relativePath,z.entry.isDir)},onInsertSnippet:async()=>{let i=n??Ie(e,"sessions")?.active?.id??"";try{let p=await ft(z.entry.path);wt(e,i,z.relativePath,p)}catch(p){console.error("[dsh-explorer] Failed to read file:",p)}},onCopyPath:()=>{navigator.clipboard.writeText(z.entry.path)},onCopyRelativePath:()=>{navigator.clipboard.writeText(z.relativePath)},onNewFile:()=>{ue({parentDir:z.entry.path,isDir:!1}),ee("")},onNewFolder:()=>{ue({parentDir:z.entry.path,isDir:!0}),ee("")},onRename:()=>{v(z.entry.path),Ee(z.entry.path)},onDelete:()=>Ct(z.entry,z.relativePath)}),Ve&&(0,re.jsx)(Yt,{x:Ve.x,y:Ve.y,onClose:()=>We(null),onNewFile:()=>{ue({parentDir:t,isDir:!1}),ee("")},onNewFolder:()=>{ue({parentDir:t,isDir:!0}),ee("")},onToggleSearch:()=>{ae(i=>!i)},onExpandAll:$t,onCollapseAll:()=>{h(new Set)},onRefresh:te,onOpenOptions:()=>{Le(!0)}}),pe&&(0,re.jsx)(en,{entry:pe.entry,relativePath:pe.relativePath,onConfirm:mn,onClose:()=>De(null)})]})};var ne=require("react/jsx-runtime"),In=["slots","sessions","locale"],Bt=class extends ot.Component{state={hasError:!1,error:null};static getDerivedStateFromError(n){return{hasError:!0,error:n}}componentDidCatch(n,o){console.error("[dsh-explorer] Render error:",n,o)}render(){return this.state.hasError?(0,ne.jsxs)("div",{style:{padding:"16px",color:"var(--dsw-alias-label-primary, #ffffff)",fontSize:"12px",fontFamily:"var(--dsw-font-code, monospace)",display:"flex",flexDirection:"column",gap:"12px",height:"100%",boxSizing:"border-box"},children:[(0,ne.jsx)("div",{style:{fontWeight:600,color:"var(--dsw-alias-danger, #f85149)"},children:"Explorer encountered an error"}),(0,ne.jsx)("div",{style:{fontSize:"11px",opacity:.85,wordBreak:"break-word",background:"var(--dsw-alias-bg-hover, rgba(255, 255, 255, 0.05))",padding:"8px",borderRadius:"4px"},children:this.state.error?.message||"Unknown render exception"}),(0,ne.jsx)("button",{type:"button",onClick:()=>this.setState({hasError:!1,error:null}),style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid var(--dsw-alias-hairline, rgba(255, 255, 255, 0.15))",background:"var(--dsw-alias-interactive-bg-hover, rgba(255, 255, 255, 0.08))",color:"var(--dsw-alias-label-primary, #ffffff)",cursor:"pointer",alignSelf:"flex-start",fontSize:"12px"},children:"Reload Explorer"})]}):this.props.children}},It=()=>(0,ne.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:(0,ne.jsx)("path",{d:"M14 4.5V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6.5L14 4.5zm-1 0H9.5a.5.5 0 0 1-.5-.5V2H3v12h10V4.5z"})}),An=(0,ot.memo)(function(){return(0,ne.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"6px",fontSize:"12px"},children:[(0,ne.jsx)(It,{}),(0,ne.jsx)("span",{children:"Explorer"})]})}),Pn=(0,ot.memo)(function(n){return(0,ne.jsx)(Bt,{children:(0,ne.jsx)(fn,{ctx:n.ctx,sessionId:n.sessionId})})}),Hn=({ctx:e,sessionId:n})=>(0,ne.jsx)("button",{type:"button",title:"Explorer (File Tree)","aria-label":"Explorer",onClick:()=>{try{let o=e.get?e.get("sidebarRight"):e.sidebarRight;n&&o?.openTabIn?o.openTabIn(n,"explorer"):o?.openTab&&o.openTab("explorer")}catch(o){console.warn("[dsh-explorer] failed to open sidebar tab:",o)}},style:{display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:"none",cursor:"pointer",padding:"3px 6px",borderRadius:"6px",color:"var(--dsw-alias-label-secondary, #8b949e)",transition:"color 0.15s, background-color 0.15s"},onMouseEnter:o=>{o.currentTarget.style.color="var(--dsw-alias-label-primary, #ffffff)",o.currentTarget.style.backgroundColor="var(--dsw-alias-bg-hover, rgba(255, 255, 255, 0.08))"},onMouseLeave:o=>{o.currentTarget.style.color="var(--dsw-alias-label-secondary, #8b949e)",o.currentTarget.style.backgroundColor="transparent"},children:(0,ne.jsx)(It,{})});function $n(e){e.effect(()=>{try{return nn()}catch(n){return console.warn("[dsh-explorer] failed to setup caret tracker:",n),()=>{}}},"dsh-explorer: caret tracker"),e.effect(()=>{try{return an(e)}catch(n){return console.warn("[dsh-explorer] failed to attach conversation drop listener:",n),()=>{}}},"dsh-explorer: conversation drop listener"),e.slots.inject("conversation.session.header.utilities",()=>e.slots.register({name:"conversation.session.header.utilities",id:"dsh-explorer:header-button",order:15,inject:n=>({sessionId:n})},n=>(0,ne.jsx)(Hn,{ctx:e,sessionId:n.sessionId}))),e.inject(["sidebarRightTabs"],n=>{let o=n.get?n.get("sidebarRightTabs"):n.sidebarRightTabs;if(!o?.register)return;let t=o.register({id:"dsh-explorer",kind:"explorer",keepMounted:!0,priority:"extension",title:()=>"Explorer",guide:[{id:"dsh-explorer",order:5,title:()=>"Explorer",description:()=>"VS Code style file explorer with drag & drop to chat",icon:It}]}),s=e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:"dsh-explorer",inject:l=>({ctx:e,sessionId:l})},Pn)),a=e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:"dsh-explorer",inject:l=>({sessionId:l})},An));return()=>{try{a?.()}catch{}try{s?.()}catch{}try{t?.()}catch{}}})}
855
+
856
+
857
+ return module.exports;
858
+ }
859
+ });