UNPKG

@drincs/nqtr

Version:

A complete system introducing the concepts of location, time and event, producing the framework of a not-quite-point-and-click adventure game.

2 lines 46.3 kB
'use strict';var Fe=require('fs'),path=require('path'),url=require('url'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Fe__namespace=/*#__PURE__*/_interopNamespace(Fe);var $e=Object.create;var Ot=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty;var J=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Te=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ie(e))!Oe.call(t,n)&&n!==s&&Ot(t,n,{get:()=>e[n],enumerable:!(r=Le(e,n))||r.enumerable});return t};var Tt=(t,e,s)=>(s=t!=null?$e(we(t)):{},Te(e||!t||!t.__esModule?Ot(s,"default",{value:t,enumerable:true}):s,t));var kt=J((Zr,gt)=>{var pt=process||{},Pt=pt.argv||[],lt=pt.env||{},Pe=!(lt.NO_COLOR||Pt.includes("--no-color"))&&(!!lt.FORCE_COLOR||Pt.includes("--color")||pt.platform==="win32"||(pt.stdout||{}).isTTY&&lt.TERM!=="dumb"||!!lt.CI),He=(t,e,s=t)=>r=>{let n=""+r,i=n.indexOf(e,t.length);return ~i?t+ke(n,e,s,i)+e:t+n+e},ke=(t,e,s,r)=>{let n="",i=0;do n+=t.substring(i,r)+s,i=r+e.length,r=t.indexOf(e,i);while(~r);return n+t.substring(i)},Ht=(t=Pe)=>{let e=t?He:()=>String;return {isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};gt.exports=Ht();gt.exports.createColors=Ht;});var rt=J((ln,Vt)=>{var Qt="[^\\\\/]",ks="(?=.)",jt="[^/]",yt="(?:\\/|$)",zt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Ns="(?!\\.)",Ds=`(?!${zt}${Rt})`,Bs=`(?!\\.{0,1}${yt})`,Ms=`(?!${Rt})`,qs="[^.\\/]",Fs=`${jt}*?`,Gs="/",Yt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ks,QMARK:jt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Ns,NO_DOTS:Ds,NO_DOT_SLASH:Bs,NO_DOTS_SLASH:Ms,QMARK_NO_DOT:qs,STAR:Fs,START_ANCHOR:zt,SEP:Gs},Ws={...Yt,SLASH_LITERAL:"[\\\\/]",QMARK:Qt,STAR:`${Qt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Us={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Vt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Us,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?Ws:Yt}};});var nt=J(W=>{var{REGEX_BACKSLASH:Ks,REGEX_REMOVE_BACKSLASH:Xs,REGEX_SPECIAL_CHARS:Qs,REGEX_SPECIAL_CHARS_GLOBAL:js}=rt();W.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);W.hasRegexChars=t=>Qs.test(t);W.isRegexChar=t=>t.length===1&&W.hasRegexChars(t);W.escapeRegex=t=>t.replace(js,"\\$1");W.toPosixSlashes=t=>t.replace(Ks,"/");W.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};W.removeBackslashes=t=>t.replace(Xs,e=>e==="\\"?"":e);W.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return r===-1?t:t[r-1]==="\\"?W.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};W.removePrefix=(t,e={})=>{let s=t;return s.startsWith("./")&&(s=s.slice(2),e.prefix="./"),s};W.wrapOutput=(t,e={},s={})=>{let r=s.contains?"":"^",n=s.contains?"":"$",i=`${r}(?:${t})${n}`;return e.negated===true&&(i=`(?:^(?!${i}).*$)`),i};W.basename=(t,{windows:e}={})=>{let s=t.split(e?/[\\/]/:"/"),r=s[s.length-1];return r===""?s[s.length-2]:r};});var ie=J((fn,ne)=>{var Jt=nt(),{CHAR_ASTERISK:xt,CHAR_AT:zs,CHAR_BACKWARD_SLASH:it,CHAR_COMMA:Ys,CHAR_DOT:At,CHAR_EXCLAMATION_MARK:St,CHAR_FORWARD_SLASH:re,CHAR_LEFT_CURLY_BRACE:_t,CHAR_LEFT_PARENTHESES:Et,CHAR_LEFT_SQUARE_BRACKET:Vs,CHAR_PLUS:Js,CHAR_QUESTION_MARK:Zt,CHAR_RIGHT_CURLY_BRACE:Zs,CHAR_RIGHT_PARENTHESES:te,CHAR_RIGHT_SQUARE_BRACKET:tr}=rt(),ee=t=>t===re||t===it,se=t=>{t.isPrefix!==true&&(t.depth=t.isGlobstar?1/0:1);},er=(t,e)=>{let s=e||{},r=t.length-1,n=s.parts===true||s.scanToEnd===true,i=[],o=[],l=[],b=t,x=-1,A=0,y=0,_=false,E=false,R=false,g=false,p=false,m=false,h=false,q=false,F=false,w=false,I=0,L,S,$={value:"",depth:0,isGlob:false},c=()=>x>=r,G=()=>b.charCodeAt(x+1),B=()=>(L=S,b.charCodeAt(++x));for(;x<r;){S=B();let O;if(S===it){h=$.backslashes=true,S=B(),S===_t&&(m=true);continue}if(m===true||S===_t){for(I++;c()!==true&&(S=B());){if(S===it){h=$.backslashes=true,B();continue}if(S===_t){I++;continue}if(m!==true&&S===At&&(S=B())===At){if(_=$.isBrace=true,R=$.isGlob=true,w=true,n===true)continue;break}if(m!==true&&S===Ys){if(_=$.isBrace=true,R=$.isGlob=true,w=true,n===true)continue;break}if(S===Zs&&(I--,I===0)){m=false,_=$.isBrace=true,w=true;break}}if(n===true)continue;break}if(S===re){if(i.push(x),o.push($),$={value:"",depth:0,isGlob:false},w===true)continue;if(L===At&&x===A+1){A+=2;continue}y=x+1;continue}if(s.noext!==true&&(S===Js||S===zs||S===xt||S===Zt||S===St)===true&&G()===Et){if(R=$.isGlob=true,g=$.isExtglob=true,w=true,S===St&&x===A&&(F=true),n===true){for(;c()!==true&&(S=B());){if(S===it){h=$.backslashes=true,S=B();continue}if(S===te){R=$.isGlob=true,w=true;break}}continue}break}if(S===xt){if(L===xt&&(p=$.isGlobstar=true),R=$.isGlob=true,w=true,n===true)continue;break}if(S===Zt){if(R=$.isGlob=true,w=true,n===true)continue;break}if(S===Vs){for(;c()!==true&&(O=B());){if(O===it){h=$.backslashes=true,B();continue}if(O===tr){E=$.isBracket=true,R=$.isGlob=true,w=true;break}}if(n===true)continue;break}if(s.nonegate!==true&&S===St&&x===A){q=$.negated=true,A++;continue}if(s.noparen!==true&&S===Et){if(R=$.isGlob=true,n===true){for(;c()!==true&&(S=B());){if(S===Et){h=$.backslashes=true,S=B();continue}if(S===te){w=true;break}}continue}break}if(R===true){if(w=true,n===true)continue;break}}s.noext===true&&(g=false,R=false);let N=b,a="",u="";A>0&&(a=b.slice(0,A),b=b.slice(A),y-=A),N&&R===true&&y>0?(N=b.slice(0,y),u=b.slice(y)):R===true?(N="",u=b):N=b,N&&N!==""&&N!=="/"&&N!==b&&ee(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),s.unescape===true&&(u&&(u=Jt.removeBackslashes(u)),N&&h===true&&(N=Jt.removeBackslashes(N)));let K={prefix:a,input:t,start:A,base:N,glob:u,isBrace:_,isBracket:E,isGlob:R,isExtglob:g,isGlobstar:p,negated:q,negatedExtglob:F};if(s.tokens===true&&(K.maxDepth=0,ee(S)||o.push($),K.tokens=o),s.parts===true||s.tokens===true){let O;for(let k=0;k<i.length;k++){let z=O?O+1:A,X=i[k],Y=t.slice(z,X);s.tokens&&(k===0&&A!==0?(o[k].isPrefix=true,o[k].value=a):o[k].value=Y,se(o[k]),K.maxDepth+=o[k].depth),(k!==0||Y!=="")&&l.push(Y),O=X;}if(O&&O+1<t.length){let k=t.slice(O+1);l.push(k),s.tokens&&(o[o.length-1].value=k,se(o[o.length-1]),K.maxDepth+=o[o.length-1].depth);}K.slashes=i,K.parts=l;}return K};ne.exports=er;});var ce=J((hn,ae)=>{var ot=rt(),U=nt(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:sr,REGEX_NON_SPECIAL_CHARS:rr,REGEX_SPECIAL_CHARS_BACKREF:nr,REPLACEMENTS:oe}=ot,ir=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let s=`[${t.join("-")}]`;try{new RegExp(s);}catch{return t.map(n=>U.escapeRegex(n)).join("..")}return s},tt=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,ue=t=>{let e=[],s=0,r=0,n=0,i="",o=false;for(let l of t){if(o===true){i+=l,o=false;continue}if(l==="\\"){i+=l,o=true;continue}if(l==='"'){n=n===1?0:1,i+=l;continue}if(n===0){if(l==="[")s++;else if(l==="]"&&s>0)s--;else if(s===0){if(l==="(")r++;else if(l===")"&&r>0)r--;else if(l==="|"&&r===0){e.push(i),i="";continue}}}i+=l;}return e.push(i),e},or=t=>{let e=false;for(let s of t){if(e===true){e=false;continue}if(s==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(s))return false}return true},Ct=t=>{let e=t.trim(),s=true;for(;s===true;)s=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),s=true);if(or(e))return e.replace(/\\(.)/g,"$1")},ur=t=>{let e=t.map(Ct).filter(Boolean);for(let s=0;s<e.length;s++)for(let r=s+1;r<e.length;r++){let n=e[s],i=e[r],o=n[0];if(!(!o||n!==o.repeat(n.length)||i!==o.repeat(i.length))&&(n===i||n.startsWith(i)||i.startsWith(n)))return true}return false},vt=(t,e=true)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let s=0,r=0,n=0,i=false;for(let o=1;o<t.length;o++){let l=t[o];if(i===true){i=false;continue}if(l==="\\"){i=true;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){s++;continue}if(l==="]"&&s>0){s--;continue}if(!(s>0)){if(l==="("){r++;continue}if(l===")"&&(r--,r===0))return e===true&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},ar=t=>`${t.length===1?U.escapeRegex(t[0]):`[${t.map(s=>U.escapeRegex(s)).join("")}]`}*`,cr=t=>{let e=0,s=[];for(;e<t.length;){let r=vt(t.slice(e),false);if(!r||r.type!=="*")return;let n=ue(r.body).map(o=>o.trim());if(n.length!==1)return;let i=Ct(n[0]);if(!i||i.length!==1)return;s.push(i),e+=r.end+1;}if(!(s.length<1))return s},lr=t=>{let e=0,s=t.trim(),r=vt(s);for(;r;)e++,s=r.body.trim(),r=vt(s);return e},pr=(t,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let s=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ot.DEFAULT_MAX_EXTGLOB_RECURSION,r=ue(t).map(l=>l.trim());if(r.length>1&&(r.some(l=>l==="")||r.some(l=>/^[*?]+$/.test(l))||ur(r)))return {risky:true};let n=[],i=false,o=true;for(let l of r){let b=cr(l);if(b){i=true,n.push(...b);continue}let x=Ct(l);if(x&&x.length===1){n.push(x);continue}if(o=false,lr(l)>s)return {risky:true}}return i?o?{risky:true,safeOutput:ar([...new Set(n)])}:{risky:true}:{risky:false}},$t=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=oe[t]||t;let s={...e},r=typeof s.maxLength=="number"?Math.min(ht,s.maxLength):ht,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);let i={type:"bos",value:"",output:s.prepend||""},o=[i],l=s.capture?"":"?:",b=ot.globChars(s.windows),x=ot.extglobChars(b),{DOT_LITERAL:A,PLUS_LITERAL:y,SLASH_LITERAL:_,ONE_CHAR:E,DOTS_SLASH:R,NO_DOT:g,NO_DOT_SLASH:p,NO_DOTS_SLASH:m,QMARK:h,QMARK_NO_DOT:q,STAR:F,START_ANCHOR:w}=b,I=d=>`(${l}(?:(?!${w}${d.dot?R:A}).)*?)`,L=s.dot?"":g,S=s.dot?h:q,$=s.bash===true?I(s):F;s.capture&&($=`(${$})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);let c={input:t,index:-1,start:0,dot:s.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:o};t=U.removePrefix(t,c),n=t.length;let G=[],B=[],N=[],a=i,u,K=()=>c.index===n-1,O=c.peek=(d=1)=>t[c.index+d],k=c.advance=()=>t[++c.index]||"",z=()=>t.slice(c.index+1),X=(d="",H=0)=>{c.consumed+=d,c.index+=H;},Y=d=>{c.output+=d.output!=null?d.output:d.value,X(d.value);},ve=()=>{let d=1;for(;O()==="!"&&(O(2)!=="("||O(3)==="?");)k(),c.start++,d++;return d%2===0?false:(c.negated=true,c.start++,true)},at=d=>{c[d]++,N.push(d);},V=d=>{c[d]--,N.pop();},v=d=>{if(a.type==="globstar"){let H=c.braces>0&&(d.type==="comma"||d.type==="brace"),f=d.extglob===true||G.length&&(d.type==="pipe"||d.type==="paren");d.type!=="slash"&&d.type!=="paren"&&!H&&!f&&(c.output=c.output.slice(0,-a.output.length),a.type="star",a.value="*",a.output=$,c.output+=a.output);}if(G.length&&d.type!=="paren"&&(G[G.length-1].inner+=d.value),(d.value||d.output)&&Y(d),a&&a.type==="text"&&d.type==="text"){a.output=(a.output||a.value)+d.value,a.value+=d.value;return}d.prev=a,o.push(d),a=d;},ct=(d,H)=>{let f={...x[H],conditions:1,inner:""};f.prev=a,f.parens=c.parens,f.output=c.output,f.startIndex=c.index,f.tokensIndex=o.length;let C=(s.capture?"(":"")+f.open;at("parens"),v({type:d,value:H,output:c.output?"":E}),v({type:"paren",extglob:true,value:k(),output:C}),G.push(f);},Ce=d=>{let H=t.slice(d.startIndex,c.index+1),f=t.slice(d.startIndex+2,c.index),C=pr(f,s);if((d.type==="plus"||d.type==="star")&&C.risky){let T=C.safeOutput?(d.output?"":E)+(s.capture?`(${C.safeOutput})`:C.safeOutput):void 0,Q=o[d.tokensIndex];Q.type="text",Q.value=H,Q.output=T||U.escapeRegex(H);for(let j=d.tokensIndex+1;j<o.length;j++)o[j].value="",o[j].output="",delete o[j].suffix;c.output=d.output+Q.output,c.backtrack=true,v({type:"paren",extglob:true,value:u,output:""}),V("parens");return}let P=d.close+(s.capture?")":""),M;if(d.type==="negate"){let T=$;if(d.inner&&d.inner.length>1&&d.inner.includes("/")&&(T=I(s)),(T!==$||K()||/^\)+$/.test(z()))&&(P=d.close=`)$))${T}`),d.inner.includes("*")&&(M=z())&&/^\.[^\\/.]+$/.test(M)){let Q=$t(M,{...e,fastpaths:false}).output;P=d.close=`)${Q})${T})`;}d.prev.type==="bos"&&(c.negatedExtglob=true);}v({type:"paren",extglob:true,value:u,output:P}),V("parens");};if(s.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let d=false,H=t.replace(nr,(f,C,P,M,T,Q)=>M==="\\"?(d=true,f):M==="?"?C?C+M+(T?h.repeat(T.length):""):Q===0?S+(T?h.repeat(T.length):""):h.repeat(P.length):M==="."?A.repeat(P.length):M==="*"?C?C+M+(T?$:""):$:C?f:`\\${f}`);return d===true&&(s.unescape===true?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),H===t&&s.contains===true?(c.output=t,c):(c.output=U.wrapOutput(H,c,e),c)}for(;!K();){if(u=k(),u==="\0")continue;if(u==="\\"){let f=O();if(f==="/"&&s.bash!==true||f==="."||f===";")continue;if(!f){u+="\\",v({type:"text",value:u});continue}let C=/^\\+/.exec(z()),P=0;if(C&&C[0].length>2&&(P=C[0].length,c.index+=P,P%2!==0&&(u+="\\")),s.unescape===true?u=k():u+=k(),c.brackets===0){v({type:"text",value:u});continue}}if(c.brackets>0&&(u!=="]"||a.value==="["||a.value==="[^")){if(s.posix!==false&&u===":"){let f=a.value.slice(1);if(f.includes("[")&&(a.posix=true,f.includes(":"))){let C=a.value.lastIndexOf("["),P=a.value.slice(0,C),M=a.value.slice(C+2),T=sr[M];if(T){a.value=P+T,c.backtrack=true,k(),!i.output&&o.indexOf(a)===1&&(i.output=E);continue}}}(u==="["&&O()!==":"||u==="-"&&O()==="]")&&(u=`\\${u}`),u==="]"&&(a.value==="["||a.value==="[^")&&(u=`\\${u}`),s.posix===true&&u==="!"&&a.value==="["&&(u="^"),a.value+=u,Y({value:u});continue}if(c.quotes===1&&u!=='"'){u=U.escapeRegex(u),a.value+=u,Y({value:u});continue}if(u==='"'){c.quotes=c.quotes===1?0:1,s.keepQuotes===true&&v({type:"text",value:u});continue}if(u==="("){at("parens"),v({type:"paren",value:u});continue}if(u===")"){if(c.parens===0&&s.strictBrackets===true)throw new SyntaxError(tt("opening","("));let f=G[G.length-1];if(f&&c.parens===f.parens+1){Ce(G.pop());continue}v({type:"paren",value:u,output:c.parens?")":"\\)"}),V("parens");continue}if(u==="["){if(s.nobracket===true||!z().includes("]")){if(s.nobracket!==true&&s.strictBrackets===true)throw new SyntaxError(tt("closing","]"));u=`\\${u}`;}else at("brackets");v({type:"bracket",value:u});continue}if(u==="]"){if(s.nobracket===true||a&&a.type==="bracket"&&a.value.length===1){v({type:"text",value:u,output:`\\${u}`});continue}if(c.brackets===0){if(s.strictBrackets===true)throw new SyntaxError(tt("opening","["));v({type:"text",value:u,output:`\\${u}`});continue}V("brackets");let f=a.value.slice(1);if(a.posix!==true&&f[0]==="^"&&!f.includes("/")&&(u=`/${u}`),a.value+=u,Y({value:u}),s.literalBrackets===false||U.hasRegexChars(f))continue;let C=U.escapeRegex(a.value);if(c.output=c.output.slice(0,-a.value.length),s.literalBrackets===true){c.output+=C,a.value=C;continue}a.value=`(${l}${C}|${a.value})`,c.output+=a.value;continue}if(u==="{"&&s.nobrace!==true){at("braces");let f={type:"brace",value:u,output:"(",outputIndex:c.output.length,tokensIndex:c.tokens.length};B.push(f),v(f);continue}if(u==="}"){let f=B[B.length-1];if(s.nobrace===true||!f){v({type:"text",value:u,output:u});continue}let C=")";if(f.dots===true){let P=o.slice(),M=[];for(let T=P.length-1;T>=0&&(o.pop(),P[T].type!=="brace");T--)P[T].type!=="dots"&&M.unshift(P[T].value);C=ir(M,s),c.backtrack=true;}if(f.comma!==true&&f.dots!==true){let P=c.output.slice(0,f.outputIndex),M=c.tokens.slice(f.tokensIndex);f.value=f.output="\\{",u=C="\\}",c.output=P;for(let T of M)c.output+=T.output||T.value;}v({type:"brace",value:u,output:C}),V("braces"),B.pop();continue}if(u==="|"){G.length>0&&G[G.length-1].conditions++,v({type:"text",value:u});continue}if(u===","){let f=u,C=B[B.length-1];C&&N[N.length-1]==="braces"&&(C.comma=true,f="|"),v({type:"comma",value:u,output:f});continue}if(u==="/"){if(a.type==="dot"&&c.index===c.start+1){c.start=c.index+1,c.consumed="",c.output="",o.pop(),a=i;continue}v({type:"slash",value:u,output:_});continue}if(u==="."){if(c.braces>0&&a.type==="dot"){a.value==="."&&(a.output=A);let f=B[B.length-1];a.type="dots",a.output+=u,a.value+=u,f.dots=true;continue}if(c.braces+c.parens===0&&a.type!=="bos"&&a.type!=="slash"){v({type:"text",value:u,output:A});continue}v({type:"dot",value:u,output:A});continue}if(u==="?"){if(!(a&&a.value==="(")&&s.noextglob!==true&&O()==="("&&O(2)!=="?"){ct("qmark",u);continue}if(a&&a.type==="paren"){let C=O(),P=u;(a.value==="("&&!/[!=<:]/.test(C)||C==="<"&&!/<([!=]|\w+>)/.test(z()))&&(P=`\\${u}`),v({type:"text",value:u,output:P});continue}if(s.dot!==true&&(a.type==="slash"||a.type==="bos")){v({type:"qmark",value:u,output:q});continue}v({type:"qmark",value:u,output:h});continue}if(u==="!"){if(s.noextglob!==true&&O()==="("&&(O(2)!=="?"||!/[!=<:]/.test(O(3)))){ct("negate",u);continue}if(s.nonegate!==true&&c.index===0){ve();continue}}if(u==="+"){if(s.noextglob!==true&&O()==="("&&O(2)!=="?"){ct("plus",u);continue}if(a&&a.value==="("||s.regex===false){v({type:"plus",value:u,output:y});continue}if(a&&(a.type==="bracket"||a.type==="paren"||a.type==="brace")||c.parens>0){v({type:"plus",value:u});continue}v({type:"plus",value:y});continue}if(u==="@"){if(s.noextglob!==true&&O()==="("&&O(2)!=="?"){v({type:"at",extglob:true,value:u,output:""});continue}v({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let f=rr.exec(z());f&&(u+=f[0],c.index+=f[0].length),v({type:"text",value:u});continue}if(a&&(a.type==="globstar"||a.star===true)){a.type="star",a.star=true,a.value+=u,a.output=$,c.backtrack=true,c.globstar=true,X(u);continue}let d=z();if(s.noextglob!==true&&/^\([^?]/.test(d)){ct("star",u);continue}if(a.type==="star"){if(s.noglobstar===true){X(u);continue}let f=a.prev,C=f.prev,P=f.type==="slash"||f.type==="bos",M=C&&(C.type==="star"||C.type==="globstar");if(s.bash===true&&(!P||d[0]&&d[0]!=="/")){v({type:"star",value:u,output:""});continue}let T=c.braces>0&&(f.type==="comma"||f.type==="brace"),Q=G.length&&(f.type==="pipe"||f.type==="paren");if(!P&&f.type!=="paren"&&!T&&!Q){v({type:"star",value:u,output:""});continue}for(;d.slice(0,3)==="/**";){let j=t[c.index+4];if(j&&j!=="/")break;d=d.slice(3),X("/**",3);}if(f.type==="bos"&&K()){a.type="globstar",a.value+=u,a.output=I(s),c.output=a.output,c.globstar=true,X(u);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!M&&K()){c.output=c.output.slice(0,-(f.output+a.output).length),f.output=`(?:${f.output}`,a.type="globstar",a.output=I(s)+(s.strictSlashes?")":"|$)"),a.value+=u,c.globstar=true,c.output+=f.output+a.output,X(u);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&d[0]==="/"){let j=d[1]!==void 0?"|$":"";c.output=c.output.slice(0,-(f.output+a.output).length),f.output=`(?:${f.output}`,a.type="globstar",a.output=`${I(s)}${_}|${_}${j})`,a.value+=u,c.output+=f.output+a.output,c.globstar=true,X(u+k()),v({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&d[0]==="/"){a.type="globstar",a.value+=u,a.output=`(?:^|${_}|${I(s)}${_})`,c.output=a.output,c.globstar=true,X(u+k()),v({type:"slash",value:"/",output:""});continue}c.output=c.output.slice(0,-a.output.length),a.type="globstar",a.output=I(s),a.value+=u,c.output+=a.output,c.globstar=true,X(u);continue}let H={type:"star",value:u,output:$};if(s.bash===true){H.output=".*?",(a.type==="bos"||a.type==="slash")&&(H.output=L+H.output),v(H);continue}if(a&&(a.type==="bracket"||a.type==="paren")&&s.regex===true){H.output=u,v(H);continue}(c.index===c.start||a.type==="slash"||a.type==="dot")&&(a.type==="dot"?(c.output+=p,a.output+=p):s.dot===true?(c.output+=m,a.output+=m):(c.output+=L,a.output+=L),O()!=="*"&&(c.output+=E,a.output+=E)),v(H);}for(;c.brackets>0;){if(s.strictBrackets===true)throw new SyntaxError(tt("closing","]"));c.output=U.escapeLast(c.output,"["),V("brackets");}for(;c.parens>0;){if(s.strictBrackets===true)throw new SyntaxError(tt("closing",")"));c.output=U.escapeLast(c.output,"("),V("parens");}for(;c.braces>0;){if(s.strictBrackets===true)throw new SyntaxError(tt("closing","}"));c.output=U.escapeLast(c.output,"{"),V("braces");}if(s.strictSlashes!==true&&(a.type==="star"||a.type==="bracket")&&v({type:"maybe_slash",value:"",output:`${_}?`}),c.backtrack===true){c.output="";for(let d of c.tokens)c.output+=d.output!=null?d.output:d.value,d.suffix&&(c.output+=d.suffix);}return c};$t.fastpaths=(t,e)=>{let s={...e},r=typeof s.maxLength=="number"?Math.min(ht,s.maxLength):ht,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);t=oe[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:o,ONE_CHAR:l,DOTS_SLASH:b,NO_DOT:x,NO_DOTS:A,NO_DOTS_SLASH:y,STAR:_,START_ANCHOR:E}=ot.globChars(s.windows),R=s.dot?A:x,g=s.dot?y:x,p=s.capture?"":"?:",m={negated:false,prefix:""},h=s.bash===true?".*?":_;s.capture&&(h=`(${h})`);let q=L=>L.noglobstar===true?h:`(${p}(?:(?!${E}${L.dot?b:i}).)*?)`,F=L=>{switch(L){case "*":return `${R}${l}${h}`;case ".*":return `${i}${l}${h}`;case "*.*":return `${R}${h}${i}${l}${h}`;case "*/*":return `${R}${h}${o}${l}${g}${h}`;case "**":return R+q(s);case "**/*":return `(?:${R}${q(s)}${o})?${g}${l}${h}`;case "**/*.*":return `(?:${R}${q(s)}${o})?${g}${h}${i}${l}${h}`;case "**/.*":return `(?:${R}${q(s)}${o})?${i}${l}${h}`;default:{let S=/^(.*?)\.(\w+)$/.exec(L);if(!S)return;let $=F(S[1]);return $?$+i+S[2]:void 0}}},w=U.removePrefix(t,m),I=F(w);return I&&s.strictSlashes!==true&&(I+=`${o}?`),I};ae.exports=$t;});var fe=J((dn,pe)=>{var fr=ie(),Lt=ce(),le=nt(),hr=rt(),dr=t=>t&&typeof t=="object"&&!Array.isArray(t),D=(t,e,s=false)=>{if(Array.isArray(t)){let A=t.map(_=>D(_,e,s));return _=>{for(let E of A){let R=E(_);if(R)return R}return false}}let r=dr(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let n=e||{},i=n.windows,o=r?D.compileRe(t,e):D.makeRe(t,e,false,true),l=o.state;delete o.state;let b=()=>false;if(n.ignore){let A={...e,ignore:null,onMatch:null,onResult:null};b=D(n.ignore,A,s);}let x=(A,y=false)=>{let{isMatch:_,match:E,output:R}=D.test(A,o,e,{glob:t,posix:i}),g={glob:t,state:l,regex:o,posix:i,input:A,output:R,match:E,isMatch:_};return typeof n.onResult=="function"&&n.onResult(g),_===false?(g.isMatch=false,y?g:false):b(A)?(typeof n.onIgnore=="function"&&n.onIgnore(g),g.isMatch=false,y?g:false):(typeof n.onMatch=="function"&&n.onMatch(g),y?g:true)};return s&&(x.state=l),x};D.test=(t,e,s,{glob:r,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:false,output:""};let i=s||{},o=i.format||(n?le.toPosixSlashes:null),l=t===r,b=l&&o?o(t):t;return l===false&&(b=o?o(t):t,l=b===r),(l===false||i.capture===true)&&(i.matchBase===true||i.basename===true?l=D.matchBase(t,e,s,n):l=e.exec(b)),{isMatch:!!l,match:l,output:b}};D.matchBase=(t,e,s,r=s&&s.windows)=>(e instanceof RegExp?e:D.makeRe(e,s)).test(le.basename(t,{windows:r}));D.isMatch=(t,e,s)=>D(e,s)(t);D.parse=(t,e)=>Array.isArray(t)?t.map(s=>D.parse(s,e)):Lt(t,{...e,fastpaths:false});D.scan=(t,e)=>fr(t,e);D.compileRe=(t,e,s=false,r=false)=>{if(s===true)return t.output;let n=e||{},i=n.contains?"":"^",o=n.contains?"":"$",l=`${i}(?:${t.output})${o}`;t&&t.negated===true&&(l=`^(?!${l}).*$`);let b=D.toRegex(l,e);return r===true&&(b.state=t),b};D.makeRe=(t,e={},s=false,r=false)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:false,fastpaths:true};return e.fastpaths!==false&&(t[0]==="."||t[0]==="*")&&(n.output=Lt.fastpaths(t,e)),n.output||(n=Lt(t,e)),D.compileRe(n,e,s,r)};D.toRegex=(t,e)=>{try{let s=e||{};return new RegExp(t,s.flags||(s.nocase?"i":""))}catch(s){if(e&&e.debug===true)throw s;return /$^/}};D.constants=hr;pe.exports=D;});var me=J((gn,ge)=>{var he=fe(),gr=nt();function de(t,e,s=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:gr.isWindows()}),he(t,e,s)}Object.assign(de,he);ge.exports=de;});var wt=Tt(kt());var Nt=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.cjs', document.baseURI).href)));function Ge(t){let e=path.normalize(t);return e.length>1&&e[e.length-1]===path.sep&&(e=e.substring(0,e.length-1)),e}var We=/[\\/]/g;function Mt(t,e){return t.replace(We,e)}var Ue=/^[a-z]:[\\/]$/i;function Ke(t){return t==="/"||Ue.test(t)}function mt(t,e){let{resolvePaths:s,normalizePath:r,pathSeparator:n}=e,i=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=path.resolve(t)),(r||i)&&(t=Ge(t)),t===".")return "";let o=t[t.length-1]!==n;return Mt(o?t+n:t,n)}function qt(t,e){return e+t}function Xe(t,e){return function(s,r){return r.startsWith(t)?r.slice(t.length)+s:Mt(path.relative(t,r),e.pathSeparator)+e.pathSeparator+s}}function Qe(t){return t}function je(t,e,s){return e+t+s}function ze(t,e){let{relativePaths:s,includeBasePath:r}=e;return s&&t?Xe(t,e):r?qt:Qe}function Ye(t){return function(e,s){s.push(e.substring(t.length)||".");}}function Ve(t){return function(e,s,r){let n=e.substring(t.length)||".";r.every(i=>i(n,true))&&s.push(n);}}var Je=(t,e)=>{e.push(t||".");},Ze=(t,e,s)=>{let r=t||".";s.every(n=>n(r,true))&&e.push(r);},ts=()=>{};function es(t,e){let{includeDirs:s,filters:r,relativePaths:n}=e;return s?n?r&&r.length?Ve(t):Ye(t):r&&r.length?Ze:Je:ts}var ss=(t,e,s,r)=>{r.every(n=>n(t,false))&&s.files++;},rs=(t,e,s,r)=>{r.every(n=>n(t,false))&&e.push(t);},ns=(t,e,s,r)=>{s.files++;},is=(t,e)=>{e.push(t);},os=()=>{};function us(t){let{excludeFiles:e,filters:s,onlyCounts:r}=t;return e?os:s&&s.length?r?ss:rs:r?ns:is}var as=t=>t,cs=()=>[""].slice(0,0);function ls(t){return t.group?cs:as}var ps=(t,e,s)=>{t.push({directory:e,files:s,dir:e});},fs=()=>{};function hs(t){return t.group?ps:fs}var ds=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue(),n.realpath(t,(o,l)=>{if(o)return r.dequeue(i?null:o,e);n.stat(l,(b,x)=>{if(b)return r.dequeue(i?null:b,e);if(x.isDirectory()&&Ft(t,l,e))return r.dequeue(null,e);s(x,l),r.dequeue(null,e);});});},gs=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue();try{let o=n.realpathSync(t),l=n.statSync(o);if(l.isDirectory()&&Ft(t,o,e))return;s(l,o);}catch(o){if(!i)throw o}};function ms(t,e){return !t.resolveSymlinks||t.excludeSymlinks?null:e?gs:ds}function Ft(t,e,s){if(s.options.useRealPaths)return bs(e,s);let r=path.dirname(t),n=1;for(;r!==s.root&&n<2;){let i=s.symlinks.get(r);!!i&&(i===e||i.startsWith(e)||e.startsWith(i))?n++:r=path.dirname(r);}return s.symlinks.set(t,e),n>1}function bs(t,e){return e.visited.includes(t+e.options.pathSeparator)}var ys=t=>t.counts,Rs=t=>t.groups,xs=t=>t.paths,As=t=>t.paths.slice(0,t.options.maxFiles),Ss=(t,e,s)=>(ft(e,s,t.counts,t.options.suppressErrors),null),_s=(t,e,s)=>(ft(e,s,t.paths,t.options.suppressErrors),null),Es=(t,e,s)=>(ft(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),vs=(t,e,s)=>(ft(e,s,t.groups,t.options.suppressErrors),null);function ft(t,e,s,r){e(t&&!r?t:null,s);}function Cs(t,e){let{onlyCounts:s,group:r,maxFiles:n}=t;return s?e?ys:Ss:r?e?Rs:vs:n?e?As:Es:e?xs:_s}var Gt={withFileTypes:true},$s=(t,e,s,r,n)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",Gt,(o,l=[])=>{n(l,s,r),t.queue.dequeue(t.options.suppressErrors?null:o,t);});},Ls=(t,e,s,r,n)=>{let{fs:i}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=i.readdirSync(e||".",Gt);}catch(l){if(!t.options.suppressErrors)throw l}n(o,s,r);};function Is(t){return t?Ls:$s}var ws=class{count=0;constructor(t){this.onQueueEmpty=t;}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0));}},Os=class{_files=0;_directories=0;set files(t){this._files=t;}get files(){return this._files}set directories(t){this._directories=t;}get directories(){return this._directories}get dirs(){return this._directories}},Ts=class{aborted=false;abort(){this.aborted=true;}},Wt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,s){this.isSynchronous=!s,this.callbackInvoker=Cs(e,this.isSynchronous),this.root=mt(t,e),this.state={root:Ke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Os,options:e,queue:new ws((r,n)=>this.callbackInvoker(n,r,s)),symlinks:new Map,visited:[""].slice(0,0),controller:new Ts,fs:e.fs||Fe__namespace},this.joinPath=ze(this.root,e),this.pushDirectory=es(this.root,e),this.pushFile=us(e),this.getArray=ls(e),this.groupFiles=hs(e),this.resolveSymlink=ms(e,this.isSynchronous),this.walkDirectory=Is(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,s)=>{let{paths:r,options:{filters:n,resolveSymlinks:i,excludeSymlinks:o,exclude:l,maxFiles:b,signal:x,useRealPaths:A,pathSeparator:y},controller:_}=this.state;if(_.aborted||x&&x.aborted||b&&r.length>b)return;let E=this.getArray(this.state.paths);for(let R=0;R<t.length;++R){let g=t[R];if(g.isFile()||g.isSymbolicLink()&&!i&&!o){let p=this.joinPath(g.name,e);this.pushFile(p,E,this.state.counts,n);}else if(g.isDirectory()){let p=je(g.name,e,this.state.options.pathSeparator);if(l&&l(g.name,p))continue;this.pushDirectory(p,r,n),this.walkDirectory(this.state,p,p,s-1,this.walk);}else if(this.resolveSymlink&&g.isSymbolicLink()){let p=qt(g.name,e);this.resolveSymlink(p,this.state,(m,h)=>{if(m.isDirectory()){if(h=mt(h,this.state.options),l&&l(g.name,A?h:p+y))return;this.walkDirectory(this.state,h,A?h:p+y,s-1,this.walk);}else {h=A?h:p;let q=path.basename(h),F=mt(path.dirname(h),this.state.options);h=this.joinPath(q,F),this.pushFile(h,E,this.state.counts,n);}});}}this.groupFiles(this.state.groups,e,E);}};function Ps(t,e){return new Promise((s,r)=>{Ut(t,e,(n,i)=>{if(n)return r(n);s(i);});})}function Ut(t,e,s){new Wt(t,e,s).start();}function Hs(t,e){return new Wt(t,e).start()}var Dt=class{constructor(t,e){this.root=t,this.options=e;}withPromise(){return Ps(this.root,this.options)}withCallback(t){Ut(this.root,this.options,t);}sync(){return Hs(this.root,this.options)}},Kt=null;try{Nt.resolve("picomatch"),Kt=Nt("picomatch");}catch{}var Xt=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:path.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:t=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=true,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(t){return new Dt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new Dt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:true})}globWithOptions(t,...e){let s=this.globFunction||Kt;if(!s)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=s(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(n=>r(n)),this}};var et=Tt(me(),1),vr=Array.isArray,xe=/\\/g,Cr=/^[A-Za-z]:$/,Ae=process.platform==="win32",$r=/^(\/?\.\.)+$/;function Lr(t,e={}){let s=t.length,r=Array(s),n=Array(s),i,o;for(i=0;i<s;i++){let l=Se(t[i]);r[i]=l;let b=l.length,x=Array(b);for(o=0;o<b;o++)x[o]=(0, et.default)(l[o],e);n[i]=x;}return l=>{let b=l.split("/");if(b[0]===".."&&$r.test(l))return true;for(i=0;i<s;i++){let x=r[i],A=n[i],y=b.length,_=Math.min(y,x.length);for(o=0;o<_;){let E=x[o];if(E.includes("/"))return true;if(!A[o](b[o]))break;if(!e.noglobstar&&E==="**")return true;o++;}if(o===y)return true}return false}}var Ir=/^[A-Z]:\/$/i,wr=Ae?t=>Ir.test(t):t=>t==="/";function be(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){let n=t.length+ +!wr(t);return (i,o)=>i.slice(n,o?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(n,i)=>{if(n===".")return r;let o=`${r}/${n}`;return i?o.slice(0,-1):o}:(n,i)=>i&&n!=="."?n.slice(0,-1):n}return s?r=>path.posix.relative(t,r)||".":r=>path.posix.relative(t,`${e}/${r}`)||"."}function Or(t,e){if(e.startsWith(`${t}/`)){let s=e.slice(t.length+1);return r=>`${s}/${r}`}return s=>{let r=path.posix.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function ye(t){return t.replace(Cr,e=>`${e}/`)}var Tr={parts:true};function Se(t){var e;let s=et.default.scan(t,Tr);return !((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}var Pr=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Hr=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,kr=t=>t.replace(Pr,"\\$&"),Nr=t=>t.replace(Hr,"\\$&"),Dr=Ae?Nr:kr;function Br(t,e){let s=et.default.scan(t);return s.isGlob||s.negated}function ut(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t);}function _e(t){return typeof t=="string"?[t]:t??[]}var Mr=/^(\/?\.\.)+/,qr=/\\(?=[()[\]{}!*+?@|])/g;function It(t,e,s,r){var n;let i=e.cwd,o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1)),o[o.length-1]!=="*"&&e.expandDirectories&&(o+="/**");let l=Dr(i);o=path.isAbsolute(o.replace(qr,""))?path.posix.relative(l,o):path.posix.normalize(o);let b=(n=Mr.exec(o))===null||n===void 0?void 0:n[0],x=Se(o);if(b){let y=(b.length+1)/3,_=0,E=l.split("/");for(;_<y&&x[_+y]===E[E.length+_-y];)o=o.slice(0,(y-_-1)*3)+o.slice((y-_)*3+x[_+y].length+1)||".",_++;let R=path.posix.join(i,b.slice(_*3));R[0]!=="."&&s.root.length>R.length&&(s.root=ye(R),s.depthOffset=-y+_);}if(!r&&s.depthOffset>=0){var A;(A=s.commonPath)!==null&&A!==void 0||(s.commonPath=x);let y=[],_=Math.min(s.commonPath.length,x.length);for(let E=0;E<_;E++){let R=x[E];if(R==="**"&&!x[E+1]){y.pop();break}if(E===x.length-1||R!==s.commonPath[E]||Br(R))break;y.push(R);}s.depthOffset=y.length,s.commonPath=y,s.root=ye(y.length>0?path.posix.join(i,...y):i);}return o}function Fr(t,e,s){let r=[],n=[];for(let i of t.ignore)i&&(i[0]!=="!"||i[1]==="(")&&n.push(It(i,t,s,true));for(let i of e)i&&(i[0]!=="!"||i[1]==="("?r.push(It(i,t,s,false)):(i[1]!=="!"||i[2]==="(")&&n.push(It(i.slice(1),t,s,true)));return {match:r,ignore:n}}function Gr(t,e){let s=t.cwd,r={root:s,depthOffset:0},n=Fr(t,e,r);t.debug&&ut("internal processing patterns:",n);let{absolute:i,caseSensitiveMatch:o,debug:l,dot:b,followSymbolicLinks:x,onlyDirectories:A}=t,y=r.root.replace(xe,""),_={dot:b,nobrace:t.braceExpansion===false,nocase:!o,noextglob:t.extglob===false,noglobstar:t.globstar===false,posix:true},E=(0, et.default)(n.match,_),R=(0, et.default)(n.ignore,_),g=Lr(n.match,_),p=be(s,y,i),m=i?p:be(s,y,true),h=(w,I)=>{let L=m(I,true);return L!=="."&&!g(L)||R(L)},q;t.deep!==void 0&&(q=Math.round(t.deep-r.depthOffset));let F=new Xt({filters:[l?(w,I)=>{let L=p(w,I),S=E(L)&&!R(L);return S&&ut(`matched ${L}`),S}:(w,I)=>{let L=p(w,I);return E(L)&&!R(L)}],exclude:l?(w,I)=>{let L=h(w,I);return ut(`${L?"skipped":"crawling"} ${I}`),L}:h,fs:t.fs,pathSeparator:"/",relativePaths:!i,resolvePaths:i,includeBasePath:i,resolveSymlinks:x,excludeSymlinks:!x,excludeFiles:A,includeDirs:A||!t.onlyFiles,maxDepth:q,signal:t.signal}).crawl(y);return t.debug&&ut("internal properties:",{...r,root:y}),[F,s!==y&&!i&&Or(s,y)]}function Wr(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}var Re={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function Ur(t){let e=Object.assign({},t);for(let s in Re)e[s]===void 0&&Object.assign(e,{[s]:Re[s]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):path.resolve(e.cwd||process.cwd())).replace(xe,"/"),e.ignore=_e(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Fe.readdir,readdirSync:e.fs.readdirSync||Fe.readdirSync,realpath:e.fs.realpath||Fe.realpath,realpathSync:e.fs.realpathSync||Fe.realpathSync,stat:e.fs.stat||Fe.stat,statSync:e.fs.statSync||Fe.statSync}),e.debug&&ut("globbing with options:",e),e}function Kr(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=vr(t)||typeof t=="string",n=_e((s=r?t:t.patterns)!==null&&s!==void 0?s:"**/*"),i=Ur(r?e:t);return n.length>0?Gr(i,n):[]}async function Ee(t,e){let[s,r]=Kr(t,e);return s?Wr(await s.withPromise(),r):[]}var dt=wt.default.cyan("(nqtr)");function st(t){return t?Array.isArray(t)?t:[t]:[]}function Vr(t){return t?.find(e=>e.name==="vite-plugin-pixi-vn")}function En(t){let e,s,r,n=new Promise(g=>{r=g;}),i=[...st(t?.activities),...st(t?.commitments),...st(t?.locations),...st(t?.maps),...st(t?.quests),...st(t?.rooms)],o=new Set,l={activityIds:[],commitmentIds:[],locationIds:[],mapIds:[],questIds:[],roomIds:[]};function b(){if(!t?.typeFilePath||!e)return null;let g=t.typeFilePath;return path.isAbsolute(g)?g:path.resolve(e.root,g)}function x(g,p){Fe.mkdirSync(path.dirname(g),{recursive:true});let m=["// @ts-nocheck","/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/nqtr vite plugin. Do not edit manually.","",`export const nqtrActivityIds = ${JSON.stringify(p.activityIds)} as const;`,`export const nqtrCommitmentIds = ${JSON.stringify(p.commitmentIds)} as const;`,`export const nqtrLocationIds = ${JSON.stringify(p.locationIds)} as const;`,`export const nqtrMapIds = ${JSON.stringify(p.mapIds)} as const;`,`export const nqtrQuestIds = ${JSON.stringify(p.questIds)} as const;`,`export const nqtrRoomIds = ${JSON.stringify(p.roomIds)} as const;`,""],h=[["nqtrActivityIdsEnum",p.activityIds],["nqtrCommitmentIdsEnum",p.commitmentIds],["nqtrLocationIdsEnum",p.locationIds],["nqtrMapIdsEnum",p.mapIds],["nqtrQuestIdsEnum",p.questIds],["nqtrRoomIdsEnum",p.roomIds]];for(let[F,w]of h){if(w.length===0){m.push(`export const ${F} = {} as const;`);continue}let I=w.map(L=>`${JSON.stringify(L)}: ${JSON.stringify(L)}`).join(", ");m.push(`export const ${F} = { ${I} } as const;`);}m.push(""),m.push('declare module "@drincs/nqtr/registries" {');let q=[["NqtrActivityIds",p.activityIds],["NqtrCommitmentIds",p.commitmentIds],["NqtrLocationIds",p.locationIds],["NqtrMapIds",p.mapIds],["NqtrQuestIds",p.questIds],["NqtrRoomIds",p.roomIds]];for(let[F,w]of q)if(w.length!==0){m.push(` interface ${F} {`);for(let I of w)m.push(` ${JSON.stringify(I)}: never;`);m.push(" }");}m.push("}"),m.push(""),Fe.writeFileSync(g,m.join(` `),"utf-8");}function A(){let g=b();if(g)try{x(g,l);}catch(p){e?.logger.error(`${dt} Failed to write type file "${g}".`,{error:p instanceof Error?p:new Error(String(p)),timestamp:true});}}async function y(g){let p={};try{p=await g("@drincs/nqtr/registries");}catch{}l={activityIds:p.RegisteredActivities?.values().map(h=>h.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(h=>h.id)??[],locationIds:p.RegisteredLocations?.values().map(h=>h.id)??[],mapIds:p.RegisteredMaps?.values().map(h=>h.id)??[],questIds:p.RegisteredQuests?.values().map(h=>h.id)??[],roomIds:p.RegisteredRooms?.values().map(h=>h.id)??[]};let m=l.activityIds.length+l.commitmentIds.length+l.locationIds.length+l.mapIds.length+l.questIds.length+l.roomIds.length;e?.logger.info(`${dt} ${wt.default.dim(`${m} NQTR id(s) \u2014 activities: ${l.activityIds.length}, commitments: ${l.commitmentIds.length}, locations: ${l.locationIds.length}, maps: ${l.mapIds.length}, quests: ${l.questIds.length}, rooms: ${l.roomIds.length}`)}`,{timestamp:true});}async function _(g){try{let p=await g("@drincs/nqtr/registries");p.RegisteredActivities?.clear?.(),p.RegisteredCommitments?.clear?.(),p.RegisteredLocations?.clear?.(),p.RegisteredMaps?.clear?.(),p.RegisteredQuests?.clear?.(),p.RegisteredRooms?.clear?.();}catch{}}async function E(g,p){let m=await Ee(i,{cwd:p,absolute:true,onlyFiles:true});for(let h of m){o.add(h);try{await g(h);}catch{}}}async function R(g){for(let p of o)for(let m of g.moduleGraph.getModulesByFile(p)??[])g.moduleGraph.invalidateModule(m);await _(p=>g.ssrLoadModule(p)),await E(p=>g.ssrLoadModule(p),e.root),await y(p=>g.ssrLoadModule(p)),A();}return {name:"vite-plugin-nqtr",enforce:"pre",api:{contentLoaded:n},config(g,p){if(p.command==="serve"&&i.length>0)return {ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}}},configResolved(g){e=g,s=Vr(g.plugins),i.length===0&&!s?.api?.contentLoaded&&r();},async buildStart(){if(e?.command!=="build")return;let g=s?.api?.contentLoaded;if(g&&await g,i.length>0){let{createServer:p}=await import('vite'),m=await p({root:e.root,configFile:false,resolve:e.resolve,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}});try{await E(h=>m.ssrLoadModule(h),e.root),await y(h=>m.ssrLoadModule(h)),A(),r();}catch{r();}finally{await m.close();}}else if(g){try{let p=await import('@drincs/nqtr/registries');l={activityIds:p.RegisteredActivities?.values().map(m=>m.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(m=>m.id)??[],locationIds:p.RegisteredLocations?.values().map(m=>m.id)??[],mapIds:p.RegisteredMaps?.values().map(m=>m.id)??[],questIds:p.RegisteredQuests?.values().map(m=>m.id)??[],roomIds:p.RegisteredRooms?.values().map(m=>m.id)??[]},A();}catch{}r();}else r();},configureServer(g){(async()=>{let m=s?.api?.contentLoaded;m&&await m,i.length>0&&await E(h=>g.ssrLoadModule(h),e.root),await y(h=>g.ssrLoadModule(h)),A(),r(),s?.api?.onReload?.(()=>{y(h=>g.ssrLoadModule(h)).then(()=>A()).catch(h=>{e?.logger.error(`${dt} Failed to regenerate types after pixi-vn reload.`,{error:h instanceof Error?h:new Error(String(h)),timestamp:true});});});})().catch(()=>r());},hotUpdate({file:g,server:p}){let m=b();if(m&&g===m)return [];if(i.length>0&&o.has(g))return R(p).catch(h=>{e?.logger.error(`${dt} Failed to reload NQTR content.`,{error:h instanceof Error?h:new Error(String(h)),timestamp:true});}),[]}}}exports.vitePluginNqtr=En;