git-viewer 3.0.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,2212 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+
5
+ // node_modules/.pnpm/@remix-run+interaction@0.4.0/node_modules/@remix-run/interaction/dist/lib/interaction.js
6
+ function createContainer(target, options) {
7
+ let disposed = false;
8
+ let { signal, onError = defaultOnError } = options ?? {};
9
+ let bindings = {};
10
+ function disposeAll() {
11
+ if (disposed)
12
+ return;
13
+ disposed = true;
14
+ for (let type in bindings) {
15
+ let existing = bindings[type];
16
+ if (existing) {
17
+ for (let binding of existing) {
18
+ binding.dispose();
19
+ }
20
+ }
21
+ }
22
+ }
23
+ if (signal) {
24
+ signal.addEventListener("abort", disposeAll, { once: true });
25
+ }
26
+ return {
27
+ dispose: disposeAll,
28
+ set: (listeners) => {
29
+ if (disposed) {
30
+ throw new Error("Container has been disposed");
31
+ }
32
+ let listenerKeys = new Set(Object.keys(listeners));
33
+ for (let type in bindings) {
34
+ let eventType = type;
35
+ if (!listenerKeys.has(eventType)) {
36
+ let existing = bindings[eventType];
37
+ if (existing) {
38
+ for (let binding of existing) {
39
+ binding.dispose();
40
+ }
41
+ delete bindings[eventType];
42
+ }
43
+ }
44
+ }
45
+ for (let type of listenerKeys) {
46
+ let updateTypeBindings = function(type2, raw2) {
47
+ let descriptors = normalizeDescriptors(raw2);
48
+ let existing = bindings[type2];
49
+ if (!existing) {
50
+ bindings[type2] = descriptors.map((d) => {
51
+ let { listener, ...options2 } = d;
52
+ return createBinding(target, type2, listener, options2, onError);
53
+ });
54
+ return;
55
+ }
56
+ let min = Math.min(existing.length, descriptors.length);
57
+ for (let i = 0; i < min; i++) {
58
+ let d = descriptors[i];
59
+ let b = existing[i];
60
+ let { listener, ...options2 } = d;
61
+ if (optionsChanged(options2, b.options)) {
62
+ b.rebind(listener, options2);
63
+ } else {
64
+ b.setListener(listener);
65
+ }
66
+ }
67
+ if (descriptors.length > existing.length) {
68
+ for (let i = existing.length; i < descriptors.length; i++) {
69
+ let d = descriptors[i];
70
+ let { listener, ...options2 } = d;
71
+ existing.push(createBinding(target, type2, listener, options2, onError));
72
+ }
73
+ }
74
+ if (existing.length > descriptors.length) {
75
+ for (let i = descriptors.length; i < existing.length; i++) {
76
+ existing[i].dispose();
77
+ }
78
+ existing.length = descriptors.length;
79
+ }
80
+ };
81
+ let raw = listeners[type];
82
+ if (raw == null)
83
+ continue;
84
+ updateTypeBindings(type, raw);
85
+ }
86
+ }
87
+ };
88
+ }
89
+ var interactions = /* @__PURE__ */ new Map();
90
+ var initializedTargets = /* @__PURE__ */ new WeakMap();
91
+ function defaultOnError(error) {
92
+ throw error;
93
+ }
94
+ var InteractionHandle = class {
95
+ constructor(target, signal, onError) {
96
+ __publicField(this, "target");
97
+ __publicField(this, "signal");
98
+ __publicField(this, "raise");
99
+ this.target = target;
100
+ this.signal = signal;
101
+ this.raise = onError;
102
+ }
103
+ on(target, listeners) {
104
+ let container = createContainer(target, {
105
+ signal: this.signal,
106
+ onError: this.raise
107
+ });
108
+ container.set(listeners);
109
+ }
110
+ };
111
+ function normalizeDescriptors(raw) {
112
+ if (Array.isArray(raw)) {
113
+ return raw.map((item) => isDescriptor(item) ? item : { listener: item });
114
+ }
115
+ return [isDescriptor(raw) ? raw : { listener: raw }];
116
+ }
117
+ function isDescriptor(value) {
118
+ return typeof value === "object" && value !== null && "listener" in value;
119
+ }
120
+ function createBinding(target, type, listener, options, onError) {
121
+ let reentry = null;
122
+ let interactionController = null;
123
+ let disposed = false;
124
+ let needsSignal = listener.length >= 2;
125
+ function abort() {
126
+ if (reentry) {
127
+ reentry.abort(new DOMException("", "EventReentry"));
128
+ reentry = new AbortController();
129
+ }
130
+ }
131
+ let wrappedListener = (event) => {
132
+ if (needsSignal) {
133
+ abort();
134
+ if (!reentry)
135
+ reentry = new AbortController();
136
+ }
137
+ try {
138
+ let result = listener(event, reentry?.signal);
139
+ if (result instanceof Promise) {
140
+ result.catch(onError);
141
+ }
142
+ } catch (error) {
143
+ onError(error);
144
+ }
145
+ };
146
+ function bind() {
147
+ target.addEventListener(type, wrappedListener, options);
148
+ }
149
+ function unbind() {
150
+ abort();
151
+ target.removeEventListener(type, wrappedListener, options);
152
+ }
153
+ function decrementInteractionRef() {
154
+ let interaction = interactions.get(type);
155
+ if (interaction) {
156
+ let refCounts = initializedTargets.get(target);
157
+ if (refCounts) {
158
+ let count = refCounts.get(interaction) ?? 0;
159
+ if (count > 0) {
160
+ count--;
161
+ if (count === 0) {
162
+ refCounts.delete(interaction);
163
+ } else {
164
+ refCounts.set(interaction, count);
165
+ }
166
+ }
167
+ }
168
+ }
169
+ }
170
+ function cleanup() {
171
+ if (disposed)
172
+ return;
173
+ disposed = true;
174
+ unbind();
175
+ if (interactionController)
176
+ interactionController.abort();
177
+ decrementInteractionRef();
178
+ }
179
+ if (interactions.has(type)) {
180
+ let interaction = interactions.get(type);
181
+ let refCounts = initializedTargets.get(target);
182
+ if (!refCounts) {
183
+ refCounts = /* @__PURE__ */ new Map();
184
+ initializedTargets.set(target, refCounts);
185
+ }
186
+ let count = refCounts.get(interaction) ?? 0;
187
+ if (count === 0) {
188
+ interactionController = new AbortController();
189
+ let interactionContext = new InteractionHandle(target, interactionController.signal, onError);
190
+ interaction(interactionContext);
191
+ }
192
+ refCounts.set(interaction, count + 1);
193
+ }
194
+ bind();
195
+ return {
196
+ type,
197
+ get options() {
198
+ return options;
199
+ },
200
+ setListener(newListener) {
201
+ listener = newListener;
202
+ needsSignal = newListener.length >= 2;
203
+ },
204
+ rebind(newListener, newOptions) {
205
+ unbind();
206
+ options = newOptions;
207
+ listener = newListener;
208
+ needsSignal = newListener.length >= 2;
209
+ bind();
210
+ },
211
+ dispose: cleanup
212
+ };
213
+ }
214
+ function optionsChanged(a, b) {
215
+ return a.capture !== b.capture || a.once !== b.once || a.passive !== b.passive || a.signal !== b.signal;
216
+ }
217
+
218
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/component.js
219
+ function createComponent(config) {
220
+ let taskQueue = [];
221
+ let renderCtrl = null;
222
+ let connectedCtrl = null;
223
+ let contextValue = void 0;
224
+ function getConnectedSignal() {
225
+ if (!connectedCtrl)
226
+ connectedCtrl = new AbortController();
227
+ return connectedCtrl.signal;
228
+ }
229
+ let getContent = null;
230
+ let scheduleUpdate = () => {
231
+ throw new Error("scheduleUpdate not implemented");
232
+ };
233
+ let context = {
234
+ set: (value) => {
235
+ contextValue = value;
236
+ },
237
+ get: (type) => {
238
+ return config.getContext(type);
239
+ }
240
+ };
241
+ let handle = {
242
+ id: config.id,
243
+ update: (task) => {
244
+ if (task)
245
+ taskQueue.push(task);
246
+ scheduleUpdate();
247
+ },
248
+ queueTask: (task) => {
249
+ taskQueue.push(task);
250
+ },
251
+ raise: config.raise,
252
+ frame: config.frame,
253
+ context,
254
+ get signal() {
255
+ return getConnectedSignal();
256
+ },
257
+ on: (target, listeners) => {
258
+ let container = createContainer(target, { signal: getConnectedSignal() });
259
+ container.set(listeners);
260
+ }
261
+ };
262
+ function dequeueTasks() {
263
+ let needsSignal = taskQueue.some((task) => task.length >= 1);
264
+ if (needsSignal && !renderCtrl) {
265
+ renderCtrl = new AbortController();
266
+ }
267
+ let signal = renderCtrl?.signal;
268
+ return taskQueue.splice(0, taskQueue.length).map((task) => () => task(signal));
269
+ }
270
+ function render(props) {
271
+ if (connectedCtrl?.signal.aborted) {
272
+ console.warn("render called after component was removed, potential application memory leak");
273
+ return [null, []];
274
+ }
275
+ if (renderCtrl) {
276
+ renderCtrl.abort();
277
+ renderCtrl = null;
278
+ }
279
+ if (!getContent) {
280
+ let { setup, ...propsWithoutSetup } = props;
281
+ let result = config.type(handle, setup);
282
+ if (typeof result !== "function") {
283
+ let name = config.type.name || "Anonymous";
284
+ throw new Error(`${name} must return a render function, received ${typeof result}`);
285
+ } else {
286
+ getContent = (props2) => {
287
+ let { setup: _, ...rest } = props2;
288
+ return result(rest);
289
+ };
290
+ }
291
+ }
292
+ let node = getContent(props);
293
+ return [node, dequeueTasks()];
294
+ }
295
+ function remove2() {
296
+ if (connectedCtrl)
297
+ connectedCtrl.abort();
298
+ return dequeueTasks();
299
+ }
300
+ function setScheduleUpdate(_scheduleUpdate) {
301
+ scheduleUpdate = _scheduleUpdate;
302
+ }
303
+ function getContextValue() {
304
+ return contextValue;
305
+ }
306
+ return { render, remove: remove2, setScheduleUpdate, frame: config.frame, getContextValue };
307
+ }
308
+ function Frame(handle) {
309
+ return (_) => null;
310
+ }
311
+ function Fragment() {
312
+ return (_) => null;
313
+ }
314
+ function Catch() {
315
+ return (_) => null;
316
+ }
317
+ function createFrameHandle(def) {
318
+ return Object.assign(new EventTarget(), {
319
+ src: "/",
320
+ replace: notImplemented("replace not implemented"),
321
+ reload: notImplemented("reload not implemented")
322
+ }, def);
323
+ }
324
+ function notImplemented(msg) {
325
+ return () => {
326
+ throw new Error(msg);
327
+ };
328
+ }
329
+
330
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/invariant.js
331
+ function invariant(assertion, message) {
332
+ let prefix = "Framework invariant";
333
+ if (assertion)
334
+ return;
335
+ throw new Error(message ? `${prefix}: ${message}` : prefix);
336
+ }
337
+
338
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/document-state.js
339
+ function createDocumentState(_doc) {
340
+ let doc = _doc ?? document;
341
+ function getActiveElement() {
342
+ return doc.activeElement || doc.body;
343
+ }
344
+ function hasSelectionCapabilities(elem) {
345
+ let nodeName = elem.nodeName.toLowerCase();
346
+ return nodeName === "input" && "type" in elem && (elem.type === "text" || elem.type === "search" || elem.type === "tel" || elem.type === "url" || elem.type === "password") || nodeName === "textarea" || elem instanceof HTMLElement && elem.contentEditable === "true";
347
+ }
348
+ function getSelection(input) {
349
+ if ("selectionStart" in input && typeof input.selectionStart === "number" && "selectionEnd" in input) {
350
+ let htmlInput = input;
351
+ return {
352
+ start: htmlInput.selectionStart ?? 0,
353
+ end: htmlInput.selectionEnd ?? htmlInput.selectionStart ?? 0
354
+ };
355
+ }
356
+ return null;
357
+ }
358
+ function setSelection(input, offsets) {
359
+ if ("selectionStart" in input && "selectionEnd" in input) {
360
+ try {
361
+ let htmlInput = input;
362
+ htmlInput.selectionStart = offsets.start;
363
+ htmlInput.selectionEnd = Math.min(offsets.end, htmlInput.value?.length ?? 0);
364
+ } catch {
365
+ }
366
+ }
367
+ }
368
+ function isInDocument(node) {
369
+ return doc.documentElement.contains(node);
370
+ }
371
+ function getSelectionInformation() {
372
+ let focusedElem = getActiveElement();
373
+ return {
374
+ focusedElem,
375
+ selectionRange: focusedElem && hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
376
+ };
377
+ }
378
+ function restoreSelection(priorSelectionInformation) {
379
+ let curFocusedElem = getActiveElement();
380
+ let priorFocusedElem = priorSelectionInformation.focusedElem;
381
+ let priorSelectionRange = priorSelectionInformation.selectionRange;
382
+ if (curFocusedElem !== priorFocusedElem && priorFocusedElem && isInDocument(priorFocusedElem)) {
383
+ let ancestors = [];
384
+ let ancestor = priorFocusedElem;
385
+ while (ancestor) {
386
+ if (ancestor.nodeType === Node.ELEMENT_NODE) {
387
+ let el = ancestor;
388
+ ancestors.push({
389
+ element: el,
390
+ left: el.scrollLeft ?? 0,
391
+ top: el.scrollTop ?? 0
392
+ });
393
+ }
394
+ ancestor = ancestor.parentNode;
395
+ }
396
+ if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
397
+ setSelection(priorFocusedElem, priorSelectionRange);
398
+ }
399
+ if (priorFocusedElem instanceof HTMLElement && typeof priorFocusedElem.focus === "function") {
400
+ priorFocusedElem.focus();
401
+ }
402
+ for (let info of ancestors) {
403
+ info.element.scrollLeft = info.left;
404
+ info.element.scrollTop = info.top;
405
+ }
406
+ }
407
+ }
408
+ let selectionInfo = null;
409
+ function capture() {
410
+ selectionInfo = getSelectionInformation();
411
+ }
412
+ function restore() {
413
+ if (selectionInfo !== null) {
414
+ restoreSelection(selectionInfo);
415
+ }
416
+ selectionInfo = null;
417
+ }
418
+ return { capture, restore };
419
+ }
420
+
421
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/style/lib/style.js
422
+ function camelToKebab(str) {
423
+ return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
424
+ }
425
+ var NUMERIC_CSS_PROPS = /* @__PURE__ */ new Set([
426
+ "z-index",
427
+ "opacity",
428
+ "flex-grow",
429
+ "flex-shrink",
430
+ "flex-order",
431
+ "grid-area",
432
+ "grid-row",
433
+ "grid-column",
434
+ "font-weight",
435
+ "line-height",
436
+ "order",
437
+ "orphans",
438
+ "widows",
439
+ "zoom",
440
+ "columns",
441
+ "column-count"
442
+ ]);
443
+ function normalizeCssValue(key, value) {
444
+ if (value == null)
445
+ return String(value);
446
+ if (typeof value === "number" && value !== 0) {
447
+ let cssKey = camelToKebab(key);
448
+ if (!NUMERIC_CSS_PROPS.has(cssKey) && !cssKey.startsWith("--")) {
449
+ return `${value}px`;
450
+ }
451
+ }
452
+ return String(value);
453
+ }
454
+ function isComplexSelector(key) {
455
+ return key.startsWith("&") || key.startsWith("@") || key.startsWith(":") || key.startsWith("[") || key.startsWith(".");
456
+ }
457
+ function isKeyframesAtRule(key) {
458
+ if (!key.startsWith("@"))
459
+ return false;
460
+ let lower = key.toLowerCase();
461
+ return lower.startsWith("@keyframes") || lower.startsWith("@-webkit-keyframes") || lower.startsWith("@-moz-keyframes") || lower.startsWith("@-o-keyframes");
462
+ }
463
+ function hashStyle(obj) {
464
+ let sortedEntries = Object.entries(obj).sort(([a], [b]) => a.localeCompare(b));
465
+ let str = JSON.stringify(sortedEntries);
466
+ let hash = 0;
467
+ for (let i = 0; i < str.length; i++) {
468
+ let char = str.charCodeAt(i);
469
+ hash = (hash << 5) - hash + char;
470
+ hash = hash & hash;
471
+ }
472
+ return Math.abs(hash).toString(36);
473
+ }
474
+ function styleToCss(styles, selector = "") {
475
+ let baseDeclarations = [];
476
+ let nestedBlocks = [];
477
+ let atRules = [];
478
+ let preludeAtRules = [];
479
+ for (let [key, value] of Object.entries(styles)) {
480
+ if (isComplexSelector(key)) {
481
+ if (key.startsWith("@")) {
482
+ if (key.startsWith("@function")) {
483
+ let body = atRuleBodyToCss(value);
484
+ if (body.trim().length > 0) {
485
+ preludeAtRules.push(`${key} {
486
+ ${indent(body, 2)}
487
+ }`);
488
+ } else {
489
+ preludeAtRules.push(`${key} {
490
+ }`);
491
+ }
492
+ } else if (isKeyframesAtRule(key)) {
493
+ let body = keyframesBodyToCss(value);
494
+ if (body.trim().length > 0) {
495
+ preludeAtRules.push(`${key} {
496
+ ${indent(body, 2)}
497
+ }`);
498
+ } else {
499
+ preludeAtRules.push(`${key} {
500
+ }`);
501
+ }
502
+ } else {
503
+ let inner = styleToCss(value, selector);
504
+ if (inner.trim().length > 0) {
505
+ atRules.push(`${key} {
506
+ ${indent(inner, 2)}
507
+ }`);
508
+ } else {
509
+ atRules.push(`${key} {
510
+ ${selector} {
511
+ }
512
+ }`);
513
+ }
514
+ }
515
+ continue;
516
+ }
517
+ let nestedContent = "";
518
+ for (let [prop, propValue] of Object.entries(value)) {
519
+ if (propValue != null) {
520
+ let normalizedValue = normalizeCssValue(prop, propValue);
521
+ nestedContent += ` ${camelToKebab(prop)}: ${normalizedValue};
522
+ `;
523
+ }
524
+ }
525
+ if (nestedContent) {
526
+ nestedBlocks.push(` ${key} {
527
+ ${nestedContent} }`);
528
+ }
529
+ } else {
530
+ if (value != null) {
531
+ let normalizedValue = normalizeCssValue(key, value);
532
+ baseDeclarations.push(` ${camelToKebab(key)}: ${normalizedValue};`);
533
+ }
534
+ }
535
+ }
536
+ let css = "";
537
+ if (preludeAtRules.length > 0) {
538
+ css += preludeAtRules.join("\n");
539
+ }
540
+ if (selector && (baseDeclarations.length > 0 || nestedBlocks.length > 0)) {
541
+ css += (css ? "\n" : "") + `${selector} {
542
+ `;
543
+ if (baseDeclarations.length > 0) {
544
+ css += baseDeclarations.join("\n") + "\n";
545
+ }
546
+ if (nestedBlocks.length > 0) {
547
+ css += nestedBlocks.join("\n") + "\n";
548
+ }
549
+ css += "}";
550
+ }
551
+ if (atRules.length > 0) {
552
+ css += (css ? "\n" : "") + atRules.join("\n");
553
+ }
554
+ return css;
555
+ }
556
+ function indent(text, spaces) {
557
+ let pad = " ".repeat(spaces);
558
+ return text.split("\n").map((line) => line.length ? pad + line : line).join("\n");
559
+ }
560
+ function isRecord(value) {
561
+ return typeof value === "object" && value !== null;
562
+ }
563
+ function keyframesBodyToCss(frames) {
564
+ if (!isRecord(frames))
565
+ return "";
566
+ let blocks = [];
567
+ for (let [frameSelector, frameValue] of Object.entries(frames)) {
568
+ if (!isRecord(frameValue)) {
569
+ continue;
570
+ }
571
+ let declarations = [];
572
+ for (let [prop, propValue] of Object.entries(frameValue)) {
573
+ if (propValue == null)
574
+ continue;
575
+ if (isComplexSelector(prop))
576
+ continue;
577
+ let normalizedValue = normalizeCssValue(prop, propValue);
578
+ declarations.push(` ${camelToKebab(prop)}: ${normalizedValue};`);
579
+ }
580
+ if (declarations.length > 0) {
581
+ blocks.push(`${frameSelector} {
582
+ ${declarations.join("\n")}
583
+ }`);
584
+ } else {
585
+ blocks.push(`${frameSelector} {
586
+ }`);
587
+ }
588
+ }
589
+ return blocks.join("\n");
590
+ }
591
+ function atRuleBodyToCss(styles) {
592
+ let declarations = [];
593
+ let nested = [];
594
+ for (let [key, value] of Object.entries(styles)) {
595
+ if (isComplexSelector(key)) {
596
+ if (key.startsWith("@")) {
597
+ let inner = atRuleBodyToCss(value);
598
+ if (inner.trim().length > 0) {
599
+ nested.push(`${key} {
600
+ ${indent(inner, 2)}
601
+ }`);
602
+ } else {
603
+ nested.push(`${key} {
604
+ }`);
605
+ }
606
+ } else {
607
+ continue;
608
+ }
609
+ } else {
610
+ if (value != null) {
611
+ let normalizedValue = normalizeCssValue(key, value);
612
+ declarations.push(` ${camelToKebab(key)}: ${normalizedValue};`);
613
+ }
614
+ }
615
+ }
616
+ let body = "";
617
+ if (declarations.length > 0) {
618
+ body += declarations.join("\n");
619
+ }
620
+ if (nested.length > 0) {
621
+ body += (body ? "\n" : "") + nested.join("\n");
622
+ }
623
+ return body;
624
+ }
625
+ function processStyle(styleObj, styleCache2) {
626
+ if (Object.keys(styleObj).length === 0) {
627
+ return { className: "", css: "" };
628
+ }
629
+ let hash = hashStyle(styleObj);
630
+ let className = `rmx-${hash}`;
631
+ let cached = styleCache2.get(hash);
632
+ if (cached) {
633
+ return cached;
634
+ }
635
+ let css = styleToCss(styleObj, `.${className}`);
636
+ let result = { className, css };
637
+ styleCache2.set(hash, result);
638
+ return result;
639
+ }
640
+
641
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/style/lib/stylesheet.js
642
+ function createStyleManager(layer = "rmx") {
643
+ let stylesheet = new CSSStyleSheet();
644
+ document.adoptedStyleSheets.push(stylesheet);
645
+ let ruleMap = /* @__PURE__ */ new Map();
646
+ function has(className) {
647
+ let entry = ruleMap.get(className);
648
+ return entry !== void 0 && entry.count > 0;
649
+ }
650
+ function insert2(className, rule) {
651
+ let entry = ruleMap.get(className);
652
+ if (entry) {
653
+ entry.count++;
654
+ return;
655
+ }
656
+ let index = stylesheet.cssRules.length;
657
+ try {
658
+ stylesheet.insertRule(`@layer ${layer} { ${rule} }`, index);
659
+ ruleMap.set(className, { count: 1, index });
660
+ } catch (error) {
661
+ throw error;
662
+ }
663
+ }
664
+ function remove2(className) {
665
+ let entry = ruleMap.get(className);
666
+ if (!entry)
667
+ return;
668
+ entry.count--;
669
+ if (entry.count > 0) {
670
+ return;
671
+ }
672
+ let indexToDelete = entry.index;
673
+ stylesheet.deleteRule(indexToDelete);
674
+ ruleMap.delete(className);
675
+ for (let [name, data] of ruleMap.entries()) {
676
+ if (data.index > indexToDelete) {
677
+ data.index--;
678
+ }
679
+ }
680
+ }
681
+ function dispose() {
682
+ document.adoptedStyleSheets = Array.from(document.adoptedStyleSheets).filter((s) => s !== stylesheet);
683
+ ruleMap.clear();
684
+ }
685
+ return { insert: insert2, remove: remove2, has, dispose };
686
+ }
687
+
688
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/vdom.js
689
+ var fixmeIdCounter = 0;
690
+ var TEXT_NODE = Symbol("TEXT_NODE");
691
+ var SVG_NS = "http://www.w3.org/2000/svg";
692
+ var XLINK_NS = "http://www.w3.org/1999/xlink";
693
+ var XML_NS = "http://www.w3.org/XML/1998/namespace";
694
+ var INSERT_VNODE = 1 << 0;
695
+ var MATCHED = 1 << 1;
696
+ var styleCache = /* @__PURE__ */ new Map();
697
+ var styleManager = typeof window !== "undefined" ? createStyleManager() : null;
698
+ function createScheduler(doc) {
699
+ let documentState = createDocumentState(doc);
700
+ let scheduled = /* @__PURE__ */ new Map();
701
+ let tasks = [];
702
+ let flushScheduled = false;
703
+ let scheduler;
704
+ function flush() {
705
+ flushScheduled = false;
706
+ let batch = new Map(scheduled);
707
+ scheduled.clear();
708
+ let hasWork = batch.size > 0 || tasks.length > 0;
709
+ if (!hasWork)
710
+ return;
711
+ documentState.capture();
712
+ if (batch.size > 0) {
713
+ let vnodes = Array.from(batch);
714
+ let noScheduledAncestor = /* @__PURE__ */ new Set();
715
+ for (let [vnode, [domParent, anchor]] of vnodes) {
716
+ if (ancestorIsScheduled(vnode, batch, noScheduledAncestor))
717
+ continue;
718
+ let handle = vnode._handle;
719
+ let curr = vnode._content;
720
+ let vParent = vnode._parent;
721
+ renderComponent(handle, curr, vnode, domParent, handle.frame, scheduler, vParent, anchor);
722
+ }
723
+ }
724
+ documentState.restore();
725
+ if (tasks.length > 0) {
726
+ for (let task of tasks) {
727
+ task();
728
+ }
729
+ tasks = [];
730
+ }
731
+ }
732
+ function scheduleFlush() {
733
+ if (flushScheduled)
734
+ return;
735
+ flushScheduled = true;
736
+ queueMicrotask(flush);
737
+ }
738
+ function ancestorIsScheduled(vnode, batch, safe) {
739
+ let path = [];
740
+ let current = vnode._parent;
741
+ while (current) {
742
+ if (safe.has(current)) {
743
+ for (let node of path)
744
+ safe.add(node);
745
+ return false;
746
+ }
747
+ path.push(current);
748
+ if (isCommittedComponentNode(current) && batch.has(current)) {
749
+ return true;
750
+ }
751
+ current = current._parent;
752
+ }
753
+ for (let node of path)
754
+ safe.add(node);
755
+ return false;
756
+ }
757
+ scheduler = {
758
+ enqueue(vnode, domParent, anchor) {
759
+ scheduled.set(vnode, [domParent, anchor]);
760
+ scheduleFlush();
761
+ },
762
+ enqueueTasks(newTasks) {
763
+ tasks.push(...newTasks);
764
+ scheduleFlush();
765
+ },
766
+ dequeue() {
767
+ flush();
768
+ }
769
+ };
770
+ return scheduler;
771
+ }
772
+ var ROOT_VNODE = Symbol("ROOT_VNODE");
773
+ function createRoot(container, options = {}) {
774
+ let root = null;
775
+ let frameStub = options.frame ?? createFrameHandle();
776
+ let scheduler = options.scheduler ?? createScheduler(container.ownerDocument ?? document);
777
+ let hydrationCursor = container.innerHTML.trim() !== "" ? container.firstChild : void 0;
778
+ return {
779
+ render(element) {
780
+ let vnode = toVNode(element);
781
+ let vParent = { type: ROOT_VNODE, _svg: false };
782
+ scheduler.enqueueTasks([
783
+ () => {
784
+ diffVNodes(root, vnode, container, frameStub, scheduler, vParent, void 0, hydrationCursor);
785
+ root = vnode;
786
+ hydrationCursor = void 0;
787
+ }
788
+ ]);
789
+ scheduler.dequeue();
790
+ },
791
+ remove() {
792
+ root = null;
793
+ },
794
+ flush() {
795
+ scheduler.dequeue();
796
+ }
797
+ };
798
+ }
799
+ function flatMapChildrenToVNodes(node) {
800
+ return "children" in node.props ? Array.isArray(node.props.children) ? node.props.children.flat(Infinity).map(toVNode) : [toVNode(node.props.children)] : [];
801
+ }
802
+ function flattenRemixNodeArray(nodes, out = []) {
803
+ for (let child of nodes) {
804
+ if (Array.isArray(child)) {
805
+ flattenRemixNodeArray(child, out);
806
+ } else {
807
+ out.push(child);
808
+ }
809
+ }
810
+ return out;
811
+ }
812
+ function toVNode(node) {
813
+ if (node === null || node === void 0 || typeof node === "boolean") {
814
+ return { type: TEXT_NODE, _text: "" };
815
+ }
816
+ if (typeof node === "string" || typeof node === "number" || typeof node === "bigint") {
817
+ return { type: TEXT_NODE, _text: String(node) };
818
+ }
819
+ if (Array.isArray(node)) {
820
+ let flatChildren = flattenRemixNodeArray(node);
821
+ return { type: Fragment, _children: flatChildren.map(toVNode) };
822
+ }
823
+ if (node.type === Fragment) {
824
+ return { type: Fragment, key: node.key, _children: flatMapChildrenToVNodes(node) };
825
+ }
826
+ if (node.type === Catch) {
827
+ return {
828
+ type: Catch,
829
+ key: node.key,
830
+ _fallback: node.props.fallback,
831
+ _children: flatMapChildrenToVNodes(node)
832
+ };
833
+ }
834
+ if (isRemixElement(node)) {
835
+ let children = flatMapChildrenToVNodes(node);
836
+ return { type: node.type, key: node.key, props: node.props, _children: children };
837
+ }
838
+ invariant(false, "Unexpected RemixNode");
839
+ }
840
+ function diffVNodes(curr, next, domParent, frame, scheduler, vParent, anchor, rootCursor) {
841
+ next._parent = vParent;
842
+ next._svg = getSvgContext(vParent, next.type);
843
+ if (curr === null) {
844
+ insert(next, domParent, frame, scheduler, vParent, anchor, rootCursor);
845
+ return;
846
+ }
847
+ if (curr.type !== next.type) {
848
+ replace(curr, next, domParent, frame, scheduler, vParent, anchor);
849
+ return;
850
+ }
851
+ if (isCommittedTextNode(curr) && isTextNode(next)) {
852
+ diffText(curr, next, scheduler, vParent);
853
+ return;
854
+ }
855
+ if (isCommittedHostNode(curr) && isHostNode(next)) {
856
+ diffHost(curr, next, domParent, frame, scheduler, vParent);
857
+ return;
858
+ }
859
+ if (isCommittedComponentNode(curr) && isComponentNode(next)) {
860
+ diffComponent(curr, next, frame, scheduler, domParent, vParent);
861
+ return;
862
+ }
863
+ if (isFragmentNode(curr) && isFragmentNode(next)) {
864
+ diffChildren(curr._children, next._children, domParent, frame, scheduler, vParent, void 0, anchor);
865
+ return;
866
+ }
867
+ if (isCatchNode(curr) && isCatchNode(next)) {
868
+ diffCatch(curr, next, domParent, frame, scheduler, vParent);
869
+ return;
870
+ }
871
+ if (curr.type === Frame && next.type === Frame) {
872
+ throw new Error("TODO: Frame diff not implemented");
873
+ }
874
+ invariant(false, "Unexpected diff case");
875
+ }
876
+ function diffCatch(curr, next, domParent, frame, scheduler, vParent) {
877
+ if (curr._tripped) {
878
+ replace(curr, next, domParent, frame, scheduler, vParent);
879
+ return;
880
+ }
881
+ let added = [];
882
+ try {
883
+ for (let i = 0; i < curr._children.length; i++) {
884
+ let child = curr._children[i];
885
+ diffVNodes(child, next._children[i], domParent, frame, scheduler, vParent);
886
+ added.unshift(child);
887
+ }
888
+ curr._parent = vParent;
889
+ curr._tripped = false;
890
+ curr._added = added;
891
+ } catch (e) {
892
+ for (let child of added) {
893
+ remove(child, domParent, scheduler);
894
+ }
895
+ let fallbackNode = getCatchFallback(next, e);
896
+ let anchor = findFirstDomAnchor(curr) || findNextSiblingDomAnchor(curr, vParent) || void 0;
897
+ insert(fallbackNode, domParent, frame, scheduler, vParent, anchor);
898
+ curr._parent = vParent;
899
+ curr._tripped = true;
900
+ curr._added = [fallbackNode];
901
+ dispatchError(e);
902
+ }
903
+ }
904
+ function replace(curr, next, domParent, frame, scheduler, vParent, anchor) {
905
+ anchor = anchor || findFirstDomAnchor(curr) || findNextSiblingDomAnchor(curr, curr._parent) || void 0;
906
+ insert(next, domParent, frame, scheduler, vParent, anchor);
907
+ remove(curr, domParent, scheduler);
908
+ }
909
+ function diffHost(curr, next, domParent, frame, scheduler, vParent) {
910
+ diffChildren(curr._children, next._children, curr._dom, frame, scheduler, next);
911
+ diffHostProps(curr.props, next.props, curr._dom);
912
+ next._dom = curr._dom;
913
+ next._parent = vParent;
914
+ next._controller = curr._controller;
915
+ let nextOn = next.props.on;
916
+ if (nextOn) {
917
+ if (curr._events) {
918
+ next._events = curr._events;
919
+ let eventsContainer = curr._events;
920
+ scheduler.enqueueTasks([() => eventsContainer.set(nextOn)]);
921
+ } else {
922
+ let eventsContainer = createContainer(curr._dom, {
923
+ onError: (error) => raise(error, next, domParent, frame, scheduler)
924
+ });
925
+ scheduler.enqueueTasks([() => eventsContainer.set(nextOn)]);
926
+ next._events = eventsContainer;
927
+ }
928
+ } else if (curr._events) {
929
+ let eventsContainer = curr._events;
930
+ scheduler.enqueueTasks([() => eventsContainer.dispose()]);
931
+ }
932
+ return;
933
+ }
934
+ function setupHostNode(node, dom, domParent, frame, scheduler) {
935
+ node._dom = dom;
936
+ let on2 = node.props.on;
937
+ if (on2) {
938
+ let eventsContainer = createContainer(dom, {
939
+ onError: (error) => raise(error, node, domParent, frame, scheduler)
940
+ });
941
+ scheduler.enqueueTasks([() => eventsContainer.set(on2)]);
942
+ node._events = eventsContainer;
943
+ }
944
+ let connect = node.props.connect;
945
+ if (connect) {
946
+ if (connect.length >= 2) {
947
+ let controller = new AbortController();
948
+ node._controller = controller;
949
+ scheduler.enqueueTasks([() => connect(dom, controller.signal)]);
950
+ } else {
951
+ scheduler.enqueueTasks([() => connect(dom)]);
952
+ }
953
+ }
954
+ }
955
+ function diffCssProp(curr, next, dom) {
956
+ let prevClassName = curr.css ? processStyle(curr.css, styleCache).className : "";
957
+ let { className, css } = next.css ? processStyle(next.css, styleCache) : { className: "", css: "" };
958
+ if (prevClassName === className)
959
+ return;
960
+ if (prevClassName) {
961
+ dom.classList.remove(prevClassName);
962
+ styleManager.remove(prevClassName);
963
+ }
964
+ if (css && className) {
965
+ dom.classList.add(className);
966
+ styleManager.insert(className, css);
967
+ }
968
+ }
969
+ function diffHostProps(curr, next, dom) {
970
+ let isSvg = dom.namespaceURI === SVG_NS;
971
+ if (next.css || curr.css) {
972
+ diffCssProp(curr, next, dom);
973
+ }
974
+ for (let name in curr) {
975
+ if (isFrameworkProp(name))
976
+ continue;
977
+ if (!(name in next) || next[name] == null) {
978
+ if (canUseProperty(dom, name, isSvg)) {
979
+ try {
980
+ dom[name] = "";
981
+ continue;
982
+ } catch {
983
+ }
984
+ }
985
+ let { ns, attr } = normalizePropName(name, isSvg);
986
+ if (ns)
987
+ dom.removeAttributeNS(ns, attr);
988
+ else
989
+ dom.removeAttribute(attr);
990
+ }
991
+ }
992
+ for (let name in next) {
993
+ if (isFrameworkProp(name))
994
+ continue;
995
+ let nextValue = next[name];
996
+ if (nextValue == null)
997
+ continue;
998
+ let prevValue = curr[name];
999
+ if (prevValue !== nextValue) {
1000
+ let { ns, attr } = normalizePropName(name, isSvg);
1001
+ if (attr === "style" && typeof nextValue === "object" && nextValue && !Array.isArray(nextValue)) {
1002
+ dom.setAttribute("style", serializeStyleObject(nextValue));
1003
+ continue;
1004
+ }
1005
+ if (canUseProperty(dom, name, isSvg)) {
1006
+ try {
1007
+ dom[name] = nextValue == null ? "" : nextValue;
1008
+ continue;
1009
+ } catch {
1010
+ }
1011
+ }
1012
+ if (typeof nextValue === "function") {
1013
+ continue;
1014
+ }
1015
+ let isAriaOrData = name.startsWith("aria-") || name.startsWith("data-");
1016
+ if (nextValue != null && (nextValue !== false || isAriaOrData)) {
1017
+ let attrValue = name === "popover" && nextValue === true ? "" : String(nextValue);
1018
+ if (ns)
1019
+ dom.setAttributeNS(ns, attr, attrValue);
1020
+ else
1021
+ dom.setAttribute(attr, attrValue);
1022
+ } else {
1023
+ if (ns)
1024
+ dom.removeAttributeNS(ns, attr);
1025
+ else
1026
+ dom.removeAttribute(attr);
1027
+ }
1028
+ }
1029
+ }
1030
+ }
1031
+ var ATTRIBUTE_FALLBACK_NAMES = /* @__PURE__ */ new Set([
1032
+ "width",
1033
+ "height",
1034
+ "href",
1035
+ "list",
1036
+ "form",
1037
+ "tabIndex",
1038
+ "download",
1039
+ "rowSpan",
1040
+ "colSpan",
1041
+ "role",
1042
+ "popover"
1043
+ ]);
1044
+ function canUseProperty(dom, name, isSvg) {
1045
+ if (isSvg)
1046
+ return false;
1047
+ if (ATTRIBUTE_FALLBACK_NAMES.has(name))
1048
+ return false;
1049
+ return name in dom;
1050
+ }
1051
+ function isCommittedCatchNode(node) {
1052
+ return isCatchNode(node) && node._added != void 0 && node._tripped != null;
1053
+ }
1054
+ function isComponentNode(node) {
1055
+ return typeof node.type === "function" && node.type !== Frame;
1056
+ }
1057
+ function isCommittedComponentNode(node) {
1058
+ return isComponentNode(node) && node._content !== void 0;
1059
+ }
1060
+ function isFrameworkProp(name) {
1061
+ return name === "children" || name === "key" || name === "on" || name === "css" || name === "setup";
1062
+ }
1063
+ function serializeStyleObject(style) {
1064
+ let parts = [];
1065
+ for (let [key, value] of Object.entries(style)) {
1066
+ if (value == null)
1067
+ continue;
1068
+ if (typeof value === "boolean")
1069
+ continue;
1070
+ if (typeof value === "number" && !Number.isFinite(value))
1071
+ continue;
1072
+ let cssKey = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
1073
+ let cssValue = Array.isArray(value) ? value.join(", ") : normalizeCssValue(key, value);
1074
+ parts.push(`${cssKey}: ${cssValue};`);
1075
+ }
1076
+ return parts.join(" ");
1077
+ }
1078
+ function getSvgContext(vParent, nodeType) {
1079
+ if (typeof nodeType === "string") {
1080
+ if (nodeType === "svg")
1081
+ return true;
1082
+ if (nodeType === "foreignObject")
1083
+ return false;
1084
+ }
1085
+ return vParent._svg ?? false;
1086
+ }
1087
+ function normalizePropName(name, isSvg) {
1088
+ if (name.startsWith("aria-") || name.startsWith("data-"))
1089
+ return { attr: name };
1090
+ if (!isSvg) {
1091
+ if (name === "className")
1092
+ return { attr: "class" };
1093
+ if (name === "htmlFor")
1094
+ return { attr: "for" };
1095
+ if (name === "tabIndex")
1096
+ return { attr: "tabindex" };
1097
+ if (name === "acceptCharset")
1098
+ return { attr: "accept-charset" };
1099
+ if (name === "httpEquiv")
1100
+ return { attr: "http-equiv" };
1101
+ return { attr: name.toLowerCase() };
1102
+ }
1103
+ if (name === "xlinkHref")
1104
+ return { ns: XLINK_NS, attr: "xlink:href" };
1105
+ if (name === "xmlLang")
1106
+ return { ns: XML_NS, attr: "xml:lang" };
1107
+ if (name === "xmlSpace")
1108
+ return { ns: XML_NS, attr: "xml:space" };
1109
+ if (name === "viewBox" || name === "preserveAspectRatio" || name === "gradientUnits" || name === "gradientTransform" || name === "patternUnits" || name === "patternTransform" || name === "clipPathUnits" || name === "maskUnits" || name === "maskContentUnits") {
1110
+ return { attr: name };
1111
+ }
1112
+ return { attr: camelToKebab2(name) };
1113
+ }
1114
+ function camelToKebab2(input) {
1115
+ return input.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
1116
+ }
1117
+ function diffText(curr, next, scheduler, vParent) {
1118
+ if (curr._text !== next._text) {
1119
+ curr._dom.textContent = next._text;
1120
+ }
1121
+ next._dom = curr._dom;
1122
+ next._parent = vParent;
1123
+ }
1124
+ function logHydrationMismatch(...msg) {
1125
+ console.error("Hydration mismatch:", ...msg);
1126
+ }
1127
+ function insert(node, domParent, frame, scheduler, vParent, anchor, cursor) {
1128
+ node._parent = vParent;
1129
+ node._svg = getSvgContext(vParent, node.type);
1130
+ cursor = skipComments(cursor ?? null);
1131
+ let doInsert = anchor ? (dom) => domParent.insertBefore(dom, anchor) : (dom) => domParent.appendChild(dom);
1132
+ if (isTextNode(node)) {
1133
+ if (cursor instanceof Text) {
1134
+ node._dom = cursor;
1135
+ node._parent = vParent;
1136
+ if (cursor.data !== node._text) {
1137
+ logHydrationMismatch("text mismatch", cursor.data, node._text);
1138
+ cursor.data = node._text;
1139
+ }
1140
+ return cursor.nextSibling;
1141
+ }
1142
+ let dom = document.createTextNode(node._text);
1143
+ node._dom = dom;
1144
+ node._parent = vParent;
1145
+ doInsert(dom);
1146
+ return cursor;
1147
+ }
1148
+ if (isHostNode(node)) {
1149
+ if (cursor instanceof Element) {
1150
+ if (cursor.tagName.toLowerCase() === node.type) {
1151
+ diffHostProps({}, node.props, cursor);
1152
+ setupHostNode(node, cursor, domParent, frame, scheduler);
1153
+ let childCursor = cursor.firstChild;
1154
+ let excess = diffChildren(null, node._children, cursor, frame, scheduler, node, childCursor);
1155
+ if (excess) {
1156
+ logHydrationMismatch("excess", excess);
1157
+ }
1158
+ return cursor.nextSibling;
1159
+ } else {
1160
+ logHydrationMismatch("tag", cursor.tagName.toLowerCase(), node.type);
1161
+ cursor.remove();
1162
+ cursor = void 0;
1163
+ }
1164
+ }
1165
+ let dom = node._svg ? document.createElementNS(SVG_NS, node.type) : document.createElement(node.type);
1166
+ diffHostProps({}, node.props, dom);
1167
+ diffChildren(null, node._children, dom, frame, scheduler, node);
1168
+ setupHostNode(node, dom, domParent, frame, scheduler);
1169
+ doInsert(dom);
1170
+ return cursor;
1171
+ }
1172
+ if (isFragmentNode(node)) {
1173
+ for (let child of node._children) {
1174
+ cursor = insert(child, domParent, frame, scheduler, vParent, anchor, cursor);
1175
+ }
1176
+ return cursor;
1177
+ }
1178
+ if (isCatchNode(node)) {
1179
+ let added = [];
1180
+ try {
1181
+ for (let child of node._children) {
1182
+ insert(child, domParent, frame, scheduler, node, anchor);
1183
+ added.unshift(child);
1184
+ }
1185
+ node._parent = vParent;
1186
+ node._tripped = false;
1187
+ node._added = added;
1188
+ } catch (e) {
1189
+ let fallback = getCatchFallback(node, e);
1190
+ for (let child of added) {
1191
+ remove(child, domParent, scheduler);
1192
+ }
1193
+ insert(fallback, domParent, frame, scheduler, node, anchor);
1194
+ node._parent = vParent;
1195
+ node._tripped = true;
1196
+ node._added = [fallback];
1197
+ dispatchError(e);
1198
+ }
1199
+ return;
1200
+ }
1201
+ if (isComponentNode(node)) {
1202
+ diffComponent(null, node, frame, scheduler, domParent, vParent, anchor, cursor);
1203
+ return cursor;
1204
+ }
1205
+ if (node.type === Frame) {
1206
+ throw new Error("TODO: Frame insert not implemented");
1207
+ }
1208
+ if (node.type === Catch) {
1209
+ throw new Error("TODO: Catch insert not implemented");
1210
+ }
1211
+ invariant(false, "Unexpected node type");
1212
+ }
1213
+ function renderComponent(handle, currContent, next, domParent, frame, scheduler, vParent, anchor, cursor) {
1214
+ let [element, tasks] = handle.render(next.props);
1215
+ let content = toVNode(element);
1216
+ diffVNodes(currContent, content, domParent, frame, scheduler, next, anchor, cursor);
1217
+ next._content = content;
1218
+ next._handle = handle;
1219
+ next._parent = vParent;
1220
+ let committed = next;
1221
+ handle.setScheduleUpdate(() => {
1222
+ scheduler.enqueue(committed, domParent, anchor);
1223
+ });
1224
+ scheduler.enqueueTasks(tasks);
1225
+ }
1226
+ function diffComponent(curr, next, frame, scheduler, domParent, vParent, anchor, cursor) {
1227
+ if (curr === null) {
1228
+ next._handle = createComponent({
1229
+ id: `e${++fixmeIdCounter}`,
1230
+ frame,
1231
+ type: next.type,
1232
+ raise: (error) => {
1233
+ raise(error, next, domParent, frame, scheduler);
1234
+ },
1235
+ getContext: (type) => {
1236
+ return findContextFromAncestry(vParent, type);
1237
+ }
1238
+ });
1239
+ renderComponent(next._handle, null, next, domParent, frame, scheduler, vParent, anchor, cursor);
1240
+ return;
1241
+ }
1242
+ next._handle = curr._handle;
1243
+ let { _content, _handle } = curr;
1244
+ renderComponent(_handle, _content, next, domParent, frame, scheduler, vParent, anchor, cursor);
1245
+ }
1246
+ function findContextFromAncestry(node, type) {
1247
+ let current = node;
1248
+ while (current) {
1249
+ if (current.type === type && isComponentNode(current)) {
1250
+ return current._handle.getContextValue();
1251
+ }
1252
+ current = current._parent;
1253
+ }
1254
+ return void 0;
1255
+ }
1256
+ function cleanupDescendants(node, scheduler) {
1257
+ if (isCommittedTextNode(node)) {
1258
+ return;
1259
+ }
1260
+ if (isCommittedHostNode(node)) {
1261
+ for (let child of node._children) {
1262
+ cleanupDescendants(child, scheduler);
1263
+ }
1264
+ if (node.props.css) {
1265
+ let { className } = processStyle(node.props.css, styleCache);
1266
+ if (className) {
1267
+ styleManager.remove(className);
1268
+ }
1269
+ }
1270
+ if (node._controller)
1271
+ node._controller.abort();
1272
+ let _events = node._events;
1273
+ if (_events) {
1274
+ scheduler.enqueueTasks([() => _events.dispose()]);
1275
+ }
1276
+ return;
1277
+ }
1278
+ if (isFragmentNode(node)) {
1279
+ for (let child of node._children) {
1280
+ cleanupDescendants(child, scheduler);
1281
+ }
1282
+ return;
1283
+ }
1284
+ if (isCommittedComponentNode(node)) {
1285
+ cleanupDescendants(node._content, scheduler);
1286
+ let tasks = node._handle.remove();
1287
+ scheduler.enqueueTasks(tasks);
1288
+ return;
1289
+ }
1290
+ if (isCommittedCatchNode(node)) {
1291
+ for (let child of node._added) {
1292
+ cleanupDescendants(child, scheduler);
1293
+ }
1294
+ return;
1295
+ }
1296
+ }
1297
+ function remove(node, domParent, scheduler) {
1298
+ if (isCommittedTextNode(node)) {
1299
+ domParent.removeChild(node._dom);
1300
+ return;
1301
+ }
1302
+ if (isCommittedHostNode(node)) {
1303
+ for (let child of node._children) {
1304
+ cleanupDescendants(child, scheduler);
1305
+ }
1306
+ if (node.props.css) {
1307
+ let { className } = processStyle(node.props.css, styleCache);
1308
+ if (className) {
1309
+ styleManager.remove(className);
1310
+ }
1311
+ }
1312
+ domParent.removeChild(node._dom);
1313
+ if (node._controller)
1314
+ node._controller.abort();
1315
+ let _events = node._events;
1316
+ if (_events) {
1317
+ scheduler.enqueueTasks([() => _events.dispose()]);
1318
+ }
1319
+ return;
1320
+ }
1321
+ if (isFragmentNode(node)) {
1322
+ for (let child of node._children) {
1323
+ remove(child, domParent, scheduler);
1324
+ }
1325
+ return;
1326
+ }
1327
+ if (isCommittedComponentNode(node)) {
1328
+ remove(node._content, domParent, scheduler);
1329
+ let tasks = node._handle.remove();
1330
+ scheduler.enqueueTasks(tasks);
1331
+ return;
1332
+ }
1333
+ if (isCommittedCatchNode(node)) {
1334
+ for (let child of node._added) {
1335
+ remove(child, domParent, scheduler);
1336
+ }
1337
+ return;
1338
+ }
1339
+ }
1340
+ function diffChildren(curr, next, domParent, frame, scheduler, vParent, cursor, anchor) {
1341
+ if (curr === null) {
1342
+ for (let node of next) {
1343
+ cursor = insert(node, domParent, frame, scheduler, vParent, anchor, cursor);
1344
+ }
1345
+ vParent._children = next;
1346
+ return cursor;
1347
+ }
1348
+ let currLength = curr.length;
1349
+ let nextLength = next.length;
1350
+ let hasKeys = false;
1351
+ for (let i = 0; i < nextLength; i++) {
1352
+ let node = next[i];
1353
+ if (node && node.key != null) {
1354
+ hasKeys = true;
1355
+ break;
1356
+ }
1357
+ }
1358
+ if (!hasKeys) {
1359
+ for (let i = 0; i < nextLength; i++) {
1360
+ let currentNode = i < currLength ? curr[i] : null;
1361
+ diffVNodes(currentNode, next[i], domParent, frame, scheduler, vParent, anchor, cursor);
1362
+ }
1363
+ if (currLength > nextLength) {
1364
+ for (let i = nextLength; i < currLength; i++) {
1365
+ let node = curr[i];
1366
+ if (node)
1367
+ remove(node, domParent, scheduler);
1368
+ }
1369
+ }
1370
+ vParent._children = next;
1371
+ return;
1372
+ }
1373
+ let oldChildren = curr;
1374
+ let oldChildrenLength = currLength;
1375
+ let remainingOldChildren = oldChildrenLength;
1376
+ let oldKeyMap = /* @__PURE__ */ new Map();
1377
+ for (let i = 0; i < oldChildrenLength; i++) {
1378
+ let c = oldChildren[i];
1379
+ if (c) {
1380
+ c._flags = 0;
1381
+ if (c.key != null) {
1382
+ oldKeyMap.set(c.key, i);
1383
+ }
1384
+ }
1385
+ }
1386
+ let skew = 0;
1387
+ let newChildren = new Array(nextLength);
1388
+ for (let i = 0; i < nextLength; i++) {
1389
+ let childVNode = next[i];
1390
+ if (!childVNode) {
1391
+ newChildren[i] = childVNode;
1392
+ continue;
1393
+ }
1394
+ newChildren[i] = childVNode;
1395
+ childVNode._parent = vParent;
1396
+ let skewedIndex = i + skew;
1397
+ let matchingIndex = -1;
1398
+ let key = childVNode.key;
1399
+ let type = childVNode.type;
1400
+ if (key != null) {
1401
+ let mapIndex = oldKeyMap.get(key);
1402
+ if (mapIndex !== void 0) {
1403
+ let candidate = oldChildren[mapIndex];
1404
+ let candidateFlags = candidate?._flags ?? 0;
1405
+ if (candidate && (candidateFlags & MATCHED) === 0 && candidate.type === type) {
1406
+ matchingIndex = mapIndex;
1407
+ }
1408
+ }
1409
+ } else {
1410
+ let searchVNode = oldChildren[skewedIndex];
1411
+ let searchFlags = searchVNode?._flags ?? 0;
1412
+ let available = searchVNode != null && (searchFlags & MATCHED) === 0;
1413
+ if (available && searchVNode.key == null && type === searchVNode.type) {
1414
+ matchingIndex = skewedIndex;
1415
+ }
1416
+ }
1417
+ childVNode._index = matchingIndex;
1418
+ let matchedOldVNode = null;
1419
+ if (matchingIndex !== -1) {
1420
+ matchedOldVNode = oldChildren[matchingIndex];
1421
+ remainingOldChildren--;
1422
+ if (matchedOldVNode) {
1423
+ matchedOldVNode._flags = (matchedOldVNode._flags ?? 0) | MATCHED;
1424
+ }
1425
+ }
1426
+ let oldDom = matchedOldVNode && findFirstDomAnchor(matchedOldVNode);
1427
+ let isMounting = !matchedOldVNode || !oldDom;
1428
+ if (isMounting) {
1429
+ if (matchingIndex === -1) {
1430
+ if (nextLength > oldChildrenLength) {
1431
+ skew--;
1432
+ } else if (nextLength < oldChildrenLength) {
1433
+ skew++;
1434
+ }
1435
+ }
1436
+ childVNode._flags = (childVNode._flags ?? 0) | INSERT_VNODE;
1437
+ } else if (matchingIndex !== i + skew) {
1438
+ if (matchingIndex === i + skew - 1) {
1439
+ skew--;
1440
+ } else if (matchingIndex === i + skew + 1) {
1441
+ skew++;
1442
+ } else {
1443
+ if (matchingIndex > i + skew)
1444
+ skew--;
1445
+ else
1446
+ skew++;
1447
+ childVNode._flags = (childVNode._flags ?? 0) | INSERT_VNODE;
1448
+ }
1449
+ }
1450
+ }
1451
+ if (remainingOldChildren) {
1452
+ for (let i = 0; i < oldChildrenLength; i++) {
1453
+ let oldVNode = oldChildren[i];
1454
+ if (oldVNode && ((oldVNode._flags ?? 0) & MATCHED) === 0) {
1455
+ remove(oldVNode, domParent, scheduler);
1456
+ }
1457
+ }
1458
+ }
1459
+ vParent._children = newChildren;
1460
+ let lastPlaced = null;
1461
+ for (let i = 0; i < nextLength; i++) {
1462
+ let childVNode = newChildren[i];
1463
+ if (!childVNode)
1464
+ continue;
1465
+ let idx = childVNode._index ?? -1;
1466
+ let oldVNode = idx >= 0 ? oldChildren[idx] : null;
1467
+ diffVNodes(oldVNode, childVNode, domParent, frame, scheduler, vParent, anchor, cursor);
1468
+ let shouldPlace = (childVNode._flags ?? 0) & INSERT_VNODE;
1469
+ let firstDom = findFirstDomAnchor(childVNode);
1470
+ if (shouldPlace && firstDom && firstDom.parentNode === domParent) {
1471
+ if (lastPlaced === null) {
1472
+ if (firstDom !== domParent.firstChild) {
1473
+ domParent.insertBefore(firstDom, domParent.firstChild);
1474
+ }
1475
+ } else {
1476
+ let target = lastPlaced.nextSibling;
1477
+ if (firstDom !== target) {
1478
+ domParent.insertBefore(firstDom, target);
1479
+ }
1480
+ }
1481
+ }
1482
+ if (firstDom)
1483
+ lastPlaced = firstDom;
1484
+ childVNode._flags = 0;
1485
+ childVNode._index = void 0;
1486
+ }
1487
+ return;
1488
+ }
1489
+ function dispatchError(error) {
1490
+ }
1491
+ function getCatchFallback(vnode, error) {
1492
+ let content = typeof vnode._fallback === "function" ? vnode._fallback(error) : vnode._fallback;
1493
+ return toVNode(content);
1494
+ }
1495
+ function raise(error, descendant, domParent, frame, scheduler) {
1496
+ let catchBoundary = findCatchBoundary(descendant);
1497
+ if (catchBoundary) {
1498
+ let content = getCatchFallback(catchBoundary, error);
1499
+ let anchor = findFirstDomAnchor(catchBoundary) || findNextSiblingDomAnchor(catchBoundary, catchBoundary._parent) || void 0;
1500
+ insert(content, domParent, frame, scheduler, catchBoundary, anchor);
1501
+ for (let child of catchBoundary._added) {
1502
+ remove(child, domParent, scheduler);
1503
+ }
1504
+ catchBoundary._tripped = true;
1505
+ catchBoundary._added = [content];
1506
+ } else {
1507
+ dispatchError(error);
1508
+ }
1509
+ }
1510
+ function findCatchBoundary(vnode) {
1511
+ let current = vnode;
1512
+ while (current) {
1513
+ if (isCommittedCatchNode(current))
1514
+ return current;
1515
+ current = current._parent;
1516
+ }
1517
+ return null;
1518
+ }
1519
+ function isFragmentNode(node) {
1520
+ return node.type === Fragment;
1521
+ }
1522
+ function isCatchNode(node) {
1523
+ return node.type === Catch;
1524
+ }
1525
+ function isTextNode(node) {
1526
+ return node.type === TEXT_NODE;
1527
+ }
1528
+ function isCommittedTextNode(node) {
1529
+ return isTextNode(node) && node._dom instanceof Text;
1530
+ }
1531
+ function isHostNode(node) {
1532
+ return typeof node.type === "string";
1533
+ }
1534
+ function isCommittedHostNode(node) {
1535
+ return isHostNode(node) && node._dom instanceof Element;
1536
+ }
1537
+ function isRemixElement(node) {
1538
+ return typeof node === "object" && node !== null && "$rmx" in node;
1539
+ }
1540
+ function findFirstDomAnchor(node) {
1541
+ if (!node)
1542
+ return null;
1543
+ if (isCommittedTextNode(node))
1544
+ return node._dom;
1545
+ if (isCommittedHostNode(node))
1546
+ return node._dom;
1547
+ if (isCommittedComponentNode(node))
1548
+ return findFirstDomAnchor(node._content);
1549
+ if (isFragmentNode(node)) {
1550
+ for (let child of node._children) {
1551
+ let dom = findFirstDomAnchor(child);
1552
+ if (dom)
1553
+ return dom;
1554
+ }
1555
+ }
1556
+ if (isCommittedCatchNode(node)) {
1557
+ for (let child of node._added) {
1558
+ let dom = findFirstDomAnchor(child);
1559
+ if (dom)
1560
+ return dom;
1561
+ }
1562
+ }
1563
+ return null;
1564
+ }
1565
+ function findNextSiblingDomAnchor(curr, vParent) {
1566
+ if (!vParent || !Array.isArray(vParent._children))
1567
+ return null;
1568
+ let children = vParent._children;
1569
+ let idx = children.indexOf(curr);
1570
+ if (idx === -1)
1571
+ return null;
1572
+ for (let i = idx + 1; i < children.length; i++) {
1573
+ let dom = findFirstDomAnchor(children[i]);
1574
+ if (dom)
1575
+ return dom;
1576
+ }
1577
+ return null;
1578
+ }
1579
+ function skipComments(cursor) {
1580
+ while (cursor && cursor.nodeType === Node.COMMENT_NODE) {
1581
+ cursor = cursor.nextSibling;
1582
+ }
1583
+ return cursor;
1584
+ }
1585
+
1586
+ // node_modules/.pnpm/@remix-run+component@0.3.0/node_modules/@remix-run/component/dist/lib/jsx.js
1587
+ function jsx(type, props, key) {
1588
+ return { type, props, key, $rmx: true };
1589
+ }
1590
+
1591
+ // entry.tsx
1592
+ var state = {
1593
+ refs: null,
1594
+ commits: [],
1595
+ maxLane: 0,
1596
+ selectedCommit: null,
1597
+ diff: null,
1598
+ filter: "all",
1599
+ search: "",
1600
+ loading: true
1601
+ };
1602
+ var updateApp;
1603
+ async function fetchRefs() {
1604
+ let res = await fetch("/api/refs");
1605
+ return res.json();
1606
+ }
1607
+ async function fetchCommits(ref, search) {
1608
+ let params = new URLSearchParams();
1609
+ if (ref) params.set("ref", ref);
1610
+ if (search) params.set("search", search);
1611
+ let res = await fetch(`/api/commits?${params}`);
1612
+ let data = await res.json();
1613
+ return { commits: data.commits, maxLane: data.maxLane };
1614
+ }
1615
+ async function fetchDiff(sha) {
1616
+ let res = await fetch(`/api/diff/${sha}`);
1617
+ return res.json();
1618
+ }
1619
+ async function setFilter(filter) {
1620
+ state.filter = filter;
1621
+ state.loading = true;
1622
+ updateApp();
1623
+ let ref = filter === "all" ? "all" : filter === "local" ? state.refs?.currentBranch : filter;
1624
+ let result = await fetchCommits(ref, state.search);
1625
+ state.commits = result.commits;
1626
+ state.maxLane = result.maxLane;
1627
+ state.loading = false;
1628
+ updateApp();
1629
+ }
1630
+ async function setSearch(search) {
1631
+ state.search = search;
1632
+ state.loading = true;
1633
+ updateApp();
1634
+ let ref = state.filter === "all" ? "all" : state.filter === "local" ? state.refs?.currentBranch : state.filter;
1635
+ let result = await fetchCommits(ref, search);
1636
+ state.commits = result.commits;
1637
+ state.maxLane = result.maxLane;
1638
+ state.loading = false;
1639
+ updateApp();
1640
+ }
1641
+ async function selectCommit(commit) {
1642
+ state.selectedCommit = commit;
1643
+ state.diff = null;
1644
+ updateApp();
1645
+ state.diff = await fetchDiff(commit.sha);
1646
+ updateApp();
1647
+ }
1648
+ var colors = {
1649
+ bg: "#ffffff",
1650
+ bgLight: "#f6f8fa",
1651
+ bgLighter: "#eaeef2",
1652
+ border: "#d1d9e0",
1653
+ text: "#1f2328",
1654
+ textMuted: "#656d76",
1655
+ accent: "#0969da",
1656
+ accentDim: "#ddf4ff",
1657
+ green: "#1a7f37",
1658
+ red: "#cf222e"
1659
+ };
1660
+ var graphColors = [
1661
+ "#0969da",
1662
+ // blue
1663
+ "#8250df",
1664
+ // purple
1665
+ "#bf3989",
1666
+ // pink
1667
+ "#cf222e",
1668
+ // red
1669
+ "#bc4c00",
1670
+ // orange
1671
+ "#4d2d00",
1672
+ // brown
1673
+ "#1a7f37",
1674
+ // green
1675
+ "#0550ae"
1676
+ // dark blue
1677
+ ];
1678
+ function App(handle) {
1679
+ updateApp = () => handle.update();
1680
+ handle.queueTask(async () => {
1681
+ let [refs, commitsResult] = await Promise.all([
1682
+ fetchRefs(),
1683
+ fetchCommits("all")
1684
+ ]);
1685
+ state.refs = refs;
1686
+ state.commits = commitsResult.commits;
1687
+ state.maxLane = commitsResult.maxLane;
1688
+ state.loading = false;
1689
+ handle.update();
1690
+ });
1691
+ return () => /* @__PURE__ */ jsx(
1692
+ "div",
1693
+ {
1694
+ css: {
1695
+ display: "flex",
1696
+ height: "100vh",
1697
+ background: colors.bg,
1698
+ color: colors.text,
1699
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
1700
+ fontSize: "13px"
1701
+ },
1702
+ children: [
1703
+ /* @__PURE__ */ jsx(Sidebar, {}),
1704
+ /* @__PURE__ */ jsx(MainPanel, {})
1705
+ ]
1706
+ }
1707
+ );
1708
+ }
1709
+ function Sidebar() {
1710
+ return () => /* @__PURE__ */ jsx(
1711
+ "div",
1712
+ {
1713
+ css: {
1714
+ width: "200px",
1715
+ minWidth: "200px",
1716
+ borderRight: `1px solid ${colors.border}`,
1717
+ display: "flex",
1718
+ flexDirection: "column",
1719
+ overflow: "hidden"
1720
+ },
1721
+ children: [
1722
+ /* @__PURE__ */ jsx(
1723
+ "div",
1724
+ {
1725
+ css: {
1726
+ padding: "12px",
1727
+ borderBottom: `1px solid ${colors.border}`,
1728
+ fontWeight: 600,
1729
+ fontSize: "11px",
1730
+ textTransform: "uppercase",
1731
+ letterSpacing: "0.5px",
1732
+ color: colors.textMuted
1733
+ },
1734
+ children: "Git Tree Viewer"
1735
+ }
1736
+ ),
1737
+ /* @__PURE__ */ jsx("div", { css: { flex: 1, overflow: "auto", padding: "8px 0" }, children: state.refs && /* @__PURE__ */ jsx(Fragment, { children: [
1738
+ /* @__PURE__ */ jsx(RefSection, { title: "LOCAL", nodes: state.refs.local }),
1739
+ Object.entries(state.refs.remotes).map(([remote, nodes]) => /* @__PURE__ */ jsx(
1740
+ RefSection,
1741
+ {
1742
+ title: remote.toUpperCase(),
1743
+ nodes
1744
+ },
1745
+ remote
1746
+ ))
1747
+ ] }) })
1748
+ ]
1749
+ }
1750
+ );
1751
+ }
1752
+ function RefSection(handle) {
1753
+ let expanded = true;
1754
+ return ({ title, nodes }) => /* @__PURE__ */ jsx("div", { css: { marginBottom: "8px" }, children: [
1755
+ /* @__PURE__ */ jsx(
1756
+ "div",
1757
+ {
1758
+ css: {
1759
+ padding: "4px 12px",
1760
+ fontSize: "10px",
1761
+ fontWeight: 600,
1762
+ textTransform: "uppercase",
1763
+ letterSpacing: "0.5px",
1764
+ color: colors.textMuted,
1765
+ cursor: "pointer",
1766
+ "&:hover": { color: colors.text }
1767
+ },
1768
+ on: {
1769
+ click: () => {
1770
+ expanded = !expanded;
1771
+ handle.update();
1772
+ }
1773
+ },
1774
+ children: [
1775
+ expanded ? "\u25BC" : "\u25B6",
1776
+ " ",
1777
+ title
1778
+ ]
1779
+ }
1780
+ ),
1781
+ expanded && /* @__PURE__ */ jsx("div", { css: { paddingLeft: "8px" }, children: nodes.map((node) => /* @__PURE__ */ jsx(RefNodeItem, { node, depth: 0 }, node.name)) })
1782
+ ] });
1783
+ }
1784
+ function RefNodeItem(handle) {
1785
+ let expanded = true;
1786
+ return ({ node, depth }) => {
1787
+ let paddingLeft = 12 + depth * 12;
1788
+ if (node.type === "folder") {
1789
+ return /* @__PURE__ */ jsx("div", { children: [
1790
+ /* @__PURE__ */ jsx(
1791
+ "div",
1792
+ {
1793
+ css: {
1794
+ padding: `3px 12px`,
1795
+ paddingLeft: `${paddingLeft}px`,
1796
+ cursor: "pointer",
1797
+ color: colors.textMuted,
1798
+ fontSize: "12px",
1799
+ "&:hover": { color: colors.text }
1800
+ },
1801
+ on: {
1802
+ click: () => {
1803
+ expanded = !expanded;
1804
+ handle.update();
1805
+ }
1806
+ },
1807
+ children: [
1808
+ expanded ? "\u25BC" : "\u25B6",
1809
+ " ",
1810
+ node.name,
1811
+ "/"
1812
+ ]
1813
+ }
1814
+ ),
1815
+ expanded && node.children.map((child) => /* @__PURE__ */ jsx(RefNodeItem, { node: child, depth: depth + 1 }, child.name))
1816
+ ] });
1817
+ }
1818
+ let isSelected = state.filter === node.fullName;
1819
+ return /* @__PURE__ */ jsx(
1820
+ "div",
1821
+ {
1822
+ css: {
1823
+ padding: `3px 12px`,
1824
+ paddingLeft: `${paddingLeft}px`,
1825
+ cursor: "pointer",
1826
+ borderRadius: "3px",
1827
+ marginRight: "8px",
1828
+ background: isSelected ? colors.accentDim : "transparent",
1829
+ color: node.current ? colors.accent : colors.text,
1830
+ fontWeight: node.current ? 600 : 400,
1831
+ "&:hover": {
1832
+ background: isSelected ? colors.accentDim : colors.bgLighter
1833
+ }
1834
+ },
1835
+ on: { click: () => setFilter(node.fullName) },
1836
+ children: [
1837
+ node.current && "\u25CF ",
1838
+ node.name
1839
+ ]
1840
+ }
1841
+ );
1842
+ };
1843
+ }
1844
+ function MainPanel() {
1845
+ return () => /* @__PURE__ */ jsx(
1846
+ "div",
1847
+ {
1848
+ css: {
1849
+ flex: 1,
1850
+ display: "flex",
1851
+ flexDirection: "column",
1852
+ overflow: "hidden"
1853
+ },
1854
+ children: [
1855
+ /* @__PURE__ */ jsx(CommitList, {}),
1856
+ /* @__PURE__ */ jsx(DiffPanel, {})
1857
+ ]
1858
+ }
1859
+ );
1860
+ }
1861
+ function CommitList() {
1862
+ let searchTimeout = null;
1863
+ function handleSearch(value) {
1864
+ if (searchTimeout) clearTimeout(searchTimeout);
1865
+ searchTimeout = setTimeout(() => setSearch(value), 300);
1866
+ }
1867
+ return () => /* @__PURE__ */ jsx(
1868
+ "div",
1869
+ {
1870
+ css: {
1871
+ height: "40%",
1872
+ minHeight: "200px",
1873
+ display: "flex",
1874
+ flexDirection: "column",
1875
+ borderBottom: `1px solid ${colors.border}`
1876
+ },
1877
+ children: [
1878
+ /* @__PURE__ */ jsx(
1879
+ "div",
1880
+ {
1881
+ css: {
1882
+ display: "flex",
1883
+ alignItems: "center",
1884
+ gap: "8px",
1885
+ padding: "8px 12px",
1886
+ borderBottom: `1px solid ${colors.border}`,
1887
+ background: colors.bgLight
1888
+ },
1889
+ children: [
1890
+ /* @__PURE__ */ jsx(FilterButton, { label: "All", filter: "all" }),
1891
+ /* @__PURE__ */ jsx(FilterButton, { label: "Local", filter: "local" }),
1892
+ state.refs && /* @__PURE__ */ jsx(
1893
+ FilterButton,
1894
+ {
1895
+ label: state.refs.currentBranch,
1896
+ filter: state.refs.currentBranch
1897
+ }
1898
+ ),
1899
+ /* @__PURE__ */ jsx("div", { css: { flex: 1 } }),
1900
+ /* @__PURE__ */ jsx(
1901
+ "input",
1902
+ {
1903
+ type: "text",
1904
+ placeholder: "Search commits...",
1905
+ css: {
1906
+ width: "200px",
1907
+ padding: "4px 8px",
1908
+ border: `1px solid ${colors.border}`,
1909
+ borderRadius: "4px",
1910
+ background: colors.bg,
1911
+ color: colors.text,
1912
+ fontSize: "12px",
1913
+ "&:focus": { outline: "none", borderColor: colors.accent },
1914
+ "&::placeholder": { color: colors.textMuted }
1915
+ },
1916
+ on: {
1917
+ input: (e) => handleSearch(e.target.value)
1918
+ }
1919
+ }
1920
+ )
1921
+ ]
1922
+ }
1923
+ ),
1924
+ /* @__PURE__ */ jsx("div", { css: { flex: 1, overflow: "auto" }, children: state.loading ? /* @__PURE__ */ jsx(
1925
+ "div",
1926
+ {
1927
+ css: {
1928
+ padding: "20px",
1929
+ textAlign: "center",
1930
+ color: colors.textMuted
1931
+ },
1932
+ children: "Loading..."
1933
+ }
1934
+ ) : /* @__PURE__ */ jsx(
1935
+ "table",
1936
+ {
1937
+ css: {
1938
+ width: "100%",
1939
+ borderCollapse: "collapse",
1940
+ tableLayout: "fixed",
1941
+ "& th, & td": {
1942
+ padding: "6px 12px",
1943
+ textAlign: "left",
1944
+ borderBottom: `1px solid ${colors.border}`,
1945
+ overflow: "hidden",
1946
+ textOverflow: "ellipsis",
1947
+ whiteSpace: "nowrap"
1948
+ },
1949
+ "& th": {
1950
+ background: colors.bgLight,
1951
+ fontWeight: 600,
1952
+ fontSize: "11px",
1953
+ textTransform: "uppercase",
1954
+ letterSpacing: "0.5px",
1955
+ color: colors.textMuted,
1956
+ position: "sticky",
1957
+ top: 0
1958
+ },
1959
+ "& tbody tr:hover": { background: colors.bgLighter }
1960
+ },
1961
+ children: [
1962
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: [
1963
+ /* @__PURE__ */ jsx("th", { children: "Subject" }),
1964
+ /* @__PURE__ */ jsx("th", { css: { width: "150px" }, children: "Author" }),
1965
+ /* @__PURE__ */ jsx("th", { css: { width: "150px" }, children: "Date" }),
1966
+ /* @__PURE__ */ jsx("th", { css: { width: "80px" }, children: "SHA" })
1967
+ ] }) }),
1968
+ /* @__PURE__ */ jsx("tbody", { children: state.commits.map((commit) => /* @__PURE__ */ jsx(CommitRow, { commit }, commit.sha)) })
1969
+ ]
1970
+ }
1971
+ ) })
1972
+ ]
1973
+ }
1974
+ );
1975
+ }
1976
+ function FilterButton() {
1977
+ return ({ label, filter }) => {
1978
+ let isActive = state.filter === filter;
1979
+ return /* @__PURE__ */ jsx(
1980
+ "button",
1981
+ {
1982
+ css: {
1983
+ padding: "4px 10px",
1984
+ border: `1px solid ${isActive ? colors.accent : colors.border}`,
1985
+ borderRadius: "4px",
1986
+ background: isActive ? colors.accentDim : "transparent",
1987
+ color: isActive ? colors.accent : colors.text,
1988
+ fontSize: "12px",
1989
+ cursor: "pointer",
1990
+ "&:hover": { borderColor: colors.accent }
1991
+ },
1992
+ on: { click: () => setFilter(filter) },
1993
+ children: label
1994
+ }
1995
+ );
1996
+ };
1997
+ }
1998
+ function CommitRow() {
1999
+ return ({ commit }) => {
2000
+ let isSelected = state.selectedCommit?.sha === commit.sha;
2001
+ let { graph } = commit;
2002
+ let maxUsedLane = graph.lane;
2003
+ for (let line of graph.lines) {
2004
+ maxUsedLane = Math.max(maxUsedLane, line.from, line.to);
2005
+ }
2006
+ let graphWidth = (maxUsedLane + 1) * 16 + 8;
2007
+ let laneColor = graphColors[graph.color % graphColors.length];
2008
+ return /* @__PURE__ */ jsx(
2009
+ "tr",
2010
+ {
2011
+ css: {
2012
+ cursor: "pointer",
2013
+ background: isSelected ? colors.accentDim : "transparent"
2014
+ },
2015
+ on: { click: () => selectCommit(commit) },
2016
+ children: [
2017
+ /* @__PURE__ */ jsx("td", { css: { display: "flex", alignItems: "center" }, children: [
2018
+ /* @__PURE__ */ jsx(
2019
+ "svg",
2020
+ {
2021
+ width: graphWidth,
2022
+ height: "24",
2023
+ css: { display: "block", flexShrink: 0 },
2024
+ children: [
2025
+ graph.lines.map((line, i) => {
2026
+ let x1 = line.from * 16 + 8;
2027
+ let x2 = line.to * 16 + 8;
2028
+ let color = graphColors[line.color % graphColors.length];
2029
+ let isOwnLaneLine = line.from === graph.lane && line.to === graph.lane;
2030
+ if (line.from === line.to) {
2031
+ if (isOwnLaneLine && graph.isFirstInLane) {
2032
+ return /* @__PURE__ */ jsx(
2033
+ "line",
2034
+ {
2035
+ x1,
2036
+ y1: 12,
2037
+ x2,
2038
+ y2: 24,
2039
+ stroke: color,
2040
+ "stroke-width": "2"
2041
+ },
2042
+ i
2043
+ );
2044
+ }
2045
+ return /* @__PURE__ */ jsx(
2046
+ "line",
2047
+ {
2048
+ x1,
2049
+ y1: 0,
2050
+ x2,
2051
+ y2: 24,
2052
+ stroke: color,
2053
+ "stroke-width": "2"
2054
+ },
2055
+ i
2056
+ );
2057
+ } else {
2058
+ let midY = 12;
2059
+ return /* @__PURE__ */ jsx(
2060
+ "path",
2061
+ {
2062
+ d: `M ${x1} 0 Q ${x1} ${midY}, ${(x1 + x2) / 2} ${midY} Q ${x2} ${midY}, ${x2} 24`,
2063
+ fill: "none",
2064
+ stroke: color,
2065
+ "stroke-width": "2"
2066
+ },
2067
+ i
2068
+ );
2069
+ }
2070
+ }),
2071
+ /* @__PURE__ */ jsx(
2072
+ "circle",
2073
+ {
2074
+ cx: graph.lane * 16 + 8,
2075
+ cy: 12,
2076
+ r: 4,
2077
+ fill: laneColor,
2078
+ stroke: colors.bg,
2079
+ "stroke-width": "1"
2080
+ }
2081
+ )
2082
+ ]
2083
+ }
2084
+ ),
2085
+ /* @__PURE__ */ jsx(
2086
+ "span",
2087
+ {
2088
+ css: {
2089
+ overflow: "hidden",
2090
+ textOverflow: "ellipsis",
2091
+ whiteSpace: "nowrap"
2092
+ },
2093
+ children: [
2094
+ commit.refs.map((ref) => /* @__PURE__ */ jsx(
2095
+ "span",
2096
+ {
2097
+ css: {
2098
+ display: "inline-block",
2099
+ padding: "1px 6px",
2100
+ marginRight: "6px",
2101
+ borderRadius: "3px",
2102
+ background: laneColor,
2103
+ color: "#fff",
2104
+ fontSize: "10px",
2105
+ fontWeight: 600
2106
+ },
2107
+ children: ref
2108
+ },
2109
+ ref
2110
+ )),
2111
+ commit.subject
2112
+ ]
2113
+ }
2114
+ )
2115
+ ] }),
2116
+ /* @__PURE__ */ jsx("td", { css: { color: colors.textMuted }, children: commit.author }),
2117
+ /* @__PURE__ */ jsx("td", { css: { color: colors.textMuted }, children: commit.date }),
2118
+ /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsx("code", { css: { color: colors.accent, fontSize: "11px" }, children: commit.shortSha }) })
2119
+ ]
2120
+ }
2121
+ );
2122
+ };
2123
+ }
2124
+ function DiffPanel() {
2125
+ return () => {
2126
+ if (!state.selectedCommit) {
2127
+ return /* @__PURE__ */ jsx(
2128
+ "div",
2129
+ {
2130
+ css: {
2131
+ flex: 1,
2132
+ display: "flex",
2133
+ alignItems: "center",
2134
+ justifyContent: "center",
2135
+ color: colors.textMuted,
2136
+ background: colors.bgLight
2137
+ },
2138
+ children: "Select a commit to view diff"
2139
+ }
2140
+ );
2141
+ }
2142
+ return /* @__PURE__ */ jsx(
2143
+ "div",
2144
+ {
2145
+ css: {
2146
+ flex: 1,
2147
+ display: "flex",
2148
+ flexDirection: "column",
2149
+ background: colors.bgLight
2150
+ },
2151
+ children: [
2152
+ /* @__PURE__ */ jsx(
2153
+ "div",
2154
+ {
2155
+ css: { padding: "12px", borderBottom: `1px solid ${colors.border}` },
2156
+ children: [
2157
+ /* @__PURE__ */ jsx("div", { css: { fontWeight: 600, marginBottom: "4px" }, children: state.selectedCommit.subject }),
2158
+ /* @__PURE__ */ jsx("div", { css: { fontSize: "12px", color: colors.textMuted }, children: [
2159
+ /* @__PURE__ */ jsx("span", { children: state.selectedCommit.author }),
2160
+ /* @__PURE__ */ jsx("span", { css: { margin: "0 8px" }, children: "\u2022" }),
2161
+ /* @__PURE__ */ jsx("span", { children: state.selectedCommit.date }),
2162
+ /* @__PURE__ */ jsx("span", { css: { margin: "0 8px" }, children: "\u2022" }),
2163
+ /* @__PURE__ */ jsx("code", { css: { color: colors.accent }, children: state.selectedCommit.shortSha })
2164
+ ] })
2165
+ ]
2166
+ }
2167
+ ),
2168
+ /* @__PURE__ */ jsx("div", { css: { flex: 1, overflow: "auto" }, children: state.diff ? /* @__PURE__ */ jsx(
2169
+ "section",
2170
+ {
2171
+ css: {
2172
+ "& .d2h-wrapper": { background: "transparent" },
2173
+ "& .d2h-file-header": {
2174
+ background: colors.bgLighter,
2175
+ borderBottom: `1px solid ${colors.border}`,
2176
+ padding: "8px 12px"
2177
+ },
2178
+ "& .d2h-file-name": { color: colors.text },
2179
+ "& .d2h-code-line": { padding: "0 8px" },
2180
+ "& .d2h-code-line-ctn": { color: colors.text },
2181
+ "& .d2h-ins": { background: "#dafbe1" },
2182
+ "& .d2h-del": { background: "#ffebe9" },
2183
+ "& .d2h-ins .d2h-code-line-ctn": { color: colors.green },
2184
+ "& .d2h-del .d2h-code-line-ctn": { color: colors.red },
2185
+ "& .d2h-code-linenumber": {
2186
+ color: colors.textMuted,
2187
+ borderRight: `1px solid ${colors.border}`
2188
+ },
2189
+ "& .d2h-file-diff": {
2190
+ borderBottom: `1px solid ${colors.border}`
2191
+ },
2192
+ "& .d2h-diff-tbody": { position: "relative" }
2193
+ },
2194
+ innerHTML: state.diff.diffHtml
2195
+ }
2196
+ ) : /* @__PURE__ */ jsx(
2197
+ "div",
2198
+ {
2199
+ css: {
2200
+ padding: "20px",
2201
+ textAlign: "center",
2202
+ color: colors.textMuted
2203
+ },
2204
+ children: "Loading diff..."
2205
+ }
2206
+ ) })
2207
+ ]
2208
+ }
2209
+ );
2210
+ };
2211
+ }
2212
+ createRoot(document.body).render(/* @__PURE__ */ jsx(App, {}));