Files
locobook/node_modules/@tailwindcss/node/dist/index.js
T

19 lines
53 KiB
JavaScript
Raw Normal View History

"use strict";var It=Object.create;var oe=Object.defineProperty;var Ut=Object.getOwnPropertyDescriptor;var zt=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var Me=(e,r)=>{for(var t in r)oe(e,t,{get:r[t],enumerable:!0})},Fe=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of zt(r))!Kt.call(e,o)&&o!==t&&oe(e,o,{get:()=>r[o],enumerable:!(n=Ut(r,o))||n.enumerable});return e};var T=(e,r,t)=>(t=e!=null?It(Lt(e)):{},Fe(r||!e||!e.__esModule?oe(t,"default",{value:e,enumerable:!0}):t,e)),Mt=e=>Fe(oe({},"__esModule",{value:!0}),e);var pn={};Me(pn,{Features:()=>_.Features,Instrumentation:()=>Ke,Polyfills:()=>_.Polyfills,__unstable__loadDesignSystem:()=>tn,compile:()=>en,compileAst:()=>Xr,env:()=>le,loadModule:()=>ze,normalizePath:()=>ge,optimize:()=>sn,toSourceMap:()=>fn});module.exports=Mt(pn);var _t=T(require("module")),Dt=require("url");var le={};Me(le,{DEBUG:()=>ke});var ke=Ft(process.env.DEBUG);function Ft(e){if(typeof e=="boolean")return e;if(e===void 0)return!1;if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1;if(e==="*")return!0;let r=e.split(",").map(t=>t.split(":")[0]);return r.includes("-tailwindcss")?!1:!!r.includes("tailwindcss")}var W=T(require("enhanced-resolve")),$t=require("jiti"),he=T(require("fs")),Ue=T(require("fs/promises")),H=T(require("path")),De=require("url"),_=require("tailwindcss");var ae=T(require("fs/promises")),Y=T(require("path")),jt=[/import[\s\S]*?['"](.{3,}?)['"]/gi,/import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi,/require\(['"`](.+)['"`]\)/gi],Wt=[".js",".cjs",".mjs"],Bt=["",".js",".cjs",".mjs",".ts",".cts",".mts",".jsx",".tsx"],Yt=["",".ts",".cts",".mts",".tsx",".js",".cjs",".mjs",".jsx"];async function Gt(e,r){for(let t of r){let n=`${e}${t}`;if((await ae.default.stat(n).catch(()=>null))?.isFile())return n}for(let t of r){let n=`${e}/index${t}`;if(await ae.default.access(n).then(()=>!0,()=>!1))return n}return null}async function je(e,r,t,n){let o=Wt.includes(n)?Bt:Yt,l=await Gt(Y.default.resolve(t,r),o);if(l===null||e.has(l))return;e.add(l),t=Y.default.dirname(l),n=Y.default.extname(l);let i=await ae.default.readFile(l,"utf-8"),s=[];for(let a of jt)for(let u of i.matchAll(a))u[1].startsWith(".")&&s.push(je(e,u[1],t,n));await Promise.all(s)}async function We(e){let r=new Set;return await je(r,e,Y.default.dirname(e),Y.default.extname(e)),Array.from(r)}var Pe=T(require("path"));function G(e){return{kind:"word",value:e}}function Ht(e,r){return{kind:"function",value:e,nodes:r}}function qt(e){return{kind:"separator",value:e}}function C(e){let r="";for(let t of e)switch(t.kind){case"word":case"separator":{r+=t.value;break}case"function":r+=t.value+"("+C(t.nodes)+")"}return r}var Be=92,Zt=41,Ye=58,Ge=44,Qt=34,He=61,qe=62,Ze=60,Qe=10,Jt=40,Xt=39,er=47,Je=32,Xe=9;function A(e){e=e.replaceAll(`\r
`,`
`);let r=[],t=[],n=null,o="",l;for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);switch(s){case Be:{o+=e[i]+e[i+1],i++;break}case er:{if(o.length>0){let u=G(o);n?n.nodes.push(u):r.push(u),o=""}let a=G(e[i]);n?n.nodes.push(a):r.push(a);break}case Ye:case Ge:case He:case qe:case Ze:case Qe:case Je:case Xe:{if(o.length>0){let c=G(o);n?n.nodes.push(c):r.push(c),o=""}let a=i,u=i+1;for(;u<e.length&&(l=e.charCodeAt(u),!(l!==Ye&&l!==Ge&&l!==He&&l!==qe&&l!==Ze&&l!==Qe&&l!==Je&&l!==Xe));u++);i=u-1;let p=qt(e.slice(a,u));n?n.nodes.push(p):r.push(p);break}case Xt:case Qt:{let a=i;for(let u=i+1;u<e.length;u++)if(l=e.charCodeAt(u),l===Be)u+=1;else if(l===s){i=u;break}o+=e.slice(a,i+1);break}case Jt:{let a=Ht(o,[]);o="",n?n.nodes.push(a):r.push(a),t.push(a),n=a;break}case Zt:{let a=t.pop();if(o.length>0){let u=G(o);a?.nodes.push(u),o=""}t.length>0?n=t[t.length-1]:n=null;break}default:o+=String.fromCharCode(s)}}return o.length>0&&r.push(G(o)),r}var g=class extends Map{constructor(t){super();this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t,this),this.set(t,n)),n}};var yn=new Uint8Array(256);var se=new Uint8Array(256);function w(e,r){let t=0,n=[],o=0,l=e.length,i=r.charCodeAt(0);for(let s=0;s<l;s++){let a=e.charCodeAt(s);if(t===0&&a===i){n.push(e.slice(o,s)),o=s+1;continue}switch(a){case 92:s+=1;break;case 39:case 34:for(;++s<l;){let u=e.charCodeAt(s);if(u===92){s+=1;continue}if(u===a)break}break;case 40:se[t]=41,t++;break;case 91:se[t]=93,t++;break;case 123:se[t]=125,t++;break;case 93:case 125:case 41:t>0&&a===se[t-1]&&t--;break}}return n.push(e.slice(o)),n}var we=(i=>(i[i.Continue=0]="Continue",i[i.Skip=1]="Skip",i[i.Stop=2]="Stop",i[i.Replace=3]="Replace",i[i.ReplaceSkip=4]="ReplaceSkip",i[i.ReplaceStop=5]="ReplaceStop",i))(we||{}),k={Continue:{kind:0},Skip:{kind:1},Stop:{kind:2},Replace:e=>({kind:3,nodes:Array.isArray(e)?e:[e]}),ReplaceSkip:e=>({kind:4,nodes:Array.isArray(e)?e:[e]}),ReplaceStop:e=>({kind:5,nodes:Array.isArray(e)?e:[e]})};function h(e,r){typeof r=="function"?et(e,r):et(e,r.enter,r.exit)}function et(e,r=()=>k.Continue,t=()=>k.Continue){let n={value:[e,0,null],prev:null},o={parent:null,depth:0,path(){let l=[],i=n;for(;i;){let s=i.value[2];s&&l.push(s),i=i.prev}return l.reverse(),l}};for(;n!==null;){let l=n.value,i=l[0],s=l[1],a=l[2];if(s>=i.length){n=n.prev,o.depth-=1;continue}if(o.parent=a,s>=0){let f=i[s],d=r(f,o)??k.Continue;switch(d.kind){case 0:{f.nodes&&f.nodes.length>0&&(o.depth+=1,n={value:[f.nodes,0,f],prev:n}),l[1]=~s;continue}case 2:return;case 1:{l[1]=~s;continue}case 3:{i.splice(s,1,...d.nodes);continue}case 5:{i.splice(s,1,...d.nodes);return}case 4:{i.splice(s,1,...d.nodes),l[1]+=d.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${we[d.kind]??`Unknown(${d.kind})`}\` in enter.`)}}let u=~s,p=i[u],c=t(p,o)??k.Continue;switch(c.kind){case 0:l[1]=u+1;continue;case 2:return;case 3:{i.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}case 5:{i.splice(u,1,...c.nodes);return}case 4:{i.splice(u,1,...c.nodes),l[1]=u+c.nodes.length;continue}default:throw new Error(`Invalid \`WalkAction.${we[c.kind]??`Unknown(${c.kind})`}\` in exit.`)}}}var Rn=new g(e=>{let r=A(e),t=new Set;return h(r,(n,o)=>{let l=o.parent===null?r:o.parent.nodes??[];if(n.kind==="word"&&(n.value==="+"||n.value==="-"||n.value==="*"||n.value==="/")){let i=l.indexOf(n)??-1;if(i===-1)return;let s=l[i-1];if(s?.kind!=="separator"||s.value!==" ")return;let a=l[i+1];if(a?.kind!=="separator"||a.value!==" ")return;t.add(s),t.add(a)}else n.kind==="separator"&&n.value.length>0&&n.value.trim()===""?(l[0]===n||l[l.length-1]===n)&&t.add(n):n.kind==="separator"&&n.value.trim()===","&&(n.value=",")}),t.size>0&&h(r,n=>{if(t.has(n))return t.delete(n),k.ReplaceSkip([])}),ye(r),C(r)});var On=new g(e=>{let r=A(e);return r.length===3&&r[0].kind==="word"&&r[0].value==="&"&&r[1].kind==="separator"&&r[1].value===":"&&r[2].kind==="function"&&r[2].value==="is"?C(r[2].nodes):e});function ye(e){for(let r of e)switch(r.kind){case"function":{if(r.value==="url"||r.value.endsWith("_url")){r.value=q(r.value);break}if(r.value==="var"|
`,r){t+=u.length;let p=t;t+=i.property.length,t+=2,t+=i.value?.length??0,i.important&&(t+=11);let c=t;t+=2,i.dst=[n,p,c]}}else if(i.kind==="rule"){if(a+=`${u}${i.selector} {
`,r){t+=u.length;let p=t;t+=i.selector.length,t+=1;let c=t;i.dst=[n,p,c],t+=2}for(let p of i.nodes)a+=o(p,s+1);a+=`${u}}
`,r&&(t+=u.length,t+=2)}else if(i.kind==="at-rule"){if(i.nodes.length===0){let p=`${u}${i.name} ${i.params};
`;if(r){t+=u.length;let c=t;t+=i.name.length,t+=1,t+=i.params.length;let f=t;t+=2,i.dst=[n,c,f]}return p}if(a+=`${u}${i.name}${i.params?` ${i.params} `:" "}{
`,r){t+=u.length;let p=t;t+=i.name.length,i.params&&(t+=1,t+=i.params.length),t+=1;let c=t;i.dst=[n,p,c],t+=2}for(let p of i.nodes)a+=o(p,s+1);a+=`${u}}
`,r&&(t+=u.length,t+=2)}else if(i.kind==="comment"){if(a+=`${u}/*${i.value}*/
`,r){t+=u.length;let p=t;t+=2+i.value.length+2;let c=t;i.dst=[n,p,c],t+=1}}else if(i.kind==="context"||i.kind==="at-root")return"";return a}let l="";for(let i of e)l+=o(i,0);return n.code=l,l}function zr(e,r){if(typeof e!="string")throw new TypeError("expected path to be a string");if(e==="\\"||e==="/")return"/";var t=e.length;if(t<=1)return e;var n="";if(t>4&&e[3]==="\\"){var o=e[2];(o==="?"||o===".")&&e.slice(0,2)==="\\\\"&&(e=e.slice(2),n="//")}var l=e.split(/[/\\]+/);return r!==!1&&l[l.length-1]===""&&l.pop(),n+l.join("/")}function ge(e){let r=zr(e);return e.startsWith("\\\\")&&r.startsWith("/")&&!r.startsWith("//")?`/${r}`:r}var _e=/(?<!@import\s+)(?<=^|[^\w\-\u0080-\uffff])url\((\s*('[^']+'|"[^"]+")\s*|[^'")]+)\)/,kt=/(?<=image-set\()((?:[\w-]{1,256}\([^)]*\)|[^)])*)(?=\))/,Lr=/(?:gradient|element|cross-fade|image)\(/,Kr=/^\s*data:/i,Mr=/^([a-z]+:)?\/\//,Fr=/^[A-Z_][.\w-]*\(/i,jr=/(?:^|\s)(?<url>[\w-]+\([^)]*\)|"[^"]*"|'[^']*'|[^,]\S*[^,])\s*(?:\s(?<descriptor>\w[^,]+))?(?:,|$)/g,Wr=/(?<!\\)"/g,Br=/(?: |\\t|\\n|\\f|\\r)+/g,Yr=e=>Kr.test(e),Gr=e=>Mr.test(e);async function wt({css:e,base:r,root:t}){if(!e.includes("url(")&&!e.includes("image-set("))return e;let n=ne(e),o=[];function l(i){if(i[0]==="/")return i;let s=Pe.posix.join(ge(r),i),a=Pe.posix.relative(ge(t),s);return a.startsWith(".")||(a="./"+a),a}return h(n,i=>{if(i.kind!=="declaration"||!i.value)return;let s=_e.test(i.value),a=kt.test(i.value);if(s||a){let u=a?Hr:yt;o.push(u(i.value,l).then(p=>{i.value=p}))}}),o.length&&await Promise.all(o),F(n)}function yt(e,r){return xt(e,_e,async t=>{let[n,o]=t;return await bt(o.trim(),n,r)})}async function Hr(e,r){return await xt(e,kt,async t=>{let[,n]=t;return await Zr(n,async({url:l})=>_e.test(l)?await yt(l,r):Lr.test(l)?l:await bt(l,l,r))})}async function bt(e,r,t,n="url"){let o="",l=e[0];if((l==='"'||l==="'")&&(o=l,e=e.slice(1,-1)),qr(e))return r;let i=await t(e);return o===""&&i!==encodeURI(i)&&(o='"'),o==="'"&&i.includes("'")&&(o='"'),o==='"'&&i.includes('"')&&(i=i.replace(Wr,'\\"')),`${n}(${o}${i}${o})`}function qr(e,r){return Gr(e)||Yr(e)||!e[0].match(/[.a-zA-Z0-9_]/)||Fr.test(e)}function Zr(e,r){return Promise.all(Qr(e).map(async({url:t,descriptor:n})=>({url:await r({url:t,descriptor:n}),descriptor:n}))).then(Jr)}function Qr(e){let r=e.trim().replace(Br," ").replace(/\r?\n/,"").replace(/,\s+/,", ").replaceAll(/\s+/g," ").matchAll(jr);return Array.from(r,({groups:t})=>({url:t?.url?.trim()??"",descriptor:t?.descriptor?.trim()??""})).filter(({url:t})=>!!t)}function Jr(e){return e.map(({url:r,descriptor:t})=>r+(t?` ${t}`:"")).join(", ")}async function xt(e,r,t){let n,o=e,l="";for(;n=r.exec(o);)l+=o.slice(0,n.index),l+=await t(n),o=o.slice(n.index+n[0].length);return l+=o,l}var an={};function Et({base:e,from:r,polyfills:t,onDependency:n,shouldRewriteUrls:o,customCssResolver:l,customJsResolver:i}){return{base:e,polyfills:t,from:r,async loadModule(s,a){return ze(s,a,n,i)},async loadStylesheet(s,a){let u=await Vt(s,a,n,l);return o&&(u.content=await wt({css:u.content,root:e,base:u.base})),u}}}async function Tt(e){if(e.root&&e.root!=="none"){let r=/[*{]/,t=[];for(let o of e.root.pattern.split("/")){if(r.test(o))break;t.push(o)}if(!await Ue.default.stat(H.default.resolve(e.root.base,t.join("/"))).then(o=>o.isDirectory()).catch(()=>!1))throw new Error(`The \`source(${e.root.pattern})\` does not exist or is not a directory.`)}}async function Xr(e,r){let t=await(0,_.compileAst)(e,Et(r));return await Tt(t),t}async function en(e,r){let t=await(0,_.compile)(e,Et(r));return await Tt(t),t}async function tn(e,{base:r}){return(0,_.__unstable__loadDesignSystem)(e,{base:r,async loadModule(t,n){return ze(t,n,()=>{})},async loadStylesheet(t,n){return Vt(t,n,()=>{})}})}async function ze(e,r,t,n){if(e[0]!=="."){let s=await St(e,r,n);if(!s)throw new Error(`Could not resolve '${e}' from '${r}'`);let a=await Ct((0,De.pathToFileURL)(s).href);return{path:s,base:H.default.dirname(s),module:a.default??a}}let o=await St(e,r,n);if(!o)throw new Error(`Could not resolve '${e}' from '${r}'`);let[l,i]=await Promise.all([Ct((0,De.pathToFileURL)(o).hre
`)){this.defaultFlush=r}#r=new g(()=>({value:0}));#t=new g(()=>({value:0n}));#e=[];hit(r){this.#r.get(r).value++}start(r){let t=this.#e.map(o=>o.label).join("//"),n=`${t}${t.length===0?"":"//"}${r}`;this.#r.get(n).value++,this.#t.get(n),this.#e.push({id:n,label:r,namespace:t,value:process.hrtime.bigint()})}end(r){let t=process.hrtime.bigint();if(this.#e[this.#e.length-1].label!==r)throw new Error(`Mismatched timer label: \`${r}\`, expected \`${this.#e[this.#e.length-1].label}\``);let n=this.#e.pop(),o=t-n.value;this.#t.get(n.id).value+=o}reset(){this.#r.clear(),this.#t.clear(),this.#e.splice(0)}report(r=this.defaultFlush){let t=[],n=!1;for(let i=this.#e.length-1;i>=0;i--)this.end(this.#e[i].label);for(let[i,{value:s}]of this.#r.entries()){if(this.#t.has(i))continue;t.length===0&&(n=!0,t.push("Hits:"));let a=i.split("//").length;t.push(`${" ".repeat(a)}${i} ${ve(Nt(`\xD7 ${s}`))}`)}this.#t.size>0&&n&&t.push(`
Timers:`);let o=-1/0,l=new Map;for(let[i,{value:s}]of this.#t){let a=`${(Number(s)/1e6).toFixed(2)}ms`;l.set(i,a),o=Math.max(o,a.length)}for(let i of this.#t.keys()){let s=i.split("//").length;t.push(`${ve(`[${l.get(i).padStart(o," ")}]`)}${" ".repeat(s-1)}${s===1?" ":ve(" \u21B3 ")}${i.split("//").pop()} ${this.#r.get(i).value===1?"":ve(Nt(`\xD7 ${this.#r.get(i).value}`))}`.trimEnd())}r(`
${t.join(`
`)}
`),this.reset()}[Symbol.dispose](){ke&&this.report()}};function ve(e){return`\x1B[2m${e}\x1B[22m`}function Nt(e){return`\x1B[34m${e}\x1B[39m`}var Rt=T(require("@jridgewell/remapping")),z=require("lightningcss"),Ot=T(require("magic-string"));function sn(e,{file:r="input.css",minify:t=!1,map:n}={}){function o(a,u){return(0,z.transform)({filename:r,code:a,minify:t,sourceMap:typeof u<"u",inputSourceMap:u,drafts:{customMedia:!0},nonStandard:{deepSelectorCombinator:!0},include:z.Features.Nesting|z.Features.MediaQueries,exclude:z.Features.LogicalProperties|z.Features.DirSelector|z.Features.LightDark,targets:{safari:16<<16|1024,ios_saf:16<<16|1024,firefox:8388608,chrome:7274496},errorRecovery:!0})}let l=o(Buffer.from(e),n);if(n=l.map?.toString(),l.warnings=l.warnings.filter(a=>!/'(deep|slotted|global)' is not recognized as a valid pseudo-/.test(a.message)),l.warnings.length>0){let a=e.split(`
`),u=[`Found ${l.warnings.length} ${l.warnings.length===1?"warning":"warnings"} while optimizing generated CSS:`];for(let[p,c]of l.warnings.entries()){u.push(""),l.warnings.length>1&&u.push(`Issue #${p+1}:`);let f=2,d=Math.max(0,c.loc.line-f-1),m=Math.min(a.length,c.loc.line+f),x=a.slice(d,m).map((v,L)=>d+L+1===c.loc.line?`${ie("\u2502")} ${v}`:ie(`\u2502 ${v}`));x.splice(c.loc.line-d,0,`${ie("\u2506")}${" ".repeat(c.loc.column-1)} ${un(`${ie("^--")} ${c.message}`)}`,`${ie("\u2506")}`),u.push(...x)}u.push(""),console.warn(u.join(`
`))}l=o(l.code,n),n=l.map?.toString();let i=l.code.toString(),s=new Ot.default(i);if(s.replaceAll("@media not (","@media not all and ("),n!==void 0&&s.hasChanged()){let a=s.generateMap({source:"original",hires:"boundary"}).toString();n=(0,Rt.default)([a,n],()=>null).toString()}return i=s.toString(),{code:i,map:n}}function ie(e){return`\x1B[2m${e}\x1B[22m`}function un(e){return`\x1B[33m${e}\x1B[39m`}var Pt=require("source-map-js");function cn(e){let r=new Pt.SourceMapGenerator,t=1,n=new g(o=>({url:o?.url??`<unknown ${t++}>`,content:o?.content??"<none>"}));for(let o of e.mappings){let l=n.get(o.originalPosition?.source??null);r.addMapping({generated:o.generatedPosition,original:o.originalPosition,source:l.url,name:o.name}),r.setSourceContent(l.url,l.content)}return r.toString()}function fn(e){let r=typeof e=="string"?e:cn(e);function t(n){return`/*# sourceMappingURL=${n} */
`}return{raw:r,get inline(){let n=Buffer.from(r,"utf-8").toString("base64");return t(`data:application/json;base64,${n}`)},comment:t}}process.versions.bun||_t.register?.((0,Dt.pathToFileURL)(require.resolve("@tailwindcss/node/esm-cache-loader")));0&&(module.exports={Features,Instrumentation,Polyfills,__unstable__loadDesignSystem,compile,compileAst,env,loadModule,normalizePath,optimize,toSourceMap});