-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex_v1.html
More file actions
2435 lines (2267 loc) · 173 KB
/
index_v1.html
File metadata and controls
2435 lines (2267 loc) · 173 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="he" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>אלבומי תמונות לאומיים של מדינת ישראל | בר-אילן · חיפה</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web" crossorigin="anonymous"></script>
<!-- React & ReactDOM -->
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin="anonymous"></script>
<!-- Babel -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js" crossorigin="anonymous"></script>
<style>
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
body { font-family: system-ui, -apple-system, sans-serif; background-color: #f8fafc; overflow-x: hidden; }
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.barcode-stripe { transition: opacity 0.2s; }
.barcode-stripe:hover { opacity: 0.5; cursor: pointer; }
.img-card:hover .img-overlay { opacity: 1; }
.obj-bubble { transition: all 0.2s ease; }
.obj-bubble:hover { transform: scale(1.05); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); z-index: 10; }
.treemap-node { transition: all 0.3s; border: 1px solid rgba(255,255,255,0.2); }
.treemap-node:hover { filter: brightness(1.1); transform: scale(0.99); box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 10; }
</style>
</head>
<body class="text-slate-800 h-screen flex flex-col overflow-hidden">
<div id="root" class="h-full flex flex-col"></div>
<div id="tt-root" style="position:fixed;top:0;left:0;width:0;height:0;z-index:9999;pointer-events:none;"></div>
<div id="err" style="display:none;position:fixed;top:0;left:0;right:0;background:#fee2e2;color:#991b1b;padding:16px;font-family:monospace;font-size:13px;z-index:99999;overflow:auto;max-height:60vh;white-space:pre-wrap;"></div>
<script>
function showErr(msg) { var d=document.getElementById('err'); d.style.display='block'; d.textContent=msg; }
window.onerror=function(m,s,l,c,e){ showErr('JS Error line '+l+' col '+c+': '+m+'\nSource: '+s+'\n'+(e&&e.stack?e.stack:'')); };
window.addEventListener('unhandledrejection',function(e){ showErr('Unhandled Promise: '+(e.reason&&e.reason.stack?e.reason.stack:e.reason)); });
// Intercept Babel transform errors
document.addEventListener('DOMContentLoaded',function(){
var orig = window.Babel && window.Babel.transform;
if(orig) { window.Babel.transform = function(code,opts){ try{ return orig.call(this,code,opts); } catch(e){ showErr('Babel parse error:\n'+e.message); throw e; } }; }
});
</script>
<script type="text/babel">
const { useState, useMemo, useEffect, useCallback, useRef } = React;
// ── Language context ───────────────────────────────────────────────────
const LangContext = React.createContext('he');
const useLang = () => React.useContext(LangContext);
// Bilingual VIZ title component
const VizTitle = ({ icon, iconColor, he, en }) => {
const lang = useLang();
return (
<h3 className="text-2xl font-black text-slate-800 flex items-center gap-3 mb-2">
<i className={`${icon} ${iconColor}`}></i>
{lang === 'he' ? he : en}
</h3>
);
};
// --- Core Parsing ---
const parseCaptionString = (captionStr) => {
if (!captionStr) return {};
const parts = captionStr.split(' | ');
const result = {};
parts.forEach(part => {
const colonIndex = part.indexOf(':');
if (colonIndex > -1) {
const key = part.slice(0, colonIndex).trim();
const value = part.slice(colonIndex + 1).trim();
result[key] = value;
}
});
return result;
};
const VIBE_COLORS = {
// ── Core emotions ──────────────────────────────────────────────
'historical': '#64748b',
'relaxed': '#38bdf8',
'tense': '#ef4444',
'somber': '#7c3aed',
'celebratory': '#f59e0b',
'ruins': '#a8a29e',
'war': '#991b1b',
'peaceful': '#34d399',
'neutral': '#cbd5e1',
'violent': '#dc2626',
// ── From actual album data ──────────────────────────────────────
'serious': '#475569',
'documentary': '#0891b2',
'war-torn': '#b91c1c',
'laborious': '#92400e',
'determined': '#15803d',
'desolate': '#a16207',
'ancient': '#7c2d12',
'solemn': '#3730a3',
'crowded': '#be185d',
'hopeful': '#059669',
'patriotic': '#1d4ed8',
'industrious': '#d97706',
'agricultural': '#65a30d',
'communal': '#7c3aed',
'joyful': '#ea580c',
'austere': '#6b7280',
'prayerful': '#9333ea',
'bustling': '#0369a1',
'meditative': '#0f766e',
'triumphant': '#dc2626',
'reverent': '#4338ca',
'melancholic': '#1e3a5f',
'nostalgic': '#c2410c',
};
const getVibeColor = (vibe) => {
if (!vibe) return '#e2e8f0';
const firstVibe = vibe.split(',')[0].trim().toLowerCase();
return VIBE_COLORS[firstVibe] || '#94a3b8';
};
const getTagColor = (type) => {
const colors = {
Scene: 'bg-blue-100 text-blue-800 border-blue-300 hover:bg-blue-200',
Vibe: 'bg-purple-100 text-purple-800 border-purple-300 hover:bg-purple-200',
Objects: 'bg-emerald-100 text-emerald-800 border-emerald-300 hover:bg-emerald-200',
People: 'bg-amber-100 text-amber-800 border-amber-300 hover:bg-amber-200'
};
return colors[type] || 'bg-slate-100 text-slate-800 border-slate-300 hover:bg-slate-200';
};
// ── Image proxy: use server-side cache only when running via node server.js ───
// On GitHub Pages or other static hosts, fall back to direct S3 URI.
const IS_SERVER = typeof window !== 'undefined' &&
['localhost', '127.0.0.1', '0.0.0.0'].includes(window.location.hostname);
const getImgSrc = (img) => {
if (!img) return '';
if (IS_SERVER && img.image_id) return `/img/${encodeURIComponent(img.image_id)}`;
return img.uri ? img.uri.split('?')[0] : '';
};
// ── Floating chart tooltip (portal to dedicated fixed root) ──────────
const ChartTooltip = ({ tooltip }) => {
if (!tooltip) return null;
const vw = window.innerWidth || 1200;
const vh = window.innerHeight || 800;
const W = 220;
const left = tooltip.x + 14 + W > vw ? tooltip.x - W - 8 : tooltip.x + 14;
const top = tooltip.y + 10 + 80 > vh ? tooltip.y - 80 : tooltip.y + 10;
const style = { position: 'fixed', left, top, zIndex: 9999, pointerEvents: 'none' };
const root = document.getElementById('tt-root') || document.body;
return ReactDOM.createPortal(
<div style={style} className="bg-slate-900/95 text-white text-xs px-3 py-2.5 rounded-xl shadow-2xl border border-slate-700 max-w-[220px] whitespace-pre-line leading-relaxed">
{tooltip.content}
</div>,
root
);
};
const primaryScene = (sceneText) => {
if (!sceneText) return 'unknown';
return sceneText.split(',')[0].replace(/\([^)]*\)/g, '').trim().toLowerCase() || 'unknown';
};
const primaryVibe = (vibeText) => {
if (!vibeText) return 'neutral';
return vibeText.split(',')[0].trim().toLowerCase() || 'neutral';
};
const toPeopleValue = (peopleText) => {
if (peopleText === '1') return 1;
if (peopleText === '2') return 2;
if (peopleText === '5+') return 5;
const parsed = parseInt(peopleText, 10);
return Number.isFinite(parsed) ? Math.max(0, Math.min(parsed, 5)) : 0;
};
const tokenize = (text) => {
if (!text) return [];
return text
.toLowerCase()
.replace(/[^\w\u0590-\u05FF\s]/g, ' ')
.split(/\s+/)
.filter(token => token.length > 2);
};
const toTokenSet = (text) => new Set(tokenize(text));
const jaccardDistance = (setA, setB) => {
if (!setA.size && !setB.size) return 0;
const intersection = [...setA].filter(v => setB.has(v)).length;
const union = new Set([...setA, ...setB]).size || 1;
return 1 - (intersection / union);
};
const sceneColor = (sceneName) => {
const str = sceneName || 'unknown';
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
const hue = Math.abs(hash) % 360;
return `hsl(${hue}, 68%, 46%)`;
};
// --- Bilingual Academic Explanation Component ---
const BilingualTheoryBox = ({ titleHe, titleEn, fields, algoHe, algoEn, claimHe, claimEn, fieldMapHe = [], fieldMapEn = [], stepsHe = [], stepsEn = [] }) => {
const [isOpen, setIsOpen] = useState(false);
const autoFields = (fields || '')
.split(/,|&|->|vs\.?/i)
.map(x => x.trim())
.filter(Boolean);
const computedFieldMapHe = fieldMapHe.length
? fieldMapHe
: (autoFields.length ? autoFields.map(f => ({ field: f, action: 'השדה נקרא ישירות מה-JSON ומשמש בחישוב המדד.' })) : [{ field: fields, action: 'שדות הקלט שהרכיב קורא ישירות לצורך החישוב.' }]);
const computedFieldMapEn = fieldMapEn.length
? fieldMapEn
: (autoFields.length ? autoFields.map(f => ({ field: f, action: 'The field is read directly from JSON and consumed in this metric.' })) : [{ field: fields, action: 'Direct input fields consumed by this model.' }]);
const computedStepsHe = stepsHe.length ? stepsHe : [
'שליפת השדות המוגדרים מכל תמונה בקורפוס הפעיל.',
'ניקוי/נרמול ערכים כדי לאחד פורמטים טקסטואליים וקטגוריאליים.',
algoHe
];
const computedStepsEn = stepsEn.length ? stepsEn : [
'Extract configured fields from each image in the active corpus.',
'Normalize values to align mixed textual and categorical formats.',
algoEn
];
return (
<div className="mt-2 mb-6 w-full">
<button onClick={() => setIsOpen(!isOpen)} className={`flex items-center justify-between w-full text-xs font-bold px-5 py-3 rounded-xl transition-all border shadow-sm ${isOpen ? 'bg-slate-800 text-white border-slate-700' : 'bg-white text-slate-600 border-slate-200 hover:bg-slate-50'}`}>
<span className="flex items-center gap-2">
<i className={`ph-bold text-lg ${isOpen ? 'ph-caret-up text-blue-400' : 'ph-info text-blue-600'}`}></i>
{isOpen ? 'סגור חלון הסבר / Close Method Window' : 'פתח חלון הסבר מתודולוגי / Open Method Window'}
</span>
<span className="font-mono text-[10px] opacity-50">{fields}</span>
</button>
{isOpen && (
<div className="fixed inset-0 z-50 bg-slate-900/70 backdrop-blur-sm p-4 md:p-8 fade-in" onClick={() => setIsOpen(false)}>
<div className="max-w-6xl mx-auto h-full bg-slate-800 text-slate-200 rounded-2xl border border-slate-700 shadow-2xl overflow-hidden" onClick={(e) => e.stopPropagation()}>
<div className="px-6 py-4 border-b border-slate-700 flex items-center justify-between">
<div>
<h4 className="font-black text-white text-lg">{titleHe} / {titleEn}</h4>
<p className="text-xs text-slate-400 mt-1">Fields: {fields}</p>
</div>
<button onClick={() => setIsOpen(false)} className="bg-slate-700 hover:bg-slate-600 px-3 py-2 rounded-lg text-xs font-bold">סגור / Close</button>
</div>
<div className="h-[calc(100%-70px)] overflow-y-auto p-6 grid grid-cols-1 xl:grid-cols-2 gap-6">
<div className="space-y-5" dir="rtl">
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-emerald-300 text-xs uppercase tracking-widest block mb-2">שדות קלט מדויקים</strong>
<div className="space-y-2 text-sm">
{computedFieldMapHe.map((item, idx) => (
<div key={`he-field-${idx}`} className="border-b border-slate-600/40 pb-2 last:border-b-0 last:pb-0">
<div className="font-mono text-xs text-blue-200">{item.field}</div>
<div className="text-slate-300 text-xs mt-1">{item.action}</div>
</div>
))}
</div>
</div>
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-amber-300 text-xs uppercase tracking-widest block mb-2">מה המערכת עושה בדיוק</strong>
<ol className="space-y-2 text-sm list-decimal list-inside text-slate-200">
{computedStepsHe.map((step, idx) => <li key={`he-step-${idx}`}>{step}</li>)}
</ol>
</div>
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-purple-300 text-xs uppercase tracking-widest block mb-1">משמעות תיאורטית</strong>
<p className="text-sm text-slate-200 leading-relaxed">{claimHe}</p>
</div>
</div>
<div className="space-y-5" dir="ltr">
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-emerald-300 text-xs uppercase tracking-widest block mb-2">Exact Input Fields</strong>
<div className="space-y-2 text-sm">
{computedFieldMapEn.map((item, idx) => (
<div key={`en-field-${idx}`} className="border-b border-slate-600/40 pb-2 last:border-b-0 last:pb-0">
<div className="font-mono text-xs text-blue-200">{item.field}</div>
<div className="text-slate-300 text-xs mt-1">{item.action}</div>
</div>
))}
</div>
</div>
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-amber-300 text-xs uppercase tracking-widest block mb-2">Exact Computational Pipeline</strong>
<ol className="space-y-2 text-sm list-decimal list-inside text-slate-200">
{computedStepsEn.map((step, idx) => <li key={`en-step-${idx}`}>{step}</li>)}
</ol>
</div>
<div className="bg-slate-700/40 border border-slate-600 rounded-xl p-4">
<strong className="text-purple-300 text-xs uppercase tracking-widest block mb-1">Theoretical Framing</strong>
<p className="text-sm text-slate-200 leading-relaxed">{claimEn}</p>
</div>
</div>
</div>
</div>
</div>
)}
</div>
);
};
const OptimizedImage = ({ src, alt, className, eager = false }) => {
const containerRef = useRef(null);
const [shouldRender, setShouldRender] = useState(eager);
const [isLoaded, setIsLoaded] = useState(false);
const [hasError, setHasError] = useState(false);
useEffect(() => {
setHasError(false);
setIsLoaded(false);
setShouldRender(eager);
}, [src, eager]);
useEffect(() => {
if (!src || eager || shouldRender) return;
const node = containerRef.current;
if (!node || typeof IntersectionObserver === 'undefined') {
setShouldRender(true);
return;
}
const observer = new IntersectionObserver((entries) => {
if (entries.some(entry => entry.isIntersecting)) {
setShouldRender(true);
observer.disconnect();
}
}, { rootMargin: '320px' });
observer.observe(node);
return () => observer.disconnect();
}, [src, eager, shouldRender]);
return (
<div ref={containerRef} className="w-full h-full bg-slate-200 relative overflow-hidden">
{!isLoaded && !hasError && (
<div className="absolute inset-0 bg-gradient-to-br from-slate-200 via-slate-100 to-slate-200 animate-pulse"></div>
)}
{src && shouldRender && !hasError && (
<img
src={src}
alt={alt || ''}
referrerPolicy="no-referrer"
loading={eager ? 'eager' : 'lazy'}
decoding="async"
fetchPriority={eager ? 'high' : 'low'}
onLoad={() => setIsLoaded(true)}
onError={() => setHasError(true)}
className={`${className} ${isLoaded ? 'opacity-100' : 'opacity-0'} transition-opacity duration-300`}
/>
)}
{(!src || hasError) && (
<div className="flex flex-col items-center justify-center h-full text-slate-400">
<i className="ph ph-image-broken text-3xl"></i>
</div>
)}
</div>
);
};
// ==========================================
// VIZ 1: הדיאלקטיקה המולטי-מודאלית (Modalities)
// ==========================================
const ModalitiesDialectic = ({ images }) => {
const [ttip, setTtip] = useState(null);
const data = useMemo(() => {
let visualWords = 0; let textualWords = 0;
images.forEach(img => {
const m = img.parsedMetadata;
visualWords += (m.Objects ? m.Objects.split(',').length : 0) + (m.Description ? m.Description.split(' ').length : 0);
textualWords += (m.Caption ? m.Caption.split(' ').length : 0) + (m.Text ? m.Text.split(' ').length : 0);
});
const total = visualWords + textualWords || 1;
return { vPct: (visualWords/total)*100, tPct: (textualWords/total)*100, visualWords, textualWords };
}, [images]);
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-arrows-split" iconColor="text-blue-600" he="מולטי-מודאליות: תמונה מול טקסט" en="Modalities Dialectic: Image vs. Text" />
<BilingualTheoryBox
titleHe="זירת התיווך המולטי-מודאלית"
titleEn="The Multimodal Mediation Arena"
fields="Objects & Description vs. Caption & OCR"
algoHe="השוואה כמותית של 'נפח המידע'. האלגוריתם סוכם את כמות האובייקטים והמילים בתיאור הראייה הממוחשבת (המידע הויזואלי הגולמי) אל מול מספר המילים בכיתוב המקורי של האלבום ובטקסט שזוהה בתוך התמונה (התיווך הטקסטואלי)."
algoEn="Quantitative comparison of 'information volume'. The algorithm sums the count of detected objects and computer vision description words (raw visual data) versus the word count of the original album caption and in-image OCR text (textual mediation)."
claimHe="האלבום מתווך מציאות ולא רק משקף אותה. המודל מציף פערים: לדוגמה, תמונה עמוסה בפרטים ויזואליים שמקבלת כיתוב קצר וחד-מימדי המצמצם את משמעותה להקשר לאומי צר."
claimEn="The album mediates reality rather than just reflecting it. This model highlights discrepancies: e.g., a visually cluttered image accompanied by a reductive, one-dimensional caption that restricts its meaning to a narrow national context."
/>
<div className="mt-8 bg-slate-50 p-6 rounded-2xl border border-slate-200">
<div className="flex justify-between mb-2 font-bold text-sm">
<span className="text-blue-600">העושר הויזואלי (המצלמה)</span>
<span className="text-amber-600">התיווך הטקסטואלי (העורך)</span>
</div>
<div className="h-10 w-full bg-slate-200 rounded-full overflow-hidden flex shadow-inner">
<div className="h-full bg-gradient-to-r from-blue-400 to-blue-600 flex items-center px-4 text-white font-bold cursor-pointer" style={{width: `${data.vPct}%`}}
onMouseEnter={e => setTtip({x:e.clientX,y:e.clientY,content:`עושר ויזואלי
אובייקטים + תיאורים: ${data.visualWords} ישויות
${data.vPct.toFixed(1)}% מסך המידע`})}
onMouseMove={e => setTtip(p => p ? {...p,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}>{data.vPct.toFixed(1)}%</div>
<div className="h-full bg-gradient-to-r from-amber-500 to-amber-400 flex items-center justify-end px-4 text-white font-bold cursor-pointer" style={{width: `${data.tPct}%`}}
onMouseEnter={e => setTtip({x:e.clientX,y:e.clientY,content:`תיווך טקסטואלי
כיתובים + OCR: ${data.textualWords} מילים
${data.tPct.toFixed(1)}% מסך המידע`})}
onMouseMove={e => setTtip(p => p ? {...p,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}>{data.tPct.toFixed(1)}%</div>
</div>
<div className="flex justify-between mt-4 text-xs text-slate-500">
<span>{data.visualWords} ישויות/מילים זוהו</span>
<span>{data.textualWords} מילים הודפסו</span>
</div>
</div>
<ChartTooltip tooltip={ttip} />
</div>
);
};
// ==========================================
// VIZ 2: התחביר המרחבי (Spatial Syntax)
// ==========================================
const SpatialSyntax = ({ images, onTagClick }) => {
const [ttip, setTtip] = useState(null);
const data = useMemo(() => {
const pages = images
.map(img => ({
page: img.image_num,
scene: primaryScene(img.parsedMetadata.Scene),
objects: (img.parsedMetadata.Objects || '').split(',').map(x => x.trim().toLowerCase()).filter(Boolean)
}))
.sort((a, b) => a.page - b.page);
const sceneCounts = {};
const sceneObjects = {};
pages.forEach(p => {
sceneCounts[p.scene] = (sceneCounts[p.scene] || 0) + 1;
if (!sceneObjects[p.scene]) sceneObjects[p.scene] = {};
p.objects.forEach(obj => {
sceneObjects[p.scene][obj] = (sceneObjects[p.scene][obj] || 0) + 1;
});
});
const topScenes = Object.entries(sceneCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 8)
.map(([name]) => name);
const binCount = Math.min(30, Math.max(12, Math.round(pages.length / 4)));
const sceneBins = {};
topScenes.forEach(scene => {
sceneBins[scene] = new Array(binCount).fill(0);
});
pages.forEach((p, idx) => {
if (!sceneBins[p.scene]) return;
const bin = Math.min(binCount - 1, Math.floor((idx / Math.max(1, pages.length)) * binCount));
sceneBins[p.scene][bin] += 1;
});
const topObjectsByScene = {};
topScenes.forEach(scene => {
topObjectsByScene[scene] = Object.entries(sceneObjects[scene] || {})
.sort((a, b) => b[1] - a[1])
.slice(0, 4);
});
const transitionCounts = {};
for (let i = 1; i < pages.length; i++) {
const prev = pages[i - 1].scene;
const curr = pages[i].scene;
const key = `${prev}=>${curr}`;
transitionCounts[key] = (transitionCounts[key] || 0) + 1;
}
const topTransitions = Object.entries(transitionCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 8)
.map(([key, count]) => {
const [from, to] = key.split('=>');
return { from, to, count };
});
let maxBin = 1;
topScenes.forEach(scene => {
sceneBins[scene].forEach(v => {
if (v > maxBin) maxBin = v;
});
});
return { pages, topScenes, sceneCounts, sceneBins, topObjectsByScene, topTransitions, maxBin, binCount };
}, [images]);
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-graph" iconColor="text-emerald-600" he="התחביר המרחבי: לינארי + מצרפי" en="Spatial Syntax: Sequential + Aggregate" />
<BilingualTheoryBox
titleHe="האקולוגיה של המרחב הלאומי"
titleEn="Ecology of the National Space"
fields="image_num, Scene, Objects"
fieldMapHe={[
{ field: 'image_num', action: 'מסדר את האלבום כרצף לינארי קבוע (ציר זמן של דפים).' },
{ field: 'Scene', action: 'מחלץ סצנה ראשית לכל עמוד, מחשב שכיחות, יוצר bins זמן, ומחשב מעברים בין סצנות רצופות.' },
{ field: 'Objects', action: 'מחשב חתימת אובייקטים מובילים לכל סצנה לצורך פרשנות חומרית.' }
]}
fieldMapEn={[
{ field: 'image_num', action: 'Orders the album as a fixed linear page-time axis.' },
{ field: 'Scene', action: 'Extracts the primary scene per page, computes frequency, temporal bins, and adjacent scene transitions.' },
{ field: 'Objects', action: 'Builds top-object signatures per scene for material interpretation.' }
]}
stepsHe={[
'המערכת ממיינת עמודים לפי image_num ומחלצת scene ראשי מכל תמונה.',
'המערכת בונה שני ייצוגים במקביל: סרט לינארי דף-דף ו-heatmap מרוכז לפי מקטעי זמן.',
'לכל סצנה מחושבים אובייקטים מובילים ומעברי סצנה עוקבים (Scene_i -> Scene_i+1).'
]}
stepsEn={[
'Pages are sorted by image_num and mapped to a primary scene label.',
'Two views are computed simultaneously: a page-level linear strip and a temporally binned heatmap.',
'Top object signatures per scene and adjacent scene transitions (Scene_i -> Scene_i+1) are then computed.'
]}
algoHe="בניית מודל כפול: גם רצף לינארי לכל עמוד וגם דחיסת זמן למקטעים קבועים. החישוב משלב שכיחות סצנות, צפיפות לאורך האלבום ומעברי סצנה רציפים, כדי לחשוף מבנה מרחבי ונרטיבי יחד."
algoEn="A dual model combines page-level linear sequence with fixed temporal binning. The computation integrates scene frequency, distribution over album time, and adjacent scene transitions to reveal spatial and narrative structure together."
claimHe="חושף את ה'דקדוק החומרי' של הלאום ואת מיקום החפצים במרחב. אילו כלים מאפיינים את זירת ההתיישבות לעומת זירת המלחמה? מהו הציוד החומרי של 'החלוץ'? מספק אונטולוגיה של המרחב הציבורי והפרטי."
claimEn="Exposes the 'material grammar' of the nation and the spatial placement of items. What tools characterize the settlement scene versus the war zone? Provides an ontology of public and private national spaces."
/>
<div className="mt-6 bg-slate-50 border border-slate-200 rounded-2xl p-4">
<div className="flex items-center justify-between mb-3">
<h4 className="text-sm font-black text-slate-700">תצוגה לינארית: סצנה לכל עמוד</h4>
<span className="text-xs text-slate-500">{data.pages.length} עמודים</span>
</div>
<div className="h-16 w-full flex rounded-lg overflow-hidden border border-slate-300 bg-white">
{data.pages.map(p => (
<div
key={p.page}
className="flex-1 min-w-[2px] cursor-pointer hover:opacity-80"
style={{ backgroundColor: sceneColor(p.scene) }}
onMouseEnter={e => setTtip({x:e.clientX,y:e.clientY,content:`עמ' ${p.page}\nסצנה: ${p.scene}`})}
onMouseMove={e => setTtip(p2 => p2 ? {...p2,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}
onClick={() => onTagClick && onTagClick(p.scene, 'Scene')}
></div>
))}
</div>
</div>
<div className="mt-6 overflow-x-auto" dir="ltr">
<div className="min-w-[960px] bg-slate-50 border border-slate-200 rounded-2xl p-4 space-y-3">
<div className="flex items-center justify-between">
<h4 className="text-sm font-black text-slate-700">תצוגה מרוכזת: צפיפות סצנות לאורך האלבום</h4>
<span className="text-xs text-slate-500">{data.binCount} מקטעי זמן</span>
</div>
{data.topScenes.map(scene => (
<div key={scene} className="grid grid-cols-[180px_1fr_220px] gap-3 items-center">
<button
onClick={() => onTagClick && onTagClick(scene, 'Scene')}
className="text-left text-xs font-bold capitalize text-slate-700 hover:text-emerald-700"
style={{ borderLeft: `6px solid ${sceneColor(scene)}`, paddingLeft: '8px' }}
title={`Filter by scene: ${scene}`}
>
{scene} ({data.sceneCounts[scene] || 0})
</button>
<div className="flex h-8 rounded overflow-hidden border border-slate-300 bg-white">
{data.sceneBins[scene].map((value, idx) => {
const intensity = value / data.maxBin;
return (
<div
key={`${scene}-bin-${idx}`}
className="flex-1 border-r border-slate-200/40"
style={{ backgroundColor: sceneColor(scene), opacity: value ? 0.12 + intensity * 0.88 : 0.04 }}
onMouseEnter={e => setTtip({x:e.clientX,y:e.clientY,content:`${scene}\nמקטע ${idx + 1}/${data.binCount}\n${value} עמודים`})}
onMouseMove={e => setTtip(p => p ? {...p,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}
></div>
);
})}
</div>
<div className="flex flex-wrap gap-1.5">
{(data.topObjectsByScene[scene] || []).map(([obj, freq]) => (
<button
key={`${scene}-${obj}`}
onClick={() => onTagClick && onTagClick(obj, 'Objects')}
className="px-2 py-1 rounded-md text-[11px] bg-white border border-slate-300 text-slate-700 hover:bg-emerald-50 capitalize"
title={`${obj}: ${freq}`}
>
{obj} ({freq})
</button>
))}
</div>
</div>
))}
</div>
</div>
<div className="mt-6 bg-slate-50 border border-slate-200 rounded-2xl p-4">
<h4 className="text-sm font-black text-slate-700 mb-3">מעברי סצנה מובילים (לינארי)</h4>
<div className="flex flex-wrap gap-2">
{data.topTransitions.map((tr, idx) => (
<button
key={`${tr.from}-${tr.to}-${idx}`}
onClick={() => onTagClick && onTagClick(tr.from, 'Scene')}
className="px-3 py-2 rounded-lg bg-white border border-slate-300 text-xs font-bold text-slate-700 hover:bg-slate-100"
title={`Transition count: ${tr.count}`}
>
<span className="capitalize">{tr.from}</span> <span className="mx-1">→</span> <span className="capitalize">{tr.to}</span> <span className="text-slate-500">({tr.count})</span>
</button>
))}
{data.topTransitions.length === 0 && (
<div className="text-xs text-slate-500">אין מספיק מידע למעברים.</div>
)}
</div>
</div>
<ChartTooltip tooltip={ttip} />
</div>
);
};
// ==========================================
// VIZ 3: הברקוד הרגשי (Vibe Barcode)
// ==========================================
const VibeBarcode = ({ images, onTagClick }) => {
const [ttip, setTtip] = useState(null);
const existingVibes = useMemo(() => {
const vibes = new Set();
images.forEach(img => { if(img.parsedMetadata.Vibe) vibes.add(img.parsedMetadata.Vibe.split(',')[0].trim().toLowerCase()); });
return Array.from(vibes).slice(0,8);
}, [images]);
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-barcode" iconColor="text-purple-600" he="הברקוד הרגשי" en="Emotional Barcode" />
<BilingualTheoryBox
titleHe="הטמפורליות של האווירה"
titleEn="Temporality of the Vibe"
fields="image_num (X-axis) & Vibe (Color)"
algoHe="דחיסת כל עמוד באלבום לפס אנכי המסודר לינארית (מעמוד 1 ועד הסוף). צבע הפס נגזר מהאווירה (Vibe) הראשית שזוהתה בתמונה על ידי מודל השפה."
algoEn="Compressing each album page into a vertical stripe arranged linearly (from page 1 to the end). The stripe's color is derived from the primary emotional 'Vibe' detected in the image by the language model."
claimHe="האלבום אינו ארכיון אקראי אלא נרטיב קולנועי מתוזמן. הברקוד מאפשר לזהות את ה'פסקול הויזואלי' במבט מהיר: מעבר מגוונים אדומים (מתח/מלחמה) בתחילת האלבום לגוונים בהירים (רגיעה/בניין) בסופו."
claimEn="The album is not a random archive but a timed cinematic narrative. The barcode identifies the 'visual soundtrack' at a glance: e.g., transitioning from red hues (tension/war) early on, to light hues (peace/building) at the end."
/>
<div className="flex flex-wrap gap-3 mb-4 mt-4">
{existingVibes.map(v => (
<div key={v} className="flex items-center gap-1.5 text-xs text-slate-600 font-medium">
<span className="w-3 h-3 rounded-full" style={{backgroundColor: getVibeColor(v)}}></span>
<span className="capitalize">{v}</span>
</div>
))}
</div>
<div className="h-20 w-full flex bg-slate-100 rounded-lg overflow-hidden border border-slate-300 shadow-inner">
{images.map(img => {
const vibe = img.parsedMetadata.Vibe ? img.parsedMetadata.Vibe.split(',')[0].trim().toLowerCase() : 'neutral';
const allVibes = img.parsedMetadata.Vibe || vibe;
return <div key={img.image_num}
onClick={()=>onTagClick&&onTagClick(vibe, 'Vibe')}
onMouseEnter={(e) => setTtip({ x:e.clientX, y:e.clientY, content:`עמוד ${img.image_num}\n${allVibes}` })}
onMouseMove={(e) => setTtip(p => p ? {...p, x:e.clientX, y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}
className="flex-1 h-full barcode-stripe cursor-pointer" style={{ backgroundColor: getVibeColor(vibe) }}></div>;
})}
</div>
<ChartTooltip tooltip={ttip} />
</div>
);
};
// ==========================================
// VIZ 4: זרימה דמוגרפית (Demographic Stream)
// ==========================================
const DemographicStream = ({ images }) => {
const [ttip, setTtip] = useState(null);
const contRefD = useRef(null);
const streamData = images.map(img => {
const p = img.parsedMetadata.People;
let val = 0; if(p === '1') val = 1; else if(p === '2') val = 2; else if(p === '5+') val = 5;
return { page: img.image_num, val };
});
const createPath = (data, w, h) => {
if(!data.length) return '';
const stepX = w/(data.length-1);
let d=`M 0 ${h}`;
data.forEach((p,i) => { d+=` L ${i*stepX} ${h-((p.val/5)*h)}`});
return d+` L ${w} ${h} Z`;
};
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-users" iconColor="text-blue-600" he="המקצב הדמוגרפי" en="Demographic Rhythm" />
<BilingualTheoryBox
titleHe="זרימת הנוכחות האנושית"
titleEn="Human Presence Flow"
fields="image_num (X-axis) & People (Y-axis Area)"
algoHe="המרת הערכים הקטגוריאליים של שדה האנשים ('0', '1', '2', '5+') לערכים מספריים רציפים. שרטוט הפוליגון כגרף שטח המייצג גובה וצפיפות לאורך ציר הזמן הלינארי של האלבום."
algoEn="Converting the categorical values of the People field ('0', '1', '2', '5+') into continuous numerical values. Drawing a polygon area chart that represents height and density along the linear timeline of the album."
claimHe="בוחן את יחס האלבום לפרט מול הכלל. האם האלבום מקדם נרטיב קולקטיביסטי המבוסס על המונים (פיקים גבוהים ועקביים של 5+), מתמקד בגיבור האינדיבידואלי (קו ישר על 1), או מציג נופים וטבע ריקים מאדם?"
claimEn="Examines the album's attitude towards the individual vs. the collective. Does it promote a collectivist narrative based on crowds (consistent 5+ peaks), focus on the individual hero (straight line on 1), or show empty landscapes?"
/>
<div ref={contRefD} className="relative w-full h-32 bg-slate-50 border-b-2 border-slate-300 mt-6 cursor-crosshair"
onMouseMove={(e) => { const r=contRefD.current?.getBoundingClientRect(); if(!r) return; const idx=Math.max(0,Math.min(streamData.length-1,Math.round(((e.clientX-r.left)/r.width)*(streamData.length-1)))); const pt=streamData[idx]; const lab={0:'ללא אנשים',1:'1 אדם',2:'2 אנשים',5:'5+ (המונים)'}[pt.val]||String(pt.val); setTtip({x:e.clientX,y:e.clientY,content:`עמוד ${pt.page}\n${lab}`}); }}
onMouseLeave={() => setTtip(null)}>
<svg className="w-full h-full" preserveAspectRatio="none" viewBox="0 0 1000 160">
<line x1="0" y1="32" x2="1000" y2="32" stroke="#e2e8f0" strokeDasharray="4 4" />
<text x="10" y="28" fontSize="12" fill="#94a3b8">5+ (המונים / Crowds)</text>
<line x1="0" y1="96" x2="1000" y2="96" stroke="#e2e8f0" strokeDasharray="4 4" />
<text x="10" y="92" fontSize="12" fill="#94a3b8">2 אנשים / People</text>
<path d={createPath(streamData, 1000, 160)} fill="rgba(59, 130, 246, 0.2)" stroke="#3b82f6" strokeWidth="2" />
</svg>
</div>
<ChartTooltip tooltip={ttip} />
</div>
);
};
// ==========================================
// VIZ 5: מקצב מרחבי (Spatial Rhythm - Indoor/Outdoor)
// ==========================================
const SpatialRhythm = ({ images, onTagClick }) => {
const [ttip, setTtip] = useState(null);
const contRefS = useRef(null);
const data = images.map(img => {
const scene = (img.parsedMetadata.Scene || '').toLowerCase();
return { page: img.image_num, isOut: scene.includes('(outdoor)') ? 1 : 0, isIn: scene.includes('(indoor)') ? 1 : 0 };
});
const buildLinePath = (values, w, h) => {
if (!values.length) return '';
if (values.length === 1) return `M 0 ${h - values[0] * h} L ${w} ${h - values[0] * h}`;
const step = w / (values.length - 1);
let path = '';
values.forEach((v, i) => {
const x = i * step;
const y = h - v * h;
path += `${i === 0 ? 'M' : 'L'} ${x} ${y} `;
});
return path;
};
const outdoorVals = data.map(d => d.isOut);
const indoorVals = data.map(d => d.isIn);
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-house-line" iconColor="text-teal-600" he="מקצב מרחבי (פנים מול חוץ)" en="Spatial Rhythm (Indoor vs. Outdoor)" />
<BilingualTheoryBox
titleHe="קצב התנועה בין פנים לחוץ"
titleEn="Rhythm of Movement: Indoor vs. Outdoor"
fields="image_num & Scene (Regex search for 'indoor/outdoor')"
fieldMapHe={[
{ field: 'image_num', action: 'ממקם כל עמוד על ציר הזמן של האלבום.' },
{ field: 'Scene', action: 'מאתר אם מופיע indoor או outdoor וממיר לוקטור בינארי לכל עמוד.' }
]}
fieldMapEn={[
{ field: 'image_num', action: 'Positions every page on the album timeline.' },
{ field: 'Scene', action: 'Detects indoor/outdoor tags and converts each page into binary temporal vectors.' }
]}
stepsHe={[
'לכל עמוד מחושב ערך בינארי לחוץ (1/0) ופנים (1/0) לפי Scene.',
'הערכים נפרסים כרצפי זמן ברוחב מלא כך שניתן לראות רצפים, שברים והחלפות קצב.',
'המערכת מספקת גם פס סיכום מהיר של אחוזי פנים/חוץ באלבום.'
]}
stepsEn={[
'Each page receives binary indoor/outdoor values derived from Scene.',
'These vectors are rendered as full-width temporal traces to expose continuity and breaks.',
'A quick ratio summary reports overall indoor/outdoor balance.'
]}
algoHe="סריקת ביטויים רגולריים (Regex) לאיתור התיוגים הקשיחים '(indoor)' ו-'(outdoor)' מתוך תיאור הסצנה. הצגת הנתונים כגרף בלוקים צפוף המשקף מעברים על פני זמן."
algoEn="Regex scanning to locate the hardcoded tags '(indoor)' and '(outdoor)' within the Scene description. Displaying the data as a dense block chart reflecting spatial transitions over time."
claimHe="עונה על שאלה בימויית מהותית: האם האלבום משדר 'בניית הארץ/מלחמה' שמתרחשת בעיקרה בחוץ תחת השמש, או חושף אטמוספירה פרטית ומוסדית המתרחשת בתוך מבנים סגורים?"
claimEn="Answers a fundamental directorial question: Does the album broadcast 'nation-building/war' occurring primarily outdoors under the sun, or does it reveal a private/institutional atmosphere occurring inside enclosed structures?"
/>
<div className="flex items-center gap-4 mb-2 text-xs font-bold mt-6">
<span className="flex items-center gap-1 text-teal-600"><div className="w-3 h-3 bg-teal-500 rounded-sm"></div> חוץ (Outdoor)</span>
<span className="flex items-center gap-1 text-slate-600"><div className="w-3 h-3 bg-slate-700 rounded-sm"></div> פנים (Indoor)</span>
</div>
<div ref={contRefS} className="relative w-full h-36 bg-slate-50 border border-slate-300 rounded-xl overflow-hidden cursor-crosshair"
onMouseMove={(e) => { const r=contRefS.current?.getBoundingClientRect(); if(!r) return; const idx=Math.max(0,Math.min(data.length-1,Math.round(((e.clientX-r.left)/r.width)*(data.length-1)))); const pt=data[idx]; const place=pt.isOut?'חוץ (outdoor)':pt.isIn?'פנים (indoor)':'לא מוגדר'; setTtip({x:e.clientX,y:e.clientY,content:`עמוד ${pt.page}\n${place}`}); }}
onMouseLeave={() => setTtip(null)}>
<svg className="w-full h-full" preserveAspectRatio="none" viewBox="0 0 1000 160">
<line x1="0" y1="140" x2="1000" y2="140" stroke="#cbd5e1" strokeWidth="1" />
<line x1="0" y1="20" x2="1000" y2="20" stroke="#e2e8f0" strokeDasharray="4 4" />
<path d={buildLinePath(outdoorVals, 1000, 140)} fill="none" stroke="#14b8a6" strokeWidth="3" />
<path d={buildLinePath(indoorVals, 1000, 140)} fill="none" stroke="#334155" strokeWidth="3" />
</svg>
</div>
<ChartTooltip tooltip={ttip} />
<div className="mt-4 flex items-center gap-3 text-xs">
<button onClick={() => onTagClick && onTagClick('outdoor', 'Scene')} className="px-3 py-1.5 rounded-lg bg-teal-50 border border-teal-200 text-teal-700 font-bold hover:bg-teal-100">
סנן חוץ
</button>
<button onClick={() => onTagClick && onTagClick('indoor', 'Scene')} className="px-3 py-1.5 rounded-lg bg-slate-100 border border-slate-300 text-slate-700 font-bold hover:bg-slate-200">
סנן פנים
</button>
<span className="text-slate-500">
חוץ: {Math.round((outdoorVals.reduce((a, b) => a + b, 0) / Math.max(1, data.length)) * 100)}% | פנים: {Math.round((indoorVals.reduce((a, b) => a + b, 0) / Math.max(1, data.length)) * 100)}%
</span>
</div>
</div>
);
};
// ==========================================
// VIZ 6: מורכבות חזותית (Visual Complexity)
// ==========================================
const VisualComplexity = ({ images }) => {
const [ttip, setTtip] = useState(null);
const contRefV = useRef(null);
const data = images.map(img => {
const count = img.parsedMetadata.Objects ? img.parsedMetadata.Objects.split(',').length : 0;
return { page: img.image_num, count };
});
const maxObjects = Math.max(...data.map(d => d.count)) || 10;
const createPath = (data, w, h) => {
if(!data.length) return '';
let d = '';
data.forEach((p, i) => { const x = i*(w/(data.length-1)); const y = h-((p.count/maxObjects)*h); if(i===0) d+=`M ${x} ${y}`; else d+=` L ${x} ${y}`; });
return d;
};
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-chart-scatter" iconColor="text-orange-500" he="צפיפות ומורכבות חזותית" en="Visual Density & Complexity" />
<BilingualTheoryBox
titleHe="מדד הרעש החזותי"
titleEn="Visual Clutter Index"
fields="image_num & Count of Objects"
algoHe="ספירת כמות האובייקטים השונים שזוהו בכל תמונה (קבוצות מופרדות בפסיקים) כדי לייצר ציון 'עומס' סקלרי. משורטט כגרף קו (Line Chart)."
algoEn="Counting the number of distinct objects identified in each image (comma-separated lists) to generate a scalar 'clutter' score. Plotted as a line chart."
claimHe="מזהה את קצב העריכה החומרית. האם התמונות מינימליסטיות ונקיות (ציון נמוך, למשל קיר או דיוקן בודד) או שוקקות ורועשות (ציון גבוה, רחוב סואן או שדה קרב עמוס פריטים)?"
claimEn="Identifies the rhythm of material editing. Are the images minimalist and clean (low score, e.g., a blank wall or solo portrait) or bustling and noisy (high score, e.g., a busy street or cluttered battlefield)?"
/>
<div ref={contRefV} className="relative w-full h-32 bg-slate-50 border-b-2 border-slate-300 border-l border-slate-200 mt-6 cursor-crosshair"
onMouseMove={(e) => { const r=contRefV.current?.getBoundingClientRect(); if(!r) return; const idx=Math.max(0,Math.min(data.length-1,Math.round(((e.clientX-r.left)/r.width)*(data.length-1)))); const pt=data[idx]; const img=images[idx]; const objs=(img?.parsedMetadata.Objects||'').split(',').map(x=>x.trim()).filter(Boolean).slice(0,5).join(', '); setTtip({x:e.clientX,y:e.clientY,content:`עמוד ${pt.page} — ${pt.count} אובייקטים${objs?'\n'+objs:''}`}); }}
onMouseLeave={() => setTtip(null)}>
<svg className="w-full h-full" preserveAspectRatio="none" viewBox="0 0 1000 160">
<path d={createPath(data, 1000, 150)} fill="none" stroke="#f97316" strokeWidth="3" strokeLinejoin="round" />
{data.map((point, i) => <circle key={i} cx={(i/(data.length-1))*1000} cy={160-((point.count/maxObjects)*150)} r="2" fill="#ea580c" />)}
</svg>
<div className="absolute top-1 left-2 text-[10px] text-slate-400 font-bold">עמוס (Max: {maxObjects})</div>
<div className="absolute bottom-1 left-2 text-[10px] text-slate-400 font-bold">ריק (0)</div>
</div>
<ChartTooltip tooltip={ttip} />
</div>
);
};
// ==========================================
// VIZ 7: טביעת אצבע (Album Fingerprint)
// ==========================================
const AlbumFingerprint = ({ images }) => {
const stats = useMemo(() => {
let totalPeople = 0; let totalObj = 0; let totalTextWords = 0; let outdoorCount = 0; let indoorCount = 0;
images.forEach(img => {
const m = img.parsedMetadata;
const p = m.People; if(p==='1') totalPeople+=1; else if(p==='2') totalPeople+=2; else if(p==='5+') totalPeople+=5;
if(m.Objects) totalObj += m.Objects.split(',').length;
if(m.Caption) totalTextWords += m.Caption.split(' ').length;
if(m.Text) totalTextWords += m.Text.split(' ').length;
if(m.Scene && m.Scene.includes('outdoor')) outdoorCount++;
if(m.Scene && m.Scene.includes('indoor')) indoorCount++;
});
const N = images.length || 1;
return {
peopleScore: Math.min(100, (totalPeople / (N*5))*100),
clutterScore: Math.min(100, (totalObj / (N*15))*100),
textScore: Math.min(100, (totalTextWords / (N*50))*100),
outdoorScore: (outdoorCount+indoorCount>0) ? (outdoorCount/(outdoorCount+indoorCount))*100 : 0
};
}, [images]);
return (
<div className="bg-slate-800 p-8 rounded-3xl shadow-sm border border-slate-700 text-white">
<VizTitle icon="ph-fill ph-fingerprint" iconColor="text-emerald-400" he="טביעת אצבע סמנטית" en="Album Fingerprint" />
<BilingualTheoryBox
titleHe="תעודת הזהות המצטברת של הקורפוס"
titleEn="Aggregate Corpus Identity Card"
fields="Aggregated: People, Objects, Text, Scene"
algoHe="שקלול הממוצעים הגלובליים של האלבום לארבעה צירי זהות מרכזיים, ונרמולם לסולם סטנדרטי של 0 עד 100% כדי לאפשר השוואה עתידית הוגנת."
algoEn="Weighting the global averages of the album across four core identity axes, and normalizing them to a standard 0 to 100% scale to allow fair future comparison."
claimHe="מייצר פרופיל אישיותי לאלבום השלם. האם הוא נוטה לטקסטואליות כבדה או מציג תמונות 'נקיות'? האם הוא מרוכז בנוכחות אנושית (דיוקנאות והמונים) או מתמקד בחומריות ומרחב?"
claimEn="Generates a personality profile for the entire album. Does it lean towards heavy textuality or present 'clean' images? Is it focused on human presence or does it highlight materiality and space?"
/>
{(() => { const [ttipFP, setTtipFP] = React.useState(null); return (
<div className="space-y-6 mt-8">
{[{label:'נוכחות אנושית (Human Presence)', score:stats.peopleScore, color:'bg-blue-400', descHe:'ממוצע ערך People בכל תמונות האלבום', descEn:'Avg people density'},
{label:'עומס חומרי (Material Clutter)', score:stats.clutterScore, color:'bg-orange-400', descHe:'ממוצע מספר אובייקטים לתמונה', descEn:'Avg objects per image'},
{label:'משקל טקסטואלי (Textual Weight)', score:stats.textScore, color:'bg-amber-400', descHe:'ממוצע מילים בכיתוב + OCR לתמונה', descEn:'Avg words in caption + OCR'},
{label:'דומיננטיות חוץ (Outdoor Dominance)', score:stats.outdoorScore, color:'bg-teal-400', descHe:'אחוז תמונות בחוץ מתוך חוץ+פנים', descEn:'% outdoor of outdoor+indoor'}].map(item => (
<div key={item.label}
onMouseEnter={e => setTtipFP({x:e.clientX,y:e.clientY,content:`${item.label}\n${item.score.toFixed(1)}%\n${item.descHe}`})}
onMouseMove={e => setTtipFP(p => p ? {...p,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtipFP(null)}>
<div className="flex justify-between text-sm mb-1 font-bold"><span className="text-slate-300">{item.label}</span> <span>{item.score.toFixed(0)}%</span></div>
<div className="h-4 bg-slate-700 rounded-full overflow-hidden"><div className={`h-full ${item.color}`} style={{width: `${item.score}%`}}></div></div>
</div>
))}
<ChartTooltip tooltip={ttipFP} />
</div>
); })()}
</div>
);
};
// ==========================================
// VIZ 8: קווי רכס (Lexical Ridgeline)
// ==========================================
const LexicalRidgeline = ({ images, onTagClick }) => {
const [ttip, setTtip] = useState(null);
const data = useMemo(() => {
const objectPages = {};
const maxPage = Math.max(...images.map(img => img.image_num)) || 100;
images.forEach(img => {
if(img.parsedMetadata.Objects) {
img.parsedMetadata.Objects.split(',').forEach(o => {
const obj = o.trim().toLowerCase();
if(!objectPages[obj]) objectPages[obj] = [];
objectPages[obj].push(img.image_num);
});
}
});
const topObjects = Object.entries(objectPages).sort((a,b) => b[1].length - a[1].length).slice(0, 5).map(x => ({ name: x[0], pages: x[1] }));
return { topObjects, maxPage };
}, [images]);
const createRidgePath = (pages, maxPage, width, height) => {
const bins = new Array(20).fill(0);
pages.forEach(p => { const binIdx = Math.min(19, Math.floor((p / maxPage) * 20)); bins[binIdx]++; });
let d = `M 0 ${height}`;
const maxBin = Math.max(...bins) || 1;
bins.forEach((val, i) => { d += ` L ${i*(width/19)} ${height - ((val/maxBin)*(height-10))}`; });
return d + ` L ${width} ${height} Z`;
};
const colors = ['rgba(239, 68, 68, 0.7)', 'rgba(59, 130, 246, 0.7)', 'rgba(16, 185, 129, 0.7)', 'rgba(245, 158, 11, 0.7)', 'rgba(139, 92, 246, 0.7)'];
return (
<div className="bg-white p-8 rounded-3xl shadow-sm border border-slate-200">
<VizTitle icon="ph-fill ph-chart-line-up" iconColor="text-indigo-600" he="קווי רכס אובייקטים" en="Object Ridgelines" />
<BilingualTheoryBox
titleHe="גליות של אובייקטים בזמן"
titleEn="Waves of Objects over Time (Joyplot)"
fields="image_num & Top 5 Objects"
fieldMapHe={[
{ field: 'Objects', action: 'מחלץ את כל האובייקטים מכל עמוד, מחשב תדירות ומבחר את 5 האובייקטים השכיחים ביותר.' },
{ field: 'image_num', action: 'ממקם כל הופעת אובייקט לאורך ציר הדפים ומבצע דחיסה ל-20 bins זמן.' }
]}
fieldMapEn={[
{ field: 'Objects', action: 'Extracts all objects, computes frequency, and selects the top 5 most frequent object terms.' },
{ field: 'image_num', action: 'Places each object occurrence on the page axis and compresses it into 20 temporal bins.' }
]}
stepsHe={[
'המערכת בוחרת את 5 האובייקטים הנפוצים ביותר באלבום כולו.',
'לכל אובייקט נספרת כמות הופעות בכל אחד מ-20 מקטעי זמן.',
'קו הרכס מציג את צפיפות ההופעה: פסגה גבוהה = ריכוז עמודים גבוה במקטע נתון.'
]}
stepsEn={[
'The model selects the 5 most frequent objects in the full album.',
'For each object, occurrences are counted in each of 20 temporal bins.',
'Ridge height encodes local concentration: taller peaks mean stronger clustering in that segment.'
]}
algoHe="הדמיית ridgeline של צפיפות הופעת אובייקטים לאורך זמן: כל רכס מייצג אובייקט אחד, וצורתו מתארת מתי האובייקט מרוכז ומתי כמעט נעלם."
algoEn="Ridgeline density visualization for object occurrences over time: each ridge is one object, and its shape shows where the object concentrates or fades."
claimHe="הגרף לא מציג רק 'כמה פעמים' אלא 'מתי' כל אובייקט שולט בנרטיב. כך אפשר לזהות פרקי-אלבום שבהם מערכת חזותית אחת עולה ואחרת דועכת."
claimEn="The plot shows not only 'how often' but 'when' each object dominates the narrative, exposing album phases where one visual regime rises while another declines."
/>
<div className="relative w-full mt-8" style={{ height: `${data.topObjects.length * 40 + 40}px` }}>
<svg className="w-full h-full" preserveAspectRatio="none">
{data.topObjects.map((obj, idx) => (
<g key={obj.name} transform={`translate(0, ${idx * 40})`}
onMouseEnter={e => setTtip({x:e.clientX,y:e.clientY,content:`${obj.name}\n${obj.pages.length} הופעות`})}
onMouseMove={e => setTtip(p => p ? {...p,x:e.clientX,y:e.clientY} : null)}
onMouseLeave={() => setTtip(null)}>
<text x="0" y="35" fontSize="12" fill="#475569" fontWeight="bold" className="capitalize cursor-pointer hover:fill-indigo-600" onClick={()=>onTagClick&&onTagClick(obj.name, 'Objects')}>{obj.name}</text>
<line x1="80" y1="40" x2="1000" y2="40" stroke="#cbd5e1" strokeWidth="1" />
<path d={createRidgePath(obj.pages, data.maxPage, 920, 40)} transform="translate(80, 0)" fill={colors[idx]} stroke="white" strokeWidth="1" className="transition-opacity hover:opacity-100 opacity-80 cursor-pointer" onClick={()=>onTagClick&&onTagClick(obj.name, 'Objects')} />
</g>
))}
</svg>
</div>
<div className="flex flex-wrap gap-x-5 gap-y-2 mt-4 px-1">
{data.topObjects.map((obj, idx) => (
<div key={obj.name} className="flex items-center gap-2 text-xs font-bold text-slate-600 capitalize cursor-pointer hover:text-indigo-600" onClick={() => onTagClick && onTagClick(obj.name, 'Objects')}>
<span className="w-4 h-4 rounded-sm shrink-0 border border-white/50 shadow-sm" style={{backgroundColor: colors[idx]}}></span>
{obj.name}
<span className="font-normal text-slate-400">({obj.pages.length})</span>
</div>
))}
</div>