datalog-theme 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +127 -0
  3. data/CITATION.cff +2 -2
  4. data/README.md +4 -2
  5. data/_data/i18n/en.yml +55 -3
  6. data/_data/i18n/es.yml +55 -3
  7. data/_data/i18n/pt.yml +55 -3
  8. data/_includes/analytics/dashboard.html +24 -9
  9. data/_includes/components/academic-dashboard.html +168 -133
  10. data/_includes/components/author-bio.html +7 -5
  11. data/_includes/components/author-list.html +6 -5
  12. data/_includes/components/citation-tools.html +2 -1
  13. data/_includes/components/content-provenance.html +19 -1
  14. data/_includes/components/correction-report.html +15 -8
  15. data/_includes/components/hero.html +22 -15
  16. data/_includes/components/package-index.html +121 -0
  17. data/_includes/components/package-install.html +27 -50
  18. data/_includes/components/post-list.html +14 -0
  19. data/_includes/components/responsive-image.html +15 -21
  20. data/_includes/footer.html +1 -1
  21. data/_includes/head.html +70 -11
  22. data/_includes/layouts/default/article.html +76 -46
  23. data/_includes/meta/dataset-json.html +171 -0
  24. data/_includes/meta/math-config.html +15 -1
  25. data/_includes/meta/package-json.html +69 -0
  26. data/_includes/meta/person-json.html +36 -13
  27. data/_includes/meta/publisher.html +15 -0
  28. data/_includes/meta/schema.html +108 -23
  29. data/_includes/meta/scholarly.html +10 -5
  30. data/_includes/post/related-posts.html +17 -43
  31. data/_includes/scripts.html +2 -2
  32. data/_includes/search/index-data.json +10 -1
  33. data/_includes/search/page.html +11 -6
  34. data/_layouts/archive.html +67 -0
  35. data/_layouts/dataset.html +2 -1
  36. data/_layouts/default.html +13 -11
  37. data/_layouts/docs.html +53 -0
  38. data/_layouts/home.html +30 -1
  39. data/_layouts/notebook.html +5 -1
  40. data/_layouts/package.html +38 -21
  41. data/_layouts/portfolio.html +1 -0
  42. data/_layouts/post.html +21 -62
  43. data/_layouts/project.html +2 -1
  44. data/_layouts/research.html +14 -2
  45. data/_plugins/analytics_dashboard.rb +4 -1
  46. data/_plugins/archive.rb +114 -0
  47. data/_plugins/authors.rb +50 -1
  48. data/_plugins/citation_exports.rb +12 -1
  49. data/_plugins/config_validator.rb +77 -2
  50. data/_plugins/correction_fallback.rb +110 -0
  51. data/_plugins/image_optimizer.rb +129 -22
  52. data/_plugins/math_preprocessor.rb +7 -48
  53. data/_plugins/notebook_converter.rb +44 -5
  54. data/_plugins/packages.rb +84 -0
  55. data/_plugins/page_dates.rb +37 -0
  56. data/_plugins/references.rb +16 -2
  57. data/_plugins/related_posts.rb +149 -0
  58. data/_plugins/search_sections.rb +110 -0
  59. data/_plugins/site_identity.rb +42 -0
  60. data/_plugins/social_cards.rb +17 -0
  61. data/_sass/_academic-dashboard.scss +18 -30
  62. data/_sass/_base.scss +2 -0
  63. data/_sass/_components.scss +21 -23
  64. data/_sass/_docs.scss +143 -0
  65. data/_sass/_features.scss +6 -0
  66. data/_sass/_layout.scss +65 -6
  67. data/_sass/_mathematical.scss +61 -19
  68. data/_sass/_notebooks.scss +1 -32
  69. data/_sass/_package-docs.scss +6 -9
  70. data/_sass/_post-components.scss +23 -23
  71. data/_sass/_print.scss +1 -1
  72. data/_sass/_search-page.scss +75 -0
  73. data/_sass/_search.scss +17 -26
  74. data/_sass/_syntax-highlighting.scss +23 -1
  75. data/_sass/_theme.scss +1 -0
  76. data/_sass/_utilities.scss +87 -40
  77. data/_sass/_variables.scss +31 -29
  78. data/assets/css/main.scss +2 -1
  79. data/assets/js/dist/academic.js +1 -1
  80. data/assets/js/dist/analytics-dashboard.js +1 -1
  81. data/assets/js/dist/chunks/chunk-TNVD6UAM.js +1 -0
  82. data/assets/js/dist/comments.js +1 -1
  83. data/assets/js/dist/contact.js +1 -1
  84. data/assets/js/dist/core.js +1 -1
  85. data/assets/js/dist/corrections.js +5 -1
  86. data/assets/js/dist/loader.js +1 -1
  87. data/assets/js/dist/math.js +2 -1
  88. data/assets/js/dist/moderation.js +1 -1
  89. data/assets/js/dist/reactions.js +1 -1
  90. data/assets/js/dist/search.js +1 -1
  91. data/assets/js/dist/sources.json +20 -16
  92. data/assets/js/dist/subscriptions.js +1 -1
  93. data/assets/js/loader.js +6 -2
  94. data/lib/datalog/audit/checks.rb +269 -0
  95. data/lib/datalog/audit/known_keys.rb +61 -0
  96. data/lib/datalog/audit/site_reader.rb +118 -0
  97. data/lib/datalog/audit/source_file.rb +85 -0
  98. data/lib/datalog/audit.rb +145 -0
  99. data/lib/datalog/citations/bibtex.rb +200 -0
  100. data/lib/datalog/citations/entry.rb +333 -0
  101. data/lib/datalog/citations/markup.rb +79 -0
  102. data/lib/datalog/cli.rb +164 -89
  103. data/lib/datalog/critical_css.rb +126 -21
  104. data/lib/datalog/latex_speech/words.json +88 -0
  105. data/lib/datalog/latex_speech.rb +355 -0
  106. data/lib/datalog/packages/command.rb +51 -0
  107. data/lib/datalog/packages/refresh.rb +187 -0
  108. data/lib/datalog/packages.rb +177 -0
  109. data/lib/datalog/plugin_system.rb +5 -0
  110. data/lib/datalog/plugins/citations.rb +325 -109
  111. data/lib/datalog/site_config.rb +26 -0
  112. data/lib/datalog/social_cards/font.rb +286 -0
  113. data/lib/datalog/social_cards/fonts/IBMPlexSans-Regular.ttf +0 -0
  114. data/lib/datalog/social_cards/fonts/IBMPlexSerif-SemiBold.ttf +0 -0
  115. data/lib/datalog/social_cards/fonts/OFL.txt +92 -0
  116. data/lib/datalog/social_cards/geometry.rb +51 -0
  117. data/lib/datalog/social_cards/outline.rb +54 -0
  118. data/lib/datalog/social_cards/plain_text.rb +258 -0
  119. data/lib/datalog/social_cards/template.rb +322 -0
  120. data/lib/datalog/social_cards/template.svg +17 -0
  121. data/lib/datalog/social_cards/typesetter.rb +178 -0
  122. data/lib/datalog/social_cards.rb +369 -0
  123. data/lib/datalog/theme/updater.rb +307 -0
  124. data/lib/datalog/theme/version.rb +1 -1
  125. metadata +44 -7
  126. data/_includes/components/enhanced-code-block.html +0 -212
  127. data/_includes/components/performance-monitor.html +0 -170
  128. data/_includes/components/viz-table-fallback.html +0 -19
  129. data/_plugins/datalog_bibliography.rb +0 -21
  130. data/assets/js/dist/chunks/chunk-WIRUK3OZ.js +0 -1
@@ -1,212 +0,0 @@
1
- {%- comment -%}
2
- Enhanced Code Block with Advanced Sharing Options
3
- Adds copy, download, and playground integration to code blocks
4
-
5
- Parameters:
6
- - code: Code content
7
- - language: Programming language
8
- - filename: Optional filename for downloads
9
- - playground_url: URL to online playground (optional)
10
- - show_line_numbers: Show line numbers (default: true)
11
- {%- endcomment -%}
12
-
13
- {%- assign code_content = include.code -%}
14
- {%- assign language = include.language | default: "text" -%}
15
- {%- assign filename = include.filename -%}
16
- {%- assign playground_url = include.playground_url -%}
17
- {%- assign show_line_numbers = include.show_line_numbers | default: true -%}
18
-
19
- {%- assign code_id = "code-" | append: language | append: "-" | append: include.index | default: "1" -%}
20
-
21
- <div class="enhanced-code-block" data-enhanced-code data-language="{{ language }}">
22
- <div class="enhanced-code-block__header">
23
- <div class="enhanced-code-block__info">
24
- <span class="enhanced-code-block__language">{{ language | upcase }}</span>
25
- {%- if filename -%}
26
- <span class="enhanced-code-block__filename">{{ filename }}</span>
27
- {%- endif -%}
28
- </div>
29
-
30
- <div class="enhanced-code-block__actions">
31
- {%- comment -%} Copy button {%- endcomment -%}
32
- <button type="button"
33
- class="enhanced-code-block__action"
34
- data-action="copy"
35
- data-code-id="{{ code_id }}"
36
- aria-label="Copy code to clipboard"
37
- title="Copy code">
38
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
39
- <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
40
- <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
41
- </svg>
42
- <span class="enhanced-code-block__action-text">Copy</span>
43
- </button>
44
-
45
- {%- comment -%} Download button {%- endcomment -%}
46
- <button type="button"
47
- class="enhanced-code-block__action"
48
- data-action="download"
49
- data-code-id="{{ code_id }}"
50
- data-filename="{{ filename | default: 'code.' | append: language }}"
51
- aria-label="Download code file"
52
- title="Download">
53
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
54
- <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
55
- <polyline points="7 10 12 15 17 10"></polyline>
56
- <line x1="12" y1="15" x2="12" y2="3"></line>
57
- </svg>
58
- <span class="enhanced-code-block__action-text">Download</span>
59
- </button>
60
-
61
- {%- comment -%} Playground button {%- endcomment -%}
62
- {%- if playground_url -%}
63
- <a href="{{ playground_url }}"
64
- class="enhanced-code-block__action"
65
- target="_blank"
66
- rel="noopener noreferrer"
67
- aria-label="Open in playground"
68
- title="Open in playground">
69
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
70
- <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
71
- </svg>
72
- <span class="enhanced-code-block__action-text">Run</span>
73
- </a>
74
- {%- elsif language == "python" or language == "javascript" or language == "typescript" -%}
75
- <button type="button"
76
- class="enhanced-code-block__action"
77
- data-action="playground"
78
- data-code-id="{{ code_id }}"
79
- aria-label="Open in online playground"
80
- title="Open in playground">
81
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
82
- <polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon>
83
- </svg>
84
- <span class="enhanced-code-block__action-text">Run</span>
85
- </button>
86
- {%- endif -%}
87
-
88
- {%- comment -%} Share button {%- endcomment -%}
89
- <button type="button"
90
- class="enhanced-code-block__action"
91
- data-action="share"
92
- data-code-id="{{ code_id }}"
93
- aria-label="Share code snippet"
94
- title="Share snippet">
95
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
96
- <circle cx="18" cy="5" r="3"></circle>
97
- <circle cx="6" cy="12" r="3"></circle>
98
- <circle cx="18" cy="19" r="3"></circle>
99
- <line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line>
100
- <line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line>
101
- </svg>
102
- <span class="enhanced-code-block__action-text">Share</span>
103
- </button>
104
- </div>
105
- </div>
106
-
107
- <pre class="highlight enhanced-code-block__pre{% if show_line_numbers %} enhanced-code-block__pre--numbered{% endif %}" tabindex="0"><code id="{{ code_id }}" class="language-{{ language }}" data-code-content>{{ code_content | rouge_highlight: language }}</code></pre>
108
-
109
- {%- comment -%} Feedback message {%- endcomment -%}
110
- <div class="enhanced-code-block__feedback" data-feedback role="status" aria-live="polite"></div>
111
- </div>
112
-
113
- <script>
114
- (function() {
115
- 'use strict';
116
-
117
- // Playground URLs for different languages
118
- const playgroundUrls = {
119
- python: 'https://repl.it/languages/python3',
120
- javascript: 'https://jsfiddle.net/',
121
- typescript: 'https://www.typescriptlang.org/play',
122
- go: 'https://go.dev/play/',
123
- rust: 'https://play.rust-lang.org/',
124
- sql: 'https://www.db-fiddle.com/'
125
- };
126
-
127
- document.addEventListener('click', function(e) {
128
- const button = e.target.closest('[data-action]');
129
- if (!button) return;
130
-
131
- const action = button.dataset.action;
132
- const codeId = button.dataset.codeId;
133
- const codeElement = document.getElementById(codeId);
134
- if (!codeElement) return;
135
-
136
- const code = codeElement.textContent;
137
- const codeBlock = button.closest('[data-enhanced-code]');
138
- const feedback = codeBlock.querySelector('[data-feedback]');
139
-
140
- function showFeedback(message, type = 'success') {
141
- if (feedback) {
142
- feedback.textContent = message;
143
- feedback.className = `enhanced-code-block__feedback enhanced-code-block__feedback--${type}`;
144
- setTimeout(() => {
145
- feedback.textContent = '';
146
- feedback.className = 'enhanced-code-block__feedback';
147
- }, 3000);
148
- }
149
- }
150
-
151
- switch (action) {
152
- case 'copy':
153
- if (navigator.clipboard) {
154
- navigator.clipboard.writeText(code).then(() => {
155
- showFeedback('Code copied to clipboard!');
156
- button.querySelector('.enhanced-code-block__action-text').textContent = 'Copied!';
157
- setTimeout(() => {
158
- button.querySelector('.enhanced-code-block__action-text').textContent = 'Copy';
159
- }, 2000);
160
- }).catch(() => {
161
- showFeedback('Failed to copy code', 'error');
162
- });
163
- }
164
- break;
165
-
166
- case 'download':
167
- const filename = button.dataset.filename || 'code.txt';
168
- const blob = new Blob([code], { type: 'text/plain' });
169
- const url = URL.createObjectURL(blob);
170
- const link = document.createElement('a');
171
- link.href = url;
172
- link.download = filename;
173
- link.click();
174
- URL.revokeObjectURL(url);
175
- showFeedback(`Downloaded as ${filename}`);
176
- break;
177
-
178
- case 'playground':
179
- const language = codeBlock.dataset.language;
180
- const playgroundUrl = playgroundUrls[language];
181
- if (playgroundUrl) {
182
- // Encode code and open in new window
183
- window.open(playgroundUrl, '_blank', 'noopener,noreferrer');
184
- showFeedback('Opening in playground...');
185
- } else {
186
- showFeedback('Playground not available for this language', 'error');
187
- }
188
- break;
189
-
190
- case 'share':
191
- if (navigator.share) {
192
- navigator.share({
193
- title: 'Code Snippet',
194
- text: code
195
- }).then(() => {
196
- showFeedback('Shared successfully!');
197
- }).catch((err) => {
198
- if (err.name !== 'AbortError') {
199
- showFeedback('Failed to share', 'error');
200
- }
201
- });
202
- } else {
203
- // Fallback: copy to clipboard
204
- navigator.clipboard.writeText(code).then(() => {
205
- showFeedback('Link copied to clipboard!');
206
- });
207
- }
208
- break;
209
- }
210
- });
211
- })();
212
- </script>
@@ -1,170 +0,0 @@
1
- {%- comment -%}
2
- Performance Monitoring - Track Core Web Vitals and RUM
3
- {%- endcomment -%}
4
-
5
- <script>
6
- (function() {
7
- 'use strict';
8
-
9
- class PerformanceMonitor {
10
- constructor() {
11
- this.metrics = {};
12
- this.init();
13
- }
14
-
15
- init() {
16
- // Core Web Vitals
17
- this.measureCLS();
18
- this.measureFID();
19
- this.measureLCP();
20
- this.measureTTFB();
21
- this.measureFCP();
22
-
23
- // Custom metrics
24
- this.measurePageLoad();
25
- this.measureResourceTiming();
26
-
27
- // Report after page load
28
- window.addEventListener('load', () => {
29
- setTimeout(() => this.reportMetrics(), 2000);
30
- });
31
- }
32
-
33
- measureCLS() {
34
- let clsValue = 0;
35
- let clsEntries = [];
36
-
37
- const observer = new PerformanceObserver((list) => {
38
- for (const entry of list.getEntries()) {
39
- if (!entry.hadRecentInput) {
40
- clsValue += entry.value;
41
- clsEntries.push(entry);
42
- }
43
- }
44
- });
45
-
46
- observer.observe({type: 'layout-shift', buffered: true});
47
- this.metrics.cls = () => clsValue;
48
- }
49
-
50
- measureFID() {
51
- const observer = new PerformanceObserver((list) => {
52
- for (const entry of list.getEntries()) {
53
- this.metrics.fid = entry.processingStart - entry.startTime;
54
- }
55
- });
56
-
57
- observer.observe({type: 'first-input', buffered: true});
58
- }
59
-
60
- measureLCP() {
61
- const observer = new PerformanceObserver((list) => {
62
- const entries = list.getEntries();
63
- const lastEntry = entries[entries.length - 1];
64
- this.metrics.lcp = lastEntry.renderTime || lastEntry.loadTime;
65
- });
66
-
67
- observer.observe({type: 'largest-contentful-paint', buffered: true});
68
- }
69
-
70
- measureTTFB() {
71
- const navTiming = performance.getEntriesByType('navigation')[0];
72
- if (navTiming) {
73
- this.metrics.ttfb = navTiming.responseStart - navTiming.requestStart;
74
- }
75
- }
76
-
77
- measureFCP() {
78
- const observer = new PerformanceObserver((list) => {
79
- for (const entry of list.getEntries()) {
80
- if (entry.name === 'first-contentful-paint') {
81
- this.metrics.fcp = entry.startTime;
82
- }
83
- }
84
- });
85
-
86
- observer.observe({type: 'paint', buffered: true});
87
- }
88
-
89
- measurePageLoad() {
90
- window.addEventListener('load', () => {
91
- const navTiming = performance.getEntriesByType('navigation')[0];
92
- if (navTiming) {
93
- this.metrics.domContentLoaded = navTiming.domContentLoadedEventEnd - navTiming.domContentLoadedEventStart;
94
- this.metrics.loadComplete = navTiming.loadEventEnd - navTiming.loadEventStart;
95
- this.metrics.totalTime = navTiming.loadEventEnd - navTiming.fetchStart;
96
- }
97
- });
98
- }
99
-
100
- measureResourceTiming() {
101
- window.addEventListener('load', () => {
102
- const resources = performance.getEntriesByType('resource');
103
- const byType = {};
104
-
105
- resources.forEach(resource => {
106
- const type = resource.initiatorType;
107
- if (!byType[type]) byType[type] = {count: 0, totalSize: 0, totalDuration: 0};
108
-
109
- byType[type].count++;
110
- byType[type].totalSize += resource.transferSize || 0;
111
- byType[type].totalDuration += resource.duration;
112
- });
113
-
114
- this.metrics.resources = byType;
115
- });
116
- }
117
-
118
- reportMetrics() {
119
- const report = {
120
- url: window.location.href,
121
- userAgent: navigator.userAgent,
122
- connection: navigator.connection ? {
123
- effectiveType: navigator.connection.effectiveType,
124
- downlink: navigator.connection.downlink,
125
- rtt: navigator.connection.rtt
126
- } : null,
127
- metrics: {
128
- cls: typeof this.metrics.cls === 'function' ? this.metrics.cls() : this.metrics.cls,
129
- fid: this.metrics.fid,
130
- lcp: this.metrics.lcp,
131
- ttfb: this.metrics.ttfb,
132
- fcp: this.metrics.fcp,
133
- domContentLoaded: this.metrics.domContentLoaded,
134
- loadComplete: this.metrics.loadComplete,
135
- totalTime: this.metrics.totalTime
136
- },
137
- resources: this.metrics.resources,
138
- timestamp: new Date().toISOString()
139
- };
140
-
141
- // Log to console (in production, send to analytics endpoint)
142
- console.log('Performance Metrics:', report);
143
-
144
- // Store in localStorage for debugging
145
- try {
146
- const history = JSON.parse(localStorage.getItem('performanceHistory') || '[]');
147
- history.push(report);
148
- localStorage.setItem('performanceHistory', JSON.stringify(history.slice(-10))); // Keep last 10
149
- } catch (e) {
150
- console.error('Failed to store performance metrics:', e);
151
- }
152
-
153
- // Send to analytics (if configured)
154
- if (window.gtag) {
155
- window.gtag('event', 'web_vitals', {
156
- event_category: 'Performance',
157
- cls: report.metrics.cls,
158
- fid: report.metrics.fid,
159
- lcp: report.metrics.lcp
160
- });
161
- }
162
- }
163
- }
164
-
165
- // Initialize
166
- if ('PerformanceObserver' in window) {
167
- new PerformanceMonitor();
168
- }
169
- })();
170
- </script>
@@ -1,19 +0,0 @@
1
- <template id="viz-table-fallback-template" data-component="viz-table-fallback">
2
- <div class="viz-table-container" data-viz-table-container>
3
- <button
4
- type="button"
5
- class="viz-table-toggle"
6
- data-viz-table-toggle
7
- aria-expanded="false"
8
- >
9
- Show data table
10
- </button>
11
- <div class="viz-table-wrapper" data-viz-table-wrapper hidden>
12
- <table class="viz-table" data-viz-table>
13
- <caption data-viz-table-caption></caption>
14
- <thead data-viz-table-head></thead>
15
- <tbody data-viz-table-body></tbody>
16
- </table>
17
- </div>
18
- </div>
19
- </template>
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Jekyll
4
- # Stands in for the `datalog_bibliography` tag when the datalog-citations
5
- # plugin is not enabled, so a layout that uses the tag still builds. The plugin
6
- # registers the real tag and sets `datalog_bibliography` on the pages it
7
- # handles; a page that sets the key by hand without the plugin gets nothing and
8
- # a build warning, where it used to get a "coming soon" notice.
9
- class DatalogBibliographyTag < Liquid::Tag
10
- def render(context)
11
- page = context.registers[:page]
12
- return "" unless page["datalog_bibliography"]
13
-
14
- Jekyll.logger.warn("datalog-citations", "#{page['path']} sets datalog_bibliography, " \
15
- "but datalog_plugins.enabled does not list datalog-citations")
16
- ""
17
- end
18
- end
19
- end
20
-
21
- Liquid::Template.register_tag("datalog_bibliography", Jekyll::DatalogBibliographyTag)
@@ -1 +0,0 @@
1
- import{a as c}from"./chunk-VZ5WKQVA.js";var b=["idle","pending","success","invalid","error","disabled"];function g(r=null){let t=new Map,i=()=>t.clear();return r&&["input","change","reset"].forEach(e=>r.addEventListener(e,i)),{key(e,n=""){var a,o,d;let s=JSON.stringify(e);if(((a=t.get(n))==null?void 0:a.fingerprint)!==s){let u=((d=(o=globalThis.crypto)==null?void 0:o.randomUUID)==null?void 0:d.call(o))||`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;t.set(n,{fingerprint:s,key:u})}return t.get(n).key},clear(e=""){t.delete(e)},reset:i}}function S(r,t,i,e={}){let n=null;return()=>(n||(n=r.feature(t).then(s=>(i.dataset.state==="error"&&l(i,"idle"),s)).catch(s=>{throw n=null,["disabled","unsupported","version"].includes(s.kind)?l(i,"disabled",c(s,e)):h(i,s,e),s})),n)}function f(r,t){let i=r.elements.namedItem(t);return i?typeof i.setAttribute=="function"?[i]:Array.from(i):[]}function y(r){r.querySelectorAll("[aria-invalid]").forEach(t=>{t.removeAttribute("aria-invalid");let i=(t.getAttribute("aria-describedby")||"").split(/\s+/).filter(e=>e&&!e.endsWith("-error")).join(" ");i?t.setAttribute("aria-describedby",i):t.removeAttribute("aria-describedby")}),r.querySelectorAll("[data-error-for]").forEach(t=>{t.textContent="",t.hidden=!0})}function p(r,t){let i=0,e=null;return Object.keys(t||{}).forEach(n=>{let s=Array.isArray(t[n])?t[n].join(" "):String(t[n]),a=r.querySelector(`[data-error-for="${n}"]`);a&&(a.textContent=s,a.hidden=!1,a.id||(a.id=`${r.id||"form"}-${n}-error`)),f(r,n).forEach(o=>{if(o.setAttribute("aria-invalid","true"),a){let d=(o.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);d.includes(a.id)||d.push(a.id),o.setAttribute("aria-describedby",d.join(" "))}e=e||o,i+=1})}),e&&typeof e.focus=="function"&&e.focus(),i}function l(r,t,i="",e=null){r.dataset.state=b.includes(t)?t:"idle";let n=t==="pending";r.setAttribute("aria-busy",n?"true":"false"),r.querySelectorAll("button[type=submit], [data-form-submit]").forEach(a=>{a.disabled=n||t==="disabled"}),r.querySelectorAll("fieldset").forEach(a=>{a.disabled=t==="disabled"});let s=r.querySelector("[data-form-status]");s&&(s.setAttribute("role",t==="error"||t==="invalid"?"alert":"status"),s.textContent=i,s.hidden=i===""),y(r),t==="invalid"&&e&&p(r,e)}function v(r){let t={};return new FormData(r).forEach((i,e)=>{let n=typeof i=="string"?i.trim():i;e in t?t[e]=[].concat(t[e],n):t[e]=n}),t}function h(r,t,i={}){let e=c(t,i);t&&t.kind==="invalid"?l(r,"invalid",e,t.errors||null):l(r,"error",e)}export{g as a,S as b,l as c,v as d,h as e};