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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>MATRIX/MA DATASETS - by webXOS</title>
    
    <!-- Core Libraries -->
    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    
    <style>
        /* === ORIGINAL WEBXOS COLORS === */
        :root {
            --terminal-black: #000000;
            --terminal-green: #00FF00;
            --terminal-red: #FF0000;
            --terminal-gray: #1E1E1E;
            --terminal-light-gray: #2D2D2D;
            --terminal-medium-gray: #3A3A3A;
            --terminal-border: #7A7A7A;
            --terminal-yellow: #FFFF00;
            --terminal-blue: #0000FF;
            
            /* Clean Terminal Colors */
            --clean-bg: rgba(10, 10, 12, 0.98);
            --clean-text: #E0E0E0;
            --clean-accent: #00FF88;
            --clean-border: #333344;
            --clean-header: rgba(20, 20, 30, 0.95);
            --hf-purple: #7C3AED;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'JetBrains Mono', 'Courier New', monospace;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            background-color: var(--terminal-black);
            color: var(--terminal-green);
            height: 100vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            touch-action: manipulation;
        }

        /* === HF DATASET GENERATOR WINDOW === */
        .hf-window {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 90%;
            max-width: 1200px;
            height: 85%;
            background: var(--clean-bg);
            border: 1px solid var(--clean-border);
            border-radius: 8px;
            box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
            display: none;
            flex-direction: column;
            z-index: 10000;
            overflow: hidden;
        }

        .hf-window.active {
            display: flex;
        }

        .hf-header {
            background: var(--clean-header);
            padding: 12px 20px;
            border-bottom: 1px solid var(--clean-border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: var(--clean-accent);
            font-weight: 500;
        }

        .hf-title {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .hf-title i {
            color: var(--hf-purple);
        }

        .hf-controls {
            display: flex;
            gap: 8px;
        }

        .hf-btn {
            background: rgba(124, 58, 237, 0.1);
            border: 1px solid rgba(124, 58, 237, 0.3);
            color: var(--hf-purple);
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 0.8rem;
            transition: all 0.2s;
        }

        .hf-btn:hover {
            background: rgba(124, 58, 237, 0.2);
        }

        .hf-btn.primary {
            background: rgba(0, 255, 136, 0.1);
            border-color: rgba(0, 255, 136, 0.3);
            color: var(--clean-accent);
        }

        .hf-btn.danger {
            background: rgba(255, 0, 0, 0.1);
            border-color: rgba(255, 0, 0, 0.3);
            color: #ff6666;
        }

        .hf-btn.close {
            background: rgba(255, 0, 0, 0.1);
            border-color: rgba(255, 0, 0, 0.3);
            color: #ff6666;
        }

        .hf-container {
            flex: 1;
            display: flex;
            overflow: hidden;
            padding: 20px;
            gap: 20px;
        }

        .config-panel {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: rgba(5, 5, 10, 0.8);
            border: 1px solid var(--clean-border);
            border-radius: 6px;
            overflow: hidden;
            min-width: 300px;
        }

        .config-header {
            padding: 10px 15px;
            background: rgba(15, 15, 25, 0.9);
            border-bottom: 1px solid var(--clean-border);
            color: var(--hf-purple);
            font-size: 0.85rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .config-content {
            flex: 1;
            padding: 15px;
            overflow-y: auto;
            color: var(--clean-text);
        }

        .config-section {
            margin-bottom: 20px;
            padding: 10px;
            background: rgba(20, 20, 30, 0.3);
            border-radius: 4px;
        }

        .section-title {
            color: var(--hf-purple);
            font-size: 0.9rem;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .config-input {
            margin-bottom: 12px;
        }

        .config-input label {
            display: block;
            font-size: 0.8rem;
            color: var(--clean-text);
            margin-bottom: 4px;
        }

        .config-input input, .config-input select {
            width: 100%;
            background: rgba(30, 30, 40, 0.8);
            border: 1px solid var(--clean-border);
            color: var(--clean-text);
            padding: 6px 10px;
            border-radius: 3px;
            font-size: 0.8rem;
        }

        .config-input input:focus, .config-input select:focus {
            outline: 1px solid var(--hf-purple);
        }

        .slider-container {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .slider-value {
            min-width: 40px;
            text-align: center;
            font-size: 0.8rem;
        }

        input[type="range"] {
            flex: 1;
            height: 4px;
            background: rgba(30, 30, 40, 0.8);
            border-radius: 2px;
            outline: none;
            -webkit-appearance: none;
        }

        input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 16px;
            height: 16px;
            background: var(--hf-purple);
            border-radius: 50%;
            cursor: pointer;
        }

        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 5px;
        }

        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 0.8rem;
        }

        .checkbox-item input[type="checkbox"] {
            width: 14px;
            height: 14px;
        }

        .terminal-panel {
            flex: 2;
            display: flex;
            flex-direction: column;
            background: rgba(5, 5, 10, 0.8);
            border: 1px solid var(--clean-border);
            border-radius: 6px;
            overflow: hidden;
        }

        .terminal-header {
            padding: 10px 15px;
            background: rgba(15, 15, 25, 0.9);
            border-bottom: 1px solid var(--clean-border);
            color: var(--hf-purple);
            font-size: 0.85rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .terminal-output {
            flex: 1;
            padding: 15px;
            overflow-y: auto;
            font-size: 0.85rem;
            line-height: 1.4;
            color: var(--clean-text);
        }

        .terminal-line {
            margin-bottom: 3px;
            word-break: break-word;
            white-space: pre-wrap;
            animation: fadeIn 0.2s ease;
        }

        .terminal-line.command {
            color: var(--hf-purple);
        }

        .terminal-line.output {
            color: var(--clean-text);
        }

        .terminal-line.error {
            color: #ff6666;
        }

        .terminal-line.success {
            color: var(--clean-accent);
        }

        .terminal-line.info {
            color: #66ccff;
        }

        .terminal-line.warning {
            color: #ffcc00;
        }

        .terminal-line.hf {
            color: var(--hf-purple);
        }

        .terminal-input {
            padding: 10px 15px;
            background: rgba(15, 15, 25, 0.9);
            border-top: 1px solid var(--clean-border);
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .input-prompt {
            color: var(--hf-purple);
            font-weight: bold;
        }

        #hfInput {
            flex: 1;
            background: transparent;
            border: none;
            color: var(--clean-text);
            font-family: 'JetBrains Mono', monospace;
            font-size: 0.9rem;
            outline: none;
        }

        .progress-container {
            margin-top: 15px;
            padding: 10px;
            background: rgba(20, 20, 30, 0.5);
            border-radius: 4px;
            border: 1px solid var(--clean-border);
        }

        .progress-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 0.8rem;
        }

        .progress-bar {
            height: 8px;
            background: rgba(30, 30, 40, 0.8);
            border-radius: 4px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--hf-purple), var(--clean-accent));
            transition: width 0.3s ease;
            width: 0%;
        }

        .progress-stats {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            margin-top: 10px;
            font-size: 0.75rem;
        }

        .stat-item {
            display: flex;
            justify-content: space-between;
        }

        .stat-label {
            color: #aaa;
        }

        .stat-value {
            color: var(--clean-text);
        }

        /* === LOADING SCREEN === */
        .loading-screen {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: var(--terminal-black);
            display: flex; align-items: center; justify-content: center;
            z-index: 9999; flex-direction: column;
            font-size: 1.2rem;
            text-align: center;
        }

        .webxos-logo {
            font-size: 6rem;
            font-weight: bold;
            margin-bottom: 20px;
            color: var(--hf-purple);
            animation: glow 2s infinite alternate;
        }

        .loading-bar {
            width: 400px; height: 20px;
            background: var(--terminal-light-gray);
            margin-top: 40px;
            border-radius: 10px;
            overflow: hidden;
            border: 2px solid var(--hf-purple);
        }

        .loading-fill {
            width: 0%; height: 100%;
            background: var(--hf-purple);
            transition: width 0.3s;
        }

        /* === TASKBAR === */
        .taskbar {
            height: 42px;
            background: var(--terminal-gray);
            border-top: 1px solid #fff;
            display: flex;
            align-items: center;
            padding: 0 6px;
            box-shadow: 0 -1px 3px rgba(0,0,0,0.5);
            z-index: 1000;
            position: fixed;
            bottom: 0;
            width: 100%;
        }

        .start-btn {
            background: var(--terminal-black);
            border: 1px outset var(--hf-purple);
            padding: 4px 14px;
            font-weight: bold;
            color: var(--hf-purple);
            cursor: pointer;
            margin-right: 8px;
            font-size: 1rem;
            min-height: 32px;
        }

        .task-icon {
            width: 32px; height: 32px;
            background: var(--terminal-light-gray);
            border: 1px solid var(--terminal-medium-gray);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1rem;
            color: var(--hf-purple);
            margin-right: 6px;
        }

        .task-icon.active {
            background: var(--hf-purple);
            color: black;
        }

        .clock {
            margin-left: auto;
            font-size: 1rem;
            padding: 0 10px;
        }

        /* === RESPONSIVE === */
        @media (max-width: 768px) {
            .hf-container {
                flex-direction: column;
                padding: 10px;
            }
            
            .hf-window {
                width: 95%;
                height: 90%;
            }
            
            .config-panel {
                min-width: unset;
            }
            
            .webxos-logo {
                font-size: 4rem;
            }
            
            .loading-bar {
                width: 90%;
            }
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes glow {
            0% { text-shadow: 0 0 10px rgba(124, 58, 237, 0.5); }
            100% { text-shadow: 0 0 20px rgba(124, 58, 237, 0.8), 0 0 30px rgba(124, 58, 237, 0.6); }
        }
    </style>
</head>
<body>
    <!-- HF DATASET GENERATOR WINDOW -->
    <div class="hf-window" id="hfWindow">
        <div class="hf-header">
            <div class="hf-title">
                <i class="fas fa-database"></i>
                <span>MATRIX/MA DATASETS by webXOS</span>
            </div>
            <div class="hf-controls">
                <button class="hf-btn primary" onclick="hfGenerator.generateDataset()">
                    <i class="fas fa-play"></i> Generate Dataset
                </button>
                <button class="hf-btn" onclick="hfGenerator.exportDataset()" id="exportBtn" disabled>
                    <i class="fas fa-file-export"></i> Export ZIP
                </button>
                <button class="hf-btn close" onclick="closeHFWindow()">
                    <i class="fas fa-times"></i> Close
                </button>
            </div>
        </div>
        <div class="hf-container">
            <div class="config-panel">
                <div class="config-header">
                    <span>DATASET CONFIGURATION</span>
                    <span id="configStatus">READY</span>
                </div>
                <div class="config-content">
                    <div class="config-section">
                        <div class="section-title">
                            <i class="fas fa-sliders-h"></i>
                            <span>Dataset Parameters</span>
                        </div>
                        <div class="config-input">
                            <label>Dataset Name</label>
                            <input type="text" id="datasetName" value="matrix_operations" placeholder="Enter dataset name">
                        </div>
                        <div class="config-input">
                            <label>Number of Samples</label>
                            <div class="slider-container">
                                <input type="range" id="sampleCount" min="10" max="5000" value="500" step="10">
                                <span class="slider-value" id="sampleCountValue">500</span>
                            </div>
                        </div>
                        <div class="config-input">
                            <label>Matrix Dimensions</label>
                            <div class="slider-container">
                                <input type="range" id="matrixSize" min="2" max="16" value="8" step="2">
                                <span class="slider-value" id="matrixSizeValue">8×8</span>
                            </div>
                        </div>
                        <div class="config-input">
                            <label>Data Format</label>
                            <select id="dataFormat">
                                <option value="jsonl">JSON Lines (.jsonl)</option>
                                <option value="csv">CSV (.csv)</option>
                                <option value="json">JSON (.json)</option>
                            </select>
                        </div>
                        <div class="config-input">
                            <label>Train/Test Split</label>
                            <div class="slider-container">
                                <input type="range" id="trainSplit" min="50" max="100" value="80" step="5">
                                <span class="slider-value" id="trainSplitValue">80% Train</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="config-section">
                        <div class="section-title">
                            <i class="fas fa-cogs"></i>
                            <span>Operations</span>
                        </div>
                        <div class="checkbox-group">
                            <div class="checkbox-item">
                                <input type="checkbox" id="opMatmul" checked>
                                <label for="opMatmul">Matrix Multiplication</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" id="opAdd" checked>
                                <label for="opAdd">Matrix Addition</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" id="opTranspose">
                                <label for="opTranspose">Matrix Transpose</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" id="opInverse">
                                <label for="opInverse">Matrix Inverse</label>
                            </div>
                        </div>
                    </div>
                    
                    <div class="config-section">
                        <div class="section-title">
                            <i class="fas fa-file-alt"></i>
                            <span>Metadata</span>
                        </div>
                        <div class="config-input">
                            <label>Description</label>
                            <input type="text" id="datasetDesc" value="Synthetic matrix operations dataset for ML training" placeholder="Dataset description">
                        </div>
                        <div class="config-input">
                            <label>License</label>
                            <select id="datasetLicense">
                                <option value="apache-2.0">Apache 2.0</option>
                                <option value="mit">MIT</option>
                                <option value="cc-by-4.0">CC-BY-4.0</option>
                                <option value="cc-by-sa-4.0">CC-BY-SA-4.0</option>
                            </select>
                        </div>
                    </div>
                    
                    <div class="progress-container">
                        <div class="progress-header">
                            <span>Generation Progress</span>
                            <span id="progressPercent">0%</span>
                        </div>
                        <div class="progress-bar">
                            <div class="progress-fill" id="progressFill"></div>
                        </div>
                        <div class="progress-stats">
                            <div class="stat-item">
                                <span class="stat-label">Samples:</span>
                                <span class="stat-value" id="statSamples">0/500</span>
                            </div>
                            <div class="stat-item">
                                <span class="stat-label">Size:</span>
                                <span class="stat-value" id="statSize">0 KB</span>
                            </div>
                            <div class="stat-item">
                                <span class="stat-label">Time:</span>
                                <span class="stat-value" id="statTime">0s</span>
                            </div>
                            <div class="stat-item">
                                <span class="stat-label">Format:</span>
                                <span class="stat-value" id="statFormat">jsonl</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="terminal-panel">
                <div class="terminal-header">
                    <span>GENERATION TERMINAL</span>
                    <span id="terminalStatus">READY</span>
                </div>
                <div class="terminal-output" id="terminalOutput">
                    <div class="terminal-line hf">⟩⟩ MATRIXMA DATASETS Dataset Generator v2.2</div>
                    <div class="terminal-line output">Fixed Hugging Face schema compatibility</div>
                    <div class="terminal-line output">All exports validated for HF Hub upload</div>
                    <div class="terminal-line output">Configure parameters and click "Generate Dataset"</div>
                </div>
                <div class="terminal-input">
                    <div class="input-prompt">⟩⟩</div>
                    <input type="text" id="hfInput" placeholder="Enter command (help for options)..." autocomplete="off">
                    <button class="hf-btn" onclick="hfGenerator.executeCommand()">Execute</button>
                </div>
            </div>
        </div>
    </div>

    <!-- LOADING SCREEN -->
    <div class="loading-screen" id="loadingScreen">
        <div class="webxos-logo">MATRIX/MA DATASETS</div>
        <div>v2.2 - by webXOS 2026</div>
        <div class="loading-bar"><div class="loading-fill" id="loadingFill"></div></div>
    </div>

    <!-- TASKBAR -->
    <div class="taskbar" id="taskbar" style="display: none;">
        <button class="start-btn" onclick="openHFWindow()">MATRIX MULTIPLIER DATASET GEN</button>
        <div class="task-icon" onclick="openHFWindow()">
            <i class="fas fa-database"></i>
        </div>
        <div class="clock" id="clock">00:00:00</div>
    </div>

    <script>
        // ==================== HF DATASET GENERATOR v2.2 ====================
        class HFDatasetGenerator {
            constructor() {
                this.tfReady = false;
                this.isGenerating = false;
                this.dataset = { train: [], test: [] };
                this.metadata = {
                    name: "matrix_operations",
                    description: "Synthetic matrix operations dataset",
                    license: "apache-2.0",
                    format: "jsonl",
                    generated_at: null,
                    splits: { train: 0, test: 0 }
                };
                this.stats = {
                    samples: 0,
                    totalSamples: 500,
                    startTime: 0,
                    sizeKB: 0,
                    backend: 'unknown'
                };
                
                this.init();
                this.setupConfigListeners();
            }

            async init() {
                this.printTerminal("Initializing HF Dataset Generator v2.2 (HF Schema Fixed)...", "hf");
                this.printTerminal("Fixed schema compatibility for Hugging Face Hub", "success");
                
                try {
                    // Try WebGL first with proper fallback logging
                    try {
                        await tf.setBackend('webgl');
                        await tf.ready();
                        this.stats.backend = 'webgl';
                        this.printTerminal(`✓ TensorFlow.js backend: WebGL (GPU)`, "success");
                    } catch (webglError) {
                        this.printTerminal(`WebGL failed: ${webglError.message}`, "warning");
                        this.printTerminal("Falling back to CPU backend...", "warning");
                        await tf.setBackend('cpu');
                        await tf.ready();
                        this.stats.backend = 'cpu';
                        this.printTerminal(`✓ TensorFlow.js backend: CPU`, "info");
                    }
                    
                    this.tfReady = true;
                    this.printTerminal("System ready for Hugging Face compatible dataset generation", "success");
                    this.updateStatus("IDLE");
                    
                } catch (error) {
                    this.printTerminal(`Initialization error: ${error.message}`, "error");
                }
            }

            setupConfigListeners() {
                // Update slider values
                document.getElementById('sampleCount').addEventListener('input', (e) => {
                    const value = e.target.value;
                    document.getElementById('sampleCountValue').textContent = value;
                    this.stats.totalSamples = parseInt(value);
                    document.getElementById('statSamples').textContent = `0/${value}`;
                });
                
                document.getElementById('matrixSize').addEventListener('input', (e) => {
                    const size = e.target.value;
                    document.getElementById('matrixSizeValue').textContent = `${size}×${size}`;
                });
                
                document.getElementById('trainSplit').addEventListener('input', (e) => {
                    const value = e.target.value;
                    document.getElementById('trainSplitValue').textContent = `${value}% Train`;
                });
                
                // Update format display
                document.getElementById('dataFormat').addEventListener('change', (e) => {
                    const format = e.target.value;
                    document.getElementById('statFormat').textContent = format;
                });
            }

            async generateDataset() {
                if (this.isGenerating) {
                    this.printTerminal("Dataset generation already in progress", "warning");
                    return;
                }
                
                this.isGenerating = true;
                this.dataset = { train: [], test: [] };
                this.updateStatus("GENERATING");
                
                // Get configuration
                const config = this.getConfig();
                const trainSplit = config.trainSplit;
                const trainCount = Math.floor(config.sampleCount * (trainSplit / 100));
                const testCount = config.sampleCount - trainCount;
                
                this.metadata = {
                    name: config.name,
                    description: config.description,
                    license: config.license,
                    format: config.format,
                    generated_at: new Date().toISOString(),
                    operations: config.operations,
                    matrix_size: config.matrixSize,
                    backend: this.stats.backend,
                    splits: { train: trainCount, test: testCount }
                };
                
                this.stats = {
                    samples: 0,
                    totalSamples: config.sampleCount,
                    startTime: performance.now(),
                    sizeKB: 0,
                    backend: this.stats.backend
                };
                
                this.printTerminal(`Starting dataset generation: ${config.name}`, "hf");
                this.printTerminal(`Backend: ${this.stats.backend.toUpperCase()}`, "info");
                this.printTerminal(`Samples: ${config.sampleCount} (Train: ${trainCount}, Test: ${testCount})`, "info");
                this.printTerminal(`Matrix: ${config.matrixSize}×${config.matrixSize}`, "info");
                this.printTerminal(`Operations: ${config.operations.join(', ')}`, "info");
                this.printTerminal(`Format: ${config.format}`, "info");
                
                // Update progress UI
                this.updateProgress(0);
                document.getElementById('exportBtn').disabled = true;
                
                // Generate samples
                for (let i = 0; i < config.sampleCount; i++) {
                    if (!this.isGenerating) break;
                    
                    const sample = await this.generateSample(config.matrixSize, config.operations);
                    
                    // Split into train/test
                    if (i < trainCount) {
                        this.dataset.train.push(sample);
                    } else {
                        this.dataset.test.push(sample);
                    }
                    
                    this.stats.samples = i + 1;
                    
                    // Update progress every 10 samples or at the end
                    if ((i + 1) % 10 === 0 || i === config.sampleCount - 1) {
                        const progress = ((i + 1) / config.sampleCount) * 100;
                        this.updateProgress(progress);
                        
                        // Update stats
                        const elapsed = (performance.now() - this.stats.startTime) / 1000;
                        const size = this.calculateSize();
                        document.getElementById('statTime').textContent = `${elapsed.toFixed(1)}s`;
                        document.getElementById('statSize').textContent = `${size} KB`;
                        document.getElementById('statSamples').textContent = `${i + 1}/${config.sampleCount}`;
                        
                        if ((i + 1) % 100 === 0) {
                            this.printTerminal(`Generated ${i + 1}/${config.sampleCount} samples`, "output");
                        }
                    }
                    
                    // Yield to UI every 20 samples
                    if (i % 20 === 0) await new Promise(resolve => setTimeout(resolve, 0));
                }
                
                if (this.isGenerating) {
                    const elapsed = ((performance.now() - this.stats.startTime) / 1000).toFixed(2);
                    const size = this.calculateSize();
                    
                    this.printTerminal(`Dataset generation complete!`, "success");
                    this.printTerminal(`✓ ${config.sampleCount} samples in ${elapsed}s`, "success");
                    this.printTerminal(`✓ ${trainCount} train samples, ${testCount} test samples`, "success");
                    this.printTerminal(`✓ Total size: ${size} KB`, "success");
                    this.printTerminal(`✓ Ready for Hugging Face Hub upload`, "success");
                    
                    this.updateStatus("COMPLETE");
                    document.getElementById('exportBtn').disabled = false;
                    this.showDatasetSummary();
                }
                
                this.isGenerating = false;
            }

            async generateSample(matrixSize, operations) {
                const sampleId = `sample_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
                const sample = {
                    id: sampleId,
                    timestamp: new Date().toISOString(),
                    matrix_size: matrixSize,
                    operations: []
                };
                
                // Generate random matrices
                const matrixA = tf.randomNormal([matrixSize, matrixSize], 0, 1);
                const matrixB = tf.randomNormal([matrixSize, matrixSize], 0, 1);
                
                // Perform selected operations
                for (const op of operations) {
                    let result, time, operationData = { type: op };
                    
                    try {
                        const start = performance.now();
                        
                        switch(op) {
                            case 'matmul':
                                result = tf.matMul(matrixA, matrixB);
                                await result.data();
                                time = performance.now() - start;
                                operationData.time_ms = time;
                                operationData.matrix_a = Array.from(matrixA.dataSync());
                                operationData.matrix_b = Array.from(matrixB.dataSync());
                                operationData.result = Array.from(result.dataSync());
                                result.dispose();
                                break;
                                
                            case 'add':
                                result = tf.add(matrixA, matrixB);
                                await result.data();
                                time = performance.now() - start;
                                operationData.time_ms = time;
                                operationData.matrix_a = Array.from(matrixA.dataSync());
                                operationData.matrix_b = Array.from(matrixB.dataSync());
                                operationData.result = Array.from(result.dataSync());
                                result.dispose();
                                break;
                                
                            case 'transpose':
                                result = tf.transpose(matrixA);
                                await result.data();
                                time = performance.now() - start;
                                operationData.time_ms = time;
                                operationData.matrix = Array.from(matrixA.dataSync());
                                operationData.result = Array.from(result.dataSync());
                                result.dispose();
                                break;
                                
                            case 'inverse':
                                // Create invertible matrix: identity + small random perturbation
                                const identity = tf.eye(matrixSize);
                                const perturbation = tf.randomNormal([matrixSize, matrixSize], 0, 0.1);
                                const invertibleMatrix = tf.add(identity, perturbation);
                                
                                try {
                                    result = tf.linalg.inv(invertibleMatrix);
                                    await result.data();
                                    time = performance.now() - start;
                                    operationData.time_ms = time;
                                    operationData.matrix = Array.from(invertibleMatrix.dataSync());
                                    operationData.result = Array.from(result.dataSync());
                                    result.dispose();
                                } catch (invError) {
                                    operationData.time_ms = time;
                                    operationData.matrix = Array.from(invertibleMatrix.dataSync());
                                    operationData.result = [];
                                    operationData.error = "Matrix not invertible";
                                }
                                
                                identity.dispose();
                                perturbation.dispose();
                                invertibleMatrix.dispose();
                                break;
                        }
                        
                        sample.operations.push(operationData);
                        
                    } catch (error) {
                        this.printTerminal(`Error in operation ${op}: ${error.message}`, "error");
                        operationData.error = error.message;
                        sample.operations.push(operationData);
                    }
                }
                
                // Cleanup
                matrixA.dispose();
                matrixB.dispose();
                
                return sample;
            }

            getConfig() {
                const selectedOps = [];
                
                if (document.getElementById('opMatmul').checked) selectedOps.push('matmul');
                if (document.getElementById('opAdd').checked) selectedOps.push('add');
                if (document.getElementById('opTranspose').checked) selectedOps.push('transpose');
                if (document.getElementById('opInverse').checked) selectedOps.push('inverse');
                
                return {
                    name: document.getElementById('datasetName').value,
                    sampleCount: parseInt(document.getElementById('sampleCount').value),
                    matrixSize: parseInt(document.getElementById('matrixSize').value),
                    format: document.getElementById('dataFormat').value,
                    description: document.getElementById('datasetDesc').value,
                    license: document.getElementById('datasetLicense').value,
                    trainSplit: parseInt(document.getElementById('trainSplit').value),
                    operations: selectedOps
                };
            }

            calculateSize() {
                const allData = [...this.dataset.train, ...this.dataset.test];
                const jsonString = JSON.stringify(allData);
                return (new TextEncoder().encode(jsonString).length / 1024).toFixed(2);
            }

            async exportDataset() {
                if (this.dataset.train.length === 0 && this.dataset.test.length === 0) {
                    this.printTerminal("No dataset to export. Generate a dataset first.", "warning");
                    return;
                }
                
                this.printTerminal("Preparing dataset for Hugging Face export...", "hf");
                this.updateStatus("EXPORTING");
                
                const config = this.getConfig();
                const zip = new JSZip();
                
                // Create dataset folder structure
                const datasetFolder = zip.folder(config.name);
                
                // Export based on format
                switch(config.format) {
                    case 'jsonl':
                        if (this.dataset.train.length > 0) {
                            const trainJsonl = this.dataset.train.map(s => JSON.stringify(s)).join('\n');
                            datasetFolder.file("train.jsonl", trainJsonl);
                        }
                        if (this.dataset.test.length > 0) {
                            const testJsonl = this.dataset.test.map(s => JSON.stringify(s)).join('\n');
                            datasetFolder.file("test.jsonl", testJsonl);
                        }
                        break;
                        
                    case 'json':
                        if (this.dataset.train.length > 0) {
                            datasetFolder.file("train.json", JSON.stringify(this.dataset.train, null, 2));
                        }
                        if (this.dataset.test.length > 0) {
                            datasetFolder.file("test.json", JSON.stringify(this.dataset.test, null, 2));
                        }
                        break;
                        
                    case 'csv':
                        // CSV with complete data
                        if (this.dataset.train.length > 0) {
                            const trainCsv = this.convertToCSV(this.dataset.train);
                            datasetFolder.file("train.csv", trainCsv);
                        }
                        if (this.dataset.test.length > 0) {
                            const testCsv = this.convertToCSV(this.dataset.test);
                            datasetFolder.file("test.csv", testCsv);
                        }
                        break;
                }
                
                // Add metadata and documentation
                const readmeContent = this.generateReadme();
                datasetFolder.file("README.md", readmeContent);
                
                const datasetCard = this.generateDatasetCard();
                datasetFolder.file("dataset_card.md", datasetCard);
                
                const metadata = {
                    ...this.metadata,
                    samples: this.dataset.train.length + this.dataset.test.length,
                    train_samples: this.dataset.train.length,
                    test_samples: this.dataset.test.length,
                    size_kb: this.calculateSize()
                };
                datasetFolder.file("metadata.json", JSON.stringify(metadata, null, 2));
                
                // Add data loading script
                const loadScript = this.generateLoadScript(config);
                datasetFolder.file("load_dataset.py", loadScript);
                
                // Generate and download ZIP
                try {
                    const content = await zip.generateAsync({ type: "blob" });
                    const filename = `${config.name}_hf_dataset.zip`;
                    
                    const a = document.createElement("a");
                    const url = URL.createObjectURL(content);
                    a.href = url;
                    a.download = filename;
                    document.body.appendChild(a);
                    a.click();
                    document.body.removeChild(a);
                    URL.revokeObjectURL(url);
                    
                    this.printTerminal(`✓ Dataset exported as ${filename}`, "success");
                    this.printTerminal("Ready for Hugging Face Hub upload:", "hf");
                    this.printTerminal("  cd " + config.name, "output");
                    this.printTerminal("  git init", "output");
                    this.printTerminal("  git lfs install", "output");
                    this.printTerminal("  git add .", "output");
                    this.printTerminal('  git commit -m "Add dataset"', "output");
                    this.printTerminal(`  git push https://huggingface.co/datasets/your-username/${config.name}`, "output");
                    
                    this.updateStatus("EXPORTED");
                    
                } catch (error) {
                    this.printTerminal(`Export error: ${error.message}`, "error");
                    this.updateStatus("ERROR");
                }
            }

            convertToCSV(samples) {
                // Create CSV with simplified structure
                const rows = [];
                
                // Header
                const headers = ['id', 'timestamp', 'matrix_size', 'operations_count'];
                rows.push(headers.join(','));
                
                // Data rows
                for (const sample of samples) {
                    const row = [
                        `"${sample.id}"`,
                        `"${sample.timestamp}"`,
                        sample.matrix_size,
                        sample.operations.length
                    ];
                    rows.push(row.join(','));
                }
                
                return rows.join('\n');
            }

            generateReadme() {
                const config = this.getConfig();
                const totalSamples = this.dataset.train.length + this.dataset.test.length;
                const totalBytes = this.calculateSize() * 1024;
                
                // Correct Hugging Face YAML schema - using proper feature types
                return `---
language: 
  - en
task_categories:
  - matrix-computation
  - synthetic-data-generation
tags:
  - matrix-operations
  - synthetic-data
  - machine-learning
  - mathematics
license: ${config.license}
dataset_info:
  features:
    - name: id
      dtype: string
    - name: timestamp
      dtype: string
    - name: matrix_size
      dtype: int32
    - name: operations
      list:
        - name: type
          dtype: string
        - name: time_ms
          dtype: float32
        - name: matrix_a
          sequence: float32
        - name: matrix_b
          sequence: float32
        - name: matrix
          sequence: float32
        - name: result
          sequence: float32
        - name: error
          dtype: string
  splits:
    - name: train
      num_bytes: ${Math.round(totalBytes * (this.dataset.train.length / totalSamples))}
      num_examples: ${this.dataset.train.length}
    - name: test
      num_bytes: ${Math.round(totalBytes * (this.dataset.test.length / totalSamples))}
      num_examples: ${this.dataset.test.length}
  download_size: ${Math.round(totalBytes)}
  dataset_size: ${Math.round(totalBytes)}
pretty_name: "${config.name}"
size_categories:
  - ${totalSamples < 1000 ? 'n<1K' : totalSamples < 10000 ? '1K<n<10K' : '10K<n<100K'}
---

# ${config.name}

${config.description}

## Dataset Details

- **Generated:** ${new Date().toISOString()}
- **Total Samples:** ${totalSamples}
- **Splits:** Train (${this.dataset.train.length}), Test (${this.dataset.test.length})
- **Matrix Size:** ${config.matrixSize}×${config.matrixSize}
- **Operations:** ${config.operations.join(', ') || 'None selected'}
- **Backend:** ${this.stats.backend.toUpperCase()}
- **Format:** ${config.format}

## Usage

\`\`\`python
from datasets import load_dataset

# Load the dataset
dataset = load_dataset("${config.name}")

# Access train and test splits
train_dataset = dataset["train"]
test_dataset = dataset["test"]
\`\`\`

## Example

\`\`\`python
import datasets

# Load dataset
ds = datasets.load_dataset("${config.name}")

# Get first example
example = ds["train"][0]
print(f"ID: {example['id']}")
print(f"Matrix Size: {example['matrix_size']}")
print(f"Operations: {len(example['operations'])}")
\`\`\`

## Citation

If you use this dataset in research, please cite:

\`\`\`bibtex
@dataset{${config.name.replace(/[^a-z0-9]/gi, '_').toLowerCase()}_${new Date().getFullYear()},
  title = {${config.name}},
  author = {Generated by HF Dataset Generator v2.2},
  year = {${new Date().getFullYear()}},
  publisher = {Hugging Face},
  url = {https://huggingface.co/datasets/your-username/${config.name}}
}
\`\`\`

## License

${config.license}
`;
            }

            generateDatasetCard() {
                const config = this.getConfig();
                const totalSamples = this.dataset.train.length + this.dataset.test.length;
                
                return `# Dataset Card for ${config.name}

## Dataset Description

- **Homepage:** [Add homepage URL if available]
- **Repository:** [Add repository URL]
- **Point of Contact:** [Add contact name/email]

### Dataset Summary

${config.description}

This dataset was automatically generated using the HF Dataset Generator v2.2 with TensorFlow.js backend (${this.stats.backend}).

### Supported Tasks

- Matrix operation prediction
- Computational performance benchmarking
- Synthetic data for ML training
- Algorithm validation and testing

### Languages

English

## Dataset Structure

### Data Instances

Each instance contains:
- Unique sample ID
- Generation timestamp
- Matrix size (n×n)
- List of operations performed with:
  - Operation type
  - Execution time in milliseconds
  - Input matrices
  - Result matrices
  - Error messages (if any)

### Data Fields

- \`id\`: Unique identifier (string)
- \`timestamp\`: Generation timestamp (string)
- \`matrix_size\`: Dimension of matrices (int32)
- \`operations\`: List of operations performed (list of dicts)

### Data Splits

- **Train:** ${this.dataset.train.length} samples
- **Test:** ${this.dataset.test.length} samples

## Dataset Creation

### Curation Rationale

This dataset was created to provide synthetic matrix operation data for machine learning research, benchmarking computational kernels, and testing numerical algorithms.

### Source Data

Synthetically generated using TensorFlow.js matrix operations with random normal distributions.

### Annotations

No human annotations.

### Personal and Sensitive Information

None. All data is synthetically generated.

## Considerations for Using the Data

### Social Impact

This dataset enables research in computational mathematics, machine learning optimization, and numerical analysis education.

### Discussion of Biases

Matrices are randomly generated from normal distributions (mean=0, std=1). Real-world matrices may have different distributions.

### Other Known Limitations

1. Matrix inverse may fail for singular matrices
2. Performance timing varies by hardware (${this.stats.backend} backend)
3. Limited to square matrices

## Additional Information

### Dataset Curators

Generated automatically by HF Dataset Generator v2.2

### Licensing Information

${config.license} License

### Contributions

Thanks to TensorFlow.js and Hugging Face communities.
`;
            }

            generateLoadScript(config) {
                return `#!/usr/bin/env python3
"""
Script to load and verify the ${config.name} dataset
"""

import json
from pathlib import Path

def load_and_verify_dataset():
    dataset_path = Path(".")
    
    print(f"Loading {config.name} dataset...")
    
    # Load train split
    train_data = []
    if (dataset_path / "train.jsonl").exists():
        with open(dataset_path / "train.jsonl", "r") as f:
            for line in f:
                train_data.append(json.loads(line))
        print(f"Loaded {len(train_data)} train samples")
    
    # Load test split
    test_data = []
    if (dataset_path / "test.jsonl").exists():
        with open(dataset_path / "test.jsonl", "r") as f:
            for line in f:
                test_data.append(json.loads(line))
        print(f"Loaded {len(test_data)} test samples")
    
    # Basic validation
    print("\\nDataset Validation:")
    print(f"Total samples: {len(train_data) + len(test_data)}")
    
    if train_data:
        sample = train_data[0]
        print(f"Sample keys: {list(sample.keys())}")
        print(f"Matrix size: {sample.get('matrix_size')}")
        print(f"Operations count: {len(sample.get('operations', []))}")
    
    print("\\nDataset ready for use!")
    print("To upload to Hugging Face Hub:")
    print(f"  git push https://huggingface.co/datasets/your-username/{config.name}")

if __name__ == "__main__":
    load_and_verify_dataset()
`;
            }

            showDatasetSummary() {
                const config = this.getConfig();
                const size = this.calculateSize();
                const elapsed = ((performance.now() - this.stats.startTime) / 1000).toFixed(2);
                const totalSamples = this.dataset.train.length + this.dataset.test.length;
                
                let summary = `
=== DATASET SUMMARY ===

Name: ${config.name}
Description: ${config.description}
Total Samples: ${totalSamples}
Train/Test: ${this.dataset.train.length}/${this.dataset.test.length}
Matrix Size: ${config.matrixSize}×${config.matrixSize}
Operations: ${config.operations.join(', ') || 'None'}
Format: ${config.format}
Backend: ${this.stats.backend.toUpperCase()}
Size: ${size} KB
Generation Time: ${elapsed}s
License: ${config.license}

✓ Hugging Face compatible schema
✓ Ready for HF Hub upload
✓ Includes train/test splits
✓ Validated YAML structure
                `.trim();
                
                this.printTerminal(summary, "success");
            }

            // UI Helper Methods
            printTerminal(message, type = "output") {
                const output = document.getElementById('terminalOutput');
                const line = document.createElement('div');
                line.className = `terminal-line ${type}`;
                line.textContent = message;
                output.appendChild(line);
                output.scrollTop = output.scrollHeight;
                
                // Limit lines to prevent memory issues
                const lines = output.querySelectorAll('.terminal-line');
                if (lines.length > 300) {
                    for (let i = 0; i < 100; i++) {
                        if (lines[i]) lines[i].remove();
                    }
                }
            }

            updateStatus(text) {
                document.getElementById('terminalStatus').textContent = text;
                document.getElementById('configStatus').textContent = text;
            }

            updateProgress(percent) {
                document.getElementById('progressFill').style.width = `${percent}%`;
                document.getElementById('progressPercent').textContent = `${Math.round(percent)}%`;
            }

            executeCommand() {
                const input = document.getElementById('hfInput');
                const command = input.value.trim().toLowerCase();
                
                if (!command) return;
                
                this.printTerminal(`⟩⟩ ${command}`, "command");
                
                switch(command) {
                    case 'generate':
                    case 'gen':
                        this.generateDataset();
                        break;
                    case 'export':
                    case 'zip':
                        this.exportDataset();
                        break;
                    case 'clear':
                        this.clearTerminal();
                        break;
                    case 'help':
                        this.showHelp();
                        break;
                    case 'status':
                        this.showStatus();
                        break;
                    case 'stop':
                        this.stopGeneration();
                        break;
                    case 'schema':
                        this.printTerminal("Using correct Hugging Face YAML schema with 'list' and 'sequence' types", "info");
                        break;
                    default:
                        this.printTerminal(`Unknown command: ${command}`, "error");
                        this.printTerminal("Type 'help' for available commands", "info");
                }
                
                input.value = '';
                input.focus();
            }

            showHelp() {
                const help = `
Available Commands:
-------------------
generate / gen    - Generate dataset with current configuration
export / zip      - Export dataset as ZIP (HF compatible)
stop              - Stop dataset generation
status            - Show generation status
schema            - Show schema information
clear             - Clear terminal
help              - Show this help message
                `.trim();
                
                help.split('\n').forEach(line => {
                    this.printTerminal(line, "output");
                });
            }

            showStatus() {
                let status = `Generation Status: ${this.isGenerating ? 'RUNNING' : 'IDLE'}\n`;
                status += `TensorFlow Backend: ${this.stats.backend.toUpperCase()}\n`;
                status += `Samples Generated: ${this.dataset.train.length + this.dataset.test.length}\n`;
                status += `Train Samples: ${this.dataset.train.length}\n`;
                status += `Test Samples: ${this.dataset.test.length}\n`;
                
                if (this.dataset.train.length > 0) {
                    const config = this.getConfig();
                    status += `\nCurrent Configuration:\n`;
                    status += `- Name: ${config.name}\n`;
                    status += `- Matrix Size: ${config.matrixSize}×${config.matrixSize}\n`;
                    status += `- Format: ${config.format}\n`;
                    status += `- Operations: ${config.operations.join(', ') || 'None'}\n`;
                    status += `- Train Split: ${config.trainSplit}%\n`;
                }
                
                this.printTerminal(status, "output");
            }

            stopGeneration() {
                if (this.isGenerating) {
                    this.isGenerating = false;
                    this.printTerminal("Dataset generation stopped by user", "warning");
                    this.updateStatus("STOPPED");
                } else {
                    this.printTerminal("No generation in progress", "info");
                }
            }

            clearTerminal() {
                document.getElementById('terminalOutput').innerHTML = `
                    <div class="terminal-line hf">⟩⟩ Hugging Face Dataset Generator v2.2</div>
                    <div class="terminal-line output">Fixed Hugging Face schema compatibility</div>
                    <div class="terminal-line output">All exports validated for HF Hub upload</div>
                    <div class="terminal-line output">Terminal cleared</div>
                `;
            }
        }

        // ==================== OS FUNCTIONS ====================
        let hfGenerator = null;

        function openHFWindow() {
            document.getElementById('hfWindow').classList.add('active');
            if (!hfGenerator) {
                hfGenerator = new HFDatasetGenerator();
            }
        }

        function closeHFWindow() {
            document.getElementById('hfWindow').classList.remove('active');
        }

        document.addEventListener('DOMContentLoaded', function() {
            // Boot sequence
            const loadingFill = document.getElementById('loadingFill');
            const loadingScreen = document.getElementById('loadingScreen');
            const taskbar = document.getElementById('taskbar');
            
            let loadProgress = 0;
            const loadInterval = setInterval(() => {
                loadProgress += 2;
                loadingFill.style.width = loadProgress + '%';
                
                if (loadProgress >= 100) {
                    clearInterval(loadInterval);
                    setTimeout(() => {
                        loadingScreen.style.display = 'none';
                        taskbar.style.display = 'flex';
                        hfGenerator = new HFDatasetGenerator();
                        
                        // Auto-open window after brief delay
                        setTimeout(() => {
                            openHFWindow();
                        }, 300);
                    }, 500);
                }
            }, 30);

            // Update clock
            function updateClock() {
                const now = new Date();
                const time = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' });
                document.getElementById('clock').textContent = time;
            }
            setInterval(updateClock, 1000);
            updateClock();

            // Keyboard shortcuts
            document.addEventListener('keydown', (e) => {
                // Ctrl+G to generate dataset
                if (e.ctrlKey && e.key === 'g') {
                    e.preventDefault();
                    if (hfGenerator) hfGenerator.generateDataset();
                }
                
                // Ctrl+E to export
                if (e.ctrlKey && e.key === 'e') {
                    e.preventDefault();
                    if (hfGenerator) hfGenerator.exportDataset();
                }
                
                // Escape to close window
                if (e.key === 'Escape') {
                    closeHFWindow();
                }
                
                // Focus input when typing in terminal
                if (e.key.length === 1 && !e.ctrlKey && !e.metaKey) {
                    const input = document.getElementById('hfInput');
                    if (document.getElementById('hfWindow').classList.contains('active')) {
                        input.focus();
                    }
                }
            });

            // Terminal input
            const hfInput = document.getElementById('hfInput');
            hfInput.addEventListener('keypress', (e) => {
                if (e.key === 'Enter') {
                    if (hfGenerator) hfGenerator.executeCommand();
                }
            });
            
            // Initial configuration updates
            document.getElementById('sampleCount').dispatchEvent(new Event('input'));
            document.getElementById('matrixSize').dispatchEvent(new Event('input'));
            document.getElementById('trainSplit').dispatchEvent(new Event('input'));
        });
    </script>
</body>
</html>