UNPKG

64.2 kBJavaScriptView Raw
1// src/internal/util.ts
2var includes = (value, search) => !!~value.indexOf(search);
3var join = (parts, separator = "-") => parts.join(separator);
4var joinTruthy = (parts, separator) => join(parts.filter(Boolean), separator);
5var tail = (array, startIndex = 1) => array.slice(startIndex);
6var identity = (value) => value;
7var noop = () => {
8};
9var capitalize = (value) => value[0].toUpperCase() + tail(value);
10var hyphenate = (value) => value.replace(/[A-Z]/g, "-$&").toLowerCase();
11var evalThunk = (value, context) => {
12 while (typeof value == "function") {
13 value = value(context);
14 }
15 return value;
16};
17var ensureMaxSize = (map, max) => {
18 if (map.size > max) {
19 map.delete(map.keys().next().value);
20 }
21};
22var isCSSProperty = (key, value) => !includes("@:&", key[0]) && (includes("rg", (typeof value)[5]) || Array.isArray(value));
23var merge = (target, source, context) => source ? Object.keys(source).reduce((target2, key) => {
24 const value = evalThunk(source[key], context);
25 if (isCSSProperty(key, value)) {
26 target2[hyphenate(key)] = value;
27 } else {
28 target2[key] = key[0] == "@" && includes("figa", key[1]) ? (target2[key] || []).concat(value) : merge(target2[key] || {}, value, context);
29 }
30 return target2;
31}, target) : target;
32var escape = typeof CSS !== "undefined" && CSS.escape || ((className) => className.replace(/[!"'`*+.,;:\\/<=>?@#$%&^|~()[\]{}]/g, "\\$&").replace(/^\d/, "\\3$& "));
33var buildMediaQuery = (screen) => {
34 if (!Array.isArray(screen)) {
35 screen = [screen];
36 }
37 return "@media " + join(screen.map((screen2) => {
38 if (typeof screen2 == "string") {
39 screen2 = {min: screen2};
40 }
41 return screen2.raw || join(Object.keys(screen2).map((feature) => `(${feature}-width:${screen2[feature]})`), " and ");
42 }), ",");
43};
44var cyrb32 = (value) => {
45 for (var h = 9, index = value.length; index--; ) {
46 h = Math.imul(h ^ value.charCodeAt(index), 1597334677);
47 }
48 return "tw-" + ((h ^ h >>> 9) >>> 0).toString(36);
49};
50var sortedInsertionIndex = (array, element) => {
51 let high = array.length;
52 if (high == 0)
53 return 0;
54 for (let low = 0; low < high; ) {
55 const pivot = high + low >> 1;
56 if (array[pivot] <= element) {
57 low = pivot + 1;
58 } else {
59 high = pivot;
60 }
61 }
62 return high;
63};
64
65// src/twind/parse.ts
66var groupings;
67var rules;
68var startGrouping = (value = "") => {
69 groupings.push(value);
70 return "";
71};
72var endGrouping = (isWhitespace) => {
73 groupings.length = Math.max(groupings.lastIndexOf("") + ~~isWhitespace, 0);
74};
75var onlyPrefixes = (s) => s && !includes("!:", s[0]);
76var onlyVariants = (s) => s[0] == ":";
77var addRule = (directive2, negate) => {
78 rules.push({
79 v: groupings.filter(onlyVariants),
80 d: directive2,
81 n: negate,
82 i: includes(groupings, "!"),
83 $: ""
84 });
85};
86var saveRule = (buffer) => {
87 const negate = buffer[0] == "-";
88 if (negate) {
89 buffer = tail(buffer);
90 }
91 const prefix = join(groupings.filter(onlyPrefixes));
92 addRule(buffer == "&" ? prefix : (prefix && prefix + "-") + buffer, negate);
93 return "";
94};
95var parseString = (token, isVariant) => {
96 let buffer = "";
97 for (let char, dynamic = false, position2 = 0; char = token[position2++]; ) {
98 if (dynamic || char == "[") {
99 buffer += char;
100 dynamic = char != "]";
101 continue;
102 }
103 switch (char) {
104 case ":":
105 buffer = buffer && startGrouping(":" + (token[position2] == char ? token[position2++] : "") + buffer);
106 break;
107 case "(":
108 buffer = buffer && startGrouping(buffer);
109 startGrouping();
110 break;
111 case "!":
112 startGrouping(char);
113 break;
114 case ")":
115 case " ":
116 case " ":
117 case "\n":
118 case "\r":
119 buffer = buffer && saveRule(buffer);
120 endGrouping(char !== ")");
121 break;
122 default:
123 buffer += char;
124 }
125 }
126 if (buffer) {
127 if (isVariant) {
128 startGrouping(":" + buffer);
129 } else if (buffer.slice(-1) == "-") {
130 startGrouping(buffer.slice(0, -1));
131 } else {
132 saveRule(buffer);
133 }
134 }
135};
136var parseGroupedToken = (token) => {
137 startGrouping();
138 parseToken(token);
139 endGrouping();
140};
141var parseGroup = (key, token) => {
142 if (token) {
143 startGrouping();
144 const isVariant = includes("tbu", (typeof token)[1]);
145 parseString(key, isVariant);
146 if (isVariant) {
147 parseGroupedToken(token);
148 }
149 endGrouping();
150 }
151};
152var parseToken = (token) => {
153 switch (typeof token) {
154 case "string":
155 parseString(token);
156 break;
157 case "function":
158 addRule(token);
159 break;
160 case "object":
161 if (Array.isArray(token)) {
162 token.forEach(parseGroupedToken);
163 } else if (token) {
164 Object.keys(token).forEach((key) => {
165 parseGroup(key, token[key]);
166 });
167 }
168 }
169};
170var staticsCaches = new WeakMap();
171var buildStatics = (strings) => {
172 let statics = staticsCaches.get(strings);
173 if (!statics) {
174 let slowModeIndex = NaN;
175 let buffer = "";
176 statics = strings.map((token, index) => {
177 if (slowModeIndex !== slowModeIndex && (token.slice(-1) == "[" || includes(":-(", (strings[index + 1] || "")[0]))) {
178 slowModeIndex = index;
179 }
180 if (index >= slowModeIndex) {
181 return (interpolation) => {
182 if (index == slowModeIndex) {
183 buffer = "";
184 }
185 buffer += token;
186 if (includes("rg", (typeof interpolation)[5])) {
187 buffer += interpolation;
188 } else if (interpolation) {
189 parseString(buffer);
190 buffer = "";
191 parseToken(interpolation);
192 }
193 if (index == strings.length - 1) {
194 parseString(buffer);
195 }
196 };
197 }
198 const staticRules = rules = [];
199 parseString(token);
200 const activeGroupings = [...groupings];
201 rules = [];
202 return (interpolation) => {
203 rules.push(...staticRules);
204 groupings = [...activeGroupings];
205 if (interpolation) {
206 parseToken(interpolation);
207 }
208 };
209 });
210 staticsCaches.set(strings, statics);
211 }
212 return statics;
213};
214var parse = (tokens) => {
215 groupings = [];
216 rules = [];
217 if (Array.isArray(tokens[0]) && Array.isArray(tokens[0].raw)) {
218 buildStatics(tokens[0]).forEach((apply2, index) => apply2(tokens[index + 1]));
219 } else {
220 parseToken(tokens);
221 }
222 return rules;
223};
224
225// src/twind/directive.ts
226var isFunctionFree;
227var detectFunction = (key, value) => {
228 if (typeof value == "function") {
229 isFunctionFree = false;
230 }
231 return value;
232};
233var stringify = (data) => {
234 isFunctionFree = true;
235 const key = JSON.stringify(data, detectFunction);
236 return isFunctionFree && key;
237};
238var cacheByFactory = new WeakMap();
239var directive = (factory, data) => {
240 const key = stringify(data);
241 let directive2;
242 if (key) {
243 var cache = cacheByFactory.get(factory);
244 if (!cache) {
245 cacheByFactory.set(factory, cache = new Map());
246 }
247 directive2 = cache.get(key);
248 }
249 if (!directive2) {
250 directive2 = Object.defineProperty((params, context) => {
251 context = Array.isArray(params) ? context : params;
252 return evalThunk(factory(data, context), context);
253 }, "toJSON", {
254 value: () => key || data
255 });
256 if (cache) {
257 cache.set(key, directive2);
258 ensureMaxSize(cache, 1e4);
259 }
260 }
261 return directive2;
262};
263
264// src/twind/apply.ts
265var applyFactory = (tokens, {css}) => css(parse(tokens));
266var apply = (...tokens) => directive(applyFactory, tokens);
267
268// src/twind/helpers.ts
269var positions = (resolve) => (value, position2, prefix, suffix) => {
270 if (value) {
271 const properties = position2 && resolve(position2);
272 if (properties && properties.length > 0) {
273 return properties.reduce((declarations, property2) => {
274 declarations[joinTruthy([prefix, property2, suffix])] = value;
275 return declarations;
276 }, {});
277 }
278 }
279};
280var corners = /* @__PURE__ */ positions((key) => ({
281 t: ["top-left", "top-right"],
282 r: ["top-right", "bottom-right"],
283 b: ["bottom-left", "bottom-right"],
284 l: ["bottom-left", "top-left"],
285 tl: ["top-left"],
286 tr: ["top-right"],
287 bl: ["bottom-left"],
288 br: ["bottom-right"]
289})[key]);
290var expandEdges = (key) => {
291 const parts = ({x: "lr", y: "tb"}[key] || key || "").split("").sort();
292 for (let index = parts.length; index--; ) {
293 if (!(parts[index] = {
294 t: "top",
295 r: "right",
296 b: "bottom",
297 l: "left"
298 }[parts[index]]))
299 return;
300 }
301 if (parts.length)
302 return parts;
303};
304var edges = /* @__PURE__ */ positions(expandEdges);
305
306// src/twind/plugins.ts
307var _;
308var __;
309var $;
310var toColumnsOrRows = (x) => x == "cols" ? "columns" : "rows";
311var property = (property2) => (params, context, id) => ({
312 [property2]: id + ((_ = join(params)) && "-" + _)
313});
314var propertyValue = (property2, separator) => (params, context, id) => (_ = join(params, separator)) && {
315 [property2 || id]: _
316};
317var themeProperty = (section) => (params, {theme: theme2}, id) => (_ = theme2(section || id, params)) && {
318 [section || id]: _
319};
320var themePropertyFallback = (section, separator) => (params, {theme: theme2}, id) => (_ = theme2(section || id, params, join(params, separator))) && {
321 [section || id]: _
322};
323var alias = (handler, name) => (params, context) => handler(params, context, name);
324var display = property("display");
325var position = property("position");
326var textTransform = property("textTransform");
327var textDecoration = property("textDecoration");
328var fontStyle = property("fontStyle");
329var fontVariantNumeric = (key) => (params, context, id) => ({
330 ["--tw-" + key]: id,
331 fontVariantNumeric: "var(--tw-ordinal,/*!*/ /*!*/) var(--tw-slashed-zero,/*!*/ /*!*/) var(--tw-numeric-figure,/*!*/ /*!*/) var(--tw-numeric-spacing,/*!*/ /*!*/) var(--tw-numeric-fraction,/*!*/ /*!*/)"
332});
333var inset = (params, {theme: theme2}, id) => (_ = theme2("inset", params)) && {[id]: _};
334var opacityProperty = (params, theme2, id, section = id) => (_ = theme2(section + "Opacity", tail(params))) && {
335 [`--tw-${id}-opacity`]: _
336};
337var parseColorComponent = (chars, factor) => Math.round(parseInt(chars, 16) * factor);
338var asRGBA = (color, opacityProperty2, opacityDefault) => {
339 if (color && color[0] == "#" && (_ = (color.length - 1) / 3) && ($ = [17, 1, 0.062272][_ - 1])) {
340 return `rgba(${parseColorComponent(color.substr(1, _), $)},${parseColorComponent(color.substr(1 + _, _), $)},${parseColorComponent(color.substr(1 + 2 * _, _), $)},${opacityProperty2 ? `var(--tw-${opacityProperty2}${opacityDefault ? "," + opacityDefault : ""})` : opacityDefault || 1})`;
341 }
342 return color;
343};
344var withOpacityFallback = (property2, kind, color) => color && typeof color == "string" ? (_ = asRGBA(color, kind + "-opacity")) && _ !== color ? {
345 [`--tw-${kind}-opacity`]: "1",
346 [property2]: [color, _]
347} : {[property2]: color} : void 0;
348var transparentTo = (color) => ($ = asRGBA(color, "", "0")) == _ ? "transparent" : $;
349var reversableEdge = (params, {theme: theme2}, id, section, prefix, suffix) => (_ = {x: ["right", "left"], y: ["bottom", "top"]}[params[0]]) && ($ = `--tw-${id}-${params[0]}-reverse`) ? params[1] == "reverse" ? {
350 [$]: "1"
351} : {
352 [$]: "0",
353 [joinTruthy([prefix, _[0], suffix])]: (__ = theme2(section, tail(params))) && `calc(${__} * var(${$}))`,
354 [joinTruthy([prefix, _[1], suffix])]: __ && [__, `calc(${__} * calc(1 - var(${$})))`]
355} : void 0;
356var placeHelper = (property2, params) => params[0] && {
357 [property2]: (includes("wun", (params[0] || "")[3]) ? "space-" : "") + params[0]
358};
359var contentPluginFor = (property2) => (params) => includes(["start", "end"], params[0]) ? {[property2]: "flex-" + params[0]} : placeHelper(property2, params);
360var gridPlugin = (kind) => (params, {theme: theme2}) => {
361 if (_ = theme2("grid" + capitalize(kind), params, "")) {
362 return {["grid-" + kind]: _};
363 }
364 switch (params[0]) {
365 case "span":
366 return params[1] && {
367 ["grid-" + kind]: `span ${params[1]} / span ${params[1]}`
368 };
369 case "start":
370 case "end":
371 return (_ = theme2("grid" + capitalize(kind) + capitalize(params[0]), tail(params), join(tail(params)))) && {
372 [`grid-${kind}-${params[0]}`]: _
373 };
374 }
375};
376var border = (params, {theme: theme2}, id) => {
377 switch (params[0]) {
378 case "solid":
379 case "dashed":
380 case "dotted":
381 case "double":
382 case "none":
383 return propertyValue("borderStyle")(params);
384 case "collapse":
385 case "separate":
386 return propertyValue("borderCollapse")(params);
387 case "opacity":
388 return opacityProperty(params, theme2, id);
389 }
390 return (_ = theme2(id + "Width", params, "")) ? {borderWidth: _} : withOpacityFallback("borderColor", id, theme2(id + "Color", params));
391};
392var transform = (gpu) => (gpu ? "translate3d(var(--tw-translate-x,0),var(--tw-translate-y,0),0)" : "translateX(var(--tw-translate-x,0)) translateY(var(--tw-translate-y,0))") + " rotate(var(--tw-rotate,0)) skewX(var(--tw-skew-x,0)) skewY(var(--tw-skew-y,0)) scaleX(var(--tw-scale-x,1)) scaleY(var(--tw-scale-y,1))";
393var transformXYFunction = (params, context, id) => params[0] && (_ = context.theme(id, params[1] || params[0])) && {
394 [`--tw-${id}-x`]: params[0] !== "y" && _,
395 [`--tw-${id}-y`]: params[0] !== "x" && _,
396 transform: [`${id}${params[1] ? params[0].toUpperCase() : ""}(${_})`, transform()]
397};
398var edgesPluginFor = (key) => (params, context, id) => id[1] ? edges(context.theme(key, params), id[1], key) : themeProperty(key)(params, context, id);
399var padding = edgesPluginFor("padding");
400var margin = edgesPluginFor("margin");
401var minMax = (params, {theme: theme2}, id) => (_ = {w: "width", h: "height"}[params[0]]) && {
402 [_ = `${id}${capitalize(_)}`]: theme2(_, tail(params))
403};
404var filter = (params, {theme: theme2}, id) => {
405 const parts = id.split("-");
406 const prefix = parts[0] == "backdrop" ? parts[0] + "-" : "";
407 if (!prefix) {
408 params.unshift(...parts);
409 }
410 if (params[0] == "filter") {
411 const filters = [
412 "blur",
413 "brightness",
414 "contrast",
415 "grayscale",
416 "hue-rotate",
417 "invert",
418 prefix && "opacity",
419 "saturate",
420 "sepia",
421 !prefix && "drop-shadow"
422 ].filter(Boolean);
423 return params[1] == "none" ? {filter: "none"} : filters.reduce((css, key) => {
424 css["--tw-" + prefix + key] = "var(--tw-empty,/*!*/ /*!*/)";
425 return css;
426 }, {
427 filter: filters.map((key) => `var(--tw-${prefix}${key})`).join(" ")
428 });
429 }
430 $ = params.shift();
431 if (includes(["hue", "drop"], $))
432 $ += capitalize(params.shift());
433 return (_ = theme2(prefix ? "backdrop" + capitalize($) : $, params)) && {
434 ["--tw-" + prefix + $]: (Array.isArray(_) ? _ : [_]).map((_4) => `${hyphenate($)}(${_4})`).join(" ")
435 };
436};
437var corePlugins = {
438 group: (params, {tag}, id) => tag(join([id, ...params])),
439 hidden: alias(display, "none"),
440 inline: display,
441 block: display,
442 contents: display,
443 flow: display,
444 table: (params, context, id) => includes(["auto", "fixed"], params[0]) ? {tableLayout: params[0]} : display(params, context, id),
445 flex(params, context, id) {
446 switch (params[0]) {
447 case "row":
448 case "col":
449 return {
450 flexDirection: join(params[0] == "col" ? ["column", ...tail(params)] : params)
451 };
452 case "nowrap":
453 case "wrap":
454 return {flexWrap: join(params)};
455 case "grow":
456 case "shrink":
457 _ = context.theme("flex" + capitalize(params[0]), tail(params), params[1] || 1);
458 return _ != null && {
459 ["flex-" + params[0]]: "" + _
460 };
461 }
462 return (_ = context.theme("flex", params, "")) ? {flex: _} : display(params, context, id);
463 },
464 grid(params, context, id) {
465 switch (params[0]) {
466 case "cols":
467 case "rows":
468 return (_ = context.theme("gridTemplate" + capitalize(toColumnsOrRows(params[0])), tail(params), params.length == 2 && Number(params[1]) ? `repeat(${params[1]},minmax(0,1fr))` : join(tail(params)))) && {
469 ["grid-template-" + toColumnsOrRows(params[0])]: _
470 };
471 case "flow":
472 return params.length > 1 && {
473 gridAutoFlow: join(params[1] == "col" ? ["column", ...tail(params, 2)] : tail(params), " ")
474 };
475 }
476 return display(params, context, id);
477 },
478 auto: (params, {theme: theme2}) => includes(["cols", "rows"], params[0]) && (_ = theme2("gridAuto" + capitalize(toColumnsOrRows(params[0])), tail(params), join(tail(params)))) && {
479 ["grid-auto-" + toColumnsOrRows(params[0])]: _
480 },
481 static: position,
482 fixed: position,
483 absolute: position,
484 relative: position,
485 sticky: position,
486 visible: {visibility: "visible"},
487 invisible: {visibility: "hidden"},
488 antialiased: {
489 WebkitFontSmoothing: "antialiased",
490 MozOsxFontSmoothing: "grayscale"
491 },
492 "subpixel-antialiased": {
493 WebkitFontSmoothing: "auto",
494 MozOsxFontSmoothing: "auto"
495 },
496 truncate: {
497 overflow: "hidden",
498 whiteSpace: "nowrap",
499 textOverflow: "ellipsis"
500 },
501 "sr-only": {
502 position: "absolute",
503 width: "1px",
504 height: "1px",
505 padding: "0",
506 margin: "-1px",
507 overflow: "hidden",
508 whiteSpace: "nowrap",
509 clip: "rect(0,0,0,0)",
510 borderWidth: "0"
511 },
512 "not-sr-only": {
513 position: "static",
514 width: "auto",
515 height: "auto",
516 padding: "0",
517 margin: "0",
518 overflow: "visible",
519 whiteSpace: "normal",
520 clip: "auto"
521 },
522 resize: (params) => ({
523 resize: {x: "vertical", y: "horizontal"}[params[0]] || params[0] || "both"
524 }),
525 box: (params) => params[0] && {"box-sizing": params[0] + "-box"},
526 appearance: propertyValue(),
527 cursor: themePropertyFallback(),
528 float: propertyValue(),
529 clear: propertyValue(),
530 decoration: propertyValue("boxDecorationBreak"),
531 isolate: {isolation: "isolate"},
532 isolation: propertyValue(),
533 "mix-blend": propertyValue("mixBlendMode"),
534 top: inset,
535 right: inset,
536 bottom: inset,
537 left: inset,
538 inset: (params, {theme: theme2}) => (_ = expandEdges(params[0])) ? edges(theme2("inset", tail(params)), params[0]) : (_ = theme2("inset", params)) && {
539 top: _,
540 right: _,
541 bottom: _,
542 left: _
543 },
544 underline: textDecoration,
545 "line-through": textDecoration,
546 "no-underline": alias(textDecoration, "none"),
547 "text-underline": alias(textDecoration, "underline"),
548 "text-no-underline": alias(textDecoration, "none"),
549 "text-line-through": alias(textDecoration, "line-through"),
550 uppercase: textTransform,
551 lowercase: textTransform,
552 capitalize: textTransform,
553 "normal-case": alias(textTransform, "none"),
554 "text-normal-case": alias(textTransform, "none"),
555 italic: fontStyle,
556 "not-italic": alias(fontStyle, "normal"),
557 "font-italic": alias(fontStyle, "italic"),
558 "font-not-italic": alias(fontStyle, "normal"),
559 font: (params, context, id) => (_ = context.theme("fontFamily", params, "")) ? {fontFamily: _} : themeProperty("fontWeight")(params, context, id),
560 items: (params) => params[0] && {
561 alignItems: includes(["start", "end"], params[0]) ? "flex-" + params[0] : join(params)
562 },
563 "justify-self": propertyValue(),
564 "justify-items": propertyValue(),
565 justify: contentPluginFor("justifyContent"),
566 content: contentPluginFor("alignContent"),
567 self: contentPluginFor("alignSelf"),
568 place: (params) => params[0] && placeHelper("place-" + params[0], tail(params)),
569 overscroll: (params) => params[0] && {
570 ["overscrollBehavior" + (params[1] ? "-" + params[0] : "")]: params[1] || params[0]
571 },
572 col: gridPlugin("column"),
573 row: gridPlugin("row"),
574 duration: themeProperty("transitionDuration"),
575 delay: themeProperty("transitionDelay"),
576 tracking: themeProperty("letterSpacing"),
577 leading: themeProperty("lineHeight"),
578 z: themeProperty("zIndex"),
579 opacity: themeProperty(),
580 ease: themeProperty("transitionTimingFunction"),
581 p: padding,
582 py: padding,
583 px: padding,
584 pt: padding,
585 pr: padding,
586 pb: padding,
587 pl: padding,
588 m: margin,
589 my: margin,
590 mx: margin,
591 mt: margin,
592 mr: margin,
593 mb: margin,
594 ml: margin,
595 w: themeProperty("width"),
596 h: themeProperty("height"),
597 min: minMax,
598 max: minMax,
599 fill: themeProperty(),
600 order: themeProperty(),
601 origin: themePropertyFallback("transformOrigin", " "),
602 select: propertyValue("userSelect"),
603 "pointer-events": propertyValue(),
604 align: propertyValue("verticalAlign"),
605 whitespace: propertyValue("whiteSpace"),
606 "normal-nums": {fontVariantNumeric: "normal"},
607 ordinal: fontVariantNumeric("ordinal"),
608 "slashed-zero": fontVariantNumeric("slashed-zero"),
609 "lining-nums": fontVariantNumeric("numeric-figure"),
610 "oldstyle-nums": fontVariantNumeric("numeric-figure"),
611 "proportional-nums": fontVariantNumeric("numeric-spacing"),
612 "tabular-nums": fontVariantNumeric("numeric-spacing"),
613 "diagonal-fractions": fontVariantNumeric("numeric-fraction"),
614 "stacked-fractions": fontVariantNumeric("numeric-fraction"),
615 overflow: (params, context, id) => includes(["ellipsis", "clip"], params[0]) ? propertyValue("textOverflow")(params) : params[1] ? {["overflow-" + params[0]]: params[1]} : propertyValue()(params, context, id),
616 transform: (params) => params[0] == "none" ? {transform: "none"} : {
617 "--tw-translate-x": "0",
618 "--tw-translate-y": "0",
619 "--tw-rotate": "0",
620 "--tw-skew-x": "0",
621 "--tw-skew-y": "0",
622 "--tw-scale-x": "1",
623 "--tw-scale-y": "1",
624 transform: transform(params[0] == "gpu")
625 },
626 rotate: (params, {theme: theme2}) => (_ = theme2("rotate", params)) && {
627 "--tw-rotate": _,
628 transform: [`rotate(${_})`, transform()]
629 },
630 scale: transformXYFunction,
631 translate: transformXYFunction,
632 skew: transformXYFunction,
633 gap: (params, context, id) => (_ = {x: "column", y: "row"}[params[0]]) ? {[_ + "Gap"]: context.theme("gap", tail(params))} : themeProperty("gap")(params, context, id),
634 stroke: (params, context, id) => (_ = context.theme("stroke", params, "")) ? {stroke: _} : themeProperty("strokeWidth")(params, context, id),
635 outline: (params, {theme: theme2}) => (_ = theme2("outline", params)) && {
636 outline: _[0],
637 outlineOffset: _[1]
638 },
639 "break-normal": {
640 wordBreak: "normal",
641 overflowWrap: "normal"
642 },
643 "break-words": {overflowWrap: "break-word"},
644 "break-all": {wordBreak: "break-all"},
645 text(params, {theme: theme2}, id) {
646 switch (params[0]) {
647 case "left":
648 case "center":
649 case "right":
650 case "justify":
651 return {textAlign: params[0]};
652 case "uppercase":
653 case "lowercase":
654 case "capitalize":
655 return textTransform([], _, params[0]);
656 case "opacity":
657 return opacityProperty(params, theme2, id);
658 }
659 const fontSize = theme2("fontSize", params, "");
660 if (fontSize) {
661 return typeof fontSize == "string" ? {fontSize} : {
662 fontSize: fontSize[0],
663 ...typeof fontSize[1] == "string" ? {lineHeight: fontSize[1]} : fontSize[1]
664 };
665 }
666 return withOpacityFallback("color", "text", theme2("textColor", params));
667 },
668 bg(params, {theme: theme2}, id) {
669 switch (params[0]) {
670 case "fixed":
671 case "local":
672 case "scroll":
673 return propertyValue("backgroundAttachment", ",")(params);
674 case "bottom":
675 case "center":
676 case "left":
677 case "right":
678 case "top":
679 return propertyValue("backgroundPosition", " ")(params);
680 case "no":
681 return params[1] == "repeat" && propertyValue("backgroundRepeat")(params);
682 case "repeat":
683 return includes("xy", params[1]) ? propertyValue("backgroundRepeat")(params) : {"background-repeat": params[1] || params[0]};
684 case "opacity":
685 return opacityProperty(params, theme2, id, "background");
686 case "clip":
687 return params[1] && {backgroundClip: params[1] + (params[1] == "text" ? "" : "-box")};
688 case "blend":
689 return propertyValue("background-blend-mode")(tail(params));
690 case "gradient":
691 if (params[1] == "to" && (_ = expandEdges(params[2]))) {
692 return {
693 backgroundImage: `linear-gradient(to ${join(_, " ")},var(--tw-gradient-stops))`
694 };
695 }
696 }
697 return (_ = theme2("backgroundPosition", params, "")) ? {backgroundPosition: _} : (_ = theme2("backgroundSize", params, "")) ? {backgroundSize: _} : (_ = theme2("backgroundImage", params, "")) ? {backgroundImage: _} : withOpacityFallback("backgroundColor", "bg", theme2("backgroundColor", params));
698 },
699 from: (params, {theme: theme2}) => (_ = theme2("gradientColorStops", params)) && {
700 "--tw-gradient-from": _,
701 "--tw-gradient-stops": `var(--tw-gradient-from),var(--tw-gradient-to,${transparentTo(_)})`
702 },
703 via: (params, {theme: theme2}) => (_ = theme2("gradientColorStops", params)) && {
704 "--tw-gradient-stops": `var(--tw-gradient-from),${_},var(--tw-gradient-to,${transparentTo(_)})`
705 },
706 to: (params, {theme: theme2}) => (_ = theme2("gradientColorStops", params)) && {
707 "--tw-gradient-to": _
708 },
709 border: (params, context, id) => expandEdges(params[0]) ? edges(context.theme("borderWidth", tail(params)), params[0], "border", "width") : border(params, context, id),
710 divide: (params, context, id) => (_ = reversableEdge(params, context, id, "divideWidth", "border", "width") || border(params, context, id)) && {
711 "&>:not([hidden])~:not([hidden])": _
712 },
713 space: (params, context, id) => (_ = reversableEdge(params, context, id, "space", "margin")) && {
714 "&>:not([hidden])~:not([hidden])": _
715 },
716 placeholder: (params, {theme: theme2}, id) => (_ = params[0] == "opacity" ? opacityProperty(params, theme2, id) : withOpacityFallback("color", "placeholder", theme2("placeholderColor", params))) && {
717 "&::placeholder": _
718 },
719 shadow: (params, {theme: theme2}) => (_ = theme2("boxShadow", params)) && {
720 ":global": {
721 "*": {
722 "--tw-shadow": "0 0 transparent"
723 }
724 },
725 "--tw-shadow": _ == "none" ? "0 0 transparent" : _,
726 boxShadow: [
727 _,
728 `var(--tw-ring-offset-shadow,0 0 transparent),var(--tw-ring-shadow,0 0 transparent),var(--tw-shadow)`
729 ]
730 },
731 animate: (params, {theme: theme2, tag}) => {
732 if ($ = theme2("animation", params)) {
733 const parts = $.split(" ");
734 if ((_ = theme2("keyframes", parts[0], __ = {})) !== __) {
735 return ($ = tag(parts[0])) && {
736 animation: $ + " " + join(tail(parts), " "),
737 ["@keyframes " + $]: _
738 };
739 }
740 return {animation: $};
741 }
742 },
743 ring(params, {theme: theme2}, id) {
744 switch (params[0]) {
745 case "inset":
746 return {"--tw-ring-inset": "inset"};
747 case "opacity":
748 return opacityProperty(params, theme2, id);
749 case "offset":
750 return (_ = theme2("ringOffsetWidth", tail(params), "")) ? {
751 "--tw-ring-offset-width": _
752 } : {
753 "--tw-ring-offset-color": theme2("ringOffsetColor", tail(params))
754 };
755 }
756 return (_ = theme2("ringWidth", params, "")) ? {
757 "--tw-ring-offset-shadow": `var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)`,
758 "--tw-ring-shadow": `var(--tw-ring-inset) 0 0 0 calc(${_} + var(--tw-ring-offset-width)) var(--tw-ring-color)`,
759 "box-shadow": `var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 transparent)`,
760 ":global": {
761 "*": {
762 "--tw-ring-inset": "var(--tw-empty,/*!*/ /*!*/)",
763 "--tw-ring-offset-width": theme2("ringOffsetWidth", "", "0px"),
764 "--tw-ring-offset-color": theme2("ringOffsetColor", "", "#fff"),
765 "--tw-ring-color": asRGBA(theme2("ringColor", "", "#93c5fd"), "ring-opacity", theme2("ringOpacity", "", "0.5")),
766 "--tw-ring-offset-shadow": "0 0 transparent",
767 "--tw-ring-shadow": "0 0 transparent"
768 }
769 }
770 } : {
771 "--tw-ring-opacity": "1",
772 "--tw-ring-color": asRGBA(theme2("ringColor", params), "ring-opacity")
773 };
774 },
775 object: (params, context, id) => includes(["contain", "cover", "fill", "none", "scale-down"], join(params)) ? {objectFit: join(params)} : themePropertyFallback("objectPosition", " ")(params, context, id),
776 list: (params, context, id) => join(params) == "item" ? display(params, context, id) : includes(["inside", "outside"], join(params)) ? {listStylePosition: params[0]} : themePropertyFallback("listStyleType")(params, context, id),
777 rounded: (params, context, id) => corners(context.theme("borderRadius", tail(params), ""), params[0], "border", "radius") || themeProperty("borderRadius")(params, context, id),
778 "transition-none": {"transition-property": "none"},
779 transition: (params, {theme: theme2}) => ({
780 transitionProperty: theme2("transitionProperty", params),
781 transitionTimingFunction: theme2("transitionTimingFunction", ""),
782 transitionDuration: theme2("transitionDuration", "")
783 }),
784 container: (params, {theme: theme2}) => {
785 const {screens = theme2("screens"), center, padding: padding2} = theme2("container");
786 const paddingFor = (screen) => (_ = padding2 && (typeof padding2 == "string" ? padding2 : padding2[screen] || padding2.DEFAULT)) ? {
787 paddingRight: _,
788 paddingLeft: _
789 } : {};
790 return Object.keys(screens).reduce((rules2, screen) => {
791 if (($ = screens[screen]) && typeof $ == "string") {
792 rules2[buildMediaQuery($)] = {
793 "&": {
794 "max-width": $,
795 ...paddingFor(screen)
796 }
797 };
798 }
799 return rules2;
800 }, {
801 width: "100%",
802 ...center ? {marginRight: "auto", marginLeft: "auto"} : {},
803 ...paddingFor("xs")
804 });
805 },
806 filter,
807 blur: filter,
808 brightness: filter,
809 contrast: filter,
810 grayscale: filter,
811 "hue-rotate": filter,
812 invert: filter,
813 saturate: filter,
814 sepia: filter,
815 "drop-shadow": filter,
816 backdrop: filter
817};
818
819// src/twind/preflight.ts
820var createPreflight = (theme2) => ({
821 ":root": {tabSize: 4},
822 "body,blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre,fieldset,ol,ul": {margin: "0"},
823 button: {backgroundColor: "transparent", backgroundImage: "none"},
824 'button,[type="button"],[type="reset"],[type="submit"]': {WebkitAppearance: "button"},
825 "button:focus": {outline: ["1px dotted", "5px auto -webkit-focus-ring-color"]},
826 "fieldset,ol,ul,legend": {padding: "0"},
827 "ol,ul": {listStyle: "none"},
828 html: {
829 lineHeight: "1.5",
830 WebkitTextSizeAdjust: "100%",
831 fontFamily: theme2("fontFamily.sans", "ui-sans-serif,system-ui,sans-serif")
832 },
833 body: {fontFamily: "inherit", lineHeight: "inherit"},
834 "*,::before,::after": {
835 boxSizing: "border-box",
836 border: `0 solid ${theme2("borderColor.DEFAULT", "currentColor")}`
837 },
838 hr: {height: "0", color: "inherit", borderTopWidth: "1px"},
839 img: {borderStyle: "solid"},
840 textarea: {resize: "vertical"},
841 "input::placeholder,textarea::placeholder": {
842 opacity: "1",
843 color: theme2("placeholderColor.DEFAULT", theme2("colors.gray.400", "#a1a1aa"))
844 },
845 'button,[role="button"]': {cursor: "pointer"},
846 table: {textIndent: "0", borderColor: "inherit", borderCollapse: "collapse"},
847 "h1,h2,h3,h4,h5,h6": {fontSize: "inherit", fontWeight: "inherit"},
848 a: {color: "inherit", textDecoration: "inherit"},
849 "button,input,optgroup,select,textarea": {
850 fontFamily: "inherit",
851 fontSize: "100%",
852 margin: "0",
853 padding: "0",
854 lineHeight: "inherit",
855 color: "inherit"
856 },
857 "button,select": {textTransform: "none"},
858 "::-moz-focus-inner": {borderStyle: "none", padding: "0"},
859 ":-moz-focusring": {outline: "1px dotted ButtonText"},
860 ":-moz-ui-invalid": {boxShadow: "none"},
861 progress: {verticalAlign: "baseline"},
862 "::-webkit-inner-spin-button,::-webkit-outer-spin-button": {height: "auto"},
863 '[type="search"]': {WebkitAppearance: "textfield", outlineOffset: "-2px"},
864 "::-webkit-search-decoration": {WebkitAppearance: "none"},
865 "::-webkit-file-upload-button": {WebkitAppearance: "button", font: "inherit"},
866 summary: {display: "list-item"},
867 "abbr[title]": {textDecoration: "underline dotted"},
868 "b,strong": {fontWeight: "bolder"},
869 "pre,code,kbd,samp": {
870 fontFamily: theme2("fontFamily", "mono", "ui-monospace,monospace"),
871 fontSize: "1em"
872 },
873 "sub,sup": {fontSize: "75%", lineHeight: "0", position: "relative", verticalAlign: "baseline"},
874 sub: {bottom: "-0.25em"},
875 sup: {top: "-0.5em"},
876 "img,svg,video,canvas,audio,iframe,embed,object": {display: "block", verticalAlign: "middle"},
877 "img,video": {maxWidth: "100%", height: "auto"}
878});
879
880// src/twind/variants.ts
881var coreVariants = {
882 dark: "@media (prefers-color-scheme:dark)",
883 sticky: "@supports ((position: -webkit-sticky) or (position:sticky))",
884 "motion-reduce": "@media (prefers-reduced-motion:reduce)",
885 "motion-safe": "@media (prefers-reduced-motion:no-preference)",
886 first: "&:first-child",
887 last: "&:last-child",
888 even: "&:nth-child(2n)",
889 odd: "&:nth-child(odd)",
890 children: "&>*",
891 siblings: "&~*",
892 sibling: "&+*",
893 override: "&&"
894};
895
896// src/internal/dom.ts
897var STYLE_ELEMENT_ID = "__twind";
898var getStyleElement = (nonce) => {
899 let element = self[STYLE_ELEMENT_ID];
900 if (!element) {
901 element = document.head.appendChild(document.createElement("style"));
902 element.id = STYLE_ELEMENT_ID;
903 nonce && (element.nonce = nonce);
904 element.appendChild(document.createTextNode(""));
905 }
906 return element;
907};
908
909// src/twind/sheets.ts
910var cssomSheet = ({
911 nonce,
912 target = getStyleElement(nonce).sheet
913} = {}) => {
914 const offset = target.cssRules.length;
915 return {
916 target,
917 insert: (rule, index) => target.insertRule(rule, offset + index)
918 };
919};
920var voidSheet = () => ({
921 target: null,
922 insert: noop
923});
924
925// src/twind/modes.ts
926var mode = (report) => ({
927 unknown(section, key = [], optional, context) {
928 if (!optional) {
929 this.report({id: "UNKNOWN_THEME_VALUE", key: section + "." + join(key)}, context);
930 }
931 },
932 report({id, ...info}) {
933 const message = `[${id}] ${JSON.stringify(info)}`;
934 const stack = (new Error(message).stack || message).split("at ");
935 for (let frame; (frame = stack.splice(1, 1)[0]) && !/(^|\.)(tw|setup) /.test(frame); ) {
936 }
937 return report(join(stack, "at "));
938 }
939});
940var warn = /* @__PURE__ */ mode((message) => console.warn(message));
941var strict = /* @__PURE__ */ mode((message) => {
942 throw new Error(message);
943});
944var silent = /* @__PURE__ */ mode(noop);
945
946// src/twind/prefix.ts
947import {cssPropertyAlias, cssPropertyPrefixFlags, cssValuePrefixFlags} from "style-vendorizer";
948var noprefix = (property2, value, important) => `${property2}:${value}${important ? " !important" : ""}`;
949var autoprefix = (property2, value, important) => {
950 let cssText = "";
951 const propertyAlias = cssPropertyAlias(property2);
952 if (propertyAlias)
953 cssText += `${noprefix(propertyAlias, value, important)};`;
954 let flags = cssPropertyPrefixFlags(property2);
955 if (flags & 1)
956 cssText += `-webkit-${noprefix(property2, value, important)};`;
957 if (flags & 2)
958 cssText += `-moz-${noprefix(property2, value, important)};`;
959 if (flags & 4)
960 cssText += `-ms-${noprefix(property2, value, important)};`;
961 flags = cssValuePrefixFlags(property2, value);
962 if (flags & 1)
963 cssText += `${noprefix(property2, `-webkit-${value}`, important)};`;
964 if (flags & 2)
965 cssText += `${noprefix(property2, `-moz-${value}`, important)};`;
966 if (flags & 4)
967 cssText += `${noprefix(property2, `-ms-${value}`, important)};`;
968 cssText += noprefix(property2, value, important);
969 return cssText;
970};
971
972// src/twind/theme.ts
973var ratios = (start, end) => {
974 const result = {};
975 do {
976 for (let dividend = 1; dividend < start; dividend++) {
977 result[`${dividend}/${start}`] = Number((dividend / start * 100).toFixed(6)) + "%";
978 }
979 } while (++start <= end);
980 return result;
981};
982var exponential = (stop, unit, start = 0) => {
983 const result = {};
984 for (; start <= stop; start = start * 2 || 1) {
985 result[start] = start + unit;
986 }
987 return result;
988};
989var linear = (stop, unit = "", divideBy = 1, start = 0, step = 1, result = {}) => {
990 for (; start <= stop; start += step) {
991 result[start] = start / divideBy + unit;
992 }
993 return result;
994};
995var alias2 = (section) => (theme2) => theme2(section);
996var themeFactory = (args, {theme: theme2}) => theme2(...args);
997var theme = (...args) => directive(themeFactory, args);
998var defaultTheme = {
999 screens: {
1000 sm: "640px",
1001 md: "768px",
1002 lg: "1024px",
1003 xl: "1280px",
1004 "2xl": "1536px"
1005 },
1006 colors: {
1007 transparent: "transparent",
1008 current: "currentColor",
1009 black: "#000",
1010 white: "#fff",
1011 gray: {
1012 50: "#f9fafb",
1013 100: "#f3f4f6",
1014 200: "#e5e7eb",
1015 300: "#d1d5db",
1016 400: "#9ca3af",
1017 500: "#6b7280",
1018 600: "#4b5563",
1019 700: "#374151",
1020 800: "#1f2937",
1021 900: "#111827"
1022 },
1023 red: {
1024 50: "#fef2f2",
1025 100: "#fee2e2",
1026 200: "#fecaca",
1027 300: "#fca5a5",
1028 400: "#f87171",
1029 500: "#ef4444",
1030 600: "#dc2626",
1031 700: "#b91c1c",
1032 800: "#991b1b",
1033 900: "#7f1d1d"
1034 },
1035 yellow: {
1036 50: "#fffbeb",
1037 100: "#fef3c7",
1038 200: "#fde68a",
1039 300: "#fcd34d",
1040 400: "#fbbf24",
1041 500: "#f59e0b",
1042 600: "#d97706",
1043 700: "#b45309",
1044 800: "#92400e",
1045 900: "#78350f"
1046 },
1047 green: {
1048 50: "#ecfdf5",
1049 100: "#d1fae5",
1050 200: "#a7f3d0",
1051 300: "#6ee7b7",
1052 400: "#34d399",
1053 500: "#10b981",
1054 600: "#059669",
1055 700: "#047857",
1056 800: "#065f46",
1057 900: "#064e3b"
1058 },
1059 blue: {
1060 50: "#eff6ff",
1061 100: "#dbeafe",
1062 200: "#bfdbfe",
1063 300: "#93c5fd",
1064 400: "#60a5fa",
1065 500: "#3b82f6",
1066 600: "#2563eb",
1067 700: "#1d4ed8",
1068 800: "#1e40af",
1069 900: "#1e3a8a"
1070 },
1071 indigo: {
1072 50: "#eef2ff",
1073 100: "#e0e7ff",
1074 200: "#c7d2fe",
1075 300: "#a5b4fc",
1076 400: "#818cf8",
1077 500: "#6366f1",
1078 600: "#4f46e5",
1079 700: "#4338ca",
1080 800: "#3730a3",
1081 900: "#312e81"
1082 },
1083 purple: {
1084 50: "#f5f3ff",
1085 100: "#ede9fe",
1086 200: "#ddd6fe",
1087 300: "#c4b5fd",
1088 400: "#a78bfa",
1089 500: "#8b5cf6",
1090 600: "#7c3aed",
1091 700: "#6d28d9",
1092 800: "#5b21b6",
1093 900: "#4c1d95"
1094 },
1095 pink: {
1096 50: "#fdf2f8",
1097 100: "#fce7f3",
1098 200: "#fbcfe8",
1099 300: "#f9a8d4",
1100 400: "#f472b6",
1101 500: "#ec4899",
1102 600: "#db2777",
1103 700: "#be185d",
1104 800: "#9d174d",
1105 900: "#831843"
1106 }
1107 },
1108 spacing: {
1109 px: "1px",
1110 0: "0px",
1111 .../* @__PURE__ */ linear(4, "rem", 4, 0.5, 0.5),
1112 .../* @__PURE__ */ linear(12, "rem", 4, 5),
1113 14: "3.5rem",
1114 .../* @__PURE__ */ linear(64, "rem", 4, 16, 4),
1115 72: "18rem",
1116 80: "20rem",
1117 96: "24rem"
1118 },
1119 durations: {
1120 75: "75ms",
1121 100: "100ms",
1122 150: "150ms",
1123 200: "200ms",
1124 300: "300ms",
1125 500: "500ms",
1126 700: "700ms",
1127 1e3: "1000ms"
1128 },
1129 animation: {
1130 none: "none",
1131 spin: "spin 1s linear infinite",
1132 ping: "ping 1s cubic-bezier(0, 0, 0.2, 1) infinite",
1133 pulse: "pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
1134 bounce: "bounce 1s infinite"
1135 },
1136 backdropBlur: /* @__PURE__ */ alias2("blur"),
1137 backdropBrightness: /* @__PURE__ */ alias2("brightness"),
1138 backdropContrast: /* @__PURE__ */ alias2("contrast"),
1139 backdropGrayscale: /* @__PURE__ */ alias2("grayscale"),
1140 backdropHueRotate: /* @__PURE__ */ alias2("hueRotate"),
1141 backdropInvert: /* @__PURE__ */ alias2("invert"),
1142 backdropOpacity: /* @__PURE__ */ alias2("opacity"),
1143 backdropSaturate: /* @__PURE__ */ alias2("saturate"),
1144 backdropSepia: /* @__PURE__ */ alias2("sepia"),
1145 backgroundColor: /* @__PURE__ */ alias2("colors"),
1146 backgroundImage: {
1147 none: "none"
1148 },
1149 backgroundOpacity: /* @__PURE__ */ alias2("opacity"),
1150 backgroundSize: {
1151 auto: "auto",
1152 cover: "cover",
1153 contain: "contain"
1154 },
1155 blur: {
1156 0: "0",
1157 sm: "4px",
1158 DEFAULT: "8px",
1159 md: "12px",
1160 lg: "16px",
1161 xl: "24px",
1162 "2xl": "40px",
1163 "3xl": "64px"
1164 },
1165 brightness: {
1166 .../* @__PURE__ */ linear(200, "", 100, 0, 50),
1167 .../* @__PURE__ */ linear(110, "", 100, 90, 5),
1168 75: "0.75",
1169 125: "1.25"
1170 },
1171 borderColor: (theme2) => ({
1172 ...theme2("colors"),
1173 DEFAULT: theme2("colors.gray.200", "currentColor")
1174 }),
1175 borderOpacity: /* @__PURE__ */ alias2("opacity"),
1176 borderRadius: {
1177 none: "0px",
1178 sm: "0.125rem",
1179 DEFAULT: "0.25rem",
1180 md: "0.375rem",
1181 lg: "0.5rem",
1182 xl: "0.75rem",
1183 "2xl": "1rem",
1184 "3xl": "1.5rem",
1185 "1/2": "50%",
1186 full: "9999px"
1187 },
1188 borderWidth: {
1189 DEFAULT: "1px",
1190 .../* @__PURE__ */ exponential(8, "px")
1191 },
1192 boxShadow: {
1193 sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
1194 DEFAULT: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",
1195 md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
1196 lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",
1197 xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",
1198 "2xl": "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
1199 inner: "inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)",
1200 none: "none"
1201 },
1202 contrast: {
1203 .../* @__PURE__ */ linear(200, "", 100, 0, 50),
1204 75: "0.75",
1205 125: "1.25"
1206 },
1207 divideColor: /* @__PURE__ */ alias2("borderColor"),
1208 divideOpacity: /* @__PURE__ */ alias2("borderOpacity"),
1209 divideWidth: /* @__PURE__ */ alias2("borderWidth"),
1210 dropShadow: {
1211 sm: "0 1px 1px rgba(0,0,0,0.05)",
1212 DEFAULT: ["0 1px 2px rgba(0, 0, 0, 0.1)", "0 1px 1px rgba(0, 0, 0, 0.06)"],
1213 md: ["0 4px 3px rgba(0, 0, 0, 0.07)", "0 2px 2px rgba(0, 0, 0, 0.06)"],
1214 lg: ["0 10px 8px rgba(0, 0, 0, 0.04)", "0 4px 3px rgba(0, 0, 0, 0.1)"],
1215 xl: ["0 20px 13px rgba(0, 0, 0, 0.03)", "0 8px 5px rgba(0, 0, 0, 0.08)"],
1216 "2xl": "0 25px 25px rgba(0, 0, 0, 0.15)",
1217 none: "0 0 #0000"
1218 },
1219 fill: {current: "currentColor"},
1220 grayscale: {
1221 0: "0",
1222 DEFAULT: "100%"
1223 },
1224 hueRotate: {
1225 0: "0deg",
1226 15: "15deg",
1227 30: "30deg",
1228 60: "60deg",
1229 90: "90deg",
1230 180: "180deg"
1231 },
1232 invert: {
1233 0: "0",
1234 DEFAULT: "100%"
1235 },
1236 flex: {
1237 1: "1 1 0%",
1238 auto: "1 1 auto",
1239 initial: "0 1 auto",
1240 none: "none"
1241 },
1242 fontFamily: {
1243 sans: 'ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"'.split(","),
1244 serif: 'ui-serif,Georgia,Cambria,"Times New Roman",Times,serif'.split(","),
1245 mono: 'ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'.split(",")
1246 },
1247 fontSize: {
1248 xs: ["0.75rem", "1rem"],
1249 sm: ["0.875rem", "1.25rem"],
1250 base: ["1rem", "1.5rem"],
1251 lg: ["1.125rem", "1.75rem"],
1252 xl: ["1.25rem", "1.75rem"],
1253 "2xl": ["1.5rem", "2rem"],
1254 "3xl": ["1.875rem", "2.25rem"],
1255 "4xl": ["2.25rem", "2.5rem"],
1256 "5xl": ["3rem", "1"],
1257 "6xl": ["3.75rem", "1"],
1258 "7xl": ["4.5rem", "1"],
1259 "8xl": ["6rem", "1"],
1260 "9xl": ["8rem", "1"]
1261 },
1262 fontWeight: {
1263 thin: "100",
1264 extralight: "200",
1265 light: "300",
1266 normal: "400",
1267 medium: "500",
1268 semibold: "600",
1269 bold: "700",
1270 extrabold: "800",
1271 black: "900"
1272 },
1273 gridTemplateColumns: {},
1274 gridTemplateRows: {},
1275 gridAutoColumns: {
1276 min: "min-content",
1277 max: "max-content",
1278 fr: "minmax(0,1fr)"
1279 },
1280 gridAutoRows: {
1281 min: "min-content",
1282 max: "max-content",
1283 fr: "minmax(0,1fr)"
1284 },
1285 gridColumn: {
1286 auto: "auto",
1287 "span-full": "1 / -1"
1288 },
1289 gridRow: {
1290 auto: "auto",
1291 "span-full": "1 / -1"
1292 },
1293 gap: /* @__PURE__ */ alias2("spacing"),
1294 gradientColorStops: /* @__PURE__ */ alias2("colors"),
1295 height: (theme2) => ({
1296 auto: "auto",
1297 ...theme2("spacing"),
1298 ...ratios(2, 6),
1299 full: "100%",
1300 screen: "100vh"
1301 }),
1302 inset: (theme2) => ({
1303 auto: "auto",
1304 ...theme2("spacing"),
1305 ...ratios(2, 4),
1306 full: "100%"
1307 }),
1308 keyframes: {
1309 spin: {
1310 from: {
1311 transform: "rotate(0deg)"
1312 },
1313 to: {
1314 transform: "rotate(360deg)"
1315 }
1316 },
1317 ping: {
1318 "0%": {
1319 transform: "scale(1)",
1320 opacity: "1"
1321 },
1322 "75%,100%": {
1323 transform: "scale(2)",
1324 opacity: "0"
1325 }
1326 },
1327 pulse: {
1328 "0%,100%": {
1329 opacity: "1"
1330 },
1331 "50%": {
1332 opacity: ".5"
1333 }
1334 },
1335 bounce: {
1336 "0%, 100%": {
1337 transform: "translateY(-25%)",
1338 animationTimingFunction: "cubic-bezier(0.8,0,1,1)"
1339 },
1340 "50%": {
1341 transform: "none",
1342 animationTimingFunction: "cubic-bezier(0,0,0.2,1)"
1343 }
1344 }
1345 },
1346 letterSpacing: {
1347 tighter: "-0.05em",
1348 tight: "-0.025em",
1349 normal: "0em",
1350 wide: "0.025em",
1351 wider: "0.05em",
1352 widest: "0.1em"
1353 },
1354 lineHeight: {
1355 none: "1",
1356 tight: "1.25",
1357 snug: "1.375",
1358 normal: "1.5",
1359 relaxed: "1.625",
1360 loose: "2",
1361 .../* @__PURE__ */ linear(10, "rem", 4, 3)
1362 },
1363 margin: (theme2) => ({
1364 auto: "auto",
1365 ...theme2("spacing")
1366 }),
1367 maxHeight: (theme2) => ({
1368 ...theme2("spacing"),
1369 full: "100%",
1370 screen: "100vh"
1371 }),
1372 maxWidth: (theme2, {breakpoints}) => ({
1373 none: "none",
1374 0: "0rem",
1375 xs: "20rem",
1376 sm: "24rem",
1377 md: "28rem",
1378 lg: "32rem",
1379 xl: "36rem",
1380 "2xl": "42rem",
1381 "3xl": "48rem",
1382 "4xl": "56rem",
1383 "5xl": "64rem",
1384 "6xl": "72rem",
1385 "7xl": "80rem",
1386 full: "100%",
1387 min: "min-content",
1388 max: "max-content",
1389 prose: "65ch",
1390 ...breakpoints(theme2("screens"))
1391 }),
1392 minHeight: {
1393 0: "0px",
1394 full: "100%",
1395 screen: "100vh"
1396 },
1397 minWidth: {
1398 0: "0px",
1399 full: "100%",
1400 min: "min-content",
1401 max: "max-content"
1402 },
1403 opacity: {
1404 .../* @__PURE__ */ linear(100, "", 100, 0, 10),
1405 5: "0.05",
1406 25: "0.25",
1407 75: "0.75",
1408 95: "0.95"
1409 },
1410 order: {
1411 first: "-9999",
1412 last: "9999",
1413 none: "0",
1414 .../* @__PURE__ */ linear(12, "", 1, 1)
1415 },
1416 outline: {
1417 none: ["2px solid transparent", "2px"],
1418 white: ["2px dotted white", "2px"],
1419 black: ["2px dotted black", "2px"]
1420 },
1421 padding: /* @__PURE__ */ alias2("spacing"),
1422 placeholderColor: /* @__PURE__ */ alias2("colors"),
1423 placeholderOpacity: /* @__PURE__ */ alias2("opacity"),
1424 ringColor: (theme2) => ({
1425 DEFAULT: theme2("colors.blue.500", "#3b82f6"),
1426 ...theme2("colors")
1427 }),
1428 ringOffsetColor: /* @__PURE__ */ alias2("colors"),
1429 ringOffsetWidth: /* @__PURE__ */ exponential(8, "px"),
1430 ringOpacity: (theme2) => ({
1431 DEFAULT: "0.5",
1432 ...theme2("opacity")
1433 }),
1434 ringWidth: {
1435 DEFAULT: "3px",
1436 .../* @__PURE__ */ exponential(8, "px")
1437 },
1438 rotate: {
1439 .../* @__PURE__ */ exponential(2, "deg"),
1440 .../* @__PURE__ */ exponential(12, "deg", 3),
1441 .../* @__PURE__ */ exponential(180, "deg", 45)
1442 },
1443 saturate: /* @__PURE__ */ linear(200, "", 100, 0, 50),
1444 scale: {
1445 .../* @__PURE__ */ linear(150, "", 100, 0, 50),
1446 .../* @__PURE__ */ linear(110, "", 100, 90, 5),
1447 75: "0.75",
1448 125: "1.25"
1449 },
1450 sepia: {
1451 0: "0",
1452 DEFAULT: "100%"
1453 },
1454 skew: {
1455 .../* @__PURE__ */ exponential(2, "deg"),
1456 .../* @__PURE__ */ exponential(12, "deg", 3)
1457 },
1458 space: /* @__PURE__ */ alias2("spacing"),
1459 stroke: {
1460 current: "currentColor"
1461 },
1462 strokeWidth: /* @__PURE__ */ linear(2),
1463 textColor: /* @__PURE__ */ alias2("colors"),
1464 textOpacity: /* @__PURE__ */ alias2("opacity"),
1465 transitionDuration: (theme2) => ({
1466 DEFAULT: "150ms",
1467 ...theme2("durations")
1468 }),
1469 transitionDelay: /* @__PURE__ */ alias2("durations"),
1470 transitionProperty: {
1471 none: "none",
1472 all: "all",
1473 DEFAULT: "background-color,border-color,color,fill,stroke,opacity,box-shadow,transform",
1474 colors: "background-color,border-color,color,fill,stroke",
1475 opacity: "opacity",
1476 shadow: "box-shadow",
1477 transform: "transform"
1478 },
1479 transitionTimingFunction: {
1480 DEFAULT: "cubic-bezier(0.4,0,0.2,1)",
1481 linear: "linear",
1482 in: "cubic-bezier(0.4,0,1,1)",
1483 out: "cubic-bezier(0,0,0.2,1)",
1484 "in-out": "cubic-bezier(0.4,0,0.2,1)"
1485 },
1486 translate: (theme2) => ({
1487 ...theme2("spacing"),
1488 ...ratios(2, 4),
1489 full: "100%"
1490 }),
1491 width: (theme2) => ({
1492 auto: "auto",
1493 ...theme2("spacing"),
1494 ...ratios(2, 6),
1495 ...ratios(12, 12),
1496 screen: "100vw",
1497 full: "100%",
1498 min: "min-content",
1499 max: "max-content"
1500 }),
1501 zIndex: {
1502 auto: "auto",
1503 .../* @__PURE__ */ linear(50, "", 1, 0, 10)
1504 }
1505};
1506var flattenColorPalette = (colors, target = {}, prefix = []) => {
1507 Object.keys(colors).forEach((property2) => {
1508 const value = colors[property2];
1509 if (property2 == "DEFAULT") {
1510 target[join(prefix)] = value;
1511 target[join(prefix, ".")] = value;
1512 }
1513 const key = [...prefix, property2];
1514 target[join(key)] = value;
1515 target[join(key, ".")] = value;
1516 if (value && typeof value == "object") {
1517 flattenColorPalette(value, target, key);
1518 }
1519 }, target);
1520 return target;
1521};
1522var resolveContext = {
1523 negative: () => ({}),
1524 breakpoints: (screens) => Object.keys(screens).filter((key) => typeof screens[key] == "string").reduce((target, key) => {
1525 target["screen-" + key] = screens[key];
1526 return target;
1527 }, {})
1528};
1529var handleArbitraryValues = (section, key) => (key = key[0] == "[" && key.slice(-1) == "]" && key.slice(1, -1)) && includes(section, "olor") == /^(#|(hsl|rgb)a?\(|[a-z]+$)/.test(key) && (includes(key, "calc(") ? key.replace(/(-?\d*\.?\d(?:%|[a-z]+)?|\))([+\-/*])/g, "$1 $2 ") : key);
1530var makeThemeResolver = (config) => {
1531 const cache = new Map();
1532 const theme2 = {...defaultTheme, ...config};
1533 const deref = (theme3, section) => {
1534 const base = theme3 && theme3[section];
1535 const value = typeof base == "function" ? base(resolve, resolveContext) : base;
1536 return value && section == "colors" ? flattenColorPalette(value) : value;
1537 };
1538 const resolve = (section, key, defaultValue) => {
1539 const keypath = section.split(".");
1540 section = keypath[0];
1541 if (keypath.length > 1) {
1542 defaultValue = key;
1543 key = join(tail(keypath), ".");
1544 }
1545 let base = cache.get(section);
1546 if (!base) {
1547 cache.set(section, base = {...deref(theme2, section)});
1548 Object.assign(base, deref(theme2.extend, section));
1549 }
1550 if (key != null) {
1551 key = (Array.isArray(key) ? join(key) : key) || "DEFAULT";
1552 const value = handleArbitraryValues(section, key) || base[key];
1553 return value == null ? defaultValue : Array.isArray(value) && !includes(["fontSize", "outline", "dropShadow"], section) ? join(value, ",") : value;
1554 }
1555 return base;
1556 };
1557 return resolve;
1558};
1559
1560// src/twind/translate.ts
1561var translate = (plugins, context) => (rule, isTranslating) => {
1562 if (typeof rule.d == "function") {
1563 return rule.d(context);
1564 }
1565 const parameters = rule.d.split(/-(?![^[]*])/g);
1566 if (!isTranslating && parameters[0] == "tw" && rule.$ == rule.d) {
1567 return rule.$;
1568 }
1569 for (let index = parameters.length; index; index--) {
1570 const id = join(parameters.slice(0, index));
1571 const plugin = plugins[id];
1572 if (plugin) {
1573 return typeof plugin == "function" ? plugin(tail(parameters, index), context, id) : typeof plugin == "string" ? context[isTranslating ? "css" : "tw"](plugin) : plugin;
1574 }
1575 }
1576};
1577
1578// src/twind/decorate.ts
1579var _2;
1580var GROUP_RE = /^:(group(?:(?!-focus).+?)*)-(.+)$/;
1581var NOT_PREFIX_RE = /^(:not)-(.+)/;
1582var prepareVariantSelector = (variant) => variant[1] == "[" ? tail(variant) : variant;
1583var decorate = (darkMode, variants, {theme: theme2, tag}) => {
1584 const applyVariant = (translation, variant) => {
1585 if (_2 = theme2("screens", tail(variant), "")) {
1586 return {[buildMediaQuery(_2)]: translation};
1587 }
1588 if (variant == ":dark" && darkMode == "class") {
1589 return {".dark &": translation};
1590 }
1591 if (_2 = GROUP_RE.exec(variant)) {
1592 return {[`.${escape(tag(_2[1]))}:${_2[2]} &`]: translation};
1593 }
1594 return {
1595 [variants[tail(variant)] || "&" + variant.replace(NOT_PREFIX_RE, (_4, not, variant2) => not + "(" + prepareVariantSelector(":" + variant2) + ")")]: translation
1596 };
1597 };
1598 return (translation, rule) => rule.v.reduceRight(applyVariant, translation);
1599};
1600
1601// src/twind/presedence.ts
1602var _3;
1603var responsivePrecedence = (css) => (((_3 = /(?:^|min-width: *)(\d+(?:.\d+)?)(p)?/.exec(css)) ? +_3[1] / (_3[2] ? 15 : 1) / 10 : 0) & 31) << 22;
1604var seperatorPrecedence = (string) => {
1605 _3 = 0;
1606 for (let index = string.length; index--; ) {
1607 _3 += includes("-:,", string[index]);
1608 }
1609 return _3;
1610};
1611var atRulePresedence = (css) => (seperatorPrecedence(css) & 15) << 18;
1612var PRECEDENCES_BY_PSEUDO_CLASS = [
1613 "rst",
1614 "st",
1615 "en",
1616 "d",
1617 "nk",
1618 "sited",
1619 "pty",
1620 "ecked",
1621 "cus-w",
1622 "ver",
1623 "cus",
1624 "cus-v",
1625 "tive",
1626 "sable",
1627 "ad-on",
1628 "tiona",
1629 "quire"
1630];
1631var pseudoPrecedence = (pseudoClass) => 1 << (~(_3 = PRECEDENCES_BY_PSEUDO_CLASS.indexOf(pseudoClass.replace(GROUP_RE, ":$2").slice(3, 8))) ? _3 : 17);
1632var makeVariantPresedenceCalculator = (theme2, variants) => (presedence, variant) => presedence | ((_3 = theme2("screens", tail(variant), "")) ? 1 << 27 | responsivePrecedence(buildMediaQuery(_3)) : variant == ":dark" ? 1 << 30 : (_3 = variants[variant] || variant.replace(NOT_PREFIX_RE, ":$2"))[0] == "@" ? atRulePresedence(_3) : pseudoPrecedence(variant));
1633var declarationPropertyPrecedence = (property2) => property2[0] == "-" ? 0 : seperatorPrecedence(property2) + ((_3 = /^(?:(border-(?!w|c|sty)|[tlbr].{2,4}m?$|c.{7}$)|([fl].{5}l|g.{8}$|pl))/.exec(property2)) ? +!!_3[1] || -!!_3[2] : 0) + 1;
1634
1635// src/twind/serialize.ts
1636var stringifyBlock = (body, selector) => selector + "{" + body + "}";
1637var serialize = (prefix, variants, context) => {
1638 const {theme: theme2, tag} = context;
1639 const tagVar = (_4, property2) => "--" + tag(property2);
1640 const tagVars = (value) => `${value}`.replace(/--(tw-[\w-]+)\b/g, tagVar);
1641 const stringifyDeclaration = (property2, value, important) => {
1642 property2 = tagVars(property2);
1643 return Array.isArray(value) ? join(value.filter(Boolean).map((value2) => prefix(property2, tagVars(value2), important)), ";") : prefix(property2, tagVars(value), important);
1644 };
1645 let rules2;
1646 const stringify3 = (atRules, selector, presedence, css, important) => {
1647 if (Array.isArray(css)) {
1648 css.forEach((css2) => css2 && stringify3(atRules, selector, presedence, css2, important));
1649 return;
1650 }
1651 let declarations = "";
1652 let maxPropertyPresedence = 0;
1653 let numberOfDeclarations = 0;
1654 if (css["@apply"]) {
1655 css = merge(evalThunk(apply(css["@apply"]), context), {...css, "@apply": void 0}, context);
1656 }
1657 Object.keys(css).forEach((key) => {
1658 const value = evalThunk(css[key], context);
1659 if (isCSSProperty(key, value)) {
1660 if (value !== "" && key.length > 1) {
1661 const property2 = hyphenate(key);
1662 numberOfDeclarations += 1;
1663 maxPropertyPresedence = Math.max(maxPropertyPresedence, declarationPropertyPrecedence(property2));
1664 declarations = (declarations && declarations + ";") + stringifyDeclaration(property2, value, important);
1665 }
1666 } else if (value) {
1667 if (key == ":global") {
1668 key = "@global";
1669 }
1670 if (key[0] == "@") {
1671 if (key[1] == "g") {
1672 stringify3([], "", 0, value, important);
1673 } else if (key[1] == "f") {
1674 stringify3([], key, 0, value, important);
1675 } else if (key[1] == "k") {
1676 const currentSize = rules2.length;
1677 stringify3([], "", 0, value, important);
1678 const waypoints = rules2.splice(currentSize, rules2.length - currentSize);
1679 rules2.push({
1680 r: stringifyBlock(join(waypoints.map((p) => p.r), ""), key),
1681 p: waypoints.reduce((sum, p) => sum + p.p, 0)
1682 });
1683 } else if (key[1] == "i") {
1684 ;
1685 (Array.isArray(value) ? value : [value]).forEach((value2) => value2 && rules2.push({p: 0, r: `${key} ${value2};`}));
1686 } else {
1687 if (key[2] == "c") {
1688 key = buildMediaQuery(context.theme("screens", tail(key, 8).trim()));
1689 }
1690 stringify3([...atRules, key], selector, presedence | responsivePrecedence(key) | atRulePresedence(key), value, important);
1691 }
1692 } else {
1693 stringify3(atRules, selector ? join(selector.split(/,(?![^[]*])/g).map((selectorPart) => join(key.split(/,(?![^[]*])/g).map((keyPart) => includes(keyPart, "&") ? keyPart.replace(/&/g, selectorPart) : (selectorPart && selectorPart + " ") + keyPart), ",")), ",") : key, presedence, value, important);
1694 }
1695 }
1696 });
1697 if (numberOfDeclarations) {
1698 rules2.push({
1699 r: atRules.reduceRight(stringifyBlock, stringifyBlock(declarations, selector)),
1700 p: presedence * (1 << 8) + ((Math.max(0, 15 - numberOfDeclarations) & 15) << 4 | (maxPropertyPresedence || 15) & 15)
1701 });
1702 }
1703 };
1704 const variantPresedence = makeVariantPresedenceCalculator(theme2, variants);
1705 return (css, className, rule, layer = 0) => {
1706 layer <<= 28;
1707 rules2 = [];
1708 stringify3([], className ? "." + escape(className) : "", rule ? rule.v.reduceRight(variantPresedence, layer) : layer, css, rule && rule.i);
1709 return rules2;
1710 };
1711};
1712
1713// src/twind/inject.ts
1714var inject = (sheet, mode2, init, context) => {
1715 let sortedPrecedences;
1716 init((value = []) => sortedPrecedences = value);
1717 let insertedRules;
1718 init((value = new Set()) => insertedRules = value);
1719 return ({r: css, p: presedence}) => {
1720 if (!insertedRules.has(css)) {
1721 insertedRules.add(css);
1722 const index = sortedInsertionIndex(sortedPrecedences, presedence);
1723 try {
1724 sheet.insert(css, index);
1725 sortedPrecedences.splice(index, 0, presedence);
1726 } catch (error) {
1727 if (!/:-[mwo]/.test(css)) {
1728 mode2.report({id: "INJECT_CSS_ERROR", css, error}, context);
1729 }
1730 }
1731 }
1732 };
1733};
1734
1735// src/twind/configure.ts
1736var sanitize = (value, defaultValue, disabled, enabled = defaultValue) => value === false ? disabled : value === true ? enabled : value || defaultValue;
1737var loadMode = (mode2) => (typeof mode2 == "string" ? {t: strict, a: warn, i: silent}[mode2[1]] : mode2) || warn;
1738var stringifyVariant = (selector, variant) => selector + (variant[1] == ":" ? tail(variant, 2) + ":" : tail(variant)) + ":";
1739var stringify2 = (rule, directive2 = rule.d) => typeof directive2 == "function" ? "" : rule.v.reduce(stringifyVariant, "") + (rule.i ? "!" : "") + (rule.n ? "-" : "") + directive2;
1740var COMPONENT_PROPS = {_: {value: "", writable: true}};
1741var configure = (config = {}) => {
1742 const theme2 = makeThemeResolver(config.theme);
1743 const mode2 = loadMode(config.mode);
1744 const hash = sanitize(config.hash, false, false, cyrb32);
1745 const important = config.important;
1746 let activeRule = {v: []};
1747 let translateDepth = 0;
1748 const lastTranslations = [];
1749 const context = {
1750 tw: (...tokens) => process(tokens),
1751 theme: (section, key, defaultValue) => {
1752 const value = theme2(section, key, defaultValue) ?? mode2.unknown(section, key == null || Array.isArray(key) ? key : key.split("."), defaultValue != null, context);
1753 return activeRule.n && value && includes("rg", (typeof value)[5]) ? `calc(${value} * -1)` : value;
1754 },
1755 tag: (value) => hash ? hash(value) : value,
1756 css: (rules2) => {
1757 translateDepth++;
1758 const lastTranslationsIndex = lastTranslations.length;
1759 try {
1760 ;
1761 (typeof rules2 == "string" ? parse([rules2]) : rules2).forEach(convert);
1762 const css = Object.create(null, COMPONENT_PROPS);
1763 for (let index = lastTranslationsIndex; index < lastTranslations.length; index++) {
1764 const translation = lastTranslations[index];
1765 if (translation) {
1766 switch (typeof translation) {
1767 case "object":
1768 merge(css, translation, context);
1769 break;
1770 case "string":
1771 css._ += (css._ && " ") + translation;
1772 }
1773 }
1774 }
1775 return css;
1776 } finally {
1777 lastTranslations.length = lastTranslationsIndex;
1778 translateDepth--;
1779 }
1780 }
1781 };
1782 const translate2 = translate({...corePlugins, ...config.plugins}, context);
1783 const doTranslate = (rule) => {
1784 const parentRule = activeRule;
1785 activeRule = rule;
1786 try {
1787 return evalThunk(translate2(rule), context);
1788 } finally {
1789 activeRule = parentRule;
1790 }
1791 };
1792 const variants = {...coreVariants, ...config.variants};
1793 const decorate2 = decorate(config.darkMode || "media", variants, context);
1794 const serialize2 = serialize(sanitize(config.prefix, autoprefix, noprefix), variants, context);
1795 const sheet = config.sheet || (typeof window == "undefined" ? voidSheet() : cssomSheet(config));
1796 const {init = (callback) => callback()} = sheet;
1797 const inject2 = inject(sheet, mode2, init, context);
1798 let idToClassName;
1799 init((value = new Map()) => idToClassName = value);
1800 const inlineDirectiveName = new WeakMap();
1801 const evaluateFunctions = (key, value) => key == "_" ? void 0 : typeof value == "function" ? JSON.stringify(evalThunk(value, context), evaluateFunctions) : value;
1802 const convert = (rule) => {
1803 if (!translateDepth && activeRule.v.length) {
1804 rule = {...rule, v: [...activeRule.v, ...rule.v], $: ""};
1805 }
1806 if (!rule.$) {
1807 rule.$ = stringify2(rule, inlineDirectiveName.get(rule.d));
1808 }
1809 let className = translateDepth ? null : idToClassName.get(rule.$);
1810 if (className == null) {
1811 let translation = doTranslate(rule);
1812 if (!rule.$) {
1813 rule.$ = cyrb32(JSON.stringify(translation, evaluateFunctions));
1814 inlineDirectiveName.set(rule.d, rule.$);
1815 rule.$ = stringify2(rule, rule.$);
1816 }
1817 if (translation && typeof translation == "object") {
1818 rule.v = rule.v.map(prepareVariantSelector);
1819 if (important)
1820 rule.i = important;
1821 translation = decorate2(translation, rule);
1822 if (translateDepth) {
1823 lastTranslations.push(translation);
1824 } else {
1825 const layer = typeof rule.d == "function" ? typeof translation._ == "string" ? 1 : 3 : 2;
1826 className = hash || typeof rule.d == "function" ? (hash || cyrb32)(layer + rule.$) : rule.$;
1827 serialize2(translation, className, rule, layer).forEach(inject2);
1828 if (translation._) {
1829 className += " " + translation._;
1830 }
1831 }
1832 } else {
1833 if (typeof translation == "string") {
1834 className = translation;
1835 } else {
1836 className = rule.$;
1837 mode2.report({id: "UNKNOWN_DIRECTIVE", rule: className}, context);
1838 }
1839 if (translateDepth && typeof rule.d !== "function") {
1840 lastTranslations.push(className);
1841 }
1842 }
1843 if (!translateDepth) {
1844 idToClassName.set(rule.$, className);
1845 ensureMaxSize(idToClassName, 3e4);
1846 }
1847 }
1848 return className;
1849 };
1850 const process = (tokens) => join(parse(tokens).map(convert).filter(Boolean), " ");
1851 const preflight = sanitize(config.preflight, identity, false);
1852 if (preflight) {
1853 const css = createPreflight(theme2);
1854 const styles = serialize2(typeof preflight == "function" ? evalThunk(preflight(css, context), context) || css : {...css, ...preflight});
1855 init((injected = (styles.forEach(inject2), true)) => injected);
1856 }
1857 return {
1858 init: () => mode2.report({id: "LATE_SETUP_CALL"}, context),
1859 process
1860 };
1861};
1862
1863// src/twind/instance.ts
1864var create = (config) => {
1865 let process = (tokens) => {
1866 init();
1867 return process(tokens);
1868 };
1869 let init = (config2) => {
1870 ;
1871 ({process, init} = configure(config2));
1872 };
1873 if (config)
1874 init(config);
1875 let context;
1876 const fromContext = (key) => () => {
1877 if (!context) {
1878 process([
1879 (_4) => {
1880 context = _4;
1881 return "";
1882 }
1883 ]);
1884 }
1885 return context[key];
1886 };
1887 return {
1888 tw: Object.defineProperties((...tokens) => process(tokens), {
1889 theme: {
1890 get: fromContext("theme")
1891 }
1892 }),
1893 setup: (config2) => init(config2)
1894 };
1895};
1896
1897// src/twind/default.ts
1898var {tw, setup} = /* @__PURE__ */ create();
1899export {
1900 apply,
1901 autoprefix,
1902 create,
1903 cssomSheet,
1904 directive,
1905 cyrb32 as hash,
1906 mode,
1907 noprefix,
1908 setup,
1909 silent,
1910 strict,
1911 theme,
1912 tw,
1913 voidSheet,
1914 warn
1915};
1916//# sourceMappingURL=twind.esnext.js.map