-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
4311 lines (4259 loc) · 158 KB
/
Copy pathindex.jsx
File metadata and controls
4311 lines (4259 loc) · 158 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// GENERATED from src/ by build.mjs — do not edit by hand.
// Edit src/app.jsx + src/{lib,ui,editor}/*, then run `npm run build`.
// src/app.jsx
import React, { useState as useState4, useEffect as useEffect6, useMemo as useMemo3, useCallback as useCallback4, useRef as useRef6, useDeferredValue } from "react";
// src/ui/colors.js
var NOTE_COLORS = [
{ name: null, label: "Default", hex: null },
{ name: "slate", label: "Slate", hex: "#7d96b4" },
{ name: "moss", label: "Moss", hex: "#84a583" },
{ name: "sand", label: "Sand", hex: "#c2ab82" },
{ name: "clay", label: "Clay", hex: "#bd8d7c" },
{ name: "plum", label: "Plum", hex: "#a98ab4" }
];
var LEGACY_TONES = {
violet: "plum",
pink: "plum",
green: "moss",
amber: "sand",
coral: "clay",
sky: "slate"
};
function normalizeColorName(name) {
if (!name) return null;
if (NOTE_COLORS.some((c) => c.name === name)) return name;
return LEGACY_TONES[name] ?? null;
}
// src/ui/css.js
var TONE_CSS = NOTE_COLORS.filter((c) => c.name).map((c) => `
.nt-card--${c.name} {
--nt-note-tone: ${c.hex};
background: color-mix(in srgb, var(--nt-note-tone) 14%, var(--surface));
border-color: color-mix(in srgb, var(--nt-note-tone) 36%, var(--border));
}
.nt-swatch--${c.name} { background: ${c.hex}; }
.nt-color-dot--${c.name},
.nt-card--${c.name} .nt-card-tone-dot { background: color-mix(in srgb, var(--nt-note-tone) 72%, var(--surface)); }`).join("\n");
var CSS = `
/* mobius-ui:Root v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-root {
--nt-measure: 704px;
--nt-safe-top: var(--mobius-safe-top, env(safe-area-inset-top, 0px));
--nt-safe-right: var(--mobius-safe-right, env(safe-area-inset-right, 0px));
--nt-safe-bottom: var(--mobius-safe-bottom, env(safe-area-inset-bottom, 0px));
--nt-safe-left: var(--mobius-safe-left, env(safe-area-inset-left, 0px));
--nt-accent-ink: color-mix(in srgb, var(--accent) 72%, var(--text));
--nt-danger-ink: color-mix(in srgb, var(--danger) 68%, var(--text));
position: relative;
display: flex; flex-direction: column;
height: 100%; width: 100%; max-width: 100%;
overflow: hidden;
background: var(--bg); color: var(--text); font-family: var(--font);
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}
.nt-home {
display: flex; flex-direction: column;
flex: 1; min-width: 0; min-height: 0;
}
.nt-scroll {
flex: 1; min-height: 0;
overflow-y: auto; overflow-x: hidden;
overscroll-behavior: contain;
word-break: break-word; overflow-wrap: anywhere;
}
/* /mobius-ui:Root */
/* mobius-ui:Scrollskin v2 \u2014 keep in sync; library candidate. */
.nt-scroll,
.nt-attach-strip {
scrollbar-width: none;
-ms-overflow-style: none;
}
.nt-scroll::-webkit-scrollbar,
.nt-attach-strip::-webkit-scrollbar {
display: none;
width: 0; height: 0;
}
/* /mobius-ui:Scrollskin */
/* mobius-ui:Focus v1 \u2014 shared keyboard focus ring (WCAG 2.4.7); never bare outline:none */
:where(button,a,input,textarea,select,summary,[role="button"],[tabindex]:not([tabindex="-1"])):focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* /mobius-ui:Focus */
/* \u2500\u2500 TopBar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* mobius-ui:Header v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-topbar {
/* top-pinned bar: pad past the notch/status bar on notched phones */
padding: max(14px, var(--nt-safe-top)) 0 12px;
border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
position: sticky; top: 0;
background: color-mix(in srgb, var(--bg) 86%, transparent); z-index: 5;
backdrop-filter: saturate(1.35) blur(14px);
-webkit-backdrop-filter: saturate(1.35) blur(14px);
flex: 0 0 auto;
}
.nt-topbar-inner {
box-sizing: border-box;
width: 100%; max-width: 1040px; margin: 0 auto;
padding: 0 max(18px, var(--nt-safe-right)) 0 max(18px, var(--nt-safe-left));
display: flex; flex-direction: column; gap: 12px;
}
.nt-topbar-row {
display: flex; align-items: center; gap: 11px; min-width: 0;
}
/* Brand mark \u2014 the app's real icon, rounded and sized to the search row */
.nt-brand-icon {
width: 32px; height: 32px; flex-shrink: 0;
border-radius: 8px; object-fit: cover; display: block;
}
/* Accent-dot fallback when the install has no custom icon (route 404s) */
.nt-brand-fallback {
width: 32px; height: 32px; flex-shrink: 0;
display: inline-flex;
align-items: center; justify-content: center;
font-size: 32px; font-weight: 700; line-height: 1;
color: var(--accent); user-select: none;
}
.nt-app-title {
flex: 1; margin: 0; min-width: 0;
color: var(--text);
font-size: 22px; line-height: 1; font-weight: 700; letter-spacing: 0;
}
/* Search field \u2014 full-width quiet inset */
.nt-search-wrap {
width: 100%; min-height: 44px;
display: flex; align-items: center; gap: 9px;
padding: 0 12px; border-radius: 11px;
border: 1px solid transparent;
background: var(--surface2, var(--surface)); color: var(--muted);
transition: border-color 0.15s ease, background 0.15s ease;
}
.nt-search {
flex: 1; min-width: 0;
min-height: 44px;
padding: 0; border: 0; border-radius: 0;
background: transparent; color: var(--text);
/* 16px stops iOS Safari zoom-on-focus (don't drop below on a focusable field) */
font-size: 16px; font-family: var(--font); line-height: 1;
}
.nt-search:focus, .nt-search:focus-visible { outline: none; }
.nt-search-wrap:focus-within {
border-color: var(--accent);
background: var(--surface);
}
.nt-search::placeholder { color: color-mix(in srgb, var(--text) 14%, var(--muted)); }
.nt-new-note-btn {
width: 44px; height: 44px; flex: 0 0 auto;
border-radius: 11px;
border: none; background: var(--accent-hover, var(--accent)); color: var(--accent-fg);
display: inline-flex; align-items: center; justify-content: center;
cursor: pointer; font-family: var(--font);
box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 18%, transparent);
-webkit-tap-highlight-color: transparent;
touch-action: manipulation; user-select: none;
transition: filter 0.14s ease, transform 0.12s ease;
}
@media (hover: hover) { .nt-new-note-btn:hover { filter: brightness(0.94); } }
.nt-new-note-btn:active { transform: scale(0.94); }
/* /mobius-ui:Header */
/* \u2500\u2500 Loading / Empty \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
.nt-spinner {
width: 22px; height: 22px; border-radius: 50%;
border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
border-top-color: var(--accent);
animation: nt-spin 0.7s linear infinite;
}
@keyframes nt-spin { to { transform: rotate(360deg); } }
.nt-loading-grid {
box-sizing: border-box;
padding: 18px max(18px, var(--nt-safe-right)) max(72px, calc(52px + var(--nt-safe-bottom))) max(18px, var(--nt-safe-left));
max-width: 1040px; margin: 0 auto;
}
.nt-loading-label {
display: inline-flex; align-items: center; gap: 9px;
margin: 4px 4px 12px;
color: var(--muted); font-size: 13px; font-weight: 600;
}
.nt-skeleton-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
gap: 12px; align-items: start;
}
.nt-skeleton-card {
min-height: 128px; border-radius: 16px;
border: 1px solid var(--border);
background: var(--surface);
box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 5%, transparent),
0 4px 8px color-mix(in srgb, var(--text) 6%, transparent);
padding: 16px;
}
.nt-skeleton-line {
display: block; height: 10px; border-radius: 999px;
background: color-mix(in srgb, var(--muted) 18%, transparent);
margin-bottom: 10px;
}
.nt-skeleton-line.is-title {
width: 72%; height: 13px;
background: color-mix(in srgb, var(--text) 18%, transparent);
}
.nt-skeleton-line.is-short { width: 44%; }
/* mobius-ui:Empty v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-empty {
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 0; padding: 18vh 24px; text-align: center; color: var(--muted);
}
.nt-empty-icon {
width: 56px; height: 56px; border-radius: 16px;
display: grid; place-items: center;
margin-bottom: 16px;
background: var(--surface2, var(--surface));
color: color-mix(in srgb, var(--muted) 74%, transparent);
}
.nt-empty-msg {
margin: 0 0 6px;
font-size: 17px; line-height: 1.2; font-weight: 650; color: var(--text);
}
.nt-empty-hint {
max-width: 270px;
font-size: 13.5px; line-height: 1.5; color: var(--muted);
}
.nt-empty-action {
min-height: 44px; margin-top: 18px; padding: 9px 16px;
display: inline-flex; align-items: center; justify-content: center;
border: none; border-radius: 10px;
background: var(--accent-hover, var(--accent)); color: var(--accent-fg);
font: 650 14px/1 var(--font); cursor: pointer;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: filter 0.14s ease, transform 0.12s ease;
}
@media (hover: hover) { .nt-empty-action:hover { filter: brightness(0.94); } }
.nt-empty-action:active { transform: scale(0.97); }
/* /mobius-ui:Empty */
/* \u2500\u2500 Grid \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
.nt-grid-wrap {
box-sizing: border-box;
padding: 18px max(18px, var(--nt-safe-right)) max(72px, calc(52px + var(--nt-safe-bottom))) max(18px, var(--nt-safe-left));
max-width: 1040px; margin: 0 auto;
}
.nt-section { margin-bottom: 26px; }
/* mobius-ui:SectionHead v1 \u2014 keep in sync; library candidate. */
.nt-section-head {
display: flex; align-items: center; gap: 8px;
font-size: 13px; line-height: 1; font-weight: 650; letter-spacing: 0;
color: color-mix(in srgb, var(--text) 66%, var(--muted));
margin: 4px 4px 12px; user-select: none;
}
.nt-section-count {
letter-spacing: 0; font-weight: 500;
color: color-mix(in srgb, var(--text) 50%, var(--muted));
}
/* /mobius-ui:SectionHead */
.nt-cards {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
grid-auto-rows: min-content;
gap: 12px; align-items: start;
}
/* \u2500\u2500 Card \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* mobius-ui:Card v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-card-wrap {
min-width: 0; /* grid item \u2014 no extra margin needed with gap */
content-visibility: auto;
contain-intrinsic-size: auto 180px;
}
.nt-card {
position: relative;
border-radius: 16px; overflow: hidden;
background: var(--surface); border: 1px solid var(--border);
min-height: 118px;
box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 5%, transparent),
0 4px 8px color-mix(in srgb, var(--text) 6%, transparent);
transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}
.nt-card.is-locked {
box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 4%, transparent),
0 4px 8px color-mix(in srgb, var(--text) 5%, transparent);
}
@media (hover: hover) {
.nt-card:hover {
box-shadow: 0 2px 4px color-mix(in srgb, var(--text) 7%, transparent),
0 6px 8px color-mix(in srgb, var(--text) 10%, transparent);
transform: translateY(-2px);
}
}
.nt-card:active { transform: scale(0.985); }
.nt-card-body {
min-height: 118px;
cursor: pointer; padding: 14px 14px 12px 16px;
display: flex; flex-direction: column; gap: 8px;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nt-card-body:active { opacity: 0.85; }
.nt-card-main {
flex: 1; min-width: 0;
display: flex; flex-direction: column; gap: 8px;
}
.nt-card-title {
display: block;
font-size: 15px; line-height: 1.28; font-weight: 650; color: var(--text);
overflow-wrap: anywhere;
}
.nt-card-title span {
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
overflow: hidden;
}
.nt-card-empty {
font-size: 13px; color: color-mix(in srgb, var(--text) 58%, var(--muted)); font-style: italic;
}
.nt-card-preview {
font-size: 13px;
color: color-mix(in srgb, var(--text) 72%, var(--muted));
font-weight: 450;
line-height: 1.45;
display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
overflow: hidden;
}
.nt-card-kicker {
color: color-mix(in srgb, var(--text) 64%, var(--muted)); font-size: 12px;
}
.nt-card-meta {
display: flex; align-items: center; gap: 8px; min-height: 12px;
}
.nt-card-tone-dot {
width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto;
}
.nt-card-date {
color: color-mix(in srgb, var(--text) 58%, var(--muted));
font: 500 11.5px/1 var(--mono); letter-spacing: 0;
}
.nt-card-thumbs {
display: grid; gap: 6px; margin-bottom: 8px;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nt-card-thumbs--1 {
grid-template-columns: minmax(0, 1fr);
}
.nt-card-thumb {
width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; border-radius: 6px;
border: 1px solid var(--border);
background: var(--surface2, var(--surface));
/* Render an already-stored Ultra HDR image (gain-map JPEG) as SDR. Without
this, Chrome on Android promotes the display surface to HDR while the image
is painted and tone-shifts the whole shell+app background \u2014 visible to the
eye, invisible to screenshots. Supported Chrome 136+/Android; ignored
elsewhere. New uploads are already flattened to SDR at attach time; this
covers images stored before that fix. */
dynamic-range-limit: standard;
}
.nt-card-thumbs--1 .nt-card-thumb {
aspect-ratio: 16 / 10;
}
.nt-card-thumb.is-wide {
grid-column: span 2;
}
/* /mobius-ui:Card */
/* \u2500\u2500 Card toolbar \u2014 shown on hover/focus; toggled via .nt-card--tools \u2500\u2500\u2500\u2500\u2500\u2500 */
.nt-card-footer {
display: flex; align-items: center; gap: 0;
padding: 4px 6px 5px;
border-top: 1px solid var(--border); background: transparent;
/* hidden by default; revealed on hover/focus or long-press (.nt-card--tools) */
opacity: 0;
transition: opacity 0.14s ease;
pointer-events: none;
}
@media (hover: hover) {
.nt-card:hover .nt-card-footer { opacity: 1; pointer-events: auto; }
}
/* focus-within: keyboard navigation reveals the toolbar */
.nt-card:focus-within .nt-card-footer { opacity: 1; pointer-events: auto; }
/* long-press (touch) toggle class */
.nt-card--tools .nt-card-footer { opacity: 1; pointer-events: auto; }
@media (hover: none) {
.nt-card-footer { opacity: 1; pointer-events: auto; }
}
/* note-preview: prose styles for rendered markdown in card previews */
.note-preview p { margin: 0 0 6px; }
.note-preview p:last-child { margin-bottom: 0; }
.note-preview h1, .note-preview h2, .note-preview h3 { font-size: 13.5px; font-weight: 700; margin: 0 0 4px; }
.note-preview code { font-family: var(--mono); font-size: 12px; background: color-mix(in srgb, var(--muted) 15%, transparent); border-radius: 3px; padding: 0 3px; }
.note-preview pre { margin: 0 0 6px; font-size: 12px; overflow: hidden; }
.note-preview ul, .note-preview ol { margin: 0 0 6px; padding-left: 18px; }
.note-preview li { margin-bottom: 2px; }
.note-preview li:has(> input[type="checkbox"]) {
list-style: none;
margin-left: -18px;
display: flex;
align-items: flex-start;
gap: 6px;
}
.note-preview li:has(> input[type="checkbox"])::marker { content: ""; }
.note-preview input[type="checkbox"] {
flex: 0 0 auto;
width: 13px; height: 13px;
margin: 2px 0 0;
accent-color: var(--accent);
opacity: 1;
filter: saturate(1.2) contrast(1.12);
}
/* \u2500\u2500 Card toolbar buttons \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* mobius-ui:Button v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-icon-btn {
width: 44px; height: 44px;
display: inline-flex; align-items: center; justify-content: center;
border: none; border-radius: 8px;
background: transparent; color: color-mix(in srgb, var(--text) 64%, var(--muted));
cursor: pointer; font-size: 14px;
opacity: 1; font-family: var(--font);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: background 0.12s ease, transform 0.1s ease;
}
.nt-icon-btn.is-active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--nt-accent-ink); opacity: 1; }
.nt-icon-btn.is-danger { color: var(--nt-danger-ink); }
.nt-icon-btn:disabled,
.nt-icon-btn:disabled:hover {
background: transparent;
cursor: default;
color: color-mix(in srgb, var(--text) 40%, var(--muted));
opacity: 0.68;
transform: none;
}
@media (hover: hover) {
.nt-icon-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
}
.nt-icon-btn:active { transform: scale(0.93); }
.nt-icon-btn:disabled:active { transform: none; }
/* keyboard focus ring comes from the shared mobius-ui:Focus block above */
/* /mobius-ui:Button */
.nt-color-anchor { position: relative; flex-shrink: 0; }
.nt-spacer { flex: 1; }
/* \u2500\u2500 ColorPicker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
.nt-color-picker {
position: fixed; z-index: 60;
display: grid; grid-template-columns: repeat(4, 44px); gap: 8px;
max-width: calc(100vw - 24px); padding: 8px;
background: var(--surface2, var(--surface));
border: 1px solid var(--border); border-radius: 12px;
box-shadow: 0 4px 8px color-mix(in srgb, var(--text) 20%, transparent);
}
.nt-swatch {
width: 44px; height: 44px; border-radius: 9px;
cursor: pointer; padding: 0;
border: 1px solid var(--border);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: transform 0.1s ease;
}
.nt-swatch.is-current { border: 2px solid var(--text); }
.nt-swatch--default { background: linear-gradient(135deg, var(--surface) 49%, var(--muted) 51%); }
.nt-swatch:active { transform: scale(0.9); }
@media (hover: hover) { .nt-swatch:hover { transform: scale(1.1); } }
/* \u2500\u2500 ConfirmModal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* mobius-ui:Sheet v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-modal-scrim {
position: fixed; inset: 0; z-index: 50;
display: flex; align-items: center; justify-content: center; padding: 20px;
overscroll-behavior: contain;
background: color-mix(in srgb, var(--text) 46%, transparent); backdrop-filter: blur(2px);
}
.nt-modal {
width: 100%; max-width: 360px;
background: var(--surface);
border: 1px solid var(--border); border-radius: 16px; padding: 20px;
box-shadow: 0 4px 8px color-mix(in srgb, var(--text) 22%, transparent);
}
.nt-modal-title {
font-size: 16px; font-weight: 650; color: var(--text);
margin: 0 0 8px; user-select: none;
}
.nt-modal-msg {
font-size: 14px; color: var(--muted); line-height: 1.5; margin: 0 0 18px;
}
.nt-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.nt-modal-btn {
min-height: 44px;
display: inline-flex; align-items: center; justify-content: center;
padding: 9px 16px; border-radius: 10px;
font-size: 14px; cursor: pointer; font-family: var(--font);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: transform 0.1s ease;
}
.nt-modal-btn:active { transform: scale(0.97); }
.nt-modal-cancel {
border: 1px solid var(--border); background: transparent; color: var(--text);
}
.nt-modal-confirm {
border: none; color: var(--accent-fg); background: var(--accent-hover, var(--accent)); font-weight: 600;
/* --accent-fg is the legal foreground on the platform's filled action tokens
(no hex fallback \u2014 a custom light theme may set it dark). */
}
.nt-modal-confirm.is-danger {
background: color-mix(in srgb, var(--danger) 78%, var(--text));
color: var(--bg);
}
/* /mobius-ui:Sheet */
/* \u2500\u2500 EditorPanel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
.nt-editor-root {
position: absolute; inset: 0; z-index: 20;
display: flex; align-items: center; justify-content: center;
padding: max(14px, var(--nt-safe-top)) max(14px, var(--nt-safe-right)) max(14px, var(--nt-safe-bottom)) max(14px, var(--nt-safe-left));
background: color-mix(in srgb, var(--bg) 54%, transparent);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
}
.nt-editor-sheet {
width: min(760px, 100%);
height: min(760px, 100%);
max-height: 100%;
box-sizing: border-box;
display: flex; flex-direction: column;
background: var(--bg);
border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
border-radius: 18px;
overflow: hidden;
box-shadow: 0 4px 8px color-mix(in srgb, var(--text) 18%, transparent);
}
@media (max-width: 640px) {
.nt-editor-root {
align-items: flex-end;
padding: max(10px, var(--nt-safe-top)) max(8px, var(--nt-safe-right)) max(8px, var(--nt-safe-bottom)) max(8px, var(--nt-safe-left));
}
.nt-editor-sheet {
width: 100%;
height: min(92vh, 100%);
border-radius: 18px 18px 14px 14px;
}
}
/* mobius-ui:Header v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-editor-hdr {
position: relative; z-index: 3;
padding: 12px 14px 10px;
border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
flex: 0 0 auto;
background: color-mix(in srgb, var(--bg) 86%, transparent);
backdrop-filter: saturate(1.35) blur(14px);
-webkit-backdrop-filter: saturate(1.35) blur(14px);
}
.nt-editor-toolbar {
display: flex; align-items: center; gap: 6px; min-width: 0;
padding-bottom: 1px;
}
.nt-editor-actions {
flex: 0 1 auto;
min-width: 0;
display: flex; align-items: center; gap: 6px;
overflow-x: auto;
overscroll-behavior: contain;
scrollbar-width: none;
scroll-padding-inline: 4px 20px;
}
.nt-editor-actions::-webkit-scrollbar { display: none; }
@media (max-width: 480px) {
.nt-editor-toolbar { gap: 2px; }
.nt-editor-actions {
gap: 2px;
padding-inline-end: 18px;
-webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
}
}
/* /mobius-ui:Header */
/* mobius-ui:Button v1 \u2014 keep in sync; library candidate. Diverge below the marker only. */
.nt-hdr-btn {
width: 44px; height: 44px;
display: inline-flex; align-items: center; justify-content: center;
border: 1px solid transparent; border-radius: 11px;
background: transparent; color: var(--text);
cursor: pointer; font-size: 16px; flex-shrink: 0; font-family: var(--font);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: background 0.12s ease, transform 0.1s ease;
}
.nt-hdr-btn.is-active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.nt-hdr-btn.is-danger { color: var(--nt-danger-ink); }
.nt-hdr-btn:disabled {
cursor: default;
color: color-mix(in srgb, var(--text) 40%, var(--muted));
background: transparent;
}
@media (hover: hover) {
.nt-hdr-btn:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
}
.nt-hdr-btn:not(:disabled):active { transform: scale(0.95); }
/* keyboard focus ring comes from the shared mobius-ui:Focus block above */
/* /mobius-ui:Button */
.nt-color-dot {
width: 9px; height: 9px; border-radius: 3px;
flex-shrink: 0;
/* background comes from the nt-color-dot--<tone> classes generated above */
}
.nt-cm-host {
height: 100%;
min-height: 0;
}
.nt-file-input { display: none; }
.nt-editor-title-band {
position: relative; z-index: 1;
flex: 0 0 auto;
padding: 26px clamp(18px, 6vw, 40px) 6px;
}
.nt-title-input {
display: block; width: 100%; max-width: var(--nt-measure); margin: 0 auto;
padding: 0; border: none;
background: transparent; color: var(--text);
font-size: clamp(24px, 4vw, 31px); line-height: 1.14; font-weight: 700;
letter-spacing: 0; font-family: var(--font);
text-wrap: balance;
}
/* mouse focus is borderless by design; keyboard focus keeps the shared ring */
.nt-title-input:focus:not(:focus-visible) { outline: none; }
.nt-title-input::placeholder { color: var(--muted); }
.nt-title-input[readonly] { cursor: default; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.nt-cm-host .cm-scroller {
overflow-x: hidden;
font-family: var(--font);
font-size: 16px;
line-height: 1.66;
scrollbar-width: none;
-ms-overflow-style: none;
}
.nt-cm-host .cm-scroller::-webkit-scrollbar { display: none; width: 0; height: 0; }
.nt-cm-host .cm-content {
box-sizing: border-box;
width: 100%;
max-width: var(--nt-measure);
margin: 0 auto;
padding: 12px 18px 34vh;
}
.nt-cm-host .cm-line {
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
}
.nt-cm-checkbox-hit {
width: 44px; height: 44px; margin-right: 2px;
display: inline-flex; align-items: center; justify-content: center;
vertical-align: middle; cursor: pointer;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nt-cm-checkbox {
width: 24px; height: 24px; margin: 0;
cursor: pointer; accent-color: var(--accent);
}
.nt-cm-file-chip {
min-height: 44px; max-width: min(100%, 320px);
display: inline-flex; align-items: center; gap: 5px;
margin: 2px; padding: 6px 10px;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
border-radius: 8px; border: 1px solid var(--border);
background: var(--surface2, var(--surface)); color: var(--text);
font: 500 13px/1.25 var(--font); cursor: pointer;
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
transition: background 0.12s ease, transform 0.1s ease;
}
@media (hover: hover) {
.nt-cm-file-chip:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface2, var(--surface))); }
}
.nt-cm-file-chip:active { transform: scale(0.98); }
.nt-editor-sheet.is-locked .cm-content { cursor: default; }
/* mobius-ui:SyncPill v1 (editor variant) \u2014 keep in sync; library candidate. */
.nt-status {
font-size: 12px; white-space: nowrap; margin-right: 2px; flex-shrink: 0;
font-variant-numeric: tabular-nums;
}
/* Online+idle: nothing shown (standard). Resolving uses accent; others muted. */
.nt-status.is-resolving { color: var(--nt-accent-ink); }
.nt-status.is-default { color: var(--muted); }
/* /mobius-ui:SyncPill */
.nt-hdr-spacer { flex: 1; min-width: 4px; }
.nt-conflict-bar {
display: flex; align-items: center; gap: 10px;
padding: 9px 16px;
background: color-mix(in srgb, var(--accent) 12%, transparent);
color: var(--text); font-size: 13px; flex: 0 0 auto;
}
.nt-conflict-msg { flex: 1; }
.nt-conflict-btn {
min-height: 44px;
display: inline-flex; align-items: center; justify-content: center;
border: 1px solid var(--nt-accent-ink); background: transparent; color: var(--nt-accent-ink);
border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer;
flex-shrink: 0; font-family: var(--font);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nt-attach-err {
padding: 8px 16px;
background: color-mix(in srgb, var(--danger) 14%, transparent);
color: var(--nt-danger-ink); font-size: 13px; flex: 0 0 auto;
}
/* Grid-level save-failure banner \u2014 surfaces a refused (dead-lettered) write that
happened with no editor open (a closed-note pin/color, or a back-out after a
refused save). Never silent: a failed save the user can't see is data loss. */
.nt-save-err {
display: flex; align-items: center; gap: 10px;
padding: 9px 16px;
background: color-mix(in srgb, var(--danger) 14%, transparent);
color: var(--nt-danger-ink); font-size: 13px; flex: 0 0 auto;
}
.nt-save-err-msg { flex: 1; }
.nt-save-err-btn {
min-height: 44px;
display: inline-flex; align-items: center; justify-content: center;
border: 1px solid var(--nt-danger-ink); background: transparent; color: var(--nt-danger-ink);
border-radius: 8px; padding: 4px 12px; font-size: 12px; cursor: pointer;
flex-shrink: 0; font-family: var(--font);
-webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nt-editor-body { position: relative; z-index: 1; flex: 1; min-height: 0; overflow: hidden; }
.nt-editor-foot {
position: relative; z-index: 3;
flex: 0 0 auto;
display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
gap: 8px 14px;
padding: 10px clamp(18px, 6vw, 40px) max(14px, var(--nt-safe-bottom));
border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
color: color-mix(in srgb, var(--text) 54%, var(--muted));
font: 500 12px/1.2 var(--mono);
}
/* \u2500\u2500 Grid offline pill (mobius-ui:SyncPill v2) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* SILENT WHEN HEALTHY: mounted ONLY while offline (never "Saving"/pending
counts), plain "Offline" copy. Absolute to .nt-root (which is
position:relative), never fixed \u2014 a fixed overlay could paint over shell chrome. */
.nt-sync-pill {
position: absolute; left: 50%; bottom: max(22px, var(--nt-safe-bottom));
transform: translateX(-50%);
z-index: 15;
display: inline-flex; align-items: center; padding: 9px 14px; border-radius: 999px;
background: var(--text); border: 1px solid transparent; color: var(--bg);
font-size: 12.5px; line-height: 1; font-weight: 650; font-family: var(--font);
box-shadow: 0 4px 8px color-mix(in srgb, var(--text) 20%, transparent);
}
.nt-sync-pill.is-error { border-color: var(--danger); color: var(--danger); }
/* \u2500\u2500 Stranded-attachment strip (editor) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
/* Images attached to the note (meta.attachments) whose markdown ref is no
longer in the body. Without this strip they'd be invisible inside the note
while still showing on the card \u2014 stranded data. */
.nt-attach-strip {
display: flex; gap: 8px; align-items: flex-start;
padding: 8px max(16px, var(--nt-safe-right)) max(10px, var(--nt-safe-bottom)) max(16px, var(--nt-safe-left));
border-top: 1px solid var(--border);
background: var(--surface2, var(--surface));
overflow-x: auto; flex: 0 0 auto;
overscroll-behavior: contain;
}
.nt-attach-thumb {
height: 72px; max-width: 140px; object-fit: cover;
border-radius: 8px; border: 1px solid var(--border);
background: var(--surface); flex-shrink: 0;
/* Constrain pre-existing Ultra HDR thumbnails to SDR (see .nt-card-thumb). */
dynamic-range-limit: standard;
}
/* \u2500\u2500 Per-note color tones (generated from NOTE_COLORS) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
${TONE_CSS}
/* mobius-ui:ReducedMotion v1 \u2014 honor the OS reduce-motion setting */
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}
/* /mobius-ui:ReducedMotion */
`;
// src/lib/hash.js
var encoder = new TextEncoder();
async function sha256Hex(str) {
const data = encoder.encode(String(str));
const digest = await globalThis.crypto.subtle.digest("SHA-256", data);
const bytes = new Uint8Array(digest);
let hex = "";
for (let i = 0; i < bytes.length; i++) {
hex += bytes[i].toString(16).padStart(2, "0");
}
return hex;
}
// src/lib/note.js
function normalize(meta, body) {
return {
title: meta.title ?? "",
body: String(body ?? ""),
pinned: meta.pinned ?? false,
locked: meta.locked ?? false,
color: meta.color ?? null,
tags: Array.isArray(meta.tags) ? meta.tags : [],
attachments: Array.isArray(meta.attachments) ? meta.attachments : [],
type: meta.type ?? "note",
archived: meta.archived ?? false
};
}
async function contentHash(meta, body) {
const canonical = normalize(meta, body);
const json = JSON.stringify([
canonical.title,
canonical.body,
canonical.pinned,
canonical.locked,
canonical.color,
canonical.tags,
canonical.attachments,
canonical.type,
canonical.archived
]);
return sha256Hex(json);
}
function nowIso() {
return (/* @__PURE__ */ new Date()).toISOString();
}
function newNote({ title, type } = {}) {
const ts = nowIso();
return {
id: globalThis.crypto.randomUUID(),
title: title ?? "",
pinned: false,
locked: false,
color: null,
type: type ?? "note",
created: ts,
updated: ts,
mobius_rev: 1,
parent_rev: 0,
attachments: []
};
}
function isBlankNote(meta = {}, body = "") {
const hasTitle = Boolean((meta.title || "").trim());
const hasBody = Boolean(String(body || "").trim());
const hasAttachments = Array.isArray(meta.attachments) && meta.attachments.length > 0;
return !hasTitle && !hasBody && !hasAttachments;
}
function bumpRev(meta) {
const oldRev = meta.mobius_rev ?? 0;
return {
...meta,
mobius_rev: oldRev + 1,
parent_rev: oldRev,
updated: nowIso()
};
}
// src/lib/index-cache.js
var SNIPPET_LEN = 140;
function stripMarkdown(body) {
let s = String(body ?? "");
s = s.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
s = s.replace(/\[([^\]]*)\]\([^)]*\)/g, "$1");
s = s.replace(/`+/g, "");
s = s.replace(/(\*\*|__|~~|\*|_)/g, "");
s = s.replace(/^\s{0,3}(#{1,6}\s+|>\s?|[-*+]\s+|\d+\.\s+)/gm, "");
s = s.replace(/\s+/g, " ").trim();
return s;
}
function snippetOf(body) {
const text = stripMarkdown(body);
return text.length > SNIPPET_LEN ? text.slice(0, SNIPPET_LEN) : text;
}
function toEntry({ meta, body }) {
return {
id: meta.id,
title: meta.title ?? "",
snippet: snippetOf(body),
pinned: meta.pinned ?? false,
locked: meta.locked ?? false,
color: meta.color ?? null,
type: meta.type ?? "note",
updated: meta.updated
};
}
function byPinnedThenUpdatedDesc(a, b) {
if (a.pinned !== b.pinned) return a.pinned ? -1 : 1;
const ua = a.updated ?? "";
const ub = b.updated ?? "";
if (ua === ub) return 0;
return ua < ub ? 1 : -1;
}
function buildIndex(notes) {
const entries = (notes ?? []).map(toEntry);
entries.sort(byPinnedThenUpdatedDesc);
return { notes: entries };
}
function notesFromIndex(index) {
const entries = index && Array.isArray(index.notes) ? index.notes : [];
return entries.filter((e) => e && e.id).map((e) => ({
meta: {
id: e.id,
title: e.title ?? "",
pinned: e.pinned ?? false,
locked: e.locked ?? false,
color: e.color ?? null,
type: e.type ?? "note",
updated: e.updated
},
body: e.snippet ?? "",
placeholder: true
}));
}
// src/lib/visible.js
function visibleNotes(notes, query) {
const q = (query || "").trim().toLowerCase();
let list = notes;
if (q) {
list = list.filter((n) => (n.meta.title || "").toLowerCase().includes(q) || (n.body || "").toLowerCase().includes(q));
}
return [...list].sort((a, b) => {
if (!!a.meta.pinned !== !!b.meta.pinned) return a.meta.pinned ? -1 : 1;
return (b.meta.updated || "").localeCompare(a.meta.updated || "");
});
}
// src/lib/attachments.js
function attachmentPath(sha, ext) {
return `attachments/${sha}.${ext}`;
}
var TYPE_TO_EXT = {
"image/png": "png",
"image/jpeg": "jpeg",
"image/gif": "gif",
"image/webp": "webp",
"application/pdf": "pdf",
"text/plain": "txt"
};
function extFromType(type) {
if (!type) return null;
const base = String(type).split(";")[0].trim().toLowerCase();
return TYPE_TO_EXT[base] ?? null;
}
var BODY_ATTACHMENT_REF = /\]\((attachments\/[^)\s]+)\)/g;
function noteAttachmentRefs(meta = {}, body = "") {
const refs = /* @__PURE__ */ new Set();
if (Array.isArray(meta.attachments)) {
for (const p of meta.attachments) if (typeof p === "string" && p.startsWith("attachments/")) refs.add(p);
}
let m;
BODY_ATTACHMENT_REF.lastIndex = 0;
while (m = BODY_ATTACHMENT_REF.exec(String(body || ""))) refs.add(m[1]);
return refs;
}
function bodyAttachmentRefs(body = "") {
return [...noteAttachmentRefs({}, body)];
}
var IMAGE_EXT = /\.(png|jpe?g|gif|webp|avif)$/i;
function strandedImageRefs(meta = {}, body = "") {
if (!Array.isArray(meta.attachments)) return [];
const bodyRefs = noteAttachmentRefs({}, body);
return meta.attachments.filter((p) => typeof p === "string" && p.startsWith("attachments/") && IMAGE_EXT.test(p) && !bodyRefs.has(p));
}
function referencedAttachments(notes = []) {
const refs = /* @__PURE__ */ new Set();
for (const n of notes) {
if (!n) continue;
for (const p of noteAttachmentRefs(n.meta || {}, n.body || "")) refs.add(p);
}
return refs;
}
// node_modules/node-diff3/dist/diff3.mjs
function LCS(buffer1, buffer2) {
let equivalenceClasses = {};
for (let j = 0; j < buffer2.length; j++) {
const item = buffer2[j];
if (equivalenceClasses[item]) {
equivalenceClasses[item].push(j);
} else {
equivalenceClasses[item] = [j];
}
}
const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
let candidates = [NULLRESULT];
for (let i = 0; i < buffer1.length; i++) {
const item = buffer1[i];
const buffer2indices = equivalenceClasses[item] || [];
let r = 0;
let c = candidates[0];
for (let jx = 0; jx < buffer2indices.length; jx++) {
const j = buffer2indices[jx];
let s;
for (s = r; s < candidates.length; s++) {
if (candidates[s].buffer2index < j && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j)) {
break;
}