Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
955 lines (906 loc) · 71.7 KB
/
Copy pathindex.html
File metadata and controls
955 lines (906 loc) · 71.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenTEAM Polycentric License Engine</title>
<meta name="description" content="Find the right license for your project or build a custom polycentric agreement with interoperable conditional use blocks." />
<!-- React via CDN -->
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<!-- Babel standalone for in-browser JSX -->
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@300;400;500&display=swap" rel="stylesheet" />
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { background: #1a1d17; color: #e8e4d9; font-family: 'DM Sans', sans-serif; overflow-x: hidden; }
::selection { background: rgba(143,168,118,0.3); }
select option { background: #1a1d17; color: #e8e4d9; }
input:focus, select:focus, textarea:focus { border-color: rgba(143,168,118,0.5) !important; outline: none; }
@keyframes fadeSlideIn {
from { opacity: 0; transform: translateY(14px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.anim-enter { animation: fadeSlideIn 0.5s ease forwards; opacity: 0; }
.anim-enter-d1 { animation-delay: 0.05s; }
.anim-enter-d2 { animation-delay: 0.10s; }
.anim-enter-d3 { animation-delay: 0.15s; }
.anim-enter-d4 { animation-delay: 0.20s; }
.anim-enter-d5 { animation-delay: 0.25s; }
/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #1a1d17; }
::-webkit-scrollbar-thumb { background: #3a3e36; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #5a5e56; }
/* Loading screen */
#loading-screen {
position: fixed; inset: 0; z-index: 9999;
background: #1a1d17;
display: flex; flex-direction: column; align-items: center; justify-content: center;
font-family: 'DM Mono', monospace; color: #7a8a6e;
transition: opacity 0.4s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }
#loading-screen .spinner {
width: 28px; height: 28px; border: 2px solid #2a2e26;
border-top-color: #8fa876; border-radius: 50%;
animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
</style>
</head>
<body>
<div id="loading-screen">
<div class="spinner"></div>
<div style="font-size: 11px; letter-spacing: 2px;">LOADING ENGINE</div>
</div>
<div id="root"></div>
<script type="text/babel" data-type="module">
const { useState, useCallback, useRef, useEffect } = React;
// ═══════════════════════════════════════════════════════════════════════
// DATA: LICENSE DATABASE
// ═══════════════════════════════════════════════════════════════════════
const LICENSE_DATABASE = {
software: [
{ id: "mit", name: "MIT License", openness: 5, copyleft: 0, commercial: true, patent: false, desc: "Maximally permissive. Do almost anything with attribution.", tags: ["permissive", "simple"] },
{ id: "apache2", name: "Apache 2.0", openness: 5, copyleft: 0, commercial: true, patent: true, desc: "Permissive with explicit patent grant and contributor protections.", tags: ["permissive", "patent"] },
{ id: "gpl3", name: "GPL 3.0", openness: 4, copyleft: 3, commercial: true, patent: true, desc: "Strong copyleft \u2014 derivatives must also be GPL. Patent protections included.", tags: ["copyleft", "strong"] },
{ id: "agpl3", name: "AGPL 3.0", openness: 4, copyleft: 4, commercial: true, patent: true, desc: "Strongest copyleft \u2014 network use triggers sharing. Closes the \u2018SaaS loophole\u2019.", tags: ["copyleft", "network"] },
{ id: "lgpl3", name: "LGPL 3.0", openness: 4, copyleft: 2, commercial: true, patent: true, desc: "Weak copyleft \u2014 linking allowed without copyleft trigger.", tags: ["copyleft", "weak"] },
{ id: "mpl2", name: "Mozilla Public License 2.0", openness: 4, copyleft: 1, commercial: true, patent: true, desc: "File-level copyleft. Modified files must stay open, but can combine with proprietary code.", tags: ["copyleft", "file-level"] },
{ id: "bsd2", name: "BSD 2-Clause", openness: 5, copyleft: 0, commercial: true, patent: false, desc: "Simple permissive license. Attribution required.", tags: ["permissive", "simple"] },
{ id: "bsd3", name: "BSD 3-Clause", openness: 5, copyleft: 0, commercial: true, patent: false, desc: "Permissive with non-endorsement clause.", tags: ["permissive"] },
{ id: "unlicense", name: "The Unlicense", openness: 5, copyleft: 0, commercial: true, patent: false, desc: "Public domain dedication. No conditions at all.", tags: ["permissive", "public-domain"] },
{ id: "cc0", name: "CC0 1.0", openness: 5, copyleft: 0, commercial: true, patent: false, desc: "Creative Commons public domain dedication for code or data.", tags: ["permissive", "public-domain"] },
{ id: "sspl", name: "SSPL", openness: 2, copyleft: 5, commercial: false, patent: false, desc: "Server Side Public License \u2014 requires sharing the entire service stack.", tags: ["copyleft", "extreme"] },
{ id: "custom", name: "Custom / Write Your Own", openness: null, copyleft: null, commercial: null, patent: null, desc: "Build a bespoke license using conditional use blocks.", tags: ["custom"] },
],
data: [
{ id: "ccby4", name: "CC BY 4.0", openness: 5, copyleft: 0, commercial: true, attribution: true, desc: "Share and adapt with attribution.", tags: ["permissive", "attribution"] },
{ id: "ccbysa4", name: "CC BY-SA 4.0", openness: 4, copyleft: 2, commercial: true, attribution: true, desc: "Share-alike \u2014 adaptations must use same license.", tags: ["copyleft", "share-alike"] },
{ id: "ccbync4", name: "CC BY-NC 4.0", openness: 3, copyleft: 0, commercial: false, attribution: true, desc: "Non-commercial use only with attribution.", tags: ["non-commercial"] },
{ id: "ccbyncsa4", name: "CC BY-NC-SA 4.0", openness: 2, copyleft: 2, commercial: false, attribution: true, desc: "Non-commercial, share-alike with attribution.", tags: ["non-commercial", "share-alike"] },
{ id: "ccbynd4", name: "CC BY-ND 4.0", openness: 2, copyleft: 0, commercial: true, attribution: true, desc: "No derivatives \u2014 share unchanged only.", tags: ["no-derivatives"] },
{ id: "odbl", name: "ODbL 1.0", openness: 4, copyleft: 2, commercial: true, attribution: true, desc: "Open Data Commons. Share-alike for databases specifically.", tags: ["database", "share-alike"] },
{ id: "cdla_permissive", name: "CDLA Permissive 2.0", openness: 5, copyleft: 0, commercial: true, attribution: false, desc: "Community Data License \u2014 permissive data sharing.", tags: ["permissive", "data-specific"] },
{ id: "cdla_sharing", name: "CDLA Sharing 1.0", openness: 4, copyleft: 2, commercial: true, attribution: false, desc: "Community Data License \u2014 copyleft for data.", tags: ["copyleft", "data-specific"] },
{ id: "pddl", name: "PDDL 1.0", openness: 5, copyleft: 0, commercial: true, attribution: false, desc: "Public Domain Dedication for databases.", tags: ["public-domain", "database"] },
{ id: "ogl", name: "Open Government License", openness: 5, copyleft: 0, commercial: true, attribution: true, desc: "Government open data license with attribution.", tags: ["government", "permissive"] },
{ id: "custom_data", name: "Custom Data Agreement", openness: null, copyleft: null, commercial: null, attribution: null, desc: "Build conditional use terms for your dataset.", tags: ["custom"] },
],
hardware: [
{ id: "cern_ohl_s", name: "CERN OHL-S 2.0", openness: 4, copyleft: 3, commercial: true, desc: "Strong reciprocal \u2014 modifications must be shared under same terms.", tags: ["copyleft", "strong"] },
{ id: "cern_ohl_w", name: "CERN OHL-W 2.0", openness: 4, copyleft: 2, commercial: true, desc: "Weak reciprocal \u2014 only modifications to original must be shared.", tags: ["copyleft", "weak"] },
{ id: "cern_ohl_p", name: "CERN OHL-P 2.0", openness: 5, copyleft: 0, commercial: true, desc: "Permissive \u2014 do anything with attribution.", tags: ["permissive"] },
{ id: "tapr_ohl", name: "TAPR OHL 1.0", openness: 4, copyleft: 2, commercial: true, desc: "Share-alike for hardware designs and documentation.", tags: ["copyleft", "legacy"] },
{ id: "solderpad", name: "Solderpad 2.1", openness: 5, copyleft: 0, commercial: true, desc: "Apache-based permissive hardware license.", tags: ["permissive"] },
{ id: "oshwa_cert", name: "OSHWA Certification", openness: 4, copyleft: 0, commercial: true, desc: "Open Source Hardware Association certification program.", tags: ["certification"] },
{ id: "custom_hw", name: "Custom Hardware Agreement", openness: null, copyleft: null, commercial: null, desc: "Build conditional use terms for your hardware.", tags: ["custom"] },
]
};
// ═══════════════════════════════════════════════════════════════════════
// DATA: QUESTION SETS
// ═══════════════════════════════════════════════════════════════════════
const QUESTION_SETS = {
software: [
{ id: "purpose", question: "What is the primary purpose of sharing this software?", help: "This determines the fundamental philosophy of your license. OpenTEAM encourages maximizing community benefit while respecting creator intent.", options: [
{ value: "maximize_adoption", label: "Maximize adoption and use", icon: "\ud83c\udf0d", weight: { openness: 2, copyleft: -2 } },
{ value: "community_commons", label: "Build a community commons", icon: "\ud83e\udd1d", weight: { openness: 1, copyleft: 2 } },
{ value: "protect_investment", label: "Protect development investment", icon: "\ud83d\udee1\ufe0f", weight: { openness: -1, copyleft: 1 } },
{ value: "public_good", label: "Release as public good", icon: "\ud83c\udfdb\ufe0f", weight: { openness: 3, copyleft: -1 } },
]},
{ id: "commercial", question: "How should commercial use be handled?", help: "Consider whether commercial entities should be able to use, modify, and profit from your work. Conditional use blocks can add nuance here.", options: [
{ value: "unrestricted", label: "Fully unrestricted commercial use", icon: "\u2705", weight: { commercial: 2, openness: 1 } },
{ value: "with_contribution", label: "Commercial use requires contribution back", icon: "\ud83d\udd04", weight: { commercial: 1, copyleft: 2 } },
{ value: "non_commercial", label: "Non-commercial use only", icon: "\ud83d\udeab", weight: { commercial: -3, openness: -1 } },
{ value: "conditional", label: "Conditional \u2014 I want to define specific terms", icon: "\u2699\ufe0f", weight: { commercial: 0, custom: 2 } },
]},
{ id: "derivatives", question: "When someone modifies your software, what should happen?", help: "Copyleft strength: Strong = all derivatives must share. Weak = only direct modifications. None = no requirement.", options: [
{ value: "no_requirement", label: "No requirements on derivatives", icon: "\ud83c\udd93", weight: { copyleft: -3, openness: 2 } },
{ value: "file_level", label: "Modified files must remain open", icon: "\ud83d\udcc4", weight: { copyleft: 1 } },
{ value: "project_level", label: "Entire derivative project must be open", icon: "\ud83d\udce6", weight: { copyleft: 3 } },
{ value: "network_level", label: "Even network/SaaS use triggers sharing", icon: "\ud83c\udf10", weight: { copyleft: 4 } },
]},
{ id: "patents", question: "Do you need patent protections?", help: "Patent grants protect users from patent litigation. Important for enterprise and institutional adoption.", options: [
{ value: "yes", label: "Yes \u2014 include explicit patent grant", icon: "\ud83d\udcdc", weight: { patent: 2 } },
{ value: "no", label: "No \u2014 keep it simple", icon: "\u2702\ufe0f", weight: { patent: -1 } },
{ value: "defensive", label: "Defensive \u2014 revoke if patent claims made", icon: "\u2694\ufe0f", weight: { patent: 3 } },
]},
{ id: "ecosystem", question: "What ecosystem interoperability matters most?", help: "OpenTEAM\u2019s polycentric approach values interoperability between different governance frameworks.", options: [
{ value: "maximum", label: "Maximum compatibility with other licenses", icon: "\ud83d\udd17", weight: { openness: 2, copyleft: -1 } },
{ value: "gpl_family", label: "GPL ecosystem compatibility", icon: "\ud83d\udc27", weight: { copyleft: 2 } },
{ value: "enterprise", label: "Enterprise-friendly", icon: "\ud83c\udfe2", weight: { openness: 1, patent: 1 } },
{ value: "custom_ecosystem", label: "Building our own ecosystem", icon: "\ud83c\udf31", weight: { custom: 1 } },
]},
],
data: [
{ id: "data_type", question: "What type of data are you licensing?", help: "Different data types have different licensing considerations \u2014 especially around privacy, sovereignty, and derivative works.", options: [
{ value: "research", label: "Research / scientific data", icon: "\ud83d\udd2c", weight: { openness: 2 } },
{ value: "agricultural", label: "Agricultural / environmental data", icon: "\ud83c\udf3e", weight: { openness: 1, sovereignty: 1 } },
{ value: "geospatial", label: "Geospatial / mapping data", icon: "\ud83d\uddfa\ufe0f", weight: { openness: 1 } },
{ value: "personal", label: "Anonymized personal data", icon: "\ud83d\udc64", weight: { openness: -1, privacy: 2 } },
]},
{ id: "data_use", question: "Who should be able to use this data?", help: "Consider data sovereignty \u2014 who controls how data about communities or land is used?", options: [
{ value: "anyone", label: "Anyone, for any purpose", icon: "\ud83c\udf0d", weight: { openness: 3, commercial: 2 } },
{ value: "research_only", label: "Researchers and non-profits only", icon: "\ud83c\udfeb", weight: { openness: 1, commercial: -2 } },
{ value: "community", label: "Community members and approved partners", icon: "\ud83e\udd1d", weight: { openness: -1, sovereignty: 2 } },
{ value: "conditional", label: "Conditional \u2014 define specific use terms", icon: "\u2699\ufe0f", weight: { custom: 2 } },
]},
{ id: "attribution", question: "What attribution requirements do you need?", help: "Attribution ensures credit flows back to data creators and communities.", options: [
{ value: "none", label: "No attribution required", icon: "\ud83c\udd93", weight: { attribution: -2, openness: 2 } },
{ value: "simple", label: "Simple credit / citation", icon: "\ud83d\udcdd", weight: { attribution: 1 } },
{ value: "detailed", label: "Detailed provenance chain required", icon: "\ud83d\udd17", weight: { attribution: 2 } },
{ value: "community", label: "Community acknowledgment protocol", icon: "\ud83c\udf31", weight: { attribution: 2, sovereignty: 1 } },
]},
{ id: "derivatives_data", question: "Can others create derivative datasets?", help: "Share-alike ensures improvements flow back. No-derivatives protects data integrity.", options: [
{ value: "freely", label: "Yes, with no conditions", icon: "\u2705", weight: { copyleft: -2, openness: 2 } },
{ value: "share_alike", label: "Yes, if shared under same terms", icon: "\ud83d\udd04", weight: { copyleft: 2 } },
{ value: "no_derivatives", label: "No \u2014 data must stay unchanged", icon: "\ud83d\udd12", weight: { copyleft: 0, openness: -2 } },
{ value: "conditional", label: "Conditional \u2014 specific rules", icon: "\u2699\ufe0f", weight: { custom: 2 } },
]},
{ id: "ai_training", question: "Can this data be used for AI/ML model training?", help: "A rapidly evolving area. Consider whether AI training constitutes \u2018fair use\u2019 or a derivative work.", options: [
{ value: "yes", label: "Yes, unrestricted", icon: "\ud83e\udd16", weight: { openness: 2 } },
{ value: "non_commercial_ai", label: "Only for non-commercial AI research", icon: "\ud83d\udd2c", weight: { commercial: -1 } },
{ value: "no", label: "No AI/ML training permitted", icon: "\ud83d\udeab", weight: { openness: -2, custom: 1 } },
{ value: "conditional", label: "Conditional \u2014 with specific terms", icon: "\u2699\ufe0f", weight: { custom: 2 } },
]},
],
hardware: [
{ id: "hw_type", question: "What type of hardware are you licensing?", help: "The physical nature of hardware creates unique licensing considerations around manufacturing, repair, and modification.", options: [
{ value: "electronics", label: "Electronic designs / PCBs", icon: "\ud83d\udd0c", weight: {} },
{ value: "mechanical", label: "Mechanical designs / CAD", icon: "\u2699\ufe0f", weight: {} },
{ value: "agricultural_tools", label: "Agricultural tools / equipment", icon: "\ud83d\ude9c", weight: { sovereignty: 1 } },
{ value: "mixed", label: "Mixed / integrated systems", icon: "\ud83d\udd27", weight: {} },
]},
{ id: "hw_sharing", question: "What must be shared when someone manufactures your design?", help: "Consider the full documentation stack: schematics, BOMs, firmware, assembly instructions, test procedures.", options: [
{ value: "nothing", label: "Nothing \u2014 fully permissive", icon: "\ud83c\udd93", weight: { copyleft: -3, openness: 2 } },
{ value: "modifications_only", label: "Only changes they make", icon: "\ud83d\udcdd", weight: { copyleft: 1 } },
{ value: "full_stack", label: "Complete design package", icon: "\ud83d\udce6", weight: { copyleft: 3 } },
{ value: "conditional", label: "Conditional \u2014 define what", icon: "\u2699\ufe0f", weight: { custom: 2 } },
]},
{ id: "hw_commercial", question: "Can manufacturers sell products based on your design?", help: "Open hardware often allows commercial manufacturing. Consider right-to-repair implications.", options: [
{ value: "yes", label: "Yes, unrestricted", icon: "\u2705", weight: { commercial: 2, openness: 1 } },
{ value: "with_attribution", label: "Yes, with clear attribution", icon: "\ud83c\udff7\ufe0f", weight: { commercial: 1, attribution: 1 } },
{ value: "non_commercial", label: "Non-commercial only", icon: "\ud83d\udeab", weight: { commercial: -3 } },
{ value: "conditional", label: "Conditional \u2014 specific terms", icon: "\u2699\ufe0f", weight: { custom: 2 } },
]},
{ id: "repair", question: "What are your right-to-repair requirements?", help: "OpenTEAM values repairability and local fabrication capacity as key to resilient infrastructure.", options: [
{ value: "full", label: "Full repair documentation required", icon: "\ud83d\udd27", weight: { openness: 2 } },
{ value: "basic", label: "Basic repair information", icon: "\ud83d\udccb", weight: { openness: 1 } },
{ value: "none", label: "No repair requirements", icon: "\u274c", weight: {} },
{ value: "community", label: "Community repair network access", icon: "\ud83e\udd1d", weight: { sovereignty: 1, custom: 1 } },
]},
]
};
// ═══════════════════════════════════════════════════════════════════════
// DATA: CONDITIONAL USE BLOCKS
// ═══════════════════════════════════════════════════════════════════════
const CONDITIONAL_USE_BLOCKS = [
{ id: "ethical_use", category: "Ethics", name: "Ethical Use Restriction", description: "Prohibit use in ways that cause harm to individuals or communities",
template: "This {resource_type} may not be used in any manner that causes or facilitates harm to individuals, communities, or the environment, including but not limited to: {harm_categories}.",
fields: [{ id: "harm_categories", label: "Prohibited harm categories", type: "multi", options: ["Surveillance of individuals without consent", "Weapons development or deployment", "Environmental destruction", "Forced labor or exploitation", "Discrimination based on protected characteristics", "Undermining democratic processes"] }]
},
{ id: "data_sovereignty", category: "Sovereignty", name: "Data Sovereignty Clause", description: "Ensure communities maintain control over data about them",
template: "Data pertaining to {community_scope} remains under the governance authority of {governance_body}. Use requires {approval_process}.",
fields: [
{ id: "community_scope", label: "Community or geographic scope", type: "text" },
{ id: "governance_body", label: "Governing body or community", type: "text" },
{ id: "approval_process", label: "Required approval process", type: "select", options: ["Written consent from governance body", "Community review board approval", "Public comment period of 30 days", "Bilateral agreement"] }
]
},
{ id: "revenue_sharing", category: "Economics", name: "Revenue Sharing Requirement", description: "Require commercial users to share revenue with creators/community",
template: "Commercial use generating more than {threshold} annually requires contribution of {percentage}% of net revenue derived from this {resource_type} to {beneficiary}.",
fields: [
{ id: "threshold", label: "Revenue threshold (USD)", type: "number" },
{ id: "percentage", label: "Revenue share percentage", type: "number" },
{ id: "beneficiary", label: "Beneficiary", type: "text" }
]
},
{ id: "environmental", category: "Environment", name: "Environmental Impact Clause", description: "Require environmental responsibility in use",
template: "Users of this {resource_type} must {environmental_requirement}. Compliance must be demonstrated through {verification_method}.",
fields: [
{ id: "environmental_requirement", label: "Environmental requirement", type: "select", options: ["Conduct environmental impact assessment before deployment", "Offset carbon emissions from manufacturing/operation", "Use renewable energy for operation where feasible", "Comply with local environmental regulations"] },
{ id: "verification_method", label: "Verification method", type: "select", options: ["Self-certification", "Third-party audit", "Community review", "Public reporting"] }
]
},
{ id: "network_reciprocity", category: "Reciprocity", name: "Network Reciprocity", description: "Require contributions back when used in networked/platform contexts",
template: "When this {resource_type} is used as part of a networked service or platform accessed by {user_threshold} or more users, the operator must {reciprocity_requirement} within {timeframe}.",
fields: [
{ id: "user_threshold", label: "User threshold", type: "number" },
{ id: "reciprocity_requirement", label: "Reciprocity requirement", type: "select", options: ["Publish all modifications under these same terms", "Contribute improvements upstream to the original project", "Make their service's API publicly accessible", "Share anonymized usage data with the community"] },
{ id: "timeframe", label: "Compliance timeframe", type: "select", options: ["30 days", "90 days", "6 months", "1 year"] }
]
},
{ id: "geographic", category: "Sovereignty", name: "Geographic Use Restriction", description: "Limit use to specific regions or jurisdictions",
template: "This {resource_type} is licensed for use within {jurisdiction}. Use outside these jurisdictions requires {external_requirement}.",
fields: [
{ id: "jurisdiction", label: "Permitted jurisdictions", type: "text" },
{ id: "external_requirement", label: "External use requirement", type: "select", options: ["Separate written agreement", "Community governance approval", "Additional licensing fee", "Not permitted"] }
]
},
{ id: "sunset", category: "Temporal", name: "Sunset / Graduation Clause", description: "Automatically change license terms after conditions are met",
template: "After {trigger_condition}, all conditional use restrictions in this license shall {sunset_action}. The base license ({base_license}) remains in effect.",
fields: [
{ id: "trigger_condition", label: "Trigger condition", type: "select", options: ["5 years from date of publication", "Creator's declaration of public domain intent", "Community governance vote", "Revenue threshold of $1M is reached", "10 years from first commercial use"] },
{ id: "sunset_action", label: "What happens at sunset", type: "select", options: ["Be removed, leaving only the base license", "Convert to the most permissive equivalent", "Require community review for renewal", "Automatically renew for another term"] },
{ id: "base_license", label: "Underlying base license", type: "text" }
]
},
{ id: "indigenous_rights", category: "Sovereignty", name: "Indigenous Knowledge Protection", description: "Protect traditional knowledge and indigenous rights",
template: "This {resource_type} incorporates or is derived from traditional knowledge of {community}. Use must comply with {protocol} and requires {consent_type}.",
fields: [
{ id: "community", label: "Community or peoples", type: "text" },
{ id: "protocol", label: "Applicable protocol", type: "select", options: ["CARE Principles for Indigenous Data Governance", "Nagoya Protocol on Access and Benefit Sharing", "UN Declaration on the Rights of Indigenous Peoples", "Custom community protocol (specify in additional terms)"] },
{ id: "consent_type", label: "Required consent", type: "select", options: ["Free, prior and informed consent (FPIC)", "Community council approval", "Elder/knowledge keeper authorization", "Bilateral agreement with community representatives"] }
]
},
{ id: "custom_block", category: "Custom", name: "Write Your Own Clause", description: "Create a completely custom conditional use block",
template: "{custom_text}",
fields: [{ id: "custom_text", label: "Your custom clause text", type: "textarea" }]
}
];
// ═══════════════════════════════════════════════════════════════════════
// HELPERS
// ═══════════════════════════════════════════════════════════════════════
function generateClausePreview(block, data) {
let text = block.template;
block.fields.forEach(function(field) {
const val = data[field.id];
let display = "";
if (Array.isArray(val)) display = val.join("; ");
else if (val) display = String(val);
else display = "[" + field.label + "]";
text = text.replace("{" + field.id + "}", display);
});
text = text.replace(/\{resource_type\}/g, "resource");
return text;
}
function scoreLicenses(answers, domain) {
const licenses = LICENSE_DATABASE[domain];
const questions = QUESTION_SETS[domain];
var scores = {};
licenses.forEach(function(l) { scores[l.id] = { match: 0, total: 0 }; });
Object.entries(answers).forEach(function([qId, answer]) {
const question = questions.find(function(q) { return q.id === qId; });
if (!question) return;
const option = question.options.find(function(o) { return o.value === answer; });
if (!option || !option.weight) return;
const weights = option.weight;
licenses.forEach(function(l) {
if (l.id.startsWith("custom")) return;
var qScore = 0;
if (weights.openness !== undefined && l.openness !== null) {
qScore += weights.openness > 0 ? (l.openness / 5) * weights.openness : ((5 - l.openness) / 5) * Math.abs(weights.openness);
}
if (weights.copyleft !== undefined && l.copyleft !== undefined) {
var cm = weights.copyleft > 0 ? ((l.copyleft || 0) / 4) * weights.copyleft : ((4 - (l.copyleft || 0)) / 4) * Math.abs(weights.copyleft);
qScore += cm;
}
if (weights.commercial !== undefined && l.commercial !== undefined) {
if (weights.commercial > 0 && l.commercial) qScore += weights.commercial;
if (weights.commercial < 0 && !l.commercial) qScore += Math.abs(weights.commercial);
}
if (weights.patent !== undefined && l.patent !== undefined) {
if (weights.patent > 0 && l.patent) qScore += weights.patent;
}
scores[l.id].match += qScore;
scores[l.id].total += Object.values(weights).reduce(function(a, b) { return a + Math.abs(b || 0); }, 0);
});
});
var hasCustomSignal = Object.values(answers).some(function(a) { return a === "conditional"; });
return licenses
.map(function(l) {
if (l.id.startsWith("custom")) {
return Object.assign({}, l, { score: hasCustomSignal ? 85 : 20 });
}
var s = scores[l.id];
var normalized = s.total > 0 ? Math.round((s.match / s.total) * 100) : 50;
return Object.assign({}, l, { score: Math.min(100, Math.max(0, normalized)) });
})
.sort(function(a, b) { return b.score - a.score; });
}
function generateFullText(license, domain, selectedBlocks, blockData, projectName) {
var blocks = CONDITIONAL_USE_BLOCKS.filter(function(b) { return selectedBlocks.includes(b.id); });
var today = new Date().toISOString().split("T")[0];
var text = "POLYCENTRIC AGREEMENT\n";
text += (projectName || "Untitled Project") + "\n";
text += "Generated: " + today + " | OpenTEAM Compatible\n";
text += "============================================================\n\n";
text += "\u00a71 \u2014 BASE LICENSE\n";
text += "This " + (domain || "resource") + " is released under the " + (license ? license.name : "custom terms") + ".\n";
if (license && license.desc) text += license.desc + "\n";
text += "\n";
if (blocks.length > 0) {
text += "\u00a72 \u2014 CONDITIONAL USE PROVISIONS\n";
text += "In addition to the base license, the following conditional use provisions apply.\n\n";
blocks.forEach(function(block, i) {
text += "\u00a72." + (i + 1) + " \u2014 " + block.name.toUpperCase() + "\n";
text += generateClausePreview(block, blockData[block.id] || {}) + "\n\n";
});
}
text += "\u00a7" + (blocks.length > 0 ? "3" : "2") + " \u2014 INTEROPERABILITY\n";
text += "This agreement is designed for polycentric interoperability. Conditional use blocks may be composed with other OpenTEAM-compatible agreements to form multi-party governance arrangements.\n";
return text;
}
// ═══════════════════════════════════════════════════════════════════════
// STYLE OBJECTS
// ═══════════════════════════════════════════════════════════════════════
const S = {
container: { minHeight: "100vh", position: "relative", overflow: "hidden" },
bg1: { position: "fixed", inset: 0, zIndex: 0, opacity: 0.04, pointerEvents: "none", backgroundImage: "radial-gradient(circle at 1px 1px, #8fa876 0.5px, transparent 0.5px)", backgroundSize: "24px 24px" },
bg2: { position: "fixed", top: 0, left: 0, right: 0, height: 300, zIndex: 0, pointerEvents: "none", background: "radial-gradient(ellipse at 50% 0%, rgba(143,168,118,0.06) 0%, transparent 70%)" },
inner: { maxWidth: 720, margin: "0 auto", padding: "40px 24px 80px", position: "relative", zIndex: 1 },
mono: { fontFamily: "'DM Mono', monospace" },
serif: { fontFamily: "'Fraunces', serif" },
btnPrimary: { padding: "12px 28px", background: "#8fa876", color: "#1a1d17", border: "none", borderRadius: 8, fontFamily: "'DM Sans', sans-serif", fontSize: 14, fontWeight: 600, cursor: "pointer", transition: "all 0.2s ease", letterSpacing: 0.3 },
btnSecondary: { padding: "12px 28px", background: "transparent", color: "#8fa876", border: "1.5px solid rgba(143,168,118,0.3)", borderRadius: 8, fontFamily: "'DM Sans', sans-serif", fontSize: 14, fontWeight: 500, cursor: "pointer", transition: "all 0.2s ease" },
backBtn: { background: "none", border: "none", color: "#7a8a6e", cursor: "pointer", fontFamily: "'DM Mono', monospace", fontSize: 12, letterSpacing: 0.5, padding: "4px 0" },
label: { fontFamily: "'DM Mono', monospace", fontSize: 11, color: "#7a8a6e", letterSpacing: 1.5, marginBottom: 12, textTransform: "uppercase" },
input: { width: "100%", boxSizing: "border-box", padding: "10px 12px", background: "rgba(0,0,0,0.3)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: 6, color: "#e8e4d9", fontFamily: "'DM Sans', sans-serif", fontSize: 13, outline: "none" },
};
// ═══════════════════════════════════════════════════════════════════════
// COMPONENTS
// ═══════════════════════════════════════════════════════════════════════
function ProgressBar({ current, total }) {
const pct = Math.round((current / total) * 100);
return (
<div style={{ width: "100%", marginBottom: 32 }}>
<div style={{ display: "flex", justifyContent: "space-between", marginBottom: 8, ...S.mono, fontSize: 12, color: "#7a8a6e", letterSpacing: 1 }}>
<span>QUESTION {current} OF {total}</span>
<span>{pct}%</span>
</div>
<div style={{ width: "100%", height: 4, background: "#2a2e26", borderRadius: 2, overflow: "hidden" }}>
<div style={{ width: pct + "%", height: "100%", background: "linear-gradient(90deg, #8fa876, #c4d4a0)", borderRadius: 2, transition: "width 0.5s cubic-bezier(0.4, 0, 0.2, 1)" }} />
</div>
</div>
);
}
function QuestionCard({ question, selected, onSelect, animDelay }) {
const [hoveredOpt, setHoveredOpt] = useState(null);
return (
<div className={"anim-enter anim-enter-d" + (animDelay || 0)}>
<h3 style={{ ...S.serif, fontSize: 22, fontWeight: 500, color: "#e8e4d9", margin: "0 0 8px 0", lineHeight: 1.35 }}>
{question.question}
</h3>
<p style={{ fontSize: 13, color: "#8a9a7e", margin: "0 0 20px 0", lineHeight: 1.6 }}>
{question.help}
</p>
<div style={{ display: "flex", flexDirection: "column", gap: 10 }}>
{question.options.map(function(opt) {
const isSel = selected === opt.value;
const isHov = hoveredOpt === opt.value;
return (
<button key={opt.value}
onClick={function() { onSelect(question.id, opt.value); }}
onMouseEnter={function() { setHoveredOpt(opt.value); }}
onMouseLeave={function() { setHoveredOpt(null); }}
style={{
display: "flex", alignItems: "center", gap: 14, padding: "14px 18px",
background: isSel ? "rgba(143,168,118,0.15)" : isHov ? "rgba(143,168,118,0.06)" : "rgba(255,255,255,0.02)",
border: "1.5px solid " + (isSel ? "#8fa876" : isHov ? "rgba(143,168,118,0.3)" : "rgba(255,255,255,0.06)"),
borderRadius: 10, cursor: "pointer", transition: "all 0.25s ease", textAlign: "left",
color: isSel ? "#c4d4a0" : "#c8c3b8", fontFamily: "'DM Sans', sans-serif", fontSize: 14.5, fontWeight: isSel ? 500 : 400,
}}>
<span style={{ fontSize: 20, flexShrink: 0, width: 32, textAlign: "center" }}>{opt.icon}</span>
<span>{opt.label}</span>
{isSel && <span style={{ marginLeft: "auto", color: "#8fa876", fontSize: 16 }}>{"\u2713"}</span>}
</button>
);
})}
</div>
</div>
);
}
function LicenseResult({ license, rank }) {
const barColor = license.score > 70 ? "#8fa876" : license.score > 40 ? "#c4a64e" : "#a87676";
return (
<div className={"anim-enter anim-enter-d" + Math.min(rank, 5)} style={{
padding: "18px 20px",
background: rank === 0 ? "rgba(143,168,118,0.08)" : "rgba(255,255,255,0.02)",
border: "1px solid " + (rank === 0 ? "rgba(143,168,118,0.25)" : "rgba(255,255,255,0.05)"),
borderRadius: 12,
}}>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "flex-start", marginBottom: 8 }}>
<div>
<div style={{ display: "flex", alignItems: "center", gap: 10 }}>
{rank === 0 && <span style={{ background: "#8fa876", color: "#1a1d17", fontSize: 10, fontWeight: 700, padding: "2px 8px", borderRadius: 4, ...S.mono, letterSpacing: 1 }}>BEST MATCH</span>}
<h4 style={{ ...S.serif, fontSize: 18, fontWeight: 600, color: "#e8e4d9", margin: 0 }}>{license.name}</h4>
</div>
<p style={{ fontSize: 13, color: "#8a9a7e", margin: "6px 0 0 0", lineHeight: 1.5 }}>{license.desc}</p>
</div>
<div style={{ textAlign: "right", flexShrink: 0, marginLeft: 16 }}>
<span style={{ ...S.mono, fontSize: 28, fontWeight: 700, color: barColor }}>{license.score}</span>
<span style={{ ...S.mono, fontSize: 12, color: "#7a8a6e" }}>%</span>
</div>
</div>
<div style={{ width: "100%", height: 3, background: "#2a2e26", borderRadius: 2, overflow: "hidden", marginTop: 10 }}>
<div style={{ width: license.score + "%", height: "100%", background: barColor, borderRadius: 2, transition: "width 0.8s cubic-bezier(0.4,0,0.2,1)" }} />
</div>
{license.tags && (
<div style={{ display: "flex", gap: 6, marginTop: 10, flexWrap: "wrap" }}>
{license.tags.map(function(tag) {
return <span key={tag} style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", border: "1px solid rgba(122,138,110,0.3)", padding: "2px 8px", borderRadius: 4, letterSpacing: 0.5 }}>{tag}</span>;
})}
</div>
)}
</div>
);
}
function ConditionalBlockBuilder({ selectedBlocks, onToggleBlock, onUpdateField, blockData }) {
const [expandedBlock, setExpandedBlock] = useState(null);
const categories = [...new Set(CONDITIONAL_USE_BLOCKS.map(function(b) { return b.category; }))];
return (
<div>
<h3 style={{ ...S.serif, fontSize: 20, color: "#e8e4d9", margin: "0 0 6px 0" }}>Conditional Use Blocks</h3>
<p style={{ fontSize: 13, color: "#8a9a7e", margin: "0 0 24px 0", lineHeight: 1.6 }}>
Add modular clauses to create a polycentric agreement. Each block is interoperable and can be mixed with standard licenses.
</p>
{categories.map(function(cat) {
return (
<div key={cat} style={{ marginBottom: 20 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1.5, marginBottom: 10, textTransform: "uppercase" }}>{cat}</div>
{CONDITIONAL_USE_BLOCKS.filter(function(b) { return b.category === cat; }).map(function(block) {
const isSel = selectedBlocks.includes(block.id);
const isExp = expandedBlock === block.id;
return (
<div key={block.id} style={{
marginBottom: 8,
border: "1px solid " + (isSel ? "rgba(143,168,118,0.3)" : "rgba(255,255,255,0.05)"),
borderRadius: 10,
background: isSel ? "rgba(143,168,118,0.06)" : "rgba(255,255,255,0.02)",
overflow: "hidden", transition: "all 0.3s ease",
}}>
<div onClick={function() { onToggleBlock(block.id); setExpandedBlock(isExp ? null : block.id); }}
style={{ display: "flex", alignItems: "center", gap: 12, padding: "14px 16px", cursor: "pointer" }}>
<div style={{
width: 20, height: 20, borderRadius: 4, flexShrink: 0,
border: "2px solid " + (isSel ? "#8fa876" : "rgba(255,255,255,0.15)"),
background: isSel ? "#8fa876" : "transparent",
display: "flex", alignItems: "center", justifyContent: "center",
transition: "all 0.2s ease", fontSize: 12, color: "#1a1d17", fontWeight: 700,
}}>
{isSel && "\u2713"}
</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 14, fontWeight: 500, color: "#e8e4d9" }}>{block.name}</div>
<div style={{ fontSize: 12, color: "#7a8a6e", marginTop: 2 }}>{block.description}</div>
</div>
<span style={{ color: "#7a8a6e", fontSize: 12, transform: isExp && isSel ? "rotate(180deg)" : "rotate(0deg)", transition: "transform 0.2s ease" }}>{"\u25bc"}</span>
</div>
{isSel && isExp && (
<div style={{ padding: "0 16px 16px", borderTop: "1px solid rgba(255,255,255,0.04)" }}>
<div style={{ padding: "12px 0", display: "flex", flexDirection: "column", gap: 12 }}>
{block.fields.map(function(field) {
const bData = blockData[block.id] || {};
return (
<div key={field.id}>
<label style={{ ...S.mono, fontSize: 11, color: "#8a9a7e", display: "block", marginBottom: 6, letterSpacing: 0.5 }}>{field.label}</label>
{(field.type === "text" || field.type === "number") ? (
<input type={field.type} value={bData[field.id] || ""} onChange={function(e) { onUpdateField(block.id, field.id, e.target.value); }} style={S.input} placeholder={"Enter " + field.label.toLowerCase() + "..."} />
) : field.type === "textarea" ? (
<textarea value={bData[field.id] || ""} onChange={function(e) { onUpdateField(block.id, field.id, e.target.value); }} rows={4} style={Object.assign({}, S.input, { resize: "vertical" })} placeholder="Write your custom clause..." />
) : field.type === "select" ? (
<select value={bData[field.id] || ""} onChange={function(e) { onUpdateField(block.id, field.id, e.target.value); }} style={S.input}>
<option value="">Select...</option>
{field.options.map(function(o) { return <option key={o} value={o}>{o}</option>; })}
</select>
) : field.type === "multi" ? (
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
{field.options.map(function(opt) {
const cur = bData[field.id] || [];
const isChk = cur.includes(opt);
return (
<label key={opt} style={{ display: "flex", alignItems: "center", gap: 8, cursor: "pointer", fontSize: 13, color: "#c8c3b8" }}>
<input type="checkbox" checked={isChk} onChange={function() { var next = isChk ? cur.filter(function(x) { return x !== opt; }) : cur.concat([opt]); onUpdateField(block.id, field.id, next); }} style={{ accentColor: "#8fa876" }} />
{opt}
</label>
);
})}
</div>
) : null}
</div>
);
})}
</div>
<div style={{ marginTop: 8, padding: "10px 12px", background: "rgba(0,0,0,0.2)", borderRadius: 6, border: "1px solid rgba(255,255,255,0.04)" }}>
<div style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", letterSpacing: 1, marginBottom: 4 }}>CLAUSE PREVIEW</div>
<p style={{ fontSize: 12, color: "#a8a298", margin: 0, lineHeight: 1.6, fontStyle: "italic" }}>
{generateClausePreview(block, blockData[block.id] || {})}
</p>
</div>
</div>
)}
</div>
);
})}
</div>
);
})}
</div>
);
}
function AgreementPreview({ baseLicense, domain, selectedBlocks, blockData, projectName }) {
const blocks = CONDITIONAL_USE_BLOCKS.filter(function(b) { return selectedBlocks.includes(b.id); });
const today = new Date().toISOString().split("T")[0];
return (
<div style={{ background: "rgba(0,0,0,0.25)", border: "1px solid rgba(255,255,255,0.06)", borderRadius: 12, padding: "28px 24px" }}>
<div style={{ textAlign: "center", marginBottom: 24 }}>
<div style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", letterSpacing: 2, marginBottom: 8 }}>POLYCENTRIC AGREEMENT</div>
<h2 style={{ ...S.serif, fontSize: 24, color: "#e8e4d9", margin: "0 0 4px 0" }}>{projectName || "Untitled Project"}</h2>
<p style={{ fontSize: 12, color: "#7a8a6e", margin: 0 }}>Generated {today} • OpenTEAM Compatible</p>
</div>
<div style={{ borderTop: "1px solid rgba(255,255,255,0.06)", paddingTop: 20 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#8fa876", letterSpacing: 1, marginBottom: 12 }}>{"\u00a71 \u2014 BASE LICENSE"}</div>
<p style={{ fontSize: 14, color: "#c8c3b8", lineHeight: 1.7, margin: "0 0 6px 0" }}>
This {domain} is released under the <strong style={{ color: "#e8e4d9" }}>{baseLicense ? baseLicense.name : "\u2014"}</strong>.
</p>
{baseLicense && <p style={{ fontSize: 13, color: "#8a9a7e", margin: "0 0 20px 0" }}>{baseLicense.desc}</p>}
</div>
{blocks.length > 0 && (
<div style={{ borderTop: "1px solid rgba(255,255,255,0.06)", paddingTop: 20 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#8fa876", letterSpacing: 1, marginBottom: 12 }}>{"\u00a72 \u2014 CONDITIONAL USE PROVISIONS"}</div>
<p style={{ fontSize: 13, color: "#8a9a7e", margin: "0 0 16px 0" }}>
In addition to the base license, the following conditional use provisions apply. These provisions are modular and interoperable per OpenTEAM polycentric governance standards.
</p>
{blocks.map(function(block, i) {
return (
<div key={block.id} style={{ marginBottom: 16, paddingLeft: 16, borderLeft: "2px solid rgba(143,168,118,0.2)" }}>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", marginBottom: 4 }}>{"\u00a72." + (i + 1) + " \u2014 " + block.name.toUpperCase()}</div>
<p style={{ fontSize: 13, color: "#c8c3b8", lineHeight: 1.7, margin: 0 }}>
{generateClausePreview(block, blockData[block.id] || {})}
</p>
</div>
);
})}
</div>
)}
<div style={{ borderTop: "1px solid rgba(255,255,255,0.06)", paddingTop: 20, marginTop: 8 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#8fa876", letterSpacing: 1, marginBottom: 12 }}>{"\u00a7" + (blocks.length > 0 ? "3" : "2") + " \u2014 INTEROPERABILITY"}</div>
<p style={{ fontSize: 13, color: "#c8c3b8", lineHeight: 1.7, margin: 0 }}>
This agreement is designed for polycentric interoperability. Conditional use blocks may be composed with other OpenTEAM-compatible agreements to form multi-party governance arrangements for the exchange of {domain}, subject to the compatibility matrix of the base licenses involved.
</p>
</div>
<div style={{ borderTop: "1px solid rgba(255,255,255,0.06)", paddingTop: 16, marginTop: 20, display: "flex", gap: 8, flexWrap: "wrap" }}>
<span style={{ ...S.mono, fontSize: 10, color: "#1a1d17", background: "#8fa876", padding: "3px 10px", borderRadius: 4, letterSpacing: 0.5 }}>OpenTEAM COMPATIBLE</span>
<span style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", border: "1px solid rgba(122,138,110,0.3)", padding: "3px 10px", borderRadius: 4, letterSpacing: 0.5 }}>POLYCENTRIC</span>
<span style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", border: "1px solid rgba(122,138,110,0.3)", padding: "3px 10px", borderRadius: 4, letterSpacing: 0.5 }}>{(domain || "").toUpperCase()}</span>
{blocks.length > 0 && <span style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", border: "1px solid rgba(122,138,110,0.3)", padding: "3px 10px", borderRadius: 4, letterSpacing: 0.5 }}>CONDITIONAL USE</span>}
</div>
</div>
);
}
// ═══════════════════════════════════════════════════════════════════════
// MAIN APP
// ═══════════════════════════════════════════════════════════════════════
function LicenseEngine() {
const [phase, setPhase] = useState("welcome");
const [domain, setDomain] = useState(null);
const [answers, setAnswers] = useState({});
const [currentQ, setCurrentQ] = useState(0);
const [results, setResults] = useState([]);
const [selectedLicense, setSelectedLicense] = useState(null);
const [selectedBlocks, setSelectedBlocks] = useState([]);
const [blockData, setBlockData] = useState({});
const [projectName, setProjectName] = useState("");
const [interviewMode, setInterviewMode] = useState(false);
const [copied, setCopied] = useState(false);
const questions = domain ? QUESTION_SETS[domain] : [];
const handleAnswer = useCallback(function(qId, value) {
setAnswers(function(prev) { return Object.assign({}, prev, { [qId]: value }); });
if (interviewMode) {
setTimeout(function() {
if (currentQ < questions.length - 1) {
setCurrentQ(function(p) { return p + 1; });
} else {
var newAnswers = Object.assign({}, answers, { [qId]: value });
setResults(scoreLicenses(newAnswers, domain));
setPhase("results");
}
}, 350);
}
}, [currentQ, questions, domain, answers, interviewMode]);
const handleComplete = useCallback(function() {
setResults(scoreLicenses(answers, domain));
setPhase("results");
}, [answers, domain]);
const handleToggleBlock = useCallback(function(blockId) {
setSelectedBlocks(function(prev) {
return prev.includes(blockId) ? prev.filter(function(b) { return b !== blockId; }) : prev.concat([blockId]);
});
}, []);
const handleUpdateField = useCallback(function(blockId, fieldId, value) {
setBlockData(function(prev) {
return Object.assign({}, prev, { [blockId]: Object.assign({}, prev[blockId] || {}, { [fieldId]: value }) });
});
}, []);
const reset = function() {
setPhase("welcome"); setDomain(null); setAnswers({}); setCurrentQ(0);
setResults([]); setSelectedLicense(null); setSelectedBlocks([]);
setBlockData({}); setProjectName(""); setCopied(false);
};
const copyAgreement = function() {
var text = generateFullText(selectedLicense, domain, selectedBlocks, blockData, projectName);
navigator.clipboard.writeText(text).then(function() {
setCopied(true);
setTimeout(function() { setCopied(false); }, 2500);
}).catch(function() {
// Fallback
var el = document.createElement("textarea");
el.value = text; document.body.appendChild(el); el.select();
document.execCommand("copy"); document.body.removeChild(el);
setCopied(true);
setTimeout(function() { setCopied(false); }, 2500);
});
};
const downloadAgreement = function() {
var text = generateFullText(selectedLicense, domain, selectedBlocks, blockData, projectName);
var blob = new Blob([text], { type: "text/plain" });
var url = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = url;
a.download = (projectName || "agreement").replace(/\s+/g, "-").toLowerCase() + "-license.txt";
document.body.appendChild(a); a.click(); document.body.removeChild(a);
URL.revokeObjectURL(url);
};
// Scroll to top on phase change
useEffect(function() { window.scrollTo({ top: 0, behavior: "smooth" }); }, [phase]);
return (
<div style={S.container}>
<div style={S.bg1} />
<div style={S.bg2} />
<div style={S.inner}>
{/* ═══ WELCOME ═══ */}
{phase === "welcome" && (
<div className="anim-enter">
<div style={{ marginBottom: 48, textAlign: "center" }}>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 3, marginBottom: 16 }}>OPENTEAM · POLYCENTRIC GOVERNANCE</div>
<h1 style={{ ...S.serif, fontSize: 42, fontWeight: 600, color: "#e8e4d9", margin: "0 0 12px 0", lineHeight: 1.15, letterSpacing: -0.5 }}>
License<br />Engine
</h1>
<p style={{ fontSize: 16, color: "#8a9a7e", margin: "0 auto", maxWidth: 480, lineHeight: 1.7 }}>
Find the right license for your project — or build a custom polycentric agreement with interoperable conditional use blocks.
</p>
</div>
<div style={S.label}>WHAT ARE YOU LICENSING?</div>
<div style={{ display: "flex", flexDirection: "column", gap: 10, marginBottom: 32 }}>
{[
{ key: "software", icon: "\u2328\ufe0f", label: "Software", sub: "Applications, libraries, tools, APIs" },
{ key: "data", icon: "\ud83d\udcca", label: "Data & Datasets", sub: "Research data, agricultural data, databases" },
{ key: "hardware", icon: "\ud83d\udd27", label: "Hardware Designs", sub: "Schematics, CAD files, fabrication plans" },
].map(function(d) {
return (
<button key={d.key} onClick={function() { setDomain(d.key); }}
style={{
display: "flex", alignItems: "center", gap: 16, padding: "18px 20px",
background: domain === d.key ? "rgba(143,168,118,0.12)" : "rgba(255,255,255,0.02)",
border: "1.5px solid " + (domain === d.key ? "#8fa876" : "rgba(255,255,255,0.06)"),
borderRadius: 12, cursor: "pointer", textAlign: "left", transition: "all 0.25s ease", color: "#e8e4d9",
fontFamily: "'DM Sans', sans-serif",
}}>
<span style={{ fontSize: 28 }}>{d.icon}</span>
<div>
<div style={{ fontSize: 16, fontWeight: 500 }}>{d.label}</div>
<div style={{ fontSize: 12, color: "#7a8a6e", marginTop: 2 }}>{d.sub}</div>
</div>
{domain === d.key && <span style={{ marginLeft: "auto", color: "#8fa876", fontSize: 18 }}>{"\u2713"}</span>}
</button>
);
})}
</div>
{domain && (
<div className="anim-enter">
<div style={{ marginBottom: 20 }}>
<label style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1, display: "block", marginBottom: 8 }}>PROJECT NAME (OPTIONAL)</label>
<input type="text" value={projectName} onChange={function(e) { setProjectName(e.target.value); }}
placeholder="e.g., FarmHack Soil Sensor v2"
style={{ width: "100%", padding: "12px 14px", background: "rgba(0,0,0,0.3)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: 8, color: "#e8e4d9", fontFamily: "'DM Sans', sans-serif", fontSize: 14, outline: "none" }} />
</div>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1.5, marginBottom: 12 }}>HOW DO YOU WANT TO PROCEED?</div>
<div style={{ display: "flex", gap: 10, flexWrap: "wrap" }}>
<button onClick={function() { setInterviewMode(true); setPhase("questions"); }} style={S.btnPrimary}>
Guided Interview {"\u2192"}
</button>
<button onClick={function() { setInterviewMode(false); setPhase("questions"); }} style={S.btnSecondary}>
All Questions at Once
</button>
<button onClick={function() { setPhase("builder"); }} style={Object.assign({}, S.btnSecondary, { borderStyle: "dashed" })}>
Skip to Custom Builder {"\u2699\ufe0f"}
</button>
</div>
</div>
)}
</div>
)}
{/* ═══ QUESTIONS: Interview ═══ */}
{phase === "questions" && interviewMode && (
<div>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}>
<button onClick={reset} style={S.backBtn}>{"\u2190 BACK"}</button>
<span style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1 }}>{(domain || "").toUpperCase() + " LICENSE"}</span>
</div>
<ProgressBar current={currentQ + 1} total={questions.length} />
<QuestionCard key={questions[currentQ].id} question={questions[currentQ]} selected={answers[questions[currentQ].id]} onSelect={handleAnswer} animDelay={0} />
<div style={{ display: "flex", justifyContent: "space-between", marginTop: 32 }}>
<button onClick={function() { setCurrentQ(Math.max(0, currentQ - 1)); }} disabled={currentQ === 0}
style={Object.assign({}, S.btnSecondary, { opacity: currentQ === 0 ? 0.3 : 1 })}>
{"\u2190 Previous"}
</button>
{answers[questions[currentQ] && questions[currentQ].id] && currentQ === questions.length - 1 && (
<button onClick={handleComplete} style={S.btnPrimary}>See Results {"\u2192"}</button>
)}
</div>
</div>
)}
{/* ═══ QUESTIONS: All at Once ═══ */}
{phase === "questions" && !interviewMode && (
<div>
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}>
<button onClick={reset} style={S.backBtn}>{"\u2190 BACK"}</button>
<span style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1 }}>{(domain || "").toUpperCase() + " LICENSE"}</span>
</div>
<ProgressBar current={Object.keys(answers).length} total={questions.length} />
<div style={{ display: "flex", flexDirection: "column", gap: 36 }}>
{questions.map(function(q, i) {
return <QuestionCard key={q.id} question={q} selected={answers[q.id]} onSelect={handleAnswer} animDelay={Math.min(i, 5)} />;
})}
</div>
<div style={{ display: "flex", justifyContent: "center", marginTop: 40 }}>
<button onClick={handleComplete} disabled={Object.keys(answers).length < questions.length}
style={Object.assign({}, S.btnPrimary, { opacity: Object.keys(answers).length < questions.length ? 0.4 : 1, padding: "14px 40px", fontSize: 15 })}>
Find Best License Match {"\u2192"}
</button>
</div>
</div>
)}
{/* ═══ RESULTS ═══ */}
{phase === "results" && (
<div className="anim-enter">
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 8 }}>
<button onClick={function() { setPhase("questions"); setCurrentQ(0); }} style={S.backBtn}>{"\u2190 REVISE ANSWERS"}</button>
<button onClick={reset} style={S.backBtn}>START OVER</button>
</div>
<div style={{ textAlign: "center", marginBottom: 32 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 2, marginBottom: 8 }}>RECOMMENDATION</div>
<h2 style={{ ...S.serif, fontSize: 28, color: "#e8e4d9", margin: "0 0 8px 0" }}>
{projectName ? "Licenses for " + projectName : (domain ? domain.charAt(0).toUpperCase() + domain.slice(1) : "") + " License Matches"}
</h2>
<p style={{ fontSize: 14, color: "#8a9a7e", margin: 0 }}>Ranked by compatibility with your stated preferences</p>
</div>
<div style={{ display: "flex", flexDirection: "column", gap: 10, marginBottom: 32 }}>
{results.slice(0, 6).map(function(lic, i) {
return (
<div key={lic.id} onClick={function() { setSelectedLicense(lic); }} style={{ cursor: "pointer" }}>
<LicenseResult license={lic} rank={i} />
</div>
);
})}
</div>
{selectedLicense ? (
<div className="anim-enter" style={{ marginBottom: 24, padding: 20, background: "rgba(143,168,118,0.06)", border: "1px solid rgba(143,168,118,0.2)", borderRadius: 12 }}>
<h3 style={{ ...S.serif, fontSize: 18, color: "#e8e4d9", margin: "0 0 6px 0" }}>Selected: {selectedLicense.name}</h3>
<p style={{ fontSize: 13, color: "#8a9a7e", margin: "0 0 16px 0" }}>{selectedLicense.desc}</p>
<div style={{ display: "flex", gap: 10, flexWrap: "wrap" }}>
<button onClick={function() { setPhase("builder"); }} style={S.btnPrimary}>Add Conditional Use Blocks {"\u2192"}</button>
<button onClick={function() { setPhase("preview"); }} style={S.btnSecondary}>Generate Agreement {"\u2192"}</button>
</div>
</div>
) : (
<p style={{ textAlign: "center", fontSize: 13, color: "#7a8a6e", fontStyle: "italic" }}>Click a license above to select it</p>
)}
</div>
)}
{/* ═══ BUILDER ═══ */}
{phase === "builder" && (
<div className="anim-enter">
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}>
<button onClick={function() { results.length > 0 ? setPhase("results") : reset(); }} style={S.backBtn}>{"\u2190 BACK"}</button>
<span style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1 }}>AGREEMENT BUILDER</span>
</div>
{!selectedLicense && (
<div style={{ marginBottom: 28 }}>
<div style={{ ...S.mono, fontSize: 11, color: "#7a8a6e", letterSpacing: 1, marginBottom: 10 }}>BASE LICENSE</div>
<select value={selectedLicense ? selectedLicense.id : ""} onChange={function(e) {
var all = [].concat(LICENSE_DATABASE.software, LICENSE_DATABASE.data, LICENSE_DATABASE.hardware);
setSelectedLicense(all.find(function(l) { return l.id === e.target.value; }) || null);
}} style={{ width: "100%", padding: "12px 14px", background: "rgba(0,0,0,0.3)", border: "1px solid rgba(255,255,255,0.1)", borderRadius: 8, color: "#e8e4d9", fontFamily: "'DM Sans', sans-serif", fontSize: 14, outline: "none" }}>
<option value="">Select a base license...</option>
<optgroup label="Software">
{LICENSE_DATABASE.software.filter(function(l) { return !l.id.startsWith("custom"); }).map(function(l) { return <option key={l.id} value={l.id}>{l.name}</option>; })}
</optgroup>
<optgroup label="Data">
{LICENSE_DATABASE.data.filter(function(l) { return !l.id.startsWith("custom"); }).map(function(l) { return <option key={l.id} value={l.id}>{l.name}</option>; })}
</optgroup>
<optgroup label="Hardware">
{LICENSE_DATABASE.hardware.filter(function(l) { return !l.id.startsWith("custom"); }).map(function(l) { return <option key={l.id} value={l.id}>{l.name}</option>; })}
</optgroup>
<optgroup label="Custom">
<option value="none">No base license — fully custom terms</option>
</optgroup>
</select>
</div>
)}
{selectedLicense && (
<div style={{ marginBottom: 24, padding: "14px 16px", background: "rgba(143,168,118,0.06)", border: "1px solid rgba(143,168,118,0.15)", borderRadius: 8 }}>
<div style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", letterSpacing: 1, marginBottom: 4 }}>BASE LICENSE</div>
<div style={{ ...S.serif, fontSize: 16, color: "#e8e4d9" }}>{selectedLicense.name}</div>
</div>
)}
<ConditionalBlockBuilder selectedBlocks={selectedBlocks} onToggleBlock={handleToggleBlock} onUpdateField={handleUpdateField} blockData={blockData} />
<div style={{ display: "flex", justifyContent: "center", marginTop: 32, gap: 12 }}>
<button onClick={function() { setPhase("preview"); }} style={Object.assign({}, S.btnPrimary, { padding: "14px 36px" })}>
Generate Agreement {"\u2192"}
</button>
</div>
</div>
)}
{/* ═══ PREVIEW ═══ */}
{phase === "preview" && (
<div className="anim-enter">
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}>
<button onClick={function() { setPhase("builder"); }} style={S.backBtn}>{"\u2190 EDIT BLOCKS"}</button>
<button onClick={reset} style={S.backBtn}>START OVER</button>
</div>
<AgreementPreview baseLicense={selectedLicense} domain={domain || "software"} selectedBlocks={selectedBlocks} blockData={blockData} projectName={projectName} />
<div style={{ display: "flex", justifyContent: "center", gap: 12, marginTop: 28, flexWrap: "wrap" }}>
<button onClick={copyAgreement} style={Object.assign({}, S.btnPrimary, { background: copied ? "#6b8a5a" : "#8fa876" })}>
{copied ? "\u2713 Copied!" : "Copy Agreement Text"}
</button>
<button onClick={downloadAgreement} style={S.btnSecondary}>
Download .txt
</button>
<button onClick={function() { setPhase("builder"); }} style={S.btnSecondary}>
Edit Blocks
</button>
<button onClick={function() { setPhase("questions"); setCurrentQ(0); setAnswers({}); }} style={S.btnSecondary}>
Re-run Interview
</button>
</div>
<div style={{ marginTop: 40, padding: 20, background: "rgba(0,0,0,0.2)", borderRadius: 10, border: "1px solid rgba(255,255,255,0.04)" }}>
<div style={{ ...S.mono, fontSize: 10, color: "#7a8a6e", letterSpacing: 1.5, marginBottom: 10 }}>INTEROPERABILITY NOTE</div>
<p style={{ fontSize: 13, color: "#8a9a7e", lineHeight: 1.7, margin: 0 }}>
This agreement uses the OpenTEAM polycentric framework. Conditional use blocks are modular — they can be independently adopted, composed with other organizations’ agreements, and form part of multi-party governance arrangements. Each block carries its own version and compatibility identifier, enabling true polycentric exchange of {domain || "resources"} across organizational boundaries.
</p>
</div>
</div>
)}
</div>
</div>
);
}
// ═══════════════════════════════════════════════════════════════════════
// MOUNT
// ═══════════════════════════════════════════════════════════════════════
ReactDOM.createRoot(document.getElementById("root")).render(React.createElement(LicenseEngine));
// Hide loading screen
setTimeout(function() {
var ls = document.getElementById("loading-screen");
if (ls) { ls.classList.add("fade-out"); setTimeout(function() { ls.remove(); }, 500); }
}, 300);
</script>
</body>
</html>