@malto/sdk 0.1.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.
@@ -0,0 +1,607 @@
1
+ var Malto=(function(exports){'use strict';var F="https://api.malto.io",h=class{constructor(t){this.apiKey=t.apiKey,this.apiUrl=(t.apiUrl??F).replace(/\/$/,""),this.getSessionToken=t.getSessionToken;}async request(t,e={}){let a={"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`};if(e.headers){let s=e.headers;for(let[d,l]of Object.entries(s))a[d]=l;}if(e.auth){let s=this.getSessionToken();s&&(a["X-Malto-Session"]=s);}let r=await fetch(`${this.apiUrl}${t}`,{...e,headers:a}),o=await r.text(),n=o?A(o):null;if(!r.ok){let s=n&&(n.message||n.error)||`Request failed (${r.status})`;throw new b(Array.isArray(s)?s.join(", "):String(s),r.status)}return n}board(){return this.request("/v1/sdk/board")}listFeedbacks(){return this.request("/v1/sdk/feedbacks",{auth:true})}feedback(t){return this.request(`/v1/sdk/feedbacks/${t}`,{auth:true})}createFeedback(t){return this.request("/v1/sdk/feedbacks",{method:"POST",auth:true,body:JSON.stringify(t)})}vote(t){return this.request(`/v1/sdk/feedbacks/${t}/vote`,{method:"POST",auth:true})}comments(t){return this.request(`/v1/sdk/feedbacks/${t}/comments`,{auth:true})}addComment(t,e,a){return this.request(`/v1/sdk/feedbacks/${t}/comments`,{method:"POST",auth:true,body:JSON.stringify({body:e,parentId:a})})}roadmap(){return this.request("/v1/sdk/roadmap")}releases(){return this.request("/v1/sdk/releases")}startMagicLink(t){return this.request("/v1/sdk/auth/magic-link",{method:"POST",body:JSON.stringify(t)})}verifyMagicLink(t){return this.request("/v1/sdk/auth/verify",{method:"POST",body:JSON.stringify({token:t})})}identify(t){return this.request("/v1/sdk/auth/identify",{method:"POST",body:JSON.stringify(t)})}},b=class extends Error{constructor(e,a){super(e);this.status=a;this.name="MaltoApiError";}};function A(i){try{return JSON.parse(i)}catch{return null}}var x="malto:session:";function E(i){if(typeof window>"u")return null;try{let t=window.localStorage.getItem(x+i);if(!t)return null;let e=JSON.parse(t);return !e?.token||!e?.expiresAt?null:new Date(e.expiresAt).getTime()<Date.now()?(window.localStorage.removeItem(x+i),null):e}catch{return null}}function S(i,t){if(!(typeof window>"u"))try{window.localStorage.setItem(x+i,JSON.stringify(t));}catch{}}function g(i){if(!(typeof window>"u"))try{window.localStorage.removeItem(x+i);}catch{}}var H="malto-sdk-styles",P="malto-sdk-styles-custom";function R(i){if(typeof document>"u")return;let t=B(i);I(H,t),i.customCss?I(P,O(i.customCss)):document.getElementById(P)?.remove();}function O(i){return i.replace(/<\/style/gi,"<\\/style").replace(/<\/script/gi,"<\\/script").replace(/expression\s*\(/gi,"expr\\(").replace(/javascript\s*:/gi,"javascript\\:")}function I(i,t){let e=document.getElementById(i);if(e){e.textContent=t;return}let a=document.createElement("style");a.id=i,a.textContent=t,document.head.appendChild(a);}function B(i){let t=i.primary,e=D(t),a=i.radius==="sm"?"10px":i.radius==="lg"?"22px":"16px",r=i.appearance??"auto",o=i.cssVars??{};return `
2
+ :where(.malto-root, .malto-root *) {
3
+ box-sizing: border-box;
4
+ }
5
+ .malto-root {
6
+ --malto-primary: ${o.primary??t};
7
+ --malto-primary-contrast: ${o.primaryContrast??e.contrast};
8
+ --malto-primary-50: ${e.tint50};
9
+ --malto-primary-100: ${e.tint100};
10
+ --malto-primary-200: ${e.tint200};
11
+ --malto-primary-600: ${e.shade600};
12
+ --malto-primary-rgb: ${e.rgb};
13
+ --malto-surface: ${o.surface??"#ffffff"};
14
+ --malto-surface-muted: ${o.surfaceMuted??"#fbfaff"};
15
+ --malto-surface-elevated: rgba(255,255,255,0.85);
16
+ --malto-border: ${o.border??"rgba(15, 13, 35, 0.06)"};
17
+ --malto-border-strong: rgba(15, 13, 35, 0.1);
18
+ --malto-text: ${o.text??"#0f0d23"};
19
+ --malto-text-muted: ${o.textMuted??"#5b5871"};
20
+ --malto-text-subtle: rgba(15, 13, 35, 0.45);
21
+ --malto-radius: ${o.radius??a};
22
+ --malto-radius-sm: 10px;
23
+ --malto-radius-pill: 999px;
24
+ --malto-shadow-sm: ${o.shadow??"0 4px 12px -4px rgba(15, 13, 35, 0.08)"};
25
+ --malto-shadow-md: 0 12px 32px -8px rgba(15, 13, 35, 0.16);
26
+ --malto-shadow-lg: 0 30px 60px -20px rgba(15, 13, 35, 0.28);
27
+ --malto-shadow-glow: 0 12px 24px -8px rgba(var(--malto-primary-rgb), 0.45);
28
+ --malto-font: ${o.font??"-apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif"};
29
+ --malto-ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
30
+ --malto-ease-smooth: cubic-bezier(0.32, 0.72, 0, 1);
31
+ }
32
+
33
+ ${r==="dark"?T():""}
34
+ ${r==="auto"?`@media (prefers-color-scheme: dark) { ${T()} }`:""}
35
+
36
+ .malto-root, .malto-root *, .malto-root *::before, .malto-root *::after {
37
+ font-family: var(--malto-font);
38
+ -webkit-font-smoothing: antialiased;
39
+ -moz-osx-font-smoothing: grayscale;
40
+ }
41
+ .malto-root *::-webkit-scrollbar { width: 8px; height: 8px; }
42
+ .malto-root *::-webkit-scrollbar-track { background: transparent; }
43
+ .malto-root *::-webkit-scrollbar-thumb {
44
+ background: rgba(15, 13, 35, 0.12);
45
+ border-radius: 999px;
46
+ }
47
+ .malto-root *::-webkit-scrollbar-thumb:hover {
48
+ background: rgba(15, 13, 35, 0.22);
49
+ }
50
+
51
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Bubble (floating action button) \u2500\u2500\u2500\u2500\u2500\u2500 */
52
+ .malto-bubble {
53
+ position: fixed;
54
+ width: 56px; height: 56px;
55
+ border-radius: 999px;
56
+ background: var(--malto-primary);
57
+ color: var(--malto-primary-contrast);
58
+ display: flex; align-items: center; justify-content: center;
59
+ cursor: pointer; border: none;
60
+ box-shadow: var(--malto-shadow-glow);
61
+ z-index: var(--malto-z, 2147483600);
62
+ transition: transform .35s var(--malto-ease-spring), box-shadow .25s ease;
63
+ overflow: hidden;
64
+ }
65
+ .malto-bubble::before {
66
+ content: "";
67
+ position: absolute; inset: 0;
68
+ border-radius: inherit;
69
+ background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 50%);
70
+ pointer-events: none;
71
+ }
72
+ .malto-bubble::after {
73
+ content: "";
74
+ position: absolute; inset: -4px;
75
+ border-radius: inherit;
76
+ background: var(--malto-primary);
77
+ opacity: 0.25;
78
+ filter: blur(12px);
79
+ z-index: -1;
80
+ transition: opacity .25s ease;
81
+ }
82
+ .malto-bubble:hover { transform: scale(1.06) translateY(-2px); }
83
+ .malto-bubble:hover::after { opacity: 0.45; }
84
+ .malto-bubble:active { transform: scale(0.96); }
85
+ .malto-bubble svg { width: 24px; height: 24px; position: relative; z-index: 1; }
86
+
87
+ .malto-trigger {
88
+ display: inline-flex; align-items: center; gap: 8px;
89
+ padding: 9px 18px;
90
+ border-radius: var(--malto-radius-pill);
91
+ background: var(--malto-primary);
92
+ color: var(--malto-primary-contrast);
93
+ border: none; cursor: pointer;
94
+ font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
95
+ box-shadow: var(--malto-shadow-glow);
96
+ transition: transform .25s var(--malto-ease-spring), box-shadow .2s ease;
97
+ }
98
+ .malto-trigger:hover { transform: translateY(-1px); }
99
+ .malto-trigger:active { transform: scale(0.97); }
100
+ .malto-trigger svg { width: 14px; height: 14px; }
101
+
102
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Overlay + modal \u2500\u2500\u2500\u2500\u2500\u2500 */
103
+ .malto-overlay {
104
+ position: fixed; inset: 0;
105
+ background: rgba(15, 13, 35, 0.32);
106
+ backdrop-filter: blur(6px) saturate(140%);
107
+ -webkit-backdrop-filter: blur(6px) saturate(140%);
108
+ z-index: var(--malto-z, 2147483600);
109
+ display: flex; align-items: flex-end; justify-content: center;
110
+ padding: 0;
111
+ animation: malto-overlay-in .25s var(--malto-ease-smooth);
112
+ }
113
+ @media (min-width: 640px) {
114
+ .malto-overlay { align-items: center; padding: 24px; }
115
+ }
116
+
117
+ .malto-modal {
118
+ background: var(--malto-surface);
119
+ width: 100%;
120
+ max-width: 460px;
121
+ max-height: 92vh;
122
+ border-radius: var(--malto-radius) var(--malto-radius) 0 0;
123
+ box-shadow: var(--malto-shadow-lg);
124
+ display: flex; flex-direction: column;
125
+ overflow: hidden;
126
+ animation: malto-modal-in .35s var(--malto-ease-spring);
127
+ position: relative;
128
+ }
129
+ @media (min-width: 640px) {
130
+ .malto-modal { border-radius: var(--malto-radius); }
131
+ }
132
+
133
+ .malto-inline {
134
+ width: 100%;
135
+ max-width: 480px;
136
+ background: var(--malto-surface);
137
+ border: 1px solid var(--malto-border);
138
+ border-radius: var(--malto-radius);
139
+ box-shadow: var(--malto-shadow-sm);
140
+ overflow: hidden;
141
+ display: flex; flex-direction: column;
142
+ max-height: 640px;
143
+ }
144
+
145
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Header \u2500\u2500\u2500\u2500\u2500\u2500 */
146
+ .malto-header {
147
+ display: flex; align-items: center; justify-content: space-between;
148
+ padding: 18px 22px 14px;
149
+ position: relative;
150
+ flex: none;
151
+ }
152
+ .malto-header h3 {
153
+ margin: 0;
154
+ font-size: 16px; font-weight: 600;
155
+ color: var(--malto-text);
156
+ letter-spacing: -0.015em;
157
+ }
158
+ .malto-header-meta {
159
+ display: flex; align-items: center; gap: 10px;
160
+ }
161
+ .malto-board-logo {
162
+ width: 28px; height: 28px;
163
+ border-radius: 8px;
164
+ background: var(--malto-primary-100);
165
+ display: flex; align-items: center; justify-content: center;
166
+ color: var(--malto-primary);
167
+ font-size: 12px; font-weight: 700;
168
+ overflow: hidden;
169
+ object-fit: cover;
170
+ }
171
+ .malto-board-logo img { width: 100%; height: 100%; object-fit: cover; }
172
+ .malto-close {
173
+ width: 30px; height: 30px;
174
+ border-radius: 8px;
175
+ background: transparent; border: none; cursor: pointer;
176
+ color: var(--malto-text-muted);
177
+ font-size: 18px; line-height: 1;
178
+ display: flex; align-items: center; justify-content: center;
179
+ transition: background .15s ease, color .15s ease;
180
+ }
181
+ .malto-close:hover {
182
+ background: var(--malto-primary-50);
183
+ color: var(--malto-text);
184
+ }
185
+
186
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Tabs \u2500\u2500\u2500\u2500\u2500\u2500 */
187
+ .malto-tabs {
188
+ display: flex;
189
+ padding: 4px;
190
+ margin: 0 18px 14px;
191
+ background: var(--malto-primary-50);
192
+ border-radius: var(--malto-radius-sm);
193
+ flex: none;
194
+ }
195
+ .malto-tab {
196
+ flex: 1;
197
+ padding: 8px 10px;
198
+ background: transparent;
199
+ border: none; cursor: pointer;
200
+ font-size: 12px; font-weight: 600;
201
+ color: var(--malto-text-muted);
202
+ border-radius: 8px;
203
+ transition: all .25s var(--malto-ease-smooth);
204
+ letter-spacing: -0.005em;
205
+ }
206
+ .malto-tab:hover { color: var(--malto-text); }
207
+ .malto-tab[aria-selected="true"] {
208
+ background: var(--malto-surface);
209
+ color: var(--malto-primary);
210
+ box-shadow: var(--malto-shadow-sm);
211
+ }
212
+
213
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Body \u2500\u2500\u2500\u2500\u2500\u2500 */
214
+ .malto-body {
215
+ flex: 1;
216
+ overflow-y: auto;
217
+ padding: 4px 18px 18px;
218
+ background: var(--malto-surface);
219
+ scroll-behavior: smooth;
220
+ }
221
+ .malto-body > * {
222
+ animation: malto-fade-in .35s var(--malto-ease-smooth);
223
+ }
224
+ .malto-list {
225
+ display: flex; flex-direction: column;
226
+ gap: 8px;
227
+ }
228
+
229
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Feedback row \u2500\u2500\u2500\u2500\u2500\u2500 */
230
+ .malto-item {
231
+ display: flex; gap: 12px;
232
+ padding: 12px;
233
+ border-radius: 12px;
234
+ background: var(--malto-surface);
235
+ border: 1px solid var(--malto-border);
236
+ transition: all .25s var(--malto-ease-smooth);
237
+ position: relative;
238
+ cursor: pointer;
239
+ }
240
+ .malto-item:hover {
241
+ border-color: var(--malto-border-strong);
242
+ transform: translateY(-1px);
243
+ box-shadow: var(--malto-shadow-sm);
244
+ }
245
+ .malto-vote {
246
+ display: flex; flex-direction: column;
247
+ align-items: center; justify-content: center;
248
+ min-width: 44px; padding: 6px 4px;
249
+ border-radius: 10px;
250
+ border: 1px solid var(--malto-border);
251
+ background: var(--malto-surface-muted);
252
+ cursor: pointer;
253
+ font-size: 11px; color: var(--malto-text-muted);
254
+ transition: all .2s var(--malto-ease-spring);
255
+ user-select: none;
256
+ }
257
+ .malto-vote:hover {
258
+ border-color: var(--malto-primary);
259
+ color: var(--malto-primary);
260
+ transform: translateY(-1px);
261
+ }
262
+ .malto-vote:active { transform: scale(0.92); }
263
+ .malto-vote[aria-pressed="true"] {
264
+ border-color: var(--malto-primary);
265
+ background: var(--malto-primary);
266
+ color: var(--malto-primary-contrast);
267
+ box-shadow: 0 4px 12px -4px rgba(var(--malto-primary-rgb), 0.45);
268
+ }
269
+ .malto-vote-arrow {
270
+ font-size: 11px;
271
+ transition: transform .3s var(--malto-ease-spring);
272
+ }
273
+ .malto-vote:hover .malto-vote-arrow { transform: translateY(-2px); }
274
+ .malto-vote-count {
275
+ font-size: 13px; font-weight: 700;
276
+ letter-spacing: -0.01em;
277
+ margin-top: 1px;
278
+ }
279
+ .malto-item-content { flex: 1; min-width: 0; }
280
+ .malto-item h4 {
281
+ margin: 0 0 3px;
282
+ font-size: 14px; font-weight: 600;
283
+ color: var(--malto-text);
284
+ letter-spacing: -0.01em;
285
+ line-height: 1.3;
286
+ }
287
+ .malto-item p {
288
+ margin: 0;
289
+ font-size: 12.5px;
290
+ color: var(--malto-text-muted);
291
+ line-height: 1.45;
292
+ display: -webkit-box;
293
+ -webkit-line-clamp: 2;
294
+ -webkit-box-orient: vertical;
295
+ overflow: hidden;
296
+ }
297
+ .malto-item-meta {
298
+ display: flex; align-items: center; gap: 8px;
299
+ margin-top: 6px;
300
+ font-size: 11px;
301
+ color: var(--malto-text-subtle);
302
+ }
303
+ .malto-item-meta-dot {
304
+ width: 3px; height: 3px;
305
+ border-radius: 999px;
306
+ background: currentColor;
307
+ opacity: 0.4;
308
+ }
309
+
310
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Status pills \u2500\u2500\u2500\u2500\u2500\u2500 */
311
+ .malto-status {
312
+ display: inline-flex; align-items: center; gap: 5px;
313
+ padding: 2px 8px;
314
+ border-radius: 999px;
315
+ font-size: 10px; font-weight: 600;
316
+ text-transform: uppercase; letter-spacing: 0.04em;
317
+ line-height: 1.4;
318
+ }
319
+ .malto-status-dot {
320
+ width: 5px; height: 5px;
321
+ border-radius: 999px;
322
+ background: currentColor;
323
+ }
324
+ .malto-status-PLANNED { background: rgba(99, 102, 241, 0.1); color: #4f46e5; }
325
+ .malto-status-IN_PROGRESS { background: rgba(245, 158, 11, 0.1); color: #b45309; }
326
+ .malto-status-COMPLETED { background: rgba(34, 197, 94, 0.1); color: #15803d; }
327
+ .malto-status-DECLINED { background: rgba(244, 63, 94, 0.1); color: #be123c; }
328
+ .malto-status-UNDER_REVIEW { background: rgba(168, 85, 247, 0.1); color: #7e22ce; }
329
+ .malto-status-BACKLOG { background: rgba(100, 116, 139, 0.1); color: #475569; }
330
+
331
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Forms \u2500\u2500\u2500\u2500\u2500\u2500 */
332
+ .malto-form {
333
+ display: flex; flex-direction: column;
334
+ gap: 10px;
335
+ }
336
+ .malto-input, .malto-textarea {
337
+ width: 100%;
338
+ padding: 11px 14px;
339
+ border: 1px solid var(--malto-border-strong);
340
+ border-radius: 12px;
341
+ font-size: 13.5px;
342
+ color: var(--malto-text);
343
+ background: var(--malto-surface);
344
+ outline: none;
345
+ transition: all .2s ease;
346
+ font-family: inherit;
347
+ }
348
+ .malto-input::placeholder, .malto-textarea::placeholder {
349
+ color: var(--malto-text-subtle);
350
+ }
351
+ .malto-input:focus, .malto-textarea:focus {
352
+ border-color: var(--malto-primary);
353
+ box-shadow: 0 0 0 4px rgba(var(--malto-primary-rgb), 0.1);
354
+ }
355
+ .malto-textarea {
356
+ min-height: 110px;
357
+ resize: vertical;
358
+ line-height: 1.5;
359
+ }
360
+ .malto-button {
361
+ padding: 11px 18px;
362
+ border-radius: 12px;
363
+ background: var(--malto-primary);
364
+ color: var(--malto-primary-contrast);
365
+ border: none; cursor: pointer;
366
+ font-size: 13px; font-weight: 600;
367
+ letter-spacing: -0.005em;
368
+ box-shadow: var(--malto-shadow-glow);
369
+ transition: transform .2s var(--malto-ease-spring), box-shadow .2s ease, opacity .2s ease;
370
+ display: inline-flex; align-items: center; justify-content: center; gap: 6px;
371
+ }
372
+ .malto-button:hover { transform: translateY(-1px); }
373
+ .malto-button:active { transform: scale(0.97); }
374
+ .malto-button[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
375
+ .malto-secondary {
376
+ padding: 9px 14px;
377
+ border-radius: 10px;
378
+ background: transparent;
379
+ color: var(--malto-text);
380
+ border: 1px solid var(--malto-border-strong);
381
+ cursor: pointer;
382
+ font-size: 13px; font-weight: 500;
383
+ transition: all .2s ease;
384
+ }
385
+ .malto-secondary:hover {
386
+ border-color: var(--malto-primary);
387
+ color: var(--malto-primary);
388
+ background: var(--malto-primary-50);
389
+ }
390
+ .malto-link {
391
+ color: var(--malto-primary);
392
+ background: none; border: none; padding: 0;
393
+ font-size: 13px; font-weight: 600;
394
+ cursor: pointer;
395
+ text-decoration: underline;
396
+ text-underline-offset: 3px;
397
+ text-decoration-color: rgba(var(--malto-primary-rgb), 0.3);
398
+ transition: text-decoration-color .2s ease;
399
+ }
400
+ .malto-link:hover {
401
+ text-decoration-color: var(--malto-primary);
402
+ }
403
+
404
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Empty / loading \u2500\u2500\u2500\u2500\u2500\u2500 */
405
+ .malto-empty {
406
+ padding: 40px 18px;
407
+ text-align: center;
408
+ display: flex; flex-direction: column; align-items: center; gap: 8px;
409
+ }
410
+ .malto-empty-icon {
411
+ width: 44px; height: 44px;
412
+ border-radius: 14px;
413
+ background: var(--malto-primary-50);
414
+ color: var(--malto-primary);
415
+ display: flex; align-items: center; justify-content: center;
416
+ margin-bottom: 4px;
417
+ }
418
+ .malto-empty-title {
419
+ font-size: 14px; font-weight: 600;
420
+ color: var(--malto-text);
421
+ }
422
+ .malto-empty-desc {
423
+ font-size: 12.5px;
424
+ color: var(--malto-text-muted);
425
+ max-width: 240px;
426
+ line-height: 1.5;
427
+ }
428
+ .malto-skeleton {
429
+ background: linear-gradient(90deg,
430
+ var(--malto-primary-50) 0%,
431
+ var(--malto-primary-100) 50%,
432
+ var(--malto-primary-50) 100%);
433
+ background-size: 200% 100%;
434
+ border-radius: 8px;
435
+ animation: malto-shimmer 1.4s linear infinite;
436
+ }
437
+ .malto-skeleton-row {
438
+ padding: 12px;
439
+ border: 1px solid var(--malto-border);
440
+ border-radius: 12px;
441
+ display: flex; gap: 12px;
442
+ margin-bottom: 8px;
443
+ }
444
+ .malto-error {
445
+ padding: 10px 12px;
446
+ margin-bottom: 10px;
447
+ background: rgba(244, 63, 94, 0.08);
448
+ color: #be123c;
449
+ border-radius: 10px;
450
+ font-size: 12.5px;
451
+ border-left: 3px solid #f43f5e;
452
+ }
453
+
454
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Roadmap \u2500\u2500\u2500\u2500\u2500\u2500 */
455
+ .malto-roadmap-col { margin-bottom: 18px; }
456
+ .malto-roadmap-col h5 {
457
+ display: flex; align-items: center; gap: 8px;
458
+ margin: 0 0 8px;
459
+ font-size: 11px;
460
+ text-transform: uppercase;
461
+ letter-spacing: 0.06em;
462
+ color: var(--malto-text-muted);
463
+ font-weight: 600;
464
+ }
465
+ .malto-roadmap-count {
466
+ background: var(--malto-primary-50);
467
+ color: var(--malto-primary);
468
+ border-radius: 999px;
469
+ padding: 1px 7px;
470
+ font-size: 10px; font-weight: 700;
471
+ }
472
+
473
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Releases / changelog \u2500\u2500\u2500\u2500\u2500\u2500 */
474
+ .malto-release {
475
+ padding: 14px;
476
+ border: 1px solid var(--malto-border);
477
+ border-radius: 12px;
478
+ margin-bottom: 8px;
479
+ transition: all .2s ease;
480
+ }
481
+ .malto-release:hover {
482
+ border-color: var(--malto-border-strong);
483
+ box-shadow: var(--malto-shadow-sm);
484
+ }
485
+ .malto-release h4 {
486
+ margin: 0 0 4px;
487
+ font-size: 13.5px; font-weight: 600;
488
+ color: var(--malto-text);
489
+ letter-spacing: -0.01em;
490
+ }
491
+ .malto-release p {
492
+ margin: 0;
493
+ font-size: 12.5px;
494
+ color: var(--malto-text-muted);
495
+ line-height: 1.5;
496
+ white-space: pre-wrap;
497
+ }
498
+ .malto-release-date {
499
+ font-size: 10.5px;
500
+ color: var(--malto-text-subtle);
501
+ text-transform: uppercase;
502
+ letter-spacing: 0.05em;
503
+ margin-bottom: 6px;
504
+ display: block;
505
+ }
506
+
507
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Comments \u2500\u2500\u2500\u2500\u2500\u2500 */
508
+ .malto-comment {
509
+ padding: 10px 0;
510
+ display: flex; gap: 10px;
511
+ border-top: 1px solid var(--malto-border);
512
+ }
513
+ .malto-comment:first-child { border-top: none; }
514
+ .malto-avatar {
515
+ width: 28px; height: 28px;
516
+ border-radius: 999px;
517
+ background: var(--malto-primary-100);
518
+ color: var(--malto-primary);
519
+ flex: none;
520
+ display: flex; align-items: center; justify-content: center;
521
+ font-size: 11px; font-weight: 700;
522
+ overflow: hidden;
523
+ }
524
+ .malto-avatar img { width: 100%; height: 100%; object-fit: cover; }
525
+ .malto-comment-author {
526
+ font-size: 12.5px; font-weight: 600;
527
+ color: var(--malto-text);
528
+ }
529
+ .malto-comment-time {
530
+ font-size: 11px;
531
+ color: var(--malto-text-subtle);
532
+ margin-left: 6px;
533
+ }
534
+ .malto-comment-body {
535
+ font-size: 13px;
536
+ color: var(--malto-text);
537
+ line-height: 1.5;
538
+ margin-top: 2px;
539
+ white-space: pre-wrap;
540
+ }
541
+
542
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Footer banner (sign-in CTA) \u2500\u2500\u2500\u2500\u2500\u2500 */
543
+ .malto-footer-banner {
544
+ flex: none;
545
+ padding: 12px 18px;
546
+ background: var(--malto-surface-muted);
547
+ border-top: 1px solid var(--malto-border);
548
+ font-size: 12px;
549
+ color: var(--malto-text-muted);
550
+ display: flex; align-items: center; justify-content: space-between;
551
+ gap: 10px;
552
+ }
553
+ .malto-footer-banner strong { color: var(--malto-text); font-weight: 600; }
554
+
555
+ .malto-back {
556
+ display: inline-flex; align-items: center; gap: 4px;
557
+ padding: 6px 10px;
558
+ background: transparent;
559
+ border: none; cursor: pointer;
560
+ font-size: 12px; font-weight: 600;
561
+ color: var(--malto-text-muted);
562
+ border-radius: 8px;
563
+ transition: all .15s ease;
564
+ margin-bottom: 10px;
565
+ }
566
+ .malto-back:hover {
567
+ color: var(--malto-text);
568
+ background: var(--malto-primary-50);
569
+ }
570
+
571
+ /* \u2500\u2500\u2500\u2500\u2500\u2500 Animations \u2500\u2500\u2500\u2500\u2500\u2500 */
572
+ @keyframes malto-overlay-in {
573
+ from { opacity: 0; backdrop-filter: blur(0); }
574
+ to { opacity: 1; }
575
+ }
576
+ @keyframes malto-modal-in {
577
+ 0% { opacity: 0; transform: translateY(20px) scale(0.96); }
578
+ 100% { opacity: 1; transform: translateY(0) scale(1); }
579
+ }
580
+ @keyframes malto-fade-in {
581
+ from { opacity: 0; transform: translateY(4px); }
582
+ to { opacity: 1; transform: translateY(0); }
583
+ }
584
+ @keyframes malto-shimmer {
585
+ 0% { background-position: 200% 0; }
586
+ 100% { background-position: -200% 0; }
587
+ }
588
+ @media (prefers-reduced-motion: reduce) {
589
+ .malto-root *,
590
+ .malto-root *::before,
591
+ .malto-root *::after {
592
+ animation-duration: 0.01ms !important;
593
+ transition-duration: 0.01ms !important;
594
+ }
595
+ }
596
+ `}function T(){return `
597
+ .malto-root {
598
+ --malto-surface: #131127;
599
+ --malto-surface-muted: #1a1834;
600
+ --malto-border: rgba(255, 255, 255, 0.08);
601
+ --malto-border-strong: rgba(255, 255, 255, 0.16);
602
+ --malto-text: #e6e3f5;
603
+ --malto-text-muted: #a09cc7;
604
+ --malto-text-subtle: rgba(230, 227, 245, 0.5);
605
+ }
606
+ `}function D(i){let{r:t,g:e,b:a}=U(i);return {rgb:`${t}, ${e}, ${a}`,contrast:j(t,e,a),tint50:N(t,e,a,.06),tint100:N(t,e,a,.12),tint200:N(t,e,a,.18),shade600:V(t,e,a,-0.18)}}function U(i){let t=i.trim().replace(/^#/,"");return t.length===3&&(t=t.split("").map(e=>e+e).join("")),/^[0-9a-fA-F]{6}$/.test(t)?{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}:{r:69,g:47,b:223}}function j(i,t,e){return (.2126*i+.7152*t+.0722*e)/255>.65?"#0f0d23":"#ffffff"}function N(i,t,e,a,r){return `rgba(${i}, ${t}, ${e}, ${a})`}function V(i,t,e,a){let r=n=>Math.max(0,Math.min(255,Math.round(n+255*a))),o=n=>r(n).toString(16).padStart(2,"0");return `#${o(i)}${o(t)}${o(e)}`}var q={"bottom-right":{right:"24px",bottom:"24px"},"bottom-left":{left:"24px",bottom:"24px"},"top-right":{right:"24px",top:"24px"},"top-left":{left:"24px",top:"24px"}},v=class{constructor(t){this.resolvedMode="bubble";this.root=null;this.container=null;this.trigger=null;this.board=null;if(!t.apiKey)throw new Error("Malto: apiKey is required");this.apiKeyPrefix=t.apiKey.slice(0,16),this.config={apiKey:t.apiKey,apiUrl:t.apiUrl??"https://api.malto.io",mode:t.mode??"auto",position:t.position??"bottom-right",triggerLabel:t.triggerLabel??"Feedback",primaryColor:t.primaryColor,cssVars:t.cssVars,customCss:t.customCss,radius:t.radius??"md",appearance:t.appearance??"auto",zIndex:t.zIndex??2147483600,views:t.views,identify:t.identify,target:t.target,onReady:t.onReady,onError:t.onError};let e=E(this.apiKeyPrefix);this.state={open:false,view:"list",loading:false,error:null,feedbacks:[],roadmap:{},releases:[],selectedFeedback:null,comments:[],authEmail:"",authStatus:"idle",email:e?.email??null,name:e?.name??null},this.client=new h({apiKey:this.config.apiKey,apiUrl:this.config.apiUrl,getSessionToken:()=>E(this.apiKeyPrefix)?.token??null});}async mount(){try{let t=await this.client.board();this.board=t;let e=this.config.primaryColor||t.widget.primaryColor||t.board.boardThemeColor||"#452fdf";R({primary:e,cssVars:this.config.cssVars,customCss:this.config.customCss,radius:this.config.radius,appearance:this.config.appearance}),this.resolvedMode=this.config.mode==="auto"?t.widget.defaultMode:this.config.mode,this.config.identify&&await this.runIdentify(this.config.identify),this.renderHost(this.resolvedMode),this.config.onReady?.();}catch(t){this.config.onError?.(t);}}unmount(){this.root?.parentElement?.removeChild(this.root),this.trigger?.parentElement?.removeChild(this.trigger),this.root=null,this.trigger=null,this.container=null;}open(){this.state.open=true,this.render();}close(){this.state.open=false,this.render();}setIdentify(t){if(!t){g(this.apiKeyPrefix),this.state.email=null,this.state.name=null,this.render();return}this.runIdentify(t);}async runIdentify(t){try{let e=await this.client.identify(t);S(this.apiKeyPrefix,{token:e.sessionToken,expiresAt:e.expiresAt,email:e.user.email,name:e.user.name}),this.state.email=e.user.email,this.state.name=e.user.name,this.render();}catch(e){this.config.onError?.(e);}}renderHost(t){let e=document.createElement("div");if(e.className="malto-root",e.style.setProperty("--malto-z",String(this.config.zIndex)),document.body.appendChild(e),this.root=e,t==="inline"){let a=this.resolveTarget();if(!a){this.config.onError?.(new Error("Malto: inline target not found"));return}let r=document.createElement("div");r.className="malto-root malto-inline",r.style.setProperty("--malto-z",String(this.config.zIndex)),a.appendChild(r),this.container=r,this.state.open=true,this.render();return}if(t==="bubble"){let a=this.buildBubble(),r=q[this.config.position];Object.assign(a.style,r);let o=document.createElement("div");o.className="malto-root",o.style.setProperty("--malto-z",String(this.config.zIndex)),o.appendChild(a),document.body.appendChild(o),this.trigger=o;}else if(t==="trigger"){let a=this.resolveTarget();if(!a){this.config.onError?.(new Error("Malto: trigger target not found"));return}let r=document.createElement("span");r.className="malto-root",r.style.setProperty("--malto-z",String(this.config.zIndex));let o=document.createElement("button");o.className="malto-trigger",o.innerHTML=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg><span>${L(this.config.triggerLabel)}</span>`,o.addEventListener("click",()=>this.open()),r.appendChild(o),a.appendChild(r),this.trigger=r;}else t==="modal"&&(this.state.open=true);this.render();}buildBubble(){let t=document.createElement("button");return t.className="malto-bubble",t.setAttribute("aria-label",this.config.triggerLabel),t.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>',t.addEventListener("click",()=>{this.state.open?this.close():this.open();}),t}resolveTarget(){return this.config.target?typeof this.config.target=="string"?document.querySelector(this.config.target):this.config.target:null}render(){if(!this.root)return;if(this.resolvedMode==="inline"){if(!this.container)return;this.container.innerHTML="",this.container.appendChild(this.buildPanelBody());return}if(this.root.innerHTML="",!this.state.open)return;let t=document.createElement("div");t.className="malto-overlay",t.addEventListener("click",a=>{a.target===t&&this.close();});let e=document.createElement("div");e.className="malto-modal",e.appendChild(this.buildPanelBody()),t.appendChild(e),this.root.appendChild(t);}buildPanelBody(){let t=document.createElement("div");t.style.display="flex",t.style.flexDirection="column",t.style.height="100%",t.style.minHeight="0",t.appendChild(this.buildHeader()),t.appendChild(this.buildTabs());let e=document.createElement("div");if(e.className="malto-body",e.appendChild(this.buildView()),t.appendChild(e),this.state.view!=="auth"&&!this.state.email){let a=document.createElement("div");a.className="malto-footer-banner";let r=document.createElement("span");r.innerHTML="Sign in to vote, comment, or submit ideas.";let o=document.createElement("button");o.className="malto-link",o.textContent="Sign in",o.addEventListener("click",()=>this.go("auth")),a.appendChild(r),a.appendChild(o),t.appendChild(a);}return t}buildHeader(){let t=document.createElement("div");t.className="malto-header";let e=document.createElement("div");e.className="malto-header-meta";let a=document.createElement("div");a.className="malto-board-logo";let r=$(this.board?.board.companyLogoUrl);if(r){let n=document.createElement("img");n.src=r,n.alt="",n.referrerPolicy="no-referrer",n.crossOrigin="anonymous",a.appendChild(n);}else a.textContent=(this.board?.board.companyName??this.board?.board.boardName??"M").charAt(0).toUpperCase();let o=document.createElement("h3");if(o.textContent=this.board?.board.boardName??this.board?.board.companyName??"Feedback",e.appendChild(a),e.appendChild(o),t.appendChild(e),this.resolvedMode!=="inline"){let n=document.createElement("button");n.className="malto-close",n.setAttribute("aria-label","Close"),n.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',n.addEventListener("click",()=>this.close()),t.appendChild(n);}return t}buildTabs(){let t=document.createElement("div");t.className="malto-tabs";let e=this.allowedViews();return e.includes("list")&&t.appendChild(this.tabBtn("Feed","list")),e.includes("submit")&&t.appendChild(this.tabBtn("New","submit")),e.includes("roadmap")&&t.appendChild(this.tabBtn("Roadmap","roadmap")),e.includes("changelog")&&t.appendChild(this.tabBtn("Updates","changelog")),t}tabBtn(t,e){let a=document.createElement("button");return a.className="malto-tab",a.setAttribute("aria-selected",this.state.view===e?"true":"false"),a.textContent=t,a.addEventListener("click",()=>this.go(e)),a}go(t){this.state.view=t,this.state.error=null,this.render(),t==="list"&&this.loadFeedbacks(),t==="roadmap"&&this.loadRoadmap(),t==="changelog"&&this.loadReleases(),t==="detail"&&this.state.selectedFeedback&&this.loadComments(this.state.selectedFeedback.id);}allowedViews(){let t=this.board?.widget.enabledFeatures??["list","submit","vote","comment","roadmap","changelog"];return (this.config.views??["list","submit","roadmap","changelog"]).filter(a=>t.includes(a))}buildView(){let t=document.createElement("div");if(this.state.error){let e=document.createElement("div");e.className="malto-error",e.textContent=this.state.error,t.appendChild(e);}switch(this.state.view){case "list":t.appendChild(this.viewList()),this.state.feedbacks.length===0&&!this.state.loading&&this.loadFeedbacks();break;case "submit":t.appendChild(this.viewSubmit());break;case "auth":t.appendChild(this.viewAuth());break;case "roadmap":t.appendChild(this.viewRoadmap()),Object.keys(this.state.roadmap).length===0&&!this.state.loading&&this.loadRoadmap();break;case "changelog":t.appendChild(this.viewChangelog()),this.state.releases.length===0&&!this.state.loading&&this.loadReleases();break;case "detail":t.appendChild(this.viewDetail());break}return t}viewList(){let t=document.createElement("div");if(this.state.loading)return t.appendChild(this.skeletonList(4)),t;if(this.state.feedbacks.length===0)return t.appendChild(this.emptyState("\u{1F4A1}","No requests yet","Be the first to share an idea or report something.")),t;let e=document.createElement("div");e.className="malto-list";for(let a of this.state.feedbacks)e.appendChild(this.feedbackRow(a));return t.appendChild(e),t}feedbackRow(t){let e=document.createElement("div");e.className="malto-item";let a=document.createElement("button");a.className="malto-vote",a.setAttribute("aria-pressed",t.hasVoted?"true":"false");let r=document.createElement("span");r.className="malto-vote-arrow",r.textContent="\u25B2";let o=document.createElement("span");o.className="malto-vote-count",o.textContent=_(t.votes??0),a.appendChild(r),a.appendChild(o),a.addEventListener("click",m=>{m.stopPropagation(),this.handleVote(t);});let n=document.createElement("div");n.className="malto-item-content";let s=document.createElement("h4");if(s.textContent=t.title,n.appendChild(s),t.description){let m=document.createElement("p");m.textContent=t.description,n.appendChild(m);}let d=document.createElement("div");if(d.className="malto-item-meta",t.status&&t.status!=="BACKLOG"){let m=K(t.status);d.appendChild(m);}let l=document.createElement("span");return l.textContent=z(t.createdAt),d.appendChild(l),n.appendChild(d),e.appendChild(a),e.appendChild(n),e.addEventListener("click",()=>{this.state.selectedFeedback=t,this.go("detail");}),e}viewSubmit(){let t=document.createElement("form");t.className="malto-form";let e=document.createElement("input");e.className="malto-input",e.required=true,e.maxLength=200,e.placeholder="What would you like?";let a=document.createElement("textarea");a.className="malto-textarea",a.maxLength=5e3,a.placeholder="Add some context (optional)";let r=document.createElement("button");return r.className="malto-button",r.textContent="Submit feedback",r.type="submit",t.appendChild(e),t.appendChild(a),t.appendChild(r),t.addEventListener("submit",async o=>{if(o.preventDefault(),!this.state.email){this.go("auth");return}r.setAttribute("disabled","true");try{await this.client.createFeedback({title:e.value.trim(),description:a.value.trim()||void 0}),e.value="",a.value="",await this.loadFeedbacks(),this.go("list");}catch(n){this.state.error=n.message,r.removeAttribute("disabled"),this.render();}}),t}viewAuth(){let t=document.createElement("div");if(this.state.email){let n=document.createElement("p");n.style.fontSize="13px",n.style.color="var(--malto-text)",n.style.marginBottom="10px",n.innerHTML=`Signed in as <strong>${L(this.state.email)}</strong>`;let s=document.createElement("button");return s.className="malto-secondary",s.textContent="Sign out",s.addEventListener("click",()=>{g(this.apiKeyPrefix),this.state.email=null,this.state.name=null,this.go("list");}),t.appendChild(n),t.appendChild(s),t}if(this.state.authStatus==="sent"){let n=document.createElement("p");n.style.fontSize="13px",n.style.color="var(--malto-text)",n.style.marginBottom="12px",n.style.lineHeight="1.5",n.innerHTML=`We sent a sign-in link to <strong>${L(this.state.authEmail)}</strong>. Open the email and paste the token below.`;let s=document.createElement("input");s.className="malto-input",s.placeholder="Paste token from email";let d=document.createElement("button");d.className="malto-button",d.style.marginTop="8px",d.textContent="Verify",d.addEventListener("click",async()=>{d.setAttribute("disabled","true");try{let m=await this.client.verifyMagicLink(s.value.trim());S(this.apiKeyPrefix,{token:m.sessionToken,expiresAt:m.expiresAt,email:m.user.email,name:m.user.name}),this.state.email=m.user.email,this.state.name=m.user.name,this.state.authStatus="idle",this.go("list");}catch(m){this.state.error=m.message,d.removeAttribute("disabled"),this.render();}});let l=document.createElement("button");return l.className="malto-link",l.style.marginTop="12px",l.style.display="block",l.textContent="Use a different email",l.addEventListener("click",()=>{this.state.authStatus="idle",this.render();}),t.appendChild(n),t.appendChild(s),t.appendChild(d),t.appendChild(l),t}let e=document.createElement("form");e.className="malto-form";let a=document.createElement("p");a.style.fontSize="13px",a.style.color="var(--malto-text-muted)",a.style.marginBottom="4px",a.style.lineHeight="1.5",a.textContent="Enter your email to receive a one-click sign-in link.";let r=document.createElement("input");r.className="malto-input",r.type="email",r.required=true,r.placeholder="you@company.com",r.value=this.state.authEmail;let o=document.createElement("button");return o.className="malto-button",o.type="submit",o.textContent="Send sign-in link",e.appendChild(a),e.appendChild(r),e.appendChild(o),e.addEventListener("submit",async n=>{n.preventDefault(),o.setAttribute("disabled","true");try{await this.client.startMagicLink({email:r.value.trim()}),this.state.authEmail=r.value.trim(),this.state.authStatus="sent",this.render();}catch(s){this.state.error=s.message,o.removeAttribute("disabled"),this.render();}}),e}viewRoadmap(){let t=document.createElement("div");if(this.state.loading)return t.appendChild(this.skeletonList(3)),t;let e={PLANNED:"Planned",IN_PROGRESS:"In Progress",COMPLETED:"Done"},a=false;for(let r of ["PLANNED","IN_PROGRESS","COMPLETED"]){let o=this.state.roadmap[r]??[],n=document.createElement("div");n.className="malto-roadmap-col";let s=document.createElement("h5");s.textContent=e[r]??r;let d=document.createElement("span");if(d.className="malto-roadmap-count",d.textContent=String(o.length),s.appendChild(d),n.appendChild(s),o.length===0){let l=document.createElement("div");l.className="malto-empty-desc",l.style.padding="8px 0 12px",l.textContent="Nothing here yet.",n.appendChild(l);}else {a=true;for(let l of o)n.appendChild(this.feedbackRow(l));}t.appendChild(n);}return !a&&Object.keys(this.state.roadmap).length===0&&(t.innerHTML="",t.appendChild(this.emptyState("\u{1F5FA}\uFE0F","Empty roadmap","Once admins move items into Planned, In Progress or Done, you'll see them here."))),t}viewChangelog(){let t=document.createElement("div");if(this.state.loading)return t.appendChild(this.skeletonList(2)),t;if(this.state.releases.length===0)return t.appendChild(this.emptyState("\u2728","No updates yet","Check back soon.")),t;for(let e of this.state.releases){let a=document.createElement("div");if(a.className="malto-release",e.publishedAt){let n=document.createElement("span");n.className="malto-release-date",n.textContent=Y(e.publishedAt),a.appendChild(n);}let r=document.createElement("h4");r.textContent=e.title;let o=document.createElement("p");o.textContent=e.body,a.appendChild(r),a.appendChild(o),t.appendChild(a);}return t}viewDetail(){let t=document.createElement("div"),e=this.state.selectedFeedback;if(!e)return t.appendChild(this.emptyState("\u{1F4ED}","Nothing selected","Pick a request from Feed.")),t;let a=document.createElement("button");if(a.className="malto-back",a.innerHTML='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="15 18 9 12 15 6"/></svg> Back',a.addEventListener("click",()=>this.go("list")),t.appendChild(a),t.appendChild(this.feedbackRow(e)),this.allowedViews().includes("comment")){let o=document.createElement("h5");if(o.textContent="Comments",o.style.cssText="margin: 16px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--malto-text-muted); font-weight: 600;",t.appendChild(o),this.state.loading)t.appendChild(this.skeletonList(2));else if(this.state.comments.length===0){let l=document.createElement("div");l.className="malto-empty-desc",l.style.padding="8px 0 12px",l.textContent="No comments yet \u2014 start the conversation.",t.appendChild(l);}else for(let l of this.state.comments){let m=document.createElement("div");m.className="malto-comment";let f=document.createElement("div");f.className="malto-avatar";let M=$(l.author?.avatarUrl);if(M){let u=document.createElement("img");u.src=M,u.alt="",u.referrerPolicy="no-referrer",u.crossOrigin="anonymous",f.appendChild(u);}else f.textContent=(l.author?.name??"?").charAt(0).toUpperCase();let p=document.createElement("div");p.style.flex="1",p.style.minWidth="0";let y=document.createElement("div"),k=document.createElement("span");k.className="malto-comment-author",k.textContent=l.author?.name??"User";let w=document.createElement("span");w.className="malto-comment-time",w.textContent=z(l.createdAt),y.appendChild(k),y.appendChild(w);let C=document.createElement("div");C.className="malto-comment-body",C.textContent=l.body,p.appendChild(y),p.appendChild(C),m.appendChild(f),m.appendChild(p),t.appendChild(m);}let n=document.createElement("form");n.className="malto-form",n.style.marginTop="12px";let s=document.createElement("textarea");s.className="malto-textarea",s.placeholder="Write a comment",s.required=true;let d=document.createElement("button");d.className="malto-button",d.type="submit",d.textContent="Post comment",n.appendChild(s),n.appendChild(d),n.addEventListener("submit",async l=>{if(l.preventDefault(),!this.state.email){this.go("auth");return}d.setAttribute("disabled","true");try{await this.client.addComment(e.id,s.value.trim()),s.value="",await this.loadComments(e.id);}catch(m){this.state.error=m.message;}finally{d.removeAttribute("disabled"),this.render();}}),t.appendChild(n);}return t}skeletonList(t){let e=document.createElement("div");for(let a=0;a<t;a++){let r=document.createElement("div");r.className="malto-skeleton-row";let o=document.createElement("div");o.className="malto-skeleton",o.style.width="44px",o.style.height="48px",o.style.flex="none";let n=document.createElement("div");n.style.flex="1";let s=document.createElement("div");s.className="malto-skeleton",s.style.height="12px",s.style.width="70%",s.style.marginBottom="6px";let d=document.createElement("div");d.className="malto-skeleton",d.style.height="10px",d.style.width="90%",n.appendChild(s),n.appendChild(d),r.appendChild(o),r.appendChild(n),e.appendChild(r);}return e}emptyState(t,e,a){let r=document.createElement("div");r.className="malto-empty";let o=document.createElement("div");o.className="malto-empty-icon",o.style.fontSize="20px",o.textContent=t;let n=document.createElement("div");n.className="malto-empty-title",n.textContent=e;let s=document.createElement("div");return s.className="malto-empty-desc",s.textContent=a,r.appendChild(o),r.appendChild(n),r.appendChild(s),r}async loadFeedbacks(){this.state.loading=true,this.render();try{this.state.feedbacks=await this.client.listFeedbacks();}catch(t){this.state.error=t.message;}finally{this.state.loading=false,this.render();}}async loadRoadmap(){this.state.loading=true,this.render();try{this.state.roadmap=await this.client.roadmap();}catch(t){this.state.error=t.message;}finally{this.state.loading=false,this.render();}}async loadReleases(){this.state.loading=true,this.render();try{this.state.releases=await this.client.releases();}catch(t){this.state.error=t.message;}finally{this.state.loading=false,this.render();}}async loadComments(t){this.state.loading=true,this.render();try{this.state.comments=await this.client.comments(t);}catch(e){this.state.error=e.message;}finally{this.state.loading=false,this.render();}}async handleVote(t){if(!this.state.email){this.go("auth");return}try{let e=await this.client.vote(t.id);t.hasVoted=e.voted,t.votes=e.votes,this.render();}catch(e){this.state.error=e.message,this.render();}}};function K(i){let t=document.createElement("span");t.className=`malto-status malto-status-${i}`;let e=document.createElement("span");e.className="malto-status-dot",t.appendChild(e);let a=document.createElement("span"),r={PLANNED:"Planned",IN_PROGRESS:"In progress",COMPLETED:"Done",DECLINED:"Declined",UNDER_REVIEW:"Under review",BACKLOG:"Backlog"};return a.textContent=r[i]??i,t.appendChild(a),t}function _(i){return i<1e3?String(i):i<1e4?(i/1e3).toFixed(1).replace(/\.0$/,"")+"k":Math.floor(i/1e3)+"k"}function z(i){let t=Date.now()-new Date(i).getTime(),e=Math.floor(t/1e3);if(e<60)return "just now";let a=Math.floor(e/60);if(a<60)return `${a}m`;let r=Math.floor(a/60);if(r<24)return `${r}h`;let o=Math.floor(r/24);if(o<30)return `${o}d`;let n=Math.floor(o/30);return n<12?`${n}mo`:`${Math.floor(n/12)}y`}function Y(i){try{return new Date(i).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}catch{return i}}function L(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $(i){if(!i||typeof i!="string")return null;let t;try{t=new URL(i,typeof location<"u"?location.href:"https://x");}catch{return null}return t.protocol!=="https:"&&t.protocol!=="http:"?null:t.toString()}var c=null;function rt(i){c&&c.unmount();let t=new v(i);return c=t,t.mount(),t}function nt(){c?.open();}function it(){c?.close();}function st(i){c?.setIdentify(i);}function lt(i){g(i.slice(0,16)),c?.setIdentify(null);}function dt(){c?.unmount(),c=null;}
607
+ exports.MaltoApiError=b;exports.MaltoClient=h;exports.MaltoWidget=v;exports.close=it;exports.destroy=dt;exports.identify=st;exports.init=rt;exports.open=nt;exports.reset=lt;return exports;})({});