varR=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,r,n,o,c,l){this.type=t,this.name=r,this.prefix=n,this.value=o,this.suffix=c,this.modifier=l}hasCustomName(){returnthis.name!==""&&typeofthis.name!="number"}},be=/[$_\p{ID_Start}]/u,Pe=/[$_\u200C\u200D\p{ID_Continue}]/u,M=".*";functionRe(e,t){return(t?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(e)}functionv(e,t=!1){letr=[],n=0;for(;n<e.length;){leto=e[n],c=function(l){if(!t)thrownewTypeError(l);r.push({type:"INVALID_CHAR",index:n,value:e[n++]})};if(o==="*"){r.push({type:"ASTERISK",index:n,value:e[n++]});continue}if(o==="+"||o==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:e[n++]});continue}if(o==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});continue}if(o==="{"){r.push({type:"OPEN",index:n,value:e[n++]});continue}if(o==="}"){r.push({type:"CLOSE",index:n,value:e[n++]});continue}if(o===":"){letl="",s=n+1;for(;s<e.length;){leti=e.substr(s,1);if(s===n+1&&be.test(i)||s!==n+1&&Pe.test(i)){l+=e[s++];continue}break}if(!l){c(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:l}),n=s;continue}if(o==="("){letl=1,s="",i=n+1,a=!1;if(e[i]==="?"){c(`Pattern cannot start with "?" at ${i}`);continue}for(;i<e.length;){if(!Re(e[i],!1)){c(`Invalid character '${e[i]}' at ${i}.`),a=!0;break}if(e[i]==="\\"){s+=e[i++]+e[i++];continue}if(e[i]===")"){if(l--,l===0){i++;break}}elseif(e[i]==="("&&(l++,e[i+1]!=="?")){c(`Capturing groups are not allowed at ${i}`),a=!0;break}s+=e[i++]}if(a)continue;if(l){c(`Unbalanced pattern at ${n}`);continue}if(!s){c(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:s}),n=i;continue}r.push({type:"CHAR",index:n,value:e[n++]})}returnr.push({type:"END",index:n,value:""}),r}functionD(e,t={}){letr=v(e);t.delimiter??="/#?",t.prefixes??="./";letn=`[^${S(t.delimiter)}]+?`,o=[],c=0,l=0,s="",i=newSet,a=h=>{if(l<r.length&&r[l].type===h)returnr[l++].value},f=()=>a("OTHER_MODIFIER")??a("ASTERISK"),d=h=>{letu=a(h);if(u!==void0)returnu;let{type:p,index:A}=r[l];thrownewTypeError(`Unexpected ${p} at ${A}, expected ${h}`)},T=()=>{leth="",u;for(;u=a("CHAR")??a("ESCAPED_CHAR");)h+=u;returnh},Se=h=>h,L=t.encodePart||Se,I="",U=h=>{I+=h},$=()=>{I.length&&(o.push(newR(3,"","",L(I),"",3)),I="")},V=(h,u,p,A,Y)=>{letg=3;switch(Y){case"?":g=1;break;case"*":g=0;break;case"+":g=2;break}if(!u&&!p&&g===3){U(h);return}if($(),!u&&!p){if(!h)return;o.push(newR(3,"","",L(h),"",g));return}letm;p?p==="*"?m=M:m=p:m=n;letO=2;m===n?(O=1,m=""):m===M&&(O=0,m="");letP;if(u?P=u:p&&(P=c++),i.has(P))thrownewTypeError(`Duplicate name '${P}'.`);i.add(P),o.push(newR(O,P,L(h),m,L(A),g))};for(;l<r.length;){leth=a("CHAR"),u=a("NAME"),p=a("REGEX");if(!u&&!p&&(p=a("ASTERISK")),u||p){letg=h??"";t.prefixes.indexOf(g)===-1&&(U(g),g=""),$();letm=f();V(g,u,p,"",m);continue}letA=h??a("ESCAPED_CHAR");if(A){U(A);continue}if(a("OPEN")){letg=T(),m=a("NAME"),O=a("REGEX");!m&&!O&&(O=a("ASTERISK"));letP=T();d("CLOSE");letxe=f();V(g,m,O,P,xe);continue}$(),d("END")}returno}functionS(e){returne.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}functionX(e){returne&&e.ignoreCase?"ui":"u"}functionZ(e,t,r){returnF(D(e,r),t,r)}functionk(e){switch(e){case0:return"*";case1:return"?";case2:return"+";case3:return""}}functionF(e,t,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";letn=r.start?"^":"";for(letsofe){if(s.type===3){s.modifier===3?n+=S(s.value):n+=`(?:${S(s.value)})${k(s.modifier)}`;continue}t&&t.push(s.name);leti=`[^${S(r.delimiter)}]+?`,a=s.value;if(s.type===1?a=i:s.type===0&&(a=M),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${a})${k(s.modifier)}`:n+=`((?:${a})${k(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${S(s.prefix)}(${a})${S(s.suffix)})`,n+=k(s.modifier);continue}n+=`(?:${S(s.prefix)}`,n+=`((?:${a})(?:`,n+=S(s.suffix),n+=S(s.prefix),n+=`(?:${a}))*)${S(s.suffix)})`,s.modifier===0&&(n+="?")}leto=`[${S(r.endsWith)}]|$`,c=`[${S(r.delimiter)}]`;if(r.end)returnr.strict||(n+=`${c}?`)