@twind/core
Version:
The core engine without any presets.
2 lines (1 loc) • 21.3 kB
JavaScript
var twind=function(e){"use strict";let t;function n(e){return[...e.v,(e.i?"!":"")+e.n].join(":")}function r(e,t=","){return e.map(n).join(t)}let i="undefined"!=typeof CSS&&CSS.escape||(e=>e.replace(/[!"'`*+.,;:\\/<=>?@#$%&^|~()[\]{}]/g,"\\$&").replace(/^\d/,"\\3$& "));function l(e){for(var t=9,n=e.length;n--;)t=Math.imul(t^e.charCodeAt(n),1597334677);return"#"+((t^t>>>9)>>>0).toString(36)}function o(e,t="@media "){return t+u(e).map(e=>("string"==typeof e&&(e={min:e}),e.raw||Object.keys(e).map(t=>`(${t}-width:${e[t]})`).join(" and "))).join(",")}function u(e=[]){return Array.isArray(e)?e:null==e?[]:[e]}function s(e){return e}function a(){}let c={d:0,b:134217728,c:268435456,a:671088640,u:805306368,o:939524096};function f(e){var t;return(null==(t=e.match(/[-=:;]/g))?void 0:t.length)||0}function p(e){return Math.min(/(?:^|width[^\d]+)(\d+(?:.\d+)?)(p)?/.test(e)?Math.max(0,29.63*(+RegExp.$1/(RegExp.$2?15:1))**.137-43):0,15)<<22|Math.min(f(e),15)<<18}let d=["rst-c","st-ch","h-chi","y-lin","nk","sited","ecked","pty","ad-on","cus-w","ver","cus","cus-v","tive","sable","tiona","quire"];function h({n:e,i:t,v:r=[]},i,l,s){for(let a of(e&&(e=n({n:e,i:t,v:r})),s=[...u(s)],r)){let c=i.theme("screens",a);for(let f of u(c&&o(c)||i.v(a))){var h;s.push(f),l|=c?67108864|p(f):"dark"==a?1073741824:"@"==f[0]?p(f):(h=f,1<<~(/:([a-z-]+)/.test(h)&&~d.indexOf(RegExp.$1.slice(2,7))||-18))}}return{n:e,p:l,r:s,i:t}}let g=new Map;function y(){return(y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function m(){return y.apply(this,arguments)}function v(e){if(e.d){let t=[],n=b(e.r.reduce((e,n)=>"@"==n[0]?(t.push(n),e):n?b(e,e=>b(n,t=>{let n=/(:merge\(.+?\))(:[a-z-]+|\\[.+])/.exec(t);if(n){let r=e.indexOf(n[1]);return~r?e.slice(0,r)+n[0]+e.slice(r+n[1].length):$(e,t)}return $(t,e)})):e,"&"),t=>$(t,e.n?"."+i(e.n):""));return n&&t.push(n.replace(/:merge\((.+?)\)/g,"$1")),t.reduceRight((e,t)=>t+"{"+e+"}",e.d)}}function b(e,t){return e.replace(/ *((?:\(.+?\)|\[.+?\]|[^,])+) *(,|$)/g,(e,n,r)=>t(n)+r)}function $(e,t){return e.replace(/&/g,t)}let w=new Intl.Collator("en",{numeric:!0});function x(e,t){for(var n=0,r=e.length;n<r;){let i=r+n>>1;0>=A(e[i],t)?n=i+1:r=i}return r}function A(e,t){let n=e.p&c.o;return n==(t.p&c.o)&&(n==c.b||n==c.o)?0:e.p-t.p||e.o-t.o||w.compare(j(e.n),j(t.n))||w.compare(k(e.n),k(t.n))}function j(e){return(e||"").split(/:/).pop().split("/").pop()||"\0"}function k(e){return(e||"").replace(/\W/g,e=>String.fromCharCode(127+e.charCodeAt(0)))+"\0"}function O(e,t){return Math.round(parseInt(e,16)*t)}function S(e,t={}){if("function"==typeof e)return e(t);let{opacityValue:n="1",opacityVariable:r}=t,i=r?`var(${r})`:n;if(e.includes("<alpha-value>"))return e.replace("<alpha-value>",i);if("#"==e[0]&&(4==e.length||7==e.length)){let l=(e.length-1)/3,o=[17,1,.062272][l-1];return`rgba(${[O(e.substr(1,l),o),O(e.substr(1+l,l),o),O(e.substr(1+2*l,l),o),i]})`}return"1"==i?e:"0"==i?"#0000":e.replace(/^(rgb|hsl)(\([^)]+)\)$/,`$1a$2,${i})`)}function M(e,t,n,r,i=[]){return function e(t,{n:n,p:r,r:i=[],i:s},a){let d=[],h="",g=0,y=0;for(let m in t||{}){var b,$;let w=t[m];if("@"==m[0]){if(!w)continue;if("a"==m[1]){d.push(...z(n,r,F(""+w),a,r,i,s,!0));continue}if("l"==m[1]){for(let x of u(w))d.push(...e(x,{n:n,p:(b=c[m[7]],r&~c.o|b),r:"d"==m[7]?[]:i,i:s},a));continue}if("i"==m[1]){d.push(...u(w).map(e=>({p:-1,o:0,r:[],d:m+" "+e})));continue}if("k"==m[1]){d.push({p:c.d,o:0,r:[m],d:e(w,{p:c.d},a).map(v).join("")});continue}if("f"==m[1]){d.push(...u(w).map(t=>({p:c.d,o:0,r:[m],d:e(t,{p:c.d},a).map(v).join("")})));continue}}if("object"!=typeof w||Array.isArray(w))"label"==m&&w?n=w+l(JSON.stringify([r,s,t])):(w||0===w)&&(m=m.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),y+=1,g=Math.max(g,"-"==($=m)[0]?0:f($)+(/^(?:(border-(?!w|c|sty)|[tlbr].{2,4}m?$|c.{7,8}$)|([fl].{5}l|g.{8}$|pl))/.test($)?+!!RegExp.$1||-!!RegExp.$2:0)+1),h+=(h?";":"")+u(w).map(e=>a.s(m,C(""+e,a.theme)+(s?" !important":""))).join(";"));else if("@"==m[0]||m.includes("&")){let j=r;"@"==m[0]&&(m=m.replace(/\bscreen\(([^)]+)\)/g,(e,t)=>{let n=a.theme("screens",t);return n?(j|=67108864,o(n,"")):e}),j|=p(m)),d.push(...e(w,{n:n,p:j,r:[...i,m],i:s},a))}else d.push(...e(w,{p:r,r:[...i,m]},a))}return d.unshift({n:n,p:r,o:Math.max(0,15-y)+1.5*Math.min(g||15,15),r:i,d:h}),d.sort(A)}(e,h(t,n,r,i),n)}function C(e,t){return e.replace(/theme\((["'`])?(.+?)\1(?:\s*,\s*(["'`])?(.+?)\3)?\)/g,(e,n,r,i,l="")=>{let o=t(r,l);return"function"==typeof o&&/color|fill|stroke/i.test(r)?S(o):""+u(o).filter(e=>Object(e)!==e)})}function E(e,t){let n;let r=[];for(let i of e)i.d&&i.n?(null==n?void 0:n.p)==i.p&&""+n.r==""+i.r?(n.c=[n.c,i.c].filter(Boolean).join(" "),n.d=n.d+";"+i.d):r.push(n=m({},i,{n:i.n&&t})):r.push(m({},i,{n:i.n&&t}));return r}function R(e,t,r=c.u,i,l){let o=[];for(let s of e)for(let a of function(e,t,r,i,l){var o;e=m({},e,{i:e.i||l});let s=function(e,t){let n=g.get(e.n);return n?n(e,t):t.r(e.n,"dark"==e.v[0])}(e,t);return s?"string"==typeof s?({r:i,p:r}=h(e,t,r,i),E(R(F(s),t,r,i,e.i),e.n)):Array.isArray(s)?s.map(e=>{var t,n;return m({o:0},e,{r:[...u(i),...u(e.r)],p:(t=r,n=null!=(o=e.p)?o:r,t&~c.o|n)})}):M(s,e,t,r,i):[{c:n(e),p:0,o:0,r:[]}]}(s,t,r,i,l))o.splice(x(o,a),0,a);return o}function z(e,t,n,r,i,l,o,u){return E((u?n.flatMap(e=>R([e],r,i,l,o)):R(n,r,i,l,o)).map(e=>e.p&c.o&&(e.n||t==c.b)?m({},e,{p:e.p&~c.o|t,o:0}):e),e)}function N(e,t,n,r){var i;return i=(e,i)=>{let{n:l,p:o,r:u,i:s}=h(e,i,t);return n&&z(l,t,n,i,o,u,s,r)},g.set(e,i),e}function V(e,t){if("("!=e[e.length-1]){let n=[],r=!1,i=!1,l="";for(let o of e)if(!("("==o||/[~@]$/.test(o))){if("!"==o[0]&&(o=o.slice(1),r=!r),o.endsWith(":")){n["dark:"==o?"unshift":"push"](o.slice(0,-1));continue}"-"==o[0]&&(o=o.slice(1),i=!i),o.endsWith("-")&&(o=o.slice(0,-1)),o&&"&"!=o&&(l+=(l&&"-")+o)}l&&(i&&(l="-"+l),t[0].push({n:l,v:n.filter(P),i:r}))}}function P(e,t,n){return n.indexOf(e)==t}let T=new Map;function F(e){let t=T.get(e);if(!t){let n=[],i=[[]],o=0,u=0,s=null,a=0,f=(t,r=0)=>{o!=a&&(n.push(e.slice(o,a+r)),t&&V(n,i)),o=a+1};for(;a<e.length;a++){let p=e[a];if(u)"\\"!=e[a-1]&&(u+=+("["==p)||-("]"==p));else if("["==p)u+=1;else if(s)"\\"!=e[a-1]&&s.test(e.slice(a))&&(s=null,o=a+RegExp.lastMatch.length);else if("/"==p&&"\\"!=e[a-1]&&("*"==e[a+1]||"/"==e[a+1]))s="*"==e[a+1]?/^\*\//:/^[\r\n]/;else if("("==p)f(),n.push(p);else if(":"==p)":"!=e[a+1]&&f(!1,1);else if(/[\s,)]/.test(p)){f(!0);let d=n.lastIndexOf("(");if(")"==p){let h=n[d-1];if(/[~@]$/.test(h)){let g=i.shift();n.length=d,V([...n,"#"],i);let{v:y}=i[0].pop();for(let m of g)m.v.splice(+("dark"==m.v[0])-+("dark"==y[0]),y.length);V([...n,N(h.length>1?h.slice(0,-1)+l(JSON.stringify([h,g])):h+"("+r(g)+")",c.a,g,/@$/.test(h))],i)}d=n.lastIndexOf("(",d-1)}n.length=d+1}else/[~@]/.test(p)&&"("==e[a+1]&&i.unshift([])}f(!0),T.set(e,t=i[0])}return t}function _(e,t,n){return t.reduce((t,r,i)=>t+n(r)+e[i+1],e[0])}function I(e,t){return Array.isArray(e)&&Array.isArray(e.raw)?_(e,t,e=>L(e).trim()):t.filter(Boolean).reduce((e,t)=>e+L(t),e?L(e):"")}function L(e){let t,n="";if(e&&"object"==typeof e){if(Array.isArray(e))(t=I(e[0],e.slice(1)))&&(n+=" "+t);else for(let r in e)e[r]&&(n+=" "+r)}else null!=e&&"boolean"!=typeof e&&(n+=" "+e);return n}let q=J("@"),D=J("~");function J(e){return new Proxy(function(e,...n){return t("",e,n)},{get:(e,n)=>n in e?e[n]:function(e,...r){return t(n,e,r)}});function t(t,n,i){return r(F(t+e+"("+I(n,i)+")"))}}function B(e,t){return Array.isArray(e)?W(_(e,t,e=>null!=e&&"boolean"!=typeof e?e:"")):"string"==typeof e?W(e):[e]}let U=/ *(?:(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}))/g;function W(e){let t;e=e.replace(/\/\*[^]*?\*\/|\s\s+|\n/gm," ");let n=[{}],r=[n[0]],i=[];for(;t=U.exec(e);)t[4]&&(n.shift(),i.shift()),t[3]?(i.unshift(t[3]),n.unshift({}),r.push(i.reduce((e,t)=>({[t]:e}),n[0]))):t[4]||(n[0][t[1]]&&(n.unshift({}),r.push(i.reduce((e,t)=>({[t]:e}),n[0]))),n[0][t[1]]=t[2]);return r}function G(e,...t){var n,r;let i=B(e,t),o=((null==(n=i.find(e=>e.label))?void 0:n.label)||"css")+l(JSON.stringify(i));return r=(e,t)=>E(i.flatMap(n=>M(n,e,t,c.o)),o),g.set(o,r),o}let Y=new Proxy(function(e,t){return Z("animation",e,t)},{get:(e,t)=>t in e?e[t]:function(e,n){return Z(t,e,n)}});function Z(e,t,n){return{toString:()=>G({label:e,"@layer components":m({},"object"==typeof t?t:{animation:t},{animationName:""+n})})}}function H(e,t){return"function"==typeof e?e:"string"==typeof e&&/^[\w-]+$/.test(e)?(n,r)=>({[e]:t?t(n,r):K(n,1)}):t=>e||{[t[1]]:K(t,2)}}function K(e,t,n=e.slice(t).find(Boolean)||e.$$||e.input){return"-"==e.input[0]?`calc(${n} * -1)`:n}function Q(e,t,n){let r="string"==typeof t?(e,r)=>({[t]:n?n(e,r):e._}):t||(({1:e,_:t},n,r)=>({[e||r]:t}));return(t,n)=>{var i;let l=er(e||t[1]),o=null!=(i=n.theme(l,t.$$))?i:en(t.$$,l,n);if(null!=o)return t._=K(t,0,o),r(t,n,l)}}function X(e={},t){return(n,r)=>{let{section:i=er(n[0]).replace("-","")+"Color"}=e,[l,o]=ee(n.$$);if(!l)return;let u=r.theme(i,l)||en(l,i,r);if(!u||"object"==typeof u)return;let{opacityVariable:s=`--tw-${n[0].replace(/-$/,"")}-opacity`,opacitySection:a=i.replace("Color","Opacity"),property:c=i,selector:f}=e,p=r.theme(a,o||"DEFAULT")||o&&en(o,a,r),d=t||(({_:e})=>{let t=et(c,e);return f?{[f]:t}:t});n._={value:S(u,{opacityVariable:s||void 0,opacityValue:p||void 0}),color:e=>S(u,e),opacityVariable:s||void 0,opacityValue:p||void 0};let h=d(n,r);if(!n.dark){let g=r.d(i,l,u);g&&g!==u&&(n._={value:S(g,{opacityVariable:s||void 0,opacityValue:p||"1"}),color:e=>S(g,e),opacityVariable:s||void 0,opacityValue:p||void 0},h={"&":h,[r.v("dark")]:d(n,r)})}return h}}function ee(e){return(e.match(/^(\[[^\]]+]|[^/]+?)(?:\/(.+))?$/)||[]).slice(1)}function et(e,t){let n={};return"string"==typeof t?n[e]=t:(t.opacityVariable&&t.value.includes(t.opacityVariable)&&(n[t.opacityVariable]=t.opacityValue||"1"),n[e]=t.value),n}function en(e,t,n){if("["==e[0]&&"]"==e.slice(-1)){if(e=ei(C(e.slice(1,-1),n.theme)),!t)return e;if(!(/color|fill|stroke/i.test(t)&&!(/^color:/.test(e)||/^(#|((hsl|rgb)a?|hwb|lab|lch|color)\(|[a-z]+$)/.test(e))||/image/i.test(t)&&!(/^image:/.test(e)||/^[a-z-]+\(/.test(e))||/weight/i.test(t)&&!(/^(number|any):/.test(e)||/^\d+$/.test(e))||/position/i.test(t)&&/^(length|size):/.test(e)))return e.replace(/^[a-z-]+:/,"")}}function er(e){return e.replace(/-./g,e=>e[1].toUpperCase())}function ei(e){return e.includes("url(")?e.replace(/(.*?)(url\(.*?\))(.*?)/g,(e,t="",n,r="")=>ei(t)+n+ei(r)):e.replace(/(^|[^\\])_+/g,(e,t)=>t+" ".repeat(e.length-t.length)).replace(/\\_/g,"_").replace(/(calc|min|max|clamp)\(.+\)/g,e=>e.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,"$1 $2 "))}let el=Symbol();function eo(e,t){if(null==e)return{};var n,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}function eu(e){var{presets:t=[]}=e,n=eo(e,["presets"]);let r={darkMode:void 0,darkColor:void 0,preflight:!1!==n.preflight&&[],theme:{},variants:u(n.variants),rules:u(n.rules),ignorelist:u(n.ignorelist),hash:void 0,stringify:(e,t)=>e+":"+t,finalize:[]};for(let i of u([...t,{darkMode:n.darkMode,darkColor:n.darkColor,preflight:!1!==n.preflight&&u(n.preflight),theme:n.theme,hash:n.hash,stringify:n.stringify,finalize:n.finalize}])){let{preflight:l,darkMode:o=r.darkMode,darkColor:s=r.darkColor,theme:a,variants:c,rules:f,ignorelist:p,hash:d=r.hash,stringify:h=r.stringify,finalize:g}="function"==typeof i?i(r):i;r={preflight:!1!==r.preflight&&!1!==l&&[...r.preflight,...u(l)],darkMode:o,darkColor:s,theme:m({},r.theme,a,{extend:m({},r.theme.extend,null==a?void 0:a.extend)}),variants:[...r.variants,...u(c)],rules:[...r.rules,...u(f)],ignorelist:[...r.ignorelist,...u(p)],hash:d,stringify:h,finalize:[...r.finalize,...u(g)]}}return r}function es(e,t,n,r,i,l){for(let o of t){let u=n.get(o);u||n.set(o,u=r(o));let s=u(e,i,l);if(s)return s}}function ea(e){var t;return ef(e[0],"function"==typeof(t=e[1])?t:()=>t)}function ec(e){var t,n;return Array.isArray(e)?ef(e[0],H(e[1],e[2])):ef(e,H(t,n))}function ef(e,t){return ep(e,(e,n,r,i)=>{let l=n.exec(e);if(l)return l.$$=e.slice(l[0].length),l.dark=i,t(l,r)})}function ep(e,t){let n=u(e).map(ed);return(e,r,i)=>{for(let l of n){let o=t(e,l,r,i);if(o)return o}}}function ed(e){return"string"==typeof e?RegExp("^"+e+(e.includes("$")||"-"==e.slice(-1)?"":"$")):e}function eh(e,t){let n=eu(e),r=function({theme:e,darkMode:t,darkColor:n=a,variants:r,rules:o,hash:c,stringify:f,ignorelist:p,finalize:d}){let h=new Map,g=new Map,y=new Map,v=new Map,b=ep(p,(e,t)=>t.test(e));r.push(["dark",Array.isArray(t)||"class"==t?`${u(t)[1]||".dark"} &`:"string"==typeof t&&"media"!=t?t:"@media (prefers-color-scheme:dark)"]);let $="function"==typeof c?e=>c(e,l):c?l:s;$!==s&&d.push(e=>{var t;return m({},e,{n:e.n&&$(e.n),d:null==(t=e.d)?void 0:t.replace(/--(tw(?:-[\w-]+)?)\b/g,(e,t)=>"--"+$(t).replace("#",""))})});let w={theme:function(e){var{extend:t={}}=e,n=eo(e,["extend"]);let r={},i={get colors(){return l("colors")},theme:l,negative:()=>({}),breakpoints(e){let t={};for(let n in e)"string"==typeof e[n]&&(t["screen-"+n]=e[n]);return t}};return l;function l(e,i,u,s){if(e){var a,c;if({1:e,2:s}=/^(\S+?)(?:\s*\/\s*([^/]+))?$/.exec(e)||[,e],/[.[]/.test(e)){let f=[];e.replace(/\[([^\]]+)\]|([^.[]+)/g,(e,t,n=t)=>f.push(n)),e=f.shift(),u=i,i=f.join("-")}let p=r[e]||Object.assign(Object.assign(r[e]={},o(n,e)),o(t,e));if(null==i)return p;i||(i="DEFAULT");let d=null!=(c=null!=(a=p[i])?a:i.split("-").reduce((e,t)=>null==e?void 0:e[t],p))?c:u;return s?S(d,{opacityValue:C(s,l)}):d}let h={};for(let g of[...Object.keys(n),...Object.keys(t)])h[g]=l(g);return h}function o(e,t){let n=e[t];return("function"==typeof n&&(n=n(i)),n&&/color|fill|stroke/i.test(t))?function e(t,n=[]){let r={};for(let i in t){let l=t[i],o=[...n,i];r[o.join("-")]=l,"DEFAULT"==i&&(o=n,r[n.join("-")]=l),"object"==typeof l&&Object.assign(r,e(l,o))}return r}(n):n}}(e),e:i,h:$,s:(e,t)=>f(e,t,w),d:(e,t,r)=>n(e,t,w,r),v:e=>(h.has(e)||h.set(e,es(e,r,g,ea,w)||"&:"+e),h.get(e)),r(e,t){let n=JSON.stringify([e,t]);return y.has(n)||y.set(n,!b(e,w)&&es(e,o,v,ec,w,t)),y.get(n)},f:e=>d.reduce((e,t)=>t(e,w),e)};return w}(n),o=new Map,f=[],p=new Set;function d(e){let n=r.f(e),i=v(n);if(i&&!p.has(i)){p.add(i);let l=x(f,e);t.insert(i,l,e),f.splice(l,0,e)}return n.n}return t.resume(e=>o.set(e,e),(e,n)=>{t.insert(e,f.length,n),f.push(n),p.add(e)}),Object.defineProperties(function(e){if(!o.size)for(let t of u(n.preflight))"function"==typeof t&&(t=t(r)),t&&("string"==typeof t?z("",c.b,F(t),r,c.b,[],!1,!0):M(t,{},r,c.b)).forEach(d);e=""+e;let i=o.get(e);if(!i){let l=new Set;for(let s of R(F(e),r))l.add(s.c).add(d(s));i=[...l].filter(Boolean).join(" "),o.set(e,i).set(i,i)}return i},Object.getOwnPropertyDescriptors({get target(){return t.target},theme:r.theme,config:n,snapshot(){let e=t.snapshot(),n=new Set(p),r=new Map(o),i=[...f];return()=>{e(),p=n,o=r,f=i}},clear(){t.clear(),p=new Set,o=new Map,f=[]},destroy(){this.clear(),t.destroy()}}))}function eg(e,t){return e!=t&&""+e.split(" ").sort()!=""+t.split(" ").sort()}function ey(e){let t=new MutationObserver(n);return{observe(e){t.observe(e,{attributeFilter:["class"],subtree:!0,childList:!0}),r(e),n([{target:e,type:""}])},disconnect(){t.disconnect()}};function n(e){for(let{type:n,target:i}of e)if("a"==n[0])r(i);else for(let l of i.querySelectorAll("[class]"))r(l);t.takeRecords()}function r(t){let n;let r=null==t.getAttribute?void 0:t.getAttribute("class");r&&eg(r,n=e(r))&&t.setAttribute("class",n)}}function em(e=ej,t=document.documentElement){if(t){let n=ey(e);n.observe(t);let{destroy:r}=e;e.destroy=()=>{n.disconnect(),r.call(e)}}return e}function ev(e){let t=document.querySelector(e||'style[data-twind=""]');return t&&"STYLE"==t.tagName||(t=document.createElement("style"),document.head.prepend(t)),t.dataset.twind="claimed",t}function eb(e){let t=(null==e?void 0:e.cssRules)?e:(e&&"string"!=typeof e?e:ev(e)).sheet;return{target:t,snapshot(){let e=Array.from(t.cssRules,e=>e.cssText);return()=>{this.clear(),e.forEach(this.insert)}},clear(){for(let e=t.cssRules.length;e--;)t.deleteRule(e)},destroy(){var e;null==(e=t.ownerNode)||e.remove()},insert(e,n){try{t.insertRule(e,n)}catch(r){t.insertRule(":root{}",n)}},resume:a}}function e$(e){let t=e&&"string"!=typeof e?e:ev(e);return{target:t,snapshot(){let e=Array.from(t.childNodes,e=>e.textContent);return()=>{this.clear(),e.forEach(this.insert)}},clear(){t.textContent=""},destroy(){t.remove()},insert(e,n){t.insertBefore(document.createTextNode(e),t.childNodes[n]||null)},resume:a}}function ew(e,t){let n=e?e$():eb();return t||(n.resume=eA),n}function ex(e){return(e.ownerNode||e).textContent||(e.cssRules?Array.from(e.cssRules,e=>e.cssText):u(e)).join("")}function eA(e,t){let n=ex(this.target),r=/\/\*!([\da-z]+),([\da-z]+)(?:,(.+?))?\*\//g;if(r.test(n)){var i;let l;for(let o of(r.lastIndex=0,this.clear(),document.querySelectorAll("[class]")))e(o.getAttribute("class"));for(;i=r.exec(n),l&&t(n.slice(l.index+l[0].length,null==i?void 0:i.index),{p:parseInt(l[1],36),o:parseInt(l[2],36)/2,n:l[3]}),l=i;);}}let ej=new Proxy(a,{apply:(e,n,r)=>t(r[0]),get(e,n){let r=t[n];return"function"==typeof r?function(){return r.apply(t,arguments)}:r}});function ek(e={},n=ew,r){return null==t||t.destroy(),t=em(eh(e,"function"==typeof n?n():n),r)}let eO=function e(t){return new Proxy(function(e,...n){return eS(t,"",e,n)},{get:(n,r)=>"bind"===r?e:r in n?n[r]:function(e,...n){return eS(t,r,e,n)}})}();function eS(e,t,n,r){return{toString(){let o=B(n,r),u=i(t+l(JSON.stringify([t,o])));return("function"==typeof e?e:ej)(G({[`@keyframes ${u}`]:B(n,r)})),u}}}function eM(e,t=ej){let n=t.snapshot(),r={html:eC(e,t),css:ex(t.target)};return n(),r}function eC(e,t=ej){let n="",r=0;return!function(e,t){let n=1,r=0,i="",l="",o=o=>{5==n&&"class"==l&&!1===t(r,o,i)&&(e="")};for(let u=0;u<e.length;u++){let s=e[u];1==n?"<"==s&&(n="!--"==e.substr(u+1,3)?4:3):4==n?">"==s&&"--"==e.slice(u-2,u)&&(n=1):i?s==i&&"\\"!=e[u-1]&&(o(u),n=2,i=""):'"'==s||"'"==s?(i=s,r+=1):">"==s?(o(u),n=1):n&&("="==s?(l=e.slice(r,u),n=5,r=u+1):"/"==s&&(n<5||">"==e[u+1])?(o(u),n=0):/\s/.test(s)&&(o(u),n=2,r=u+1))}}(e,(i,l,o)=>{var u;let s=e.slice(i,l),a=t(('"'==(u=o)?s.replace(/(=|\[)(?:'|'|')|(?:'|'|')(])/g,"$1'$2"):"'"==u?s.replace(/(=|\[)(?:"|"|")|(?:"|"|")(])/g,'$1"$2'):s).replace(/(&|&|&)/g,"&"));eg(s,a)&&(o=o?"":'"',n+=e.slice(r,i)+o+a+o,r=l)}),n+e.slice(r,e.length)}let eE=(e,t)=>"function"==typeof e?eR(t,e):eR(e);function eR(e={},t){let{label:n="style",base:r,props:o={},defaults:u,when:s=[]}=e,a=m({},null==t?void 0:t.defaults,u),f=l(JSON.stringify([n,null==t?void 0:t.className,r,o,a,s])),p=d("",r||"",c.c);function d(e,r,i){return N(((t?t.className.replace(/#.+$/,"~"):"")+n+e+f).replace(/[: ,()[\]]/,""),i,r&&F(r))}return Object.defineProperties(function(e){let n,r;Array.isArray(e)&&(n=!0,e=Object.fromEntries(new URLSearchParams(e[1]).entries()));let i=m({},a,e),l=n?"":(t?t(i)+" ":"")+p;for(let u in o){let c=o[u],f=i[u];if(f===Object(f)){let h="";for(let g in r="",f){let y=c[f[g]];y&&(h+="@"+g+"-"+f[g],r+=(r&&" ")+("_"==g?y:g+":("+y+")"))}r&&(l+=" "+d("--"+u+"-"+h,r,402653184))}else(r=c[f])&&(l+=" "+d("--"+u+"-"+f,r,402653184))}return s.forEach((e,t)=>{let n="";for(let o in e[0]){let u=i[o];if(u!==Object(u)&&""+u==""+e[0][o])n+=(n&&"_")+o+"-"+u;else{n="";break}}n&&(r=e[1])&&(l+=" "+d("-"+t+"--"+n,r,536870912))}),l},Object.getOwnPropertyDescriptors({className:p,defaults:a,selector:"."+i(p)}))}return e.animation=Y,e.apply=q,e.arbitrary=en,e.asArray=u,e.auto=function(e){if(document.currentScript){let t=()=>n.disconnect(),n=new MutationObserver(n=>{for(let{target:r}of n)if(r===document.body)return e(),t()});return n.observe(document.documentElement,{childList:!0,subtree:!0}),t}return a},e.autoDarkColor=function(e,t,{theme:n}){return n(e,t=t.replace(/\d+$/,e=>100*(9-~~(parseInt(e,10)/100)||.5)))},e.colorFromTheme=X,e.consume=eC,e.css=G,e.cssom=eb,e.cx=function(e,...t){return r(F(I(e,t))," ")},e.defineConfig=eu,e.dom=e$,e.escape=i,e.extract=eM,e.fromMatch=H,e.fromTheme=Q,e.getAutocompleteProvider=function(e){return e[el]},e.getSheet=ew,e.hash=l,e.identity=s,e.injectGlobal=function(e,...t){("function"==typeof this?this:ej)(G({"@layer base":B(e,t)}))},e.inline=function(e,t={}){let{tw:n=ej,minify:r=s}="function"==typeof t?{tw:t}:t,{html:i,css:l}=eM(e,n);return i.replace("</head>",`<style data-twind>${r(l,i)}</style></head>`)},e.install=function(e,t=!0){var n;let r=eu(e);return ek(m({},r,{hash:null!=(n=r.hash)?n:t}),()=>ew(!t))},e.keyframes=eO,e.match=function(e,t,n){return[e,H(t,n)]},e.matchColor=function(e,t={},n){return[e,X(t,n)]},e.matchTheme=function(e,t,n,r){return[e,Q(t,n,r)]},e.mo=ey,e.mql=o,e.noop=a,e.normalize=ei,e.observe=em,e.parse=F,e.parseValue=ee,e.setup=ek,e.shortcut=D,e.stringify=ex,e.style=eE,e.toCSS=et,e.toColorValue=S,e.tw=ej,e.twind=eh,e.tx=function(e,...t){return("function"==typeof this?this:ej)(I(e,t))},e.virtual=function(e){let t=[];return{target:t,snapshot(){let e=[...t];return()=>{t.splice(0,t.length,...e)}},clear(){t.length=0},destroy(){this.clear()},insert(n,r,i){t.splice(r,0,e?`/*!${i.p.toString(36)},${(2*i.o).toString(36)}${i.n?","+i.n:""}*/${n}`:n)},resume:a}},e.withAutocomplete=function(e){return e},e}({});//# sourceMappingURL=core.global.js.map