File size: 107,848 Bytes
02bd34a
981f71d
 
 
 
 
4f465d3
981f71d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9cbb7ec
981f71d
 
9cbb7ec
981f71d
 
9cbb7ec
 
 
981f71d
9cbb7ec
e306123
 
981f71d
9cbb7ec
 
 
 
 
 
981f71d
9cbb7ec
 
 
 
981f71d
 
9cbb7ec
981f71d
9cbb7ec
 
 
 
981f71d
9cbb7ec
 
981f71d
 
9cbb7ec
981f71d
 
 
 
9cbb7ec
981f71d
 
 
 
 
 
 
 
9cbb7ec
 
4f465d3
 
 
 
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1969806
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4f465d3
 
 
9cbb7ec
 
 
 
 
 
 
4f465d3
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9aab612
 
 
 
 
 
2e71a23
 
9aab612
 
 
 
981f71d
 
9cbb7ec
981f71d
9cbb7ec
e306123
 
 
981f71d
 
4f465d3
 
 
 
 
 
 
 
 
 
9cbb7ec
 
 
 
 
 
a633d49
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
4f465d3
981f71d
 
9cbb7ec
 
 
981f71d
9cbb7ec
 
 
 
 
 
 
 
 
 
981f71d
 
e5bdec5
 
 
 
 
 
 
bf39e2a
 
 
1969806
 
a633d49
bf39e2a
 
 
 
2e71a23
bf39e2a
 
 
 
 
 
 
 
 
 
 
2e71a23
 
 
 
 
 
 
 
 
 
 
 
 
 
bf39e2a
2e71a23
 
bf39e2a
 
 
 
 
 
8133999
 
a633d49
 
8133999
 
a633d49
 
8133999
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1969806
bf39e2a
 
 
2e71a23
 
bf39e2a
 
 
 
 
 
 
 
 
 
981f71d
 
bf39e2a
a633d49
bf39e2a
2e71a23
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
2e71a23
7e83ef6
2e71a23
 
bf39e2a
 
 
 
 
a633d49
8133999
a633d49
bf39e2a
 
 
2e71a23
 
 
7e83ef6
2e71a23
 
 
 
 
 
 
 
bf39e2a
 
 
 
 
 
 
 
9cbb7ec
981f71d
 
4f465d3
9cbb7ec
 
981f71d
 
4f465d3
9cbb7ec
 
981f71d
 
 
 
bf39e2a
4f465d3
2e71a23
 
4f465d3
 
 
 
 
e306123
9aab612
e306123
4f465d3
e306123
 
 
4f465d3
e306123
 
4f465d3
 
 
 
 
bf39e2a
2e71a23
9cbb7ec
2e71a23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e71a23
9cbb7ec
 
2e71a23
981f71d
bf39e2a
 
9cbb7ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
981f71d
9cbb7ec
 
 
 
981f71d
4f465d3
 
9cbb7ec
 
 
981f71d
bf39e2a
981f71d
 
 
 
 
9aab612
 
8133999
a633d49
 
1969806
9aab612
981f71d
 
4f465d3
bf39e2a
981f71d
 
 
 
bf39e2a
 
981f71d
2e71a23
981f71d
 
e5bdec5
981f71d
 
 
2c9741e
429dca7
2c9741e
429dca7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2c9741e
 
981f71d
4f465d3
 
 
1969806
4f465d3
 
 
 
9cbb7ec
1969806
9cbb7ec
9aab612
 
 
1969806
9aab612
4f465d3
9aab612
4f465d3
 
 
9cbb7ec
4f465d3
9aab612
2e71a23
 
 
 
 
 
 
 
9cbb7ec
 
 
 
 
 
e306123
9cbb7ec
 
 
 
 
 
 
1969806
 
9cbb7ec
 
 
1969806
 
4f465d3
 
e306123
 
 
4f465d3
9aab612
4f465d3
 
e306123
9cbb7ec
2e71a23
e306123
 
4f465d3
 
e306123
9aab612
9cbb7ec
e306123
9aab612
9cbb7ec
 
 
2e71a23
 
 
 
 
 
 
 
 
 
 
9cbb7ec
2e71a23
 
a633d49
2e71a23
9cbb7ec
2e71a23
 
 
 
a633d49
 
 
 
 
 
 
8133999
 
a633d49
 
8133999
a633d49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8133999
a633d49
 
1969806
 
9aab612
bf39e2a
2e71a23
1969806
a633d49
1969806
9aab612
8133999
9aab612
 
1969806
 
 
 
 
 
2e71a23
4f465d3
 
 
 
 
 
 
981f71d
 
2e71a23
 
 
981f71d
4f465d3
981f71d
 
2e71a23
981f71d
2e71a23
 
 
 
 
 
 
 
 
 
 
 
 
981f71d
 
 
 
9cbb7ec
981f71d
 
2e71a23
981f71d
 
 
 
 
 
 
 
 
 
 
 
9cbb7ec
981f71d
 
 
 
 
 
2e71a23
 
981f71d
 
 
 
 
 
 
 
9cbb7ec
981f71d
 
 
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e83ef6
 
 
 
 
2e71a23
 
 
7e83ef6
2e71a23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e83ef6
2e71a23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7e83ef6
2e71a23
 
7e83ef6
 
2e71a23
 
 
 
 
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e71a23
 
bf39e2a
8133999
bf39e2a
a633d49
bf39e2a
a633d49
 
 
1969806
bf39e2a
1969806
bf39e2a
 
 
 
 
 
2e71a23
 
 
bf39e2a
2e71a23
 
bf39e2a
 
 
 
 
 
8133999
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e71a23
bf39e2a
 
 
 
 
 
2e71a23
bf39e2a
8133999
a633d49
bf39e2a
 
2e71a23
bf39e2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
981f71d
 
02bd34a
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lasagna Fields</title>
<meta name="description" content="Whole-scan lasagna fields for Herculaneum scrolls, listed by scroll: villa's own fields in the open data, and more made with the villa lasagna model and with Lasagnetta, free to download. Made by Chase Hendrick.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,650&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
:root{
  --bg:#f7f2ea;--bg2:#efe7da;--card:#fffdf9;--ink:#23201c;--ink2:#5d554b;--ink3:#8b8174;--line:#e2d8c8;
  --accent:#c2462b;--accent2:#e07a3f;--basil:#4f7a3a;--sauce:#a8321c;--code:#1f1d1a;--codeink:#efe6d6;--sel:#c2462b22;
  --shadow:0 1px 2px #2a201410,0 8px 24px #2a201412;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#141210;--bg2:#1b1815;--card:#1f1c18;--ink:#f1e9dc;--ink2:#c3b8a7;--ink3:#8f8576;--line:#332e28;
  --accent:#ef7650;--accent2:#f2a15f;--basil:#8bbf6a;--sauce:#ef7650;--code:#0f0e0c;--codeink:#efe6d6;--sel:#ef765026;
  --shadow:0 1px 2px #0006,0 8px 24px #0005;}}
:root[data-theme="dark"]{
  --bg:#141210;--bg2:#1b1815;--card:#1f1c18;--ink:#f1e9dc;--ink2:#c3b8a7;--ink3:#8f8576;--line:#332e28;
  --accent:#ef7650;--accent2:#f2a15f;--basil:#8bbf6a;--sauce:#ef7650;--code:#0f0e0c;--codeink:#efe6d6;--sel:#ef765026;
  --shadow:0 1px 2px #0006,0 8px 24px #0005;}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.6 Inter,system-ui,sans-serif;-webkit-font-smoothing:antialiased}
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{font-family:Fraunces,Georgia,serif;font-weight:650;letter-spacing:-.01em;line-height:1.15;margin:0}
h2{font-size:clamp(26px,3vw,34px);margin-bottom:8px}
h3{font-size:19px;margin-bottom:6px}
p{margin:0 0 12px}
code,pre,.mono{font-family:"JetBrains Mono",ui-monospace,monospace;font-size:13.5px;font-variant-ligatures:none}
:not(pre)>code{overflow-wrap:anywhere;background:var(--bg2);border:1px solid var(--line);padding:1px 6px;border-radius:5px;font-size:.88em}
.wrap{max-width:1180px;margin:0 auto;padding:0 24px}
.tbtn{position:absolute;top:14px;right:16px;z-index:3;border:1px solid var(--line);background:var(--card);color:var(--ink2);border-radius:8px;padding:5px 10px;cursor:pointer;font:inherit;font-size:13px}

/* hero */
header.hero{position:relative;overflow:hidden;border-bottom:1px solid var(--line)}
.hero .wrap{padding-top:60px;padding-bottom:52px;position:relative;z-index:2}
.fields{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;opacity:.85}
.hero:after{content:"";position:absolute;inset:0;pointer-events:none;background:linear-gradient(90deg,var(--bg) 0,var(--bg) 44%,color-mix(in srgb,var(--bg) 78%,transparent) 56%,color-mix(in srgb,var(--bg) 25%,transparent) 72%,transparent 88%)}
.eyebrow{text-transform:uppercase;letter-spacing:.14em;font-size:12px;font-weight:600;color:var(--accent)}
.hero h1{font-size:clamp(36px,5.6vw,64px);max-width:760px;margin:12px 0 16px}
.lede{font-size:18.5px;color:var(--ink);max-width:620px}
.by{color:var(--ink2);font-size:15px;margin:0}.by b{color:var(--ink)}
.stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:28px;max-width:720px}
.stat{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 16px;box-shadow:var(--shadow)}
.stat b{display:block;font-family:Fraunces,serif;font-size:28px;font-weight:650;line-height:1.1}
.stat span{font-size:13px;color:var(--ink3)}
.cta{display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin-top:26px}
.cta .jump{font-size:14.5px;color:var(--ink2);margin-left:6px}
.cta .jump a{color:var(--ink2);border-bottom:1px solid var(--line)}
.cta .jump a:hover{color:var(--accent);text-decoration:none}
.btn{display:inline-flex;align-items:center;gap:8px;border-radius:10px;padding:10px 16px;font-weight:600;font-size:15px;border:1px solid var(--line);background:var(--card);color:var(--ink);cursor:pointer}
.btn.primary{background:var(--accent);border-color:var(--accent);color:#fff}
.btn.small{padding:6px 12px;font-size:14px}
.btn:hover{text-decoration:none;filter:brightness(1.05)}

/* sections */
section{padding:60px 0;border-bottom:1px solid var(--line)}
.sub{color:var(--ink2);max-width:760px;margin-bottom:20px}
.panel{background:var(--card);border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow);padding:18px}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:9px;overflow:hidden}
.seg button{border:0;background:transparent;color:var(--ink2);padding:6px 12px;cursor:pointer;font:inherit;font-size:13.5px;white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--accent);color:#fff}
.codebox{position:relative;margin-top:10px}
pre{background:var(--code);color:var(--codeink);border-radius:10px;padding:14px 16px;white-space:pre-wrap;overflow-wrap:anywhere;overflow-x:auto;overflow-y:hidden;margin:0;line-height:1.55}
pre .c{color:#9a8f7e}
.codebox pre{padding-top:34px}
.copy{position:absolute;top:8px;right:8px;border:1px solid #ffffff22;background:#ffffff14;color:#efe6d6;border-radius:7px;padding:3px 9px;font-size:12px;cursor:pointer}
.copy:hover{background:#ffffff26}
.tabs{display:flex;flex-wrap:wrap;gap:4px;border-bottom:1px solid var(--line);margin-top:16px}
.tabs button{border:0;background:none;padding:8px 12px;color:var(--ink2);cursor:pointer;font:inherit;font-size:14px;border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--accent);font-weight:600}
table{width:100%;border-collapse:collapse;font-size:14.5px;background:var(--card);border:1px solid var(--line);border-radius:12px;overflow:hidden}
th,td{text-align:left;padding:9px 12px;border-bottom:1px solid var(--line);vertical-align:top}
th{background:var(--bg2);font-weight:600;font-size:13px;color:var(--ink2)}
tr:last-child td{border-bottom:0}
.tablewrap{overflow-x:auto}
.note{border-left:3px solid var(--accent2);background:var(--card);padding:12px 16px;border-radius:0 10px 10px 0;margin:14px 0;color:var(--ink2);font-size:15px}
.dim{color:var(--ink3);font-size:13.5px}
.pill{display:inline-block;background:var(--sel);color:var(--accent);border-radius:999px;padding:1px 9px;font-size:12.5px;font-weight:600;margin:2px 4px 2px 0}
.mp{display:inline-block;border-radius:999px;padding:1px 9px;font-size:12.5px;font-weight:600;white-space:nowrap}
.mp.villa{background:var(--sel);color:var(--accent)}
.mp.lgt{background:color-mix(in srgb,var(--basil) 18%,transparent);color:var(--basil)}
.mp.soon{background:var(--bg2);color:var(--ink3);border:1px dashed var(--ink3)}
.fnote{display:block;font-size:12.5px;color:var(--ink3);margin-top:3px;line-height:1.4}

/* disclosure: one look for every fold on the page */
details>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px}
details>summary::-webkit-details-marker{display:none}
details>summary:after{content:"";flex:none;width:7px;height:7px;margin-left:auto;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform .15s}
details[open]>summary:after{transform:translateY(2px) rotate(-135deg)}

/* every field: tools */
.ftools{display:flex;gap:10px 12px;flex-wrap:wrap;align-items:center;margin-bottom:16px}
.ftools input{flex:1 1 220px;max-width:320px;padding:7px 12px;border:1px solid var(--line);border-radius:9px;background:var(--card);color:var(--ink);font:inherit;font-size:14px}
.fcount{color:var(--ink3);font-size:13.5px}
.vseg{margin-left:auto}
/* every field: one card per scroll */
.fcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px;align-items:stretch}
.sccard{background:var(--card);border:1px solid var(--line);border-radius:14px;overflow:hidden;box-shadow:var(--shadow);display:flex;flex-direction:column;min-width:0}
.sccard .thumb{position:relative;aspect-ratio:2.4/1;background:#000;overflow:hidden}
.sccard .thumb img{display:block;width:100%;height:100%;object-fit:cover}
.sccard .thumb .tag{position:absolute;left:8px;bottom:6px;font-size:11px;color:#f1e9dc;background:#000a;padding:1px 7px;border-radius:6px}
.sccard button.thumb{display:block;border:0;padding:0;text-align:inherit;cursor:pointer}
.sccard button.thumb:focus-visible{outline:3px solid #5081ae;outline-offset:-3px}
.sccard .body{padding:11px 14px 0}
.sccard .hd{display:flex;align-items:baseline;justify-content:space-between;gap:10px}
.sccard .hd h3{font-size:20px;margin:0}
.sccard .cnt{font-size:12.5px;color:var(--ink3);white-space:nowrap}
.sccard .sum{display:flex;flex-wrap:wrap;gap:4px 6px;align-items:center;margin:6px 0 11px}
.sccard .sum .mp b{font-weight:700;margin-right:3px}
.sccard .sum .dim{font-size:12.5px;flex-basis:100%}
.sccard details.more{margin-top:auto}
.sccard ul{list-style:none;margin:0;padding:0 14px 4px}
.sccard li{padding:9px 0;border-top:1px solid var(--line)}
.sccard .one li{border-top:0;padding-top:6px}
.sccard .l1{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;font-size:14.5px}
.sccard .l1 b{font-weight:600}
.sccard .l1 .mono{font-size:12px;color:var(--ink3)}
.sccard .l1 .sz{margin-left:auto;font-size:13px;color:var(--ink2);white-space:nowrap}
.sccard .l2{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:3px}
.sccard .l2 .fnote{margin:0}
.sccard .why{font-size:12.5px;color:var(--ink3);line-height:1.4;margin-top:5px}
.sccard .flinks{margin-top:7px}
.sccard .flinks a,.sccard .flinks button{font-size:12.5px;padding:2px 7px}
details.more{border-top:1px solid var(--line)}
details.more>summary{padding:9px 14px;font-size:13.5px;font-weight:600;color:var(--accent)}
details.more>summary:hover{background:var(--bg2)}
details.more ul{padding-bottom:6px}
.flinks{display:flex;gap:6px;flex-wrap:wrap}
.flinks a,.flinks button{font:inherit;font-size:13px;line-height:1.5;border:1px solid var(--line);border-radius:7px;padding:2px 9px;background:var(--card);color:var(--accent);cursor:pointer;white-space:nowrap}
.flinks a:hover,.flinks button:hover{text-decoration:none;border-color:var(--accent)}
.fempty{color:var(--ink3);padding:14px 2px}
/* every field: table */
table.flist td{vertical-align:middle}
table.flist tbody+tbody{border-top:2px solid var(--line)}
table.flist .sc{font-weight:600;white-space:nowrap}
table.flist .num{white-space:nowrap}
table.flist td.mdl{max-width:300px}
table.flist .flinks{flex-wrap:nowrap}
#pend{margin-top:30px}
#pend table td{color:var(--ink2)}

/* use a field */
.picker{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:8px;margin-bottom:16px}
.scan{display:flex;align-items:center;gap:10px;min-width:0;padding:6px 10px 6px 6px;background:var(--card);border:1px solid var(--line);border-radius:11px;cursor:pointer;text-align:left;color:inherit;font:inherit;transition:border-color .15s}
.scan:hover{border-color:var(--accent2)}
.scan[aria-pressed="true"]{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.scan img{flex:none;width:72px;height:36px;object-fit:cover;border-radius:6px;background:#000;display:block}
.scan .name{font-weight:600;font-size:14px;line-height:1.25}
.scan .small{font-size:12px;color:var(--ink3);line-height:1.3}
.usebox{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:18px;align-items:start}
.viewer{background:#000;border-radius:10px;overflow:hidden;position:relative}
.viewer img{display:block;width:100%;height:auto}
.viewer .cap{position:absolute;left:10px;bottom:8px;font-size:12px;color:#e9e1d3;background:#000a;padding:2px 8px;border-radius:6px}
.vhead{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:10px}
dl.facts{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;margin:8px 0 0;font-size:14.5px}
dl.facts dt{color:var(--ink3)}dl.facts dd{margin:0;overflow-wrap:anywhere}
.links{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.howto{margin-top:18px}
.howto>.tabs{margin-top:0;padding:0 8px}
.howto>.tabs button{font-size:15px;padding:11px 14px}
.upanel{padding:18px 4px 4px}
.upanel>.lead{color:var(--ink2);max-width:820px}
.uhead{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:baseline}
.uhead h3{margin:0}
.region{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);gap:20px}
.mapbox{align-self:start;position:relative;background:var(--bg2);border:1px solid var(--line);border-radius:12px;padding:12px}
svg.map{width:100%;height:auto;display:block;cursor:crosshair;touch-action:none}
.zbar{display:flex;align-items:center;gap:10px;margin-top:10px;font-size:13.5px;color:var(--ink2)}
.zbar input{flex:1;min-width:0;accent-color:var(--accent)}
.form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.form label{font-size:12.5px;color:var(--ink3);display:block;margin-bottom:3px}
.form input{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink);font:inherit;font-size:14px}
.result{margin-top:14px;font-size:14.5px}
ol.plain{margin:0;padding-left:22px}
ol.plain li{margin:0 0 10px;padding-left:4px}
.usebox>*,.region>*,.panel,.codebox{min-width:0}

/* about */
.about{max-width:880px}
details.fold{background:var(--card);border:1px solid var(--line);border-radius:12px;margin-top:12px}
details.fold>summary{padding:13px 18px;font-weight:600;font-size:16px}
details.fold>summary .dim{font-weight:400;font-size:13.5px}
details.fold>.inner{padding:0 18px 16px}
.mstep{margin:0 0 12px}
.mstep b{display:block;font-family:Fraunces,serif;font-weight:650;font-size:16.5px;margin-bottom:2px}
.mstep p{margin:0;color:var(--ink2);font-size:15px}

footer{padding:36px 0 52px;color:var(--ink3);font-size:14px}
footer .wrap{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap}
/* preview box over the page */
.lbox{position:fixed;inset:0;z-index:60;background:color-mix(in srgb,#000 62%,transparent);display:grid;place-items:center;padding:16px}
.lbox[hidden]{display:none}
html.lbopen{overflow:hidden}
.lbpanel{background:var(--card);color:var(--ink);border-radius:16px;box-shadow:var(--shadow);width:min(1100px,100%);max-height:calc(100vh - 32px);display:flex;flex-direction:column;overflow:hidden}
.lbhead{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px 16px;border-bottom:1px solid var(--line)}
.lbhead b{font-size:15px;margin-right:auto}
.lbhead .seg{max-width:100%}
.lbhead .seg button{min-width:0;white-space:normal}
#lbslice[hidden]{display:none}
.lbx{border:1px solid var(--line);background:var(--bg2);color:var(--ink);border-radius:9px;padding:6px 12px;font:inherit;font-size:13.5px;cursor:pointer}
#lbimg{display:block;width:100%;min-height:0;flex:1 1 auto;object-fit:contain;background:#0e1117}
.lbfoot{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:10px 16px;font-size:13px;color:var(--ink2)}
.toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%) translateY(20px);background:var(--ink);color:var(--bg);padding:8px 14px;border-radius:9px;font-size:14px;opacity:0;transition:.2s;pointer-events:none;z-index:50}
.toast.on{opacity:1;transform:translateX(-50%)}

@media (max-width:900px){
  .usebox,.region{grid-template-columns:1fr}
  .hero .wrap{padding-top:250px}
  .fields{bottom:auto;height:300px;opacity:.95}
  .hero:after{background:linear-gradient(180deg,transparent 0,transparent 150px,color-mix(in srgb,var(--bg) 70%,transparent) 230px,var(--bg) 300px)}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:760px){
  table.flist,table.flist tbody,table.flist tr,table.flist td{display:block;width:100%}
  table.flist thead{display:none}
  table.flist tr{padding:10px 14px;border-bottom:1px solid var(--line)}
  table.flist tbody tr:last-child{border-bottom:0}
  table.flist td{border:0;padding:2px 0}
  table.flist td.sc{font-size:17px;padding-bottom:4px}
  table.flist td[data-k]:before{content:attr(data-k);display:inline-block;min-width:86px;color:var(--ink3);font-size:12.5px}
  table.flist td.get{padding-top:6px}
  table.flist td.mdl{max-width:none}
  table.flist .flinks{flex-wrap:wrap}
  .howto>.tabs{padding:0}
  .howto>.tabs button{font-size:14px;padding:9px 10px}
  .lbhead .seg{order:3;width:100%}.lbhead .seg button{flex:1}
}
@media (max-width:600px){
  .lbox{padding:0}
  .lbpanel{width:100%;max-height:100vh;border-radius:0}
  /* a scroll's card: picture beside the name, the fields below */
  .sccard{display:grid;grid-template-columns:132px minmax(0,1fr);align-content:start}
  .sccard .thumb{aspect-ratio:2/1;margin:12px 0 0 12px;border-radius:8px}
  .sccard .thumb .tag{display:none}
  .sccard .body{padding:10px 12px 0}
  .sccard .hd{flex-direction:column;gap:0}
  .sccard .foot{grid-column:1/-1}
  .sccard .sum .dim{flex-basis:auto}
  .sccard .one{padding-top:4px}
  .sccard ul{padding:0 12px 4px}
  details.more>summary{padding:9px 12px}
}
@media (max-width:560px){
  .wrap{padding:0 16px}
  section{padding:44px 0}
  .lede{font-size:17px}
  .cta .jump{margin-left:0;flex-basis:100%}
  .form{grid-template-columns:repeat(2,minmax(0,1fr))}
  .picker{grid-template-columns:repeat(2,minmax(0,1fr))}
  .scan img{width:54px;height:27px}
  .ftools input{max-width:none;flex-basis:100%}
  .vseg{margin-left:0}
  .panel{padding:14px}
  .upanel{padding:14px 0 0}
  details.fold>summary{padding:12px 14px}
  details.fold>summary .dim{display:none}
  .scan .gbx{display:none}
  details.fold>.inner{padding:0 14px 14px}
}
</style>
<script>
// Theme before first paint: the viewer's saved choice (the Theme button), else the theme the Space page was opened
// with (Gradio follows Hugging Face's ?__theme=, which Hugging Face keeps with the account), else the system setting.
(function(){var t=null;try{t=localStorage.getItem('lf-theme')}catch(e){}
 if(t!=='light'&&t!=='dark'){try{t=new URLSearchParams(parent.location.search).get('__theme')}catch(e){t=null}}
 if(t==='light'||t==='dark')document.documentElement.dataset.theme=t;})();
</script>
<style>
/* The human view uses the same catalog and leaves the existing guide hooks intact. */
[hidden]{display:none!important}
.human{max-width:1120px;margin:auto;padding:30px 28px 12px;position:relative;isolation:isolate}
.human-fields{position:absolute;inset:0 0 auto;height:400px;overflow:hidden;z-index:-1;pointer-events:none;opacity:.38;mask-image:linear-gradient(180deg,#000 0%,#000 50%,transparent 100%)}
.human-fields .fields{height:100%;opacity:1;pointer-events:none}
.human-intro{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:28px}
.human-kicker{font-size:12px;font-weight:650;letter-spacing:.12em;text-transform:uppercase;color:var(--accent);margin-bottom:10px}
.human-intro h2{font-size:clamp(28px,3.5vw,40px);margin-bottom:10px}
.human-intro p:not(.human-kicker){color:var(--ink2);margin:0}
.human button,.human select,.human input{min-height:44px;font:inherit;border:1px solid var(--line);border-radius:9px;background:var(--card);color:var(--ink);padding:9px 12px}
.human button{cursor:pointer}.human button:disabled{opacity:.5;cursor:default}
.human :focus-visible,.human-fold summary:focus-visible{outline:3px solid #5081ae;outline-offset:3px}
.human .human-quiet{font-size:13px;white-space:nowrap;background:transparent}
.human-browser{display:grid;grid-template-columns:minmax(240px,300px) minmax(0,1fr);gap:32px;align-items:start}
.human-choices{min-width:0}.human label{display:block;font-size:14px;font-weight:650;margin:0 0 7px}
.human select,.human input{width:100%;margin:0 0 16px;max-width:100%;text-overflow:ellipsis}
.human-help{font-size:13px;color:var(--ink2);line-height:1.5;margin:-8px 0 20px}
.human-status{padding:15px 0;border-top:1px solid var(--line);margin-top:4px}
#human-availability{display:block;font-size:14px;font-weight:650;color:var(--ink)}
#human-completeness{font-size:12px;color:var(--ink2);line-height:1.5;margin:5px 0 0}
.human-actions{display:grid;gap:10px;margin:8px 0 18px}
.human-data{grid-column:1 / -1;min-width:0;border-top:1px solid var(--line);padding-top:20px;scroll-margin-top:16px}
.human-data h3{font-size:21px;margin:0 0 8px}.human-data h4{font-size:15px;margin:20px 0 8px}
.human-data p{font-size:13px;line-height:1.6;margin:8px 0 14px;color:var(--ink2)}
.human-data-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.human-data-row{min-width:0;border:1px solid var(--line);border-radius:10px;padding:12px;background:var(--card)}
.human-data-row strong{font-size:14px;display:block}.human-data-row small{font-size:12px;color:var(--ink2);display:block;margin:4px 0}
.human-data-actions{display:flex;align-items:center;gap:16px;margin:8px 0}
.human-data-actions a,.human-data-actions button{font-size:13px;min-height:44px;display:inline-flex;align-items:center}
.human-data-url{display:block;font:11px/1.6 ui-monospace,monospace;overflow-wrap:anywhere;color:var(--ink2)}
.human-quick-links{margin:8px 0 14px}.human-quick-row{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;border-bottom:1px solid var(--line);padding:6px 0}
.human-quick-row>span{font-size:13px;flex:1;min-width:110px}.human-quick-row a,.human-quick-row button{font-size:12px;min-height:36px;padding:6px 0;display:inline-flex;align-items:center}
.human-quick-row button{border:0;background:transparent}
.human-data-footer{display:flex;align-items:center;flex-wrap:wrap;gap:12px;margin:16px 0}
.human-actions .human-help{margin:0;font-size:12px}.human-data-footer .human-help{margin:0}
#human-using{border-top:1px solid var(--line);font-size:13px}#human-using summary{cursor:pointer;padding:12px 0;min-height:44px}
#human-region-recipe{margin-top:24px}#human-region-recipe>summary{cursor:pointer;min-height:44px;padding:12px 0}
#use h3{margin-top:24px}#use .codebox pre{white-space:pre-wrap;overflow-wrap:anywhere}
.human-make{font-size:14px;display:inline-block;padding:4px 0}
.human-preview{margin:0;border:1px solid var(--line);border-radius:14px;background:var(--card);overflow:hidden;min-width:0}
.human-preview-head{display:flex;gap:12px;align-items:center;justify-content:space-between;padding:15px 18px;border-bottom:1px solid var(--line)}
.human-preview-head h3{font:650 15px/1.4 Inter,system-ui,sans-serif;margin:0}
.human-preview-head>div{display:flex;gap:4px}.human-preview-head button{font-size:13px;padding:7px 10px;min-height:40px;border-color:transparent}
.human-preview-head button[aria-pressed="true"]{background:var(--bg2);border-color:var(--line)}

.preview-display{display:flex;gap:4px;align-items:center;justify-content:flex-end;padding:6px 12px;background:var(--card);border-bottom:1px solid var(--line)}
.preview-display[hidden]{display:none}.preview-display button{font:inherit;font-size:12px;min-height:36px;padding:6px 10px;border:1px solid transparent;border-radius:9px;background:var(--card);color:var(--ink);cursor:pointer}
.preview-display button:disabled{opacity:.5;cursor:default}
.preview-display button[aria-pressed="true"]{background:var(--bg2);border-color:var(--line)}
.lbpanel .preview-display{flex:0 0 auto}
.preview-note{margin:0;padding:8px 16px;color:var(--ink2);font-size:12px;line-height:1.5}
#lbempty{padding:24px;text-align:center;color:var(--ink2)}

.human-image{min-height:300px;display:flex;align-items:center;justify-content:center;background:var(--bg2);padding:16px}
.human-image img{display:block;width:100%;max-height:420px;object-fit:contain}
.human-image p{max-width:28em;text-align:center;color:var(--ink2);font-size:14px;padding:24px;margin:0}
.human-preview figcaption{padding:14px 18px;color:var(--ink2);font-size:12px;line-height:1.6}
.human-details,.human-fold{border-top:1px solid var(--line);margin:24px auto 0;max-width:1064px}
.human-details summary,.human-fold>summary{cursor:pointer;padding:16px 0;font-size:14px;font-weight:650;color:var(--ink2);min-height:48px}
.human-details dl{display:grid;grid-template-columns:140px minmax(0,1fr);gap:8px 20px;font-size:13px;margin:8px 0 16px}
.human-details dt{color:var(--ink2)}.human-details dd{margin:0;overflow-wrap:anywhere}
.human-details p,.human-details>a{font-size:13px;overflow-wrap:anywhere}.human-explainer{font-size:13px;color:var(--ink2);margin:10px 0 16px}
.human-fold{margin-top:0}.human-fold section{padding:18px 0 32px}.human-fold .wrap{padding:0}
.human-fold[open]>summary{color:var(--ink)}.human-fold:last-of-type{margin-bottom:24px}
footer .wrap{max-width:1120px}#top[hidden]{display:none!important}
.human-no-preview{display:flex;align-items:center;justify-content:center;min-height:140px;width:100%;color:var(--ink2);font-size:13px;background:var(--bg2)}
@media(max-width:700px){
 .human{padding:12px 8px 4px}.human-intro{gap:12px;margin-bottom:18px}.human-intro h2{font-size:27px}
 .human-fields{height:340px;opacity:.3}
 .human-intro p:not(.human-kicker){font-size:14px}.human .human-quiet{font-size:12px;padding:7px}
 .human-browser{display:flex;flex-direction:column;gap:12px}.human-choices{display:contents}
 .human-inputs{order:0;width:100%}.human-preview{order:1;width:100%}
 .human-status,.human-actions,.human-make,.human-quick-links{order:2;width:100%;margin:0}
 .human-data{order:3;width:100%;margin:0}.human-data-list{grid-template-columns:minmax(0,1fr)}
 .human-actions{margin-bottom:8px}.human-image{min-height:180px;padding:8px}
 .human-image img{max-height:250px}.human select,.human input{margin-bottom:10px}.human-help{margin:0 0 10px}
 .human-inputs>.human-help:not(#human-link-note){font-size:12px;margin-bottom:4px}
 .human-preview-head{padding:12px;flex-wrap:wrap}.human-preview-head>div{margin-left:auto}
 .human-fold{margin-left:8px;margin-right:8px}.human-details dl{grid-template-columns:1fr;gap:3px}.human-details dd{margin-bottom:10px}
 .human-intro{position:relative;padding-right:76px}.human .human-quiet{position:absolute;right:0;top:0;max-width:70px;white-space:normal}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto!important}*{animation:none!important;transition:none!important}}

</style>
</head>
<body>
<main class="human" id="human-browser">
  <div class="human-fields" aria-hidden="true"><svg class="fields" id="fields" viewBox="0 440 1600 460" preserveAspectRatio="xMidYMin slice" aria-hidden="true"></svg></div>
  <div class="human-intro">
    <div><p class="human-kicker" id="human-count">Published fields</p><h2>Explore scroll layers</h2>
      <p>Choose a scroll, preview a field, and open its source.</p></div>
    <button type="button" id="human-theme" class="human-quiet">Light / dark</button>
  </div>
  <div class="human-browser">
    <div class="human-choices">
      <div class="human-inputs">
      <label for="human-search">Find a scroll</label><input id="human-search" type="search" placeholder="1447, PHerc1447, 175..." autocomplete="off">
      <p id="human-link-note" class="human-help" role="status" hidden></p>
      <label for="human-scroll">Scroll</label><select id="human-scroll"></select>
      <label for="human-volume">Scan acquisition</label><select id="human-volume"></select>
      <p class="human-help">A scroll can have several scans. Pick the acquisition you need.</p>
      <div id="human-field-choice" hidden><label for="human-field">Field</label><select id="human-field"></select></div>
      </div>
      <div class="human-status" aria-live="polite"><span id="human-availability"></span></div>
      <div id="human-quick-links" class="human-quick-links" aria-label="Selected field data links"></div>
      <p class="human-help">For arrays, Open shows metadata. Copy URL gives the Zarr address for your tools.</p>
      <div class="human-actions"><button id="human-share" type="button">Copy page link</button>
        <p class="human-help">Share this scroll, scan and field selection.</p></div>
      <a class="human-make" href="?tab=make">Need a new field? Make a small box</a>
    </div>
    <figure class="human-preview">
      <div class="human-preview-head"><h3>Field preview</h3><div role="group" aria-label="Preview direction">
        <button type="button" id="human-xy" aria-pressed="true">Top view</button>
        <button type="button" id="human-xz" aria-pressed="false">Side view</button></div><button type="button" id="human-enlarge">Enlarge</button></div>
      <div id="human-display" class="preview-display" role="group" aria-label="Preview display" title="Preview smoothing does not change the downloadable normals." hidden><button type="button" id="human-original" data-preview-mode="original" aria-pressed="false">Original</button><button type="button" id="human-smoothed" data-preview-mode="smoothed" aria-pressed="true">Smoothed</button></div>
      <p id="human-display-note" class="preview-note" role="status"></p>
      <div class="human-image"><img id="human-image" alt="" hidden><p id="human-empty">Choose a scroll to see its preview.</p></div>
      <figcaption id="human-caption">The layer signal and surface directions are model output, not a reading.</figcaption>
    </figure>
    <section class="human-data" id="human-data" aria-labelledby="human-data-title">
      <h3 id="human-data-title">Data and downloads</h3><p id="human-data-selection"></p>
      <h4>Field arrays</h4>
      <p>Open shows the array's metadata. Copy URL gives its Zarr address for a compatible reader. These are chunked arrays, not single-file downloads.</p>
      <div id="human-data-arrays" class="human-data-list"></div>
      <h4>Files and source</h4><p id="human-download-help"></p>
      <div id="human-data-files" class="human-data-list"></div>
      <div class="human-data-footer"><button id="human-copy" type="button">Copy normals with scan details</button>
        <p id="human-copy-status" class="human-help" role="status"></p></div>
      <details id="human-using"><summary>Coordinates and decoding</summary><p id="human-coordinates"></p></details>
      <p id="human-completeness">Whole-volume completeness is not verified here.</p>
    </section>
  </div>
  <details class="human-details" id="human-provenance"><summary>Field details and provenance</summary>
    <dl id="human-facts"></dl><p id="human-note"></p><a id="human-manifest" target="_blank" rel="noopener">Open field manifest</a>
  </details>
  <p class="human-explainer">A field describes the shape of papyrus layers. It helps surface-fitting tools follow them.</p>
</main>

<header class="hero" id="top" hidden>
  <button class="tbtn" id="theme" type="button" aria-label="Switch light or dark">Theme</button>
  <div class="wrap">
    <div class="eyebrow">Vesuvius Challenge open data, made usable</div>
    <h1>Lasagna fields for <span id="nscrolls">24</span> Herculaneum scrolls</h1>
    <p class="lede">Whole-scan lasagna fields in one list, by scroll: villa's own fields in the open data, and fields made here with the villa lasagna model or with Lasagnetta, a faster copy of it. Download one or stream it by URL for the lasagna surface fit or the spiral fit.</p>
    <p class="by">Made and shared by <b>Chase Hendrick</b>, October 2026.</p>
    <div class="stats" id="stats"></div>
    <div class="cta">
      <a class="btn primary" href="#all">Browse every field</a>
      <a class="btn" href="?tab=make">Make a field for any scan</a>
      <span class="jump"><a href="#use">Stream or download</a> &middot; <a href="#method">How it was made</a></span>
    </div>
  </div>
</header>

<details class="human-fold" id="human-all"><summary>All fields, filters and tables</summary>
<section id="all"><div class="wrap">
  <h2>Every field, by scroll or fragment</h2>
  <p class="sub">One card per scroll or fragment. <span class="mp villa">villa predict3d</span> is the villa lasagna model itself, the reference. <span class="mp lgt">Lasagnetta 0.1.1</span> copies it and runs about 5 times faster: use its fields as a preview, and villa's where exact values matter.</p>
  <div class="ftools">
    <input id="fq" type="search" placeholder="Filter by scroll or volume" aria-label="Filter by scroll or volume">
    <div class="seg" role="group" aria-label="Model">
      <button type="button" data-fm="" aria-pressed="true">All</button><button type="button" data-fm="villa predict3d" aria-pressed="false">villa predict3d</button><button type="button" data-fm="Lasagnetta 0.1.1" aria-pressed="false">Lasagnetta 0.1.1</button>
    </div>
    <div class="seg" role="group" aria-label="Where">
      <button type="button" data-fw="" aria-pressed="true">Any source</button><button type="button" data-fw="open-data" aria-pressed="false">Open data</button><button type="button" data-fw="dataset" aria-pressed="false">Made here</button>
    </div>
    <span class="fcount" id="fcount"></span>
    <div class="seg vseg" role="group" aria-label="Layout">
      <button type="button" data-fv="cards" aria-pressed="true">Cards</button><button type="button" data-fv="table" aria-pressed="false">Table</button>
    </div>
  </div>
  <div class="fcards" id="fcards"></div>
  <div class="tablewrap" id="ftable" hidden><table class="flist" id="flist">
    <thead><tr><th>Scroll</th><th>Volume</th><th>Voxel size</th><th>Model</th><th>Where</th><th>Size</th><th>Get it</th></tr></thead>
  </table></div>
  <div id="pend" hidden></div>
</div></section>

</details>
<details class="human-fold" id="human-use"><summary>Download and developer recipes for this field</summary>
<section id="use"><div class="wrap">
  <h2>Use the selected field</h2>
  <p id="human-recipe-selection" class="sub"></p>
  <p class="lead">These recipes follow the scroll, scan acquisition and field selected above. <a href="#human-data">Open or copy individual data links</a>.</p>
  <div id="human-stream-recipe" hidden>
    <h3>Read chunked arrays in Python</h3>
    <p class="lead">Open the listed Zarr arrays by URL. This prints their metadata; indexing an array reads its chunks. Check the manifest for coordinate scales and normal decoding before using values.</p>
    <div class="codebox"><pre id="human-stream-code"></pre><button class="copy" data-copy="human-stream-code" type="button">Copy</button></div>
  </div>
  <div id="human-bundle-recipe" hidden>
    <h3>Download the published field bundle</h3>
    <p id="human-bundle-help" class="lead"></p>
    <div class="codebox"><pre id="human-bundle-code"></pre><button class="copy" data-copy="human-bundle-code" type="button">Copy</button></div>
  </div>
  <p id="human-no-bundle" class="lead"></p>
  <details id="human-region-recipe" hidden>
    <summary>Advanced: copy only a region of this bundle</summary>
    <p class="lead">This bundle has a published part map. Coordinates below are full-resolution scan voxels. The first command copies complete z planes from the bucket; the second downloads archive parts touching your box. Both may include data outside the box. Missing parts read as empty, not as verified absence.</p>
        <div class="region" id="region">
          <div class="mapbox">
            <svg class="map" id="map" viewBox="0 0 400 400" role="img" aria-label="Top view of the scan's parts at the chosen height"></svg>
            <div class="zbar"><span>z</span><input type="range" id="zr" min="0" max="1000" step="1" aria-label="z"><span class="mono" id="zv"></span></div>
          </div>
          <div>
            <div class="form">
              <div><label for="rz">z</label><input id="rz" type="number" min="0"></div>
              <div><label for="ry">y</label><input id="ry" type="number" min="0"></div>
              <div><label for="rx">x</label><input id="rx" type="number" min="0"></div>
              <div><label for="rr">Half size (voxels)</label><input id="rr" type="number" min="1" value="512"></div>
            </div>
            <div class="result" id="rres"></div>
            <div class="codebox"><pre id="rsync"></pre><button class="copy" data-copy="rsync" type="button">Copy</button></div>
            <div class="codebox"><pre id="rcode"></pre><button class="copy" data-copy="rcode" type="button">Copy</button></div>

          </div>
        </div>
  </details>
</div></section>
</details>
<details class="human-fold" id="human-about"><summary>About these fields and credits</summary>
<section id="about"><div class="wrap"><div class="about">
  <h2>About these fields</h2>
  <p class="sub">A lasagna field is the input that the lasagna surface fit in villa reads. These are public so that nobody has to spend a GPU day before trying an idea on these scrolls: use them, compare against them, and tell us if you find a problem.</p>
  <p id="credit">The scans are <a href="https://scrollprize.org">Vesuvius Challenge</a> open data under CC BY-NC 4.0, and these derived fields are shared under the same terms. Model and code are <a href="https://github.com/ScrollPrize/villa">ScrollPrize/villa</a>'s lasagna; credit to its authors. The fields listed from the open data are villa's own, published there by the Vesuvius Challenge; this page only links them. The other fields were computed and shared by Chase Hendrick, some with <a href="https://huggingface.co/SharpMeow/lasagnetta">Lasagnetta</a>, which was trained here to copy villa's lasagna.</p>

  <details class="fold" id="method">
    <summary>How it was made <span class="dim">every step ran on Hugging Face Jobs from scripts, with each part's record kept; nothing was edited by hand</span></summary>
    <div class="inner">
      <div class="mstep"><b>Same settings as the published fields</b><p>The lasagna code in villa at commit <code>db3dbea2</code>, <code>lasagna-preprocess predict3d --tile-size 192</code> with default chunks and levels, and the <a href="https://huggingface.co/scrollprize/lasagna">scrollprize/lasagna</a> model <code>model_current.pt</code> at revision <code>de45f011</code>. On a test crop of PHerc0343 these settings reproduce the published lasagna field to within 2 of 255 at every voxel compared. Bigger tiles and <code>torch.compile</code> ran faster in testing but changed the output, so they were not used.</p></div>
      <div class="mstep"><b>Split into parts that never share a chunk</b><p>Each scan was cut into boxes whose edges sit on multiples of 1,024 scan voxels, each small enough to finish in one Job. Because of that alignment, every chunk of every pyramid level is written by exactly one part, so the parts join without blending. PHerc0175A, the first scan, used an earlier layout whose coarsest level was rebuilt across tile edges; its card gives the details.</p></div>
      <div class="mstep"><b>Predict on GPUs</b><p>One Job per part on an NVIDIA RTX PRO 6000, at the scan's native resolution with no resampling: <span id="mparts"></span> parts in all.</p></div>
      <div class="mstep"><b>Join and check</b><p>The parts were joined into one store, with a check that no chunk appears twice. A seam check then compares the step across each part edge with the steps beside it (1.0 means no step; the limit is 1.5). Finally the card's own load snippet was run on two real parts before upload.</p></div>
      <div class="mstep"><b>One flag, checked properly</b><p>PHerc0841 flagged one edge: cos at z 1,024 stepped 1.62 times its neighbors. A single run straight across that edge gave the same field as the joined parts, byte for byte, in all 1,084 level-1 cos chunks and all 760 level-2 chunks of the four channels there. So that step is in the scan itself, not a seam.</p></div>
      <div class="mstep"><b>Seven more scrolls, 29 October 2026</b><p>PHercMANBp and PHerc0343P got villa fields the same way from their 2.4 and 2.2 碌m scans read at level 2, one 1,024-slice slab per part, with no step at any part edge (worst seam ratios 1.203 and 1.101). PHerc0009B, PHerc0172, PHerc0500P2, PHercMAN5 and PHercMANB got <a href="https://huggingface.co/SharpMeow/lasagnetta">Lasagnetta</a> 0.1.1 fields: three students averaged, cos blur 0.5, cos offset 0.04, part edges on multiples of 512 scan voxels, values kept only where the masked scan holds CT. Each card gives that scan's agreement with villa's net and what the release's self-check said there.</p></div>
      <div class="mstep"><b>Publish with checksums, and unpacked for streaming</b><p>Each dataset carries <code>SHA256SUMS</code>, an <code>index.json</code> with every part's box and hash, the previews and the tested load example. The same parts were then unpacked into the public bucket, with the joined manifest written last, so tools can read chunks by URL.</p></div>
    </div>
  </details>

  <details class="fold">
    <summary>Cite</summary>
    <div class="inner">
      <div class="codebox" style="margin-top:0"><pre id="cite">Chase Hendrick (2026). Lasagna Fields: lasagna fields for Herculaneum scrolls.
Hugging Face. https://huggingface.co/spaces/SharpMeow/lasagna-fields
Computed with ScrollPrize/villa lasagna (db3dbea2) and scrollprize/lasagna (de45f011),
and with Lasagnetta 0.1.1 (SharpMeow/lasagnetta), on Vesuvius Challenge open data (CC BY-NC 4.0).</pre><button class="copy" data-copy="cite" type="button">Copy</button></div>
    </div>
  </details>
</div></div></section>

</details>
<footer><div class="wrap">
  <span>Lasagna Fields, by Chase Hendrick &middot; <a href="https://huggingface.co/SharpMeow">huggingface.co/SharpMeow</a> &middot; <a href="https://github.com/ChaseHendrick">github.com/ChaseHendrick</a></span>
  <span>Also: <a href="https://huggingface.co/datasets/SharpMeow/vesuvius-center-lines">center lines</a> &middot; <a href="https://huggingface.co/spaces/SharpMeow/umbilici?mode=lasagna&scan=PHerc0175A&z=6400">PHerc0175A in 3D</a></span>
</div></footer>
<div class="toast" id="toast">Copied</div>
<div class="lbox" id="lbox" hidden role="dialog" aria-modal="true" aria-labelledby="lbtitle"><div class="lbpanel">
  <div class="lbhead"><b id="lbtitle"></b><div class="seg"><button type="button" data-lv="xy" aria-pressed="true">Through the middle</button><button type="button" data-lv="xz" aria-pressed="false">Along the scroll</button></div><button type="button" class="lbx" id="lbclose" aria-label="Close">Close</button></div>
  <div id="lb-display" class="preview-display" role="group" aria-label="Preview display" title="Preview smoothing does not change the downloadable normals." hidden><button type="button" id="lb-original" data-preview-mode="original" aria-pressed="false">Original</button><button type="button" id="lb-smoothed" data-preview-mode="smoothed" aria-pressed="true">Smoothed</button></div>
  <p id="lb-display-note" class="preview-note" role="status"></p>
  <img id="lbimg" alt="" hidden><p id="lbempty" hidden></p>
  <div class="lbfoot"><span id="lbcaption">Model output: cos (one band per papyrus layer) beside the surface normals as color.</span><button type="button" class="btn" id="lbslice">Open in the slice viewer</button></div>
</div></div>

<script id="data" type="application/json">[{"id":"PHerc0175A","repo":"SharpMeow/pherc0175a-lasagna","volume":"20250521115057-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[12748,9363,9363],"bytes":48177793405,"fix":256972800,"seam":1.26,"pz":6372,"center":true,"parts":[["000",[[1024,2048],[0,4608],[0,9363]],569692160],["001",[[1024,2048],[4608,9363],[0,4608]],496906240],["002",[[1024,2048],[4608,9363],[4608,9363]],1085020160],["003",[[2048,3072],[0,4608],[0,9363]],1038991360],["004",[[2048,3072],[4608,7168],[0,4608]],1268101120],["005",[[2048,3072],[4608,7168],[4608,9363]],1239439360],["006",[[2048,3072],[7168,9363],[0,4608]],309596160],["007",[[2048,3072],[7168,9363],[4608,9363]],333393920],["008",[[3072,4096],[0,4608],[0,9363]],1165516800],["009",[[3072,4096],[4608,7168],[0,2048]],198952960],["010",[[3072,4096],[4608,7168],[2048,4608]],1121945600],["011",[[3072,4096],[4608,7168],[4608,9363]],1206630400],["012",[[3072,4096],[7168,9363],[0,4608]],477286400],["013",[[3072,4096],[7168,9363],[4608,9363]],298577920],["014",[[4096,5120],[0,4608],[0,9363]],1303111680],["015",[[4096,5120],[4608,7168],[0,2048]],213565440],["016",[[4096,5120],[4608,7168],[2048,4608]],1113907200],["017",[[4096,5120],[4608,7168],[4608,9363]],1252628480],["018",[[4096,5120],[7168,9363],[0,4608]],409507840],["019",[[4096,5120],[7168,9363],[4608,9363]],269250560],["020",[[5120,6144],[0,4608],[0,4608]],1032652800],["021",[[5120,6144],[0,4608],[4608,9363]],387000320],["022",[[5120,6144],[4608,7168],[0,2048]],237475840],["023",[[5120,6144],[4608,7168],[2048,4608]],1103083520],["024",[[5120,6144],[4608,7168],[4608,7168]],1101475840],["025",[[5120,6144],[4608,7168],[7168,9363]],227850240],["026",[[5120,6144],[7168,9363],[0,4608]],326850560],["027",[[5120,6144],[7168,9363],[4608,9363]],253163520],["028",[[6144,7168],[0,4608],[0,4608]],1004503040],["029",[[6144,7168],[0,4608],[4608,9363]],526776320],["030",[[6144,7168],[4608,7168],[0,2048]],200007680],["031",[[6144,7168],[4608,7168],[2048,4608]],1079756800],["032",[[6144,7168],[4608,7168],[4608,7168]],1095782400],["033",[[6144,7168],[4608,7168],[7168,9363]],264478720],["034",[[6144,7168],[7168,9363],[0,4608]],280637440],["035",[[6144,7168],[7168,9363],[4608,9363]],251627520],["036",[[7168,8192],[0,4608],[0,4608]],1008650240],["037",[[7168,8192],[0,4608],[4608,9363]],652462080],["038",[[7168,8192],[4608,7168],[0,2048]],176281600],["039",[[7168,8192],[4608,7168],[2048,4608]],1071370240],["040",[[7168,8192],[4608,7168],[4608,7168]],1079173120],["041",[[7168,8192],[4608,7168],[7168,9363]],290242560],["042",[[7168,8192],[7168,9363],[0,4608]],219996160],["043",[[7168,8192],[7168,9363],[4608,9363]],244940800],["044",[[8192,9216],[0,4608],[0,4608]],1032304640],["045",[[8192,9216],[0,4608],[4608,9363]],867645440],["046",[[8192,9216],[4608,7168],[0,4608]],1188648960],["047",[[8192,9216],[4608,7168],[4608,7168]],1085102080],["048",[[8192,9216],[4608,7168],[7168,9363]],379729920],["049",[[8192,9216],[7168,9363],[0,4608]],170926080],["050",[[8192,9216],[7168,9363],[4608,9363]],239185920],["051",[[9216,10240],[0,4608],[0,4608]],1050480640],["052",[[9216,10240],[0,4608],[4608,9363]],1185935360],["053",[[9216,10240],[4608,7168],[4608,7168]],1115289600],["054",[[9216,10240],[4608,7168],[7168,9363]],585236480],["055",[[9216,10240],[4608,9363],[0,4608]],1247825920],["056",[[9216,10240],[7168,9363],[4608,9363]],255498240],["057",[[10240,11264],[0,4608],[0,4608]],1034823680],["058",[[10240,11264],[0,4608],[4608,9363]],915281920],["059",[[10240,11264],[4608,9363],[0,4608]],1213378560],["060",[[10240,11264],[4608,9363],[4608,9363]],1442519040],["00",[[0,1024],[0,9363],[0,9363]],885186560],["11",[[11264,12288],[0,9363],[0,9363]],1106769920],["12",[[12288,12748],[0,9363],[0,9363]],1427712000]],"run":"PHerc0175A/representations/predictions/lasagna/20250521115057-lasagna-de45f011"},{"id":"PHerc0175B","repo":"SharpMeow/pherc0175b-lasagna","volume":"20250521125822-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[15897,9613,9613],"bytes":82186089634,"fix":10240,"seam":1.345,"pz":7948,"center":true,"parts":[["000",[[0,1024],[0,9613],[0,9613]],1514383360],["001",[[1024,2048],[0,5120],[0,9613]],1407938560],["002",[[1024,2048],[5120,9613],[0,9613]],3160821760],["003",[[2048,3072],[0,5120],[0,5120]],2000721920],["004",[[2048,3072],[0,5120],[5120,9613]],2044180480],["005",[[2048,3072],[5120,9613],[0,5120]],1640591360],["006",[[2048,3072],[5120,9613],[5120,9613]],1497559040],["007",[[3072,4096],[0,5120],[0,5120]],2237388800],["008",[[3072,4096],[0,5120],[5120,9613]],2131998720],["009",[[3072,4096],[5120,9613],[0,9613]],2935080960],["010",[[4096,5120],[0,5120],[0,5120]],2153451520],["011",[[4096,5120],[0,5120],[5120,9613]],1844142080],["012",[[4096,5120],[5120,9613],[0,9613]],2714398720],["013",[[5120,6144],[0,5120],[0,5120]],2108313600],["014",[[5120,6144],[0,5120],[5120,9613]],1906216960],["015",[[5120,6144],[5120,9613],[0,9613]],2691891200],["016",[[6144,7168],[0,5120],[0,5120]],2061670400],["017",[[6144,7168],[0,5120],[5120,9613]],1911951360],["018",[[6144,7168],[5120,9613],[0,9613]],2576302080],["019",[[7168,8192],[0,5120],[0,5120]],1851371520],["020",[[7168,8192],[0,5120],[5120,9613]],1717555200],["021",[[7168,8192],[5120,9613],[0,9613]],2700554240],["022",[[8192,9216],[0,5120],[0,5120]],1822607360],["023",[[8192,9216],[0,5120],[5120,9613]],1616537600],["024",[[8192,9216],[5120,9613],[0,5120]],1389537280],["025",[[8192,9216],[5120,9613],[5120,9613]],1553776640],["026",[[9216,10240],[0,5120],[0,5120]],1848739840],["027",[[9216,10240],[0,5120],[5120,9613]],1431142400],["028",[[9216,10240],[5120,9613],[0,5120]],1497989120],["029",[[9216,10240],[5120,9613],[5120,9613]],1644605440],["030",[[10240,11264],[0,5120],[0,5120]],1843128320],["031",[[10240,11264],[0,5120],[5120,9613]],1212149760],["032",[[10240,11264],[5120,9613],[0,5120]],1812940800],["033",[[10240,11264],[5120,9613],[5120,9613]],1621381120],["034",[[11264,12288],[0,5120],[0,9613]],2792785920],["035",[[11264,12288],[5120,9613],[0,5120]],1752053760],["036",[[11264,12288],[5120,9613],[5120,9613]],1498009600],["037",[[12288,13312],[0,5120],[0,9613]],2421299200],["038",[[12288,13312],[5120,9613],[0,9613]],2411141120],["039",[[13312,14336],[0,9613],[0,9613]],2876979200],["040",[[14336,15360],[0,9613],[0,9613]],816035840],["041",[[15360,15897],[0,9613],[0,9613]],1510348800]],"run":"PHerc0175B/representations/predictions/lasagna/20250521125822-lasagna-de45f011"},{"id":"PHerc0306B","repo":"SharpMeow/pherc0306b-lasagna","volume":"20250521133212-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[15898,8849,8849],"bytes":54562104779,"fix":10240,"seam":1.123,"pz":7948,"center":true,"parts":[["000",[[0,1024],[0,8849],[0,8849]],868341760],["001",[[1024,2048],[0,8849],[0,8849]],1625139200],["002",[[2048,3072],[0,8849],[0,8849]],3220418560],["003",[[3072,4096],[0,4096],[0,8849]],1915596800],["004",[[3072,4096],[4096,8849],[0,8849]],2842306560],["005",[[4096,5120],[0,4096],[0,8849]],2505390080],["006",[[4096,5120],[4096,8849],[0,8849]],2990786560],["007",[[5120,6144],[0,4096],[0,8849]],2537093120],["008",[[5120,6144],[4096,8849],[0,8849]],2867517440],["009",[[6144,7168],[0,4096],[0,8849]],2207866880],["010",[[6144,7168],[4096,8849],[0,8849]],2478387200],["011",[[7168,8192],[0,4096],[0,8849]],1837332480],["012",[[7168,8192],[4096,8849],[0,8849]],2307379200],["013",[[8192,9216],[0,4096],[0,8849]],1822986240],["014",[[8192,9216],[4096,8849],[0,8849]],2176440320],["015",[[9216,10240],[0,4096],[0,8849]],1844285440],["016",[[9216,10240],[4096,8849],[0,8849]],2145331200],["017",[[10240,11264],[0,4096],[0,8849]],1904312320],["018",[[10240,11264],[4096,8849],[0,8849]],2072791040],["019",[[11264,12288],[0,4096],[0,8849]],1891225600],["020",[[11264,12288],[4096,8849],[0,8849]],1812705280],["021",[[12288,13312],[0,4096],[0,8849]],2163097600],["022",[[12288,13312],[4096,8849],[0,8849]],1357107200],["023",[[13312,14336],[0,8849],[0,8849]],2441410560],["024",[[14336,15360],[0,8849],[0,8849]],1459896320],["025",[[15360,15898],[0,8849],[0,8849]],1263534080]],"run":"PHerc0306B/representations/predictions/lasagna/20250521133212-lasagna-de45f011"},{"id":"PHerc0483A","repo":"SharpMeow/pherc0483a-lasagna","volume":"20250521140913-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[15898,8849,8849],"bytes":47412438501,"fix":10240,"seam":1.162,"pz":7948,"center":true,"parts":[["000",[[0,1024],[0,8849],[0,8849]],953948160],["001",[[1024,2048],[0,8849],[0,8849]],2872115200],["002",[[2048,3072],[0,4096],[0,8849]],846182400],["003",[[2048,3072],[4096,8849],[0,8849]],2758737920],["004",[[3072,4096],[0,4096],[0,8849]],1158533120],["005",[[3072,4096],[4096,8849],[0,8849]],2182359040],["006",[[4096,5120],[0,4096],[0,8849]],1438115840],["007",[[4096,5120],[4096,8849],[0,8849]],2021847040],["008",[[5120,6144],[0,4096],[0,8849]],1460674560],["009",[[5120,6144],[4096,8849],[0,8849]],1818675200],["010",[[6144,7168],[0,8849],[0,8849]],2900961280],["011",[[7168,8192],[0,8849],[0,8849]],2810716160],["012",[[8192,9216],[0,8849],[0,8849]],3019837440],["013",[[9216,10240],[0,4096],[0,8849]],1343682560],["014",[[9216,10240],[4096,8849],[0,8849]],2060544000],["015",[[10240,11264],[0,4096],[0,8849]],1397544960],["016",[[10240,11264],[4096,8849],[0,8849]],2733813760],["017",[[11264,12288],[0,4096],[0,8849]],1278771200],["018",[[11264,12288],[4096,8849],[0,4096]],1464422400],["019",[[11264,12288],[4096,8849],[4096,8849]],1550018560],["020",[[12288,13312],[0,4096],[0,8849]],1111787520],["021",[[12288,13312],[4096,8849],[0,4096]],1561292800],["022",[[12288,13312],[4096,8849],[4096,8849]],1478133760],["023",[[13312,14336],[0,8849],[0,8849]],2452049920],["024",[[14336,15360],[0,8849],[0,8849]],1035386880],["025",[[15360,15898],[0,8849],[0,8849]],1698887680]],"run":"PHerc0483A/representations/predictions/lasagna/20250521140913-lasagna-de45f011"},{"id":"PHerc0483B","repo":"SharpMeow/pherc0483b-lasagna","volume":"20251124083638-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[11880,8343,8343],"bytes":41488155053,"fix":10240,"seam":1.106,"pz":5940,"center":true,"parts":[["000",[[0,1024],[0,8343],[0,8343]],176138240],["001",[[1024,2048],[0,8343],[0,8343]],1620623360],["002",[[2048,3072],[0,4096],[0,8343]],1205012480],["003",[[2048,3072],[4096,8343],[0,8343]],2147061760],["004",[[3072,4096],[0,4096],[0,8343]],1296189440],["005",[[3072,4096],[4096,8343],[0,8343]],2460006400],["006",[[4096,5120],[0,4096],[0,8343]],1599467520],["007",[[4096,5120],[4096,8343],[0,8343]],2541731840],["008",[[5120,6144],[0,4096],[0,8343]],1956659200],["009",[[5120,6144],[4096,8343],[0,8343]],2760755200],["010",[[6144,7168],[0,4096],[0,8343]],2275471360],["011",[[6144,7168],[4096,8343],[0,8343]],2689259520],["012",[[7168,8192],[0,4096],[0,8343]],2534461440],["013",[[7168,8192],[4096,8343],[0,8343]],2701701120],["014",[[8192,9216],[0,4096],[0,8343]],2829107200],["015",[[8192,9216],[4096,8343],[0,8343]],2989660160],["016",[[9216,10240],[0,4096],[0,8343]],2140211200],["017",[[9216,10240],[4096,8343],[0,8343]],2483568640],["018",[[10240,11264],[0,8343],[0,8343]],2567260160],["019",[[11264,11880],[0,8343],[0,8343]],510801920]],"run":"PHerc0483B/representations/predictions/lasagna/20251124083638-lasagna-de45f011"},{"id":"PHerc0490A","repo":"SharpMeow/pherc0490a-lasagna","volume":"20250521151210-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[11698,9101,9101],"bytes":49710517889,"fix":10240,"seam":1.184,"pz":5848,"center":true,"parts":[["000",[[0,1024],[0,9101],[0,9101]],1930536960],["001",[[1024,2048],[0,9101],[0,9101]],1422868480],["002",[[2048,3072],[0,4096],[0,9101]],2111375360],["003",[[2048,3072],[4096,9101],[0,9101]],2413690880],["004",[[3072,4096],[0,4096],[0,9101]],2379786240],["005",[[3072,4096],[4096,9101],[0,4096]],1359073280],["006",[[3072,4096],[4096,9101],[4096,9101]],1717237760],["007",[[4096,5120],[0,4096],[0,9101]],2506946560],["008",[[4096,5120],[4096,9101],[0,9101]],2644244480],["009",[[5120,6144],[0,4096],[0,9101]],2550620160],["010",[[5120,6144],[4096,9101],[0,9101]],2524825600],["011",[[6144,7168],[0,4096],[0,9101]],2422814720],["012",[[6144,7168],[4096,9101],[0,4096]],1422325760],["013",[[6144,7168],[4096,9101],[4096,9101]],1651210240],["014",[[7168,8192],[0,4096],[0,9101]],2114242560],["015",[[7168,8192],[4096,9101],[0,4096]],1600624640],["016",[[7168,8192],[4096,9101],[4096,9101]],2081792000],["017",[[8192,9216],[0,4096],[0,9101]],1961154560],["018",[[8192,9216],[4096,9101],[0,4096]],1693204480],["019",[[8192,9216],[4096,9101],[4096,9101]],2359152640],["020",[[9216,10240],[0,4096],[0,9101]],1631877120],["021",[[9216,10240],[4096,9101],[0,4096]],1850408960],["022",[[9216,10240],[4096,9101],[4096,9101]],2133708800],["023",[[10240,11264],[0,9101],[0,9101]],1912156160],["024",[[11264,11698],[0,9101],[0,9101]],1311467520]],"run":"PHerc0490A/representations/predictions/lasagna/20250521151210-lasagna-de45f011"},{"id":"PHerc0490B","repo":"SharpMeow/pherc0490b-lasagna","volume":"20250521151215-8.640um-1.2m-116keV-masked.zarr","um":8.64,"shape":[10648,8343,8343],"bytes":32900440486,"fix":10240,"seam":1.123,"pz":5324,"center":true,"parts":[["000",[[0,1024],[0,8343],[0,8343]],2058895360],["001",[[1024,2048],[0,8343],[0,8343]],822784000],["002",[[2048,3072],[0,8343],[0,8343]],2714982400],["003",[[3072,4096],[0,4096],[0,8343]],1944125440],["004",[[3072,4096],[4096,8343],[0,8343]],2514268160],["005",[[4096,5120],[0,4096],[0,8343]],2359951360],["006",[[4096,5120],[4096,8343],[0,8343]],2827724800],["007",[[5120,6144],[0,4096],[0,8343]],2485729280],["008",[[5120,6144],[4096,8343],[0,8343]],2586828800],["009",[[6144,7168],[0,4096],[0,8343]],2359173120],["010",[[6144,7168],[4096,8343],[0,8343]],2469836800],["011",[[7168,8192],[0,4096],[0,8343]],1728665600],["012",[[7168,8192],[4096,8343],[0,8343]],2325022720],["013",[[8192,9216],[0,8343],[0,8343]],2124062720],["014",[[9216,10240],[0,8343],[0,8343]],537180160],["015",[[10240,10648],[0,8343],[0,8343]],1038735360]],"run":"PHerc0490B/representations/predictions/lasagna/20250521151215-lasagna-de45f011"},{"id":"PHerc0841","repo":"SharpMeow/pherc0841-lasagna","volume":"20250821151531-9.366um-1.2m-113keV-masked.zarr","um":9.366,"shape":[19400,7703,7703],"bytes":45944867652,"fix":10240,"seam":1.622,"pz":9700,"center":false,"parts":[["000",[[0,1024],[0,7703],[0,7703]],1157713920],["001",[[1024,2048],[0,7703],[0,7703]],1659146240],["002",[[2048,3072],[0,4096],[0,7703]],2530775040],["003",[[2048,3072],[4096,7703],[0,7703]],1158072320],["004",[[3072,4096],[0,4096],[0,7703]],2732318720],["005",[[3072,4096],[4096,7703],[0,7703]],1305569280],["006",[[4096,5120],[0,4096],[0,7703]],2477383680],["007",[[4096,5120],[4096,7703],[0,7703]],1224796160],["008",[[5120,6144],[0,7703],[0,7703]],3200819200],["009",[[6144,7168],[0,7703],[0,7703]],2484510720],["010",[[7168,8192],[0,7703],[0,7703]],2356346880],["011",[[8192,9216],[0,7703],[0,7703]],2220840960],["012",[[9216,10240],[0,7703],[0,7703]],2199930880],["013",[[10240,11264],[0,7703],[0,7703]],2256486400],["014",[[11264,12288],[0,7703],[0,7703]],2268364800],["015",[[12288,13312],[0,7703],[0,7703]],2323046400],["016",[[13312,14336],[0,7703],[0,7703]],2426265600],["017",[[14336,15360],[0,7703],[0,7703]],2492456960],["018",[[15360,16384],[0,7703],[0,7703]],2691143680],["019",[[16384,17408],[0,7703],[0,7703]],2651279360],["020",[[17408,18432],[0,7703],[0,7703]],1724067840],["021",[[18432,19400],[0,7703],[0,7703]],400711680]],"run":"PHerc0841/representations/predictions/lasagna/20250821151531-lasagna-de45f011"},{"id":"PHerc0846A","repo":"SharpMeow/pherc0846a-lasagna","volume":"20250728152254-9.362um-1.2m-113keV-masked.zarr","um":9.362,"shape":[14019,7726,7726],"bytes":32441070000,"fix":10240,"seam":1.108,"pz":7008,"center":true,"parts":[["000",[[0,1024],[0,4096],[0,7726]],2497198080],["001",[[0,1024],[4096,7726],[0,7726]],2297927680],["002",[[1024,2048],[0,7726],[0,7726]],658155520],["003",[[2048,3072],[0,7726],[0,7726]],2689873920],["004",[[3072,4096],[0,4096],[0,7726]],2094336000],["005",[[3072,4096],[4096,7726],[0,7726]],1497937920],["006",[[4096,5120],[0,4096],[0,7726]],1887641600],["007",[[4096,5120],[4096,7726],[0,7726]],1414348800],["008",[[5120,6144],[0,7726],[0,7726]],2803722240],["009",[[6144,7168],[0,7726],[0,7726]],2204078080],["010",[[7168,8192],[0,7726],[0,7726]],1953495040],["011",[[8192,9216],[0,7726],[0,7726]],1988648960],["012",[[9216,10240],[0,7726],[0,7726]],2122731520],["013",[[10240,11264],[0,7726],[0,7726]],2195148800],["014",[[11264,12288],[0,7726],[0,7726]],1854883840],["015",[[12288,13312],[0,7726],[0,7726]],1597736960],["016",[[13312,14019],[0,7726],[0,7726]],680857600]],"run":"PHerc0846A/representations/predictions/lasagna/20250728152254-lasagna-de45f011"},{"id":"PHerc0846B","repo":"SharpMeow/pherc0846b-lasagna","volume":"20250804142305-9.362um-1.2m-113keV-masked.zarr","um":9.362,"shape":[13926,7859,7859],"bytes":35033335856,"fix":10240,"seam":1.36,"pz":6964,"center":true,"parts":[["000",[[0,1024],[0,7859],[0,7859]],188262400],["001",[[1024,2048],[0,7859],[0,7859]],1207982080],["002",[[2048,3072],[0,7859],[0,7859]],1744916480],["003",[[3072,4096],[0,7859],[0,7859]],1853480960],["004",[[4096,5120],[0,7859],[0,7859]],1885081600],["005",[[5120,6144],[0,7859],[0,7859]],1954447360],["006",[[6144,7168],[0,7859],[0,7859]],2012354560],["007",[[7168,8192],[0,7859],[0,7859]],2397071360],["008",[[8192,9216],[0,4096],[0,7859]],1862440960],["009",[[8192,9216],[4096,7859],[0,7859]],1379829760],["010",[[9216,10240],[0,4096],[0,7859]],2212546560],["011",[[9216,10240],[4096,7859],[0,7859]],1635399680],["012",[[10240,11264],[0,4096],[0,7859]],2502000640],["013",[[10240,11264],[4096,7859],[0,7859]],2152806400],["014",[[11264,12288],[0,4096],[0,7859]],2383554560],["015",[[11264,12288],[4096,7859],[0,7859]],2498549760],["016",[[12288,13312],[0,4096],[0,7859]],2026168320],["017",[[12288,13312],[4096,7859],[0,7859]],2171258880],["018",[[13312,13926],[0,7859],[0,7859]],962652160]],"run":"PHerc0846B/representations/predictions/lasagna/20250804142305-lasagna-de45f011"}]</script>
<script id="fieldlist" type="application/json">null</script>
<script id="coverage-list" type="application/json">null</script>
<script>
const D=JSON.parse(document.getElementById('data').textContent);
const $=id=>document.getElementById(id);
const fmt=n=>n.toLocaleString('en-US');
const gb=b=>Number.isFinite(b)&&b>=0?(b/1e9).toFixed(1)+' GB':'Size not listed';
function sizeLabel(rows){const known=rows.filter(f=>Number.isFinite(f.bytes)&&f.bytes>=0);if(!known.length)return 'Size not listed';const total=gb(known.reduce((a,f)=>a+f.bytes,0));return known.length===rows.length?total:'Known size '+total+'; remaining size not listed'}
const esc=s=>s.replace(/&/g,'&amp;').replace(/</g,'&lt;');
let cur=-1,recipeField=null;

/* theme */
(function(){/* the saved choice, or the Space page's theme, is applied in <head>, before first paint */
 $('theme').onclick=()=>{const dark=document.documentElement.dataset.theme?document.documentElement.dataset.theme==='dark':matchMedia('(prefers-color-scheme: dark)').matches;
  const n=dark?'light':'dark';document.documentElement.dataset.theme=n;try{localStorage.setItem('lf-theme',n)}catch(e){}};})();

/* hero: fields of lasagna */
(function(){const W=1600,H=900,svg=$('fields');let seed=11;const rnd=()=>(seed=(seed*16807)%2147483647)/2147483647;
 const dark=()=>document.documentElement.dataset.theme?document.documentElement.dataset.theme==='dark':matchMedia('(prefers-color-scheme: dark)').matches;
 const f1=v=>v.toFixed(1);
 function slice(x,y,s,d){/* front face top-left at x,y; s = scale */
  const w=64*s,dp=30*s,h=36*s,ox=dp*.62,oy=-dp*.5,o=[];
  const pasta=d?'#e0b860':'#f4cf73',pastaD=d?'#b88f3f':'#d9aa4f',sauce=d?'#9e2b17':'#b8351d',sauceD=d?'#7d200f':'#922814',ric=d?'#efe2c0':'#fff6dc',ricD=d?'#cdbf9c':'#eadcb6';
  const layers=[[pasta,pastaD,.12],[sauce,sauceD,.16],[ric,ricD,.12],[pasta,pastaD,.12],[sauce,sauceD,.16],[ric,ricD,.12],[pasta,pastaD,.20]];
  o.push('<ellipse cx="'+f1(x+w*.55+ox*.5)+'" cy="'+f1(y+h+2*s)+'" rx="'+f1(w*.62)+'" ry="'+f1(7*s)+'" fill="#000" opacity=".18"/>');
  let yy=y;layers.forEach(([c,cd,fr],i)=>{const t=h*fr,wav=i%3===0?2.2*s:0;
   /* side face band */
   o.push('<path d="M'+f1(x+w)+' '+f1(yy)+' L'+f1(x+w+ox)+' '+f1(yy+oy)+' L'+f1(x+w+ox)+' '+f1(yy+oy+t)+' L'+f1(x+w)+' '+f1(yy+t)+'Z" fill="'+cd+'"/>');
   /* front face band, pasta layers get a ruffled lower edge */
   let pth='M'+f1(x)+' '+f1(yy)+' L'+f1(x+w)+' '+f1(yy)+' L'+f1(x+w)+' '+f1(yy+t);
   if(wav){for(let k=12;k>=0;k--){const xx=x+w*k/12;pth+=' L'+f1(xx)+' '+f1(yy+t+(k%2?wav:-wav*.2))}}else pth+=' L'+f1(x)+' '+f1(yy+t);
   o.push('<path d="'+pth+'Z" fill="'+c+'"/>');yy+=t});
  /* ruffled pasta ends sticking out on the left */
  [0,3,6].forEach(i=>{const ty=y+h*[0,.52,.82][[0,3,6].indexOf(i)];let q='M'+f1(x)+' '+f1(ty);for(let k=0;k<=4;k++)q+=' L'+f1(x-(k%2?4.5:2)*s)+' '+f1(ty+k*1.4*s);q+=' L'+f1(x)+' '+f1(ty+6*s)+'Z';o.push('<path d="'+q+'" fill="'+(d?'#e0b860':'#f4cf73')+'"/>')});
  /* top: melted cheese with browned spots, sauce and basil */
  const top='M'+f1(x)+' '+f1(y)+' L'+f1(x+w)+' '+f1(y)+' L'+f1(x+w+ox)+' '+f1(y+oy)+' L'+f1(x+ox)+' '+f1(y+oy)+'Z';
  o.push('<path d="'+top+'" fill="'+(d?'#e7c66f':'#f7d77e')+'"/>');
  for(let i=0;i<4;i++){const u=rnd(),v=rnd();o.push('<ellipse cx="'+f1(x+u*w*.85+v*ox+4*s)+'" cy="'+f1(y+v*oy+1)+'" rx="'+f1((3+rnd()*4)*s)+'" ry="'+f1((1.4+rnd()*1.6)*s)+'" fill="'+(rnd()<.5?(d?'#a8321c':'#c2462b'):(d?'#9a6a2a':'#c98a3a'))+'" opacity=".9"/>')}
  /* cheese drips over the front edge */
  for(let i=0;i<3;i++){const dx=x+(.15+rnd()*.7)*w,dl=(3+rnd()*5)*s;o.push('<path d="M'+f1(dx-2.5*s)+' '+f1(y)+' Q'+f1(dx-2.5*s)+' '+f1(y+dl)+' '+f1(dx)+' '+f1(y+dl)+' Q'+f1(dx+2.5*s)+' '+f1(y+dl)+' '+f1(dx+2.5*s)+' '+f1(y)+'Z" fill="'+(d?'#e7c66f':'#f7d77e')+'"/>')}
  const bx=x+w*.55+ox*.5,by=y+oy*.5;o.push('<ellipse cx="'+f1(bx)+'" cy="'+f1(by)+'" rx="'+f1(6*s)+'" ry="'+f1(2.6*s)+'" fill="'+(d?'#5f8f45':'#3f7a2e')+'" transform="rotate(-18 '+f1(bx)+' '+f1(by)+')"/><ellipse cx="'+f1(bx+5*s)+'" cy="'+f1(by-1.5*s)+'" rx="'+f1(4.5*s)+'" ry="'+f1(2*s)+'" fill="'+(d?'#6fa252':'#4f8f3a')+'" transform="rotate(24 '+f1(bx+5*s)+' '+f1(by-1.5*s)+')"/>');
  return o.join('')}
 function draw(){const d=dark();seed=11;
  let h='<defs><linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">'+(d?'<stop offset="0" stop-color="#141210"/><stop offset=".55" stop-color="#2c1d18"/><stop offset="1" stop-color="#4a2a1c"/>':'<stop offset="0" stop-color="#f7f2ea"/><stop offset=".5" stop-color="#fbe8cf"/><stop offset="1" stop-color="#f9d3a8"/>')+'</linearGradient>'+
   '<linearGradient id="grass" x1="0" y1="0" x2="0" y2="1">'+(d?'<stop offset="0" stop-color="#2f3b22"/><stop offset="1" stop-color="#1d2616"/>':'<stop offset="0" stop-color="#b9cf86"/><stop offset="1" stop-color="#7fa557"/>')+'</linearGradient>'+
   '<radialGradient id="sun"><stop offset="0" stop-color="'+(d?'#ffd9a0':'#fff6dc')+'"/><stop offset="1" stop-color="#ffe2a8" stop-opacity="0"/></radialGradient></defs>';
  const hz=420;
  h+='<rect width="'+W+'" height="'+H+'" fill="url(#sky)"/><circle cx="1260" cy="300" r="170" fill="url(#sun)" opacity="'+(d?.5:.95)+'"/>';
  h+='<path d="M0 '+hz+' Q400 '+(hz-25)+' 800 '+(hz-5)+' T1600 '+(hz-15)+' L1600 900 L0 900Z" fill="url(#grass)"/>';
  /* furrows converge to a vanishing point */
  for(let i=-12;i<=24;i++){const xb=800+i*120;h+='<line x1="'+(800+i*14)+'" y1="'+hz+'" x2="'+xb+'" y2="900" stroke="'+(d?'#3b4a2b':'#a3bd72')+'" stroke-width="2" opacity=".6"/>'}
  const rows=[[440,.30,22],[470,.42,17],[512,.58,13],[570,.80,10],[650,1.08,8],[760,1.45,6],[890,1.9,5]];
  rows.forEach(([y,sc,n],r)=>{const span=W*1.15,step=span/n;for(let i=0;i<n;i++){const x=-W*.05+i*step+(r%2?step*.5:0)+(rnd()-.5)*step*.15;h+=slice(x,y-36*sc,sc,d)}});
  svg.innerHTML=h}
 draw();matchMedia('(prefers-color-scheme: dark)').addEventListener('change',draw);$('theme').addEventListener('click',()=>setTimeout(draw,0));})();

/* every field, by scroll: the list is written into the page from fields.json by the Space (null on its own) */
let F=null;try{F=JSON.parse($('fieldlist').textContent)}catch(e){}
const FL=(F&&F.fields)||[],FP=(F&&F.pending_not_public&&F.pending_not_public.items)||[];
const cosCaption=(f,view)=>(typeof f.preview_caption?.[view]==='string'?f.preview_caption[view]:'Layer pattern (cos). '+f.model+'. Vesuvius Challenge data, CC BY-NC 4.0.')+' Model output, not a reading.';
const attr=s=>esc(String(s)).replace(/"/g,'&quot;');
const uniq=a=>a.filter((v,i)=>a.indexOf(v)===i);
const um=v=>(+v).toLocaleString('en-US',{maximumFractionDigits:3})+' 碌m';
const lvl=f=>f.read_level?'read at level '+f.read_level+', '+(f.voxel_um*Math.pow(2,f.read_level)).toFixed(1)+' 碌m':'read at full resolution';
const chip=m=>'<span class="mp '+(m.indexOf('Lasagnetta')===0?'lgt':'villa')+'">'+esc(m)+'</span>';
let fm='',fq='',fw='',fv='cards',pv=null,pvReturnFocus=null;
const openSc=new Set();
function links(f){const od=f.source==='open-data';
 return '<a href="'+attr(f.browse||f.url)+'" target="_blank" rel="noopener" title="'+(od?'its run folder in the Vesuvius Challenge open data':'its Hugging Face dataset, to download')+'">Dataset</a>'+
  '<a href="'+attr(f.manifest)+'" target="_blank" rel="noopener" title="the lasagna.json the lasagna fit reads">Manifest</a>'+
  '<button type="button" data-pv="'+FL.indexOf(f)+'"'+(!f.preview_xy&&!f.preview_xz?' disabled':'')+' title="'+(f.preview_xy||f.preview_xz?(f.preview_kind==='cos'?'Layer pattern (cos)':'cos and normals, through the middle and along the scroll'):'Preview not listed')+'">Preview</button>'+
  '<button type="button" data-url="'+attr(f.stream)+'" title="the run folder, which zarr reads by URL">Copy URL</button>'}
function fieldRow(f,first,n){
 const where=f.source==='open-data'?'Open data<span class="fnote">villa\'s run</span>':'SharpMeow dataset<span class="fnote">also in the public bucket</span>';
 return '<tr>'+(first?'<td class="sc" rowspan="'+n+'">'+esc(f.scroll)+'</td>':'')+
  '<td data-k="Volume"><span class="mono">'+esc(f.volume)+'</span></td>'+
  '<td data-k="Voxel size" class="num">'+um(f.voxel_um)+'<span class="fnote">'+lvl(f)+'</span></td>'+
  '<td data-k="Model" class="mdl">'+chip(f.model)+(f.note?'<span class="fnote">'+esc(f.note)+'</span>':'')+'</td>'+
  '<td data-k="Where">'+where+'</td><td data-k="Size" class="num">'+gb(f.bytes)+'</td>'+
  '<td class="get"><div class="flinks">'+links(f)+'</div></td></tr>'}
function thumbOf(g){const f=g.find(x=>x.preview_xy||x.preview_xz)||g[0];return {src:f.preview_xy||f.preview_xz?(f.preview_thumb||f.preview_xy||f.preview_xz):null,alt:f.preview_xy||f.preview_xz||'',vol:f.volume,field:f}}
let sampleTypes=new Map();
try{sampleTypes=new Map(JSON.parse(document.getElementById('coverage-list').textContent).samples.map(s=>[s.scroll,s.sample_type]))}catch(_){}
function fieldCountLabel(rows){
 const counts={scroll:0,fragment:0,sample:0};
 for(const name of new Set(rows.map(f=>f.scroll))){const type=sampleTypes.get(name);counts[type==='scroll'||type==='fragment'?type:'sample']++}
 return [rows.length+' field'+(rows.length===1?'':'s'),...Object.entries(counts).filter(([,n])=>n).map(([kind,n])=>n+' '+(kind==='sample'?'other sample':kind)+(n===1?'':'s'))].join(' 路 ');
}
const srcOf=f=>f.source==='open-data'?'open data':'SharpMeow';
/* one field of a card: its voxel size and volume, model and source, the four links, and its note */
function cardLine(f,size){
 return '<li><div class="l1"><b>'+um(f.voxel_um)+'</b><span class="mono">'+esc(f.volume)+'</span>'+(size?'<span class="sz">'+gb(f.bytes)+'</span>':'')+'</div>'+
  '<div class="l2">'+chip(f.model)+'<span class="fnote">'+srcOf(f)+(f.read_level?', level '+f.read_level:'')+'</span></div>'+
  '<div class="flinks">'+links(f)+'</div>'+
  (f.note?'<div class="why">'+esc(f.note)+'</div>':'')+'</li>'}
/* a card's summary when it holds more than one field: its models, voxel sizes and sources */
function summary(g){
 const ms=uniq(g.map(f=>f.model)).map(m=>{const k=g.filter(f=>f.model===m).length;return '<span class="mp '+(m.indexOf('Lasagnetta')===0?'lgt':'villa')+'"><b>'+k+'</b>'+esc(m)+'</span>'}).join('');
 const v=uniq(g.map(f=>+f.voxel_um)).sort((a,b)=>a-b).map(x=>um(x).replace(' 碌m',''));
 const vs=(v.length>2?v[0]+' to '+v[v.length-1]:v.join(' and '))+' 碌m';
 return '<div class="sum">'+ms+'<span class="dim">'+vs+' &middot; '+uniq(g.map(srcOf)).join(' and ')+'</span></div>'}
function card(g){const t=thumbOf(g),n=g.length,sc=g[0].scroll;
 const cosOnly=t.field.preview_kind==='cos';
 const img=t.src?'<img loading="lazy" src="'+attr(t.src)+'" data-alt="'+attr(t.alt)+'" alt="'+attr(sc)+' field preview, '+(cosOnly?'Layer pattern (cos), '+attr(t.field.model):'cos and normals')+'" onerror="if(this.dataset.alt){this.src=this.dataset.alt;this.dataset.alt=\'\'}else{this.hidden=true;this.parentElement.textContent=\'Preview unavailable\'}"><span class="tag">'+(cosOnly?'cos':'cos | normals')+'</span>':'<span class="human-no-preview">Preview not listed</span>';
 const open=openSc.has(sc)||(fq.trim()!=='');
 const foot=n===1?'<div class="foot one"><ul>'+cardLine(g[0],false)+'</ul></div>'
  :'<details class="foot more" data-sc="'+attr(sc)+'"'+(open?' open':'')+'><summary>Show the '+n+' fields and their links</summary><ul>'+g.map(f=>cardLine(f,true)).join('')+'</ul></details>';
 const thumb=t.src?'<button class="thumb" type="button" data-pv="'+FL.indexOf(t.field)+'" aria-label="Preview '+attr(sc)+' acquisition '+attr(t.vol)+'">'+img+'</button>':'<div class="thumb">'+img+'</div>';
 return '<article class="sccard">'+thumb+'<div class="body"><div class="hd"><h3>'+esc(sc)+'</h3><span class="cnt">'+n+(n===1?' field':' fields')+' &middot; '+sizeLabel(g)+'</span></div>'+(n>1?summary(g):'')+'</div>'+foot+'</article>'}
function drawFields(){
 const t=$('flist');t.querySelectorAll('tbody').forEach(b=>b.remove());
 $('fcards').hidden=fv!=='cards';$('ftable').hidden=fv!=='table';
 if(!F){t.insertAdjacentHTML('beforeend','<tbody><tr><td colspan="7" class="fempty">The list is filled in on the Space: <a href="https://huggingface.co/spaces/SharpMeow/lasagna-fields">huggingface.co/spaces/SharpMeow/lasagna-fields</a>.</td></tr></tbody>');
  $('fcards').innerHTML='<p class="fempty">The list is filled in on the Space: <a href="https://huggingface.co/spaces/SharpMeow/lasagna-fields">huggingface.co/spaces/SharpMeow/lasagna-fields</a>.</p>';return}
 const q=fq.trim().toLowerCase();
 const rows=FL.filter(f=>(!fm||f.model===fm)&&(!fw||f.source===fw)&&(!q||f.scroll.toLowerCase().indexOf(q)>=0||f.volume.indexOf(q)>=0));
 const groups=uniq(rows.map(f=>f.scroll)).map(s=>rows.filter(f=>f.scroll===s));
 t.insertAdjacentHTML('beforeend',groups.length?groups.map(g=>'<tbody>'+g.map((f,i)=>fieldRow(f,i===0,g.length)).join('')+'</tbody>').join(''):'<tbody><tr><td colspan="7" class="fempty">No field matches.</td></tr></tbody>');
 $('fcards').innerHTML=groups.length?groups.map(card).join(''):'<p class="fempty">No field matches.</p>';
 $('fcards').querySelectorAll('details.more').forEach(d=>d.addEventListener('toggle',()=>{if(d.open)openSc.add(d.dataset.sc);else openSc.delete(d.dataset.sc)}));
 $('fcount').textContent=fieldCountLabel(rows);}
document.querySelectorAll('[data-fw]').forEach(b=>b.onclick=()=>{fw=b.dataset.fw;document.querySelectorAll('[data-fw]').forEach(x=>x.setAttribute('aria-pressed',x===b));drawFields()});
document.querySelectorAll('[data-fv]').forEach(b=>b.onclick=()=>{fv=b.dataset.fv;document.querySelectorAll('[data-fv]').forEach(x=>x.setAttribute('aria-pressed',x===b));drawFields()});
document.querySelectorAll('[data-fm]').forEach(b=>b.onclick=()=>{fm=b.dataset.fm;document.querySelectorAll('[data-fm]').forEach(x=>x.setAttribute('aria-pressed',x===b));drawFields()});
$('fq').oninput=()=>{fq=$('fq').value;drawFields()};
['flist','fcards'].forEach(id=>$(id).addEventListener('click',e=>{const b=e.target.closest('button');if(!b)return;
 if(b.dataset.pv){openPv(FL[+b.dataset.pv],'xy');return}
 if(b.dataset.url){const t=b.dataset.url,done=()=>{b.textContent='Copied';toastOn();setTimeout(()=>{b.textContent='Copy URL';$('toast').classList.remove('on')},1200)};
  if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(done,()=>fallback(t,done));else fallback(t,done)}}));
/* preview: the field's two pictures in a box over the page (no scrolling of its own) */
/* inside the Space the guide's frame is as tall as the guide and the page scrolls, so a fixed box would sit in the
   middle of the whole frame: place the box and the toast in the part of the frame that is on screen */
function onScreen(){let fe=null;try{fe=window.frameElement}catch(e){}
 if(!fe)return null;
 const r=fe.getBoundingClientRect(),vv=parent.visualViewport;
 // Intersect the frame's content box with the visible parent viewport, in CSS pixels.
 const sx=r.width/fe.offsetWidth||1,sy=r.height/fe.offsetHeight||1;
 const x=r.left+fe.clientLeft*sx,y=r.top+fe.clientTop*sy;
 const vx=vv?vv.offsetLeft:0,vy=vv?vv.offsetTop:0;
 const left=Math.max(x,vx),top=Math.max(y,vy);
 const right=Math.min(x+fe.clientWidth*sx,vx+(vv?vv.width:parent.innerWidth));
 const bottom=Math.min(y+fe.clientHeight*sy,vy+(vv?vv.height:parent.innerHeight));
 return {left:window.scrollX+(left-x)/sx,top:window.scrollY+(top-y)/sy,
  w:Math.max(0,right-left)/sx,h:Math.max(0,bottom-top)/sy}}
function placeLb(){const L=$('lbox'),v=onScreen();if(!v)return;
 L.style.position='absolute';L.style.top=v.top+'px';L.style.left=v.left+'px';
 L.style.right='auto';L.style.bottom='auto';L.style.width=v.w+'px';L.style.height=v.h+'px';
 const style=getComputedStyle(L),padding=parseFloat(style.paddingTop)+parseFloat(style.paddingBottom);
 L.querySelector('.lbpanel').style.maxHeight=Math.max(0,v.h-padding)+'px'}
function toastOn(){const T=$('toast'),v=onScreen();if(v){T.style.position='absolute';T.style.bottom='auto';T.style.top=(v.top+v.h-64)+'px'}T.classList.add('on')}
const refreshLb=()=>{if(!$('lbox').hidden)placeLb()};
window.addEventListener('resize',refreshLb,{passive:true});
try{parent.addEventListener('scroll',refreshLb,{passive:true});parent.addEventListener('resize',refreshLb,{passive:true});
 if(parent.visualViewport){parent.visualViewport.addEventListener('resize',refreshLb,{passive:true});parent.visualViewport.addEventListener('scroll',refreshLb,{passive:true})}}catch(e){}
const failedPreviews=new Set();
function smoothedPreview(f,view){
 const original=f?.['preview_'+view],value=f?.preview_smoothed?.[view];
 if(!original||f.preview_kind==='cos'||typeof value!=='string'||!/^https:\/\//.test(value))return null;
 try{const raw=new URL(original,location.href),smooth=new URL(value);raw.hash='';smooth.hash='';
  return raw.href!==smooth.href?value:null}catch(e){return null}}
function previewDisplay(prefix,f,view,mode){const smooth=smoothedPreview(f,view),failed=failedPreviews.has(smooth),active=smooth&&!failed&&mode==='smoothed'?'smoothed':'original';
 $(prefix+'-display').hidden=!smooth;
 for(const choice of ['original','smoothed'])$(prefix+'-'+choice).setAttribute('aria-pressed',String(choice===active));
 $(prefix+'-smoothed').disabled=failed;
 $(prefix+'-display-note').textContent=!f?'':failed?'Smoothed preview could not load. Showing Original.':active==='smoothed'?'Smoothed preview. Display only; downloads are unchanged.':smooth?'Original preview. Downloads are unchanged.':'Original preview. Smoothing is not available for this view.';
 return active==='smoothed'?smooth:f?.['preview_'+view]}
function loadPreview(prefix,f,view,mode){
 const image=$(prefix==='human'?'human-image':'lbimg'),empty=$(prefix==='human'?'human-empty':'lbempty');
 const source=previewDisplay(prefix,f,view,mode),request={};image.previewRequest=request;
 image.hidden=true;image.removeAttribute('src');empty.hidden=false;
 empty.textContent=source?'Loading the published preview...':'No preview image is listed for this view. Published access links remain available.';
 if(!source)return;
 // A separate loader keeps late responses from an earlier field or mode out of the current view.
 const loader=new Image();
 loader.onload=()=>{if(image.previewRequest!==request)return;image.src=source;image.hidden=false;empty.hidden=true};
 loader.onerror=()=>{if(image.previewRequest!==request)return;
  if(source===smoothedPreview(f,view)){failedPreviews.add(source);loadPreview(prefix,f,view,mode);return}
  empty.textContent='This preview could not load. Published access links remain available.';
  $(prefix+'-display-note').textContent='Preview unavailable.';
  for(const choice of ['original','smoothed'])$(prefix+'-'+choice).setAttribute('aria-pressed','false')};
 loader.src=source;
}
let pvMode='smoothed',pvView='xy';
function openPv(f,view,mode){if(!f.preview_xy&&!f.preview_xz)return;if(!f['preview_'+view])view=f.preview_xy?'xy':'xz';if(pv!==f)pvMode='smoothed';if(mode)pvMode=mode;pv=f;pvView=view;const L=$('lbox');
 loadPreview('lb',f,view,pvMode);
 $('lbimg').alt=f.scroll+' '+f.volume+' '+view+' preview, '+(f.preview_kind==='cos'?'Layer pattern (cos), '+f.model:'cos and normals');
 $('lbcaption').textContent=f.preview_kind==='cos'?cosCaption(f,view):'Model output: cos (one band per papyrus layer) beside the surface normals as color.';
 $('lbtitle').textContent=f.scroll+' 路 '+um(f.voxel_um)+' 路 '+f.volume;
 document.querySelectorAll('[data-lv]').forEach(x=>{x.setAttribute('aria-pressed',x.dataset.lv===view);x.disabled=!f['preview_'+x.dataset.lv]});
 $('lbslice').hidden=regionBundle(f)<0;
 if(L.hidden){pvReturnFocus=document.activeElement;L.hidden=false;placeLb();document.documentElement.classList.add('lbopen');$('lbclose').focus({preventScroll:true})}}
function closePv(){if($('lbox').hidden)return;$('lbox').hidden=true;document.documentElement.classList.remove('lbopen');$('lbimg').previewRequest=null;$('lbimg').removeAttribute('src');pv=null;
 const target=pvReturnFocus?.isConnected&&pvReturnFocus.getClientRects().length?pvReturnFocus:$('human-search');pvReturnFocus=null;target.focus({preventScroll:true})}
document.querySelectorAll('[data-lv]').forEach(b=>b.onclick=()=>pv&&openPv(pv,b.dataset.lv));
for(const mode of ['original','smoothed'])$('lb-'+mode).onclick=()=>{if(pv){pvMode=mode;openPv(pv,pvView)}};
$('lbclose').onclick=closePv;
$('lbox').addEventListener('click',e=>{if(e.target===$('lbox'))closePv()});
document.addEventListener('keydown',e=>{const dialog=$('lbox');if(dialog.hidden)return;
 if(e.key==='Escape'){e.preventDefault();closePv();return}
 if(e.key==='Tab'){const items=[...dialog.querySelectorAll('button:not([disabled]),a[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')].filter(n=>n.getClientRects().length);
  const first=items[0],last=items[items.length-1];if(!first)return;
  if(e.shiftKey&&(document.activeElement===first||!dialog.contains(document.activeElement))){e.preventDefault();last.focus()}
  else if(!e.shiftKey&&(document.activeElement===last||!dialog.contains(document.activeElement))){e.preventDefault();first.focus()}}});
$('lbslice').onclick=()=>{const f=pv;closePv();document.dispatchEvent(new CustomEvent('lasagna-select-field',{detail:f}));$('human-use').open=true;$('human-region-recipe').open=true;$('use').scrollIntoView({behavior:'smooth'})};
/* the volumes being made: shown without any link until each is public (fields.json, pending_not_public) */
if(FP.length){$('pend').hidden=false;
 $('pend').innerHTML='<h3>Being made now, not public yet</h3><p class="sub" style="margin-bottom:14px">Lasagnetta 0.1.1 fields for more volumes of scrolls in the list. None is public yet, so there is nothing to download or stream.</p>'+
  '<div class="tablewrap"><table class="flist"><thead><tr><th>Scroll</th><th>Volume</th><th>Voxel size</th><th>Model</th><th>Status</th></tr></thead><tbody>'+
  FP.map(f=>'<tr><td class="sc">'+esc(f.scroll)+'</td><td data-k="Volume"><span class="mono">'+esc(f.volume)+'</span></td><td data-k="Voxel size" class="num">'+um(f.voxel_um)+'<span class="fnote">'+lvl(f)+'</span></td><td data-k="Model"><span class="mp lgt">'+esc(f.model)+'</span></td><td data-k="Status"><span class="mp soon">not public yet</span></td></tr>').join('')+'</tbody></table></div>';}
drawFields();

/* stats */
const totB=D.reduce((a,s)=>a+s.bytes,0),totP=D.reduce((a,s)=>a+s.parts.length,0);
const ours=FL.filter(f=>f.source==='dataset'),nsc=uniq(FL.map(f=>f.scroll)).filter(name=>sampleTypes.get(name)==='scroll').length;
$('stats').innerHTML=(FL.length?[[nsc,'scrolls'],[uniq(FL.map(f=>f.scroll)).filter(name=>sampleTypes.get(name)==='fragment').length,'fragments'],[FL.length-ours.length,'villa fields in the open data'],[ours.length,'fields made here'],[sizeLabel(ours),'listed download size']]
 :[[D.length,'original hosted bundles'],[Math.round(totB/1e9)+' GB','to download'],[fmt(totP),'GPU parts'],['4','channels each']])
 .map(([b,s])=>'<div class="stat"><b>'+b+'</b><span>'+s+'</span></div>').join('');
$('nscrolls').textContent=FL.length?nsc:D.length;
$('mparts').textContent=fmt(totP);

/* The original part maps apply only to their exact hosted field, not every catalog entry. */
const BUCKET='https://huggingface.co/buckets/SharpMeow/lasagna-fields/resolve/';
function regionBundle(f) {
 const d=f?.normals_access?.download;
 if(d?.kind!=='hf_dataset_bundle'||!/^[a-f0-9]{40}$/.test(d.revision||''))return -1;
 return D.findIndex(s=>s.id===f.scroll && s.volume.slice(0,14)===f.volume && s.repo===d.dataset_id &&
  BUCKET+s.run===f.stream && s.run.split('/').pop()===f.run &&
  d.finalize_archives?.some(a=>a.path===s.id+'-lasagna-pyramid-fix.tar'));
}
function setRegionField(f) {
 cur=regionBundle(f);recipeField=cur>=0?f:null;
 $('human-region-recipe').hidden=cur<0;$('human-region-recipe').open=false;
 for(const id of ['rsync','rcode','rres','map'])$(id).textContent='';
 if(cur>=0)regionReset();
}

/* region picker */
const R={z:0,y:0,x:0};
function center(s){return [Math.round(s.pz/64)*64,Math.round(s.shape[1]/2),Math.round(s.shape[2]/2)]}
function regionReset(){const s=D[cur];[R.z,R.y,R.x]=center(s);$('zr').max=s.shape[0]-1;drawRegion()}
function need(s,r){const lo=[R.z-r,R.y-r,R.x-r],hi=[R.z+r,R.y+r,R.x+r];
 return s.parts.filter(p=>p[1].every((c,k)=>c[0]<hi[k]&&c[1]>lo[k]))}
function drawRegion(){const s=D[cur];if(!s||!recipeField)return;const r=Math.max(1,+$('rr').value||512);
 const clamp=(v,k)=>Math.max(0,Math.min(s.shape[k]-1,Math.round(v)));R.z=clamp(R.z,0);R.y=clamp(R.y,1);R.x=clamp(R.x,2);
 $('rz').value=R.z;$('ry').value=R.y;$('rx').value=R.x;$('zr').value=R.z;$('zv').textContent=fmt(R.z);
 const W=400,sc=W/Math.max(s.shape[1],s.shape[2]),H=Math.round(s.shape[1]*sc);
 const m=$('map');m.setAttribute('viewBox','0 0 '+W+' '+H);
 const nd=new Set(need(s,r).map(p=>p[0]));
 let h='<rect x="0" y="0" width="'+(s.shape[2]*sc)+'" height="'+H+'" fill="var(--card)" stroke="var(--line)"/>';
 s.parts.filter(p=>p[1][0][0]<=R.z&&R.z<p[1][0][1]).forEach(p=>{const[ , y,x]=p[1];const on=nd.has(p[0]);
  h+='<rect x="'+(x[0]*sc+1)+'" y="'+(y[0]*sc+1)+'" width="'+((x[1]-x[0])*sc-2)+'" height="'+((y[1]-y[0])*sc-2)+'" rx="4" fill="'+(on?'var(--accent)':'var(--bg2)')+'" fill-opacity="'+(on?.28:1)+'" stroke="'+(on?'var(--accent)':'var(--ink3)')+'" stroke-opacity="'+(on?1:.5)+'"/>'+
     '<text x="'+((x[0]+x[1])/2*sc)+'" y="'+((y[0]+y[1])/2*sc+4)+'" text-anchor="middle" font-size="11" font-family="JetBrains Mono,monospace" fill="var(--ink2)">t'+p[0]+'</text>'});
 h+='<rect x="'+((R.x-r)*sc)+'" y="'+((R.y-r)*sc)+'" width="'+(2*r*sc)+'" height="'+(2*r*sc)+'" fill="none" stroke="var(--ink)" stroke-width="1.5" stroke-dasharray="4 3"/><circle cx="'+(R.x*sc)+'" cy="'+(R.y*sc)+'" r="4" fill="var(--ink)"/>';
 m.innerHTML=h;m.dataset.sc=sc;
 const parts=need(s,r),bytes=parts.reduce((a,p)=>a+p[2],0)+s.fix,d=s.id.toLowerCase()+'-'+R.z+'-'+R.y+'-'+R.x;
 $('rres').innerHTML=s.id+': your box touches <b>'+parts.length+'</b> of '+s.parts.length+' parts, <b>'+gb(bytes)+'</b> instead of '+gb(s.bytes)+'.<br>'+parts.map(p=>'<span class="pill">t'+p[0]+'</span>').join('');
 const lo=[R.z-r,R.y-r,R.x-r].map(v=>Math.max(0,v)),hi=[R.z+r,R.y+r,R.x+r].map((v,k)=>Math.min(s.shape[k]-1,v));
 const rows=f=>{const zs=[];for(let z=Math.floor(lo[0]/f);z<=Math.floor(hi[0]/f);z++)zs.push(z);return zs};
 const inc=['"*.json"','"*/.z*"'];
 [['cos',1,128],['grad_mag',2,256],['nx',2,256],['ny',2,256]].forEach(([ch,l,f])=>rows(f).forEach(z=>inc.push('"*_'+ch+'.ome.zarr/'+l+'/'+z+'/*"')));
 $('rsync').innerHTML='<span class="c"># from the bucket: the full planes for your z range (cos level 1, the rest level 2)</span>\nhf buckets sync hf://buckets/SharpMeow/lasagna-fields/'+s.run+' '+d+' \\\n  '+inc.map(i=>'--include '+i).join(' \\\n  ');
 const files=parts.map(p=>'parts/'+s.id+'-lasagna-t'+p[0]+'.tar').concat([s.id+'-lasagna-pyramid-fix.tar','SHA256SUMS','load_example.py']);
 $('rcode').innerHTML='<span class="c"># or from the dataset: whole parts for z, y, x = '+R.z+', '+R.y+', '+R.x+' 卤 '+r+' voxels</span>\nhf download '+s.repo+' \\\n  '+files.join(' \\\n  ')+' \\\n  --repo-type dataset --revision '+recipeField.normals_access.download.revision+' --local-dir '+d+'\ncd '+d+' && sha256sum -c --ignore-missing SHA256SUMS\nfor f in parts/*.tar; do tar -xf "$f"; done\ntar -xf '+s.id+'-lasagna-pyramid-fix.tar';
}
['rz','ry','rx'].forEach((id,k)=>$(id).oninput=()=>{R['zyx'[k]]=+$(id).value||0;drawRegion()});
$('rr').oninput=drawRegion;$('zr').oninput=()=>{R.z=+$('zr').value;drawRegion()};
function mapAt(e){const m=$('map'),b=m.getBoundingClientRect(),vb=m.viewBox.baseVal,sc=+m.dataset.sc;
 R.x=(e.clientX-b.left)/b.width*vb.width/sc;R.y=(e.clientY-b.top)/b.height*vb.height/sc;drawRegion()}
let drag=false;$('map').onpointerdown=e=>{drag=true;mapAt(e)};addEventListener('pointerup',()=>drag=false);$('map').onpointermove=e=>{if(drag)mapAt(e)};

/* copy */
document.addEventListener('click',e=>{const b=e.target.closest('.copy');if(!b)return;
 const t=$(b.dataset.copy).textContent;const done=()=>{b.textContent='Copied';toastOn();setTimeout(()=>{b.textContent='Copy';$('toast').classList.remove('on')},1200)};
 if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(done,()=>fallback(t,done));else fallback(t,done)});
function fallback(t,done){const a=document.createElement('textarea');a.value=t;document.body.appendChild(a);a.select();try{document.execCommand('copy');done()}catch(e){}a.remove()}

</script>
<script>
/* Presentation only. Catalog browsing and link copying never call scientific endpoints. */
(() => {
  let coverage = {};
  try { coverage = JSON.parse(document.getElementById('coverage-list').textContent) || {}; } catch (_) {}
  const samples = coverage.samples || [];
  const names = [...new Set([...FL.map(f => f.scroll), ...samples.map(s => s.scroll)])].sort();
  const el = id => document.getElementById('human-' + id);
  const normalize = value => String(value || '').trim().toUpperCase().replace(/^PHERC[.\s_-]*/, '').replace(/[\s_.-]+/g, '').replace(/^0+(?=\d)/, '');
  let selected = null, direction = 'xy';
  const url = value => { try { const u = new URL(value); return u.protocol === 'https:' ? u.href : null; } catch (_) { return null; } };
  const manifestOf = f => f && url(f.normals_access?.manifest_url || f.manifest);
  const fieldId = f => manifestOf(f) || '';
  const rowsFor = () => FL.filter(f => f.scroll === el('scroll').value && f.volume === el('volume').value);
  function options(node, values, placeholder = null) {
    const items = placeholder === null ? values : [['',placeholder], ...values];
    node.replaceChildren(...items.map(([value,label]) => { const o = document.createElement('option'); o.value = value; o.textContent = label; return o; }));
    node.disabled = !values.length;
  }
  function notice(message = '') { el('link-note').textContent = message; el('link-note').hidden = !message; }
  function link(node, value) { const href = url(value); node.hidden = !href; if (href) node.href = href; else node.removeAttribute('href'); }
  function normals(f) {
    const a = f?.normals_access;
    if (a) return {nx:url(a.channels?.nx?.array_url), ny:url(a.channels?.ny?.array_url)};
    const arrays = f?.availability?.arrays;
    return {nx:url(arrays?.nx?.url), ny:url(arrays?.ny?.url)};
  }
  function arrayMetadataURL(value) {
    const address=new URL(value);
    address.pathname=address.pathname.replace(/\/+$/,'')+'/.zarray';
    return address.href;
  }
  function dataLinks(f) {
    if (!f) return [];
    const a=f.normals_access || {}, d=a.download || {}, n=normals(f), rows=[];
    const add=(key,label,format,value,kind)=>{const href=url(value);if(href)rows.push({key,label,format,href,openHref:kind==='zarr'?arrayMetadataURL(href):href,kind});};
    for (const [key,label] of [['nx','Normals (nx)'],['ny','Normals (ny)'],['cos','Layer pattern (cos)'],['grad_mag','Gradient magnitude']]) {
      const array=f.availability?.arrays?.[key];
      add(key,label,'Zarr array',key==='nx'||key==='ny'?n[key]:array?.url,'zarr');
    }
    let source=d.folder_url || d.page_url || f.browse || f.url;
    // A pinned file browser for a cataloged HF bundle; no archive paths are guessed.
    if (d.kind==='hf_dataset_bundle' && /^[\w.-]+\/[\w.-]+$/.test(d.dataset_id || '') && /^[a-f0-9]{40}$/.test(d.revision || ''))
      source='https://huggingface.co/datasets/'+d.dataset_id+'/tree/'+d.revision;
    add('source',d.kind==='hf_dataset_bundle'?'Field bundle files':'Published source',d.kind==='hf_dataset_bundle'?'File browser 路 TAR parts':'Folder browser',source,'source');
    add('index','Bundle index','JSON file',d.index_url,'file');
    add('checksums','Checksums','SHA256SUMS text file',d.checksums_url,'file');
    for (const [i,archive] of (d.finalize_archives || []).entries())
      add('final-'+i,'Final metadata / pyramid archive','TAR file 路 unpack after all parts',archive.url,'file');
    add('manifest','Field manifest','JSON file',manifestOf(f),'file');
    return rows;
  }
  function fieldRecipes(f) {
    const rows=dataLinks(f), arrays=rows.filter(row=>row.kind==='zarr'), d=f?.normals_access?.download || {};
    const title=f?[f.scroll,f.volume,f.model].filter(Boolean).join(' 路 '):'No published field selected.';
    const python=arrays.length?['# Install: python -m pip install "zarr>=3" fsspec aiohttp','import zarr','',
      'urls = '+JSON.stringify(Object.fromEntries(arrays.map(row=>[row.key,row.href])),null,4),
      'for channel, url in urls.items():','    array = zarr.open_array(url, mode="r")',
      '    print(channel, array.shape, array.chunks)',
      '# Use the field manifest for coordinate scales and normal decoding.'].join('\n'):'';
    const final=d.finalize_archives || [], quote=value=>"'"+String(value).replace(/'/g,"'\\''")+"'";
    const bundle=d.kind==='hf_dataset_bundle' && /^[\w.-]+\/[\w.-]+$/.test(d.dataset_id || '') &&
      /^[a-f0-9]{40}$/.test(d.revision || '') && url(d.index_url) && url(d.checksums_url) && final.length &&
      final.every(a=>url(a.url) && /^[\w./-]+\.tar$/.test(a.path || '') && !a.path.startsWith('/') && !a.path.split('/').includes('..'));
    const folder=bundle?d.dataset_id.split('/')[1]+'-'+d.revision.slice(0,8):'';
    const download=bundle?['# Install: python -m pip install -U huggingface_hub',
      'hf download '+quote(d.dataset_id)+' --repo-type dataset --revision '+quote(d.revision)+' --local-dir '+quote(folder),
      'cd '+quote(folder),'shasum -a 256 -c SHA256SUMS',
      'for part in parts/*.tar; do tar -xf "$part"; done',
      '# Unpack these last, after all parts:',...final.map(a=>'tar -xf '+quote(a.path))].join('\n'):'';
    return {title,python,download};
  }
  function showRecipes(f) {
    const recipe=fieldRecipes(f);
    el('recipe-selection').textContent=recipe.title;
    el('stream-recipe').hidden=!recipe.python;el('stream-code').textContent=recipe.python;
    el('bundle-recipe').hidden=!recipe.download;el('bundle-code').textContent=recipe.download;
    el('bundle-help').textContent=recipe.download?'Downloads all files at the recorded dataset revision. Check the checksums, unpack the parts, then unpack the final metadata / pyramid archive last.':'';
    el('no-bundle').hidden=Boolean(recipe.download);
    el('no-bundle').textContent=f?'No complete archive recipe is listed for this field. Use its Zarr URLs or published source above.':'Choose a published field above to see its recipes.';
    setRegionField(f);
  }
  function showDataLinks(f) {
    const rows=dataLinks(f), d=f?.normals_access?.download || {};
    el('quick-links').replaceChildren(...rows.filter(row=>row.kind==='zarr'||row.key==='source').map(row=>{
      const line=document.createElement('div');line.className='human-quick-row';line.dataset.key=row.key;
      const name=document.createElement('span');name.textContent=row.kind==='zarr'?row.label:d.kind==='hf_dataset_bundle'?'TAR bundle files':'Source files';
      const open=document.createElement('a');open.href=row.openHref;open.target='_blank';open.rel='noopener';open.textContent='Open';open.setAttribute('aria-label','Open '+row.label);
      const button=document.createElement('button');button.type='button';button.textContent='Copy URL';button.setAttribute('aria-label','Copy URL for '+row.label);
      button.onclick=async()=>{const ok=await copy(row.href,row.label+' URL copied.');button.textContent=ok?'Copied':'Select URL below';setTimeout(()=>{button.textContent='Copy URL';},1600);};
      line.append(name,open,button);return line;
    }));
    el('data-selection').textContent=f?[f.scroll,f.volume,f.model].filter(Boolean).join(' 路 '):'Choose a published field to see its links.';
    el('download-help').textContent=d.kind==='hf_dataset_bundle'?
      'For a complete local field, download all '+(Number.isInteger(d.parts_count)?d.parts_count+' ':'')+'parts listed in the bundle index, then unpack the final archive last. The final archive alone is not the field.':
      'Use the Zarr arrays above or browse the published source. No single-file field download is listed.';
    for (const group of ['arrays','files']) {
      const list=rows.filter(row=>(row.kind==='zarr')===(group==='arrays'));
      el('data-'+group).replaceChildren(...list.map(row=>{
        const card=document.createElement('div');card.className='human-data-row';card.dataset.key=row.key;
        const title=document.createElement('strong');title.textContent=row.label;
        const format=document.createElement('small');format.textContent=row.format;
        const actions=document.createElement('div');actions.className='human-data-actions';
        const open=document.createElement('a');open.href=row.openHref;open.target='_blank';open.rel='noopener';open.textContent='Open';open.setAttribute('aria-label','Open '+row.label);
        const button=document.createElement('button');button.type='button';button.textContent='Copy URL';button.setAttribute('aria-label','Copy URL for '+row.label);
        button.onclick=async()=>{const ok=await copy(row.href,row.label+' URL copied.');button.textContent=ok?'Copied':'Select URL';setTimeout(()=>{button.textContent='Copy URL';},1600);};
        const address=document.createElement(row.kind==='zarr'?'code':'a');address.className='human-data-url';address.textContent=row.href;
        if(row.kind!=='zarr'){address.href=row.href;address.target='_blank';address.rel='noopener';}
        actions.append(open,button);card.append(title,format,actions,address);return card;
      }));
      if (!list.length) el('data-'+group).textContent='No '+(group==='arrays'?'array':'file')+' links listed for this selection.';
    }
  }
  function shareURL() {
    if (!selected || !fieldId(selected)) return null;
    const u = new URL('https://sharpmeow-lasagna-fields.hf.space/');
    u.searchParams.set('scroll', selected.scroll); u.searchParams.set('volume', selected.volume);
    u.searchParams.set('field', fieldId(selected));
    return u.href;
  }
  function normalContext() {
    const n = normals(selected), manifest = manifestOf(selected);
    if (!selected || !n.nx || !n.ny || !manifest) return null;
    return ['Lasagna Fields: surface normals', 'Scroll: ' + selected.scroll, 'Acquisition: ' + selected.volume,
      'Model: ' + selected.model, 'Two encoded direction channels, nx and ny (chunked Zarr).',
      'nx: ' + n.nx, 'ny: ' + n.ny, 'Manifest: ' + manifest,
      selected.normals_access?.coordinate_note || '', 'View: ' + shareURL()].filter(Boolean).join('\n');
  }
  async function copy(value, success) {
    if (!value) return;
    try { await navigator.clipboard.writeText(value); el('copy-status').textContent = success; return true; }
    catch (_) { el('copy-status').textContent = 'Clipboard unavailable. Select a URL in Data and downloads to copy it.'; return false; }
  }
  let displayMode = 'smoothed';
  function preview() {
    const image = el('image');
    for (const view of ['xy','xz']) { el(view).disabled = !(selected && url(selected['preview_' + view])); el(view).setAttribute('aria-pressed', String(view === direction)); }
    el('enlarge').disabled = !(selected && url(selected['preview_' + direction]));
    loadPreview('human',selected,direction,displayMode);
    if (selected) {
      image.alt = selected.scroll + ', acquisition ' + selected.volume + ': ' + (direction === 'xy' ? 'top' : 'side') + ' view of ' + (selected.preview_kind === 'cos' ? 'Layer pattern (cos), ' + selected.model : 'the model field');
    }
    el('caption').textContent = selected ? (selected.preview_kind === 'cos' ? cosCaption(selected,direction) : 'Grayscale shows the layer pattern; color shows surface direction. ' + (selected.model || 'Published model') + '. Model output, not a reading.') : 'Field availability is specific to the selected scan acquisition.';
  }
  function showField() {
    const rows = rowsFor(), matching = rows.filter(f => fieldId(f) === el('field').value);
    selected = matching.length === 1 ? matching[0] : null;
    el('completeness').textContent = selected && selected.availability?.whole_volume_complete === true ? 'Catalog reports whole-volume completeness; see provenance.' : 'Whole-volume completeness is not verified here.';
    const f = selected || {}, a = f.normals_access || {}, p = f.provenance || {}, n = normals(selected);
    link(el('manifest'), manifestOf(selected));
    showDataLinks(selected);
    showRecipes(selected);
    const accessible = Boolean(n.nx && n.ny && manifestOf(selected));
    el('availability').textContent = accessible ? 'Field arrays (Zarr) and download files' : selected ? 'See available source links below' : 'No published field selected';
    el('copy').disabled = !accessible;
    el('using').open = false;
    el('coordinates').textContent = a.coordinate_note || 'Use the manifest for coordinate scales and decoding.';
    el('share').disabled = !shareURL(); el('copy-status').textContent = '';
    const facts = [['Scroll',el('scroll').value],['Acquisition',el('volume').value],['Model',f.model],['Source',f.source],['Made by',f.made_by],['Voxel size',f.voxel_um != null ? f.voxel_um+' 碌m' : null],['CT input level',f.read_level],['Normal source',f.normal_source],['Checkpoint',p.checkpoint_revision],['Published size',f.bytes != null ? gb(f.bytes) : null],['Availability status',f.availability?.status]];
    el('facts').replaceChildren(...facts.filter(([,v]) => v !== undefined && v !== null && v !== '').flatMap(([k,v]) => { const dt = document.createElement('dt'), dd = document.createElement('dd'); dt.textContent = k; dd.textContent = String(v); return [dt,dd]; }));
    el('note').textContent = f.note || '';
    displayMode='smoothed'; direction = f.preview_xy ? 'xy' : 'xz'; preview();
  }
  function acquisition(requestedField = null) {
    const rows = rowsFor(), invalid = requestedField !== null && !rows.some(f => fieldId(f) === requestedField);
    options(el('field'), rows.map(f => [fieldId(f),(f.model || 'Field')+' 路 '+(f.source || 'published source')]), invalid ? 'Choose a listed field' : null);
    if (requestedField !== null && !invalid) el('field').value = requestedField;
    el('field-choice').hidden = rows.length < 2 && !invalid;
    showField();
    if (invalid) notice('The field in this link is not listed for this acquisition. Choose a listed field.');
    else if (el('volume').value && !rows.length) { el('availability').textContent = 'No published field listed'; el('empty').textContent = 'No published field is listed for this acquisition. Choose another acquisition or make a small box.'; }
  }
  function scroll(requestedVolume = null, requestedField = null) {
    const name = el('scroll').value, volumes = new Map();
    for (const v of (samples.find(s => s.scroll === name)?.volumes || [])) volumes.set(v.volume,v);
    for (const f of FL.filter(f => f.scroll === name)) if (!volumes.has(f.volume)) volumes.set(f.volume,f);
    const invalid = requestedVolume !== null && !volumes.has(requestedVolume);
    options(el('volume'), [...volumes.values()].sort((a,b) => a.volume.localeCompare(b.volume)).map(v => [v.volume,v.volume+(v.voxel_um != null ? ' 路 '+v.voxel_um+' 碌m' : '')+(v.superseded_by ? ' (superseded)' : '')]), invalid ? 'Choose a listed acquisition' : null);
    if (requestedVolume !== null && !invalid) el('volume').value = requestedVolume;
    acquisition(invalid ? null : requestedField);
    if (invalid) notice('The acquisition in this link is not listed for this scroll. Choose a listed acquisition.');
  }
  function search() {
    const q = normalize(el('search').value), matches = names.filter(n => normalize(n).includes(q));
    const exact = matches.filter(n => normalize(n) === q), previous = el('scroll').value;
    const chosen = exact.length === 1 ? exact[0] : matches.length === 1 ? matches[0] : !q && matches.includes(previous) ? previous : null;
    options(el('scroll'), matches.map(s => [s,s]), chosen ? null : matches.length ? 'Choose a scroll or variant' : 'No matching scroll');
    if (chosen) el('scroll').value = chosen;
    notice(chosen ? '' : matches.length ? 'Choose a specific scroll or variant from the matches.' : 'No scroll matches this search.');
    scroll();
  }
  el('count').textContent=fieldCountLabel(FL);
  options(el('scroll'),names.map(s => [s,s]));
  if (names.includes('PHerc0139')) el('scroll').value = 'PHerc0139';
  el('search').oninput = search;
  el('scroll').onchange = () => { notice(); scroll(); };
  el('volume').onchange = () => { notice(); acquisition(); };
  el('field').onchange = () => { notice(); showField(); };
  document.addEventListener('lasagna-select-field',e=>{const f=e.detail;if(!f)return;el('search').value='';options(el('scroll'),names.map(s=>[s,s]));el('scroll').value=f.scroll;notice();scroll(f.volume,fieldId(f));});
  for (const view of ['xy','xz']) el(view).onclick = () => { direction=view; preview(); };
  for (const mode of ['original','smoothed']) el(mode).onclick = () => { displayMode=mode; preview(); };
  el('enlarge').onclick = () => { if(selected)openPv(selected,direction,displayMode); };
  el('theme').onclick = () => document.getElementById('theme').click();
  el('copy').onclick = () => copy(normalContext(),'Both normals links, manifest and field context copied.');
  el('share').onclick = async () => { const ok=await copy(shareURL(),'Page link copied. It opens this selection, not a data download.');el('share').textContent=ok?'Page link copied':'Select page URL unavailable';setTimeout(()=>{el('share').textContent='Copy page link';},1600); };
  function reveal(target) { for (let n=target;n;n=n.parentElement) if (n.tagName==='DETAILS') n.open=true; }
  document.addEventListener('click',e => { const a=e.target.closest('a[href^="#"]'); if(a)reveal(document.getElementById(a.getAttribute('href').slice(1))); if(e.target.closest('#lbslice'))reveal(document.getElementById('use')); },true);
  window.addEventListener('hashchange',() => reveal(document.getElementById(location.hash.slice(1))));
  reveal(document.getElementById(location.hash.slice(1)));
  let params;
  try { params=new URLSearchParams(window.parent.location.search); } catch (_) { params=new URLSearchParams(); }
  if (params.has('scroll')) {
    const requested=params.get('scroll'), exact=names.filter(n => normalize(n)===normalize(requested));
    if (exact.length===1) { el('scroll').value=exact[0]; scroll(params.get('volume'),params.get('field')); }
    else { el('search').value=requested; search(); if(el('scroll').value) { options(el('scroll'),names.map(s=>[s,s]),'Choose a listed scroll'); scroll(); } notice('This link needs a specific listed scroll or variant. Choose one below.'); }
  } else if (params.has('volume') || params.has('field')) {
    options(el('scroll'),names.map(s=>[s,s]),'Choose a listed scroll'); scroll(); notice('This link is missing its scroll. Choose a scroll and acquisition.');
  } else if (names.length) scroll();
  else { scroll(); notice('No published field metadata loaded.'); }
})();

</script>
</body>
</html>