@carbonplan/components 13.2.2 → 13.3.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.
package/dst/index.mjs ADDED
@@ -0,0 +1,3585 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ var __export = (target, all) => {
33
+ for (var name in all)
34
+ __defProp(target, name, { get: all[name], enumerable: true });
35
+ };
36
+
37
+ // src/avatar.tsx
38
+ import React from "react";
39
+ import { Box, Image } from "theme-ui";
40
+ var Avatar = (_a) => {
41
+ var _b = _a, {
42
+ color = "transparent",
43
+ width = "90px",
44
+ maxWidth,
45
+ name,
46
+ github,
47
+ alt,
48
+ src,
49
+ sx: sx3
50
+ } = _b, props = __objRest(_b, [
51
+ "color",
52
+ "width",
53
+ "maxWidth",
54
+ "name",
55
+ "github",
56
+ "alt",
57
+ "src",
58
+ "sx"
59
+ ]);
60
+ if (!name && !src && !github) {
61
+ console.warn("must specify either name, github, or src");
62
+ }
63
+ let srcProp, altProp;
64
+ if (name) {
65
+ srcProp = `https://images.carbonplan.org/team/${name.toLowerCase().replaceAll(" ", "-")}.png`;
66
+ altProp = alt || name;
67
+ } else if (github) {
68
+ srcProp = `https://github.com/${github}.png`;
69
+ altProp = alt || github;
70
+ } else {
71
+ srcProp = src;
72
+ altProp = alt;
73
+ }
74
+ return /* @__PURE__ */ React.createElement(
75
+ Box,
76
+ __spreadValues({
77
+ sx: __spreadValues({
78
+ width,
79
+ maxWidth,
80
+ height: "auto",
81
+ borderRadius: "50%",
82
+ overflow: "hidden",
83
+ position: "relative",
84
+ display: "inline-block",
85
+ verticalAlign: "top"
86
+ }, sx3)
87
+ }, props),
88
+ /* @__PURE__ */ React.createElement(
89
+ Image,
90
+ {
91
+ alt: altProp,
92
+ src: srcProp,
93
+ sx: {
94
+ filter: color && color !== "transparent" ? "grayscale(100%) contrast(200%) brightness(100%)" : "none",
95
+ width: "100%",
96
+ display: "block"
97
+ }
98
+ }
99
+ ),
100
+ color && color !== "transparent" && /* @__PURE__ */ React.createElement(
101
+ Box,
102
+ {
103
+ sx: {
104
+ position: "absolute",
105
+ top: 0,
106
+ bg: color,
107
+ width: "100%",
108
+ height: "100%",
109
+ opacity: 0.75,
110
+ pointerEvents: "none"
111
+ }
112
+ }
113
+ )
114
+ );
115
+ };
116
+ var avatar_default = Avatar;
117
+
118
+ // src/avatar-group.tsx
119
+ import React5 from "react";
120
+ import { Box as Box4 } from "theme-ui";
121
+
122
+ // src/row.tsx
123
+ import React2 from "react";
124
+ import { Grid } from "theme-ui";
125
+ var Row = (_a) => {
126
+ var _b = _a, { children, sx: sx3, columns, gap } = _b, props = __objRest(_b, ["children", "sx", "columns", "gap"]);
127
+ const makeArray = (input) => {
128
+ if (!Array.isArray(input)) {
129
+ input = [input, input, input, input];
130
+ }
131
+ if (Array.isArray(input) && ![1, 2, 4].includes(input.length)) {
132
+ throw new Error("Array length must be 1, 2, or 4");
133
+ }
134
+ if (Array.isArray(input) && input.length === 1) {
135
+ input = input.map((d) => [d]).flat();
136
+ }
137
+ if (Array.isArray(input) && input.length === 2) {
138
+ input = input.map((d) => [d, d]).flat();
139
+ }
140
+ return input;
141
+ };
142
+ let columnGap, rowGap;
143
+ if (Number.isInteger(gap) || Array.isArray(gap)) {
144
+ gap = makeArray(gap);
145
+ columnGap = gap;
146
+ rowGap = gap;
147
+ } else {
148
+ columnGap = [4, 5, 5, 6];
149
+ rowGap = [0, 0, 0, 0];
150
+ }
151
+ if (Number.isInteger(columns) || Array.isArray(columns)) {
152
+ columns = makeArray(columns);
153
+ } else {
154
+ columns = [6, 8, 12, 12];
155
+ }
156
+ return /* @__PURE__ */ React2.createElement(
157
+ Grid,
158
+ __spreadProps(__spreadValues({}, props), {
159
+ columns,
160
+ sx: __spreadValues({
161
+ columnGap,
162
+ rowGap
163
+ }, sx3)
164
+ }),
165
+ children
166
+ );
167
+ };
168
+ var row_default = Row;
169
+
170
+ // src/column.tsx
171
+ import React3 from "react";
172
+ import { Box as Box2 } from "theme-ui";
173
+ var Column = (_a) => {
174
+ var _b = _a, {
175
+ start,
176
+ width,
177
+ dl,
178
+ dr,
179
+ children,
180
+ sx: sx3
181
+ } = _b, props = __objRest(_b, [
182
+ "start",
183
+ "width",
184
+ "dl",
185
+ "dr",
186
+ "children",
187
+ "sx"
188
+ ]);
189
+ start = start || "auto";
190
+ width = width || "auto";
191
+ const makeArray = (input) => {
192
+ let arr = Array.isArray(input) ? input : [input];
193
+ if (![1, 2, 4].includes(arr.length)) {
194
+ throw new Error("Array length must be 1, 2, or 4");
195
+ }
196
+ if (arr.length === 1) {
197
+ arr = arr.map((d) => [d, d, d, d]).flat();
198
+ } else if (arr.length === 2) {
199
+ arr = arr.map((d) => [d, d]).flat();
200
+ }
201
+ return arr;
202
+ };
203
+ const startArray = makeArray(start);
204
+ const widthArray = makeArray(width);
205
+ const end = startArray.map((d, i) => {
206
+ if (d === "auto" || widthArray[i] === "auto") return "auto";
207
+ return d + widthArray[i];
208
+ });
209
+ let ml, mr;
210
+ if (dl) {
211
+ if (![0.5, 1].includes(dl)) {
212
+ throw new Error("dl must be 0.5 or 1");
213
+ }
214
+ if (dl === 0.5) {
215
+ ml = ["-12px", -3, -3, -4];
216
+ }
217
+ if (dl === 1) {
218
+ ml = [-4, -5, -5, -6];
219
+ }
220
+ }
221
+ if (dr) {
222
+ if (![0.5, 1].includes(dr)) {
223
+ throw new Error("dr must be 0.5 or 1");
224
+ }
225
+ if (dr === 0.5) {
226
+ mr = ["-12px", -3, -3, -4];
227
+ }
228
+ if (dr === 1) {
229
+ mr = [-4, -5, -5, -6];
230
+ }
231
+ }
232
+ return /* @__PURE__ */ React3.createElement(
233
+ Box2,
234
+ __spreadProps(__spreadValues({}, props), {
235
+ sx: __spreadValues({
236
+ gridColumnStart: startArray,
237
+ gridColumnEnd: end,
238
+ ml,
239
+ mr
240
+ }, sx3)
241
+ }),
242
+ children
243
+ );
244
+ };
245
+ var column_default = Column;
246
+
247
+ // src/group.tsx
248
+ import React4 from "react";
249
+ import { Box as Box3 } from "theme-ui";
250
+ var sizes = {
251
+ xs: [1],
252
+ sm: [3],
253
+ md: [5],
254
+ lg: [7],
255
+ xl: [9]
256
+ };
257
+ var Group = ({
258
+ children,
259
+ direction = "vertical",
260
+ spacing = "md",
261
+ sx: sx3
262
+ }) => {
263
+ let marginValue;
264
+ if (typeof spacing === "string" && spacing in sizes) {
265
+ marginValue = sizes[spacing];
266
+ } else {
267
+ marginValue = spacing;
268
+ }
269
+ if (!["horizontal", "vertical"].includes(direction)) {
270
+ throw new Error(
271
+ "Invalid direction value. Must be either horizontal or vertical"
272
+ );
273
+ }
274
+ const marginProperty = direction === "vertical" ? "mb" : "mr";
275
+ const additionalStyles = direction === "horizontal" ? { display: "inline-block" } : {};
276
+ return /* @__PURE__ */ React4.createElement(Box3, { sx: sx3 }, React4.Children.map(children, (child, i) => {
277
+ const childrenCount = React4.Children.count(children);
278
+ return /* @__PURE__ */ React4.createElement(
279
+ Box3,
280
+ {
281
+ sx: __spreadValues({
282
+ [marginProperty]: i < childrenCount - 1 ? marginValue : 0
283
+ }, additionalStyles)
284
+ },
285
+ child
286
+ );
287
+ }));
288
+ };
289
+ var group_default = Group;
290
+
291
+ // src/avatar-group.tsx
292
+ var sizes2 = {
293
+ xs: [1],
294
+ sm: [3],
295
+ md: [5],
296
+ lg: [7],
297
+ xl: [9]
298
+ };
299
+ var Blank = ({ overflow, maxWidth }) => {
300
+ return /* @__PURE__ */ React5.createElement(
301
+ Box4,
302
+ {
303
+ sx: {
304
+ bg: "muted",
305
+ height: "100%",
306
+ maxWidth,
307
+ borderRadius: "50%"
308
+ }
309
+ },
310
+ /* @__PURE__ */ React5.createElement(
311
+ Box4,
312
+ {
313
+ sx: {
314
+ display: "flex",
315
+ justifyContent: "center",
316
+ alignItems: "center",
317
+ height: "100%"
318
+ }
319
+ },
320
+ /* @__PURE__ */ React5.createElement(
321
+ Box4,
322
+ {
323
+ sx: {
324
+ fontFamily: "mono",
325
+ letterSpacing: "mono",
326
+ fontSize: [3, 3, 3, 4]
327
+ }
328
+ },
329
+ "+",
330
+ overflow
331
+ )
332
+ )
333
+ );
334
+ };
335
+ var AvatarGroup = (_a) => {
336
+ var _b = _a, {
337
+ members,
338
+ direction = "horizontal",
339
+ align,
340
+ spacing = "md",
341
+ limit,
342
+ width,
343
+ maxWidth,
344
+ fixedCount,
345
+ sx: sx3
346
+ } = _b, props = __objRest(_b, [
347
+ "members",
348
+ "direction",
349
+ "align",
350
+ "spacing",
351
+ "limit",
352
+ "width",
353
+ "maxWidth",
354
+ "fixedCount",
355
+ "sx"
356
+ ]);
357
+ let gap;
358
+ if (typeof spacing === "string" && spacing in sizes2) {
359
+ gap = sizes2[spacing];
360
+ } else {
361
+ gap = spacing;
362
+ }
363
+ let start = (_idx) => "auto";
364
+ if (align) {
365
+ const alignArray = Array.isArray(align) ? align : [align];
366
+ start = (idx) => {
367
+ return alignArray.map((d) => {
368
+ if (d === "left") {
369
+ return "auto";
370
+ } else if (d === "right") {
371
+ const offset = Math.max(0, (fixedCount != null ? fixedCount : 0) - members.length);
372
+ return (offset + idx) % (fixedCount != null ? fixedCount : 1) + 1;
373
+ } else {
374
+ throw Error(`alignment '${d}' not recognized`);
375
+ }
376
+ });
377
+ };
378
+ }
379
+ const excess = limit !== void 0 && members.length > limit;
380
+ const overflow = limit !== void 0 ? members.length - limit + 1 : 0;
381
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, fixedCount && /* @__PURE__ */ React5.createElement(row_default, __spreadValues({ columns: fixedCount, gap, sx: sx3 }, props), members.map((props2, idx) => /* @__PURE__ */ React5.createElement(column_default, { key: idx, start: start(idx) }, (!excess || limit !== void 0 && idx < limit - 1) && /* @__PURE__ */ React5.createElement(avatar_default, __spreadProps(__spreadValues({}, props2), { width, maxWidth })), excess && limit !== void 0 && idx === limit - 1 && /* @__PURE__ */ React5.createElement(Blank, { overflow, maxWidth })))), !fixedCount && /* @__PURE__ */ React5.createElement(group_default, __spreadValues({ direction, spacing, sx: sx3 }, props), members.map((props2, idx) => /* @__PURE__ */ React5.createElement(avatar_default, __spreadProps(__spreadValues({ key: idx }, props2), { width, maxWidth })))));
382
+ };
383
+ var avatar_group_default = AvatarGroup;
384
+
385
+ // src/badge.tsx
386
+ import React6 from "react";
387
+ import { Box as Box5 } from "theme-ui";
388
+ import { transparentize } from "@theme-ui/color";
389
+
390
+ // src/utils/get-sx-color.ts
391
+ var getSxColor = (sx3, fallback = "primary") => sx3 && typeof sx3 === "object" && "color" in sx3 && typeof sx3.color === "string" ? sx3.color : fallback;
392
+ var get_sx_color_default = getSxColor;
393
+
394
+ // src/badge.tsx
395
+ var Badge = (_a) => {
396
+ var _b = _a, { sx: sx3, children } = _b, props = __objRest(_b, ["sx", "children"]);
397
+ const color = get_sx_color_default(sx3);
398
+ return /* @__PURE__ */ React6.createElement(
399
+ Box5,
400
+ __spreadValues({
401
+ sx: __spreadValues({
402
+ display: "inline-block",
403
+ width: "fit-content",
404
+ height: ["24px", "24px", "24px", "26px"],
405
+ borderRadius: "5px",
406
+ backgroundColor: color === "primary" || color === "secondary" ? "muted" : transparentize(color, 0.7),
407
+ textAlign: "center",
408
+ userSelect: "none",
409
+ fontSize: [2, 2, 2, 3]
410
+ }, sx3)
411
+ }, props),
412
+ /* @__PURE__ */ React6.createElement(
413
+ Box5,
414
+ {
415
+ sx: {
416
+ letterSpacing: "0.02em",
417
+ fontFamily: "mono",
418
+ mt: ["1px", "1px", "1px", "0px"],
419
+ px: [1, 1, 1, "5px"],
420
+ color
421
+ }
422
+ },
423
+ children
424
+ )
425
+ );
426
+ };
427
+ var badge_default = Badge;
428
+
429
+ // src/blockquote.tsx
430
+ import React7, { Children } from "react";
431
+ import { Box as Box6 } from "theme-ui";
432
+ var specialChars = ["\u201C", '"', "'", "\u2018"];
433
+ var Blockquote = ({ children }) => {
434
+ return /* @__PURE__ */ React7.createElement(Box6, { variant: "styles.blockquote" }, Children.map(children, (d) => {
435
+ let firstChar = "";
436
+ let remaining = d;
437
+ if (React7.isValidElement(d) && typeof d.props.children === "string") {
438
+ firstChar = d.props.children.slice(0, 1);
439
+ remaining = d.props.children.slice(1);
440
+ } else if (typeof d === "string") {
441
+ firstChar = d.slice(0, 1);
442
+ remaining = d.slice(1);
443
+ }
444
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, specialChars.includes(firstChar) && /* @__PURE__ */ React7.createElement(Box6, { as: "span", sx: { position: "absolute", ml: "-0.4em" } }, firstChar), specialChars.includes(firstChar) ? remaining : d);
445
+ }));
446
+ };
447
+ var blockquote_default = Blockquote;
448
+
449
+ // src/button.tsx
450
+ import React9, { forwardRef as forwardRef2, cloneElement } from "react";
451
+ import { Box as Box7 } from "theme-ui";
452
+
453
+ // src/link.tsx
454
+ import React8, { forwardRef } from "react";
455
+ import { Link as ThemedLink } from "theme-ui";
456
+ import { default as NextLink } from "next/link";
457
+ var Link = (_a, ref) => {
458
+ var _b = _a, { href, children, internal = false } = _b, props = __objRest(_b, ["href", "children", "internal"]);
459
+ if (href && (internal || href.startsWith("/"))) {
460
+ return /* @__PURE__ */ React8.createElement(NextLink, { href, passHref: true, legacyBehavior: true }, /* @__PURE__ */ React8.createElement(ThemedLink, __spreadValues({ ref }, props), children));
461
+ } else {
462
+ return /* @__PURE__ */ React8.createElement(ThemedLink, __spreadValues({ ref, href }, props), children);
463
+ }
464
+ };
465
+ var link_default = forwardRef(Link);
466
+
467
+ // src/utils/get-size-styles.ts
468
+ var getSizeStyles = (size) => {
469
+ if (!["xs", "sm", "md", "lg", "xl"].includes(size)) {
470
+ throw new Error("Size must be xs, sm, md, lg, or xl");
471
+ }
472
+ let fontSize, fontFamily, letterSpacing, lineHeight;
473
+ if (size === "xs") {
474
+ fontSize = [2, 2, 2, 3];
475
+ fontFamily = "body";
476
+ letterSpacing = "body";
477
+ lineHeight = [1.2];
478
+ }
479
+ if (size === "sm") {
480
+ fontSize = [3, 3, 3, 4];
481
+ fontFamily = "body";
482
+ letterSpacing = "body";
483
+ lineHeight = [1.2];
484
+ }
485
+ if (size === "md") {
486
+ fontSize = [4, 4, 4, 5];
487
+ fontFamily = "body";
488
+ letterSpacing = "body";
489
+ lineHeight = [1.2];
490
+ }
491
+ if (size === "lg") {
492
+ fontSize = [5, 5, 6, 7];
493
+ fontFamily = "heading";
494
+ letterSpacing = "heading";
495
+ lineHeight = [1.2, 1.2, 1.25, 1.25];
496
+ }
497
+ if (size === "xl") {
498
+ fontSize = [6, 7, 8, 9];
499
+ fontFamily = "heading";
500
+ letterSpacing = "heading";
501
+ lineHeight = [1.25];
502
+ }
503
+ return { fontSize, fontFamily, letterSpacing, lineHeight };
504
+ };
505
+ var get_size_styles_default = getSizeStyles;
506
+
507
+ // src/button.tsx
508
+ var hasHoverProp = (comp) => {
509
+ if (comp == null) return false;
510
+ const isObjectOrFunction = typeof comp === "object" || typeof comp === "function";
511
+ return isObjectOrFunction && "hover" in comp;
512
+ };
513
+ var Button = (_a, ref) => {
514
+ var _b = _a, {
515
+ size = "sm",
516
+ prefix,
517
+ suffix,
518
+ inverted,
519
+ sx: sx3,
520
+ children,
521
+ align,
522
+ href,
523
+ internal
524
+ } = _b, props = __objRest(_b, [
525
+ "size",
526
+ "prefix",
527
+ "suffix",
528
+ "inverted",
529
+ "sx",
530
+ "children",
531
+ "align",
532
+ "href",
533
+ "internal"
534
+ ]);
535
+ var _b2, _c;
536
+ if (!["xs", "sm", "md", "lg", "xl"].includes(size)) {
537
+ throw new Error("Size must be xs, sm, md, lg, or xl");
538
+ }
539
+ const _a2 = sx3 && typeof sx3 === "object" ? sx3 : {}, { color: sxColor } = _a2, sxProp = __objRest(_a2, ["color"]);
540
+ const baseColor = typeof sxColor === "string" && sxColor || (inverted ? "secondary" : "primary");
541
+ const hoverColor = sxColor ? "primary" : inverted ? "primary" : "secondary";
542
+ const sizeConfig = {
543
+ xs: {
544
+ margin: ["6px", "6px", "6px", "6px"],
545
+ height: [12, 12, 12, 13],
546
+ width: [12, 12, 12, 13],
547
+ strokeWidth: [1.5, 1.5, 1.5, 1.5],
548
+ offset: { transform: "translateY(0.25px)" }
549
+ },
550
+ sm: {
551
+ margin: ["7px", "7px", "7px", "7px"],
552
+ height: [13, 13, 13, 18],
553
+ width: [13, 13, 13, 18],
554
+ strokeWidth: [1.5, 1.5, 1.5, 2],
555
+ offset: { transform: "translateY(0.25px)" }
556
+ },
557
+ md: {
558
+ margin: ["8px", "8px", "8px", "8px"],
559
+ height: [18, 18, 18, 24],
560
+ width: [18, 18, 18, 24],
561
+ strokeWidth: [2, 2, 2, 3],
562
+ offset: {}
563
+ },
564
+ lg: {
565
+ margin: ["10px", "10px", "12px", "16px"],
566
+ height: [24, 24, 34, 46],
567
+ width: [24, 24, 34, 46],
568
+ strokeWidth: [3, 3, 4, 5],
569
+ offset: {}
570
+ },
571
+ xl: {
572
+ margin: ["12px", "16px", "18px", "20px"],
573
+ height: [34, 46, 56, 68],
574
+ width: [34, 46, 56, 68],
575
+ strokeWidth: [4, 5, 6, 7],
576
+ offset: {}
577
+ }
578
+ };
579
+ const { margin, height, width, strokeWidth, offset } = sizeConfig[size];
580
+ let prefixHover, suffixHover, prefixAlign, suffixAlign, prefixOffset, suffixOffset;
581
+ if (align) {
582
+ prefixAlign = align;
583
+ suffixAlign = align;
584
+ } else {
585
+ if (prefix && suffix) {
586
+ prefixAlign = "initial";
587
+ suffixAlign = "initial";
588
+ } else if (prefix) {
589
+ prefixAlign = "initial";
590
+ } else if (suffix) {
591
+ suffixAlign = "middle";
592
+ }
593
+ }
594
+ if (prefixAlign === "middle") {
595
+ prefixOffset = {};
596
+ } else {
597
+ prefixOffset = offset;
598
+ }
599
+ if (suffixAlign === "middle") {
600
+ suffixOffset = {};
601
+ } else {
602
+ suffixOffset = offset;
603
+ }
604
+ let clonedPrefix, clonedSuffix;
605
+ if (prefix) {
606
+ prefixHover = {
607
+ "&:hover > #prefix-span > #prefix": __spreadValues({
608
+ color: hoverColor
609
+ }, hasHoverProp(prefix.type) ? prefix.type.hover : {})
610
+ };
611
+ clonedPrefix = cloneElement(prefix, {
612
+ id: "prefix",
613
+ sx: __spreadValues({
614
+ position: "relative",
615
+ height,
616
+ width,
617
+ mr: children ? margin : [0],
618
+ strokeWidth,
619
+ verticalAlign: prefixAlign,
620
+ transition: "color 0.15s, transform 0.15s"
621
+ }, (_b2 = prefix.props) == null ? void 0 : _b2.sx)
622
+ });
623
+ }
624
+ if (suffix) {
625
+ suffixHover = {
626
+ "&:hover > #suffix-span >#suffix": __spreadValues({
627
+ color: hoverColor
628
+ }, hasHoverProp(suffix.type) ? suffix.type.hover : {})
629
+ };
630
+ clonedSuffix = cloneElement(suffix, {
631
+ id: "suffix",
632
+ sx: __spreadValues({
633
+ height,
634
+ width,
635
+ ml: children ? margin : [0],
636
+ strokeWidth,
637
+ verticalAlign: suffixAlign,
638
+ transition: "color 0.15s, transform 0.15s"
639
+ }, (_c = suffix.props) == null ? void 0 : _c.sx)
640
+ });
641
+ }
642
+ let sizeStyles = get_size_styles_default(size);
643
+ const style = __spreadValues(__spreadProps(__spreadValues({}, sizeStyles), {
644
+ lineHeight: 1.05,
645
+ border: "none",
646
+ background: "transparent",
647
+ display: "block",
648
+ color: baseColor,
649
+ padding: [0],
650
+ textAlign: "left",
651
+ cursor: "pointer",
652
+ width: "fit-content",
653
+ "@media (hover: hover) and (pointer: fine)": __spreadValues(__spreadValues({
654
+ "&:hover": {
655
+ color: hoverColor
656
+ }
657
+ }, suffixHover), prefixHover)
658
+ }), sxProp);
659
+ const Inner = /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
660
+ Box7,
661
+ {
662
+ as: "span",
663
+ id: "prefix-span",
664
+ sx: __spreadValues({ display: "inline-block" }, prefixOffset)
665
+ },
666
+ clonedPrefix
667
+ ), /* @__PURE__ */ React9.createElement(Box7, { as: "span", sx: { transition: "color 0.15s" } }, children), /* @__PURE__ */ React9.createElement(
668
+ Box7,
669
+ {
670
+ as: "span",
671
+ id: "suffix-span",
672
+ sx: __spreadValues({ display: "inline-block" }, suffixOffset)
673
+ },
674
+ clonedSuffix
675
+ ));
676
+ if (href) {
677
+ return /* @__PURE__ */ React9.createElement(
678
+ link_default,
679
+ __spreadProps(__spreadValues({
680
+ ref,
681
+ internal,
682
+ sx: __spreadProps(__spreadValues({}, style), {
683
+ textDecoration: "none"
684
+ })
685
+ }, props), {
686
+ href
687
+ }),
688
+ Inner
689
+ );
690
+ } else {
691
+ return /* @__PURE__ */ React9.createElement(
692
+ Box7,
693
+ __spreadValues({
694
+ ref,
695
+ as: "button",
696
+ sx: style
697
+ }, props),
698
+ Inner
699
+ );
700
+ }
701
+ };
702
+ var button_default = forwardRef2(
703
+ Button
704
+ );
705
+
706
+ // src/callout.tsx
707
+ import React10, { forwardRef as forwardRef3 } from "react";
708
+ import { Box as Box8 } from "theme-ui";
709
+ import { Arrow } from "@carbonplan/icons";
710
+ var Callout = (_a, ref) => {
711
+ var _b = _a, {
712
+ label,
713
+ children,
714
+ inverted,
715
+ color,
716
+ href,
717
+ internal,
718
+ sx: sx3
719
+ } = _b, props = __objRest(_b, [
720
+ "label",
721
+ "children",
722
+ "inverted",
723
+ "color",
724
+ "href",
725
+ "internal",
726
+ "sx"
727
+ ]);
728
+ const baseColor = color || (inverted ? "secondary" : "primary");
729
+ const hoverColor = color ? "primary" : inverted ? "primary" : "secondary";
730
+ const style = __spreadValues({
731
+ border: "none",
732
+ padding: [0],
733
+ fontSize: [3, 3, 3, 4],
734
+ color: baseColor,
735
+ background: "transparent",
736
+ textDecoration: "none",
737
+ fontFamily: "body",
738
+ lineHeight: "h3",
739
+ letterSpacing: "body",
740
+ width: "fit-content",
741
+ cursor: "pointer",
742
+ textAlign: "left",
743
+ mb: [1],
744
+ "@media (hover: hover) and (pointer: fine)": {
745
+ "&:hover > #container > #arrow": {
746
+ transform: "rotate(45deg)",
747
+ fill: hoverColor
748
+ },
749
+ "&:hover": {
750
+ color: hoverColor
751
+ }
752
+ }
753
+ }, sx3);
754
+ const Inner = /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(Box8, { sx: { transition: "0.15s", letterSpacing: "body", pb: ["6px"] } }, children), /* @__PURE__ */ React10.createElement(
755
+ Box8,
756
+ {
757
+ sx: {
758
+ transition: "0.15s",
759
+ display: "inline-block",
760
+ textTransform: "uppercase",
761
+ letterSpacing: "smallcaps",
762
+ fontFamily: "heading",
763
+ fontSize: [2, 2, 2, 3]
764
+ }
765
+ },
766
+ label
767
+ ), /* @__PURE__ */ React10.createElement(
768
+ Box8,
769
+ {
770
+ as: "span",
771
+ id: "container",
772
+ sx: {
773
+ ml: [2],
774
+ display: "inline-block"
775
+ }
776
+ },
777
+ /* @__PURE__ */ React10.createElement(
778
+ Arrow,
779
+ {
780
+ id: "arrow",
781
+ sx: {
782
+ transition: "fill 0.15s, transform 0.15s",
783
+ position: "relative",
784
+ top: ["2px"],
785
+ color: baseColor,
786
+ height: [15, 15, 15, 17],
787
+ width: [15, 15, 15, 17]
788
+ }
789
+ }
790
+ )
791
+ ));
792
+ if (href) {
793
+ return /* @__PURE__ */ React10.createElement(
794
+ link_default,
795
+ __spreadValues({
796
+ ref,
797
+ href,
798
+ internal,
799
+ sx: style
800
+ }, props),
801
+ Inner
802
+ );
803
+ } else {
804
+ return /* @__PURE__ */ React10.createElement(
805
+ Box8,
806
+ __spreadValues({
807
+ ref,
808
+ as: "button",
809
+ sx: style
810
+ }, props),
811
+ Inner
812
+ );
813
+ }
814
+ };
815
+ var callout_default = forwardRef3(
816
+ Callout
817
+ );
818
+
819
+ // src/caption.tsx
820
+ import React11 from "react";
821
+ import { Box as Box9 } from "theme-ui";
822
+ var Caption = ({
823
+ as = "figcaption",
824
+ number,
825
+ children,
826
+ label = "figure"
827
+ }) => {
828
+ return /* @__PURE__ */ React11.createElement(
829
+ Box9,
830
+ {
831
+ as,
832
+ sx: {
833
+ color: "secondary",
834
+ display: "block",
835
+ textAlign: "left",
836
+ fontSize: [2, 2, 2, 3],
837
+ "& a": { color: "secondary" },
838
+ "& a:hover": { color: "primary" },
839
+ "& > p": {
840
+ display: "inline",
841
+ fontSize: [2, 2, 2, 3]
842
+ }
843
+ }
844
+ },
845
+ number && /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
846
+ Box9,
847
+ {
848
+ sx: {
849
+ textTransform: "uppercase",
850
+ letterSpacing: "smallcaps",
851
+ display: "inline-block"
852
+ }
853
+ },
854
+ label,
855
+ " ",
856
+ number
857
+ ), " ", /* @__PURE__ */ React11.createElement(Box9, { sx: { display: "inline-block", mx: [1], pr: [1] } }, "/")),
858
+ children
859
+ );
860
+ };
861
+ var caption_default = Caption;
862
+
863
+ // src/colorbar.tsx
864
+ import React12, {
865
+ useState,
866
+ useEffect,
867
+ useRef
868
+ } from "react";
869
+ import {
870
+ Box as Box10,
871
+ Flex,
872
+ get
873
+ } from "theme-ui";
874
+ var styles = {
875
+ clim: (setClim) => {
876
+ return {
877
+ bg: "unset",
878
+ border: "none",
879
+ color: "primary",
880
+ px: 0,
881
+ fontFamily: "mono",
882
+ fontSize: ["9px", 0, 0, 1],
883
+ letterSpacing: "smallcaps",
884
+ textTransform: "uppercase",
885
+ transition: "border 0.15s",
886
+ // !important suffix isn't representable in CSS property types
887
+ userSelect: setClim ? "none !important" : "unset",
888
+ width: "fit-content",
889
+ minWidth: "fit-content"
890
+ };
891
+ }
892
+ };
893
+ var DIMENSIONS = {
894
+ width: ["10px", "16px", "16px", "17px"],
895
+ height: ["80px", "110px", "110px", "130px"]
896
+ };
897
+ var hexToRgb = (hex) => {
898
+ let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
899
+ return result ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(
900
+ result[3],
901
+ 16
902
+ )}` : null;
903
+ };
904
+ var Gradient = ({
905
+ colormap,
906
+ discrete,
907
+ horizontal,
908
+ width,
909
+ height
910
+ }) => {
911
+ const hasColors = colormap.length > 0;
912
+ const step = hasColors ? 1 / colormap.length * 100 : 0;
913
+ const firstColor = colormap[0];
914
+ const isHex = typeof firstColor === "string" && firstColor.startsWith("#");
915
+ const values = colormap.map((color, i) => {
916
+ const normalizedColor = String(color);
917
+ const rgbColor = isHex ? hexToRgb(normalizedColor) : normalizedColor;
918
+ const position = `${i * step}% ${discrete && i < colormap.length - 1 ? `${(i + 1) * step}%` : ""}`;
919
+ return `rgb(${rgbColor}) ${position}`;
920
+ });
921
+ const css = values.length > 0 ? `linear-gradient(to ${horizontal ? "right" : "top"}, ${values.join(
922
+ ","
923
+ )})` : "none";
924
+ return /* @__PURE__ */ React12.createElement(
925
+ Box10,
926
+ {
927
+ sx: __spreadProps(__spreadValues({}, horizontal ? {
928
+ width: width || DIMENSIONS.height,
929
+ height: height || DIMENSIONS.width
930
+ } : {
931
+ width: width || DIMENSIONS.width,
932
+ minHeight: height || DIMENSIONS.height
933
+ }), {
934
+ mt: horizontal ? ["1px", "1px", "1px", 0] : 0,
935
+ border: (t) => `solid 1px ${get(t, "colors.hinted")}`,
936
+ background: css
937
+ })
938
+ }
939
+ );
940
+ };
941
+ var Label = ({
942
+ label,
943
+ units,
944
+ horizontal
945
+ }) => /* @__PURE__ */ React12.createElement(
946
+ Box10,
947
+ {
948
+ sx: horizontal ? void 0 : {
949
+ width: ["13px", "17px", "17px", "19px"],
950
+ alignSelf: "flex-end"
951
+ }
952
+ },
953
+ /* @__PURE__ */ React12.createElement(
954
+ Box10,
955
+ {
956
+ sx: __spreadValues({
957
+ mb: horizontal ? 0 : ["-4px", "-4px", "-4px", "-3px"],
958
+ fontFamily: "mono",
959
+ fontSize: ["9px", 0, 0, 1],
960
+ letterSpacing: "smallcaps",
961
+ textTransform: "uppercase"
962
+ }, horizontal ? {} : {
963
+ writingMode: "vertical-rl",
964
+ transform: "rotate(180deg)",
965
+ whiteSpace: "nowrap",
966
+ display: "inline-block",
967
+ overflow: "visible"
968
+ })
969
+ },
970
+ label,
971
+ " ",
972
+ /* @__PURE__ */ React12.createElement(
973
+ Box10,
974
+ {
975
+ as: "span",
976
+ sx: {
977
+ textTransform: "none",
978
+ color: "secondary",
979
+ display: "inline-block"
980
+ }
981
+ },
982
+ units
983
+ )
984
+ )
985
+ );
986
+ var Colorbar = (_a) => {
987
+ var _b = _a, {
988
+ colormap,
989
+ label,
990
+ clim,
991
+ setClim,
992
+ setClimStep = 1,
993
+ discrete,
994
+ units,
995
+ width,
996
+ height,
997
+ format: format2 = (d) => d,
998
+ horizontal = false,
999
+ bottom = false,
1000
+ sx: sx3,
1001
+ sxClim
1002
+ } = _b, props = __objRest(_b, [
1003
+ "colormap",
1004
+ "label",
1005
+ "clim",
1006
+ "setClim",
1007
+ "setClimStep",
1008
+ "discrete",
1009
+ "units",
1010
+ "width",
1011
+ "height",
1012
+ "format",
1013
+ "horizontal",
1014
+ "bottom",
1015
+ "sx",
1016
+ "sxClim"
1017
+ ]);
1018
+ if (!Array.isArray(colormap)) {
1019
+ throw new Error(`expected array for colormap, got '${colormap}'.`);
1020
+ }
1021
+ const climRef = [useRef(), useRef()];
1022
+ const [climMinDragging, setClimMinDragging] = useState(false);
1023
+ const [climMaxDragging, setClimMaxDragging] = useState(false);
1024
+ let x, y, dx, dy = 0;
1025
+ let id = null;
1026
+ let init2 = [0, 0];
1027
+ let scale = setClimStep;
1028
+ const draggingFunction = (e) => {
1029
+ if (!setClim) return;
1030
+ if (id === "min" && !climMinDragging) setClimMinDragging(true);
1031
+ if (id === "max" && !climMaxDragging) setClimMaxDragging(true);
1032
+ dx = e.pageX - x;
1033
+ dy = e.pageY - y;
1034
+ if (horizontal) {
1035
+ if (id === "min")
1036
+ setClim((prev) => [Math.min(init2[0] + dx * scale, init2[1]), prev[1]]);
1037
+ if (id === "max")
1038
+ setClim((prev) => [prev[0], Math.max(init2[1] + dx * scale, init2[0])]);
1039
+ } else {
1040
+ if (id === "min")
1041
+ setClim((prev) => [Math.min(init2[0] - dy * scale, init2[1]), prev[1]]);
1042
+ if (id === "max")
1043
+ setClim((prev) => [prev[0], Math.max(init2[1] - dy * scale, init2[0])]);
1044
+ }
1045
+ };
1046
+ const handleMouseDown = (e) => {
1047
+ y = e.pageY;
1048
+ x = e.pageX;
1049
+ id = e.currentTarget.id;
1050
+ init2 = clim;
1051
+ document.body.setAttribute(
1052
+ "style",
1053
+ horizontal ? "cursor: ew-resize !important" : "cursor: ns-resize !important"
1054
+ );
1055
+ document.addEventListener("mousemove", draggingFunction);
1056
+ const updater = () => {
1057
+ document.body.setAttribute("style", "cursor: unset");
1058
+ document.removeEventListener("mousemove", draggingFunction);
1059
+ window.removeEventListener("mouseup", updater);
1060
+ if (id === "min") setClimMinDragging(false);
1061
+ if (id === "max") setClimMaxDragging(false);
1062
+ };
1063
+ window.addEventListener("mouseup", updater);
1064
+ };
1065
+ const increment = (e) => {
1066
+ if (!setClim) return;
1067
+ if (climRef[0].current === document.activeElement) {
1068
+ e.preventDefault();
1069
+ setClim((prev) => [Math.min(prev[0] + scale, prev[1]), prev[1]]);
1070
+ climRef[0].current.focus();
1071
+ }
1072
+ if (climRef[1].current === document.activeElement) {
1073
+ e.preventDefault();
1074
+ setClim((prev) => [prev[0], Math.max(prev[1] + scale, prev[0])]);
1075
+ climRef[1].current.focus();
1076
+ }
1077
+ };
1078
+ const decrement = (e) => {
1079
+ if (!setClim) return;
1080
+ if (climRef[0].current === document.activeElement) {
1081
+ e.preventDefault();
1082
+ setClim((prev) => [Math.min(prev[0] - scale, prev[1]), prev[1]]);
1083
+ climRef[0].current.focus();
1084
+ }
1085
+ if (climRef[1].current === document.activeElement) {
1086
+ e.preventDefault();
1087
+ setClim((prev) => [prev[0], Math.max(prev[1] - scale, prev[0])]);
1088
+ climRef[1].current.focus();
1089
+ }
1090
+ };
1091
+ useEffect(() => {
1092
+ const listener = (e) => {
1093
+ if (["ArrowUp", "ArrowRight"].includes(e.code) || ["ArrowUp", "ArrowRight"].includes(e.key)) {
1094
+ increment(e);
1095
+ }
1096
+ if (["ArrowDown", "ArrowLeft"].includes(e.code) || ["ArrowDown", "ArrowLeft"].includes(e.key)) {
1097
+ decrement(e);
1098
+ }
1099
+ };
1100
+ window.addEventListener("keydown", listener);
1101
+ return () => {
1102
+ window.removeEventListener("keydown", listener);
1103
+ };
1104
+ }, [clim]);
1105
+ const ClimMin = () => {
1106
+ return /* @__PURE__ */ React12.createElement(
1107
+ Box10,
1108
+ {
1109
+ id: "min",
1110
+ as: setClim ? "button" : "div",
1111
+ ref: climRef[0],
1112
+ tabIndex: 0,
1113
+ sx: __spreadValues(__spreadProps(__spreadValues({}, styles.clim(setClim)), {
1114
+ ml: label ? horizontal ? bottom ? "0px" : "10px" : ["2px", "1px", "1px", "2px"] : 0,
1115
+ mr: horizontal ? ["2px", "1px", "1px", "2px"] : 0,
1116
+ mb: horizontal ? 0 : ["-2px", "-2px", "-2px", "-3px"],
1117
+ borderBottom: setClim ? (t) => `solid 1px ${get(t, "colors.primary")}` : "unset",
1118
+ cursor: setClim ? horizontal ? "ew-resize" : "ns-resize" : "default"
1119
+ }), sxClim),
1120
+ onMouseDown: setClim ? handleMouseDown : () => {
1121
+ },
1122
+ onClick: () => {
1123
+ var _a2;
1124
+ return (_a2 = climRef[0].current) == null ? void 0 : _a2.focus();
1125
+ }
1126
+ },
1127
+ format2(clim[0])
1128
+ );
1129
+ };
1130
+ const ClimMax = () => {
1131
+ return /* @__PURE__ */ React12.createElement(
1132
+ Box10,
1133
+ {
1134
+ id: "max",
1135
+ as: setClim ? "button" : "div",
1136
+ ref: climRef[1],
1137
+ tabIndex: 0,
1138
+ sx: __spreadValues(__spreadProps(__spreadValues({}, styles.clim(setClim)), {
1139
+ ml: horizontal ? ["2px", "1px", "1px", "2px"] : ["2px", "1px", "1px", "2px"],
1140
+ mt: horizontal ? 0 : ["-2px", "-3px", "-3px", "-3px"],
1141
+ borderBottom: setClim ? (t) => `solid 1px ${get(t, "colors.primary")}` : "unset",
1142
+ cursor: setClim ? horizontal ? "ew-resize" : "ns-resize" : "default"
1143
+ }), sxClim),
1144
+ onMouseDown: setClim ? handleMouseDown : () => {
1145
+ },
1146
+ onClick: () => {
1147
+ var _a2;
1148
+ return (_a2 = climRef[1].current) == null ? void 0 : _a2.focus();
1149
+ }
1150
+ },
1151
+ format2(clim[1])
1152
+ );
1153
+ };
1154
+ return /* @__PURE__ */ React12.createElement(
1155
+ Flex,
1156
+ __spreadProps(__spreadValues({}, props), {
1157
+ sx: __spreadValues({
1158
+ flexDirection: "row",
1159
+ alignItems: "start",
1160
+ justifyContent: "flex-start",
1161
+ gap: ["3px", "6px", "6px", "7px"],
1162
+ height: !horizontal ? "100%" : "unset"
1163
+ }, sx3)
1164
+ }),
1165
+ label && /* @__PURE__ */ React12.createElement(Label, { label, units, horizontal }),
1166
+ /* @__PURE__ */ React12.createElement(
1167
+ Flex,
1168
+ {
1169
+ sx: {
1170
+ flexGrow: horizontal ? 1 : "unset",
1171
+ flexDirection: "column",
1172
+ ml: bottom && label ? "4px" : "0px",
1173
+ height: !horizontal ? "100%" : "unset"
1174
+ }
1175
+ },
1176
+ /* @__PURE__ */ React12.createElement(
1177
+ Flex,
1178
+ {
1179
+ sx: {
1180
+ gap: ["3px", "6px", "6px", "7px"],
1181
+ height: !horizontal ? "100%" : "unset"
1182
+ }
1183
+ },
1184
+ horizontal && clim && !bottom && /* @__PURE__ */ React12.createElement(ClimMin, null),
1185
+ /* @__PURE__ */ React12.createElement(
1186
+ Gradient,
1187
+ {
1188
+ colormap,
1189
+ horizontal,
1190
+ discrete,
1191
+ width,
1192
+ height
1193
+ }
1194
+ ),
1195
+ horizontal && clim && !bottom && /* @__PURE__ */ React12.createElement(ClimMax, null)
1196
+ ),
1197
+ horizontal && clim && bottom && /* @__PURE__ */ React12.createElement(Flex, { sx: { justifyContent: "space-between" } }, /* @__PURE__ */ React12.createElement(ClimMin, null), /* @__PURE__ */ React12.createElement(ClimMax, null))
1198
+ ),
1199
+ !horizontal && /* @__PURE__ */ React12.createElement(
1200
+ Flex,
1201
+ {
1202
+ sx: {
1203
+ flexDirection: "column-reverse",
1204
+ justifyContent: "space-between",
1205
+ height: height || DIMENSIONS.height
1206
+ }
1207
+ },
1208
+ clim && /* @__PURE__ */ React12.createElement(ClimMin, null),
1209
+ clim && /* @__PURE__ */ React12.createElement(ClimMax, null)
1210
+ )
1211
+ );
1212
+ };
1213
+ var colorbar_default = Colorbar;
1214
+
1215
+ // src/colors.tsx
1216
+ var colors_exports = {};
1217
+ __export(colors_exports, {
1218
+ Background: () => Background,
1219
+ Blue: () => Blue,
1220
+ Green: () => Green,
1221
+ Grey: () => Grey,
1222
+ Orange: () => Orange,
1223
+ Pink: () => Pink,
1224
+ Primary: () => Primary,
1225
+ Purple: () => Purple,
1226
+ Red: () => Red,
1227
+ Secondary: () => Secondary,
1228
+ Teal: () => Teal,
1229
+ Yellow: () => Yellow
1230
+ });
1231
+ import React13 from "react";
1232
+ import { Box as Box11 } from "theme-ui";
1233
+ var InlineColor = (_a) => {
1234
+ var _b = _a, { sx: sx3, color, children } = _b, props = __objRest(_b, ["sx", "color", "children"]);
1235
+ return /* @__PURE__ */ React13.createElement(
1236
+ Box11,
1237
+ __spreadValues({
1238
+ as: "span",
1239
+ sx: __spreadValues({ display: "inline-block", color }, sx3)
1240
+ }, props),
1241
+ children
1242
+ );
1243
+ };
1244
+ var Primary = (props) => {
1245
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "primary" }, props));
1246
+ };
1247
+ var Secondary = (props) => {
1248
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "secondary" }, props));
1249
+ };
1250
+ var Background = (props) => {
1251
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "background" }, props));
1252
+ };
1253
+ var Red = (props) => {
1254
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "red" }, props));
1255
+ };
1256
+ var Orange = (props) => {
1257
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "orange" }, props));
1258
+ };
1259
+ var Yellow = (props) => {
1260
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "yellow" }, props));
1261
+ };
1262
+ var Green = (props) => {
1263
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "green" }, props));
1264
+ };
1265
+ var Teal = (props) => {
1266
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "teal" }, props));
1267
+ };
1268
+ var Blue = (props) => {
1269
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "blue" }, props));
1270
+ };
1271
+ var Purple = (props) => {
1272
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "purple" }, props));
1273
+ };
1274
+ var Pink = (props) => {
1275
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "pink" }, props));
1276
+ };
1277
+ var Grey = (props) => {
1278
+ return /* @__PURE__ */ React13.createElement(InlineColor, __spreadValues({ color: "grey" }, props));
1279
+ };
1280
+
1281
+ // src/custom-404.tsx
1282
+ import React27 from "react";
1283
+ import { Box as Box21 } from "theme-ui";
1284
+ import { PoopSad } from "@carbonplan/emoji";
1285
+
1286
+ // src/layout.tsx
1287
+ import React26, { useEffect as useEffect6 } from "react";
1288
+ import { useThemeUI as useThemeUI3, Container as Container3, Flex as Flex4, Box as Box20 } from "theme-ui";
1289
+
1290
+ // src/meta.tsx
1291
+ import React14 from "react";
1292
+ import Head from "next/head";
1293
+ import { useThemeUI } from "theme-ui";
1294
+ var Meta = ({ title, description, card, url }) => {
1295
+ var _a, _b;
1296
+ const { theme, colorMode } = useThemeUI();
1297
+ if (!description) {
1298
+ console.warn(
1299
+ "a custom description should be used for search engine optimization"
1300
+ );
1301
+ }
1302
+ if (!title) {
1303
+ console.warn("a custom title should be used for search engine optimization");
1304
+ }
1305
+ const titleProp = title || "CarbonPlan";
1306
+ const descriptionProp = description || "Improving the transparency and scientific integrity of climate solutions with open data and tools.";
1307
+ const cardProp = card || "https://images.carbonplan.org/social/homepage.png";
1308
+ const urlProp = url || "https://carbonplan.org";
1309
+ return /* @__PURE__ */ React14.createElement(Head, null, /* @__PURE__ */ React14.createElement("title", null, titleProp), /* @__PURE__ */ React14.createElement("meta", { name: "description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { name: "viewport", content: "initial-scale=1.0, width=device-width" }), url && /* @__PURE__ */ React14.createElement("link", { rel: "canonical", href: url }), /* @__PURE__ */ React14.createElement(
1310
+ "link",
1311
+ {
1312
+ rel: "alternate icon",
1313
+ type: "image/png",
1314
+ href: "https://images.carbonplan.org/favicon.png"
1315
+ }
1316
+ ), /* @__PURE__ */ React14.createElement(
1317
+ "link",
1318
+ {
1319
+ rel: "icon",
1320
+ type: "image/svg+xml",
1321
+ href: "https://images.carbonplan.org/favicon.svg"
1322
+ }
1323
+ ), /* @__PURE__ */ React14.createElement(
1324
+ "link",
1325
+ {
1326
+ rel: "preload",
1327
+ href: "https://fonts.carbonplan.org/relative/relative-book-pro.woff2",
1328
+ as: "font",
1329
+ type: "font/woff2",
1330
+ crossOrigin: "anonymous"
1331
+ }
1332
+ ), /* @__PURE__ */ React14.createElement(
1333
+ "link",
1334
+ {
1335
+ rel: "preload",
1336
+ href: "https://fonts.carbonplan.org/relative/relative-medium-pro.woff2",
1337
+ as: "font",
1338
+ type: "font/woff2",
1339
+ crossOrigin: "anonymous"
1340
+ }
1341
+ ), /* @__PURE__ */ React14.createElement(
1342
+ "link",
1343
+ {
1344
+ rel: "preload",
1345
+ href: "https://fonts.carbonplan.org/relative/relative-mono-11-pitch-pro.woff2",
1346
+ as: "font",
1347
+ type: "font/woff2",
1348
+ crossOrigin: "anonymous"
1349
+ }
1350
+ ), /* @__PURE__ */ React14.createElement(
1351
+ "link",
1352
+ {
1353
+ rel: "preload",
1354
+ href: "https://fonts.carbonplan.org/relative/relative-faux-book-pro.woff2",
1355
+ as: "font",
1356
+ type: "font/woff2",
1357
+ crossOrigin: "anonymous"
1358
+ }
1359
+ ), /* @__PURE__ */ React14.createElement("link", { rel: "manifest", href: "https://images.carbonplan.org/manifest.json" }), /* @__PURE__ */ React14.createElement(
1360
+ "meta",
1361
+ {
1362
+ name: "theme-color",
1363
+ content: typeof ((_a = theme.colors) == null ? void 0 : _a.background) === "string" ? theme.colors.background : ""
1364
+ }
1365
+ ), /* @__PURE__ */ React14.createElement(
1366
+ "meta",
1367
+ {
1368
+ name: "color-scheme",
1369
+ content: colorMode === "light" ? "light" : "dark"
1370
+ }
1371
+ ), /* @__PURE__ */ React14.createElement(
1372
+ "link",
1373
+ {
1374
+ rel: "mask-icon",
1375
+ href: "https://images.carbonplan.org/safari-pinned-tab.svg",
1376
+ color: "#000000"
1377
+ }
1378
+ ), /* @__PURE__ */ React14.createElement(
1379
+ "link",
1380
+ {
1381
+ rel: "apple-touch-icon",
1382
+ sizes: "180x180",
1383
+ href: "https://images.carbonplan.org/apple-touch-icon.png"
1384
+ }
1385
+ ), /* @__PURE__ */ React14.createElement(
1386
+ "meta",
1387
+ {
1388
+ name: "msapplication-TileColor",
1389
+ content: typeof ((_b = theme.colors) == null ? void 0 : _b.background) === "string" ? theme.colors.background : ""
1390
+ }
1391
+ ), /* @__PURE__ */ React14.createElement(
1392
+ "meta",
1393
+ {
1394
+ name: "msapplication-TileImage",
1395
+ content: "https://images.carbonplan.org/mstile-144x144.png"
1396
+ }
1397
+ ), /* @__PURE__ */ React14.createElement(
1398
+ "meta",
1399
+ {
1400
+ name: "msapplication-config",
1401
+ content: "https://images.carbonplan.org/browserconfig.xml"
1402
+ }
1403
+ ), /* @__PURE__ */ React14.createElement("meta", { property: "og:title", content: titleProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:image", content: cardProp }), /* @__PURE__ */ React14.createElement("meta", { property: "og:url", content: urlProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:title", content: titleProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:description", content: descriptionProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:image", content: cardProp }), /* @__PURE__ */ React14.createElement("meta", { name: "twitter:card", content: "summary_large_image" }), /* @__PURE__ */ React14.createElement("meta", { name: "format-detection", content: "telephone=no" }));
1404
+ };
1405
+ var meta_default = Meta;
1406
+
1407
+ // src/header.tsx
1408
+ import React17, { useState as useState2 } from "react";
1409
+ import { default as NextLink2 } from "next/link";
1410
+ import { Box as Box13, Flex as Flex2, Container, Link as Link2 } from "theme-ui";
1411
+ import { Arrow as Arrow2 } from "@carbonplan/icons";
1412
+
1413
+ // src/logo.tsx
1414
+ import React15 from "react";
1415
+ import { Box as Box12 } from "theme-ui";
1416
+ var Logo = (_a) => {
1417
+ var props = __objRest(_a, []);
1418
+ return /* @__PURE__ */ React15.createElement(
1419
+ Box12,
1420
+ __spreadValues(__spreadValues({
1421
+ as: "svg"
1422
+ }, {
1423
+ width: "150",
1424
+ fill: "currentColor",
1425
+ stroke: "none",
1426
+ viewBox: "0 0 151.1 28.8"
1427
+ }), props),
1428
+ /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1429
+ "path",
1430
+ {
1431
+ d: "M9.7,20.1c-1.3-1.4-2-3.1-2-5.2c0-2.1,0.7-3.9,2-5.2c1.3-1.4,3-2,5.1-2c1.7,0,3.1,0.4,4.3,1.3\n c1.1,0.9,1.8,2.1,2.1,3.5c0,0.1,0,0.2,0,0.3s-0.1,0.2-0.2,0.2h-2.3c-0.2,0-0.3-0.1-0.4-0.2c-0.3-0.8-0.7-1.4-1.3-1.8\n c-0.6-0.4-1.4-0.6-2.2-0.6c-1.3,0-2.3,0.4-3,1.2c-0.8,0.8-1.1,1.9-1.1,3.4c0,1.5,0.4,2.6,1.1,3.4c0.8,0.8,1.8,1.2,3,1.2\n c0.8,0,1.6-0.2,2.2-0.6c0.6-0.4,1.1-1,1.3-1.8c0.1-0.2,0.2-0.2,0.4-0.3H21c0.1,0,0.2,0.1,0.2,0.2c0,0.1,0,0.2,0,0.3\n c-0.3,1.4-1,2.6-2.1,3.5c-1.1,0.9-2.5,1.3-4.3,1.3C12.7,22.1,11,21.4,9.7,20.1z"
1432
+ }
1433
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1434
+ "path",
1435
+ {
1436
+ d: "M22.5,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1\n c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3\n c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1C30.6,7.6,32,8.1,33,9c1,0.9,1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6\n c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2\n C23,20.1,22.5,19,22.5,17.6z M25.4,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9\n c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C25.7,16.3,25.4,16.8,25.4,17.5z"
1437
+ }
1438
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1439
+ "path",
1440
+ {
1441
+ d: "M37,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.1c1-1.1,2.3-1.6,3.7-1.6\n c0.8,0,1.7,0.1,2.5,0.4c0.2,0.1,0.3,0.3,0.3,0.5v2.2c0,0.2-0.1,0.3-0.2,0.3c0,0-0.1,0-0.2-0.1c-1.1-0.5-2-0.8-2.9-0.8\n c-0.9,0-1.7,0.4-2.3,1.1c-0.6,0.7-0.9,1.7-0.9,3v7.3c0,0.2-0.1,0.3-0.3,0.3h-2.2C37.1,21.8,37,21.7,37,21.6z"
1442
+ }
1443
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1444
+ "path",
1445
+ {
1446
+ d: "M47.6,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3H50c0.2,0,0.3,0.1,0.3,0.3v6.5c1.3-1.1,2.7-1.6,4.3-1.6\n c1.9,0,3.4,0.7,4.6,2c1.1,1.3,1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.8,0-3.2-0.5-4.3-1.6v1\n c0,0.2-0.1,0.3-0.3,0.3h-2.2C47.7,21.8,47.6,21.7,47.6,21.6z M51.2,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3\n s1.7,1.3,2.9,1.3c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3\n C52.9,10.2,51.9,10.7,51.2,11.5z"
1447
+ }
1448
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1449
+ "path",
1450
+ {
1451
+ d: "M64.3,20.1c-1.4-1.4-2.1-3.1-2.1-5.2c0-2.1,0.7-3.9,2.1-5.2c1.4-1.4,3.1-2,5.2-2c2.1,0,3.8,0.7,5.2,2\n c1.4,1.4,2.1,3.1,2.1,5.2c0,2.1-0.7,3.9-2.1,5.2c-1.4,1.4-3.1,2-5.2,2C67.4,22.1,65.7,21.4,64.3,20.1z M66.4,11.5\n c-0.8,0.8-1.2,2-1.2,3.4c0,1.4,0.4,2.5,1.2,3.4s1.9,1.3,3.1,1.3c1.3,0,2.3-0.4,3.1-1.3c0.8-0.8,1.2-2,1.2-3.4\n c0-1.4-0.4-2.5-1.2-3.4c-0.8-0.8-1.9-1.3-3.1-1.3C68.2,10.2,67.2,10.7,66.4,11.5z"
1452
+ }
1453
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1454
+ "path",
1455
+ {
1456
+ d: "M78.7,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8\n c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1\n c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C78.7,21.8,78.7,21.7,78.7,21.6z"
1457
+ }
1458
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1459
+ "path",
1460
+ {
1461
+ d: "M101.7,27.1V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1c1.1-1.1,2.5-1.6,4.3-1.6\n c1.9,0,3.4,0.7,4.6,2s1.7,3.1,1.7,5.3c0,2.2-0.6,4-1.7,5.3c-1.1,1.3-2.7,2-4.6,2c-1.5,0-3-0.5-4.3-1.6v6.6c0,0.2-0.1,0.3-0.3,0.3\n H102C101.8,27.3,101.7,27.2,101.7,27.1z M105.3,11.5c-0.7,0.9-1.1,2-1.1,3.3c0,1.4,0.4,2.5,1.1,3.3s1.7,1.3,2.9,1.3\n c1.2,0,2.2-0.4,2.9-1.3c0.7-0.9,1.1-2,1.1-3.3c0-1.4-0.4-2.5-1.1-3.3c-0.7-0.9-1.7-1.3-2.9-1.3C107,10.2,106,10.7,105.3,11.5z"
1462
+ }
1463
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1464
+ "path",
1465
+ {
1466
+ d: "M117.2,21.6V2.7c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v18.9c0,0.2-0.1,0.3-0.3,0.3h-2.2\n C117.3,21.8,117.2,21.7,117.2,21.6z"
1467
+ }
1468
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1469
+ "path",
1470
+ {
1471
+ d: "M122,17.6c0-1.5,0.5-2.6,1.6-3.5c1.1-0.8,2.4-1.2,4.1-1.2c1.1,0,2.4,0.2,3.7,0.6V13c0-0.9-0.3-1.6-0.8-2.1\n c-0.5-0.5-1.2-0.8-2.2-0.8c-1.4,0-2.4,0.6-2.9,1.8c-0.1,0.2-0.2,0.2-0.4,0.2h-2.3c-0.1,0-0.2-0.1-0.2-0.2c0-0.1,0-0.2,0-0.3\n c0.3-1.2,0.9-2.2,1.9-2.9c1-0.8,2.3-1.1,3.8-1.1c1.7,0,3.1,0.5,4.2,1.4s1.5,2.2,1.5,3.8V19c0,1.1,0.2,1.9,0.5,2.6\n c0,0.1,0.1,0.1,0.1,0.1c0,0.1-0.1,0.1-0.3,0.1h-2.8c-0.2,0-0.3-0.1-0.3-0.3v-1c-1.1,1.1-2.5,1.6-4.3,1.6c-1.4,0-2.6-0.4-3.6-1.2\n C122.5,20.1,122,19,122,17.6z M124.9,17.5c0,0.6,0.2,1.1,0.7,1.5c0.4,0.4,1.1,0.5,1.9,0.5c1.1,0,2-0.3,2.8-0.9\n c0.8-0.6,1.1-1.5,1.1-2.6c-1.3-0.4-2.5-0.6-3.6-0.6c-0.8,0-1.5,0.2-2.1,0.5C125.2,16.3,124.9,16.8,124.9,17.5z"
1472
+ }
1473
+ )), /* @__PURE__ */ React15.createElement("g", null, /* @__PURE__ */ React15.createElement(
1474
+ "path",
1475
+ {
1476
+ d: "M136.9,21.6V8.2c0-0.2,0.1-0.3,0.3-0.3h2.2c0.2,0,0.3,0.1,0.3,0.3v1.3c1.3-1.2,2.7-1.8,4.4-1.8\n c1.5,0,2.7,0.4,3.5,1.3c0.8,0.9,1.3,2,1.3,3.6v9.1c0,0.2-0.1,0.3-0.3,0.3h-2.2c-0.2,0-0.3-0.1-0.3-0.3v-8.3c0-2-0.9-3.1-2.8-3.1\n c-1.1,0-1.9,0.4-2.7,1.2c-0.7,0.8-1.1,2-1.1,3.5v6.6c0,0.2-0.1,0.3-0.3,0.3h-2.2C137,21.8,136.9,21.7,136.9,21.6z"
1477
+ }
1478
+ )), /* @__PURE__ */ React15.createElement(
1479
+ "path",
1480
+ {
1481
+ d: "M97.6,14.9c0,4.2-0.6,8.3-1.6,12.3c0,0.1-0.1,0.2-0.2,0.2h-2.4c-0.1,0-0.2-0.1-0.2-0.3c1.1-3.9,1.7-8,1.7-12.2\n s-0.6-8.3-1.7-12.2c0-0.1,0.1-0.3,0.2-0.3l2.4,0c0.1,0,0.2,0.1,0.2,0.2C97.1,6.5,97.6,10.6,97.6,14.9z"
1482
+ }
1483
+ ), /* @__PURE__ */ React15.createElement(
1484
+ "path",
1485
+ {
1486
+ d: "M1.4,14.9C1.4,10.6,2,6.5,3,2.6c0-0.1,0.1-0.2,0.2-0.2l2.4,0c0.1,0,0.2,0.1,0.2,0.3c-1.1,3.9-1.7,8-1.7,12.2\n s0.6,8.3,1.7,12.2c0,0.1-0.1,0.3-0.2,0.3H3.3c-0.1,0-0.2-0.1-0.2-0.2C2,23.2,1.4,19.1,1.4,14.9z"
1487
+ }
1488
+ ))
1489
+ );
1490
+ };
1491
+ var logo_default = Logo;
1492
+
1493
+ // src/menu.tsx
1494
+ import React16 from "react";
1495
+ import { IconButton } from "theme-ui";
1496
+ var Menu = (_a) => {
1497
+ var _b = _a, { value, sx: sx3 } = _b, props = __objRest(_b, ["value", "sx"]);
1498
+ return /* @__PURE__ */ React16.createElement(
1499
+ IconButton,
1500
+ __spreadValues({
1501
+ sx: __spreadValues({
1502
+ cursor: "pointer",
1503
+ fill: "none",
1504
+ strokeWidth: "2px",
1505
+ stroke: "text",
1506
+ ".paren": {
1507
+ opacity: "0"
1508
+ },
1509
+ "@media (hover: hover) and (pointer: fine)": {
1510
+ "&:hover .paren": {
1511
+ opacity: "1"
1512
+ }
1513
+ }
1514
+ }, sx3),
1515
+ "aria-label": "Toggle Menu"
1516
+ }, props),
1517
+ !value && /* @__PURE__ */ React16.createElement(
1518
+ "svg",
1519
+ {
1520
+ style: {
1521
+ width: "50px",
1522
+ height: "30px",
1523
+ marginTop: "-3px",
1524
+ flexShrink: 0
1525
+ },
1526
+ xmlns: "http://www.w3.org/2000/svg",
1527
+ viewBox: "0 0 68 36"
1528
+ },
1529
+ /* @__PURE__ */ React16.createElement("line", { x1: "52", y1: "29.9", x2: "16", y2: "29.9" }),
1530
+ /* @__PURE__ */ React16.createElement("line", { x1: "52", y1: "6.1", x2: "16", y2: "6.1" }),
1531
+ /* @__PURE__ */ React16.createElement("line", { x1: "52", y1: "18", x2: "16", y2: "18" }),
1532
+ /* @__PURE__ */ React16.createElement(
1533
+ "path",
1534
+ {
1535
+ style: { transition: "all 0.2s" },
1536
+ className: "paren",
1537
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1538
+ }
1539
+ ),
1540
+ /* @__PURE__ */ React16.createElement(
1541
+ "path",
1542
+ {
1543
+ style: { transition: "all 0.2s" },
1544
+ className: "paren",
1545
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1546
+ }
1547
+ )
1548
+ ),
1549
+ value && /* @__PURE__ */ React16.createElement(
1550
+ "svg",
1551
+ {
1552
+ style: {
1553
+ width: "50px",
1554
+ height: "30px",
1555
+ marginTop: "-3px",
1556
+ flexShrink: 0
1557
+ },
1558
+ xmlns: "http://www.w3.org/2000/svg",
1559
+ viewBox: "0 0 68 36"
1560
+ },
1561
+ /* @__PURE__ */ React16.createElement("line", { x1: "50.85", y1: "29.79", x2: "17.15", y2: "6.21" }),
1562
+ /* @__PURE__ */ React16.createElement("line", { x1: "17.15", y1: "29.79", x2: "50.85", y2: "6.21" }),
1563
+ /* @__PURE__ */ React16.createElement(
1564
+ "path",
1565
+ {
1566
+ style: { transition: "all 0.2s" },
1567
+ className: "paren",
1568
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
1569
+ }
1570
+ ),
1571
+ /* @__PURE__ */ React16.createElement(
1572
+ "path",
1573
+ {
1574
+ style: { transition: "all 0.2s" },
1575
+ className: "paren",
1576
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
1577
+ }
1578
+ )
1579
+ )
1580
+ );
1581
+ };
1582
+ var menu_default = Menu;
1583
+
1584
+ // src/header.tsx
1585
+ var sx = {
1586
+ link: (current, label, first = false) => {
1587
+ return {
1588
+ width: "auto",
1589
+ color: current === label ? "secondary" : "text",
1590
+ fontSize: [6, 6, 7, 8],
1591
+ fontFamily: "heading",
1592
+ letterSpacing: "heading",
1593
+ borderStyle: "solid",
1594
+ borderColor: "muted",
1595
+ borderWidth: "0px",
1596
+ borderBottomWidth: "1px",
1597
+ borderTopWidth: first ? "1px" : "0px",
1598
+ py: [3, 3, 4, 5],
1599
+ textDecoration: "none",
1600
+ display: "block",
1601
+ position: "relative",
1602
+ transition: "color 0.15s",
1603
+ "@media (hover: hover) and (pointer: fine)": {
1604
+ "&:hover > #arrow": {
1605
+ opacity: 1
1606
+ }
1607
+ },
1608
+ "&:hover": {
1609
+ color: current === label ? "secondary" : "text"
1610
+ }
1611
+ };
1612
+ }
1613
+ };
1614
+ var links = [
1615
+ { url: "about", display: "About" },
1616
+ { url: "research", display: "Research" },
1617
+ { url: "blog", display: "Blog" },
1618
+ { url: "press", display: "Press" }
1619
+ ];
1620
+ var HoverArrow = () => {
1621
+ return /* @__PURE__ */ React17.createElement(
1622
+ Arrow2,
1623
+ {
1624
+ id: "arrow",
1625
+ sx: {
1626
+ pointerEvents: "none",
1627
+ display: "inline-block",
1628
+ position: "absolute",
1629
+ left: ["-60px", "-68px", "-80px", "-104px"],
1630
+ top: ["32px", "32px", "46px", "62px"],
1631
+ opacity: 0,
1632
+ transition: "opacity 0.2s ease-out",
1633
+ transform: "rotate(45deg)",
1634
+ width: [36, 36, 48, 56],
1635
+ height: [36, 36, 48, 56]
1636
+ }
1637
+ }
1638
+ );
1639
+ };
1640
+ var Nav = ({ link, mode, nav, first, setExpanded }) => {
1641
+ const { url, display } = link;
1642
+ const href = mode === "remote" ? "https://carbonplan.org/" + url : "/" + url;
1643
+ if (mode === "homepage" || mode === "local" && nav === url) {
1644
+ return /* @__PURE__ */ React17.createElement(NextLink2, { href, passHref: true, legacyBehavior: true }, /* @__PURE__ */ React17.createElement(
1645
+ Link2,
1646
+ {
1647
+ onClick: () => {
1648
+ if (nav === url) setExpanded(false);
1649
+ },
1650
+ sx: sx.link(nav, url, first)
1651
+ },
1652
+ /* @__PURE__ */ React17.createElement(HoverArrow, null),
1653
+ display
1654
+ ));
1655
+ } else {
1656
+ return /* @__PURE__ */ React17.createElement(Link2, { href, sx: sx.link(nav, url, first) }, /* @__PURE__ */ React17.createElement(HoverArrow, null), display);
1657
+ }
1658
+ };
1659
+ var NavGroup = ({ links: links2, nav, mode, setExpanded }) => {
1660
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, links2.map((d, i) => {
1661
+ return /* @__PURE__ */ React17.createElement(
1662
+ Nav,
1663
+ {
1664
+ key: i,
1665
+ link: d,
1666
+ mode,
1667
+ nav,
1668
+ first: i === 0,
1669
+ setExpanded
1670
+ }
1671
+ );
1672
+ }));
1673
+ };
1674
+ var Header = ({ status, mode, nav, menuItems }) => {
1675
+ const [expanded, setExpanded] = useState2(false);
1676
+ const toggle = () => {
1677
+ setExpanded(!expanded);
1678
+ };
1679
+ return /* @__PURE__ */ React17.createElement(
1680
+ row_default,
1681
+ {
1682
+ sx: {
1683
+ pt: ["12px"],
1684
+ pb: [3]
1685
+ }
1686
+ },
1687
+ /* @__PURE__ */ React17.createElement(column_default, { start: [1], width: [2] }, /* @__PURE__ */ React17.createElement(
1688
+ Box13,
1689
+ {
1690
+ sx: { pointerEvents: "all", display: "block", width: "fit-content" }
1691
+ },
1692
+ (mode === "homepage" || mode === "local") && /* @__PURE__ */ React17.createElement(NextLink2, { href: "/", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React17.createElement(
1693
+ Link2,
1694
+ {
1695
+ "aria-label": "CarbonPlan Homepage",
1696
+ sx: {
1697
+ display: "block"
1698
+ }
1699
+ },
1700
+ /* @__PURE__ */ React17.createElement(
1701
+ logo_default,
1702
+ {
1703
+ id: "logo",
1704
+ sx: {
1705
+ cursor: "pointer",
1706
+ color: "primary"
1707
+ }
1708
+ }
1709
+ )
1710
+ )),
1711
+ (mode == null || mode === "remote") && /* @__PURE__ */ React17.createElement(
1712
+ Link2,
1713
+ {
1714
+ href: "https://carbonplan.org",
1715
+ "aria-label": "CarbonPlan Homepage",
1716
+ sx: { display: "block" }
1717
+ },
1718
+ /* @__PURE__ */ React17.createElement(logo_default, { sx: { cursor: "pointer", color: "primary" } })
1719
+ )
1720
+ )),
1721
+ /* @__PURE__ */ React17.createElement(
1722
+ column_default,
1723
+ {
1724
+ start: [4, 9],
1725
+ width: [2, 2],
1726
+ dr: 1,
1727
+ sx: {
1728
+ display: [status ? "flex" : "none", "flex", "flex", "flex"],
1729
+ alignItems: "center"
1730
+ }
1731
+ },
1732
+ /* @__PURE__ */ React17.createElement(
1733
+ Box13,
1734
+ {
1735
+ sx: {
1736
+ fontSize: [1, 2, 3],
1737
+ position: "relative",
1738
+ top: ["-2px", "-3px", "-3px"]
1739
+ }
1740
+ },
1741
+ status ? `(${status})` : ""
1742
+ )
1743
+ ),
1744
+ /* @__PURE__ */ React17.createElement(
1745
+ column_default,
1746
+ {
1747
+ start: [status ? 6 : 4, 6, 11, 11],
1748
+ width: [status ? 1 : 3, 3, 2, 2],
1749
+ sx: { zIndex: 5e3 }
1750
+ },
1751
+ /* @__PURE__ */ React17.createElement(Flex2, { sx: { pointerEvents: "all", justifyContent: "flex-end" } }, /* @__PURE__ */ React17.createElement(
1752
+ Box13,
1753
+ {
1754
+ sx: {
1755
+ display: [status ? "none" : "flex", "flex", "flex", "flex"],
1756
+ mr: "18px",
1757
+ gap: "18px",
1758
+ opacity: expanded ? 0 : 1,
1759
+ transition: "opacity 0.15s",
1760
+ justifyContent: "space-between",
1761
+ alignItems: "center"
1762
+ }
1763
+ },
1764
+ menuItems
1765
+ ), /* @__PURE__ */ React17.createElement(
1766
+ menu_default,
1767
+ {
1768
+ sx: {
1769
+ flexShrink: 0,
1770
+ mr: ["-2px"]
1771
+ },
1772
+ value: expanded,
1773
+ onClick: toggle
1774
+ }
1775
+ ))
1776
+ ),
1777
+ /* @__PURE__ */ React17.createElement(
1778
+ Box13,
1779
+ {
1780
+ sx: {
1781
+ opacity: expanded ? 1 : 0,
1782
+ pointerEvents: expanded ? "all" : "none",
1783
+ position: "fixed",
1784
+ top: "0px",
1785
+ right: "0px",
1786
+ bottom: "0px",
1787
+ minWidth: "0px",
1788
+ maxHeight: "100vh",
1789
+ width: "100vw",
1790
+ backgroundColor: "background",
1791
+ zIndex: 4e3,
1792
+ pt: ["79px"],
1793
+ transition: "opacity 0.25s"
1794
+ }
1795
+ },
1796
+ /* @__PURE__ */ React17.createElement(Container, null, /* @__PURE__ */ React17.createElement(row_default, null, /* @__PURE__ */ React17.createElement(column_default, { start: [2, 4, 7, 7], width: [5, 4, 5, 5] }, /* @__PURE__ */ React17.createElement(
1797
+ Box13,
1798
+ {
1799
+ as: "nav",
1800
+ sx: {
1801
+ display: expanded ? "inherit" : "none",
1802
+ mt: [5, 5, 5, 6]
1803
+ }
1804
+ },
1805
+ /* @__PURE__ */ React17.createElement(
1806
+ NavGroup,
1807
+ {
1808
+ links,
1809
+ nav,
1810
+ mode,
1811
+ setExpanded
1812
+ }
1813
+ )
1814
+ ))))
1815
+ )
1816
+ );
1817
+ };
1818
+ var header_default = Header;
1819
+
1820
+ // src/footer.tsx
1821
+ import React19, { useState as useState3, useEffect as useEffect2 } from "react";
1822
+ import { Box as Box15, Flex as Flex3, Link as Link3 } from "theme-ui";
1823
+ import { default as NextLink3 } from "next/link";
1824
+
1825
+ // src/monogram.tsx
1826
+ import React18 from "react";
1827
+ import { Box as Box14 } from "theme-ui";
1828
+ var Monogram = (_a) => {
1829
+ var props = __objRest(_a, []);
1830
+ return /* @__PURE__ */ React18.createElement(
1831
+ Box14,
1832
+ __spreadValues(__spreadValues({
1833
+ as: "svg"
1834
+ }, {
1835
+ width: "80",
1836
+ stroke: "none",
1837
+ fill: "currentColor",
1838
+ viewBox: "0 0 32 32"
1839
+ }), props),
1840
+ /* @__PURE__ */ React18.createElement("path", { d: "M21.9395,14.9395 L17.5005,19.3785 L17.5005,7.0005 L14.5005,7.0005 L14.5005,19.3785 L10.0605,14.9395 L7.9395,17.0605 L14.9395,24.0605 C15.2325,24.3535 15.6165,24.5005 16.0005,24.5005 C16.3835,24.5005 16.7675,24.3535 17.0605,24.0605 L24.0605,17.0605 L21.9395,14.9395 Z" }),
1841
+ /* @__PURE__ */ React18.createElement("path", { d: "M27.5986,4 L22.8966,4 C26.5556,6.303 28.9996,10.366 28.9996,15 C28.9996,20.4 25.6896,25.039 20.9926,27 L26.5586,27 C29.8886,24.068 31.9996,19.785 31.9996,15 C31.9996,10.734 30.3196,6.868 27.5986,4" }),
1842
+ /* @__PURE__ */ React18.createElement("path", { d: "M3,15 C3,10.366 5.444,6.303 9.104,4 L4.401,4 C1.68,6.868 0,10.734 0,15 C0,19.785 2.112,24.068 5.441,27 L11.008,27 C6.311,25.039 3,20.4 3,15" })
1843
+ );
1844
+ };
1845
+ var monogram_default = Monogram;
1846
+
1847
+ // src/footer.tsx
1848
+ var Footer = () => {
1849
+ const [year, setYear] = useState3(null);
1850
+ useEffect2(() => {
1851
+ setYear((/* @__PURE__ */ new Date()).getFullYear());
1852
+ }, []);
1853
+ return /* @__PURE__ */ React19.createElement(
1854
+ Box15,
1855
+ {
1856
+ sx: {
1857
+ mt: [7, 7, 7, 8],
1858
+ mb: [7, 7, 7, 8],
1859
+ pb: [2, 1, 0, 0]
1860
+ }
1861
+ },
1862
+ /* @__PURE__ */ React19.createElement(row_default, { sx: { mb: [0, 0, 4, 5] } }, /* @__PURE__ */ React19.createElement(column_default, { start: [1, 2], width: [3, 3] }, /* @__PURE__ */ React19.createElement(Box15, null, /* @__PURE__ */ React19.createElement(
1863
+ Box15,
1864
+ {
1865
+ sx: {
1866
+ fontSize: [2, 2, 2, 3],
1867
+ fontFamily: "heading",
1868
+ letterSpacing: "mono",
1869
+ mb: [2]
1870
+ }
1871
+ },
1872
+ "EMAIL"
1873
+ ), /* @__PURE__ */ React19.createElement(
1874
+ Link3,
1875
+ {
1876
+ href: "mailto:hello@carbonplan.org",
1877
+ sx: {
1878
+ textDecoration: "none",
1879
+ fontSize: [2, 2, 2, 3]
1880
+ }
1881
+ },
1882
+ "hello@carbonplan.org"
1883
+ ))), /* @__PURE__ */ React19.createElement(
1884
+ column_default,
1885
+ {
1886
+ start: [5],
1887
+ width: [1],
1888
+ dl: 1,
1889
+ dr: 1,
1890
+ sx: {
1891
+ display: ["flex", "none", "none", "none"],
1892
+ justifyContent: ["center"]
1893
+ }
1894
+ },
1895
+ /* @__PURE__ */ React19.createElement(monogram_default, { sx: { mt: ["-4px"], width: "60px", height: "60px" } })
1896
+ ), /* @__PURE__ */ React19.createElement(column_default, { start: [1, 5, 5, 5], width: [3, 3], sx: { mt: [3, 0, 0, 0] } }, /* @__PURE__ */ React19.createElement(Box15, null, /* @__PURE__ */ React19.createElement(
1897
+ Box15,
1898
+ {
1899
+ sx: {
1900
+ fontSize: [2, 2, 2, 3],
1901
+ fontFamily: "heading",
1902
+ letterSpacing: "mono",
1903
+ mb: [2]
1904
+ }
1905
+ },
1906
+ "NEWSLETTER"
1907
+ ), /* @__PURE__ */ React19.createElement(
1908
+ Link3,
1909
+ {
1910
+ href: "https://carbonplan.org/newsletter",
1911
+ sx: {
1912
+ textDecoration: "none",
1913
+ fontSize: [2, 2, 2, 3]
1914
+ }
1915
+ },
1916
+ "Subscribe"
1917
+ ))), /* @__PURE__ */ React19.createElement(
1918
+ column_default,
1919
+ {
1920
+ start: [1, 9],
1921
+ width: [5, 4, 3, 3],
1922
+ sx: { mt: ["42px", "42px", 0, 0], mb: [3, 3, 0, 0] }
1923
+ },
1924
+ /* @__PURE__ */ React19.createElement(Box15, null, /* @__PURE__ */ React19.createElement(
1925
+ Box15,
1926
+ {
1927
+ sx: {
1928
+ fontSize: [2, 2, 2, 3],
1929
+ fontFamily: "body",
1930
+ color: "secondary"
1931
+ }
1932
+ },
1933
+ "CarbonPlan is a registered nonprofit public benefit corporation in California with 501(c)(3) status."
1934
+ ))
1935
+ )),
1936
+ /* @__PURE__ */ React19.createElement(row_default, { sx: { mb: ["2px"], mt: [5, 5, 4] } }, /* @__PURE__ */ React19.createElement(
1937
+ column_default,
1938
+ {
1939
+ start: [1, 1, 2, 2],
1940
+ width: [3, 2, 3, 3],
1941
+ sx: {
1942
+ display: "flex",
1943
+ alignItems: ["flex-start", "flex-start", "flex-end"]
1944
+ }
1945
+ },
1946
+ /* @__PURE__ */ React19.createElement(
1947
+ Box15,
1948
+ {
1949
+ sx: {
1950
+ bottom: "0px",
1951
+ borderStyle: "solid",
1952
+ borderColor: "muted",
1953
+ borderWidth: "0px",
1954
+ borderTopWidth: "1px",
1955
+ display: "inline-block",
1956
+ pt: [2]
1957
+ }
1958
+ },
1959
+ /* @__PURE__ */ React19.createElement(
1960
+ Box15,
1961
+ {
1962
+ sx: {
1963
+ color: "secondary",
1964
+ fontSize: [1, 1, 1, 2],
1965
+ fontFamily: "mono",
1966
+ letterSpacing: "mono"
1967
+ }
1968
+ },
1969
+ /* @__PURE__ */ React19.createElement(
1970
+ Flex3,
1971
+ {
1972
+ sx: {
1973
+ flexDirection: ["column", "column", "row", "row"],
1974
+ gap: [0, 0, "10px", "12px"]
1975
+ }
1976
+ },
1977
+ /* @__PURE__ */ React19.createElement(Box15, null, "(c) ", year),
1978
+ /* @__PURE__ */ React19.createElement(Box15, null, "CARBONPLAN")
1979
+ )
1980
+ )
1981
+ )
1982
+ ), /* @__PURE__ */ React19.createElement(
1983
+ column_default,
1984
+ {
1985
+ start: [4, 3, 5, 5],
1986
+ width: [3, 3, 4, 4],
1987
+ sx: {
1988
+ display: "flex",
1989
+ alignItems: ["flex-start", "flex-start", "flex-end"],
1990
+ mt: [0, 0, 0, 0]
1991
+ }
1992
+ },
1993
+ /* @__PURE__ */ React19.createElement(
1994
+ Box15,
1995
+ {
1996
+ sx: {
1997
+ bottom: "0px",
1998
+ borderStyle: "solid",
1999
+ borderColor: "muted",
2000
+ borderWidth: "0px",
2001
+ borderTopWidth: "1px",
2002
+ pt: [2]
2003
+ }
2004
+ },
2005
+ /* @__PURE__ */ React19.createElement(
2006
+ Flex3,
2007
+ {
2008
+ sx: {
2009
+ color: "secondary",
2010
+ fontSize: [1, 1, 1, 2],
2011
+ fontFamily: "mono",
2012
+ letterSpacing: "mono",
2013
+ flexDirection: ["column", "column", "row", "row"],
2014
+ gap: [0, 0, "10px", "12px"]
2015
+ }
2016
+ },
2017
+ /* @__PURE__ */ React19.createElement(NextLink3, { href: "/terms", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React19.createElement(
2018
+ Box15,
2019
+ {
2020
+ as: "a",
2021
+ sx: {
2022
+ color: "secondary",
2023
+ "&:hover": {
2024
+ color: "primary"
2025
+ }
2026
+ }
2027
+ },
2028
+ "TERMS OF USE"
2029
+ )),
2030
+ /* @__PURE__ */ React19.createElement(Box15, { sx: { display: ["none", "none", "initial", "initial"] } }, " / "),
2031
+ /* @__PURE__ */ React19.createElement(NextLink3, { href: "/privacy", passHref: true, legacyBehavior: true }, /* @__PURE__ */ React19.createElement(
2032
+ Box15,
2033
+ {
2034
+ as: "a",
2035
+ sx: {
2036
+ color: "secondary",
2037
+ "&:hover": {
2038
+ color: "primary"
2039
+ }
2040
+ }
2041
+ },
2042
+ "PRIVACY POLICY"
2043
+ ))
2044
+ )
2045
+ )
2046
+ ), /* @__PURE__ */ React19.createElement(
2047
+ column_default,
2048
+ {
2049
+ start: [5, 7, 9, 9],
2050
+ width: [2, 2, 3, 3],
2051
+ sx: { display: ["none", "initial", "initial", "initial"] }
2052
+ },
2053
+ /* @__PURE__ */ React19.createElement(
2054
+ monogram_default,
2055
+ {
2056
+ sx: {
2057
+ width: 80,
2058
+ height: 80,
2059
+ mt: [0, "-10px", 4, 5],
2060
+ mb: ["-12px"]
2061
+ }
2062
+ }
2063
+ )
2064
+ ))
2065
+ );
2066
+ };
2067
+ var footer_default = Footer;
2068
+
2069
+ // src/dimmer.tsx
2070
+ import React20 from "react";
2071
+ import { IconButton as IconButton2, useColorMode } from "theme-ui";
2072
+ import { useCallback } from "react";
2073
+ import { Sun } from "@carbonplan/icons";
2074
+ var Dimmer = (_a) => {
2075
+ var _b = _a, { sx: sx3 = {} } = _b, props = __objRest(_b, ["sx"]);
2076
+ const [colorMode, setColorMode] = useColorMode();
2077
+ const toggle = useCallback(() => {
2078
+ setColorMode(colorMode === "light" ? "dark" : "light");
2079
+ }, [colorMode]);
2080
+ return /* @__PURE__ */ React20.createElement(
2081
+ IconButton2,
2082
+ __spreadValues({
2083
+ "aria-label": "Toggle dark mode",
2084
+ onClick: toggle,
2085
+ role: "checkbox",
2086
+ sx: __spreadValues({
2087
+ width: 32,
2088
+ height: 32,
2089
+ display: "inline-block",
2090
+ cursor: "pointer",
2091
+ color: "secondary"
2092
+ }, sx3)
2093
+ }, props),
2094
+ /* @__PURE__ */ React20.createElement(
2095
+ Sun,
2096
+ {
2097
+ sx: {
2098
+ strokeWidth: "1.75",
2099
+ transition: "stroke 0.15s",
2100
+ "@media (hover: hover) and (pointer: fine)": {
2101
+ "&:hover": {
2102
+ stroke: "primary"
2103
+ }
2104
+ }
2105
+ }
2106
+ }
2107
+ )
2108
+ );
2109
+ };
2110
+ var dimmer_default = Dimmer;
2111
+
2112
+ // src/metadata.tsx
2113
+ import React22 from "react";
2114
+ import { Box as Box17, Text as Text2 } from "theme-ui";
2115
+ import { useState as useState4, useEffect as useEffect3 } from "react";
2116
+
2117
+ // src/gitsha.tsx
2118
+ import React21 from "react";
2119
+ import { Box as Box16, Text, Link as Link4, useThemeUI as useThemeUI2 } from "theme-ui";
2120
+ var GitSha = () => {
2121
+ var _a;
2122
+ const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
2123
+ const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
2124
+ const slug = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG;
2125
+ const { theme } = useThemeUI2();
2126
+ const color = (_a = theme.rawColors) == null ? void 0 : _a.secondary;
2127
+ if (sha && owner && slug) {
2128
+ const shortSha = sha.substring(0, 7);
2129
+ const href = "https://github.com/" + owner + "/" + slug + "/tree/" + sha;
2130
+ return /* @__PURE__ */ React21.createElement(Box16, { sx: { display: "inline-block", width: "87px" } }, /* @__PURE__ */ React21.createElement(Separator, { color: typeof color === "string" ? color : void 0 }), /* @__PURE__ */ React21.createElement(
2131
+ Link4,
2132
+ {
2133
+ href,
2134
+ sx: {
2135
+ whiteSpace: "nowrap",
2136
+ display: "inline-block",
2137
+ ml: [2],
2138
+ fontFamily: "mono",
2139
+ letterSpacing: "body",
2140
+ color,
2141
+ fontSize: [1],
2142
+ textTransform: "uppercase",
2143
+ textDecoration: "none"
2144
+ }
2145
+ },
2146
+ shortSha
2147
+ ));
2148
+ } else {
2149
+ return /* @__PURE__ */ React21.createElement(Box16, { sx: { display: "inline-block", width: "87px" } }, /* @__PURE__ */ React21.createElement(Separator, { color: typeof color === "string" ? color : void 0 }), /* @__PURE__ */ React21.createElement(
2150
+ Text,
2151
+ {
2152
+ sx: {
2153
+ whiteSpace: "nowrap",
2154
+ display: "inline-block",
2155
+ ml: [2],
2156
+ fontFamily: "mono",
2157
+ letterSpacing: "body",
2158
+ color,
2159
+ fontSize: [1],
2160
+ textTransform: "uppercase"
2161
+ }
2162
+ },
2163
+ typeof color === "string" ? color : ""
2164
+ ));
2165
+ }
2166
+ };
2167
+ var Separator = ({ color = "secondary" }) => {
2168
+ return /* @__PURE__ */ React21.createElement("svg", { fill: color, opacity: "0.8", viewBox: "0 0 24 24", width: "24", height: "24" }, /* @__PURE__ */ React21.createElement("circle", { r: 5, cx: 19, cy: 19 }));
2169
+ };
2170
+ var gitsha_default = GitSha;
2171
+
2172
+ // src/metadata.tsx
2173
+ var Value = ({ mode }) => {
2174
+ const [display, setDisplay] = useState4(init(mode));
2175
+ useEffect3(() => {
2176
+ if (mode === "mouse") {
2177
+ const setFromEvent = (e) => {
2178
+ const x = format(e.clientX, 4);
2179
+ const y = format(e.clientY, 4);
2180
+ setDisplay(`X,Y: ${x},${y}`);
2181
+ };
2182
+ window.addEventListener("mousemove", setFromEvent);
2183
+ return () => {
2184
+ window.removeEventListener("mousemove", setFromEvent);
2185
+ };
2186
+ }
2187
+ if (mode === "scroll") {
2188
+ const setFromEvent = () => {
2189
+ const y = scrollFraction(window, document);
2190
+ setDisplay(`SCROLL: 0.${format((y * 100).toFixed(0), 2)}`);
2191
+ };
2192
+ window.addEventListener("scroll", setFromEvent);
2193
+ return () => {
2194
+ window.removeEventListener("scroll", setFromEvent);
2195
+ };
2196
+ }
2197
+ }, []);
2198
+ return /* @__PURE__ */ React22.createElement(
2199
+ Text2,
2200
+ {
2201
+ sx: {
2202
+ whiteSpace: "nowrap",
2203
+ display: "inline-block",
2204
+ mr: "-6px",
2205
+ fontFamily: "mono",
2206
+ letterSpacing: "body",
2207
+ color: "secondary",
2208
+ fontSize: [1],
2209
+ textTransform: "uppercase"
2210
+ }
2211
+ },
2212
+ display
2213
+ );
2214
+ };
2215
+ var Metadata = ({ mode }) => {
2216
+ return /* @__PURE__ */ React22.createElement(
2217
+ Box17,
2218
+ {
2219
+ sx: {
2220
+ userSelect: "none",
2221
+ position: "fixed",
2222
+ bottom: "42px",
2223
+ right: "24px",
2224
+ transformOrigin: "right",
2225
+ transform: "rotate(90deg)",
2226
+ display: ["none", "none", "initial"]
2227
+ }
2228
+ },
2229
+ /* @__PURE__ */ React22.createElement(Value, { mode }),
2230
+ /* @__PURE__ */ React22.createElement(gitsha_default, null)
2231
+ );
2232
+ };
2233
+ function init(mode) {
2234
+ if (mode === "mouse") {
2235
+ return `X,Y: ${format(0, 4)},${format(0, 4)}`;
2236
+ } else if (mode === "scroll") {
2237
+ return `SCROLL: 0.${format(0 .toFixed(0), 2)}`;
2238
+ } else {
2239
+ return mode;
2240
+ }
2241
+ }
2242
+ function format(num, pad) {
2243
+ return num.toString().padStart(pad, "0");
2244
+ }
2245
+ function scrollFraction(window2, document2) {
2246
+ return Math.min(window2.scrollY / (document2.body.offsetHeight - 770), 0.99);
2247
+ }
2248
+ var metadata_default = Metadata;
2249
+
2250
+ // src/fade-in.tsx
2251
+ import React23 from "react";
2252
+ import { Box as Box18 } from "theme-ui";
2253
+ import { keyframes } from "@emotion/react";
2254
+ var fade = keyframes({
2255
+ from: {
2256
+ opacity: 0
2257
+ },
2258
+ to: {
2259
+ opacity: 1
2260
+ }
2261
+ });
2262
+ var FadeIn = (_a) => {
2263
+ var _b = _a, {
2264
+ duration = 300,
2265
+ delay = 0,
2266
+ children
2267
+ } = _b, delegated = __objRest(_b, [
2268
+ "duration",
2269
+ "delay",
2270
+ "children"
2271
+ ]);
2272
+ return /* @__PURE__ */ React23.createElement(
2273
+ Box18,
2274
+ __spreadProps(__spreadValues({}, delegated), {
2275
+ sx: {
2276
+ animationDuration: duration + "ms",
2277
+ animationDelay: delay + "ms",
2278
+ animationName: fade.toString(),
2279
+ animationFillMode: "backwards",
2280
+ WebkitTransform: "translateZ(0)"
2281
+ }
2282
+ }),
2283
+ children
2284
+ );
2285
+ };
2286
+ var fade_in_default = FadeIn;
2287
+
2288
+ // src/scrollbar.tsx
2289
+ import { useEffect as useEffect4 } from "react";
2290
+
2291
+ // src/utils/get-scrollbar-width.ts
2292
+ var getScrollbarWidth = (document2) => {
2293
+ const outer = document2.createElement("div");
2294
+ outer.style.visibility = "hidden";
2295
+ outer.style.width = "100px";
2296
+ document2.body.appendChild(outer);
2297
+ outer.style.overflow = "scroll";
2298
+ const inner = document2.createElement("div");
2299
+ inner.style.width = "100%";
2300
+ outer.appendChild(inner);
2301
+ const delta = outer.offsetWidth - inner.offsetWidth;
2302
+ document2.body.removeChild(outer);
2303
+ return delta;
2304
+ };
2305
+ var get_scrollbar_width_default = getScrollbarWidth;
2306
+
2307
+ // src/scrollbar.tsx
2308
+ var Scrollbar = () => {
2309
+ useEffect4(() => {
2310
+ if (typeof document !== "undefined") {
2311
+ const delta = get_scrollbar_width_default(document);
2312
+ if (delta > 0) {
2313
+ document.body.classList.add("custom-scrollbar");
2314
+ document.getElementsByTagName("html")[0].classList.add("custom-scrollbar");
2315
+ }
2316
+ }
2317
+ }, []);
2318
+ return null;
2319
+ };
2320
+ var scrollbar_default = Scrollbar;
2321
+
2322
+ // src/guide.tsx
2323
+ import React24, { useState as useState5, useEffect as useEffect5 } from "react";
2324
+ import { Box as Box19, Container as Container2 } from "theme-ui";
2325
+ var Guide = ({ color = "muted" }) => {
2326
+ const [display, setDisplay] = useState5(false);
2327
+ useEffect5(() => {
2328
+ function handler(event) {
2329
+ const { key, metaKey } = event;
2330
+ if (key === ";" && metaKey) {
2331
+ setDisplay((prev) => !prev);
2332
+ }
2333
+ }
2334
+ document.addEventListener("keydown", handler);
2335
+ return () => {
2336
+ document.removeEventListener("keydown", handler);
2337
+ };
2338
+ }, []);
2339
+ return /* @__PURE__ */ React24.createElement(
2340
+ Box19,
2341
+ {
2342
+ sx: {
2343
+ position: "fixed",
2344
+ width: "100%",
2345
+ left: 0,
2346
+ top: 0,
2347
+ zIndex: color === "teal" ? 5e3 : -1,
2348
+ pointerEvents: "none",
2349
+ display: display ? "initial" : "none"
2350
+ }
2351
+ },
2352
+ /* @__PURE__ */ React24.createElement(Container2, null, /* @__PURE__ */ React24.createElement(Box19, { sx: { display: ["none", "none", "initial", "initial"] } }, /* @__PURE__ */ React24.createElement(
2353
+ GuideColumns,
2354
+ {
2355
+ indices: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
2356
+ color
2357
+ }
2358
+ )), /* @__PURE__ */ React24.createElement(Box19, { sx: { display: ["none", "initial", "none", "none"] } }, /* @__PURE__ */ React24.createElement(GuideColumns, { indices: [1, 2, 3, 4, 5, 6, 7, 8], color })), /* @__PURE__ */ React24.createElement(Box19, { sx: { display: ["initial", "none", "none", "none"] } }, /* @__PURE__ */ React24.createElement(GuideColumns, { indices: [1, 2, 3, 4, 5, 6], color })))
2359
+ );
2360
+ };
2361
+ var colorCycle = [
2362
+ "red",
2363
+ "orange",
2364
+ "yellow",
2365
+ "green",
2366
+ "teal",
2367
+ "blue",
2368
+ "purple",
2369
+ "pink"
2370
+ ];
2371
+ function GuideColumns({
2372
+ indices,
2373
+ color
2374
+ }) {
2375
+ const sx3 = {
2376
+ outerGuideColumn: {
2377
+ borderStyle: "solid",
2378
+ borderWidth: "0px",
2379
+ borderLeftWidth: color === "teal" ? "0px" : "1px",
2380
+ borderRightWidth: color === "teal" ? "0px" : "1px",
2381
+ opacity: color === "teal" ? 0.4 : 1
2382
+ },
2383
+ innerGuideColumn: {
2384
+ borderStyle: "solid",
2385
+ borderWidth: "0px",
2386
+ borderLeftWidth: "0px",
2387
+ borderRightWidth: "0px",
2388
+ opacity: color === "teal" ? 0.4 : 1
2389
+ }
2390
+ };
2391
+ return /* @__PURE__ */ React24.createElement(row_default, null, indices.map((i) => {
2392
+ return /* @__PURE__ */ React24.createElement(
2393
+ column_default,
2394
+ {
2395
+ key: i,
2396
+ start: [i],
2397
+ width: [1, 1],
2398
+ dl: 0.5,
2399
+ dr: 0.5,
2400
+ sx: __spreadValues({
2401
+ bg: color === "teal" ? "teal" : "transparent",
2402
+ height: "100vh"
2403
+ }, sx3.innerGuideColumn)
2404
+ },
2405
+ /* @__PURE__ */ React24.createElement(
2406
+ Box19,
2407
+ {
2408
+ sx: __spreadValues({
2409
+ mx: ["12px", 3, 3, 4],
2410
+ bg: color === "teal" ? "background" : "transparent",
2411
+ height: "100%",
2412
+ borderLeftColor: color === "rainbow" ? colorCycle[i % 8] : "muted",
2413
+ borderRightColor: color === "rainbow" ? colorCycle[i % 8] : "muted"
2414
+ }, sx3.outerGuideColumn)
2415
+ }
2416
+ )
2417
+ );
2418
+ }));
2419
+ }
2420
+ var guide_default = Guide;
2421
+
2422
+ // src/settings.tsx
2423
+ import React25 from "react";
2424
+ import { IconButton as IconButton3 } from "theme-ui";
2425
+ var Settings = (_a) => {
2426
+ var _b = _a, { value, sx: sx3 } = _b, props = __objRest(_b, ["value", "sx"]);
2427
+ return /* @__PURE__ */ React25.createElement(
2428
+ IconButton3,
2429
+ __spreadValues({
2430
+ sx: __spreadValues({
2431
+ cursor: "pointer",
2432
+ fill: "none",
2433
+ strokeWidth: "2px",
2434
+ stroke: "text",
2435
+ ".paren": {
2436
+ opacity: "0"
2437
+ },
2438
+ "@media (hover: hover) and (pointer: fine)": {
2439
+ "&:hover .paren": {
2440
+ opacity: "1"
2441
+ }
2442
+ }
2443
+ }, sx3),
2444
+ "aria-label": "Toggle Menu"
2445
+ }, props),
2446
+ !value && /* @__PURE__ */ React25.createElement(
2447
+ "svg",
2448
+ {
2449
+ style: {
2450
+ width: "50px",
2451
+ height: "30px",
2452
+ marginTop: "-3px",
2453
+ flexShrink: 0
2454
+ },
2455
+ xmlns: "http://www.w3.org/2000/svg",
2456
+ viewBox: "0 0 68 36"
2457
+ },
2458
+ /* @__PURE__ */ React25.createElement("line", { x1: "24", y1: "2.1", x2: "24", y2: "6.1" }),
2459
+ /* @__PURE__ */ React25.createElement("line", { x1: "24", y1: "24.1", x2: "24", y2: "33.9" }),
2460
+ /* @__PURE__ */ React25.createElement("line", { x1: "44", y1: "2.1", x2: "44", y2: "12.1" }),
2461
+ /* @__PURE__ */ React25.createElement("line", { x1: "44", y1: "30.1", x2: "44", y2: "33.9" }),
2462
+ /* @__PURE__ */ React25.createElement("circle", { cx: "24", cy: "15.1", r: "5" }),
2463
+ /* @__PURE__ */ React25.createElement("circle", { cx: "44", cy: "21.1", r: "5" }),
2464
+ /* @__PURE__ */ React25.createElement(
2465
+ "path",
2466
+ {
2467
+ style: { transition: "all 0.2s" },
2468
+ className: "paren",
2469
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
2470
+ }
2471
+ ),
2472
+ /* @__PURE__ */ React25.createElement(
2473
+ "path",
2474
+ {
2475
+ style: { transition: "all 0.2s" },
2476
+ className: "paren",
2477
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
2478
+ }
2479
+ )
2480
+ ),
2481
+ value && /* @__PURE__ */ React25.createElement(
2482
+ "svg",
2483
+ {
2484
+ style: {
2485
+ width: "50px",
2486
+ height: "30px",
2487
+ marginTop: "-3px",
2488
+ flexShrink: 0
2489
+ },
2490
+ xmlns: "http://www.w3.org/2000/svg",
2491
+ viewBox: "0 0 68 36"
2492
+ },
2493
+ /* @__PURE__ */ React25.createElement("line", { x1: "50.85", y1: "29.79", x2: "17.15", y2: "6.21" }),
2494
+ /* @__PURE__ */ React25.createElement("line", { x1: "17.15", y1: "29.79", x2: "50.85", y2: "6.21" }),
2495
+ /* @__PURE__ */ React25.createElement(
2496
+ "path",
2497
+ {
2498
+ style: { transition: "all 0.2s" },
2499
+ className: "paren",
2500
+ d: "M6.4,1.2c-6.3,10.3-6.3,23.3,0,33.6"
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ React25.createElement(
2504
+ "path",
2505
+ {
2506
+ style: { transition: "all 0.2s" },
2507
+ className: "paren",
2508
+ d: "M61.6,34.8c6.3-10.3,6.3-23.3,0-33.6"
2509
+ }
2510
+ )
2511
+ )
2512
+ );
2513
+ };
2514
+ var settings_default = Settings;
2515
+
2516
+ // src/layout.tsx
2517
+ var Layout = ({
2518
+ title,
2519
+ description,
2520
+ url,
2521
+ card,
2522
+ children,
2523
+ status,
2524
+ nav,
2525
+ settings,
2526
+ footer = true,
2527
+ header = true,
2528
+ metadata = "mouse",
2529
+ links: links2 = "remote",
2530
+ dimmer = "bottom",
2531
+ guide = true,
2532
+ scrollbar = false,
2533
+ fade: fade2 = true,
2534
+ container = true,
2535
+ printable = false
2536
+ }) => {
2537
+ let content = children;
2538
+ if (fade2) {
2539
+ content = /* @__PURE__ */ React26.createElement(fade_in_default, { duration: 250 }, content);
2540
+ }
2541
+ if (container) {
2542
+ content = /* @__PURE__ */ React26.createElement(Box20, { sx: { mb: [8, 8, 9, 10] } }, /* @__PURE__ */ React26.createElement(Container3, null, content));
2543
+ }
2544
+ const { theme } = useThemeUI3();
2545
+ const hideOnPrint = printable ? {
2546
+ "@media print": {
2547
+ display: "none"
2548
+ }
2549
+ } : {};
2550
+ useEffect6(() => {
2551
+ var _a;
2552
+ if (!theme) return;
2553
+ const handler = (e) => {
2554
+ if (e.matches && (settings == null ? void 0 : settings.value) && (settings == null ? void 0 : settings.onClick)) {
2555
+ settings.onClick();
2556
+ }
2557
+ };
2558
+ const query = window.matchMedia(
2559
+ `(min-width: ${((_a = theme == null ? void 0 : theme.breakpoints) == null ? void 0 : _a[1]) || "64em"})`
2560
+ );
2561
+ query.onchange = handler;
2562
+ return () => {
2563
+ query.onchange = null;
2564
+ };
2565
+ }, [theme == null ? void 0 : theme.breakpoints, settings == null ? void 0 : settings.value, settings == null ? void 0 : settings.onClick]);
2566
+ const menuItems = [
2567
+ /* @__PURE__ */ React26.createElement(
2568
+ dimmer_default,
2569
+ {
2570
+ key: "dimmer",
2571
+ sx: {
2572
+ color: "primary",
2573
+ mt: "-2px",
2574
+ display: [
2575
+ "block",
2576
+ "block",
2577
+ dimmer === "top" ? "block" : "none",
2578
+ dimmer === "top" ? "block" : "none"
2579
+ ]
2580
+ }
2581
+ }
2582
+ )
2583
+ ];
2584
+ if (settings) {
2585
+ menuItems.push(
2586
+ /* @__PURE__ */ React26.createElement(
2587
+ settings_default,
2588
+ __spreadValues({
2589
+ key: "settings",
2590
+ sx: { mr: ["2px"], display: ["inherit", "inherit", "none", "none"] }
2591
+ }, settings)
2592
+ )
2593
+ );
2594
+ }
2595
+ return /* @__PURE__ */ React26.createElement(React26.Fragment, null, guide && /* @__PURE__ */ React26.createElement(guide_default, { color: typeof guide === "string" ? guide : void 0 }), scrollbar && /* @__PURE__ */ React26.createElement(scrollbar_default, null), /* @__PURE__ */ React26.createElement(meta_default, { card, description, title, url }), /* @__PURE__ */ React26.createElement(
2596
+ Flex4,
2597
+ {
2598
+ sx: {
2599
+ flexDirection: "column",
2600
+ minHeight: "100vh"
2601
+ }
2602
+ },
2603
+ header && /* @__PURE__ */ React26.createElement(
2604
+ Box20,
2605
+ {
2606
+ as: "header",
2607
+ sx: __spreadValues({
2608
+ width: "100%",
2609
+ borderStyle: "solid",
2610
+ borderColor: "muted",
2611
+ borderWidth: "0px",
2612
+ borderBottomWidth: "1px",
2613
+ position: "sticky",
2614
+ top: 0,
2615
+ bg: "background",
2616
+ height: "56px",
2617
+ zIndex: 2e3
2618
+ }, hideOnPrint)
2619
+ },
2620
+ /* @__PURE__ */ React26.createElement(Container3, null, /* @__PURE__ */ React26.createElement(
2621
+ header_default,
2622
+ {
2623
+ mode: links2,
2624
+ status,
2625
+ nav,
2626
+ menuItems
2627
+ }
2628
+ ))
2629
+ ),
2630
+ /* @__PURE__ */ React26.createElement(
2631
+ Box20,
2632
+ {
2633
+ sx: {
2634
+ width: "100%",
2635
+ flex: "1 1 auto"
2636
+ }
2637
+ },
2638
+ content
2639
+ ),
2640
+ footer && /* @__PURE__ */ React26.createElement(
2641
+ Box20,
2642
+ {
2643
+ as: "footer",
2644
+ sx: __spreadValues({
2645
+ width: "100%",
2646
+ borderStyle: "solid",
2647
+ borderColor: "muted",
2648
+ borderWidth: "0px",
2649
+ borderTopWidth: "1px"
2650
+ }, hideOnPrint)
2651
+ },
2652
+ /* @__PURE__ */ React26.createElement(Container3, null, /* @__PURE__ */ React26.createElement(footer_default, null))
2653
+ ),
2654
+ dimmer === "bottom" && /* @__PURE__ */ React26.createElement(
2655
+ Box20,
2656
+ {
2657
+ sx: {
2658
+ display: ["none", "none", "initial", "initial"],
2659
+ position: ["fixed"],
2660
+ right: [13],
2661
+ bottom: [17, 17, 15, 15]
2662
+ }
2663
+ },
2664
+ /* @__PURE__ */ React26.createElement(dimmer_default, null)
2665
+ ),
2666
+ metadata && /* @__PURE__ */ React26.createElement(metadata_default, { mode: typeof metadata === "string" ? metadata : "mouse" })
2667
+ ));
2668
+ };
2669
+ var layout_default = Layout;
2670
+
2671
+ // src/custom-404.tsx
2672
+ var Custom404 = () => {
2673
+ return /* @__PURE__ */ React27.createElement(
2674
+ layout_default,
2675
+ {
2676
+ footer: false,
2677
+ title: "404 \u2013 CarbonPlan",
2678
+ description: "Sorry but we can't seem to find the page you are looking for."
2679
+ },
2680
+ /* @__PURE__ */ React27.createElement(row_default, { sx: { mb: [5, 0, 0], pt: [0, 0, 6] } }, /* @__PURE__ */ React27.createElement(column_default, { start: [1, 1, 3, 3], width: [6, 4, 4, 4] }, /* @__PURE__ */ React27.createElement(Box21, { as: "h1", variant: "styles.h1" }, "Oops!"), /* @__PURE__ */ React27.createElement(
2681
+ Box21,
2682
+ {
2683
+ sx: {
2684
+ fontSize: [4, 4, 4, 5],
2685
+ lineHeight: "h3",
2686
+ mt: [3, 4, 4],
2687
+ mb: [2, 3, 3],
2688
+ maxWidth: ["90%", "90%", "400px"]
2689
+ }
2690
+ },
2691
+ "Sorry but we can't seem to find the page you are looking for."
2692
+ ), /* @__PURE__ */ React27.createElement(
2693
+ Box21,
2694
+ {
2695
+ sx: {
2696
+ color: "secondary",
2697
+ fontFamily: "mono",
2698
+ letterSpacing: "mono",
2699
+ fontSize: [2, 2, 2, 3],
2700
+ mt: [4, 5, 5]
2701
+ }
2702
+ },
2703
+ "ERROR CODE 404"
2704
+ )), /* @__PURE__ */ React27.createElement(column_default, { start: [2, 5, 7, 7], width: [4, 4, 4, 4] }, /* @__PURE__ */ React27.createElement(
2705
+ Box21,
2706
+ {
2707
+ sx: {
2708
+ width: ["100%"],
2709
+ mt: [2, 4, 4, 5],
2710
+ fill: "primary"
2711
+ }
2712
+ },
2713
+ /* @__PURE__ */ React27.createElement(PoopSad, { sx: { width: "100%", height: "auto" } })
2714
+ )))
2715
+ );
2716
+ };
2717
+ var custom_404_default = Custom404;
2718
+
2719
+ // src/expander.tsx
2720
+ import React28 from "react";
2721
+ import { IconButton as IconButton4 } from "theme-ui";
2722
+ var Expander = ({ value, id, onClick, sx: sx3 }) => {
2723
+ return /* @__PURE__ */ React28.createElement(
2724
+ IconButton4,
2725
+ {
2726
+ onClick,
2727
+ id,
2728
+ role: "checkbox",
2729
+ "aria-checked": value,
2730
+ "aria-label": "Expand",
2731
+ sx: __spreadValues({
2732
+ display: "inline-block",
2733
+ width: 24,
2734
+ height: 24,
2735
+ p: [1],
2736
+ cursor: "pointer",
2737
+ fill: "secondary",
2738
+ stroke: "secondary",
2739
+ "@media (hover: hover) and (pointer: fine)": {
2740
+ "&:hover": {
2741
+ fill: "primary",
2742
+ stroke: "primary"
2743
+ }
2744
+ }
2745
+ }, sx3)
2746
+ },
2747
+ /* @__PURE__ */ React28.createElement("svg", { viewBox: "0 0 16 16" }, /* @__PURE__ */ React28.createElement(
2748
+ "path",
2749
+ {
2750
+ d: "M8,0 V16 M0,8 H16",
2751
+ style: {
2752
+ strokeWidth: 2,
2753
+ transition: "0.25s all",
2754
+ transformOrigin: "8px 8px",
2755
+ transform: value ? "rotate(45deg)" : "rotate(0deg)"
2756
+ }
2757
+ }
2758
+ ))
2759
+ );
2760
+ };
2761
+ var expander_default = Expander;
2762
+
2763
+ // src/figure.tsx
2764
+ import React29 from "react";
2765
+ import { Box as Box22 } from "theme-ui";
2766
+ var Figure = ({ as = "figure", children, sx: sx3 }) => {
2767
+ const childrenArray = React29.Children.toArray(children);
2768
+ const captionElement = childrenArray.find((child) => {
2769
+ if (!React29.isValidElement(child)) return false;
2770
+ const type = child.type;
2771
+ return typeof type !== "string" && "displayName" in type && (type.displayName === "FigureCaption" || type.displayName === "TableCaption");
2772
+ });
2773
+ const captionProps = React29.isValidElement(captionElement) ? captionElement.props : void 0;
2774
+ const captionType = React29.isValidElement(captionElement) ? captionElement.type : void 0;
2775
+ const elementNumber = captionProps == null ? void 0 : captionProps.number;
2776
+ const elementType = typeof captionType !== "string" && captionType && "displayName" in captionType && captionType.displayName === "TableCaption" ? "table" : "figure";
2777
+ const id = elementNumber ? `${elementType}-${elementNumber}` : void 0;
2778
+ return /* @__PURE__ */ React29.createElement(
2779
+ Box22,
2780
+ {
2781
+ as,
2782
+ id,
2783
+ sx: __spreadValues({
2784
+ my: [6, 6, 6, 7],
2785
+ scrollMarginTop: "60px",
2786
+ // account for header height
2787
+ "@media print": {
2788
+ breakInside: "avoid"
2789
+ }
2790
+ }, sx3)
2791
+ },
2792
+ /* @__PURE__ */ React29.createElement(group_default, { spacing: [4, 4, 4, 5] }, children)
2793
+ );
2794
+ };
2795
+ var figure_default = Figure;
2796
+
2797
+ // src/figure-caption.tsx
2798
+ import React30 from "react";
2799
+ var FigureCaption = ({
2800
+ as = "figcaption",
2801
+ number,
2802
+ children
2803
+ }) => {
2804
+ return /* @__PURE__ */ React30.createElement(caption_default, { as, number, label: "figure" }, children);
2805
+ };
2806
+ FigureCaption.displayName = "FigureCaption";
2807
+ var figure_caption_default = FigureCaption;
2808
+
2809
+ // src/filter.tsx
2810
+ import React32, { useMemo } from "react";
2811
+ import { Box as Box24 } from "theme-ui";
2812
+
2813
+ // src/tag.tsx
2814
+ import React31 from "react";
2815
+ import { Box as Box23 } from "theme-ui";
2816
+ var Tag = (_a) => {
2817
+ var _b = _a, { label, value, sx: sx3, children } = _b, props = __objRest(_b, ["label", "value", "sx", "children"]);
2818
+ const color = get_sx_color_default(sx3);
2819
+ const isClickable = props && (props.onClick || props.onDoubleClick);
2820
+ return /* @__PURE__ */ React31.createElement(
2821
+ Box23,
2822
+ __spreadValues({
2823
+ as: isClickable ? "button" : "span",
2824
+ role: "checkbox",
2825
+ "aria-checked": value,
2826
+ "aria-label": label,
2827
+ sx: __spreadValues({
2828
+ display: "inline-block",
2829
+ fontSize: [1, 1, 1, 2],
2830
+ fontFamily: "mono",
2831
+ letterSpacing: "mono",
2832
+ cursor: isClickable ? "pointer" : "inherit",
2833
+ color,
2834
+ backgroundColor: "transparent",
2835
+ borderStyle: "solid",
2836
+ borderColor: color,
2837
+ lineHeight: "body",
2838
+ borderWidth: "0px",
2839
+ borderBottomWidth: "1px",
2840
+ textTransform: "uppercase",
2841
+ userSelect: "none",
2842
+ transition: "opacity 0.05s",
2843
+ pt: ["1px"],
2844
+ pb: ["2px"],
2845
+ px: [0],
2846
+ m: [0],
2847
+ opacity: value == null || value ? 1 : color === "primary" ? 0.24 : 0.33
2848
+ }, sx3)
2849
+ }, props),
2850
+ children
2851
+ );
2852
+ };
2853
+ var tag_default = Tag;
2854
+
2855
+ // src/filter.tsx
2856
+ var sx2 = {
2857
+ label: {
2858
+ fontFamily: "mono",
2859
+ letterSpacing: "mono",
2860
+ fontSize: [1, 1, 1, 2],
2861
+ color: "secondary",
2862
+ userSelect: "none",
2863
+ textTransform: "uppercase"
2864
+ }
2865
+ };
2866
+ var duplicateOptions = (options, defaultValue, overrides = {}) => {
2867
+ let result = __spreadValues({}, options);
2868
+ Object.keys(options).forEach((key) => {
2869
+ result[key] = !!overrides[key] || defaultValue;
2870
+ });
2871
+ return result;
2872
+ };
2873
+ var isAll = (option) => {
2874
+ return Object.keys(option).filter((d) => option[d]).length === Object.keys(option).length;
2875
+ };
2876
+ var updateValues = ({
2877
+ values,
2878
+ multiSelect,
2879
+ setValues,
2880
+ value
2881
+ }) => {
2882
+ const isAllAlreadySelected = isAll(values);
2883
+ let updatedToggle;
2884
+ if (value === "all") {
2885
+ if (!isAllAlreadySelected) {
2886
+ updatedToggle = duplicateOptions(values, true);
2887
+ } else if (multiSelect) {
2888
+ updatedToggle = duplicateOptions(values, false);
2889
+ }
2890
+ } else if (multiSelect) {
2891
+ updatedToggle = __spreadProps(__spreadValues({}, values), { [value]: !values[value] });
2892
+ } else {
2893
+ updatedToggle = duplicateOptions(values, false, {
2894
+ [value]: true
2895
+ });
2896
+ }
2897
+ if (updatedToggle) {
2898
+ setValues(updatedToggle);
2899
+ }
2900
+ };
2901
+ var Filter = (_a) => {
2902
+ var _b = _a, {
2903
+ values,
2904
+ setValues,
2905
+ label,
2906
+ colors,
2907
+ order,
2908
+ labels,
2909
+ showAll = false,
2910
+ multiSelect = false
2911
+ } = _b, props = __objRest(_b, [
2912
+ "values",
2913
+ "setValues",
2914
+ "label",
2915
+ "colors",
2916
+ "order",
2917
+ "labels",
2918
+ "showAll",
2919
+ "multiSelect"
2920
+ ]);
2921
+ const keys = useMemo(() => {
2922
+ if (order) {
2923
+ return order;
2924
+ } else {
2925
+ return Object.keys(values);
2926
+ }
2927
+ }, [order, ...Object.keys(values).sort()]);
2928
+ return /* @__PURE__ */ React32.createElement(Box24, __spreadValues({}, props), label && /* @__PURE__ */ React32.createElement(Box24, { sx: sx2.label }, label), /* @__PURE__ */ React32.createElement(Box24, { sx: { mt: label ? [3] : 0 } }, showAll && /* @__PURE__ */ React32.createElement(
2929
+ tag_default,
2930
+ {
2931
+ label: "all",
2932
+ onClick: () => updateValues({
2933
+ values,
2934
+ multiSelect,
2935
+ setValues,
2936
+ value: "all"
2937
+ }),
2938
+ value: isAll(values),
2939
+ sx: { mr: [2] }
2940
+ },
2941
+ "All"
2942
+ ), keys.map((d, i) => /* @__PURE__ */ React32.createElement(
2943
+ tag_default,
2944
+ {
2945
+ label: String(d),
2946
+ onClick: () => updateValues({
2947
+ values,
2948
+ multiSelect,
2949
+ setValues,
2950
+ value: d
2951
+ }),
2952
+ onDoubleClick: () => updateValues({
2953
+ values,
2954
+ multiSelect: false,
2955
+ setValues,
2956
+ value: d
2957
+ }),
2958
+ key: i,
2959
+ value: values[d],
2960
+ sx: {
2961
+ width: "max-content",
2962
+ color: colors ? colors[d] : "primary",
2963
+ mr: [2],
2964
+ mb: [1]
2965
+ }
2966
+ },
2967
+ labels ? labels[d] : String(d)
2968
+ ))));
2969
+ };
2970
+ var filter_default = Filter;
2971
+
2972
+ // src/heading.tsx
2973
+ import React34 from "react";
2974
+ import { Box as Box26 } from "theme-ui";
2975
+
2976
+ // src/sidenote.tsx
2977
+ import React33 from "react";
2978
+ import { Box as Box25 } from "theme-ui";
2979
+ var Sidenote = ({ children, variant = "h1" }) => {
2980
+ let mt;
2981
+ if (variant === "h1") mt = [4, "27px", "42px", "54px"];
2982
+ if (variant === "h2") mt = [4, 4, "14px", "25px"];
2983
+ return /* @__PURE__ */ React33.createElement(React33.Fragment, null, /* @__PURE__ */ React33.createElement(column_default, { start: [1, 4, 8, 8], width: [1, 1, 1, 1] }, /* @__PURE__ */ React33.createElement(
2984
+ Box25,
2985
+ {
2986
+ sx: {
2987
+ mt,
2988
+ fontFamily: "faux",
2989
+ letterSpacing: "faux",
2990
+ fontSize: [2, 2, 2, 3],
2991
+ textAlign: "right"
2992
+ }
2993
+ },
2994
+ "/"
2995
+ )), /* @__PURE__ */ React33.createElement(column_default, { start: [2, 5, 9, 9], width: [3, 3, 2, 2] }, /* @__PURE__ */ React33.createElement(
2996
+ Box25,
2997
+ {
2998
+ sx: {
2999
+ mt,
3000
+ fontFamily: "faux",
3001
+ letterSpacing: "faux",
3002
+ fontSize: [2, 2, 2, 3],
3003
+ height: ["100%", "0px", "0px", "0px"]
3004
+ }
3005
+ },
3006
+ children
3007
+ )));
3008
+ };
3009
+ var sidenote_default = Sidenote;
3010
+
3011
+ // src/heading.tsx
3012
+ var Heading = ({
3013
+ children,
3014
+ sidenote,
3015
+ variant = "h1",
3016
+ description,
3017
+ descriptionStart = [1, 3, 5, 5],
3018
+ descriptionWidth = [5, 5, 5, 4],
3019
+ sx: sx3
3020
+ }) => {
3021
+ let titleWidth = [6, 6, 6, 6];
3022
+ if (description) {
3023
+ titleWidth[1] = descriptionStart[1] - 1;
3024
+ titleWidth[2] = descriptionStart[2] - 2;
3025
+ titleWidth[3] = descriptionStart[3] - 2;
3026
+ }
3027
+ if (!["h1", "h2"].includes(variant)) {
3028
+ throw new Error(`variant must be 'h1' or 'h2' but got '${variant}'`);
3029
+ }
3030
+ return /* @__PURE__ */ React34.createElement(row_default, { sx: __spreadValues({ mt: [5, 6, 7, 8], mb: [5, 6, 7, 8] }, sx3) }, /* @__PURE__ */ React34.createElement(column_default, { start: [1, 1, 2, 2], width: titleWidth }, variant === "h1" && /* @__PURE__ */ React34.createElement(Box26, { as: "h1", variant: "styles.h1", sx: { my: [0, 0, 0, 0] } }, children), variant === "h2" && /* @__PURE__ */ React34.createElement(Box26, { as: "h2", variant: "styles.h2", sx: { my: [0, 0, 0, 0] } }, children)), sidenote && /* @__PURE__ */ React34.createElement(sidenote_default, { variant }, sidenote), description && /* @__PURE__ */ React34.createElement(column_default, { start: descriptionStart, width: descriptionWidth }, /* @__PURE__ */ React34.createElement(
3031
+ Box26,
3032
+ {
3033
+ sx: {
3034
+ mt: [4, "5px", "20px", "31px"],
3035
+ fontSize: [2, 2, 2, 3]
3036
+ }
3037
+ },
3038
+ description
3039
+ )));
3040
+ };
3041
+ var heading_default = Heading;
3042
+
3043
+ // src/input.tsx
3044
+ import React35, { forwardRef as forwardRef4 } from "react";
3045
+ import { Input as ThemedInput } from "theme-ui";
3046
+ var Input = (_a, ref) => {
3047
+ var _b = _a, { size = "sm", inverted, sx: sx3 } = _b, props = __objRest(_b, ["size", "inverted", "sx"]);
3048
+ const defaultColor = inverted ? "secondary" : "primary";
3049
+ const styles3 = __spreadValues(__spreadValues({
3050
+ color: defaultColor,
3051
+ borderColor: "secondary",
3052
+ borderStyle: "solid",
3053
+ borderWidth: "0px",
3054
+ borderBottomWidth: "1px",
3055
+ borderRadius: "0px",
3056
+ transition: "border 0.15s",
3057
+ width: "calc(min(15ch, 100%))",
3058
+ p: [0],
3059
+ py: ["2px"],
3060
+ "input::-webkit-outer-spin-button": {
3061
+ WebkitAppearance: "none",
3062
+ margin: 0
3063
+ },
3064
+ "input::-webkit-inner-spin-button": {
3065
+ WebkitAppearance: "none",
3066
+ margin: 0
3067
+ },
3068
+ ":focus": {
3069
+ borderColor: "primary"
3070
+ },
3071
+ ":focus-visible": {
3072
+ outline: "none !important",
3073
+ background: "none !important"
3074
+ }
3075
+ }, get_size_styles_default(size)), sx3);
3076
+ return /* @__PURE__ */ React35.createElement(ThemedInput, __spreadProps(__spreadValues({}, props), { ref, sx: styles3 }));
3077
+ };
3078
+ var input_default = forwardRef4(Input);
3079
+
3080
+ // src/link-group.tsx
3081
+ import React36 from "react";
3082
+ import { Flex as Flex5 } from "theme-ui";
3083
+ import { RotatingArrow } from "@carbonplan/icons";
3084
+ var LinkGroup = ({
3085
+ members,
3086
+ color,
3087
+ inverted,
3088
+ size = "xs",
3089
+ rowGap = [2, 2, 2, 3],
3090
+ columnGap = [3, 3, 3, 4],
3091
+ direction = "horizontal",
3092
+ sx: sx3
3093
+ }) => {
3094
+ return /* @__PURE__ */ React36.createElement(
3095
+ Flex5,
3096
+ {
3097
+ sx: __spreadValues({
3098
+ flexDirection: direction === "horizontal" ? "row" : "column",
3099
+ rowGap,
3100
+ columnGap,
3101
+ flexWrap: "wrap"
3102
+ }, sx3)
3103
+ },
3104
+ members.map((d, i) => {
3105
+ return /* @__PURE__ */ React36.createElement(
3106
+ button_default,
3107
+ {
3108
+ key: i,
3109
+ href: d.href,
3110
+ size,
3111
+ sx: { color },
3112
+ inverted,
3113
+ suffix: /* @__PURE__ */ React36.createElement(RotatingArrow, null)
3114
+ },
3115
+ d.label
3116
+ );
3117
+ })
3118
+ );
3119
+ };
3120
+ var link_group_default = LinkGroup;
3121
+
3122
+ // src/select.tsx
3123
+ import React37, { useRef as useRef2 } from "react";
3124
+ import { Box as Box27 } from "theme-ui";
3125
+ import { Arrow as Arrow3 } from "@carbonplan/icons";
3126
+ var Select = (_a) => {
3127
+ var _b = _a, {
3128
+ children,
3129
+ size = "sm",
3130
+ sx: sx3,
3131
+ sxSelect,
3132
+ onChange
3133
+ } = _b, props = __objRest(_b, [
3134
+ "children",
3135
+ "size",
3136
+ "sx",
3137
+ "sxSelect",
3138
+ "onChange"
3139
+ ]);
3140
+ const color = get_sx_color_default(sx3);
3141
+ const sizeStyles = get_size_styles_default(size);
3142
+ const ref = useRef2(null);
3143
+ if (!["xs", "sm", "md"].includes(size)) {
3144
+ throw new Error("Size must be xs, sm, or md");
3145
+ }
3146
+ const sizeConfig = {
3147
+ xs: {
3148
+ height: [14, 14, 14, 16],
3149
+ width: [14, 14, 14, 14],
3150
+ top: ["1px"],
3151
+ ml: ["-14px", "-14px", "-14px", "-16px"]
3152
+ },
3153
+ sm: {
3154
+ height: [15, 15, 15, 20],
3155
+ width: [15, 15, 15, 20],
3156
+ top: ["1px"],
3157
+ ml: ["-16px", "-16px", "-16px", "-20px"]
3158
+ },
3159
+ md: {
3160
+ height: [20, 20, 20, 20],
3161
+ width: [20, 20, 20, 20],
3162
+ top: ["2px"],
3163
+ ml: ["-20px", "-20px", "-20px", "-20px"]
3164
+ }
3165
+ };
3166
+ const { height, width, top, ml } = sizeConfig[size];
3167
+ const pr = width.map((d) => d + 12);
3168
+ return /* @__PURE__ */ React37.createElement(
3169
+ Box27,
3170
+ {
3171
+ sx: __spreadValues({
3172
+ display: "inline-block"
3173
+ }, sx3)
3174
+ },
3175
+ /* @__PURE__ */ React37.createElement(
3176
+ Box27,
3177
+ __spreadValues({
3178
+ as: "select",
3179
+ ref,
3180
+ onChange: (e) => {
3181
+ var _a2;
3182
+ (_a2 = ref.current) == null ? void 0 : _a2.blur();
3183
+ if (onChange)
3184
+ onChange(e);
3185
+ },
3186
+ sx: __spreadValues(__spreadProps(__spreadValues({}, sizeStyles), {
3187
+ lineHeight: "normal",
3188
+ cursor: "pointer",
3189
+ WebkitAppearance: "none",
3190
+ MozAppearance: "none",
3191
+ pb: ["5px"],
3192
+ bg: "background",
3193
+ pr,
3194
+ border: "none",
3195
+ borderBottomStyle: "solid",
3196
+ borderBottomWidth: "1px",
3197
+ borderBottomColor: "primary",
3198
+ borderRadius: "0px",
3199
+ width: "fit-content",
3200
+ color,
3201
+ userSelect: "none",
3202
+ "@media (hover: none) and (pointer: coarse)": {
3203
+ "&:focus-visible": {
3204
+ outline: "none !important",
3205
+ background: "transparent !important"
3206
+ }
3207
+ }
3208
+ }), sxSelect)
3209
+ }, props),
3210
+ children
3211
+ ),
3212
+ /* @__PURE__ */ React37.createElement(
3213
+ Arrow3,
3214
+ {
3215
+ sx: {
3216
+ width,
3217
+ height,
3218
+ position: "relative",
3219
+ ml,
3220
+ top,
3221
+ fill: "secondary",
3222
+ transform: "rotate(135deg)",
3223
+ pointerEvents: "none"
3224
+ }
3225
+ }
3226
+ )
3227
+ );
3228
+ };
3229
+ var select_default = Select;
3230
+
3231
+ // src/slider.tsx
3232
+ import React38, { forwardRef as forwardRef5 } from "react";
3233
+ import { useThemeUI as useThemeUI4, Slider as ThemeSlider } from "theme-ui";
3234
+ var Slider = (_a, ref) => {
3235
+ var _b = _a, { sx: sx3 } = _b, props = __objRest(_b, ["sx"]);
3236
+ const color = get_sx_color_default(sx3);
3237
+ const {
3238
+ theme: { rawColors: colors }
3239
+ } = useThemeUI4();
3240
+ return /* @__PURE__ */ React38.createElement(
3241
+ ThemeSlider,
3242
+ __spreadValues({
3243
+ ref,
3244
+ sx: __spreadValues({
3245
+ "&::-webkit-slider-thumb": {
3246
+ height: [22, 18, 16],
3247
+ width: [22, 18, 16],
3248
+ boxShadow: `0 0 0 0px ${colors == null ? void 0 : colors.secondary}`,
3249
+ transition: "box-shadow .15s ease"
3250
+ },
3251
+ "&::-moz-range-thumb": {
3252
+ height: [22, 18, 16],
3253
+ width: [22, 18, 16],
3254
+ boxShadow: `0 0 0 0px ${colors == null ? void 0 : colors.secondary}`,
3255
+ transition: "box-shadow .15s ease"
3256
+ },
3257
+ ":focus-visible": {
3258
+ outline: "none !important",
3259
+ background: `${colors == null ? void 0 : colors.secondary} !important`
3260
+ },
3261
+ ":focus": {
3262
+ color,
3263
+ "&::-webkit-slider-thumb": {
3264
+ boxShadow: `0 0 0 4px ${colors == null ? void 0 : colors.secondary}`
3265
+ },
3266
+ "&::-moz-range-thumb": {
3267
+ boxShadow: `0 0 0 4px ${colors == null ? void 0 : colors.secondary}`
3268
+ }
3269
+ },
3270
+ color
3271
+ }, sx3)
3272
+ }, props)
3273
+ );
3274
+ };
3275
+ var slider_default = forwardRef5(Slider);
3276
+
3277
+ // src/table.tsx
3278
+ import React39 from "react";
3279
+ import { Box as Box28 } from "theme-ui";
3280
+ var styles2 = {
3281
+ reset: {
3282
+ verticalAlign: "baseline",
3283
+ border: 0,
3284
+ outline: 0,
3285
+ margin: 0,
3286
+ padding: 0
3287
+ },
3288
+ row: {
3289
+ borderStyle: "solid",
3290
+ borderWidth: "0px",
3291
+ borderTopWidth: "1px",
3292
+ borderColor: "muted",
3293
+ pt: [3, 3, 3, "20px"],
3294
+ pb: [3, 3, 3, "20px"],
3295
+ mb: ["2px"]
3296
+ },
3297
+ header: {
3298
+ display: "block",
3299
+ textTransform: "uppercase",
3300
+ letterSpacing: "smallcaps",
3301
+ fontFamily: "heading",
3302
+ fontSize: [2, 2, 2, 3]
3303
+ },
3304
+ index: {
3305
+ display: "block",
3306
+ textTransform: "uppercase",
3307
+ letterSpacing: "smallcaps",
3308
+ fontFamily: "heading",
3309
+ fontSize: [2, 2, 2, 3]
3310
+ },
3311
+ entry: {
3312
+ display: "block",
3313
+ fontSize: [2, 2, 2, 3],
3314
+ fontFamily: "faux",
3315
+ letterSpacing: "faux",
3316
+ mb: ["1px"],
3317
+ mt: [2, 0, 0, 0]
3318
+ }
3319
+ };
3320
+ var Table = ({
3321
+ data,
3322
+ sx: sx3,
3323
+ color,
3324
+ header,
3325
+ columns,
3326
+ start,
3327
+ width,
3328
+ index = true,
3329
+ borderBottom = true,
3330
+ borderTop = true
3331
+ }) => {
3332
+ if (!start || !columns || !width) {
3333
+ throw new Error("Must provide columns, start, and width");
3334
+ }
3335
+ return /* @__PURE__ */ React39.createElement(Box28, { as: "table", sx: __spreadValues({ display: "block" }, sx3) }, /* @__PURE__ */ React39.createElement(Box28, { as: "tbody", sx: { display: "block" } }, header && /* @__PURE__ */ React39.createElement(
3336
+ row_default,
3337
+ {
3338
+ as: "tr",
3339
+ sx: __spreadProps(__spreadValues(__spreadValues(__spreadValues({}, styles2.reset), styles2.header), styles2.row), {
3340
+ color,
3341
+ borderTopWidth: !borderTop ? "0px" : "1px"
3342
+ })
3343
+ },
3344
+ /* @__PURE__ */ React39.createElement(column_default, { as: "td", start: [1], width: columns, sx: styles2.index }, header)
3345
+ ), data.map((row, i) => {
3346
+ return /* @__PURE__ */ React39.createElement(
3347
+ row_default,
3348
+ {
3349
+ as: "tr",
3350
+ columns,
3351
+ key: i,
3352
+ sx: __spreadProps(__spreadValues(__spreadValues({}, styles2.reset), styles2.row), {
3353
+ pb: borderBottom && i === data.length - 1 ? ["18px", "18px", "18px", "22px"] : [3, 3, 3, "20px"],
3354
+ borderBottomWidth: borderBottom && i === data.length - 1 ? "1px" : "0px",
3355
+ borderTopWidth: !borderTop && i === 0 && !header ? "0px" : "1px"
3356
+ })
3357
+ },
3358
+ row.map((column, j) => {
3359
+ return /* @__PURE__ */ React39.createElement(
3360
+ column_default,
3361
+ {
3362
+ as: "td",
3363
+ key: j,
3364
+ start: start[j],
3365
+ width: width[j],
3366
+ sx: j === 0 && index ? __spreadValues(__spreadValues({}, styles2.reset), styles2.index) : __spreadValues(__spreadValues({}, styles2.reset), styles2.entry)
3367
+ },
3368
+ column
3369
+ );
3370
+ })
3371
+ );
3372
+ })));
3373
+ };
3374
+ var table_default = Table;
3375
+
3376
+ // src/table-caption.tsx
3377
+ import React40 from "react";
3378
+ var TableCaption = ({
3379
+ as = "figcaption",
3380
+ number,
3381
+ children
3382
+ }) => {
3383
+ return /* @__PURE__ */ React40.createElement(caption_default, { as, number, label: "table" }, children);
3384
+ };
3385
+ TableCaption.displayName = "TableCaption";
3386
+ var table_caption_default = TableCaption;
3387
+
3388
+ // src/toggle.tsx
3389
+ import React41, { forwardRef as forwardRef6 } from "react";
3390
+ import { Box as Box29 } from "theme-ui";
3391
+ import { transparentize as transparentize2 } from "@theme-ui/color";
3392
+ var Toggle = (_a, ref) => {
3393
+ var _b = _a, { value, onClick, disabled, sx: sx3 } = _b, props = __objRest(_b, ["value", "onClick", "disabled", "sx"]);
3394
+ const color = get_sx_color_default(sx3);
3395
+ const active = disabled ? false : value;
3396
+ return /* @__PURE__ */ React41.createElement(
3397
+ Box29,
3398
+ __spreadValues({
3399
+ ref,
3400
+ as: "button",
3401
+ onClick,
3402
+ role: "checkbox",
3403
+ "aria-checked": active,
3404
+ "aria-label": "Toggle",
3405
+ sx: __spreadValues({
3406
+ border: "none",
3407
+ background: "none",
3408
+ cursor: disabled ? "default" : "pointer",
3409
+ p: [0],
3410
+ m: [0],
3411
+ display: "inline-block"
3412
+ }, sx3)
3413
+ }, props),
3414
+ /* @__PURE__ */ React41.createElement(
3415
+ Box29,
3416
+ {
3417
+ sx: {
3418
+ width: "50px",
3419
+ height: "20px",
3420
+ borderRadius: "20px",
3421
+ backgroundColor: active ? transparentize2(color, color === "primary" ? 0.5 : 0.45) : "muted",
3422
+ position: "relative",
3423
+ transition: "0.15s",
3424
+ display: "inline-block"
3425
+ }
3426
+ },
3427
+ /* @__PURE__ */ React41.createElement(
3428
+ Box29,
3429
+ {
3430
+ sx: {
3431
+ width: "14px",
3432
+ height: "14px",
3433
+ borderRadius: "7px",
3434
+ position: "absolute",
3435
+ left: active ? "32px" : "4px",
3436
+ top: "3px",
3437
+ backgroundColor: active ? color : "secondary",
3438
+ transition: "0.15s"
3439
+ }
3440
+ }
3441
+ )
3442
+ )
3443
+ );
3444
+ };
3445
+ var toggle_default = forwardRef6(Toggle);
3446
+
3447
+ // src/tray.tsx
3448
+ import React42 from "react";
3449
+ import { Box as Box30 } from "theme-ui";
3450
+ var Tray = ({ expanded, sx: sx3, children }) => {
3451
+ return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(
3452
+ Box30,
3453
+ {
3454
+ sx: {
3455
+ position: "fixed",
3456
+ top: "56px",
3457
+ bottom: "0px",
3458
+ left: "0px",
3459
+ width: "calc(100vw)",
3460
+ mt: ["56px"],
3461
+ bg: "background",
3462
+ zIndex: 1e3,
3463
+ transition: "opacity 0.15s",
3464
+ opacity: expanded ? 0.9 : 0,
3465
+ pointerEvents: expanded ? "all" : "none"
3466
+ }
3467
+ }
3468
+ ), /* @__PURE__ */ React42.createElement(
3469
+ Box30,
3470
+ {
3471
+ sx: __spreadValues({
3472
+ position: "fixed",
3473
+ width: "calc(100vw)",
3474
+ top: "0px",
3475
+ mt: ["56px"],
3476
+ pb: [6, 7, 7, 8],
3477
+ pt: [5, 6, 7, 8],
3478
+ bg: "background",
3479
+ zIndex: 1100,
3480
+ borderStyle: "solid",
3481
+ borderColor: "muted",
3482
+ borderWidth: "0px",
3483
+ borderBottomWidth: "1px",
3484
+ transition: "transform 0.15s",
3485
+ ml: [-3, -4, -5, -6],
3486
+ pl: [3, 4, 5, 6],
3487
+ pr: [3, 4, 5, 6],
3488
+ transform: expanded ? "translateY(0)" : "translateY(-100%)"
3489
+ }, sx3)
3490
+ },
3491
+ /* @__PURE__ */ React42.createElement(row_default, null, /* @__PURE__ */ React42.createElement(column_default, { start: [1, 1, 1, 1], width: [6, 8, 10, 10] }, children))
3492
+ ));
3493
+ };
3494
+ var tray_default = Tray;
3495
+
3496
+ // src/utils/format-date.ts
3497
+ var defaultOptions = {
3498
+ month: "short",
3499
+ day: "numeric",
3500
+ year: "numeric"
3501
+ };
3502
+ var formatDateElement = (date, element, option) => {
3503
+ if (!option) {
3504
+ return null;
3505
+ }
3506
+ const format2 = typeof option === "string" ? option : defaultOptions[element];
3507
+ const result = date.toLocaleString("default", {
3508
+ [element]: format2
3509
+ });
3510
+ if (format2 === "numeric" && ["day", "month"].includes(element)) {
3511
+ return result.padStart(2, "0");
3512
+ } else {
3513
+ return result;
3514
+ }
3515
+ };
3516
+ var formatDate = (date, options = defaultOptions) => {
3517
+ var _a;
3518
+ const d = new Date(date.replace(/-/g, "/"));
3519
+ const month = formatDateElement(d, "month", options.month);
3520
+ const day = formatDateElement(d, "day", options.day);
3521
+ const year = formatDateElement(d, "year", options.year);
3522
+ return [month, day, year].filter(Boolean).join((_a = options.separator) != null ? _a : " ");
3523
+ };
3524
+ var format_date_default = formatDate;
3525
+
3526
+ // src/utils/use-scrollbar-class.ts
3527
+ import { useEffect as useEffect7, useState as useState6 } from "react";
3528
+ var useScrollbarClass = () => {
3529
+ const [className, setClassName] = useState6(null);
3530
+ useEffect7(() => {
3531
+ if (document && get_scrollbar_width_default(document) > 0) {
3532
+ setClassName("custom-scrollbar");
3533
+ }
3534
+ }, []);
3535
+ return className;
3536
+ };
3537
+ var use_scrollbar_class_default = useScrollbarClass;
3538
+ export {
3539
+ avatar_default as Avatar,
3540
+ avatar_group_default as AvatarGroup,
3541
+ badge_default as Badge,
3542
+ blockquote_default as Blockquote,
3543
+ button_default as Button,
3544
+ callout_default as Callout,
3545
+ caption_default as Caption,
3546
+ colorbar_default as Colorbar,
3547
+ colors_exports as Colors,
3548
+ column_default as Column,
3549
+ custom_404_default as Custom404,
3550
+ dimmer_default as Dimmer,
3551
+ expander_default as Expander,
3552
+ fade_in_default as FadeIn,
3553
+ figure_default as Figure,
3554
+ figure_caption_default as FigureCaption,
3555
+ filter_default as Filter,
3556
+ footer_default as Footer,
3557
+ group_default as Group,
3558
+ guide_default as Guide,
3559
+ header_default as Header,
3560
+ heading_default as Heading,
3561
+ input_default as Input,
3562
+ layout_default as Layout,
3563
+ link_default as Link,
3564
+ link_group_default as LinkGroup,
3565
+ logo_default as Logo,
3566
+ menu_default as Menu,
3567
+ meta_default as Meta,
3568
+ metadata_default as Metadata,
3569
+ monogram_default as Monogram,
3570
+ row_default as Row,
3571
+ scrollbar_default as Scrollbar,
3572
+ select_default as Select,
3573
+ settings_default as Settings,
3574
+ sidenote_default as Sidenote,
3575
+ slider_default as Slider,
3576
+ table_default as Table,
3577
+ table_caption_default as TableCaption,
3578
+ tag_default as Tag,
3579
+ toggle_default as Toggle,
3580
+ tray_default as Tray,
3581
+ format_date_default as formatDate,
3582
+ get_scrollbar_width_default as getScrollbarWidth,
3583
+ use_scrollbar_class_default as useScrollbarClass
3584
+ };
3585
+ //# sourceMappingURL=index.mjs.map