tw-to-css
Version:
Tailwindcss Inline CSS
1,494 lines (1,476 loc) • 772 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/tailwindcss/src/css/preflight.css
var preflight_default;
var init_preflight = __esm({
"node_modules/tailwindcss/src/css/preflight.css"() {
preflight_default = '*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:theme("borderColor.DEFAULT",currentColor)}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:theme("fontFamily.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");font-feature-settings:theme("fontFamily.sans[1].fontFeatureSettings",normal);font-variation-settings:theme("fontFamily.sans[1].fontVariationSettings",normal)}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:theme("fontFamily.mono",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:theme("colors.gray.400",#9ca3af)}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}\n';
}
});
// src/stubs/fs.ts
var fs_exports = {};
__export(fs_exports, {
default: () => fs_default
});
var fs_default;
var init_fs = __esm({
"src/stubs/fs.ts"() {
init_preflight();
fs_default = {
readFileSync: () => preflight_default
};
}
});
// node_modules/@alloc/quick-lru/index.js
var require_quick_lru = __commonJS({
"node_modules/@alloc/quick-lru/index.js"(exports, module2) {
"use strict";
var QuickLRU = class {
constructor(options = {}) {
if (!(options.maxSize && options.maxSize > 0)) {
throw new TypeError("`maxSize` must be a number greater than 0");
}
if (typeof options.maxAge === "number" && options.maxAge === 0) {
throw new TypeError("`maxAge` must be a number greater than 0");
}
this.maxSize = options.maxSize;
this.maxAge = options.maxAge || Infinity;
this.onEviction = options.onEviction;
this.cache = /* @__PURE__ */ new Map();
this.oldCache = /* @__PURE__ */ new Map();
this._size = 0;
}
_emitEvictions(cache2) {
if (typeof this.onEviction !== "function") {
return;
}
for (const [key, item] of cache2) {
this.onEviction(key, item.value);
}
}
_deleteIfExpired(key, item) {
if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
if (typeof this.onEviction === "function") {
this.onEviction(key, item.value);
}
return this.delete(key);
}
return false;
}
_getOrDeleteIfExpired(key, item) {
const deleted = this._deleteIfExpired(key, item);
if (deleted === false) {
return item.value;
}
}
_getItemValue(key, item) {
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
}
_peek(key, cache2) {
const item = cache2.get(key);
return this._getItemValue(key, item);
}
_set(key, value2) {
this.cache.set(key, value2);
this._size++;
if (this._size >= this.maxSize) {
this._size = 0;
this._emitEvictions(this.oldCache);
this.oldCache = this.cache;
this.cache = /* @__PURE__ */ new Map();
}
}
_moveToRecent(key, item) {
this.oldCache.delete(key);
this._set(key, item);
}
*_entriesAscending() {
for (const item of this.oldCache) {
const [key, value2] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield item;
}
}
}
for (const item of this.cache) {
const [key, value2] = item;
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield item;
}
}
}
get(key) {
if (this.cache.has(key)) {
const item = this.cache.get(key);
return this._getItemValue(key, item);
}
if (this.oldCache.has(key)) {
const item = this.oldCache.get(key);
if (this._deleteIfExpired(key, item) === false) {
this._moveToRecent(key, item);
return item.value;
}
}
}
set(key, value2, { maxAge = this.maxAge === Infinity ? void 0 : Date.now() + this.maxAge } = {}) {
if (this.cache.has(key)) {
this.cache.set(key, {
value: value2,
maxAge
});
} else {
this._set(key, { value: value2, expiry: maxAge });
}
}
has(key) {
if (this.cache.has(key)) {
return !this._deleteIfExpired(key, this.cache.get(key));
}
if (this.oldCache.has(key)) {
return !this._deleteIfExpired(key, this.oldCache.get(key));
}
return false;
}
peek(key) {
if (this.cache.has(key)) {
return this._peek(key, this.cache);
}
if (this.oldCache.has(key)) {
return this._peek(key, this.oldCache);
}
}
delete(key) {
const deleted = this.cache.delete(key);
if (deleted) {
this._size--;
}
return this.oldCache.delete(key) || deleted;
}
clear() {
this.cache.clear();
this.oldCache.clear();
this._size = 0;
}
resize(newSize) {
if (!(newSize && newSize > 0)) {
throw new TypeError("`maxSize` must be a number greater than 0");
}
const items = [...this._entriesAscending()];
const removeCount = items.length - newSize;
if (removeCount < 0) {
this.cache = new Map(items);
this.oldCache = /* @__PURE__ */ new Map();
this._size = items.length;
} else {
if (removeCount > 0) {
this._emitEvictions(items.slice(0, removeCount));
}
this.oldCache = new Map(items.slice(removeCount));
this.cache = /* @__PURE__ */ new Map();
this._size = 0;
}
this.maxSize = newSize;
}
*keys() {
for (const [key] of this) {
yield key;
}
}
*values() {
for (const [, value2] of this) {
yield value2;
}
}
*[Symbol.iterator]() {
for (const item of this.cache) {
const [key, value2] = item;
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield [key, value2.value];
}
}
for (const item of this.oldCache) {
const [key, value2] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield [key, value2.value];
}
}
}
}
*entriesDescending() {
let items = [...this.cache];
for (let i = items.length - 1; i >= 0; --i) {
const item = items[i];
const [key, value2] = item;
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield [key, value2.value];
}
}
items = [...this.oldCache];
for (let i = items.length - 1; i >= 0; --i) {
const item = items[i];
const [key, value2] = item;
if (!this.cache.has(key)) {
const deleted = this._deleteIfExpired(key, value2);
if (deleted === false) {
yield [key, value2.value];
}
}
}
}
*entriesAscending() {
for (const [key, value2] of this._entriesAscending()) {
yield [key, value2.value];
}
}
get size() {
if (!this._size) {
return this.oldCache.size;
}
let oldCacheSize = 0;
for (const key of this.oldCache.keys()) {
if (!this.cache.has(key)) {
oldCacheSize++;
}
}
return Math.min(this._size + oldCacheSize, this.maxSize);
}
};
module2.exports = QuickLRU;
}
});
// src/stubs/picocolors.ts
var picocolors_exports = {};
__export(picocolors_exports, {
default: () => picocolors_default
});
var picocolors_default;
var init_picocolors = __esm({
"src/stubs/picocolors.ts"() {
picocolors_default = {
yellow: (input) => input
};
}
});
// (disabled):node_modules/tailwindcss/node_modules/postcss/lib/terminal-highlight
var require_terminal_highlight = __commonJS({
"(disabled):node_modules/tailwindcss/node_modules/postcss/lib/terminal-highlight"() {
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/css-syntax-error.js
var require_css_syntax_error = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/css-syntax-error.js"(exports, module2) {
"use strict";
var pico = (init_picocolors(), __toCommonJS(picocolors_exports));
var terminalHighlight = require_terminal_highlight();
var CssSyntaxError3 = class extends Error {
constructor(message, line, column, source, file, plugin3) {
super(message);
this.name = "CssSyntaxError";
this.reason = message;
if (file) {
this.file = file;
}
if (source) {
this.source = source;
}
if (plugin3) {
this.plugin = plugin3;
}
if (typeof line !== "undefined" && typeof column !== "undefined") {
if (typeof line === "number") {
this.line = line;
this.column = column;
} else {
this.line = line.line;
this.column = line.column;
this.endLine = column.line;
this.endColumn = column.column;
}
}
this.setMessage();
if (Error.captureStackTrace) {
Error.captureStackTrace(this, CssSyntaxError3);
}
}
setMessage() {
this.message = this.plugin ? this.plugin + ": " : "";
this.message += this.file ? this.file : "<css input>";
if (typeof this.line !== "undefined") {
this.message += ":" + this.line + ":" + this.column;
}
this.message += ": " + this.reason;
}
showSourceCode(color2) {
if (!this.source)
return "";
let css = this.source;
if (color2 == null)
color2 = pico.isColorSupported;
if (terminalHighlight) {
if (color2)
css = terminalHighlight(css);
}
let lines = css.split(/\r?\n/);
let start = Math.max(this.line - 3, 0);
let end = Math.min(this.line + 2, lines.length);
let maxWidth = String(end).length;
let mark, aside;
if (color2) {
let { bold, gray, red } = pico.createColors(true);
mark = (text) => bold(red(text));
aside = (text) => gray(text);
} else {
mark = aside = (str) => str;
}
return lines.slice(start, end).map((line, index3) => {
let number2 = start + 1 + index3;
let gutter = " " + (" " + number2).slice(-maxWidth) + " | ";
if (number2 === this.line) {
let spacing = aside(gutter.replace(/\d/g, " ")) + line.slice(0, this.column - 1).replace(/[^\t]/g, " ");
return mark(">") + aside(gutter) + line + "\n " + spacing + mark("^");
}
return " " + aside(gutter) + line;
}).join("\n");
}
toString() {
let code = this.showSourceCode();
if (code) {
code = "\n\n" + code + "\n";
}
return this.name + ": " + this.message + code;
}
};
module2.exports = CssSyntaxError3;
CssSyntaxError3.default = CssSyntaxError3;
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/symbols.js
var require_symbols = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/symbols.js"(exports, module2) {
"use strict";
module2.exports.isClean = Symbol("isClean");
module2.exports.my = Symbol("my");
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/stringifier.js
var require_stringifier = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/stringifier.js"(exports, module2) {
"use strict";
var DEFAULT_RAW = {
after: "\n",
beforeClose: "\n",
beforeComment: "\n",
beforeDecl: "\n",
beforeOpen: " ",
beforeRule: "\n",
colon: ": ",
commentLeft: " ",
commentRight: " ",
emptyBody: "",
indent: " ",
semicolon: false
};
function capitalize(str) {
return str[0].toUpperCase() + str.slice(1);
}
var Stringifier = class {
constructor(builder) {
this.builder = builder;
}
atrule(node, semicolon) {
let name = "@" + node.name;
let params = node.params ? this.rawValue(node, "params") : "";
if (typeof node.raws.afterName !== "undefined") {
name += node.raws.afterName;
} else if (params) {
name += " ";
}
if (node.nodes) {
this.block(node, name + params);
} else {
let end = (node.raws.between || "") + (semicolon ? ";" : "");
this.builder(name + params + end, node);
}
}
beforeAfter(node, detect) {
let value2;
if (node.type === "decl") {
value2 = this.raw(node, null, "beforeDecl");
} else if (node.type === "comment") {
value2 = this.raw(node, null, "beforeComment");
} else if (detect === "before") {
value2 = this.raw(node, null, "beforeRule");
} else {
value2 = this.raw(node, null, "beforeClose");
}
let buf = node.parent;
let depth = 0;
while (buf && buf.type !== "root") {
depth += 1;
buf = buf.parent;
}
if (value2.includes("\n")) {
let indent = this.raw(node, null, "indent");
if (indent.length) {
for (let step = 0; step < depth; step++)
value2 += indent;
}
}
return value2;
}
block(node, start) {
let between = this.raw(node, "between", "beforeOpen");
this.builder(start + between + "{", node, "start");
let after;
if (node.nodes && node.nodes.length) {
this.body(node);
after = this.raw(node, "after");
} else {
after = this.raw(node, "after", "emptyBody");
}
if (after)
this.builder(after);
this.builder("}", node, "end");
}
body(node) {
let last = node.nodes.length - 1;
while (last > 0) {
if (node.nodes[last].type !== "comment")
break;
last -= 1;
}
let semicolon = this.raw(node, "semicolon");
for (let i = 0; i < node.nodes.length; i++) {
let child = node.nodes[i];
let before = this.raw(child, "before");
if (before)
this.builder(before);
this.stringify(child, last !== i || semicolon);
}
}
comment(node) {
let left = this.raw(node, "left", "commentLeft");
let right = this.raw(node, "right", "commentRight");
this.builder("/*" + left + node.text + right + "*/", node);
}
decl(node, semicolon) {
let between = this.raw(node, "between", "colon");
let string = node.prop + between + this.rawValue(node, "value");
if (node.important) {
string += node.raws.important || " !important";
}
if (semicolon)
string += ";";
this.builder(string, node);
}
document(node) {
this.body(node);
}
raw(node, own, detect) {
let value2;
if (!detect)
detect = own;
if (own) {
value2 = node.raws[own];
if (typeof value2 !== "undefined")
return value2;
}
let parent = node.parent;
if (detect === "before") {
if (!parent || parent.type === "root" && parent.first === node) {
return "";
}
if (parent && parent.type === "document") {
return "";
}
}
if (!parent)
return DEFAULT_RAW[detect];
let root3 = node.root();
if (!root3.rawCache)
root3.rawCache = {};
if (typeof root3.rawCache[detect] !== "undefined") {
return root3.rawCache[detect];
}
if (detect === "before" || detect === "after") {
return this.beforeAfter(node, detect);
} else {
let method = "raw" + capitalize(detect);
if (this[method]) {
value2 = this[method](root3, node);
} else {
root3.walk((i) => {
value2 = i.raws[own];
if (typeof value2 !== "undefined")
return false;
});
}
}
if (typeof value2 === "undefined")
value2 = DEFAULT_RAW[detect];
root3.rawCache[detect] = value2;
return value2;
}
rawBeforeClose(root3) {
let value2;
root3.walk((i) => {
if (i.nodes && i.nodes.length > 0) {
if (typeof i.raws.after !== "undefined") {
value2 = i.raws.after;
if (value2.includes("\n")) {
value2 = value2.replace(/[^\n]+$/, "");
}
return false;
}
}
});
if (value2)
value2 = value2.replace(/\S/g, "");
return value2;
}
rawBeforeComment(root3, node) {
let value2;
root3.walkComments((i) => {
if (typeof i.raws.before !== "undefined") {
value2 = i.raws.before;
if (value2.includes("\n")) {
value2 = value2.replace(/[^\n]+$/, "");
}
return false;
}
});
if (typeof value2 === "undefined") {
value2 = this.raw(node, null, "beforeDecl");
} else if (value2) {
value2 = value2.replace(/\S/g, "");
}
return value2;
}
rawBeforeDecl(root3, node) {
let value2;
root3.walkDecls((i) => {
if (typeof i.raws.before !== "undefined") {
value2 = i.raws.before;
if (value2.includes("\n")) {
value2 = value2.replace(/[^\n]+$/, "");
}
return false;
}
});
if (typeof value2 === "undefined") {
value2 = this.raw(node, null, "beforeRule");
} else if (value2) {
value2 = value2.replace(/\S/g, "");
}
return value2;
}
rawBeforeOpen(root3) {
let value2;
root3.walk((i) => {
if (i.type !== "decl") {
value2 = i.raws.between;
if (typeof value2 !== "undefined")
return false;
}
});
return value2;
}
rawBeforeRule(root3) {
let value2;
root3.walk((i) => {
if (i.nodes && (i.parent !== root3 || root3.first !== i)) {
if (typeof i.raws.before !== "undefined") {
value2 = i.raws.before;
if (value2.includes("\n")) {
value2 = value2.replace(/[^\n]+$/, "");
}
return false;
}
}
});
if (value2)
value2 = value2.replace(/\S/g, "");
return value2;
}
rawColon(root3) {
let value2;
root3.walkDecls((i) => {
if (typeof i.raws.between !== "undefined") {
value2 = i.raws.between.replace(/[^\s:]/g, "");
return false;
}
});
return value2;
}
rawEmptyBody(root3) {
let value2;
root3.walk((i) => {
if (i.nodes && i.nodes.length === 0) {
value2 = i.raws.after;
if (typeof value2 !== "undefined")
return false;
}
});
return value2;
}
rawIndent(root3) {
if (root3.raws.indent)
return root3.raws.indent;
let value2;
root3.walk((i) => {
let p = i.parent;
if (p && p !== root3 && p.parent && p.parent === root3) {
if (typeof i.raws.before !== "undefined") {
let parts = i.raws.before.split("\n");
value2 = parts[parts.length - 1];
value2 = value2.replace(/\S/g, "");
return false;
}
}
});
return value2;
}
rawSemicolon(root3) {
let value2;
root3.walk((i) => {
if (i.nodes && i.nodes.length && i.last.type === "decl") {
value2 = i.raws.semicolon;
if (typeof value2 !== "undefined")
return false;
}
});
return value2;
}
rawValue(node, prop) {
let value2 = node[prop];
let raw = node.raws[prop];
if (raw && raw.value === value2) {
return raw.raw;
}
return value2;
}
root(node) {
this.body(node);
if (node.raws.after)
this.builder(node.raws.after);
}
rule(node) {
this.block(node, this.rawValue(node, "selector"));
if (node.raws.ownSemicolon) {
this.builder(node.raws.ownSemicolon, node, "end");
}
}
stringify(node, semicolon) {
if (!this[node.type]) {
throw new Error(
"Unknown AST node type " + node.type + ". Maybe you need to change PostCSS stringifier."
);
}
this[node.type](node, semicolon);
}
};
module2.exports = Stringifier;
Stringifier.default = Stringifier;
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/stringify.js
var require_stringify = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/stringify.js"(exports, module2) {
"use strict";
var Stringifier = require_stringifier();
function stringify3(node, builder) {
let str = new Stringifier(builder);
str.stringify(node);
}
module2.exports = stringify3;
stringify3.default = stringify3;
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/node.js
var require_node = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/node.js"(exports, module2) {
"use strict";
var { isClean, my } = require_symbols();
var CssSyntaxError3 = require_css_syntax_error();
var Stringifier = require_stringifier();
var stringify3 = require_stringify();
function cloneNode(obj, parent) {
let cloned = new obj.constructor();
for (let i in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, i)) {
continue;
}
if (i === "proxyCache")
continue;
let value2 = obj[i];
let type = typeof value2;
if (i === "parent" && type === "object") {
if (parent)
cloned[i] = parent;
} else if (i === "source") {
cloned[i] = value2;
} else if (Array.isArray(value2)) {
cloned[i] = value2.map((j) => cloneNode(j, cloned));
} else {
if (type === "object" && value2 !== null)
value2 = cloneNode(value2);
cloned[i] = value2;
}
}
return cloned;
}
var Node3 = class {
constructor(defaults3 = {}) {
this.raws = {};
this[isClean] = false;
this[my] = true;
for (let name in defaults3) {
if (name === "nodes") {
this.nodes = [];
for (let node of defaults3[name]) {
if (typeof node.clone === "function") {
this.append(node.clone());
} else {
this.append(node);
}
}
} else {
this[name] = defaults3[name];
}
}
}
addToError(error) {
error.postcssNode = this;
if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
let s = this.source;
error.stack = error.stack.replace(
/\n\s{4}at /,
`$&${s.input.from}:${s.start.line}:${s.start.column}$&`
);
}
return error;
}
after(add) {
this.parent.insertAfter(this, add);
return this;
}
assign(overrides = {}) {
for (let name in overrides) {
this[name] = overrides[name];
}
return this;
}
before(add) {
this.parent.insertBefore(this, add);
return this;
}
cleanRaws(keepBetween) {
delete this.raws.before;
delete this.raws.after;
if (!keepBetween)
delete this.raws.between;
}
clone(overrides = {}) {
let cloned = cloneNode(this);
for (let name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
}
cloneAfter(overrides = {}) {
let cloned = this.clone(overrides);
this.parent.insertAfter(this, cloned);
return cloned;
}
cloneBefore(overrides = {}) {
let cloned = this.clone(overrides);
this.parent.insertBefore(this, cloned);
return cloned;
}
error(message, opts = {}) {
if (this.source) {
let { end, start } = this.rangeBy(opts);
return this.source.input.error(
message,
{ column: start.column, line: start.line },
{ column: end.column, line: end.line },
opts
);
}
return new CssSyntaxError3(message);
}
getProxyProcessor() {
return {
get(node, prop) {
if (prop === "proxyOf") {
return node;
} else if (prop === "root") {
return () => node.root().toProxy();
} else {
return node[prop];
}
},
set(node, prop, value2) {
if (node[prop] === value2)
return true;
node[prop] = value2;
if (prop === "prop" || prop === "value" || prop === "name" || prop === "params" || prop === "important" || prop === "text") {
node.markDirty();
}
return true;
}
};
}
markDirty() {
if (this[isClean]) {
this[isClean] = false;
let next = this;
while (next = next.parent) {
next[isClean] = false;
}
}
}
next() {
if (!this.parent)
return void 0;
let index3 = this.parent.index(this);
return this.parent.nodes[index3 + 1];
}
positionBy(opts, stringRepresentation) {
let pos = this.source.start;
if (opts.index) {
pos = this.positionInside(opts.index, stringRepresentation);
} else if (opts.word) {
stringRepresentation = this.toString();
let index3 = stringRepresentation.indexOf(opts.word);
if (index3 !== -1)
pos = this.positionInside(index3, stringRepresentation);
}
return pos;
}
positionInside(index3, stringRepresentation) {
let string = stringRepresentation || this.toString();
let column = this.source.start.column;
let line = this.source.start.line;
for (let i = 0; i < index3; i++) {
if (string[i] === "\n") {
column = 1;
line += 1;
} else {
column += 1;
}
}
return { column, line };
}
prev() {
if (!this.parent)
return void 0;
let index3 = this.parent.index(this);
return this.parent.nodes[index3 - 1];
}
get proxyOf() {
return this;
}
rangeBy(opts) {
let start = {
column: this.source.start.column,
line: this.source.start.line
};
let end = this.source.end ? {
column: this.source.end.column + 1,
line: this.source.end.line
} : {
column: start.column + 1,
line: start.line
};
if (opts.word) {
let stringRepresentation = this.toString();
let index3 = stringRepresentation.indexOf(opts.word);
if (index3 !== -1) {
start = this.positionInside(index3, stringRepresentation);
end = this.positionInside(index3 + opts.word.length, stringRepresentation);
}
} else {
if (opts.start) {
start = {
column: opts.start.column,
line: opts.start.line
};
} else if (opts.index) {
start = this.positionInside(opts.index);
}
if (opts.end) {
end = {
column: opts.end.column,
line: opts.end.line
};
} else if (opts.endIndex) {
end = this.positionInside(opts.endIndex);
} else if (opts.index) {
end = this.positionInside(opts.index + 1);
}
}
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
end = { column: start.column + 1, line: start.line };
}
return { end, start };
}
raw(prop, defaultType) {
let str = new Stringifier();
return str.raw(this, prop, defaultType);
}
remove() {
if (this.parent) {
this.parent.removeChild(this);
}
this.parent = void 0;
return this;
}
replaceWith(...nodes) {
if (this.parent) {
let bookmark = this;
let foundSelf = false;
for (let node of nodes) {
if (node === this) {
foundSelf = true;
} else if (foundSelf) {
this.parent.insertAfter(bookmark, node);
bookmark = node;
} else {
this.parent.insertBefore(bookmark, node);
}
}
if (!foundSelf) {
this.remove();
}
}
return this;
}
root() {
let result = this;
while (result.parent && result.parent.type !== "document") {
result = result.parent;
}
return result;
}
toJSON(_, inputs) {
let fixed = {};
let emitInputs = inputs == null;
inputs = inputs || /* @__PURE__ */ new Map();
let inputsNextIndex = 0;
for (let name in this) {
if (!Object.prototype.hasOwnProperty.call(this, name)) {
continue;
}
if (name === "parent" || name === "proxyCache")
continue;
let value2 = this[name];
if (Array.isArray(value2)) {
fixed[name] = value2.map((i) => {
if (typeof i === "object" && i.toJSON) {
return i.toJSON(null, inputs);
} else {
return i;
}
});
} else if (typeof value2 === "object" && value2.toJSON) {
fixed[name] = value2.toJSON(null, inputs);
} else if (name === "source") {
let inputId = inputs.get(value2.input);
if (inputId == null) {
inputId = inputsNextIndex;
inputs.set(value2.input, inputsNextIndex);
inputsNextIndex++;
}
fixed[name] = {
end: value2.end,
inputId,
start: value2.start
};
} else {
fixed[name] = value2;
}
}
if (emitInputs) {
fixed.inputs = [...inputs.keys()].map((input) => input.toJSON());
}
return fixed;
}
toProxy() {
if (!this.proxyCache) {
this.proxyCache = new Proxy(this, this.getProxyProcessor());
}
return this.proxyCache;
}
toString(stringifier = stringify3) {
if (stringifier.stringify)
stringifier = stringifier.stringify;
let result = "";
stringifier(this, (i) => {
result += i;
});
return result;
}
warn(result, text, opts) {
let data = { node: this };
for (let i in opts)
data[i] = opts[i];
return result.warn(text, data);
}
};
module2.exports = Node3;
Node3.default = Node3;
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/declaration.js
var require_declaration = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/declaration.js"(exports, module2) {
"use strict";
var Node3 = require_node();
var Declaration3 = class extends Node3 {
constructor(defaults3) {
if (defaults3 && typeof defaults3.value !== "undefined" && typeof defaults3.value !== "string") {
defaults3 = { ...defaults3, value: String(defaults3.value) };
}
super(defaults3);
this.type = "decl";
}
get variable() {
return this.prop.startsWith("--") || this.prop[0] === "$";
}
};
module2.exports = Declaration3;
Declaration3.default = Declaration3;
}
});
// (disabled):node_modules/source-map-js/source-map.js
var require_source_map = __commonJS({
"(disabled):node_modules/source-map-js/source-map.js"() {
}
});
// src/stubs/path.ts
var path_exports = {};
__export(path_exports, {
join: () => join
});
var join;
var init_path = __esm({
"src/stubs/path.ts"() {
join = () => "";
}
});
// src/stubs/url.ts
var url_exports = {};
__export(url_exports, {
default: () => url_default
});
var url_default;
var init_url = __esm({
"src/stubs/url.ts"() {
url_default = null;
}
});
// node_modules/tailwindcss/node_modules/nanoid/non-secure/index.cjs
var require_non_secure = __commonJS({
"node_modules/tailwindcss/node_modules/nanoid/non-secure/index.cjs"(exports, module2) {
var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
var customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = "";
let i = size;
while (i--) {
id += alphabet[Math.random() * alphabet.length | 0];
}
return id;
};
};
var nanoid = (size = 21) => {
let id = "";
let i = size;
while (i--) {
id += urlAlphabet[Math.random() * 64 | 0];
}
return id;
};
module2.exports = { nanoid, customAlphabet };
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/previous-map.js
var require_previous_map = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/previous-map.js"(exports, module2) {
"use strict";
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
var { existsSync, readFileSync } = (init_fs(), __toCommonJS(fs_exports));
var { dirname, join: join2 } = (init_path(), __toCommonJS(path_exports));
function fromBase64(str) {
if (Buffer) {
return Buffer.from(str, "base64").toString();
} else {
return window.atob(str);
}
}
var PreviousMap = class {
constructor(css, opts) {
if (opts.map === false)
return;
this.loadAnnotation(css);
this.inline = this.startWith(this.annotation, "data:");
let prev = opts.map ? opts.map.prev : void 0;
let text = this.loadMap(opts.from, prev);
if (!this.mapFile && opts.from) {
this.mapFile = opts.from;
}
if (this.mapFile)
this.root = dirname(this.mapFile);
if (text)
this.text = text;
}
consumer() {
if (!this.consumerCache) {
this.consumerCache = new SourceMapConsumer(this.text);
}
return this.consumerCache;
}
decodeInline(text) {
let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
let baseUri = /^data:application\/json;base64,/;
let charsetUri = /^data:application\/json;charset=utf-?8,/;
let uri = /^data:application\/json,/;
if (charsetUri.test(text) || uri.test(text)) {
return decodeURIComponent(text.substr(RegExp.lastMatch.length));
}
if (baseCharsetUri.test(text) || baseUri.test(text)) {
return fromBase64(text.substr(RegExp.lastMatch.length));
}
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
throw new Error("Unsupported source map encoding " + encoding);
}
getAnnotationURL(sourceMapString) {
return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, "").trim();
}
isMap(map) {
if (typeof map !== "object")
return false;
return typeof map.mappings === "string" || typeof map._mappings === "string" || Array.isArray(map.sections);
}
loadAnnotation(css) {
let comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
if (!comments)
return;
let start = css.lastIndexOf(comments.pop());
let end = css.indexOf("*/", start);
if (start > -1 && end > -1) {
this.annotation = this.getAnnotationURL(css.substring(start, end));
}
}
loadFile(path) {
this.root = dirname(path);
if (existsSync(path)) {
this.mapFile = path;
return readFileSync(path, "utf-8").toString().trim();
}
}
loadMap(file, prev) {
if (prev === false)
return false;
if (prev) {
if (typeof prev === "string") {
return prev;
} else if (typeof prev === "function") {
let prevPath = prev(file);
if (prevPath) {
let map = this.loadFile(prevPath);
if (!map) {
throw new Error(
"Unable to load previous source map: " + prevPath.toString()
);
}
return map;
}
} else if (prev instanceof SourceMapConsumer) {
return SourceMapGenerator.fromSourceMap(prev).toString();
} else if (prev instanceof SourceMapGenerator) {
return prev.toString();
} else if (this.isMap(prev)) {
return JSON.stringify(prev);
} else {
throw new Error(
"Unsupported previous source map format: " + prev.toString()
);
}
} else if (this.inline) {
return this.decodeInline(this.annotation);
} else if (this.annotation) {
let map = this.annotation;
if (file)
map = join2(dirname(file), map);
return this.loadFile(map);
}
}
startWith(string, start) {
if (!string)
return false;
return string.substr(0, start.length) === start;
}
withContent() {
return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
}
};
module2.exports = PreviousMap;
PreviousMap.default = PreviousMap;
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/input.js
var require_input = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/input.js"(exports, module2) {
"use strict";
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
var { fileURLToPath, pathToFileURL } = (init_url(), __toCommonJS(url_exports));
var { isAbsolute, resolve } = (init_path(), __toCommonJS(path_exports));
var { nanoid } = require_non_secure();
var terminalHighlight = require_terminal_highlight();
var CssSyntaxError3 = require_css_syntax_error();
var PreviousMap = require_previous_map();
var fromOffsetCache = Symbol("fromOffsetCache");
var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
var pathAvailable = Boolean(resolve && isAbsolute);
var Input3 = class {
constructor(css, opts = {}) {
if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
throw new Error(`PostCSS received ${css} instead of CSS string`);
}
this.css = css.toString();
if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
this.hasBOM = true;
this.css = this.css.slice(1);
} else {
this.hasBOM = false;
}
if (opts.from) {
if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
this.file = opts.from;
} else {
this.file = resolve(opts.from);
}
}
if (pathAvailable && sourceMapAvailable) {
let map = new PreviousMap(this.css, opts);
if (map.text) {
this.map = map;
let file = map.consumer().file;
if (!this.file && file)
this.file = this.mapResolve(file);
}
}
if (!this.file) {
this.id = "<input css " + nanoid(6) + ">";
}
if (this.map)
this.map.file = this.from;
}
error(message, line, column, opts = {}) {
let result, endLine, endColumn;
if (line && typeof line === "object") {
let start = line;
let end = column;
if (typeof start.offset === "number") {
let pos = this.fromOffset(start.offset);
line = pos.line;
column = pos.col;
} else {
line = start.line;
column = start.column;
}
if (typeof end.offset === "number") {
let pos = this.fromOffset(end.offset);
endLine = pos.line;
endColumn = pos.col;
} else {
endLine = end.line;
endColumn = end.column;
}
} else if (!column) {
let pos = this.fromOffset(line);
line = pos.line;
column = pos.col;
}
let origin = this.origin(line, column, endLine, endColumn);
if (origin) {
result = new CssSyntaxError3(
message,
origin.endLine === void 0 ? origin.line : { column: origin.column, line: origin.line },
origin.endLine === void 0 ? origin.column : { column: origin.endColumn, line: origin.endLine },
origin.source,
origin.file,
opts.plugin
);
} else {
result = new CssSyntaxError3(
message,
endLine === void 0 ? line : { column, line },
endLine === void 0 ? column : { column: endColumn, line: endLine },
this.css,
this.file,
opts.plugin
);
}
result.input = { column, endColumn, endLine, line, source: this.css };
if (this.file) {
if (pathToFileURL) {
result.input.url = pathToFileURL(this.file).toString();
}
result.input.file = this.file;
}
return result;
}
get from() {
return this.file || this.id;
}
fromOffset(offset) {
let lastLine, lineToIndex;
if (!this[fromOffsetCache]) {
let lines = this.css.split("\n");
lineToIndex = new Array(lines.length);
let prevIndex = 0;
for (let i = 0, l = lines.length; i < l; i++) {
lineToIndex[i] = prevIndex;
prevIndex += lines[i].length + 1;
}
this[fromOffsetCache] = lineToIndex;
} else {
lineToIndex = this[fromOffsetCache];
}
lastLine = lineToIndex[lineToIndex.length - 1];
let min = 0;
if (offset >= lastLine) {
min = lineToIndex.length - 1;
} else {
let max2 = lineToIndex.length - 2;
let mid;
while (min < max2) {
mid = min + (max2 - min >> 1);
if (offset < lineToIndex[mid]) {
max2 = mid - 1;
} else if (offset >= lineToIndex[mid + 1]) {
min = mid + 1;
} else {
min = mid;
break;
}
}
}
return {
col: offset - lineToIndex[min] + 1,
line: min + 1
};
}
mapResolve(file) {
if (/^\w+:\/\//.test(file)) {
return file;
}
return resolve(this.map.consumer().sourceRoot || this.map.root || ".", file);
}
origin(line, column, endLine, endColumn) {
if (!this.map)
return false;
let consumer = this.map.consumer();
let from = consumer.originalPositionFor({ column, line });
if (!from.source)
return false;
let to;
if (typeof endLine === "number") {
to = consumer.originalPositionFor({ column: endColumn, line: endLine });
}
let fromUrl;
if (isAbsolute(from.source)) {
fromUrl = pathToFileURL(from.source);
} else {
fromUrl = new URL(
from.source,
this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile)
);
}
let result = {
column: from.column,
endColumn: to && to.column,
endLine: to && to.line,
line: from.line,
url: fromUrl.toString()
};
if (fromUrl.protocol === "file:") {
if (fileURLToPath) {
result.file = fileURLToPath(fromUrl);
} else {
throw new Error(`file: protocol is not available in this PostCSS build`);
}
}
let source = consumer.sourceContentFor(from.source);
if (source)
result.source = source;
return result;
}
toJSON() {
let json = {};
for (let name of ["hasBOM", "css", "file", "id"]) {
if (this[name] != null) {
json[name] = this[name];
}
}
if (this.map) {
json.map = { ...this.map };
if (json.map.consumerCache) {
json.map.consumerCache = void 0;
}
}
return json;
}
};
module2.exports = Input3;
Input3.default = Input3;
if (terminalHighlight && terminalHighlight.registerInput) {
terminalHighlight.registerInput(Input3);
}
}
});
// node_modules/tailwindcss/node_modules/postcss/lib/map-generator.js
var require_map_generator = __commonJS({
"node_modules/tailwindcss/node_modules/postcss/lib/map-generator.js"(exports, module2) {
"use strict";
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
var { dirname, relative, resolve, sep } = (init_path(), __toCommonJS(path_exports));
var { pathToFileURL } = (init_url(), __toCommonJS(url_