prettier 3.8.2 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1 -1
- package/index.mjs +1 -1
- package/internal/experimental-cli.mjs +1 -1
- package/package.json +1 -1
- package/plugins/postcss.js +1 -1
- package/plugins/postcss.mjs +1 -1
- package/standalone.js +1 -1
- package/standalone.mjs +1 -1
package/index.cjs
CHANGED
package/index.mjs
CHANGED
|
@@ -18461,7 +18461,7 @@ var get_file_info_default = getFileInfo;
|
|
|
18461
18461
|
import * as doc from "./doc.mjs";
|
|
18462
18462
|
|
|
18463
18463
|
// src/main/version.evaluate.js
|
|
18464
|
-
var version_evaluate_default = "3.8.
|
|
18464
|
+
var version_evaluate_default = "3.8.3";
|
|
18465
18465
|
|
|
18466
18466
|
// src/utilities/public.js
|
|
18467
18467
|
var public_exports = {};
|
package/package.json
CHANGED
package/plugins/postcss.js
CHANGED
|
@@ -55,7 +55,7 @@ $1 $2
|
|
|
55
55
|
|
|
56
56
|
`)+i}var Yn=t=>$n(ge(t).content),Vn=t=>Wn(ge(t).content),zn=t=>{let{frontMatter:e,content:s}=ge(t);return(e?e.raw+`
|
|
57
57
|
|
|
58
|
-
`:"")+Gn(s)};var cc=new Set(["red","green","blue","alpha","a","rgb","hue","h","saturation","s","lightness","l","whiteness","w","blackness","b","tint","shade","blend","blenda","contrast","hsl","hsla","hwb","hwba"]);function jn(t){return t.findAncestor(e=>e.type==="css-decl")?.prop?.toLowerCase()}var fc=new Set(["initial","inherit","unset","revert"]);function Hn(t){return fc.has(t.toLowerCase())}function Kn(t,e){return t.findAncestor(r=>r.type==="css-atrule")?.name?.toLowerCase().endsWith("keyframes")&&["from","to"].includes(e.toLowerCase())}function Ie(t){return t.includes("$")||t.includes("@")||t.includes("#")||t.startsWith("%")||t.startsWith("--")||t.startsWith(":--")||t.includes("(")&&t.includes(")")?t:t.toLowerCase()}function qe(t,e){return t.findAncestor(r=>r.type==="value-func")?.value?.toLowerCase()===e}function Qn(t){return t.hasAncestor(e=>{if(e.type!=="css-rule")return!1;let s=e.raws?.selector;return s&&(s.startsWith(":import")||s.startsWith(":export"))})}function we(t,e){let s=Array.isArray(e)?e:[e],r=t.findAncestor(n=>n.type==="css-atrule");return r&&s.includes(r.name.toLowerCase())}function Xn(t){let{node:e}=t;return e.groups[0]?.value==="url"&&e.groups.length===2&&t.findAncestor(s=>s.type==="css-atrule")?.name==="import"}function Jn(t){return t.type==="value-func"&&t.value.toLowerCase()==="url"}function Zn(t){return t.type==="value-func"&&t.value.toLowerCase()==="var"}function ei(t){let{selector:e}=t;return e?typeof e=="string"&&/^@.+:.*$/u.test(e)||e.value&&/^@.+:.*$/u.test(e.value):!1}function ti(t){return t.type==="value-word"&&["from","through","end"].includes(t.value)}function ri(t){return t.type==="value-word"&&["and","or","not"].includes(t.value)}function si(t){return t.type==="value-word"&&t.value==="in"}function Dt(t){return t.type==="value-operator"&&t.value==="*"}function ve(t){return t?.type==="value-operator"&&t.value==="/"}function J(t){return t.type==="value-operator"&&t.value==="+"}function xe(t){return t.type==="value-operator"&&t.value==="-"}function pc(t){return t.type==="value-operator"&&t.value==="%"}function Mt(t){return Dt(t)||ve(t)||J(t)||xe(t)||pc(t)}function ni(t){return t.type==="value-word"&&["==","!="].includes(t.value)}function ii(t){return t.type==="value-word"&&["<",">","<=",">="].includes(t.value)}function Je(t,e){return e.parser==="scss"&&t.type==="css-atrule"&&["if","else","for","each","while"].includes(t.name)}function es(t){return t.raws?.params&&/^\(\s*\)$/u.test(t.raws.params)}function Bt(t){return t.name.startsWith("prettier-placeholder")}function oi(t){return t.prop.startsWith("@prettier-placeholder")}function ai(t,e){return t.value==="$$"&&t.type==="value-func"&&e?.type==="value-word"&&!e.raws.before}function ui(t){return t.value?.type==="value-root"&&t.value.group?.type==="value-value"&&t.prop.toLowerCase()==="composes"}function li(t){return t.value?.group?.group?.type==="value-paren_group"&&t.value.group.group.open!==null&&t.value.group.group.close!==null}function Z(t){return t?.raws?.before===""}function Ut(t){return t.type==="value-comma_group"&&t.groups?.[1]?.type==="value-colon"}function Zr(t){return t.type==="value-paren_group"&&t.groups?.[0]&&Ut(t.groups[0])}function ts(t,e){if(e.parser!=="scss")return!1;let{node:s}=t;if(s.groups.length===0)return!1;let r=t.grandparent;return!Zr(s)&&!(
|
|
58
|
+
`:"")+Gn(s)};var cc=new Set(["red","green","blue","alpha","a","rgb","hue","h","saturation","s","lightness","l","whiteness","w","blackness","b","tint","shade","blend","blenda","contrast","hsl","hsla","hwb","hwba"]);function jn(t){return t.findAncestor(e=>e.type==="css-decl")?.prop?.toLowerCase()}var fc=new Set(["initial","inherit","unset","revert"]);function Hn(t){return fc.has(t.toLowerCase())}function Kn(t,e){return t.findAncestor(r=>r.type==="css-atrule")?.name?.toLowerCase().endsWith("keyframes")&&["from","to"].includes(e.toLowerCase())}function Ie(t){return t.includes("$")||t.includes("@")||t.includes("#")||t.startsWith("%")||t.startsWith("--")||t.startsWith(":--")||t.includes("(")&&t.includes(")")?t:t.toLowerCase()}function qe(t,e){return t.findAncestor(r=>r.type==="value-func")?.value?.toLowerCase()===e}function Qn(t){return t.hasAncestor(e=>{if(e.type!=="css-rule")return!1;let s=e.raws?.selector;return s&&(s.startsWith(":import")||s.startsWith(":export"))})}function we(t,e){let s=Array.isArray(e)?e:[e],r=t.findAncestor(n=>n.type==="css-atrule");return r&&s.includes(r.name.toLowerCase())}function Xn(t){let{node:e}=t;return e.groups[0]?.value==="url"&&e.groups.length===2&&t.findAncestor(s=>s.type==="css-atrule")?.name==="import"}function Jn(t){return t.type==="value-func"&&t.value.toLowerCase()==="url"}function Zn(t){return t.type==="value-func"&&t.value.toLowerCase()==="var"}function ei(t){let{selector:e}=t;return e?typeof e=="string"&&/^@.+:.*$/u.test(e)||e.value&&/^@.+:.*$/u.test(e.value):!1}function ti(t){return t.type==="value-word"&&["from","through","end"].includes(t.value)}function ri(t){return t.type==="value-word"&&["and","or","not"].includes(t.value)}function si(t){return t.type==="value-word"&&t.value==="in"}function Dt(t){return t.type==="value-operator"&&t.value==="*"}function ve(t){return t?.type==="value-operator"&&t.value==="/"}function J(t){return t.type==="value-operator"&&t.value==="+"}function xe(t){return t.type==="value-operator"&&t.value==="-"}function pc(t){return t.type==="value-operator"&&t.value==="%"}function Mt(t){return Dt(t)||ve(t)||J(t)||xe(t)||pc(t)}function ni(t){return t.type==="value-word"&&["==","!="].includes(t.value)}function ii(t){return t.type==="value-word"&&["<",">","<=",">="].includes(t.value)}function Je(t,e){return e.parser==="scss"&&t.type==="css-atrule"&&["if","else","for","each","while"].includes(t.name)}function es(t){return t.raws?.params&&/^\(\s*\)$/u.test(t.raws.params)}function Bt(t){return t.name.startsWith("prettier-placeholder")}function oi(t){return t.prop.startsWith("@prettier-placeholder")}function ai(t,e){return t.value==="$$"&&t.type==="value-func"&&e?.type==="value-word"&&!e.raws.before}function ui(t){return t.value?.type==="value-root"&&t.value.group?.type==="value-value"&&t.prop.toLowerCase()==="composes"}function li(t){return t.value?.group?.group?.type==="value-paren_group"&&t.value.group.group.open!==null&&t.value.group.group.close!==null}function Z(t){return t?.raws?.before===""}function Ut(t){return t.type==="value-comma_group"&&t.groups?.[1]?.type==="value-colon"}function Zr(t){return t.type==="value-paren_group"&&t.groups?.[0]&&Ut(t.groups[0])}function ts(t,e){if(e.parser!=="scss")return!1;let{node:s}=t;if(s.groups.length===0)return!1;let r=t.parent;if(r&&r.type==="value-func"&&r.value==="if")return!1;let n=t.grandparent;return!Zr(s)&&!(n&&Zr(n))?!1:!!(t.findAncestor(o=>o.type==="css-decl")?.prop?.startsWith("$")||Zr(n)||n.type==="value-func")}function Ze(t){return t.type==="value-comment"&&t.inline}function Ft(t){return t.type==="value-word"&&t.value==="#"}function rs(t){return t.type==="value-word"&&t.value==="{"}function $t(t){return t.type==="value-word"&&t.value==="}"}function et(t){return["value-word","value-atword"].includes(t.type)}function Wt(t){return t?.type==="value-colon"}function ci(t,e){if(!Ut(e))return!1;let{groups:s}=e,r=s.indexOf(t);return r===-1?!1:Wt(s[r+1])}function fi(t){return t.value&&["not","and","or"].includes(t.value.toLowerCase())}function pi(t){return t.type!=="value-func"?!1:cc.has(t.value.toLowerCase())}function Le(t){return/\/\//u.test(t.split(/[\n\r]/u).pop())}function tt(t){return t?.type==="value-atword"&&t.value.startsWith("prettier-placeholder-")}function hi(t,e){if(t.open?.value!=="("||t.close?.value!==")"||t.groups.some(s=>s.type!=="value-comma_group"))return!1;if(e.type==="value-comma_group"){let s=e.groups.indexOf(t)-1,r=e.groups[s];if(r?.type==="value-word"&&r.value==="with")return!0}return!1}function rt(t){return t.type==="value-paren_group"&&t.open?.value==="("&&t.close?.value===")"}function hc(t,e,s){let{node:r}=t,n=t.parent,i=t.grandparent,o=jn(t),u=o&&n.type==="value-value"&&(o==="grid"||o.startsWith("grid-template")),a=t.findAncestor(p=>p.type==="css-atrule"),l=a&&Je(a,e),f=r.groups.some(p=>Ze(p)),h=t.map(s,"groups"),c=[""],g=qe(t,"url"),b=!1,d=!1;for(let p=0;p<r.groups.length;++p){let m=r.groups[p-1],y=r.groups[p],v=r.groups[p+1],O=r.groups[p+2];if(Ze(y)&&!v){c.push([c.pop(),cn([" ",h[p]])]);continue}if(c.push([c.pop(),h[p]]),g){(v&&J(v)||J(y))&&c.push([c.pop()," "]);continue}if(we(t,"forward")&&y.type==="value-word"&&y.value&&m!==void 0&&m.type==="value-word"&&m.value==="as"&&v.type==="value-operator"&&v.value==="*"||we(t,"utility")&&y.type==="value-word"&&v&&v.type==="value-operator"&&v.value==="*"||!v||y.type==="value-word"&&tt(v)&&R(y)===P(v))continue;if(y.type==="value-string"&&y.quoted){let k=y.value.lastIndexOf("#{"),N=y.value.lastIndexOf("}");k!==-1&&N!==-1?b=k>N:k!==-1?b=!0:N!==-1&&(b=!1)}if(b||Wt(y)||Wt(v)||y.type==="value-atword"&&(y.value===""||y.value.endsWith("["))||v.type==="value-word"&&v.value.startsWith("]")||y.value==="~"||e.parser==="less"&&(v?.type==="value-word"&&v.value==="["||y.type==="value-word"&&y.value==="["&&(v?.type==="value-atword"||v?.type==="value-word")||y.type==="value-word"&&y.value==="]["&&v?.type==="value-word")||y.type!=="value-string"&&y.value&&y.value.includes("\\")&&v&&v.type!=="value-comment"||m?.value&&m.value.indexOf("\\")===m.value.length-1&&y.type==="value-operator"&&y.value==="/"||y.value==="\\"||ai(y,v)||Ft(y)||rs(y)||$t(v)||rs(v)&&Z(v)||$t(y)&&Z(v)||y.value==="--"&&Ft(v))continue;let q=Mt(y),H=Mt(v);if((q&&Ft(v)||H&&$t(y))&&Z(v)||!m&&ve(y)||qe(t,"calc")&&(J(y)||J(v)||xe(y)||xe(v))&&Z(v))continue;let ne=(J(y)||xe(y))&&p===0&&(v.type==="value-number"||v.isHex)&&i&&pi(i)&&!Z(v);if(e.parser==="scss"&&q&&y.value==="-"&&v.type==="value-func"&&R(y)!==P(v)){c.push([c.pop()," "]);continue}let W=O?.type==="value-func"||O&&et(O)||y.type==="value-func"||et(y),A=v.type==="value-func"||et(v)||m?.type==="value-func"||m&&et(m);if(!(!(Dt(v)||Dt(y))&&!qe(t,"calc")&&!ne&&(ve(v)&&!W||ve(y)&&!A||J(v)&&!W||J(y)&&!A||xe(v)||xe(y))&&(Z(v)||q&&(!m||m&&Mt(m))))&&!((e.parser==="scss"||e.parser==="less")&&q&&y.value==="-"&&rt(v)&&R(y)===P(v.open)&&v.open.value==="(")){if(Ze(y)){if(n.type==="value-paren_group"){c.push(le(T),"");continue}c.push(T,"");continue}if(l&&(ni(v)||ii(v)||ri(v)||si(y)||ti(y))){c.push([c.pop()," "]);continue}if(a&&a.name.toLowerCase()==="namespace"){c.push([c.pop()," "]);continue}if(u){y.source&&v.source&&y.source.start.line!==v.source.start.line?(c.push(T,""),d=!0):c.push([c.pop()," "]);continue}if(!(o&&(o==="font"||o.startsWith("--"))&&(ve(v)&&Z(v)&&di(y)||ve(y)&&Z(y)&&di(m)))){if(H){c.push([c.pop()," "]);continue}if(v?.value!=="..."&&!(tt(y)&&tt(v)&&R(y)===P(v))){if(tt(y)&&rt(v)&&R(y)===P(v.open)){c.push(M,"");continue}if(y.value==="with"&&rt(v)){c=[[Pe(c)," "]];continue}if(!(y.value?.endsWith("#")&&v.value==="{"&&rt(v.group))&&!(Ze(v)&&!O)){if(!a&&y.type==="value-comment"&&!y.inline&&r.groups.slice(0,p).every(k=>k.type==="value-comment")){c.push(le(C),"");continue}c.push(C,"")}}}}}return f&&c.push([c.pop(),Ne]),d&&c.unshift("",T),l?D(L(c)):Xn(t)?D(Pe(c)):D(L(Pe(c)))}function di(t){if(t?.type==="value-number")return!0;if(t?.type!=="value-func")return!1;let e=t.value.toLowerCase();return e==="var"||e==="calc"||e==="min"||e==="max"||e==="clamp"||e.startsWith("--")}var mi=hc;function dc(t){return t.length===1?t:t.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u,"$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u,"$1").replace(/^([+-])?\./u,"$10.").replace(/(\.\d+?)0+(?=e|$)/u,"$1").replace(/\.(?=e|$)/u,"")}var yi=dc;var Gt=new Map([["em","em"],["rem","rem"],["ex","ex"],["rex","rex"],["cap","cap"],["rcap","rcap"],["ch","ch"],["rch","rch"],["ic","ic"],["ric","ric"],["lh","lh"],["rlh","rlh"],["vw","vw"],["svw","svw"],["lvw","lvw"],["dvw","dvw"],["vh","vh"],["svh","svh"],["lvh","lvh"],["dvh","dvh"],["vi","vi"],["svi","svi"],["lvi","lvi"],["dvi","dvi"],["vb","vb"],["svb","svb"],["lvb","lvb"],["dvb","dvb"],["vmin","vmin"],["svmin","svmin"],["lvmin","lvmin"],["dvmin","dvmin"],["vmax","vmax"],["svmax","svmax"],["lvmax","lvmax"],["dvmax","dvmax"],["cm","cm"],["mm","mm"],["q","Q"],["in","in"],["pt","pt"],["pc","pc"],["px","px"],["deg","deg"],["grad","grad"],["rad","rad"],["turn","turn"],["s","s"],["ms","ms"],["hz","Hz"],["khz","kHz"],["dpi","dpi"],["dpcm","dpcm"],["dppx","dppx"],["x","x"],["cqw","cqw"],["cqh","cqh"],["cqi","cqi"],["cqb","cqb"],["cqmin","cqmin"],["cqmax","cqmax"],["fr","fr"]]);function ss(t){let e=t.toLowerCase();return Gt.has(e)?Gt.get(e):t}var gi=/(["'])(?:(?!\1)[^\\]|\\.)*\1/gsu,mc=/(?:\d*\.\d+|\d+\.?)(?:e[+-]?\d+)?/giu,yc=/[a-z]+/giu,gc=/[$@]?[_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/giu,wc=new RegExp(gi.source+`|(${gc.source})?(${mc.source})(${yc.source})?`,"giu");function V(t,e){return E(0,t,gi,s=>Pt(s,e))}function wi(t,e){let s=e.singleQuote?"'":'"',r="",n=t.match(/^(?<value>.+?)\s+(?<flag>[a-zA-Z])$/u);return n&&({value:t,flag:r}=n.groups),(t.includes('"')||t.includes("'")?t:s+t+s)+(r?` ${r}`:"")}function _e(t){return E(0,t,wc,(e,s,r,n,i)=>!r&&n&&(i??(i=""),i=i.toLowerCase(),!i||i==="n"||Gt.has(i))?ns(n)+(i?ss(i):""):e)}function ns(t){return yi(t).replace(/\.0(?=$|e)/u,"")}function vi(t){return t.trailingComma==="es5"||t.trailingComma==="all"}var xi=t=>t===`
|
|
59
59
|
`||t==="\r"||t==="\u2028"||t==="\u2029";function vc(t,e,s){let r=!!s?.backwards;if(e===!1)return!1;let n=t.charAt(e);if(r){if(t.charAt(e-1)==="\r"&&n===`
|
|
60
60
|
`)return e-2;if(xi(n))return e-1}else{if(n==="\r"&&t.charAt(e+1)===`
|
|
61
61
|
`)return e+2;if(xi(n))return e+1}return e}var Yt=vc;function xc(t,e,s={}){let r=qt(t,s.backwards?e-1:e,s),n=Yt(t,r,s);return r!==n}var Vt=xc;function _c(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let s=e+2;s<t.length;++s)if(t.charAt(s)==="*"&&t.charAt(s+1)==="/")return s+2}return e}var _i=_c;function bc(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?Lt(t,e):e}var bi=bc;function Ec(t,e){let s=null,r=e;for(;r!==s;)s=r,r=En(t,r),r=_i(t,r),r=qt(t,r);return r=bi(t,r),r=Yt(t,r),r!==!1&&Vt(t,r)}var zt=Ec;function Sc({node:t,parent:e},s){return!!(t.source&&s.originalText.slice(P(t),P(e.close)).trimEnd().endsWith(","))}function kc(t,e){return Zn(t.grandparent)&&Sc(t,e)?",":t.node.type!=="value-comment"&&!(t.node.type==="value-comma_group"&&t.node.groups.every(s=>s.type==="value-comment"))&&vi(e)&&t.callParent(()=>ts(t,e))?Nt(","):""}function Ei(t,e,s){let{node:r,parent:n}=t,i=t.map(({node:g})=>typeof g=="string"?g:s(),"groups");if(n&&Jn(n)&&(r.groups.length===1||r.groups.length>0&&r.groups[0].type==="value-comma_group"&&r.groups[0].groups.length>0&&r.groups[0].groups[0].type==="value-word"&&r.groups[0].groups[0].value.startsWith("data:")))return[r.open?s("open"):"",Y(",",i),r.close?s("close"):""];if(!r.open){let g=is(t);ye(i);let b=Ac(Y(",",i),2),d=Y(g?T:C,b);return L(g?[T,d]:D([Tc(t)?M:"",Pe(d)]))}let o=t.map(({node:g,isLast:b,index:d})=>{let p=i[d];Ut(g)&&g.type==="value-comma_group"&&g.groups&&g.groups[0].type!=="value-paren_group"&&g.groups[2]?.type==="value-paren_group"&&ue(p)===oe&&ue(p.contents)===ie&&ue(p.contents.contents)===ae&&(p=D(le(p)));let m=[p,b?kc(t,e):","];if(!b&&g.type==="value-comma_group"&&ce(g.groups)){let y=G(0,g.groups,-1);!y.source&&y.close&&(y=y.close),y.source&&zt(e.originalText,R(y))&&m.push(T)}return m},"groups"),u=ci(r,n),a=hi(r,n),l=ts(t,e),f=a||l&&!u,h=a||u,c=D([r.open?s("open"):"",L([M,Y(C,o)]),M,r.close?s("close"):""],{shouldBreak:f});return h?le(c):c}function is(t){return t.match(e=>e.type==="value-paren_group"&&!e.open&&e.groups.some(s=>s.type==="value-comma_group"),(e,s)=>s==="group"&&e.type==="value-value",(e,s)=>s==="group"&&e.type==="value-root",(e,s)=>s==="value"&&(e.type==="css-decl"&&!e.prop.startsWith("--")||e.type==="css-atrule"&&e.variable))}function Tc(t){return t.match(e=>e.type==="value-paren_group"&&!e.open,(e,s)=>s==="group"&&e.type==="value-value",(e,s)=>s==="group"&&e.type==="value-root",(e,s)=>s==="value"&&e.type==="css-decl")}function Ac(t,e){let s=[];for(let r=0;r<t.length;r+=e)s.push(t.slice(r,r+e));return s}function Oc(t,e,s){let r=[];return t.each(()=>{let{node:n,previous:i}=t;if(i?.type==="css-comment"&&i.text.trim()==="prettier-ignore"?r.push(e.originalText.slice(P(n),R(n))):r.push(s()),t.isLast)return;let{next:o}=t;o.type==="css-comment"&&!Vt(e.originalText,P(o),{backwards:!0})&&!Re(n)||o.type==="css-atrule"&&o.name==="else"&&n.type!=="css-comment"?r.push(" "):(r.push(e.__isHTMLStyleAttribute?C:T),zt(e.originalText,R(n))&&!Re(n)&&r.push(T))},"nodes"),r}var De=Oc;function Cc(t,e,s){let{node:r}=t;switch(r.type){case"css-root":{let n=De(t,e,s),i=r.raws.after.trim();return i.startsWith(";")&&(i=i.slice(1).trim()),[r.frontMatter?[s("frontMatter"),T,r.nodes.length>0?T:""]:"",n,i?` ${i}`:"",r.nodes.length>0?T:""]}case"css-comment":{let n=r.inline||r.raws.inline,i=e.originalText.slice(P(r),R(r));return n?i.trimEnd():i}case"css-rule":return[s("selector"),r.important?" !important":"",r.nodes?[r.selector?.type==="selector-unknown"&&Le(r.selector.value)?C:r.selector?" ":"","{",r.nodes.length>0?L([T,De(t,e,s)]):"",T,"}",ei(r)?";":""]:";"];case"css-decl":{let n=t.parent,{between:i}=r.raws,o=i.trim(),u=o===":",a=typeof r.value=="string"&&/^ *$/u.test(r.value),l=typeof r.value=="string"?r.value:s("value");return l=ui(r)?an(l):l,!u&&Le(o)&&!t.call(()=>is(t),"value","group","group")&&(l=L([T,le(l)])),[E(0,r.raws.before,/[\s;]/gu,""),n.type==="css-atrule"&&n.variable||Qn(t)?r.prop:Ie(r.prop),o.startsWith("//")?" ":"",o,r.extend||a?"":" ",e.parser==="less"&&r.extend&&r.selector?["extend(",s("selector"),")"]:"",l,r.raws.important?r.raws.important.replace(/\s*!\s*important/iu," !important"):r.important?" !important":"",r.raws.scssDefault?r.raws.scssDefault.replace(/\s*!default/iu," !default"):r.scssDefault?" !default":"",r.raws.scssGlobal?r.raws.scssGlobal.replace(/\s*!global/iu," !global"):r.scssGlobal?" !global":"",r.nodes?[" {",L([M,De(t,e,s)]),M,"}"]:oi(r)&&!n.raws.semicolon&&e.originalText[R(r)-1]!==";"?"":e.__isHTMLStyleAttribute&&t.isLast?Nt(";"):";"]}case"css-atrule":{let n=t.parent,i=Bt(r)&&!n.raws.semicolon&&e.originalText[R(r)-1]!==";";if(e.parser==="less"){if(r.mixin)return[s("selector"),r.important?" !important":"",i?"":";"];if(r.function)return[r.name,typeof r.params=="string"?r.params:s("params"),i?"":";"];if(r.variable)return["@",r.name,": ",r.value?s("value"):"",r.raws.between.trim()?r.raws.between.trim()+" ":"",r.nodes?["{",L([r.nodes.length>0?M:"",De(t,e,s)]),M,"}"]:"",i?"":";"]}let o=r.name==="import"&&r.params?.type==="value-unknown"&&r.params.value.endsWith(";");return["@",es(r)||r.name.endsWith(":")||Bt(r)?r.name:Ie(r.name),r.params?[es(r)?"":Bt(r)?r.raws.afterName===""?"":r.name.endsWith(":")?" ":/^\s*\n\s*\n/u.test(r.raws.afterName)?[T,T]:/^\s*\n/u.test(r.raws.afterName)?T:" ":" ",typeof r.params=="string"?r.params:s("params")]:"",r.selector?L([" ",s("selector")]):"",r.value?D([" ",s("value"),Je(r,e)?li(r)?" ":C:""]):r.name==="else"?" ":"",r.nodes?[Je(r,e)?"":r.selector&&!r.selector.nodes&&typeof r.selector.value=="string"&&Le(r.selector.value)||!r.selector&&typeof r.params=="string"&&Le(r.params)?C:" ","{",L([r.nodes.length>0?M:"",De(t,e,s)]),M,"}"]:i||o?"":";"]}case"media-query-list":{let n=[];return t.each(({node:i})=>{i.type==="media-query"&&i.value===""||n.push(s())},"nodes"),D(L(Y(C,n)))}case"media-query":return[Y(" ",t.map(s,"nodes")),t.isLast?"":","];case"media-type":return _e(V(r.value,e));case"media-feature-expression":return r.nodes?["(",...t.map(s,"nodes"),")"]:r.value;case"media-feature":return Ie(V(E(0,r.value,/ +/gu," "),e));case"media-colon":return[r.value," "];case"media-value":return _e(V(r.value,e));case"media-keyword":return V(r.value,e);case"media-url":return V(E(0,E(0,r.value,/^url\(\s+/giu,"url("),/\s+\)$/gu,")"),e);case"media-unknown":return r.value;case"selector-root":return D([we(t,"custom-selector")?[t.findAncestor(n=>n.type==="css-atrule").customSelector,C]:"",Y([",",we(t,["extend","custom-selector","nest"])?C:T],t.map(s,"nodes"))]);case"selector-selector":{let n=r.nodes.length>2;return D((n?L:i=>i)(t.map(s,"nodes")))}case"selector-comment":return r.value;case"selector-string":return V(r.value,e);case"selector-tag":return[r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",t.previous?.type==="selector-nesting"?r.value:_e(Kn(t,r.value)?r.value.toLowerCase():r.value)];case"selector-id":return["#",r.value];case"selector-class":return[".",_e(V(r.value,e))];case"selector-attribute":return["[",r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",r.attribute.trim(),r.operator??"",r.value?wi(V(r.value.trim(),e),e):"",r.insensitive?" i":"","]"];case"selector-combinator":{if(r.value==="+"||r.value===">"||r.value==="~"||r.value===">>>"){let o=t.parent;return[o.type==="selector-selector"&&o.nodes[0]===r?"":C,r.value,t.isLast?"":" "]}let n=r.value.trim().startsWith("(")?C:"",i=_e(V(r.value.trim(),e))||C;return[n,i]}case"selector-universal":return[r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",r.value];case"selector-pseudo":return[Ie(r.value),ce(r.nodes)?D(["(",L([M,Y([",",C],t.map(s,"nodes"))]),M,")"]):""];case"selector-nesting":return r.value;case"selector-unknown":{if(t.findAncestor(u=>u.type==="css-rule")?.isSCSSNesterProperty)return _e(V(Ie(r.value),e));let i=t.parent;if(i.raws?.selector){let u=P(i),a=u+i.raws.selector.length;return e.originalText.slice(u,a).trim()}let o=t.grandparent;if(i.type==="value-paren_group"&&o?.type==="value-func"&&o.value==="selector"){let u=R(i.open)+1,a=P(i.close),l=e.originalText.slice(u,a).trim();return Le(l)?[Ne,l]:l}return r.value}case"value-value":case"value-root":return s("group");case"value-comment":return e.originalText.slice(P(r),R(r));case"value-comma_group":return mi(t,e,s);case"value-paren_group":return Ei(t,e,s);case"value-func":return[r.value,we(t,"supports")&&fi(r)?" ":"",s("group")];case"value-paren":return r.value;case"value-number":return[ns(r.value),ss(r.unit)];case"value-operator":return r.value;case"value-word":return r.isColor&&r.isHex||Hn(r.value)?r.value.toLowerCase():r.value;case"value-colon":{let{previous:n}=t;return D([r.value,typeof n?.value=="string"&&n.value.endsWith("\\")||qe(t,"url")?"":C])}case"value-string":return Pt(r.raws.quote+r.value+r.raws.quote,e);case"value-atword":return["@",r.value];case"value-unicode-range":return r.value;case"value-unknown":return r.value;case"front-matter":case"value-comma":default:throw new mn(r,"PostCSS")}}var Nc={features:{experimental_frontMatterSupport:{massageAstNode:!0,embed:!0,print:!0}},print:Cc,embed:vn,insertPragma:zn,massageAstNode:gn,getVisitorKeys:bn},Si=Nc;var ki=[{name:"CSS",type:"markup",aceMode:"css",extensions:[".css",".wxss"],tmScope:"source.css",codemirrorMode:"css",codemirrorMimeType:"text/css",parsers:["css"],vscodeLanguageIds:["css"],linguistLanguageId:50},{name:"PostCSS",type:"markup",aceMode:"text",extensions:[".pcss",".postcss"],tmScope:"source.postcss",group:"CSS",parsers:["css"],vscodeLanguageIds:["postcss"],linguistLanguageId:262764437},{name:"Less",type:"markup",aceMode:"less",extensions:[".less"],tmScope:"source.css.less",aliases:["less-css"],codemirrorMode:"css",codemirrorMimeType:"text/x-less",parsers:["less"],vscodeLanguageIds:["less"],linguistLanguageId:198},{name:"SCSS",type:"markup",aceMode:"scss",extensions:[".scss"],tmScope:"source.css.scss",codemirrorMode:"css",codemirrorMimeType:"text/x-scss",parsers:["scss"],vscodeLanguageIds:["scss"],linguistLanguageId:329}];var Ti={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Pc={singleQuote:Ti.singleQuote},Ai=Pc;var en={};sn(en,{css:()=>Vy,less:()=>zy,scss:()=>jy});var ml=Te(ht(),1),yl=Te(Lo(),1),gl=Te(ma(),1);function gp(t,e){let s=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(s,e)}var ya=gp;function wp(t){return t!==null&&typeof t=="object"}var Se=wp;var Ea=Te(ba(),1);function te(t,e,s){if(Se(t)){delete t.parent;for(let r in t)te(t[r],e,s),r==="type"&&typeof t[r]=="string"&&!t[r].startsWith(e)&&(!s||!s.test(t[r]))&&(t[r]=e+t[r])}return t}function Bs(t){if(Se(t)){delete t.parent;for(let e in t)Bs(t[e]);!Array.isArray(t)&&t.value&&!t.type&&(t.type="unknown")}return t}var Np=Ea.default.default;function Pp(t){let e;try{e=Np(t)}catch{return{type:"selector-unknown",value:t}}return te(Bs(e),"media-")}var Sa=Pp;var wu=Te(gu(),1);function Vm(t){if(/\/[/*]/u.test(E(0,t,/"[^"]+"|'[^']+'/gu,"")))return{type:"selector-unknown",value:t.trim()};let e;try{new wu.default(s=>{e=s}).process(t)}catch{return{type:"selector-unknown",value:t}}return te(e,"selector-")}var se=Vm;var fl=Te(il(),1);var Iy=t=>{for(;t.parent;)t=t.parent;return t},Yr=Iy;function qy(t){return Yr(t).text.slice(t.group.open.sourceIndex+1,t.group.close.sourceIndex).trim()}var ol=qy;function Ly(t){if(ce(t)){for(let e=t.length-1;e>0;e--)if(t[e].type==="word"&&t[e].value==="{"&&t[e-1].type==="word"&&t[e-1].value.endsWith("#"))return!0}return!1}var al=Ly;function Dy(t){return t.some(e=>e.type==="string"||e.type==="func"&&!e.value.endsWith("\\"))}var ul=Dy;function My(t,e){return!!(e.parser==="scss"&&t?.type==="word"&&t.value.startsWith("$"))}var ll=My;var cl=t=>t.type==="paren"&&t.value===")";function By(t,e){let{nodes:s}=t,r={open:null,close:null,groups:[],type:"paren_group"},n=[r],i=r,o={groups:[],type:"comma_group"},u=[o];for(let a=0;a<s.length;++a){let l=s[a];if(e.parser==="scss"&&l.type==="number"&&l.unit===".."&&l.value.endsWith(".")&&(l.value=l.value.slice(0,-1),l.unit="..."),l.type==="func"&&l.value==="selector"&&(l.group.groups=[se(Yr(t).text.slice(l.group.open.sourceIndex+1,l.group.close.sourceIndex))]),l.type==="func"&&l.value==="url"){let f=l.group?.groups??[],h=[];for(let c=0;c<f.length;c++){let g=f[c];g.type==="comma_group"?h=[...h,...g.groups]:h.push(g)}(al(h)||!ul(h)&&!ll(h[0],e))&&(l.group.groups=[ol(l)])}if(l.type==="paren"&&l.value==="(")r={open:l,close:null,groups:[],type:"paren_group"},n.push(r),o={groups:[],type:"comma_group"},u.push(o);else if(cl(l)){if(o.groups.length>0&&r.groups.push(o),r.close=l,u.length===1)throw new Error("Unbalanced parenthesis");u.pop(),o=G(0,u,-1),o.groups.push(r),n.pop(),r=G(0,n,-1)}else if(l.type==="comma"){if(a===s.length-3&&s[a+1].type==="comment"&&cl(s[a+2]))continue;r.groups.push(o),o={groups:[],type:"comma_group"},u[u.length-1]=o}else o.groups.push(l)}return o.groups.length>0&&r.groups.push(o),i}function Vr(t){return t.type==="paren_group"&&!t.open&&!t.close&&t.groups.length===1||t.type==="comma_group"&&t.groups.length===1?Vr(t.groups[0]):t.type==="paren_group"||t.type==="comma_group"?{...t,groups:t.groups.map(Vr)}:t}function pl(t,e){if(Se(t))for(let s in t)s!=="parent"&&(pl(t[s],e),s==="nodes"&&(t.group=Vr(By(t,e)),delete t[s]));return t}function Uy(t,e){if(e.parser==="less"&&t.startsWith("~`"))return{type:"value-unknown",value:t};let s=null;try{s=new fl.default(t,{loose:!0}).parse()}catch{return{type:"value-unknown",value:t}}s.text=t;let r=pl(s,e);return te(r,"value-",/^selector-/u)}var de=Uy;var Fy=new Set(["import","use","forward"]);function $y(t){return Fy.has(t)}var hl=$y;function Wy(t,e){return e.parser!=="scss"||!t.selector?!1:t.selector.replace(/\/\*.*?\*\//u,"").replace(/\/\/.*\n/u,"").trim().endsWith(":")}var dl=Wy;var Gy=/(\s*)(!default).*$/u,Yy=/(\s*)(!global).*$/u;function wl(t,e){if(Se(t)){delete t.parent;for(let i in t)wl(t[i],e);if(!t.type)return t;if(t.raws??(t.raws={}),t.type==="css-decl"&&typeof t.prop=="string"&&t.prop.startsWith("--")&&typeof t.value=="string"&&t.value.startsWith("{")){let i;if(t.value.trimEnd().endsWith("}")){let o=e.originalText.slice(0,t.source.start.offset),u="a".repeat(t.prop.length)+e.originalText.slice(t.source.start.offset+t.prop.length,t.source.end.offset),a=E(0,o,/[^\n]/gu," ")+u,l;e.parser==="scss"?l=_l:e.parser==="less"?l=xl:l=vl;let f;try{f=l(a,{...e})}catch{}f?.nodes?.length===1&&f.nodes[0].type==="css-rule"&&(i=f.nodes[0].nodes)}return i?t.value={type:"css-rule",nodes:i}:t.value={type:"value-unknown",value:t.raws.value.raw},t}let s="";typeof t.selector=="string"&&(s=t.raws.selector?t.raws.selector.scss??t.raws.selector.raw:t.selector,t.raws.between&&t.raws.between.trim().length>0&&(s+=t.raws.between),t.raws.selector=s);let r="";typeof t.value=="string"&&(r=t.raws.value?t.raws.value.scss??t.raws.value.raw:t.value,t.raws.value=r.trim());let n="";if(typeof t.params=="string"&&(n=t.raws.params?t.raws.params.scss??t.raws.params.raw:t.params,t.raws.afterName&&t.raws.afterName.trim().length>0&&(n=t.raws.afterName+n),t.raws.between&&t.raws.between.trim().length>0&&(n=n+t.raws.between),n=n.trim(),t.raws.params=n),s.trim().length>0)return s.startsWith("@")&&s.endsWith(":")?t:t.mixin?(t.selector=de(s,e),t):(dl(t,e)&&(t.isSCSSNesterProperty=!0),t.selector=se(s),t);if(r.trim().length>0){let i=r.match(Gy);i&&(r=r.slice(0,i.index),t.scssDefault=!0,i[0].trim()!=="!default"&&(t.raws.scssDefault=i[0]));let o=r.match(Yy);if(o&&(r=r.slice(0,o.index),t.scssGlobal=!0,o[0].trim()!=="!global"&&(t.raws.scssGlobal=o[0])),r.startsWith("progid:"))return{type:"value-unknown",value:r};t.value=de(r,e)}if(e.parser==="less"&&t.type==="css-decl"&&r.startsWith("extend(")&&(t.extend||(t.extend=t.raws.between===":"),t.extend&&!t.selector&&(delete t.value,t.selector=se(r.slice(7,-1)))),t.type==="css-atrule"){if(e.parser==="less"){if(t.mixin){let i=t.raws.identifier+t.name+t.raws.afterName+t.raws.params;return t.selector=se(i),delete t.params,t}if(t.function)return t}if(e.parser==="css"&&t.name==="custom-selector"){let i=t.params.match(/:--\S+\s+/u)[0].trim();return t.customSelector=i,t.selector=se(t.params.slice(i.length).trim()),delete t.params,t}if(e.parser==="less"){if(t.name.includes(":")){t.variable=!0;let i=t.name.split(":");t.name=i[0];let o=i.slice(1).join(":");t.params&&(o+=t.params),t.value=de(o,e)}if(!["page","nest","keyframes"].includes(t.name)&&t.params?.[0]===":"){t.variable=!0;let i=t.params.slice(1);i&&(t.value=de(i,e)),t.raws.afterName+=":"}if(t.variable)return delete t.params,t.value||delete t.value,t}}if(t.type==="css-atrule"&&n.length>0){let{name:i}=t,o=t.name.toLowerCase();return i==="warn"||i==="error"?(t.params={type:"media-unknown",value:n},t):i==="extend"||i==="nest"?(t.selector=se(n),delete t.params,t):i==="at-root"?(/^\(\s*(?:without|with)\s*:.+\)$/su.test(n)?t.params=de(n,e):(t.selector=se(n),delete t.params),t):hl(o)?(t.import=!0,delete t.filename,t.params=de(n,e),t):["namespace","supports","if","else","for","each","while","debug","mixin","include","function","return","define-mixin","add-mixin"].includes(i)?(n=n.replace(/(\$\S+?)(\s+)?\.{3}/u,"$1...$2"),n=n.replace(/^(?!if)([^"'\s(]+)(\s+)\(/u,"$1($2"),t.value=de(n,e),delete t.params,t):["media","custom-media"].includes(o)?n.includes("#{")?{type:"media-unknown",value:n}:(t.params=Sa(n),t):(t.params=n,t)}}return t}function Js(t,e,s){let{frontMatter:r,content:n}=ge(e),i;try{i=t(n,{map:!1})}catch(o){let{name:u,reason:a,line:l,column:f}=o;throw typeof l!="number"?o:ya(`${u}: ${a}`,{loc:{start:{line:l,column:f}},cause:o})}return s.originalText=e,i=wl(te(i,"css-"),s),Xr(i,e),r&&(i.frontMatter={...r,type:"front-matter",source:{startOffset:r.start.index,endOffset:r.end.index}}),i}function vl(t,e={}){return Js(ml.default.default,t,e)}function xl(t,e={}){return Js(s=>yl.default.parse(An(s)),t,e)}function _l(t,e={}){return Js(gl.default,t,e)}var Zs={astFormat:"postcss",hasPragma:Yn,hasIgnorePragma:Vn,locStart:P,locEnd:R},Vy={...Zs,parse:vl},zy={...Zs,parse:xl},jy={...Zs,parse:_l};var Hy={postcss:Si};return Al(Ky);});
|
package/plugins/postcss.mjs
CHANGED
|
@@ -55,7 +55,7 @@ $1 $2
|
|
|
55
55
|
|
|
56
56
|
`)+i}var Gn=t=>Fn(ge(t).content),Yn=t=>$n(ge(t).content),Vn=t=>{let{frontMatter:e,content:s}=ge(t);return(e?e.raw+`
|
|
57
57
|
|
|
58
|
-
`:"")+Wn(s)};var cc=new Set(["red","green","blue","alpha","a","rgb","hue","h","saturation","s","lightness","l","whiteness","w","blackness","b","tint","shade","blend","blenda","contrast","hsl","hsla","hwb","hwba"]);function zn(t){return t.findAncestor(e=>e.type==="css-decl")?.prop?.toLowerCase()}var fc=new Set(["initial","inherit","unset","revert"]);function jn(t){return fc.has(t.toLowerCase())}function Hn(t,e){return t.findAncestor(r=>r.type==="css-atrule")?.name?.toLowerCase().endsWith("keyframes")&&["from","to"].includes(e.toLowerCase())}function Ie(t){return t.includes("$")||t.includes("@")||t.includes("#")||t.startsWith("%")||t.startsWith("--")||t.startsWith(":--")||t.includes("(")&&t.includes(")")?t:t.toLowerCase()}function qe(t,e){return t.findAncestor(r=>r.type==="value-func")?.value?.toLowerCase()===e}function Kn(t){return t.hasAncestor(e=>{if(e.type!=="css-rule")return!1;let s=e.raws?.selector;return s&&(s.startsWith(":import")||s.startsWith(":export"))})}function we(t,e){let s=Array.isArray(e)?e:[e],r=t.findAncestor(n=>n.type==="css-atrule");return r&&s.includes(r.name.toLowerCase())}function Qn(t){let{node:e}=t;return e.groups[0]?.value==="url"&&e.groups.length===2&&t.findAncestor(s=>s.type==="css-atrule")?.name==="import"}function Xn(t){return t.type==="value-func"&&t.value.toLowerCase()==="url"}function Jn(t){return t.type==="value-func"&&t.value.toLowerCase()==="var"}function Zn(t){let{selector:e}=t;return e?typeof e=="string"&&/^@.+:.*$/u.test(e)||e.value&&/^@.+:.*$/u.test(e.value):!1}function ei(t){return t.type==="value-word"&&["from","through","end"].includes(t.value)}function ti(t){return t.type==="value-word"&&["and","or","not"].includes(t.value)}function ri(t){return t.type==="value-word"&&t.value==="in"}function Lt(t){return t.type==="value-operator"&&t.value==="*"}function ve(t){return t?.type==="value-operator"&&t.value==="/"}function J(t){return t.type==="value-operator"&&t.value==="+"}function xe(t){return t.type==="value-operator"&&t.value==="-"}function pc(t){return t.type==="value-operator"&&t.value==="%"}function Dt(t){return Lt(t)||ve(t)||J(t)||xe(t)||pc(t)}function si(t){return t.type==="value-word"&&["==","!="].includes(t.value)}function ni(t){return t.type==="value-word"&&["<",">","<=",">="].includes(t.value)}function Je(t,e){return e.parser==="scss"&&t.type==="css-atrule"&&["if","else","for","each","while"].includes(t.name)}function es(t){return t.raws?.params&&/^\(\s*\)$/u.test(t.raws.params)}function Mt(t){return t.name.startsWith("prettier-placeholder")}function ii(t){return t.prop.startsWith("@prettier-placeholder")}function oi(t,e){return t.value==="$$"&&t.type==="value-func"&&e?.type==="value-word"&&!e.raws.before}function ai(t){return t.value?.type==="value-root"&&t.value.group?.type==="value-value"&&t.prop.toLowerCase()==="composes"}function ui(t){return t.value?.group?.group?.type==="value-paren_group"&&t.value.group.group.open!==null&&t.value.group.group.close!==null}function Z(t){return t?.raws?.before===""}function Bt(t){return t.type==="value-comma_group"&&t.groups?.[1]?.type==="value-colon"}function Zr(t){return t.type==="value-paren_group"&&t.groups?.[0]&&Bt(t.groups[0])}function ts(t,e){if(e.parser!=="scss")return!1;let{node:s}=t;if(s.groups.length===0)return!1;let r=t.grandparent;return!Zr(s)&&!(
|
|
58
|
+
`:"")+Wn(s)};var cc=new Set(["red","green","blue","alpha","a","rgb","hue","h","saturation","s","lightness","l","whiteness","w","blackness","b","tint","shade","blend","blenda","contrast","hsl","hsla","hwb","hwba"]);function zn(t){return t.findAncestor(e=>e.type==="css-decl")?.prop?.toLowerCase()}var fc=new Set(["initial","inherit","unset","revert"]);function jn(t){return fc.has(t.toLowerCase())}function Hn(t,e){return t.findAncestor(r=>r.type==="css-atrule")?.name?.toLowerCase().endsWith("keyframes")&&["from","to"].includes(e.toLowerCase())}function Ie(t){return t.includes("$")||t.includes("@")||t.includes("#")||t.startsWith("%")||t.startsWith("--")||t.startsWith(":--")||t.includes("(")&&t.includes(")")?t:t.toLowerCase()}function qe(t,e){return t.findAncestor(r=>r.type==="value-func")?.value?.toLowerCase()===e}function Kn(t){return t.hasAncestor(e=>{if(e.type!=="css-rule")return!1;let s=e.raws?.selector;return s&&(s.startsWith(":import")||s.startsWith(":export"))})}function we(t,e){let s=Array.isArray(e)?e:[e],r=t.findAncestor(n=>n.type==="css-atrule");return r&&s.includes(r.name.toLowerCase())}function Qn(t){let{node:e}=t;return e.groups[0]?.value==="url"&&e.groups.length===2&&t.findAncestor(s=>s.type==="css-atrule")?.name==="import"}function Xn(t){return t.type==="value-func"&&t.value.toLowerCase()==="url"}function Jn(t){return t.type==="value-func"&&t.value.toLowerCase()==="var"}function Zn(t){let{selector:e}=t;return e?typeof e=="string"&&/^@.+:.*$/u.test(e)||e.value&&/^@.+:.*$/u.test(e.value):!1}function ei(t){return t.type==="value-word"&&["from","through","end"].includes(t.value)}function ti(t){return t.type==="value-word"&&["and","or","not"].includes(t.value)}function ri(t){return t.type==="value-word"&&t.value==="in"}function Lt(t){return t.type==="value-operator"&&t.value==="*"}function ve(t){return t?.type==="value-operator"&&t.value==="/"}function J(t){return t.type==="value-operator"&&t.value==="+"}function xe(t){return t.type==="value-operator"&&t.value==="-"}function pc(t){return t.type==="value-operator"&&t.value==="%"}function Dt(t){return Lt(t)||ve(t)||J(t)||xe(t)||pc(t)}function si(t){return t.type==="value-word"&&["==","!="].includes(t.value)}function ni(t){return t.type==="value-word"&&["<",">","<=",">="].includes(t.value)}function Je(t,e){return e.parser==="scss"&&t.type==="css-atrule"&&["if","else","for","each","while"].includes(t.name)}function es(t){return t.raws?.params&&/^\(\s*\)$/u.test(t.raws.params)}function Mt(t){return t.name.startsWith("prettier-placeholder")}function ii(t){return t.prop.startsWith("@prettier-placeholder")}function oi(t,e){return t.value==="$$"&&t.type==="value-func"&&e?.type==="value-word"&&!e.raws.before}function ai(t){return t.value?.type==="value-root"&&t.value.group?.type==="value-value"&&t.prop.toLowerCase()==="composes"}function ui(t){return t.value?.group?.group?.type==="value-paren_group"&&t.value.group.group.open!==null&&t.value.group.group.close!==null}function Z(t){return t?.raws?.before===""}function Bt(t){return t.type==="value-comma_group"&&t.groups?.[1]?.type==="value-colon"}function Zr(t){return t.type==="value-paren_group"&&t.groups?.[0]&&Bt(t.groups[0])}function ts(t,e){if(e.parser!=="scss")return!1;let{node:s}=t;if(s.groups.length===0)return!1;let r=t.parent;if(r&&r.type==="value-func"&&r.value==="if")return!1;let n=t.grandparent;return!Zr(s)&&!(n&&Zr(n))?!1:!!(t.findAncestor(o=>o.type==="css-decl")?.prop?.startsWith("$")||Zr(n)||n.type==="value-func")}function Ze(t){return t.type==="value-comment"&&t.inline}function Ut(t){return t.type==="value-word"&&t.value==="#"}function rs(t){return t.type==="value-word"&&t.value==="{"}function Ft(t){return t.type==="value-word"&&t.value==="}"}function et(t){return["value-word","value-atword"].includes(t.type)}function $t(t){return t?.type==="value-colon"}function li(t,e){if(!Bt(e))return!1;let{groups:s}=e,r=s.indexOf(t);return r===-1?!1:$t(s[r+1])}function ci(t){return t.value&&["not","and","or"].includes(t.value.toLowerCase())}function fi(t){return t.type!=="value-func"?!1:cc.has(t.value.toLowerCase())}function Le(t){return/\/\//u.test(t.split(/[\n\r]/u).pop())}function tt(t){return t?.type==="value-atword"&&t.value.startsWith("prettier-placeholder-")}function pi(t,e){if(t.open?.value!=="("||t.close?.value!==")"||t.groups.some(s=>s.type!=="value-comma_group"))return!1;if(e.type==="value-comma_group"){let s=e.groups.indexOf(t)-1,r=e.groups[s];if(r?.type==="value-word"&&r.value==="with")return!0}return!1}function rt(t){return t.type==="value-paren_group"&&t.open?.value==="("&&t.close?.value===")"}function hc(t,e,s){let{node:r}=t,n=t.parent,i=t.grandparent,o=zn(t),u=o&&n.type==="value-value"&&(o==="grid"||o.startsWith("grid-template")),a=t.findAncestor(p=>p.type==="css-atrule"),l=a&&Je(a,e),f=r.groups.some(p=>Ze(p)),h=t.map(s,"groups"),c=[""],g=qe(t,"url"),b=!1,d=!1;for(let p=0;p<r.groups.length;++p){let m=r.groups[p-1],y=r.groups[p],v=r.groups[p+1],O=r.groups[p+2];if(Ze(y)&&!v){c.push([c.pop(),ln([" ",h[p]])]);continue}if(c.push([c.pop(),h[p]]),g){(v&&J(v)||J(y))&&c.push([c.pop()," "]);continue}if(we(t,"forward")&&y.type==="value-word"&&y.value&&m!==void 0&&m.type==="value-word"&&m.value==="as"&&v.type==="value-operator"&&v.value==="*"||we(t,"utility")&&y.type==="value-word"&&v&&v.type==="value-operator"&&v.value==="*"||!v||y.type==="value-word"&&tt(v)&&R(y)===P(v))continue;if(y.type==="value-string"&&y.quoted){let k=y.value.lastIndexOf("#{"),N=y.value.lastIndexOf("}");k!==-1&&N!==-1?b=k>N:k!==-1?b=!0:N!==-1&&(b=!1)}if(b||$t(y)||$t(v)||y.type==="value-atword"&&(y.value===""||y.value.endsWith("["))||v.type==="value-word"&&v.value.startsWith("]")||y.value==="~"||e.parser==="less"&&(v?.type==="value-word"&&v.value==="["||y.type==="value-word"&&y.value==="["&&(v?.type==="value-atword"||v?.type==="value-word")||y.type==="value-word"&&y.value==="]["&&v?.type==="value-word")||y.type!=="value-string"&&y.value&&y.value.includes("\\")&&v&&v.type!=="value-comment"||m?.value&&m.value.indexOf("\\")===m.value.length-1&&y.type==="value-operator"&&y.value==="/"||y.value==="\\"||oi(y,v)||Ut(y)||rs(y)||Ft(v)||rs(v)&&Z(v)||Ft(y)&&Z(v)||y.value==="--"&&Ut(v))continue;let q=Dt(y),H=Dt(v);if((q&&Ut(v)||H&&Ft(y))&&Z(v)||!m&&ve(y)||qe(t,"calc")&&(J(y)||J(v)||xe(y)||xe(v))&&Z(v))continue;let ne=(J(y)||xe(y))&&p===0&&(v.type==="value-number"||v.isHex)&&i&&fi(i)&&!Z(v);if(e.parser==="scss"&&q&&y.value==="-"&&v.type==="value-func"&&R(y)!==P(v)){c.push([c.pop()," "]);continue}let W=O?.type==="value-func"||O&&et(O)||y.type==="value-func"||et(y),A=v.type==="value-func"||et(v)||m?.type==="value-func"||m&&et(m);if(!(!(Lt(v)||Lt(y))&&!qe(t,"calc")&&!ne&&(ve(v)&&!W||ve(y)&&!A||J(v)&&!W||J(y)&&!A||xe(v)||xe(y))&&(Z(v)||q&&(!m||m&&Dt(m))))&&!((e.parser==="scss"||e.parser==="less")&&q&&y.value==="-"&&rt(v)&&R(y)===P(v.open)&&v.open.value==="(")){if(Ze(y)){if(n.type==="value-paren_group"){c.push(le(T),"");continue}c.push(T,"");continue}if(l&&(si(v)||ni(v)||ti(v)||ri(y)||ei(y))){c.push([c.pop()," "]);continue}if(a&&a.name.toLowerCase()==="namespace"){c.push([c.pop()," "]);continue}if(u){y.source&&v.source&&y.source.start.line!==v.source.start.line?(c.push(T,""),d=!0):c.push([c.pop()," "]);continue}if(!(o&&(o==="font"||o.startsWith("--"))&&(ve(v)&&Z(v)&&hi(y)||ve(y)&&Z(y)&&hi(m)))){if(H){c.push([c.pop()," "]);continue}if(v?.value!=="..."&&!(tt(y)&&tt(v)&&R(y)===P(v))){if(tt(y)&&rt(v)&&R(y)===P(v.open)){c.push(M,"");continue}if(y.value==="with"&&rt(v)){c=[[Pe(c)," "]];continue}if(!(y.value?.endsWith("#")&&v.value==="{"&&rt(v.group))&&!(Ze(v)&&!O)){if(!a&&y.type==="value-comment"&&!y.inline&&r.groups.slice(0,p).every(k=>k.type==="value-comment")){c.push(le(C),"");continue}c.push(C,"")}}}}}return f&&c.push([c.pop(),Ne]),d&&c.unshift("",T),l?D(L(c)):Qn(t)?D(Pe(c)):D(L(Pe(c)))}function hi(t){if(t?.type==="value-number")return!0;if(t?.type!=="value-func")return!1;let e=t.value.toLowerCase();return e==="var"||e==="calc"||e==="min"||e==="max"||e==="clamp"||e.startsWith("--")}var di=hc;function dc(t){return t.length===1?t:t.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(?=\d)/u,"$1$2").replace(/^([+-]?[\d.]+)e[+-]?0+$/u,"$1").replace(/^([+-])?\./u,"$10.").replace(/(\.\d+?)0+(?=e|$)/u,"$1").replace(/\.(?=e|$)/u,"")}var mi=dc;var Wt=new Map([["em","em"],["rem","rem"],["ex","ex"],["rex","rex"],["cap","cap"],["rcap","rcap"],["ch","ch"],["rch","rch"],["ic","ic"],["ric","ric"],["lh","lh"],["rlh","rlh"],["vw","vw"],["svw","svw"],["lvw","lvw"],["dvw","dvw"],["vh","vh"],["svh","svh"],["lvh","lvh"],["dvh","dvh"],["vi","vi"],["svi","svi"],["lvi","lvi"],["dvi","dvi"],["vb","vb"],["svb","svb"],["lvb","lvb"],["dvb","dvb"],["vmin","vmin"],["svmin","svmin"],["lvmin","lvmin"],["dvmin","dvmin"],["vmax","vmax"],["svmax","svmax"],["lvmax","lvmax"],["dvmax","dvmax"],["cm","cm"],["mm","mm"],["q","Q"],["in","in"],["pt","pt"],["pc","pc"],["px","px"],["deg","deg"],["grad","grad"],["rad","rad"],["turn","turn"],["s","s"],["ms","ms"],["hz","Hz"],["khz","kHz"],["dpi","dpi"],["dpcm","dpcm"],["dppx","dppx"],["x","x"],["cqw","cqw"],["cqh","cqh"],["cqi","cqi"],["cqb","cqb"],["cqmin","cqmin"],["cqmax","cqmax"],["fr","fr"]]);function ss(t){let e=t.toLowerCase();return Wt.has(e)?Wt.get(e):t}var yi=/(["'])(?:(?!\1)[^\\]|\\.)*\1/gsu,mc=/(?:\d*\.\d+|\d+\.?)(?:e[+-]?\d+)?/giu,yc=/[a-z]+/giu,gc=/[$@]?[_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/giu,wc=new RegExp(yi.source+`|(${gc.source})?(${mc.source})(${yc.source})?`,"giu");function V(t,e){return E(0,t,yi,s=>Nt(s,e))}function gi(t,e){let s=e.singleQuote?"'":'"',r="",n=t.match(/^(?<value>.+?)\s+(?<flag>[a-zA-Z])$/u);return n&&({value:t,flag:r}=n.groups),(t.includes('"')||t.includes("'")?t:s+t+s)+(r?` ${r}`:"")}function _e(t){return E(0,t,wc,(e,s,r,n,i)=>!r&&n&&(i??(i=""),i=i.toLowerCase(),!i||i==="n"||Wt.has(i))?ns(n)+(i?ss(i):""):e)}function ns(t){return mi(t).replace(/\.0(?=$|e)/u,"")}function wi(t){return t.trailingComma==="es5"||t.trailingComma==="all"}var vi=t=>t===`
|
|
59
59
|
`||t==="\r"||t==="\u2028"||t==="\u2029";function vc(t,e,s){let r=!!s?.backwards;if(e===!1)return!1;let n=t.charAt(e);if(r){if(t.charAt(e-1)==="\r"&&n===`
|
|
60
60
|
`)return e-2;if(vi(n))return e-1}else{if(n==="\r"&&t.charAt(e+1)===`
|
|
61
61
|
`)return e+2;if(vi(n))return e+1}return e}var Gt=vc;function xc(t,e,s={}){let r=It(t,s.backwards?e-1:e,s),n=Gt(t,r,s);return r!==n}var Yt=xc;function _c(t,e){if(e===!1)return!1;if(t.charAt(e)==="/"&&t.charAt(e+1)==="*"){for(let s=e+2;s<t.length;++s)if(t.charAt(s)==="*"&&t.charAt(s+1)==="/")return s+2}return e}var xi=_c;function bc(t,e){return e===!1?!1:t.charAt(e)==="/"&&t.charAt(e+1)==="/"?qt(t,e):e}var _i=bc;function Ec(t,e){let s=null,r=e;for(;r!==s;)s=r,r=bn(t,r),r=xi(t,r),r=It(t,r);return r=_i(t,r),r=Gt(t,r),r!==!1&&Yt(t,r)}var Vt=Ec;function Sc({node:t,parent:e},s){return!!(t.source&&s.originalText.slice(P(t),P(e.close)).trimEnd().endsWith(","))}function kc(t,e){return Jn(t.grandparent)&&Sc(t,e)?",":t.node.type!=="value-comment"&&!(t.node.type==="value-comma_group"&&t.node.groups.every(s=>s.type==="value-comment"))&&wi(e)&&t.callParent(()=>ts(t,e))?Ct(","):""}function bi(t,e,s){let{node:r,parent:n}=t,i=t.map(({node:g})=>typeof g=="string"?g:s(),"groups");if(n&&Xn(n)&&(r.groups.length===1||r.groups.length>0&&r.groups[0].type==="value-comma_group"&&r.groups[0].groups.length>0&&r.groups[0].groups[0].type==="value-word"&&r.groups[0].groups[0].value.startsWith("data:")))return[r.open?s("open"):"",Y(",",i),r.close?s("close"):""];if(!r.open){let g=is(t);ye(i);let b=Ac(Y(",",i),2),d=Y(g?T:C,b);return L(g?[T,d]:D([Tc(t)?M:"",Pe(d)]))}let o=t.map(({node:g,isLast:b,index:d})=>{let p=i[d];Bt(g)&&g.type==="value-comma_group"&&g.groups&&g.groups[0].type!=="value-paren_group"&&g.groups[2]?.type==="value-paren_group"&&ue(p)===oe&&ue(p.contents)===ie&&ue(p.contents.contents)===ae&&(p=D(le(p)));let m=[p,b?kc(t,e):","];if(!b&&g.type==="value-comma_group"&&ce(g.groups)){let y=G(0,g.groups,-1);!y.source&&y.close&&(y=y.close),y.source&&Vt(e.originalText,R(y))&&m.push(T)}return m},"groups"),u=li(r,n),a=pi(r,n),l=ts(t,e),f=a||l&&!u,h=a||u,c=D([r.open?s("open"):"",L([M,Y(C,o)]),M,r.close?s("close"):""],{shouldBreak:f});return h?le(c):c}function is(t){return t.match(e=>e.type==="value-paren_group"&&!e.open&&e.groups.some(s=>s.type==="value-comma_group"),(e,s)=>s==="group"&&e.type==="value-value",(e,s)=>s==="group"&&e.type==="value-root",(e,s)=>s==="value"&&(e.type==="css-decl"&&!e.prop.startsWith("--")||e.type==="css-atrule"&&e.variable))}function Tc(t){return t.match(e=>e.type==="value-paren_group"&&!e.open,(e,s)=>s==="group"&&e.type==="value-value",(e,s)=>s==="group"&&e.type==="value-root",(e,s)=>s==="value"&&e.type==="css-decl")}function Ac(t,e){let s=[];for(let r=0;r<t.length;r+=e)s.push(t.slice(r,r+e));return s}function Oc(t,e,s){let r=[];return t.each(()=>{let{node:n,previous:i}=t;if(i?.type==="css-comment"&&i.text.trim()==="prettier-ignore"?r.push(e.originalText.slice(P(n),R(n))):r.push(s()),t.isLast)return;let{next:o}=t;o.type==="css-comment"&&!Yt(e.originalText,P(o),{backwards:!0})&&!Re(n)||o.type==="css-atrule"&&o.name==="else"&&n.type!=="css-comment"?r.push(" "):(r.push(e.__isHTMLStyleAttribute?C:T),Vt(e.originalText,R(n))&&!Re(n)&&r.push(T))},"nodes"),r}var De=Oc;function Cc(t,e,s){let{node:r}=t;switch(r.type){case"css-root":{let n=De(t,e,s),i=r.raws.after.trim();return i.startsWith(";")&&(i=i.slice(1).trim()),[r.frontMatter?[s("frontMatter"),T,r.nodes.length>0?T:""]:"",n,i?` ${i}`:"",r.nodes.length>0?T:""]}case"css-comment":{let n=r.inline||r.raws.inline,i=e.originalText.slice(P(r),R(r));return n?i.trimEnd():i}case"css-rule":return[s("selector"),r.important?" !important":"",r.nodes?[r.selector?.type==="selector-unknown"&&Le(r.selector.value)?C:r.selector?" ":"","{",r.nodes.length>0?L([T,De(t,e,s)]):"",T,"}",Zn(r)?";":""]:";"];case"css-decl":{let n=t.parent,{between:i}=r.raws,o=i.trim(),u=o===":",a=typeof r.value=="string"&&/^ *$/u.test(r.value),l=typeof r.value=="string"?r.value:s("value");return l=ai(r)?on(l):l,!u&&Le(o)&&!t.call(()=>is(t),"value","group","group")&&(l=L([T,le(l)])),[E(0,r.raws.before,/[\s;]/gu,""),n.type==="css-atrule"&&n.variable||Kn(t)?r.prop:Ie(r.prop),o.startsWith("//")?" ":"",o,r.extend||a?"":" ",e.parser==="less"&&r.extend&&r.selector?["extend(",s("selector"),")"]:"",l,r.raws.important?r.raws.important.replace(/\s*!\s*important/iu," !important"):r.important?" !important":"",r.raws.scssDefault?r.raws.scssDefault.replace(/\s*!default/iu," !default"):r.scssDefault?" !default":"",r.raws.scssGlobal?r.raws.scssGlobal.replace(/\s*!global/iu," !global"):r.scssGlobal?" !global":"",r.nodes?[" {",L([M,De(t,e,s)]),M,"}"]:ii(r)&&!n.raws.semicolon&&e.originalText[R(r)-1]!==";"?"":e.__isHTMLStyleAttribute&&t.isLast?Ct(";"):";"]}case"css-atrule":{let n=t.parent,i=Mt(r)&&!n.raws.semicolon&&e.originalText[R(r)-1]!==";";if(e.parser==="less"){if(r.mixin)return[s("selector"),r.important?" !important":"",i?"":";"];if(r.function)return[r.name,typeof r.params=="string"?r.params:s("params"),i?"":";"];if(r.variable)return["@",r.name,": ",r.value?s("value"):"",r.raws.between.trim()?r.raws.between.trim()+" ":"",r.nodes?["{",L([r.nodes.length>0?M:"",De(t,e,s)]),M,"}"]:"",i?"":";"]}let o=r.name==="import"&&r.params?.type==="value-unknown"&&r.params.value.endsWith(";");return["@",es(r)||r.name.endsWith(":")||Mt(r)?r.name:Ie(r.name),r.params?[es(r)?"":Mt(r)?r.raws.afterName===""?"":r.name.endsWith(":")?" ":/^\s*\n\s*\n/u.test(r.raws.afterName)?[T,T]:/^\s*\n/u.test(r.raws.afterName)?T:" ":" ",typeof r.params=="string"?r.params:s("params")]:"",r.selector?L([" ",s("selector")]):"",r.value?D([" ",s("value"),Je(r,e)?ui(r)?" ":C:""]):r.name==="else"?" ":"",r.nodes?[Je(r,e)?"":r.selector&&!r.selector.nodes&&typeof r.selector.value=="string"&&Le(r.selector.value)||!r.selector&&typeof r.params=="string"&&Le(r.params)?C:" ","{",L([r.nodes.length>0?M:"",De(t,e,s)]),M,"}"]:i||o?"":";"]}case"media-query-list":{let n=[];return t.each(({node:i})=>{i.type==="media-query"&&i.value===""||n.push(s())},"nodes"),D(L(Y(C,n)))}case"media-query":return[Y(" ",t.map(s,"nodes")),t.isLast?"":","];case"media-type":return _e(V(r.value,e));case"media-feature-expression":return r.nodes?["(",...t.map(s,"nodes"),")"]:r.value;case"media-feature":return Ie(V(E(0,r.value,/ +/gu," "),e));case"media-colon":return[r.value," "];case"media-value":return _e(V(r.value,e));case"media-keyword":return V(r.value,e);case"media-url":return V(E(0,E(0,r.value,/^url\(\s+/giu,"url("),/\s+\)$/gu,")"),e);case"media-unknown":return r.value;case"selector-root":return D([we(t,"custom-selector")?[t.findAncestor(n=>n.type==="css-atrule").customSelector,C]:"",Y([",",we(t,["extend","custom-selector","nest"])?C:T],t.map(s,"nodes"))]);case"selector-selector":{let n=r.nodes.length>2;return D((n?L:i=>i)(t.map(s,"nodes")))}case"selector-comment":return r.value;case"selector-string":return V(r.value,e);case"selector-tag":return[r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",t.previous?.type==="selector-nesting"?r.value:_e(Hn(t,r.value)?r.value.toLowerCase():r.value)];case"selector-id":return["#",r.value];case"selector-class":return[".",_e(V(r.value,e))];case"selector-attribute":return["[",r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",r.attribute.trim(),r.operator??"",r.value?gi(V(r.value.trim(),e),e):"",r.insensitive?" i":"","]"];case"selector-combinator":{if(r.value==="+"||r.value===">"||r.value==="~"||r.value===">>>"){let o=t.parent;return[o.type==="selector-selector"&&o.nodes[0]===r?"":C,r.value,t.isLast?"":" "]}let n=r.value.trim().startsWith("(")?C:"",i=_e(V(r.value.trim(),e))||C;return[n,i]}case"selector-universal":return[r.namespace?[r.namespace===!0?"":r.namespace.trim(),"|"]:"",r.value];case"selector-pseudo":return[Ie(r.value),ce(r.nodes)?D(["(",L([M,Y([",",C],t.map(s,"nodes"))]),M,")"]):""];case"selector-nesting":return r.value;case"selector-unknown":{if(t.findAncestor(u=>u.type==="css-rule")?.isSCSSNesterProperty)return _e(V(Ie(r.value),e));let i=t.parent;if(i.raws?.selector){let u=P(i),a=u+i.raws.selector.length;return e.originalText.slice(u,a).trim()}let o=t.grandparent;if(i.type==="value-paren_group"&&o?.type==="value-func"&&o.value==="selector"){let u=R(i.open)+1,a=P(i.close),l=e.originalText.slice(u,a).trim();return Le(l)?[Ne,l]:l}return r.value}case"value-value":case"value-root":return s("group");case"value-comment":return e.originalText.slice(P(r),R(r));case"value-comma_group":return di(t,e,s);case"value-paren_group":return bi(t,e,s);case"value-func":return[r.value,we(t,"supports")&&ci(r)?" ":"",s("group")];case"value-paren":return r.value;case"value-number":return[ns(r.value),ss(r.unit)];case"value-operator":return r.value;case"value-word":return r.isColor&&r.isHex||jn(r.value)?r.value.toLowerCase():r.value;case"value-colon":{let{previous:n}=t;return D([r.value,typeof n?.value=="string"&&n.value.endsWith("\\")||qe(t,"url")?"":C])}case"value-string":return Nt(r.raws.quote+r.value+r.raws.quote,e);case"value-atword":return["@",r.value];case"value-unicode-range":return r.value;case"value-unknown":return r.value;case"front-matter":case"value-comma":default:throw new dn(r,"PostCSS")}}var Nc={features:{experimental_frontMatterSupport:{massageAstNode:!0,embed:!0,print:!0}},print:Cc,embed:wn,insertPragma:Vn,massageAstNode:yn,getVisitorKeys:_n},Ei=Nc;var Si=[{name:"CSS",type:"markup",aceMode:"css",extensions:[".css",".wxss"],tmScope:"source.css",codemirrorMode:"css",codemirrorMimeType:"text/css",parsers:["css"],vscodeLanguageIds:["css"],linguistLanguageId:50},{name:"PostCSS",type:"markup",aceMode:"text",extensions:[".pcss",".postcss"],tmScope:"source.postcss",group:"CSS",parsers:["css"],vscodeLanguageIds:["postcss"],linguistLanguageId:262764437},{name:"Less",type:"markup",aceMode:"less",extensions:[".less"],tmScope:"source.css.less",aliases:["less-css"],codemirrorMode:"css",codemirrorMimeType:"text/x-less",parsers:["less"],vscodeLanguageIds:["less"],linguistLanguageId:198},{name:"SCSS",type:"markup",aceMode:"scss",extensions:[".scss"],tmScope:"source.css.scss",codemirrorMode:"css",codemirrorMimeType:"text/x-scss",parsers:["scss"],vscodeLanguageIds:["scss"],linguistLanguageId:329}];var ki={bracketSpacing:{category:"Common",type:"boolean",default:!0,description:"Print spaces between brackets.",oppositeDescription:"Do not print spaces between brackets."},objectWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap object literals.",choices:[{value:"preserve",description:"Keep as multi-line, if there is a newline between the opening brace and first property."},{value:"collapse",description:"Fit to a single line when possible."}]},singleQuote:{category:"Common",type:"boolean",default:!1,description:"Use single quotes instead of double quotes."},proseWrap:{category:"Common",type:"choice",default:"preserve",description:"How to wrap prose.",choices:[{value:"always",description:"Wrap prose if it exceeds the print width."},{value:"never",description:"Do not wrap prose."},{value:"preserve",description:"Wrap prose as-is."}]},bracketSameLine:{category:"Common",type:"boolean",default:!1,description:"Put > of opening tags on the last line instead of on a new line."},singleAttributePerLine:{category:"Common",type:"boolean",default:!1,description:"Enforce single attribute per line in HTML, Vue and JSX."}};var Pc={singleQuote:ki.singleQuote},Ti=Pc;var en={};sn(en,{css:()=>Vy,less:()=>zy,scss:()=>jy});var dl=Te(ht(),1),ml=Te(qo(),1),yl=Te(da(),1);function gp(t,e){let s=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(s,e)}var ma=gp;function wp(t){return t!==null&&typeof t=="object"}var Se=wp;var ba=Te(_a(),1);function te(t,e,s){if(Se(t)){delete t.parent;for(let r in t)te(t[r],e,s),r==="type"&&typeof t[r]=="string"&&!t[r].startsWith(e)&&(!s||!s.test(t[r]))&&(t[r]=e+t[r])}return t}function Bs(t){if(Se(t)){delete t.parent;for(let e in t)Bs(t[e]);!Array.isArray(t)&&t.value&&!t.type&&(t.type="unknown")}return t}var Np=ba.default.default;function Pp(t){let e;try{e=Np(t)}catch{return{type:"selector-unknown",value:t}}return te(Bs(e),"media-")}var Ea=Pp;var gu=Te(yu(),1);function Vm(t){if(/\/[/*]/u.test(E(0,t,/"[^"]+"|'[^']+'/gu,"")))return{type:"selector-unknown",value:t.trim()};let e;try{new gu.default(s=>{e=s}).process(t)}catch{return{type:"selector-unknown",value:t}}return te(e,"selector-")}var se=Vm;var cl=Te(nl(),1);var Iy=t=>{for(;t.parent;)t=t.parent;return t},Gr=Iy;function qy(t){return Gr(t).text.slice(t.group.open.sourceIndex+1,t.group.close.sourceIndex).trim()}var il=qy;function Ly(t){if(ce(t)){for(let e=t.length-1;e>0;e--)if(t[e].type==="word"&&t[e].value==="{"&&t[e-1].type==="word"&&t[e-1].value.endsWith("#"))return!0}return!1}var ol=Ly;function Dy(t){return t.some(e=>e.type==="string"||e.type==="func"&&!e.value.endsWith("\\"))}var al=Dy;function My(t,e){return!!(e.parser==="scss"&&t?.type==="word"&&t.value.startsWith("$"))}var ul=My;var ll=t=>t.type==="paren"&&t.value===")";function By(t,e){let{nodes:s}=t,r={open:null,close:null,groups:[],type:"paren_group"},n=[r],i=r,o={groups:[],type:"comma_group"},u=[o];for(let a=0;a<s.length;++a){let l=s[a];if(e.parser==="scss"&&l.type==="number"&&l.unit===".."&&l.value.endsWith(".")&&(l.value=l.value.slice(0,-1),l.unit="..."),l.type==="func"&&l.value==="selector"&&(l.group.groups=[se(Gr(t).text.slice(l.group.open.sourceIndex+1,l.group.close.sourceIndex))]),l.type==="func"&&l.value==="url"){let f=l.group?.groups??[],h=[];for(let c=0;c<f.length;c++){let g=f[c];g.type==="comma_group"?h=[...h,...g.groups]:h.push(g)}(ol(h)||!al(h)&&!ul(h[0],e))&&(l.group.groups=[il(l)])}if(l.type==="paren"&&l.value==="(")r={open:l,close:null,groups:[],type:"paren_group"},n.push(r),o={groups:[],type:"comma_group"},u.push(o);else if(ll(l)){if(o.groups.length>0&&r.groups.push(o),r.close=l,u.length===1)throw new Error("Unbalanced parenthesis");u.pop(),o=G(0,u,-1),o.groups.push(r),n.pop(),r=G(0,n,-1)}else if(l.type==="comma"){if(a===s.length-3&&s[a+1].type==="comment"&&ll(s[a+2]))continue;r.groups.push(o),o={groups:[],type:"comma_group"},u[u.length-1]=o}else o.groups.push(l)}return o.groups.length>0&&r.groups.push(o),i}function Yr(t){return t.type==="paren_group"&&!t.open&&!t.close&&t.groups.length===1||t.type==="comma_group"&&t.groups.length===1?Yr(t.groups[0]):t.type==="paren_group"||t.type==="comma_group"?{...t,groups:t.groups.map(Yr)}:t}function fl(t,e){if(Se(t))for(let s in t)s!=="parent"&&(fl(t[s],e),s==="nodes"&&(t.group=Yr(By(t,e)),delete t[s]));return t}function Uy(t,e){if(e.parser==="less"&&t.startsWith("~`"))return{type:"value-unknown",value:t};let s=null;try{s=new cl.default(t,{loose:!0}).parse()}catch{return{type:"value-unknown",value:t}}s.text=t;let r=fl(s,e);return te(r,"value-",/^selector-/u)}var de=Uy;var Fy=new Set(["import","use","forward"]);function $y(t){return Fy.has(t)}var pl=$y;function Wy(t,e){return e.parser!=="scss"||!t.selector?!1:t.selector.replace(/\/\*.*?\*\//u,"").replace(/\/\/.*\n/u,"").trim().endsWith(":")}var hl=Wy;var Gy=/(\s*)(!default).*$/u,Yy=/(\s*)(!global).*$/u;function gl(t,e){if(Se(t)){delete t.parent;for(let i in t)gl(t[i],e);if(!t.type)return t;if(t.raws??(t.raws={}),t.type==="css-decl"&&typeof t.prop=="string"&&t.prop.startsWith("--")&&typeof t.value=="string"&&t.value.startsWith("{")){let i;if(t.value.trimEnd().endsWith("}")){let o=e.originalText.slice(0,t.source.start.offset),u="a".repeat(t.prop.length)+e.originalText.slice(t.source.start.offset+t.prop.length,t.source.end.offset),a=E(0,o,/[^\n]/gu," ")+u,l;e.parser==="scss"?l=xl:e.parser==="less"?l=vl:l=wl;let f;try{f=l(a,{...e})}catch{}f?.nodes?.length===1&&f.nodes[0].type==="css-rule"&&(i=f.nodes[0].nodes)}return i?t.value={type:"css-rule",nodes:i}:t.value={type:"value-unknown",value:t.raws.value.raw},t}let s="";typeof t.selector=="string"&&(s=t.raws.selector?t.raws.selector.scss??t.raws.selector.raw:t.selector,t.raws.between&&t.raws.between.trim().length>0&&(s+=t.raws.between),t.raws.selector=s);let r="";typeof t.value=="string"&&(r=t.raws.value?t.raws.value.scss??t.raws.value.raw:t.value,t.raws.value=r.trim());let n="";if(typeof t.params=="string"&&(n=t.raws.params?t.raws.params.scss??t.raws.params.raw:t.params,t.raws.afterName&&t.raws.afterName.trim().length>0&&(n=t.raws.afterName+n),t.raws.between&&t.raws.between.trim().length>0&&(n=n+t.raws.between),n=n.trim(),t.raws.params=n),s.trim().length>0)return s.startsWith("@")&&s.endsWith(":")?t:t.mixin?(t.selector=de(s,e),t):(hl(t,e)&&(t.isSCSSNesterProperty=!0),t.selector=se(s),t);if(r.trim().length>0){let i=r.match(Gy);i&&(r=r.slice(0,i.index),t.scssDefault=!0,i[0].trim()!=="!default"&&(t.raws.scssDefault=i[0]));let o=r.match(Yy);if(o&&(r=r.slice(0,o.index),t.scssGlobal=!0,o[0].trim()!=="!global"&&(t.raws.scssGlobal=o[0])),r.startsWith("progid:"))return{type:"value-unknown",value:r};t.value=de(r,e)}if(e.parser==="less"&&t.type==="css-decl"&&r.startsWith("extend(")&&(t.extend||(t.extend=t.raws.between===":"),t.extend&&!t.selector&&(delete t.value,t.selector=se(r.slice(7,-1)))),t.type==="css-atrule"){if(e.parser==="less"){if(t.mixin){let i=t.raws.identifier+t.name+t.raws.afterName+t.raws.params;return t.selector=se(i),delete t.params,t}if(t.function)return t}if(e.parser==="css"&&t.name==="custom-selector"){let i=t.params.match(/:--\S+\s+/u)[0].trim();return t.customSelector=i,t.selector=se(t.params.slice(i.length).trim()),delete t.params,t}if(e.parser==="less"){if(t.name.includes(":")){t.variable=!0;let i=t.name.split(":");t.name=i[0];let o=i.slice(1).join(":");t.params&&(o+=t.params),t.value=de(o,e)}if(!["page","nest","keyframes"].includes(t.name)&&t.params?.[0]===":"){t.variable=!0;let i=t.params.slice(1);i&&(t.value=de(i,e)),t.raws.afterName+=":"}if(t.variable)return delete t.params,t.value||delete t.value,t}}if(t.type==="css-atrule"&&n.length>0){let{name:i}=t,o=t.name.toLowerCase();return i==="warn"||i==="error"?(t.params={type:"media-unknown",value:n},t):i==="extend"||i==="nest"?(t.selector=se(n),delete t.params,t):i==="at-root"?(/^\(\s*(?:without|with)\s*:.+\)$/su.test(n)?t.params=de(n,e):(t.selector=se(n),delete t.params),t):pl(o)?(t.import=!0,delete t.filename,t.params=de(n,e),t):["namespace","supports","if","else","for","each","while","debug","mixin","include","function","return","define-mixin","add-mixin"].includes(i)?(n=n.replace(/(\$\S+?)(\s+)?\.{3}/u,"$1...$2"),n=n.replace(/^(?!if)([^"'\s(]+)(\s+)\(/u,"$1($2"),t.value=de(n,e),delete t.params,t):["media","custom-media"].includes(o)?n.includes("#{")?{type:"media-unknown",value:n}:(t.params=Ea(n),t):(t.params=n,t)}}return t}function Js(t,e,s){let{frontMatter:r,content:n}=ge(e),i;try{i=t(n,{map:!1})}catch(o){let{name:u,reason:a,line:l,column:f}=o;throw typeof l!="number"?o:ma(`${u}: ${a}`,{loc:{start:{line:l,column:f}},cause:o})}return s.originalText=e,i=gl(te(i,"css-"),s),Xr(i,e),r&&(i.frontMatter={...r,type:"front-matter",source:{startOffset:r.start.index,endOffset:r.end.index}}),i}function wl(t,e={}){return Js(dl.default.default,t,e)}function vl(t,e={}){return Js(s=>ml.default.parse(Tn(s)),t,e)}function xl(t,e={}){return Js(yl.default,t,e)}var Zs={astFormat:"postcss",hasPragma:Gn,hasIgnorePragma:Yn,locStart:P,locEnd:R},Vy={...Zs,parse:wl},zy={...Zs,parse:vl},jy={...Zs,parse:xl};var Hy={postcss:Ei};export{_l as default,Si as languages,Ti as options,en as parsers,Hy as printers};
|
package/standalone.js
CHANGED
|
@@ -24,6 +24,6 @@ ${d}`),d}async function Ba(e,t){let u=await We(t),r=u.preprocess?await u.preproc
|
|
|
24
24
|
`&&(d+=$t(c.slice(0,d),`
|
|
25
25
|
`)),c=oe(0,c,`
|
|
26
26
|
`,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Nu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function Sn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Nu(e,u,-1),r=Nu(e,r,0),o=Nu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function In(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=Sn(e,t),a=e.charAt(0)===On;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=ju(e)),e.includes("\r")){let s=i=>$t(e.slice(0,Math.max(i,0)),`\r
|
|
27
|
-
`);u-=s(u),r-=s(r),o-=s(o),e=Uu(e)}return{hasBOM:a,text:e,options:Sn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function wn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=In(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await wn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await wn(r,o)&&(r=o.printer.insertPragma(r)),n=await Pn(r,o)),u&&(n.formatted=On+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function kn(e,t,u){let{text:r,options:o}=In(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=bn(n.ast,o))),n}async function vn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function Rn(e,t){let u=Dr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Ln(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Mn(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:rt,softline:ar,hardline:V,literalline:Ze,group:Kt,conditionalGroup:ur,fill:tr,lineSuffix:ve,lineSuffixBoundary:ir,cursor:ee,breakParent:ce,ifBreak:rr,trim:sr,indent:ae,indentIfBreak:nr,align:De,addAlignmentToDoc:ut,markAsRoot:tt,dedentToRoot:Zu,dedent:er,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:or,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Gu,traverseDoc:we,findInDoc:qe,mapDoc:Pe,removeLines:Ju,stripTrailingHardline:Qe,replaceEndOfLine:Hu,canBreak:Xu};var Yn="3.8.
|
|
27
|
+
`);u-=s(u),r-=s(r),o-=s(o),e=Uu(e)}return{hasBOM:a,text:e,options:Sn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function wn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=In(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await wn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await wn(r,o)&&(r=o.printer.insertPragma(r)),n=await Pn(r,o)),u&&(n.formatted=On+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function kn(e,t,u){let{text:r,options:o}=In(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=bn(n.ast,o))),n}async function vn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function Rn(e,t){let u=Dr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Ln(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Mn(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:rt,softline:ar,hardline:V,literalline:Ze,group:Kt,conditionalGroup:ur,fill:tr,lineSuffix:ve,lineSuffixBoundary:ir,cursor:ee,breakParent:ce,ifBreak:rr,trim:sr,indent:ae,indentIfBreak:nr,align:De,addAlignmentToDoc:ut,markAsRoot:tt,dedentToRoot:Zu,dedent:er,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:or,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Gu,traverseDoc:we,findInDoc:qe,mapDoc:Pe,removeLines:Ju,stripTrailingHardline:Qe,replaceEndOfLine:Hu,canBreak:Xu};var Yn="3.8.3";var Pu={};Yt(Pu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>jn,getMaxContinuousCount:()=>Un,getNextNonSpaceNonCommentCharacter:()=>Wn,getNextNonSpaceNonCommentCharacterIndex:()=>ni,getPreferredQuote:()=>Kn,getStringWidth:()=>Re,hasNewline:()=>z,hasNewlineInRange:()=>Gn,hasSpaces:()=>zn,isNextLineEmpty:()=>Di,isNextLineEmptyAfterIndex:()=>vt,isPreviousLineEmpty:()=>ai,makeString:()=>si,skip:()=>ye,skipEverythingButNewLine:()=>at,skipInlineComment:()=>xe,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>ot,skipTrailingComment:()=>Be,skipWhitespace:()=>mr});function Ka(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var xe=Ka;function Ga(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?at(e,t):t}var Be=Ga;function za(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=xe(e,r),r=Be(e,r),r=K(e,r);return r}var ze=za;function Ja(e,t){let u=null,r=t;for(;r!==u;)u=r,r=ot(e,r),r=xe(e,r),r=Y(e,r);return r=Be(e,r),r=K(e,r),r!==!1&&z(e,r)}var vt=Ja;function Ha(e,t){let u=e.lastIndexOf(`
|
|
28
28
|
`);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var jn=Ha;function Ou(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Xa(e,t){let u=e.matchAll(new RegExp(`(?:${Ou(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var Un=Xa;function qa(e,t){let u=ze(e,t);return u===!1?"":e.charAt(u)}var Wn=qa;var $n=Object.freeze({character:"'",codePoint:39}),Vn=Object.freeze({character:'"',codePoint:34}),Qa=Object.freeze({preferred:$n,alternate:Vn}),Za=Object.freeze({preferred:Vn,alternate:$n});function ei(e,t){let{preferred:u,alternate:r}=t===!0||t==="'"?Qa:Za,{length:o}=e,n=0,a=0;for(let s=0;s<o;s++){let i=e.charCodeAt(s);i===u.codePoint?n++:i===r.codePoint&&a++}return(n>a?r:u).character}var Kn=ei;function ti(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
|
|
29
29
|
`)return!0;return!1}var Gn=ti;function ui(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var zn=ui;function ri(e,t,u){return ze(e,u(t))}function ni(e,t){return arguments.length===2||typeof t=="number"?ze(e,t):ri(...arguments)}function oi(e,t,u){return Le(e,u(t))}function ai(e,t){return arguments.length===2||typeof t=="number"?Le(e,t):oi(...arguments)}function ii(e,t,u){return vt(e,u(t))}function si(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Di(e,t){return arguments.length===2||typeof t=="number"?vt(e,t):ii(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var Jn=me(Su);async function Hn(e,t){let{formatted:u}=await Jn(e,{...t,cursorOffset:-1});return u}async function ci(e,t){return await Hn(e,t)===e}var fi=me(st,0),li={parse:me(kn),formatAST:me(vn),formatDoc:me(Rn),printToDoc:me(Ln),printDocToString:me(Mn)};return ao(di);});
|
package/standalone.mjs
CHANGED
|
@@ -24,6 +24,6 @@ ${d}`),d}async function Ba(e,t){let u=await We(t),r=u.preprocess?await u.preproc
|
|
|
24
24
|
`&&(d+=$t(c.slice(0,d),`
|
|
25
25
|
`)),c=oe(0,c,`
|
|
26
26
|
`,p)}return{formatted:c,cursorOffset:d,comments:f.comments}}function Nu(e,t,u){return typeof t!="number"||Number.isNaN(t)||t<0||t>e.length?u:t}function Nn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o}=t;return u=Nu(e,u,-1),r=Nu(e,r,0),o=Nu(e,o,e.length),{...t,cursorOffset:u,rangeStart:r,rangeEnd:o}}function Pn(e,t){let{cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n}=Nn(e,t),a=e.charAt(0)===wn;if(a&&(e=e.slice(1),u--,r--,o--),n==="auto"&&(n=Yu(e)),e.includes("\r")){let s=i=>$t(e.slice(0,Math.max(i,0)),`\r
|
|
27
|
-
`);u-=s(u),r-=s(r),o-=s(o),e=ju(e)}return{hasBOM:a,text:e,options:Nn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function Sn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=Pn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await Sn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await Sn(r,o)&&(r=o.printer.insertPragma(r)),n=await On(r,o)),u&&(n.formatted=wn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function In(e,t,u){let{text:r,options:o}=Pn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=yn(n.ast,o))),n}async function kn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function vn(e,t){let u=sr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Rn(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Ln(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:ut,softline:or,hardline:V,literalline:Qe,group:Kt,conditionalGroup:tr,fill:er,lineSuffix:ve,lineSuffixBoundary:ar,cursor:ee,breakParent:ce,ifBreak:ur,trim:ir,indent:ae,indentIfBreak:rr,align:De,addAlignmentToDoc:tt,markAsRoot:et,dedentToRoot:Qu,dedent:Zu,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:nr,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Ku,traverseDoc:we,findInDoc:Xe,mapDoc:Pe,removeLines:zu,stripTrailingHardline:qe,replaceEndOfLine:Ju,canBreak:Hu};var Mn="3.8.
|
|
27
|
+
`);u-=s(u),r-=s(r),o-=s(o),e=ju(e)}return{hasBOM:a,text:e,options:Nn(e,{...t,cursorOffset:u,rangeStart:r,rangeEnd:o,endOfLine:n})}}async function Sn(e,t){let u=await We(t);return!u.hasPragma||u.hasPragma(e)}async function ja(e,t){return(await We(t)).hasIgnorePragma?.(e)}async function Su(e,t){let{hasBOM:u,text:r,options:o}=Pn(e,await se(t));if(o.rangeStart>=o.rangeEnd&&r!==""||o.requirePragma&&!await Sn(r,o)||o.checkIgnorePragma&&await ja(r,o))return{formatted:e,cursorOffset:t.cursorOffset,comments:[]};let n;return o.rangeStart>0||o.rangeEnd<r.length?n=await Ya(r,o):(!o.requirePragma&&o.insertPragma&&o.printer.insertPragma&&!await Sn(r,o)&&(r=o.printer.insertPragma(r)),n=await On(r,o)),u&&(n.formatted=wn+n.formatted,n.cursorOffset>=0&&n.cursorOffset++),n}async function In(e,t,u){let{text:r,options:o}=Pn(e,await se(t)),n=await Fe(r,o);return u&&(u.preprocessForPrint&&(n.ast=await xu(n.ast,o)),u.massage&&(n.ast=yn(n.ast,o))),n}async function kn(e,t){t=await se(t);let u=await Ge(e,t);return Ce(u,t)}async function vn(e,t){let u=sr(e),{formatted:r}=await Su(u,{...t,parser:"__js_expression"});return r}async function Rn(e,t){t=await se(t);let{ast:u}=await Fe(e,t);return t.cursorOffset>=0&&(t={...t,...Bu(u,t)}),Ge(u,t)}async function Ln(e,t){return Ce(e,await se(t))}var wu={};Yt(wu,{builders:()=>Wa,printer:()=>$a,utils:()=>Va});var Wa={join:Ie,line:ut,softline:or,hardline:V,literalline:Qe,group:Kt,conditionalGroup:tr,fill:er,lineSuffix:ve,lineSuffixBoundary:ar,cursor:ee,breakParent:ce,ifBreak:ur,trim:ir,indent:ae,indentIfBreak:rr,align:De,addAlignmentToDoc:tt,markAsRoot:et,dedentToRoot:Qu,dedent:Zu,hardlineWithoutBreakParent:ke,literallineWithoutBreakParent:Gt,label:nr,concat:e=>e},$a={printDocToString:Ce},Va={willBreak:Ku,traverseDoc:we,findInDoc:Xe,mapDoc:Pe,removeLines:zu,stripTrailingHardline:qe,replaceEndOfLine:Ju,canBreak:Hu};var Mn="3.8.3";var Pu={};Yt(Pu,{addDanglingComment:()=>ue,addLeadingComment:()=>fe,addTrailingComment:()=>le,getAlignmentSize:()=>he,getIndentSize:()=>Yn,getMaxContinuousCount:()=>jn,getNextNonSpaceNonCommentCharacter:()=>Un,getNextNonSpaceNonCommentCharacterIndex:()=>ni,getPreferredQuote:()=>Vn,getStringWidth:()=>Re,hasNewline:()=>z,hasNewlineInRange:()=>Kn,hasSpaces:()=>Gn,isNextLineEmpty:()=>Di,isNextLineEmptyAfterIndex:()=>kt,isPreviousLineEmpty:()=>ai,makeString:()=>si,skip:()=>ye,skipEverythingButNewLine:()=>ot,skipInlineComment:()=>xe,skipNewline:()=>K,skipSpaces:()=>Y,skipToLineEnd:()=>nt,skipTrailingComment:()=>Be,skipWhitespace:()=>Fr});function Ka(e,t){if(t===!1)return!1;if(e.charAt(t)==="/"&&e.charAt(t+1)==="*"){for(let u=t+2;u<e.length;++u)if(e.charAt(u)==="*"&&e.charAt(u+1)==="/")return u+2}return t}var xe=Ka;function Ga(e,t){return t===!1?!1:e.charAt(t)==="/"&&e.charAt(t+1)==="/"?ot(e,t):t}var Be=Ga;function za(e,t){let u=null,r=t;for(;r!==u;)u=r,r=Y(e,r),r=xe(e,r),r=Be(e,r),r=K(e,r);return r}var ze=za;function Ja(e,t){let u=null,r=t;for(;r!==u;)u=r,r=nt(e,r),r=xe(e,r),r=Y(e,r);return r=Be(e,r),r=K(e,r),r!==!1&&z(e,r)}var kt=Ja;function Ha(e,t){let u=e.lastIndexOf(`
|
|
28
28
|
`);return u===-1?0:he(e.slice(u+1).match(/^[\t ]*/u)[0],t)}var Yn=Ha;function Ou(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Xa(e,t){let u=e.matchAll(new RegExp(`(?:${Ou(t)})+`,"gu"));return u.reduce||(u=[...u]),u.reduce((r,[o])=>Math.max(r,o.length),0)/t.length}var jn=Xa;function qa(e,t){let u=ze(e,t);return u===!1?"":e.charAt(u)}var Un=qa;var Wn=Object.freeze({character:"'",codePoint:39}),$n=Object.freeze({character:'"',codePoint:34}),Qa=Object.freeze({preferred:Wn,alternate:$n}),Za=Object.freeze({preferred:$n,alternate:Wn});function ei(e,t){let{preferred:u,alternate:r}=t===!0||t==="'"?Qa:Za,{length:o}=e,n=0,a=0;for(let s=0;s<o;s++){let i=e.charCodeAt(s);i===u.codePoint?n++:i===r.codePoint&&a++}return(n>a?r:u).character}var Vn=ei;function ti(e,t,u){for(let r=t;r<u;++r)if(e.charAt(r)===`
|
|
29
29
|
`)return!0;return!1}var Kn=ti;function ui(e,t,u={}){return Y(e,u.backwards?t-1:t,u)!==t}var Gn=ui;function ri(e,t,u){return ze(e,u(t))}function ni(e,t){return arguments.length===2||typeof t=="number"?ze(e,t):ri(...arguments)}function oi(e,t,u){return Le(e,u(t))}function ai(e,t){return arguments.length===2||typeof t=="number"?Le(e,t):oi(...arguments)}function ii(e,t,u){return kt(e,u(t))}function si(e,t,u){let r=t==='"'?"'":'"',n=oe(0,e,/\\(.)|(["'])/gsu,(a,s,i)=>s===r?s:i===t?"\\"+i:i||(u&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+n+t}function Di(e,t){return arguments.length===2||typeof t=="number"?kt(e,t):ii(...arguments)}function me(e,t=1){return async(...u)=>{let r=u[t]??{},o=r.plugins??[];return u[t]={...r,plugins:Array.isArray(o)?o:Object.values(o)},e(...u)}}var zn=me(Su);async function Jn(e,t){let{formatted:u}=await zn(e,{...t,cursorOffset:-1});return u}async function ci(e,t){return await Jn(e,t)===e}var fi=me(it,0),li={parse:me(In),formatAST:me(kn),formatDoc:me(vn),printToDoc:me(Rn),printDocToString:me(Ln)};export{li as __debug,ci as check,Hn as default,wu as doc,Jn as format,zn as formatWithCursor,fi as getSupportInfo,Pu as util,Mn as version};
|