astro-ghostcms/.pnpm-store/v3/files/ef/5e2ccff7cbd4cfcc68026afb11a...

32 lines
10 KiB
Plaintext
Raw Normal View History

2024-02-14 14:10:47 +00:00
import{walkSync as yr,ELEMENT_NODE as er,TEXT_NODE as Pr,render as Ur}from"../index.js";import{matches as zr}from"../selector.js";var j="comm",F="rule",K="decl";var or="@import";var ar="@keyframes";var cr=Math.abs,$=String.fromCharCode;function V(r){return r.trim()}function P(r,e,t){return r.replace(e,t)}function ir(r,e){return r.indexOf(e)}function O(r,e){return r.charCodeAt(e)|0}function k(r,e,t){return r.slice(e,t)}function g(r){return r.length}function C(r){return r.length}function N(r,e){return e.push(r),r}var W=1,M=1,ur=0,x=0,f=0,R="";function Y(r,e,t,n,s,a,c){return{value:r,root:e,parent:t,type:n,props:s,children:a,line:W,column:M,length:c,return:""}}function fr(){return f}function pr(){return f=x>0?O(R,--x):0,M--,f===10&&(M=1,W--),f}function w(){return f=x<ur?O(R,x++):0,M++,f===10&&(M=1,W++),f}function I(){return O(R,x)}function U(){return x}function B(r,e){return k(R,r,e)}function X(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function lr(r){return W=M=1,ur=g(R=r),x=0,[]}function hr(r){return R="",r}function G(r){return V(B(x-1,J(r===91?r+2:r===40?r+1:r)))}function mr(r){for(;(f=I())&&f<33;)w();return X(r)>2||X(f)>3?"":" "}function gr(r,e){for(;--e&&w()&&!(f<48||f>102||f>57&&f<65||f>70&&f<97););return B(r,U()+(e<6&&I()==32&&w()==32))}function J(r){for(;w();)switch(f){case r:return x;case 34:case 39:r!==34&&r!==39&&J(f);break;case 40:r===41&&J(r);break;case 92:w();break}return x}function xr(r,e){for(;w()&&r+f!==47+10;)if(r+f===42+42&&I()===47)break;return"/*"+B(e,x-1)+"*"+$(r===47?r:w())}function wr(r){for(;!X(I());)w();return B(r,x)}function Q(r){return hr(Z("",null,null,null,[""],r=lr(r),0,[0],r))}function Z(r,e,t,n,s,a,c,o,i){for(var h=0,l=0,p=c,S=0,y=0,v=0,b=1,_=1,d=1,m=0,A="",D=s,T=a,E=n,u=A;_;)switch(v=m,m=w()){case 40:if(v!=108&&O(u,p-1)==58){ir(u+=P(G(m),"&","&\f"),"&\f")!=-1&&(d=-1);break}case 34:case 39:case 91:u+=G(m);break;case 9:case 10:case 13:case 32:u+=mr(v);break;case 92:u+=gr(U()-1,7);continue;case 47:switch(I()){case 42:case 47:N(Ar(xr(w(),U()),e,t),i);break;default:u+="/"}break;case 123*b:o[h++]=g(u)*d;case 125*b:case 59:case 0:switch(m){case 0:case 125:_=0;case 59+l:y>0&&g(u)-p&&N(y>32?dr(u+";",n,t,p-1):dr(P(u," ","")+";",n,t,p-2),i);break;case 59:u+=";";default:if(N(E=br(u,e,t,h,l,s,o,A,D=[],T=[],p),a),m===123)if(l===0)Z(u,e,E,E,D,a,p,o,T);else switch(S){case 100:case 109:case 115:Z(r,E,E,n&&N(br(r,E,E,0,0,s,o,A,s,D=[],p),T),s,T,p,o,n?D:T);break;default:Z(u,E,E,E,[""],T,0,o,T)}}h=l=y=0,b=d=1,A=u="",p=c;break;case 58:p=1+g(u),y=v;default:if(b<1){if(m==123)--b;else if(m==125&&b++==0&&pr()==125)continue}switch(u+=$(m),m*b){case 38:d=l>0?1:(u+="\f",-1);break;case 44:o[h++]=(g(u)-1)*d,d=1;break;case 64:I()===45&&(u+=G(w())),S=I(),l=p=g(A=u+=wr(U())),m++;break;case 45:v===45&&g(u)==2&&(b=0)}}return a}function br(r,e,t,n,s,a,c,o,i,h,l){for(var p=s-1,S=s===0?a:[""],y=C(S),v=0,b=0,_=0;v<n;++v)for(var d=0,m=k(r,p+1,p=cr(b=c[v])),A=r;d<y;++d)(A=V(b>0?S[d]+" "+m:P(m,/&\f/g,S[d])))&&(i[_++]=A);return Y(r,e,t,s===0?F:o,i,h,l)}function Ar(r,e,t){return Y(r,e,t,j,$(fr()),k(r,2,-2),0)}function dr(r,e,t,n){return Y(r,e,t,K,k(r,0,n),k(r,n+1,-1),n)}function z(r,e){for(var t="",n=C(r),s=0;s<n;s++)t+=e(r[s],s,r,e)||"";return t}function Er(r,e,t,n){switch(r.type){case or:case K:return r.return=r.return||r.value;case j:return"";case ar:return r.return=r.value+"{"+z(r.children,n)+"}";case F:r.value=r.props.join(",")}return g(t=z(r.children,n))?r.return=r.value+"{"+t+"}":""}function rr(r){var e=C(r);return function(t,n,s,a){for(var c="",o=0;o<e;o++)c+=r[o](t,n,s,a)||"";return c}}var H={attribute:/\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,id:/#(?<name>[-\w\P{ASCII}]+)/gu,class:/\.(?<name>[-\w\P{ASCII}]+)/gu,comma:/\s*,\s*/g,combinator:/\s*[\s>+~]\s*/g,"pseudo-element":/::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)
/**
* shorthash - https://github.com/bibig/node-shorthash
*
* @license
*
* (The MIT License)
*
* Copyright (c) 2013 Bibig <bibig@me.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/