UNPKG

@shopify/cli

Version:

A CLI tool to build for the Shopify platform

32 lines • 1.18 MB
import{a as BO,b as GG,c as zG}from"./chunk-QSTEVZFQ.js";import{b as HG}from"./chunk-5Y7GIF2W.js";import{Aa as jO,i as FO,za as WG}from"./chunk-XONFGLJQ.js";import{p as UG}from"./chunk-LDGAHMS7.js";import{a as Te,b as at,c as P,d as Lb,e as Uu,f as Pb,g as b}from"./chunk-VPRTJUIN.js";var qb=P(Cb=>{"use strict";b();Object.defineProperty(Cb,"__esModule",{value:!0});Cb.deepGet=JG;function JG(t,e){return e.reduce((r,n)=>r?.[n],t)}});var $O=P(ko=>{"use strict";b();Object.defineProperty(ko,"__esModule",{value:!0});ko.first=KG;ko.last=QG;ko.findLast=YG;ko.findLastIndex=Rb;ko.findLastAndIndex=XG;function KG(t){return t[0]}function QG(t,e=0){return t[t.length-1+e]}function YG(t,e){return t[Rb(t,e)]}function Rb(t,e){for(let r=t.length-1;r>=0;r--)if(e(t[r]))return r;return-1}function XG(t,e){let r=Rb(t,e);return[t[r],r]}});var UO=P((P_e,VO)=>{"use strict";b();var ZG=BO();VO.exports=function(e){return e!=null&&typeof e=="object"&&ZG(e)===!1}});var Mb=P((R_e,WO)=>{"use strict";b();var eH=BO(),tH=UO(),q_e=Array.prototype.slice;WO.exports=Wu;function Wu(t,e){if(!(this instanceof Wu))return typeof e=="number"?new Wu(t).fromIndex(e):new Wu(t,e);this.str=t||"",this.lineToIndex=rH(this.str),e=e||{},this.origin=typeof e.origin>"u"?1:e.origin}Wu.prototype.fromIndex=function(t){if(t<0||t>=this.str.length||isNaN(t))return null;var e=nH(t,this.lineToIndex);return{line:e+this.origin,col:t-this.lineToIndex[e]+this.origin}};Wu.prototype.toIndex=function(t,e){if(typeof e>"u")return eH(t)&&t.length>=2?this.toIndex(t[0],t[1]):tH(t)&&"line"in t&&("col"in t||"column"in t)?this.toIndex(t.line,"col"in t?t.col:t.column):-1;if(isNaN(t)||isNaN(e))return-1;if(t-=this.origin,e-=this.origin,t>=0&&e>=0&&t<this.lineToIndex.length){var r=this.lineToIndex[t],n=t===this.lineToIndex.length-1?this.str.length:this.lineToIndex[t+1];if(e<n-r)return r+e}return-1};function rH(t){for(var e=t.split(` `),r=new Array(e.length),n=0,i=0,s=e.length;i<s;i++)r[i]=n,n+=e[i].length+1;return r}function nH(t,e){if(t>=e[e.length-1])return e.length-1;for(var r=0,n=e.length-2,i;r<n;)if(i=r+(n-r>>1),t<e[i])n=i-1;else if(t>=e[i+1])r=i+1;else{r=i;break}return r}});var HO=P(Gu=>{"use strict";b();var iH=Gu&&Gu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gu,"__esModule",{value:!0});Gu.getPosition=sH;Gu.getOffset=aH;var GO=iH(Mb());function sH(t,e){let r=(0,GO.default)(t,{origin:0}).fromIndex(Math.min(e,t.length-1));return{index:e,line:r?r.line:-1,character:r?r.col:-1}}function aH(t,e,r){return(0,GO.default)(t,{origin:1}).toIndex(e,r)}});var qd=P(Cd=>{"use strict";b();Object.defineProperty(Cd,"__esModule",{value:!0});Cd.isError=uH;Cd.asError=cH;var oH={1:"Invalid symbol found in the input.",2:"Invalid number format detected.",3:"Property name expected but not found.",4:"A value was expected but not found.",5:"Colon `:` expected after the property name.",6:"Comma `,` expected between elements and properties.",7:"Closing brace `}` expected.",8:"Closing bracket `]` expected.",9:"End of file expected.",10:"Invalid comment token found.",11:"Unexpected end of comment.",12:"Unexpected end of string.",13:"Unexpected end of number.",14:"Invalid Unicode escape sequence.",15:"Invalid escape character found.",16:"Invalid character found in the input."};function uH(t){return t instanceof Error}function cH(t){return t instanceof Error?t:typeof t=="string"?new Error(t):t&&typeof t=="object"&&"error"in t?new Error(lH(t)):t&&typeof t.toString=="function"?new Error(t.toString()):new Error("An unknown error occurred")}function lH(t){return oH[t.error]||"Unknown parse error."}});var Fb=P(Db=>{"use strict";b();Object.defineProperty(Db,"__esModule",{value:!0});Db.assertNever=fH;function fH(t){throw new Error(`We should never reach this code, you are missing a case for ${t}`)}});var Bb=P(Rd=>{"use strict";b();Object.defineProperty(Rd,"__esModule",{value:!0});Rd.memo=pH;Rd.memoize=hH;var jb=Symbol("Unset");function pH(t){let e=jb,r=(...n)=>(e===jb&&(e=t(...n)),e);return r.clearCache=()=>{e=jb},r}function hH(t,e){let r={},n=(...i)=>{let s=e(...i);return r[s]||(r[s]=t(...i)),r[s]};return n.force=(...i)=>(n.invalidate(...i),n(...i)),n.invalidate=(...i)=>{let s=e(...i);delete r[s]},n.clearCache=()=>{r={}},n}});var Vb=P($b=>{"use strict";b();Object.defineProperty($b,"__esModule",{value:!0});$b.indexBy=dH;function dH(t,e){let r={};for(let n of e)r[t(n)]=n;return r}});function Ao(t,e=!1){let r=t.length,n=0,i="",s=0,a=16,u=0,c=0,p=0,d=0,m=0;function h(T,S){let L=0,R=0;for(;L<T||!S;){let M=t.charCodeAt(n);if(M>=48&&M<=57)R=R*16+M-48;else if(M>=65&&M<=70)R=R*16+M-65+10;else if(M>=97&&M<=102)R=R*16+M-97+10;else break;n++,L++}return L<T&&(R=-1),R}function y(T){n=T,i="",s=0,a=16,m=0}function w(){let T=n;if(t.charCodeAt(n)===48)n++;else for(n++;n<t.length&&Hu(t.charCodeAt(n));)n++;if(n<t.length&&t.charCodeAt(n)===46)if(n++,n<t.length&&Hu(t.charCodeAt(n)))for(n++;n<t.length&&Hu(t.charCodeAt(n));)n++;else return m=3,t.substring(T,n);let S=n;if(n<t.length&&(t.charCodeAt(n)===69||t.charCodeAt(n)===101))if(n++,(n<t.length&&t.charCodeAt(n)===43||t.charCodeAt(n)===45)&&n++,n<t.length&&Hu(t.charCodeAt(n))){for(n++;n<t.length&&Hu(t.charCodeAt(n));)n++;S=n}else m=3;return t.substring(T,S)}function x(){let T="",S=n;for(;;){if(n>=r){T+=t.substring(S,n),m=2;break}let L=t.charCodeAt(n);if(L===34){T+=t.substring(S,n),n++;break}if(L===92){if(T+=t.substring(S,n),n++,n>=r){m=2;break}switch(t.charCodeAt(n++)){case 34:T+='"';break;case 92:T+="\\";break;case 47:T+="/";break;case 98:T+="\b";break;case 102:T+="\f";break;case 110:T+=` `;break;case 114:T+="\r";break;case 116:T+=" ";break;case 117:let M=h(4,!0);M>=0?T+=String.fromCharCode(M):m=4;break;default:m=5}S=n;continue}if(L>=0&&L<=31)if(Kl(L)){T+=t.substring(S,n),m=2;break}else m=6;n++}return T}function k(){if(i="",m=0,s=n,c=u,d=p,n>=r)return s=r,a=17;let T=t.charCodeAt(n);if(Ub(T)){do n++,i+=String.fromCharCode(T),T=t.charCodeAt(n);while(Ub(T));return a=15}if(Kl(T))return n++,i+=String.fromCharCode(T),T===13&&t.charCodeAt(n)===10&&(n++,i+=` `),u++,p=n,a=14;switch(T){case 123:return n++,a=1;case 125:return n++,a=2;case 91:return n++,a=3;case 93:return n++,a=4;case 58:return n++,a=6;case 44:return n++,a=5;case 34:return n++,i=x(),a=10;case 47:let S=n-1;if(t.charCodeAt(n+1)===47){for(n+=2;n<r&&!Kl(t.charCodeAt(n));)n++;return i=t.substring(S,n),a=12}if(t.charCodeAt(n+1)===42){n+=2;let L=r-1,R=!1;for(;n<L;){let M=t.charCodeAt(n);if(M===42&&t.charCodeAt(n+1)===47){n+=2,R=!0;break}n++,Kl(M)&&(M===13&&t.charCodeAt(n)===10&&n++,u++,p=n)}return R||(n++,m=1),i=t.substring(S,n),a=13}return i+=String.fromCharCode(T),n++,a=16;case 45:if(i+=String.fromCharCode(T),n++,n===r||!Hu(t.charCodeAt(n)))return a=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=w(),a=11;default:for(;n<r&&v(T);)n++,T=t.charCodeAt(n);if(s!==n){switch(i=t.substring(s,n),i){case"true":return a=8;case"false":return a=9;case"null":return a=7}return a=16}return i+=String.fromCharCode(T),n++,a=16}}function v(T){if(Ub(T)||Kl(T))return!1;switch(T){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function I(){let T;do T=k();while(T>=12&&T<=15);return T}return{setPosition:y,getPosition:()=>n,scan:e?I:k,getToken:()=>a,getTokenValue:()=>i,getTokenOffset:()=>s,getTokenLength:()=>n-s,getTokenStartLine:()=>c,getTokenStartCharacter:()=>s-d,getTokenError:()=>m}}function Ub(t){return t===32||t===9}function Kl(t){return t===10||t===13}function Hu(t){return t>=48&&t<=57}var zO,Md=at(()=>{"use strict";b();(function(t){t[t.lineFeed=10]="lineFeed",t[t.carriageReturn=13]="carriageReturn",t[t.space=32]="space",t[t._0=48]="_0",t[t._1=49]="_1",t[t._2=50]="_2",t[t._3=51]="_3",t[t._4=52]="_4",t[t._5=53]="_5",t[t._6=54]="_6",t[t._7=55]="_7",t[t._8=56]="_8",t[t._9=57]="_9",t[t.a=97]="a",t[t.b=98]="b",t[t.c=99]="c",t[t.d=100]="d",t[t.e=101]="e",t[t.f=102]="f",t[t.g=103]="g",t[t.h=104]="h",t[t.i=105]="i",t[t.j=106]="j",t[t.k=107]="k",t[t.l=108]="l",t[t.m=109]="m",t[t.n=110]="n",t[t.o=111]="o",t[t.p=112]="p",t[t.q=113]="q",t[t.r=114]="r",t[t.s=115]="s",t[t.t=116]="t",t[t.u=117]="u",t[t.v=118]="v",t[t.w=119]="w",t[t.x=120]="x",t[t.y=121]="y",t[t.z=122]="z",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z",t[t.asterisk=42]="asterisk",t[t.backslash=92]="backslash",t[t.closeBrace=125]="closeBrace",t[t.closeBracket=93]="closeBracket",t[t.colon=58]="colon",t[t.comma=44]="comma",t[t.dot=46]="dot",t[t.doubleQuote=34]="doubleQuote",t[t.minus=45]="minus",t[t.openBrace=123]="openBrace",t[t.openBracket=91]="openBracket",t[t.plus=43]="plus",t[t.slash=47]="slash",t[t.formFeed=12]="formFeed",t[t.tab=9]="tab"})(zO||(zO={}))});var Kn,zu,Wb,JO,KO=at(()=>{b();Kn=new Array(20).fill(0).map((t,e)=>" ".repeat(e)),zu=200,Wb={" ":{"\n":new Array(zu).fill(0).map((t,e)=>` `+" ".repeat(e)),"\r":new Array(zu).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(zu).fill(0).map((t,e)=>`\r `+" ".repeat(e))}," ":{"\n":new Array(zu).fill(0).map((t,e)=>` `+" ".repeat(e)),"\r":new Array(zu).fill(0).map((t,e)=>"\r"+" ".repeat(e)),"\r\n":new Array(zu).fill(0).map((t,e)=>`\r `+" ".repeat(e))}},JO=[` `,"\r",`\r `]});function Dd(t,e,r){let n,i,s,a,u;if(e){for(a=e.offset,u=a+e.length,s=a;s>0&&!Ql(t,s-1);)s--;let L=u;for(;L<t.length&&!Ql(t,L);)L++;i=t.substring(s,L),n=gH(i,r)}else i=t,n=0,s=0,a=0,u=t.length;let c=yH(r,t),p=JO.includes(c),d=0,m=0,h;r.insertSpaces?h=Kn[r.tabSize||4]??Ju(Kn[1],r.tabSize||4):h=" ";let y=h===" "?" ":" ",w=Ao(i,!1),x=!1;function k(){if(d>1)return Ju(c,d)+Ju(h,n+m);let L=h.length*(n+m);return!p||L>Wb[y][c].length?c+Ju(h,n+m):L<=0?c:Wb[y][c][L]}function v(){let L=w.scan();for(d=0;L===15||L===14;)L===14&&r.keepLines?d+=1:L===14&&(d=1),L=w.scan();return x=L===16||w.getTokenError()!==0,L}let I=[];function T(L,R,M){!x&&(!e||R<u&&M>a)&&t.substring(R,M)!==L&&I.push({offset:R,length:M-R,content:L})}let S=v();if(r.keepLines&&d>0&&T(Ju(c,d),0,0),S!==17){let L=w.getTokenOffset()+s,R=h.length*n<20&&r.insertSpaces?Kn[h.length*n]:Ju(h,n);T(R,s,L)}for(;S!==17;){let L=w.getTokenOffset()+w.getTokenLength()+s,R=v(),M="",F=!1;for(;d===0&&(R===12||R===13);){let H=w.getTokenOffset()+s;T(Kn[1],L,H),L=w.getTokenOffset()+w.getTokenLength()+s,F=R===12,M=F?k():"",R=v()}if(R===2)S!==1&&m--,r.keepLines&&d>0||!r.keepLines&&S!==1?M=k():r.keepLines&&(M=Kn[1]);else if(R===4)S!==3&&m--,r.keepLines&&d>0||!r.keepLines&&S!==3?M=k():r.keepLines&&(M=Kn[1]);else{switch(S){case 3:case 1:m++,r.keepLines&&d>0||!r.keepLines?M=k():M=Kn[1];break;case 5:r.keepLines&&d>0||!r.keepLines?M=k():M=Kn[1];break;case 12:M=k();break;case 13:d>0?M=k():F||(M=Kn[1]);break;case 6:r.keepLines&&d>0?M=k():F||(M=Kn[1]);break;case 10:r.keepLines&&d>0?M=k():R===6&&!F&&(M="");break;case 7:case 8:case 9:case 11:case 2:case 4:r.keepLines&&d>0?M=k():(R===12||R===13)&&!F?M=Kn[1]:R!==5&&R!==17&&(x=!0);break;case 16:x=!0;break}d>0&&(R===12||R===13)&&(M=k())}R===17&&(r.keepLines&&d>0?M=k():M=r.insertFinalNewline?c:"");let X=w.getTokenOffset()+s;T(M,L,X),S=R}return I}function Ju(t,e){let r="";for(let n=0;n<e;n++)r+=t;return r}function gH(t,e){let r=0,n=0,i=e.tabSize||4;for(;r<t.length;){let s=t.charAt(r);if(s===Kn[1])n++;else if(s===" ")n+=i;else break;r++}return Math.floor(n/i)}function yH(t,e){for(let r=0;r<e.length;r++){let n=e.charAt(r);if(n==="\r")return r+1<e.length&&e.charAt(r+1)===` `?`\r `:"\r";if(n===` `)return` `}return t&&t.eol||` `}function Ql(t,e){return`\r `.indexOf(t.charAt(e))!==-1}var Gb=at(()=>{"use strict";b();Md();KO()});function QO(t,e){let r=[],n=new Object,i,s={value:{},offset:0,length:0,type:"object",parent:void 0},a=!1;function u(c,p,d,m){s.value=c,s.offset=p,s.length=d,s.type=m,s.colonOffset=void 0,i=s}try{Zl(t,{onObjectBegin:(c,p)=>{if(e<=c)throw n;i=void 0,a=e>c,r.push("")},onObjectProperty:(c,p,d)=>{if(e<p||(u(c,p,d,"property"),r[r.length-1]=c,e<=p+d))throw n},onObjectEnd:(c,p)=>{if(e<=c)throw n;i=void 0,r.pop()},onArrayBegin:(c,p)=>{if(e<=c)throw n;i=void 0,r.push(0)},onArrayEnd:(c,p)=>{if(e<=c)throw n;i=void 0,r.pop()},onLiteralValue:(c,p,d)=>{if(e<p||(u(c,p,d,ZO(c)),e<=p+d))throw n},onSeparator:(c,p,d)=>{if(e<=p)throw n;if(c===":"&&i&&i.type==="property")i.colonOffset=p,a=!1,i=void 0;else if(c===","){let m=r[r.length-1];typeof m=="number"?r[r.length-1]=m+1:(a=!0,r[r.length-1]=""),i=void 0}}})}catch(c){if(c!==n)throw c}return{path:r,previousNode:i,isAtPropertyKey:a,matches:c=>{let p=0;for(let d=0;p<c.length&&d<r.length;d++)if(c[p]===r[d]||c[p]==="*")p++;else if(c[p]!=="**")return!1;return p===c.length}}}function YO(t,e=[],r=Yl.DEFAULT){let n=null,i=[],s=[];function a(c){Array.isArray(i)?i.push(c):n!==null&&(i[n]=c)}return Zl(t,{onObjectBegin:()=>{let c={};a(c),s.push(i),i=c,n=null},onObjectProperty:c=>{n=c},onObjectEnd:()=>{i=s.pop()},onArrayBegin:()=>{let c=[];a(c),s.push(i),i=c,n=null},onArrayEnd:()=>{i=s.pop()},onLiteralValue:a,onError:(c,p,d)=>{e.push({error:c,offset:p,length:d})}},r),i[0]}function jd(t,e=[],r=Yl.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(c){n.type==="property"&&(n.length=c-n.offset,n=n.parent)}function s(c){return n.children.push(c),c}Zl(t,{onObjectBegin:c=>{n=s({type:"object",offset:c,length:-1,parent:n,children:[]})},onObjectProperty:(c,p,d)=>{n=s({type:"property",offset:p,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:c,offset:p,length:d,parent:n})},onObjectEnd:(c,p)=>{i(c+p),n.length=c+p-n.offset,n=n.parent,i(c+p)},onArrayBegin:(c,p)=>{n=s({type:"array",offset:c,length:-1,parent:n,children:[]})},onArrayEnd:(c,p)=>{n.length=c+p-n.offset,n=n.parent,i(c+p)},onLiteralValue:(c,p,d)=>{s({type:ZO(c),offset:p,length:d,parent:n,value:c}),i(p+d)},onSeparator:(c,p,d)=>{n.type==="property"&&(c===":"?n.colonOffset=p:c===","&&i(p))},onError:(c,p,d)=>{e.push({error:c,offset:p,length:d})}},r);let u=n.children[0];return u&&delete u.parent,u}function Xl(t,e){if(!t)return;let r=t;for(let n of e)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let i=!1;for(let s of r.children)if(Array.isArray(s.children)&&s.children[0].value===n&&s.children.length===2){r=s.children[1],i=!0;break}if(!i)return}else{let i=n;if(r.type!=="array"||i<0||!Array.isArray(r.children)||i>=r.children.length)return;r=r.children[i]}return r}function Hb(t){if(!t.parent||!t.parent.children)return[];let e=Hb(t.parent);if(t.parent.type==="property"){let r=t.parent.children[0].value;e.push(r)}else if(t.parent.type==="array"){let r=t.parent.children.indexOf(t);r!==-1&&e.push(r)}return e}function Fd(t){switch(t.type){case"array":return t.children.map(Fd);case"object":let e=Object.create(null);for(let r of t.children){let n=r.children[1];n&&(e[r.children[0].value]=Fd(n))}return e;case"null":case"string":case"number":case"boolean":return t.value;default:return}}function vH(t,e,r=!1){return e>=t.offset&&e<t.offset+t.length||r&&e===t.offset+t.length}function zb(t,e,r=!1){if(vH(t,e,r)){let n=t.children;if(Array.isArray(n))for(let i=0;i<n.length&&n[i].offset<=e;i++){let s=zb(n[i],e,r);if(s)return s}return t}}function Zl(t,e,r=Yl.DEFAULT){let n=Ao(t,!1),i=[],s=0;function a(ee){return ee?()=>s===0&&ee(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function u(ee){return ee?W=>s===0&&ee(W,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function c(ee){return ee?W=>s===0&&ee(W,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice()):()=>!0}function p(ee){return ee?()=>{s>0?s++:ee(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>i.slice())===!1&&(s=1)}:()=>!0}function d(ee){return ee?()=>{s>0&&s--,s===0&&ee(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}let m=p(e.onObjectBegin),h=c(e.onObjectProperty),y=d(e.onObjectEnd),w=p(e.onArrayBegin),x=d(e.onArrayEnd),k=c(e.onLiteralValue),v=u(e.onSeparator),I=a(e.onComment),T=u(e.onError),S=r&&r.disallowComments,L=r&&r.allowTrailingComma;function R(){for(;;){let ee=n.scan();switch(n.getTokenError()){case 4:M(14);break;case 5:M(15);break;case 3:M(13);break;case 1:S||M(11);break;case 2:M(12);break;case 6:M(16);break}switch(ee){case 12:case 13:S?M(10):I();break;case 16:M(1);break;case 15:case 14:break;default:return ee}}}function M(ee,W=[],J=[]){if(T(ee),W.length+J.length>0){let te=n.getToken();for(;te!==17;){if(W.indexOf(te)!==-1){R();break}else if(J.indexOf(te)!==-1)break;te=R()}}}function F(ee){let W=n.getTokenValue();return ee?k(W):(h(W),i.push(W)),R(),!0}function X(){switch(n.getToken()){case 11:let ee=n.getTokenValue(),W=Number(ee);isNaN(W)&&(M(2),W=0),k(W);break;case 7:k(null);break;case 8:k(!0);break;case 9:k(!1);break;default:return!1}return R(),!0}function H(){return n.getToken()!==10?(M(3,[],[2,5]),!1):(F(!1),n.getToken()===6?(v(":"),R(),Z()||M(4,[],[2,5])):M(5,[],[2,5]),i.pop(),!0)}function $(){m(),R();let ee=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(ee||M(4,[],[]),v(","),R(),n.getToken()===2&&L)break}else ee&&M(6,[],[]);H()||M(4,[],[2,5]),ee=!0}return y(),n.getToken()!==2?M(7,[2],[]):R(),!0}function B(){w(),R();let ee=!0,W=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(W||M(4,[],[]),v(","),R(),n.getToken()===4&&L)break}else W&&M(6,[],[]);ee?(i.push(0),ee=!1):i[i.length-1]++,Z()||M(4,[],[4,5]),W=!0}return x(),ee||i.pop(),n.getToken()!==4?M(8,[4],[]):R(),!0}function Z(){switch(n.getToken()){case 3:return B();case 1:return $();case 10:return F(!0);default:return X()}}return R(),n.getToken()===17?r.allowEmptyContent?!0:(M(4,[],[]),!1):Z()?(n.getToken()!==17&&M(9,[],[]),!0):(M(4,[],[]),!1)}function XO(t,e){let r=Ao(t),n=[],i,s=0,a;do switch(a=r.getPosition(),i=r.scan(),i){case 12:case 13:case 17:s!==a&&n.push(t.substring(s,a)),e!==void 0&&n.push(r.getTokenValue().replace(/[^\r\n]/g,e)),s=r.getPosition();break}while(i!==17);return n.join("")}function ZO(t){switch(typeof t){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(t){if(Array.isArray(t))return"array"}else return"null";return"object"}default:return"null"}}var Yl,Jb=at(()=>{"use strict";b();Md();(function(t){t.DEFAULT={allowTrailingComma:!1}})(Yl||(Yl={}))});function eN(t,e,r,n){let i=e.slice(),a=jd(t,[]),u,c;for(;i.length>0&&(c=i.pop(),u=Xl(a,i),u===void 0&&r!==void 0);)typeof c=="string"?r={[c]:r}:r=[r];if(u)if(u.type==="object"&&typeof c=="string"&&Array.isArray(u.children)){let p=Xl(u,[c]);if(p!==void 0)if(r===void 0){if(!p.parent)throw new Error("Malformed AST");let d=u.children.indexOf(p.parent),m,h=p.parent.offset+p.parent.length;if(d>0){let y=u.children[d-1];m=y.offset+y.length}else m=u.offset+1,u.children.length>1&&(h=u.children[1].offset);return Io(t,{offset:m,length:h-m,content:""},n)}else return Io(t,{offset:p.offset,length:p.length,content:JSON.stringify(r)},n);else{if(r===void 0)return[];let d=`${JSON.stringify(c)}: ${JSON.stringify(r)}`,m=n.getInsertionIndex?n.getInsertionIndex(u.children.map(y=>y.children[0].value)):u.children.length,h;if(m>0){let y=u.children[m-1];h={offset:y.offset+y.length,length:0,content:","+d}}else u.children.length===0?h={offset:u.offset+1,length:0,content:d}:h={offset:u.offset+1,length:0,content:d+","};return Io(t,h,n)}}else if(u.type==="array"&&typeof c=="number"&&Array.isArray(u.children)){let p=c;if(p===-1){let d=`${JSON.stringify(r)}`,m;if(u.children.length===0)m={offset:u.offset+1,length:0,content:d};else{let h=u.children[u.children.length-1];m={offset:h.offset+h.length,length:0,content:","+d}}return Io(t,m,n)}else if(r===void 0&&u.children.length>=0){let d=c,m=u.children[d],h;if(u.children.length===1)h={offset:u.offset+1,length:u.length-2,content:""};else if(u.children.length-1===d){let y=u.children[d-1],w=y.offset+y.length,x=u.offset+u.length;h={offset:w,length:x-2-w,content:""}}else h={offset:m.offset,length:u.children[d+1].offset-m.offset,content:""};return Io(t,h,n)}else if(r!==void 0){let d,m=`${JSON.stringify(r)}`;if(!n.isArrayInsertion&&u.children.length>c){let h=u.children[c];d={offset:h.offset,length:h.length,content:m}}else if(u.children.length===0||c===0)d={offset:u.offset+1,length:0,content:u.children.length===0?m:m+","};else{let h=c>u.children.length?u.children.length:c,y=u.children[h-1];d={offset:y.offset+y.length,length:0,content:","+m}}return Io(t,d,n)}else throw new Error(`Can not ${r===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${p} as length is not sufficient`)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${u.type}`);else{if(r===void 0)throw new Error("Can not delete in empty document");return Io(t,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(r)},n)}}function Io(t,e,r){if(!r.formattingOptions)return[e];let n=Bd(t,e),i=e.offset,s=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!Ql(n,i-1);)i--;for(;s<n.length&&!Ql(n,s);)s++}let a=Dd(n,{offset:i,length:s-i},{...r.formattingOptions,keepLines:!1});for(let c=a.length-1;c>=0;c--){let p=a[c];n=Bd(n,p),i=Math.min(i,p.offset),s=Math.max(s,p.offset+p.length),s+=p.content.length-p.length}let u=t.length-(n.length-s)-i;return[{offset:i,length:u,content:n.substring(i,s)}]}function Bd(t,e){return t.substring(0,e.offset)+e.content+t.substring(e.offset+e.length)}var tN=at(()=>{"use strict";b();Gb();Jb()});var Ku={};Lb(Ku,{ParseErrorCode:()=>Yb,ScanError:()=>Kb,SyntaxKind:()=>Qb,applyEdits:()=>OH,createScanner:()=>Qn,findNodeAtLocation:()=>kH,findNodeAtOffset:()=>Zb,format:()=>r1,getLocation:()=>wH,getNodePath:()=>e1,getNodeValue:()=>t1,modify:()=>EH,parse:()=>Xb,parseTree:()=>xH,printParseErrorCode:()=>TH,stripComments:()=>IH,visit:()=>AH});function TH(t){switch(t){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function r1(t,e,r){return Dd(t,e,r)}function EH(t,e,r,n){return eN(t,e,r,n)}function OH(t,e){let r=e.slice(0).sort((i,s)=>{let a=i.offset-s.offset;return a===0?i.length-s.length:a}),n=t.length;for(let i=r.length-1;i>=0;i--){let s=r[i];if(s.offset+s.length<=n)t=Bd(t,s);else throw new Error("Overlapping edit");n=s.offset}return t}var Qn,Kb,Qb,wH,Xb,xH,kH,Zb,e1,t1,AH,IH,Yb,ns=at(()=>{"use strict";b();Gb();tN();Md();Jb();Qn=Ao;(function(t){t[t.None=0]="None",t[t.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=2]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",t[t.InvalidUnicode=4]="InvalidUnicode",t[t.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",t[t.InvalidCharacter=6]="InvalidCharacter"})(Kb||(Kb={}));(function(t){t[t.OpenBraceToken=1]="OpenBraceToken",t[t.CloseBraceToken=2]="CloseBraceToken",t[t.OpenBracketToken=3]="OpenBracketToken",t[t.CloseBracketToken=4]="CloseBracketToken",t[t.CommaToken=5]="CommaToken",t[t.ColonToken=6]="ColonToken",t[t.NullKeyword=7]="NullKeyword",t[t.TrueKeyword=8]="TrueKeyword",t[t.FalseKeyword=9]="FalseKeyword",t[t.StringLiteral=10]="StringLiteral",t[t.NumericLiteral=11]="NumericLiteral",t[t.LineCommentTrivia=12]="LineCommentTrivia",t[t.BlockCommentTrivia=13]="BlockCommentTrivia",t[t.LineBreakTrivia=14]="LineBreakTrivia",t[t.Trivia=15]="Trivia",t[t.Unknown=16]="Unknown",t[t.EOF=17]="EOF"})(Qb||(Qb={}));wH=QO,Xb=YO,xH=jd,kH=Xl,Zb=zb,e1=Hb,t1=Fd,AH=Zl,IH=XO;(function(t){t[t.InvalidSymbol=1]="InvalidSymbol",t[t.InvalidNumberFormat=2]="InvalidNumberFormat",t[t.PropertyNameExpected=3]="PropertyNameExpected",t[t.ValueExpected=4]="ValueExpected",t[t.ColonExpected=5]="ColonExpected",t[t.CommaExpected=6]="CommaExpected",t[t.CloseBraceExpected=7]="CloseBraceExpected",t[t.CloseBracketExpected=8]="CloseBracketExpected",t[t.EndOfFileExpected=9]="EndOfFileExpected",t[t.InvalidCommentToken=10]="InvalidCommentToken",t[t.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",t[t.UnexpectedEndOfString=12]="UnexpectedEndOfString",t[t.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",t[t.InvalidUnicode=14]="InvalidUnicode",t[t.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",t[t.InvalidCharacter=16]="InvalidCharacter"})(Yb||(Yb={}))});var Dt=P(Qu=>{"use strict";b();Object.defineProperty(Qu,"__esModule",{value:!0});Qu.parseJSON=CH;Qu.nodeAtPath=qH;Qu.getLocStart=RH;Qu.getLocEnd=MH;var NH=(ns(),Pb(Ku)),LH=_t(),PH={disallowComments:!1,allowTrailingComma:!0,allowEmptyContent:!1};function CH(t,e,r){try{let n=[],i=(0,NH.parse)(t,n,PH);if(n.length&&r)throw n[0];return i}catch(n){return e!==void 0?e:(0,LH.asError)(n)}}function qH(t,e){return e.reduce((r,n)=>{if(r)switch(r.type){case"Object":{let i=r.children.find(s=>s.key.value===n);return i?i.value:void 0}case"Array":return r.children[n];case"Literal":return;case"Identifier":return;case"Property":return}},t)}function RH(t){var e,r;return(r=(e=t.loc)===null||e===void 0?void 0:e.start.offset)!==null&&r!==void 0?r:0}function MH(t){var e,r;return(r=(e=t.loc)===null||e===void 0?void 0:e.end.offset)!==null&&r!==void 0?r:0}});var nN=P((To,rN)=>{b();var ef=FO(),DH=ef.default||ef,$d=function(t,e){return/^\/\//.test(t)&&(t="https:"+t),DH.call(this,t,e)};$d.ponyfill=!0;rN.exports=To=$d;To.fetch=$d;To.Headers=ef.Headers;To.Request=ef.Request;To.Response=ef.Response;To.default=$d});var is=P(Eo=>{"use strict";b();Object.defineProperty(Eo,"__esModule",{value:!0});Eo.doesFileExist=iN;Eo.doesFileExceedThreshold=sN;Eo.getFileSize=aN;Eo.hasRemoteAssetSizeExceededThreshold=jH;Eo.hasLocalAssetSizeExceededThreshold=BH;var FH=nN();async function iN(t,e){let r=t.toUri(e);return await t.fileExists(r)}async function sN(t,e,r){let n=t.toUri(e);if(!t.fileSize)return[!1,0];let i=await t.fileSize(n);return[i>r,i]}async function aN(t){try{let e=await(0,FH.fetch)(t,{method:"HEAD"});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);let r=e.headers.get("Content-Length");return r===null?0:parseFloat(r)}catch{return 0}}async function jH(t,e){return await aN(t)>e}async function BH(t,e,r){if(!await iN(t,e))return!1;let[i,s]=await sN(t,e,r);return i}});var pN=P(ka=>{"use strict";b();Object.defineProperty(ka,"__esModule",{value:!0});ka.getBlocks=uN;ka.isInvalidPresetBlock=cN;ka.isInvalidDefaultBlock=VH;ka.validateNestedBlocks=lN;ka.reportWarning=i1;ka.validateBlockFileExistence=fN;var n1=Dt(),$H=is();function uN(t){var e,r;let n=[],i=[],s={},a=[],u=t.blocks,c=t.presets;function p(h,y){if(!h)return;"name"in h?i.push({node:h,path:["blocks",String(y),"type"]}):h.type!=="@app"&&n.push({node:h,path:["blocks",String(y),"type"]})}function d(h,y,w=0){h&&(s[w]||(s[w]=[]),s[w].push({node:h,path:y.concat("type")}),"blocks"in h&&(Array.isArray(h.blocks)?h.blocks.forEach((x,k)=>{d(x,y.concat("blocks",String(k)),w+1)}):typeof h.blocks=="object"&&h.blocks!==null&&Object.entries(h.blocks).forEach(([x,k])=>{d(k,y.concat("blocks",x),w+1)})))}function m(h,y){"name"in h&&a.push({node:h,path:["default","blocks",String(y),"type"]})}return Array.isArray(u)&&u.forEach((h,y)=>{p(h,y)}),c&&c.forEach((h,y)=>{"blocks"in h&&h.blocks&&(Array.isArray(h.blocks)?h.blocks.forEach((w,x)=>{d(w,["presets",String(y),"blocks",String(x)],0)}):typeof h.blocks=="object"&&Object.entries(h.blocks).forEach(([w,x])=>{d(x,["presets",String(y),"blocks",w],0)}))}),"default"in t&&((r=(e=t.default)===null||e===void 0?void 0:e.blocks)===null||r===void 0||r.forEach((h,y)=>{m(h,y)})),{rootLevelThemeBlocks:n,rootLevelLocalBlocks:i,presetLevelBlocks:s,defaultLevelBlocks:a,hasRootBlocksDeclaration:Array.isArray(u)}}function cN(t,e,r,n,i=!0){if(e.static)return!n.some(p=>p.type===e.type&&p.id===t);let s=e.type.startsWith("_");if(s&&!i)return!1;let a=r.some(p=>p.node.type==="@theme"),u=s||!a;return!r.some(p=>p.node.type===e.type)&&u}function VH(t,e,r=!0){let n=t.type.startsWith("_");if(n&&!r)return!1;let i=e.some(u=>u.node.type==="@theme"),s=n||!i;return!e.some(u=>u.node.type===t.type)&&s}async function oN(t,e,r,n,i,s,a,u,c=[]){let p=(0,n1.nodeAtPath)(u,e),d="id"in t?t.id:e.at(-2);if(p){if(cN(d,t,i,c)){let h=!!t.static,y=t.type.startsWith("_"),w=h?`Could not find a static block of type "${t.type}" with id "${d}" in "blocks/${n.type}.liquid".`:y?`Private block type "${t.type}" is not allowed in "${n.type}" blocks.`:`Block type "${t.type}" is not allowed in "${n.type}" blocks. Allowed types are: ${s.join(", ")}.`;i1(w,a,p,r)}await fN(t.type,r)||i1(`Theme block 'blocks/${t.type}.liquid' does not exist.`,a,p,r)}"blocks"in t&&t.blocks&&lN(r,t,t.blocks,e.slice(0,-1),a,u)}async function lN(t,e,r,n,i,s){var a;if(!r)return;let u=await((a=t.getBlockSchema)===null||a===void 0?void 0:a.call(t,e.type));if(!u||u instanceof Error)return;let{validSchema:c,staticBlockDefs:p}=u;if(!c||c instanceof Error)return;let{rootLevelThemeBlocks:d}=uN(c),m=d.map(h=>h.node.type);Array.isArray(r)?Promise.all(r.map((h,y)=>{let w=n.concat(["blocks",String(y),"type"]);return oN(h,w,t,e,d,m,i,s,p)})):typeof r=="object"&&Promise.all(Object.entries(r).map(([h,y])=>{let w=n.concat(["blocks",h,"type"]);return oN(y,w,t,e,d,m,i,s,p)}))}function i1(t,e,r,n){n.report({message:t,startIndex:e+(0,n1.getLocStart)(r),endIndex:e+(0,n1.getLocEnd)(r)})}async function fN(t,e){if(t==="@theme"||t==="@app")return!0;let r=`blocks/${t}.liquid`;return await(0,$H.doesFileExist)(e,r)}});var tL=P(Fs=>{"use strict";b();Object.defineProperty(Fs,"__esModule",{value:!0});function ln(t){let e=t||"";return function(){throw new Error("this method "+e+" is abstract! (it has no implementation in class "+this.constructor.name+")")}}function cn(t,e){if(!t)throw new Error(e||"Assertion failed")}function u1(t,e,r){let n;Object.defineProperty(t,e,{get(){return n||(n=r.call(this)),n}})}function UH(t){return t&&Object.assign({},t)}function PN(t,e){let r=[];for(;e-- >0;)r.push(t());return r}function CN(t,e){return new Array(e+1).join(t)}function Jd(t,e){return PN(()=>t,e)}function c1(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];t.lastIndexOf(n)!==r&&e.indexOf(n)<0&&e.push(n)}return e}function qN(t){let e=[];return t.forEach(r=>{e.indexOf(r)<0&&e.push(r)}),e}function Oo(t){let e=t[0];return e===e.toUpperCase()}function RN(t){return!Oo(t)}function MN(t,e,r){let n=r||" ";return t.length<e?CN(n,e-t.length)+t:t}function Po(){this.strings=[]}Po.prototype.append=function(t){this.strings.push(t)};Po.prototype.contents=function(){return this.strings.join("")};var s1=t=>String.fromCodePoint(parseInt(t,16));function DN(t){if(t.charAt(0)==="\\")switch(t.charAt(1)){case"b":return"\b";case"f":return"\f";case"n":return` `;case"r":return"\r";case"t":return" ";case"v":return"\v";case"x":return s1(t.slice(2,4));case"u":return t.charAt(2)==="{"?s1(t.slice(3,-1)):s1(t.slice(2,6));default:return t.charAt(1)}else return t}function w1(t){if(t==null)return String(t);let e=Object.prototype.toString.call(t);try{let r;return t.constructor&&t.constructor.name?r=t.constructor.name:e.indexOf("[object ")===0?r=e.slice(8,-1):r=typeof t,r+": "+JSON.stringify(String(t))}catch{return e}}function FN(t,e="unexpected null value"){if(t==null)throw new Error(e);return t}var WH=Object.freeze({__proto__:null,abstract:ln,assert:cn,defineLazyProperty:u1,clone:UH,repeatFn:PN,repeatStr:CN,repeat:Jd,getDuplicates:c1,copyWithoutDuplicates:qN,isSyntactic:Oo,isLexical:RN,padLeft:MN,StringBuffer:Po,unescapeCodePoint:DN,unexpectedObjToString:w1,checkNotNull:FN});function GH(t){let e=0;return t.map(n=>{let i=n.toString();return e=Math.max(e,i.length),i}).map(n=>MN(n,e))}function hN(t,e,r){let n=t.length,i=t.slice(0,r),s=t.slice(r+e.length);return(i+e+s).substr(0,n)}function HH(...t){let e=this,{offset:r}=e,{repeatStr:n}=WH,i=new Po;i.append("Line "+e.lineNum+", col "+e.colNum+`: `);let s=GH([e.prevLine==null?0:e.lineNum-1,e.lineNum,e.nextLine==null?0:e.lineNum+1]),a=(d,m,h)=>{i.append(h+s[d]+" | "+m+` `)};e.prevLine!=null&&a(0,e.prevLine," "),a(1,e.line,"> ");let u=e.line.length,c=n(" ",u+1);for(let d=0;d<t.length;++d){let m=t[d][0],h=t[d][1];cn(m>=0&&m<=h,"range start must be >= 0 and <= end");let y=r-e.colNum+1;m=Math.max(0,m-y),h=Math.min(h-y,u),c=hN(c,n("~",h-m),m)}let p=2+s[1].length+3;return i.append(n(" ",p)),c=hN(c,"^",e.colNum-1),i.append(c.replace(/ +$/,"")+` `),e.nextLine!=null&&a(2,e.nextLine," "),i.contents()}var l1=[];function jN(t){l1.push(t)}function zH(t){l1.forEach(e=>{e(t)}),l1=null}function Kd(t,e){let r=1,n=1,i=0,s=0,a=null,u=null,c=-1;for(;i<e;){let m=t.charAt(i++);m===` `?(r++,n=1,c=s,s=i):m!=="\r"&&n++}let p=t.indexOf(` `,s);if(p===-1)p=t.length;else{let m=t.indexOf(` `,p+1);a=m===-1?t.slice(p):t.slice(p,m),a=a.replace(/^\r?\n/,"").replace(/\r$/,"")}c>=0&&(u=t.slice(c,s).replace(/\r?\n$/,""));let d=t.slice(s,p).replace(/\r$/,"");return{offset:e,lineNum:r,colNum:n,line:d,prevLine:u,nextLine:a,toString:HH}}function x1(t,e,...r){return Kd(t,e).toString(...r)}var dN=(()=>{let t=0;return e=>""+e+t++})();function JH(t,e,r){return r(e[t])}function KH(t,e,r){return e[t].map(r)}function mN(t){let e=t.split(/ ?\[\]/);return e.length===2?KH.bind(null,e[0]):JH.bind(null,t)}function gN(t,e,r){return t.map(n=>n(e,r))}function QH(t){return typeof t=="string"?gN.bind(null,[mN(t)]):Array.isArray(t)?gN.bind(null,t.map(mN)):(cn(typeof t=="function","Expected a string, Array, or function"),cn(t.length===2,"Expected a function of arity 2, got "+t.length),t)}function yN(t){return/^[a-zA-Z_][0-9a-zA-Z_]*$/.test(t)}function _N(t){return t.trim()}function YH(t){let e=t.split(/[()]/).map(_N);if(e.length===3&&e[2]===""){let r=e[0],n=[];if(e[1].length>0&&(n=e[1].split(",").map(_N)),yN(r)&&n.every(yN))return{name:r,formals:n}}throw new Error("Invalid operation signature: "+t)}var f1=class{constructor(e){this._shapes=e.shapes,this._getTag=e.getTag,this.Adapter=function(r,n){this._adaptee=r,this._family=n},this.Adapter.prototype.valueOf=function(){throw new Error("heeey!")},this.operations={},this._arities=Object.create(null),this._getChildren=Object.create(null),Object.keys(this._shapes).forEach(r=>{let n=this._shapes[r];this._getChildren[r]=QH(n),typeof n!="function"&&(this._arities[r]=Array.isArray(n)?n.length:1)}),this._wrap=r=>new this.Adapter(r,this)}wrap(e){return this._wrap(e)}_checkActionDict(e){Object.keys(e).forEach(r=>{cn(r in this._getChildren,"Unrecognized action name '"+r+"'");let n=e[r];if(cn(typeof n=="function","Key '"+r+"': expected function, got "+n),r in this._arities){let i=this._arities[r],s=e[r].length;cn(s===i,"Action '"+r+"' has the wrong arity: expected "+i+", got "+s)}})}addOperation(e,r){let n=YH(e),{name:i}=n;this._checkActionDict(r),this.operations[i]={name:i,formals:n.formals,actions:r};let s=this;return this.Adapter.prototype[i]=function(...a){let u=s._getTag(this._adaptee);cn(u in s._getChildren,"getTag returned unrecognized tag '"+u+"'"),cn(u in r,"No action for '"+u+"' in operation '"+i+"'");let c=Object.create(null);for(let[m,h]of Object.entries(a))c[n.formals[m]]=h;let p=this.args;this.args=c;let d=r[u].apply(this,s._getChildren[u](this._adaptee,s._wrap));return this.args=p,d},this}};function vN(t){return t.toAST(this.args.mapping)}function bN(){return[]}function SN(t,e,r){return[t.toAST(this.args.mapping)].concat(r.toAST(this.args.mapping))}var XH={listOf:vN,ListOf:vN,emptyListOf:bN,EmptyListOf:bN,nonemptyListOf:SN,NonemptyListOf:SN},BN={_terminal(){return this.sourceString},_nonterminal(...t){let{ctorName:e}=this._node,{mapping:r}=this.args;if(!Object.prototype.hasOwnProperty.call(r,e)){if(this.isLexical())return this.sourceString;let s=t.filter(a=>!a.isTerminal());if(s.length===1)return s[0].toAST(r)}if(typeof r[e]=="number")return t[r[e]].toAST(r);let n=r[e]||t,i={type:e};for(let s in n){let a=r[e]&&r[e][s];typeof a=="number"?i[s]=t[a].toAST(r):typeof a=="string"||typeof a=="boolean"||a===null?i[s]=a:typeof a=="object"&&a instanceof Number?i[s]=Number(a):typeof a=="function"?i[s]=a.call(this,t):a===void 0&&(t[s]&&!t[s].isTerminal()?i[s]=t[s].toAST(r):delete i[s])}return i},_iter(...t){return this._node.isOptional()?this.numChildren===0?null:t[0].toAST(this.args.mapping):t.map(e=>e.toAST(this.args.mapping))}};function ZH(t,e){if(typeof t.failed!="function"||t.failed())throw new Error("toAST() expects a succesful MatchResult as first parameter");e=Object.assign({},XH,e);let r=Object.assign({},BN);for(let s in e)typeof e[s]=="function"&&(r[s]=e[s],delete e[s]);return t._cst.grammar.createSemantics().addOperation("toAST(mapping)",r)(t).toAST(e)}function ez(t){if(typeof t.createSemantics!="function")throw new Error("semanticsToAST() expects a Grammar as parameter");return t.createSemantics().addOperation("toAST(mapping)",BN)}var $N=t=>new RegExp(String.raw`\p{${t}}`,"u"),p1=Object.fromEntries(["Cc","Cf","Cn","Co","Cs","Ll","Lm","Lo","Lt","Lu","Mc","Me","Mn","Nd","Nl","No","Pc","Pd","Pe","Pf","Pi","Po","Ps","Sc","Sk","Sm","So","Zl","Zp","Zs"].map(t=>[t,$N(t)]));p1.Ltmo=/\p{Lt}|\p{Lm}|\p{Lo}/u;var wN=Object.fromEntries(["XID_Start","XID_Continue","White_Space"].map(t=>[t,$N(t)])),Ve=class t{constructor(){if(this.constructor===t)throw new Error("PExpr cannot be instantiated -- it's abstract")}withSource(e){return e&&(this.source=e.trimmed()),this}},zr=Object.create(Ve.prototype),Jr=Object.create(Ve.prototype),ur=class extends Ve{constructor(e){super(),this.obj=e}},vr=class extends Ve{constructor(e,r){super(),this.from=e,this.to=r,this.matchCodePoint=e.length>1||r.length>1}},br=class extends Ve{constructor(e){super(),this.index=e}},Gt=class extends Ve{constructor(e){super(),this.terms=e}},Yu=class extends Gt{constructor(e,r,n){let i=e.rules[r].body;super([n,i]),this.superGrammar=e,this.name=r,this.body=n}},Xu=class extends Gt{constructor(e,r,n,i){let s=e.rules[r].body;super([...n,s,...i]),this.superGrammar=e,this.ruleName=r,this.expansionPos=n.length}},Qt=class extends Ve{constructor(e){super(),this.factors=e}},Tr=class extends Ve{constructor(e){super(),this.expr=e}},Ms=class extends Tr{},Aa=class extends Tr{},Fi=class extends Tr{};Ms.prototype.operator="*";Aa.prototype.operator="+";Fi.prototype.operator="?";Ms.prototype.minNumMatches=0;Aa.prototype.minNumMatches=1;Fi.prototype.minNumMatches=0;Ms.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Aa.prototype.maxNumMatches=Number.POSITIVE_INFINITY;Fi.prototype.maxNumMatches=1;var ar=class extends Ve{constructor(e){super(),this.expr=e}},Er=class extends Ve{constructor(e){super(),this.expr=e}},Hr=class extends Ve{constructor(e){super(),this.expr=e}},ot=class extends Ve{constructor(e,r=[]){super(),this.ruleName=e,this.args=r}isSyntactic(){return Oo(this.ruleName)}toMemoKey(){return this._memoKey||Object.defineProperty(this,"_memoKey",{value:this.toString()}),this._memoKey}},or=class extends Ve{constructor(e){if(super(),this.categoryOrProp=e,e in p1)this.pattern=p1[e];else if(e in wN)this.pattern=wN[e];else throw new Error(`Invalid Unicode category or property name: ${JSON.stringify(e)}`)}};function Ft(t,e){let r;return e?(r=new Error(e.getLineAndColumnMessage()+t),r.shortMessage=t,r.interval=e):r=new Error(t),r}function h1(){return Ft("Interval sources don't match")}function tz(t){let e=new Error;return Object.defineProperty(e,"message",{enumerable:!0,get(){return t.message}}),Object.defineProperty(e,"shortMessage",{enumerable:!0,get(){return"Expected "+t.getExpectedText()}}),e.interval=t.getInterval(),e}function rz(t,e,r){let n=e?`Grammar ${t} is not declared in namespace '${e}'`:"Undeclared grammar "+t;return Ft(n,r)}function nz(t,e){return Ft("Grammar "+t.name+" is already declared in this namespace")}function iz(t){return Ft(`Grammar '${t.name}' does not support incremental parsing`)}function VN(t,e,r){return Ft("Rule "+t+" is not declared in grammar "+e,r)}function sz(t,e,r){return Ft("Cannot override rule "+t+" because it is not declared in "+e,r)}function az(t,e,r){return Ft("Cannot extend rule "+t+" because it is not declared in "+e,r)}function xN(t,e,r,n){let i="Duplicate declaration for rule '"+t+"' in grammar '"+e+"'";return e!==r&&(i+=" (originally declared in '"+r+"')"),Ft(i,n)}function UN(t,e,r,n){return Ft("Wrong number of parameters for rule "+t+" (expected "+e+", got "+r+")",n)}function oz(t,e,r,n){return Ft("Wrong number of arguments for rule "+t+" (expected "+e+", got "+r+")",n)}function kN(t,e,r){return Ft("Duplicate parameter names in rule "+t+": "+e.join(", "),r)}function uz(t,e){return Ft("Invalid parameter to rule "+t+": "+e+" has arity "+e.getArity()+", but parameter expressions must have arity 1",e.source)}var cz="NOTE: A _syntactic rule_ is a rule whose name begins with a capital letter. See https://ohmjs.org/d/svl for more details.";function lz(t,e){return Ft("Cannot apply syntactic rule "+t+" from here (inside a lexical context)",e.source)}function fz(t){let{ruleName:e}=t;return Ft(`applySyntactic is for syntactic rules, but '${e}' is a lexical rule. `+cz,t.source)}function pz(t){return Ft("applySyntactic is not required here (in a syntactic context)",t.source)}function AN(t,e){return Ft("Incorrect argument type: expected "+t,e.source)}function hz(t){return Ft("'...' can appear at most once in a rule body",t.source)}function dz(t){let e=t._node;cn(e&&e.isNonterminal()&&e.ctorName==="escapeChar_unicodeCodePoint");let r=t.children.slice(1,-1).map(i=>i.source),n=r[0].coverageWith(...r.slice(1));return Ft(`U+${n.contents} is not a valid Unicode code point`,n)}function WN(t,e){let r=e.length>0?e[e.length-1].args:[],i="Nullable expression "+t.expr.substituteParams(r)+" is not allowed inside '"+t.operator+"' (possible infinite loop)";if(e.length>0){let s=e.map(a=>new ot(a.ruleName,a.args)).join(` `);i+=` Application stack (most recent application last): `+s}return Ft(i,t.expr.source)}function GN(t,e,r,n){return Ft("Rule "+t+" involves an alternation which has inconsistent arity (expected "+e+", got "+r+")",n.source)}function mz(t){let e=t.map(r=>r.message);return Ft(["Errors:"].concat(e).join(` - `),t[0].interval)}function gz(t,e,r,n){let i=n.slice(0,-1).map(c=>{let p=" "+c[0].name+" > "+c[1];return c.length===3?p+" for '"+c[2]+"'":p}).join(` `);i+=` `+e+" > "+t;let s="";t==="_iter"&&(s=[` NOTE: as of Ohm v16, there is no default action for iteration nodes \u2014 see `," https://ohmjs.org/d/dsa for details."].join(` `));let a=[`Missing semantic action for '${t}' in ${r} '${e}'.${s}`,"Action stack (most recent call last):",i].join(` `),u=Ft(a);return u.name="missingSemanticAction",u}function yz(t){if(t.length===1)throw t[0];if(t.length>1)throw mz(t)}var No=class t{constructor(e,r,n){Object.defineProperty(this,"_sourceString",{value:e,configurable:!1,enumerable:!1,writable:!1}),this.startIdx=r,this.endIdx=n}get sourceString(){return this._sourceString}get contents(){return this._contents===void 0&&(this._contents=this.sourceString.slice(this.startIdx,this.endIdx)),this._contents}get length(){return this.endIdx-this.startIdx}coverageWith(...e){return t.coverage(...e,this)}collapsedLeft(){return new t(this.sourceString,this.startIdx,this.startIdx)}collapsedRight(){return new t(this.sourceString,this.endIdx,this.endIdx)}getLineAndColumn(){return Kd(this.sourceString,this.startIdx)}getLineAndColumnMessage(){let e=[this.startIdx,this.endIdx];return x1(this.sourceString,this.startIdx,e)}minus(e){if(this.sourceString!==e.sourceString)throw h1();return this.startIdx===e.startIdx&&this.endIdx===e.endIdx?[]:this.startIdx<e.startIdx&&e.endIdx<this.endIdx?[new t(this.sourceString,this.startIdx,e.startIdx),new t(this.sourceString,e.endIdx,this.endIdx)]:this.startIdx<e.endIdx&&e.endIdx<this.endIdx?[new t(this.sourceString,e.endIdx,this.endIdx)]:this.startIdx<e.startIdx&&e.startIdx<this.endIdx?[new t(this.sourceString,this.startIdx,e.startIdx)]:[this]}relativeTo(e){if(this.sourceString!==e.sourceString)throw h1();return cn(this.startIdx>=e.startIdx&&this.endIdx<=e.endIdx,"other interval does not cover this one"),new t(this.sourceString,this.startIdx-e.startIdx,this.endIdx-e.startIdx)}trimmed(){let{contents:e}=this,r=this.startIdx+e.match(/^\s*/)[0].length,n=this.endIdx-e.match(/\s*$/)[0].length;return new t(this.sourceString,r,n)}subInterval(e,r){let n=this.startIdx+e;return new t(this.sourceString,n,n+r)}};No.coverage=function(t,...e){let{startIdx:r,endIdx:n}=t;for(let i of e){if(i.sourceString!==t.sourceString)throw h1();r=Math.min(r,i.startIdx),n=Math.max(n,i.endIdx)}return new No(t.sourceString,r,n)};var _z=65535,vz=1114111,Zu=class{constructor(e){this.source=e,this.pos=0,this.examinedLength=0}atEnd(){let e=this.pos>=this.source.length;return this.examinedLength=Math.max(this.examinedLength,this.pos+1),e}next(){let e=this.source[this.pos++];return this.examinedLength=Math.max(this.examinedLength,this.pos),e}nextCharCode(){let e=this.next();return e&&e.charCodeAt(0)}nextCodePoint(){let e=this.source.slice(this.pos++).codePointAt(0);return e>_z&&(this.pos+=1),this.examinedLength=Math.max(this.examinedLength,this.pos),e}matchString(e,r){let n;if(r){for(n=0;n<e.length;n++){let i=this.next(),s=e[n];if(i==null||i.toUpperCase()!==s.toUpperCase())return!1}return!0}for(n=0;n<e.length;n++)if(this.next()!==e[n])return!1;return!0}sourceSlice(e,r){return this.source.slice(e,r)}interval(e,r){return new No(this.source,e,r||this.pos)}},Vd=class{constructor(e,r,n,i,s,a,u){this.matcher=e,this.input=r,this.startExpr=n,this._cst=i,this._cstOffset=s,this._rightmostFailurePosition=a,this._rightmostFailures=u,this.failed()&&(u1(this,"message",function(){let c="Expected "+this.getExpectedText();return x1(this.input,this.getRightmostFailurePosition())+c}),u1(this,"shortMessage",function(){let c="expected "+this.getExpectedText(),p=Kd(this.input,this.getRightmostFailurePosition());return"Line "+p.lineNum+", col "+p.colNum+": "+c}))}succeeded(){return!!this._cst}failed(){return!this.succeeded()}getRightmostFailurePosition(){return this._rightmostFailurePosition}getRightmostFailures(){if(!this._rightmostFailures){this.matcher.setInput(this.input);let e=this.matcher._match(this.startExpr,{tracing:!1,positionToRecordFailures:this.getRightmostFailurePosition()});this._rightmostFailures=e.getRightmostFailures()}return this._rightmostFailures}toString(){return this.succeeded()?"[match succeeded]":"[match failed at position "+this.getRightmostFailurePosition()+"]"}getExpectedText(){if(this.succeeded())throw new Error("cannot get expected text of a successful MatchResult");let e=new Po,r=this.getRightmostFailures();r=r.filter(n=>!n.isFluffy());for(let n=0;n<r.length;n++)n>0&&(n===r.length-1?e.append(r.length>2?", or ":" or "):e.append(", ")),e.append(r[n].toString());return e.contents()}getInterval(){let e=this.getRightmostFailurePosition();return new No(this.input,e,e)}},d1=class{constructor(){this.applicationMemoKeyStack=[],this.memo={},this.maxExaminedLength=0,this.maxRightmostFailureOffset=-1,this.currentLeftRecursion=void 0}isActive(e){return this.applicationMemoKeyStack.indexOf(e.toMemoKey())>=0}enter(e){this.applicationMemoKeyStack.push(e.toMemoKey())}exit(){this.applicationMemoKeyStack.pop()}startLeftRecursion(e,r){r.isLeftRecursion=!0,r.headApplication=e,r.nextLeftRecursion=this.currentLeftRecursion,this.currentLeftRecursion=r;let{applicationMemoKeyStack:n}=this,i=n.indexOf(e.toMemoKey())+1,s=n.slice(i);r.isInvolved=function(a){return s.indexOf(a)>=0},r.updateInvolvedApplicationMemoKeys=function(){for(let a=i;a<n.length;a++){let u=n[a];this.isInvolved(u)||s.push(u)}}}endLeftRecursion(){this.currentLeftRecursion=this.currentLeftRecursion.nextLeftRecursion}shouldUseMemoizedResult(e){if(!e.isLeftRecursion)return!0;let{applicationMemoKeyStack:r}=this;for(let n=0;n<r.length;n++){let i=r[n];if(e.isInvolved(i))return!1}return!0}memoize(e,r){return this.memo[e]=r,this.maxExaminedLength=Math.max(this.maxExaminedLength,r.examinedLength),this.maxRightmostFailureOffset=Math.max(this.maxRightmostFailureOffset,r.rightmostFailureOffset),r}clearObsoleteEntries(e,r){if(e+this.maxExaminedLength<=r)return;let{memo:n}=this;this.maxExaminedLength=0,this.maxRightmostFailureOffset=-1,Object.keys(n).forEach(i=>{let s=n[i];e+s.examinedLength>r?delete n[i]:(this.maxExaminedLength=Math.max(this.maxExaminedLength,s.examinedLength),this.maxRightmostFailureOffset=Math.max(this.maxRightmostFailureOffset,s.rightmostFailureOffset))})}},bz="\u2717",Sz="\u2713",wz="\u22C5",xz="\u21D2",kz="\u2409",Az="\u240A",Iz="\u240D",m1={succeeded:1,isRootNode:2,isImplicitSpaces:4,isMemoized:8,isHeadOfLeftRecursion:16,terminatesLR:32};function Tz(t){return Jd(" ",t).join("")}function Ez(t,e,r){let n=HN(t.slice(e,e+r));return n.length<r?n+Jd(" ",r-n.length).join(""):n}function HN(t){return typeof t=="string"?t.replace(/ /g,wz).replace(/\t/g,kz).replace(/\n/g,Az).replace(/\r/g,Iz):String(t)}var ec=class t{constructor(e,r,n,i,s,a,u){this.input=e,this.pos=this.pos1=r,this.pos2=n,this.source=new No(e,r,n),this.expr=i,this.bindings=a,this.children=u||[],this.terminatingLREntry=null,this._flags=s?m1.succeeded:0}get displayString(){return this.expr.toDisplayString()}clone(){return this.cloneWithExpr(this.expr)}cloneWithExpr(e){let r=new t(this.input,this.pos,this.pos2,e,this.succeeded,this.bindings,this.children);return r.isHeadOfLeftRecursion=this.isHeadOfLeftRecursion,r.isImplicitSpaces=this.isImplicitSpaces,r.isMemoized=this.isMemoized,r.isRootNode=this.isRootNode,r.terminatesLR=this.terminatesLR,r.terminatingLREntry=this.terminatingLREntry,r}recordLRTermination(e,r){this.terminatingLREntry=new t(this.input,this.pos,this.pos2,this.expr,!1,[r],[e]),this.terminatingLREntry.terminatesLR=!0}walk(e,r){let n=e;typeof n=="function"&&(n={enter:n});function i(s,a,u){let c=!0;n.enter&&n.en