sliccy 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/ui/assets/__vite-browser-external-BC516C8G.js +1 -0
  2. package/dist/ui/assets/{anthropic-BDXWvzdA.js → anthropic-CMlPlDIk.js} +1 -1
  3. package/dist/ui/assets/{azure-openai-responses-CKLc7IC4.js → azure-openai-responses-D8KcZhBl.js} +1 -1
  4. package/dist/ui/assets/{cdp-CtEFOd-O.js → cdp-CsCvDwW3.js} +3 -3
  5. package/dist/ui/assets/chunk-jRWAZmH_.js +1 -0
  6. package/dist/ui/assets/{cost-command-CGzKvuNW.js → cost-command-DBzah9S9.js} +6 -6
  7. package/dist/ui/assets/{dist-CBC7OjhO.js → dist-C43FKPek.js} +2 -2
  8. package/dist/ui/assets/{dist--SipPaGB.js → dist-CLNuUmSq.js} +2 -2
  9. package/dist/ui/assets/{dist-BQ8A4EPf.js → dist-CWhXzJlW.js} +1 -1
  10. package/dist/ui/assets/dist-CYRMRTTO.js +1 -0
  11. package/dist/ui/assets/{dist-BlyYz71N.js → dist-DJK5C7yO.js} +1 -1
  12. package/dist/ui/assets/{dist-BbDHofFB.js → dist-DhTZTSy5.js} +1 -1
  13. package/dist/ui/assets/{es-DVVaE6zS.js → es-02E0S87Z.js} +2 -2
  14. package/dist/ui/assets/{fs-DUWoGzSN.js → fs-bsu2i7du.js} +1 -1
  15. package/dist/ui/assets/{google-g3eUXCCV.js → google-DO7yvPO4.js} +1 -1
  16. package/dist/ui/assets/{google-gemini-cli-CiaDQBZY.js → google-gemini-cli-DdA3nx6W.js} +1 -1
  17. package/dist/ui/assets/{google-shared-Bc8yrzvw.js → google-shared-BWQFIy8i.js} +2 -2
  18. package/dist/ui/assets/{google-vertex-Cf-hp1s4.js → google-vertex-C5s4LVmo.js} +1 -1
  19. package/dist/ui/assets/{index-DvKgWKET.js → index-COiC6muM.js} +289 -289
  20. package/dist/ui/assets/{json-parse-JW3qhabb.js → json-parse-Dn8fsQhn.js} +1 -1
  21. package/dist/ui/assets/{magick-wasm-D4KIq0y6.js → magick-wasm-DA8eLvGf.js} +1 -1
  22. package/dist/ui/assets/{mistral-CxSnkoPt.js → mistral-BPcBoGoy.js} +1 -1
  23. package/dist/ui/assets/{openai-codex-responses-CX6LCE-l.js → openai-codex-responses-N7fKFsLN.js} +1 -1
  24. package/dist/ui/assets/{openai-completions-CUKgrvVN.js → openai-completions-rv4ohN_x.js} +1 -1
  25. package/dist/ui/assets/{openai-responses-BthT_lNI.js → openai-responses-D4uieQSd.js} +1 -1
  26. package/dist/ui/assets/{openai-responses-shared-ByzYcNN-.js → openai-responses-shared-CUFAAR--.js} +1 -1
  27. package/dist/ui/assets/{pdfjs-Dhk_E7h9.js → pdfjs-kFXy8Q7j.js} +7 -7
  28. package/dist/ui/assets/{provider-settings-lHR3i2bS.js → provider-settings-DUchoI6k.js} +4 -4
  29. package/dist/ui/assets/{pyodide-3iToeyDO.js → pyodide-Doh5i2Gj.js} +3 -3
  30. package/dist/ui/assets/skills-CTCIxQqH.js +9 -0
  31. package/dist/ui/assets/{slicc-editor-LteGL_eD.js → slicc-editor-CWWaxccP.js} +2 -2
  32. package/dist/ui/assets/{sql-wasm-Z190sfbE.js → sql-wasm-Dx6P9mA8.js} +1 -1
  33. package/dist/ui/index.html +16 -17
  34. package/dist/ui/packages/webapp/index.html +16 -17
  35. package/package.json +2 -2
  36. package/dist/ui/assets/__vite-browser-external-CGni-twv.js +0 -1
  37. package/dist/ui/assets/agent-bridge-BQWM5sQP.js +0 -1
  38. package/dist/ui/assets/chunk-zsgVPwQN.js +0 -1
  39. package/dist/ui/assets/dist-CustHeWI.js +0 -1
  40. package/dist/ui/assets/lick-manager-D1bfS_SD.js +0 -1
  41. package/dist/ui/assets/pako-CM3trPL8.js +0 -1
  42. package/dist/ui/assets/provider-settings-CPGfcyq6.js +0 -1
  43. package/dist/ui/assets/providers-CgyG8QfW.js +0 -1
  44. package/dist/ui/assets/secret-env-D4m7q3Dc.js +0 -1
  45. package/dist/ui/assets/shell-DKDHQ8Ux.js +0 -1
  46. package/dist/ui/assets/skills-6ga2RZhv.js +0 -1
  47. package/dist/ui/assets/skills-agEj4Eg8.js +0 -9
  48. package/dist/ui/assets/sprinkle-renderer-Dj8JsQhW.js +0 -1
  49. /package/dist/ui/assets/{addon-fit-Dbzb3n3e.js → addon-fit-CVV7fTw9.js} +0 -0
  50. /package/dist/ui/assets/{bsh-watchdog-XFikI_DX.js → bsh-watchdog-C8qkdGvF.js} +0 -0
  51. /package/dist/ui/assets/{constants-Dqhmtsws.js → constants-DdIXxN9e.js} +0 -0
  52. /package/dist/ui/assets/{db-UiVJ_81p.js → db-CmHnV4DS.js} +0 -0
  53. /package/dist/ui/assets/{dist-zlAHCcD1.js → dist-B3YOuOiy.js} +0 -0
  54. /package/dist/ui/assets/{env-api-keys-qwjmVNjS.js → env-api-keys-7VVTY3n7.js} +0 -0
  55. /package/dist/ui/assets/{github-copilot-headers-Bz8q1fNX.js → github-copilot-headers-C0FOlzjL.js} +0 -0
  56. /package/dist/ui/assets/{hash-D2-j0Bls.js → hash-CQjDwcjR.js} +0 -0
  57. /package/dist/ui/assets/{lick-manager-proxy-_h8oUTsW.js → lick-manager-proxy-B2bMdplq.js} +0 -0
  58. /package/dist/ui/assets/{oauth-service-dTQ65zA2.js → oauth-service-BoyG8vZW.js} +0 -0
  59. /package/dist/ui/assets/{offscreen-client-vFDPYD-S.js → offscreen-client-CD0tozA4.js} +0 -0
  60. /package/dist/ui/assets/{openai-Cn7eGqwa.js → openai-CQsomflW.js} +0 -0
  61. /package/dist/ui/assets/{path-utils-DAY6ORUp.js → path-utils-CNNVZ3-O.js} +0 -0
  62. /package/dist/ui/assets/{sanitize-unicode-DmvZGa56.js → sanitize-unicode-BOCYaWok.js} +0 -0
  63. /package/dist/ui/assets/{secret-masking-B0alBbYk.js → secret-masking-Bqg5RXZg.js} +0 -0
  64. /package/dist/ui/assets/{simple-options-DZXt61Q2.js → simple-options-B6uouUxh.js} +0 -0
  65. /package/dist/ui/assets/{src-DGdmJN2h.js → src-CNgmwAf5.js} +0 -0
  66. /package/dist/ui/assets/{tray-follower-status-LqS6IS1u.js → tray-follower-status-BlQSlF6m.js} +0 -0
  67. /package/dist/ui/assets/{xterm-DDjY5F5A.js → xterm-ucbPh68r.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{i as e,r as t,t as n}from"./chunk-zsgVPwQN.js";var r=n((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))(),i=(e,t,n)=>{let r=e instanceof RegExp?a(e,n):e,i=t instanceof RegExp?a(t,n):t,s=r!==null&&i!=null&&o(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},a=(e,t)=>{let n=t.match(e);return n?n[0]:null},o=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},s=`\0SLASH`+Math.random()+`\0`,c=`\0OPEN`+Math.random()+`\0`,l=`\0CLOSE`+Math.random()+`\0`,u=`\0COMMA`+Math.random()+`\0`,d=`\0PERIOD`+Math.random()+`\0`,f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=new RegExp(u,`g`),g=new RegExp(d,`g`),_=/\\\\/g,v=/\\{/g,y=/\\}/g,ee=/\\,/g,te=/\\\./g,ne=1e5;function b(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function re(e){return e.replace(_,s).replace(v,c).replace(y,l).replace(ee,u).replace(te,d)}function x(e){return e.replace(f,`\\`).replace(p,`{`).replace(m,`}`).replace(h,`,`).replace(g,`.`)}function ie(e){if(!e)return[``];let t=[],n=i(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:a,post:o}=n,s=r.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=ie(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function ae(e,t={}){if(!e)return[];let{max:n=ne}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),ue(re(e),n,!0).map(x)}function oe(e){return`{`+e+`}`}function se(e){return/^-?0\d/.test(e)}function ce(e,t){return e<=t}function le(e,t){return e>=t}function ue(e,t,n){let r=[],a=i(`{`,`}`,e);if(!a)return[e];let o=a.pre,s=a.post.length?ue(a.post,t,!1):[``];if(/\$$/.test(a.pre))for(let e=0;e<s.length&&e<t;e++){let t=o+`{`+a.body+`}`+s[e];r.push(t)}else{let i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=i||c,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+l+a.post,ue(e,t,!0)):[e];let f;if(u)f=a.body.split(/\.\./);else if(f=ie(a.body),f.length===1&&f[0]!==void 0&&(f=ue(f[0],t,!1).map(oe),f.length===1))return s.map(e=>a.pre+f[0]+e);let p;if(u&&f[0]!==void 0&&f[1]!==void 0){let e=b(f[0]),t=b(f[1]),n=Math.max(f[0].length,f[1].length),r=f.length===3&&f[2]!==void 0?Math.abs(b(f[2])):1,i=ce;t<e&&(r*=-1,i=le);let a=f.some(se);p=[];for(let o=e;i(o,t);o+=r){let e;if(c)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}p.push(e)}}else{p=[];for(let e=0;e<f.length;e++)p.push.apply(p,ue(f[e],t,!1))}for(let e=0;e<p.length;e++)for(let i=0;i<s.length&&r.length<t;i++){let t=o+p[e]+s[i];(!n||u||t)&&r.push(t)}}return r}var de=1024*64,fe=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>de)throw TypeError(`pattern is too long`)},pe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},me=e=>e.replace(/[[\]\\-]/g,`\\$&`),he=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ge=e=>e.join(``),_e=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(pe))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(me(d)+`-`+me(t)):t===d&&r.push(me(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(me(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(me(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[he(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+ge(r)+`]`,p=`[`+(l?``:`^`)+ge(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},ve=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),ye,be=new Set([`!`,`?`,`+`,`*`,`@`]),xe=e=>be.has(e),Se=e=>xe(e.type),Ce=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),we=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Te=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ee=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),De=`(?!(?:^|/)\\.\\.?(?:$|/))`,Oe=`(?!\\.)`,ke=new Set([`[`,`.`]),Ae=new Set([`..`,`.`]),je=new Set(`().*{}+?[]^$\\!`),Me=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Ne=`[^/]`,Pe=Ne+`*?`,Fe=Ne+`+?`,Ie=0,Le=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Ie;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof ye&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof ye&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new ye(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&xe(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new ye(n,t);u=ye.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new ye(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&xe(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new ye(n,d);d.push(o),u=ye.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new ye(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,we)}#m(e,t=Ce){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Te){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new ye(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ee.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ee.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new ye(null,void 0,t);return ye.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Se(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?ye.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ae.has(this.#r[0]))){let n=ke,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?De:o?Oe:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,ve(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,ve(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Oe:``)+Fe;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Oe:``)+Pe+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,ve(i),this.#t=!!this.#t,this.#n]}#x(){if(Se(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(je.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Fe:Pe,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=_e(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=Ne,t=!0;continue}i+=Me(c)}return[i,ve(e),!!t,a]}};ye=Le;var Re=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),ze=(e,t,n={})=>(fe(t),!n.nocomment&&t.charAt(0)===`#`?!1:new gt(t,n).match(e)),Be=/^\*+([^+@!?\*\[\(]*)$/,Ve=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),He=e=>t=>t.endsWith(e),Ue=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),We=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ge=/^\*+\.\*+$/,Ke=e=>!e.startsWith(`.`)&&e.includes(`.`),qe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Je=/^\.\*+$/,Ye=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Xe=/^\*+$/,Ze=e=>e.length!==0&&!e.startsWith(`.`),Qe=e=>e.length!==0&&e!==`.`&&e!==`..`,$e=/^\?+([^+@!?\*\[\(]*)?$/,et=([e,t=``])=>{let n=it([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},tt=([e,t=``])=>{let n=at([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},nt=([e,t=``])=>{let n=at([e]);return t?e=>n(e)&&e.endsWith(t):n},rt=([e,t=``])=>{let n=it([e]);return t?e=>n(e)&&e.endsWith(t):n},it=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},at=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ot=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,st={win32:{sep:`\\`},posix:{sep:`/`}};ze.sep=ot===`win32`?st.win32.sep:st.posix.sep;var ct=Symbol(`globstar **`);ze.GLOBSTAR=ct;var lt=`[^/]*?`,ut=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,dt=`(?:(?!(?:\\/|^)\\.).)*?`;ze.filter=(e,t={})=>n=>ze(n,e,t);var ft=(e,t={})=>Object.assign({},e,t);ze.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return ze;let t=ze;return Object.assign((n,r,i={})=>t(n,r,ft(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,ft(e,n))}static defaults(n){return t.defaults(ft(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,ft(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,ft(e,r))}},unescape:(n,r={})=>t.unescape(n,ft(e,r)),escape:(n,r={})=>t.escape(n,ft(e,r)),filter:(n,r={})=>t.filter(n,ft(e,r)),defaults:n=>t.defaults(ft(e,n)),makeRe:(n,r={})=>t.makeRe(n,ft(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,ft(e,r)),match:(n,r,i={})=>t.match(n,r,ft(e,i)),sep:t.sep,GLOBSTAR:ct})};var pt=(e,t={})=>(fe(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ae(e,{max:t.braceExpandMax}));ze.braceExpand=pt,ze.makeRe=(e,t={})=>new gt(e,t).makeRe(),ze.match=(e,t,n={})=>{let r=new gt(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var mt=/[?*]|[+@!]\(.*?\)|\[|\]/,ht=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),gt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){fe(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ot,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!mt.test(e[2]))&&!mt.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(ct)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(ct,i),o=t.lastIndexOf(ct),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===ct?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===ct)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return pt(this.pattern,this.options)}parse(e){fe(e);let t=this.options;if(e===`**`)return ct;if(e===``)return``;let n,r=null;(n=e.match(Xe))?r=t.dot?Qe:Ze:(n=e.match(Be))?r=(t.nocase?t.dot?We:Ue:t.dot?He:Ve)(n[1]):(n=e.match($e))?r=(t.nocase?t.dot?tt:et:t.dot?nt:rt)(n):(n=e.match(Ge))?r=t.dot?qe:Ke:(n=e.match(Je))&&(r=Ye);let i=Le.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?lt:t.dot?ut:dt,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ht(e):e===ct?ct:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==ct||a===ct||(a===void 0?i!==void 0&&i!==ct?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==ct&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=ct))});let i=t.filter(e=>e!==ct);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return ze.defaults(e).Minimatch}};ze.AST=Le,ze.Minimatch=gt,ze.escape=Re,ze.unescape=ve;var _t={};function vt(){throw Error(`gunzipSync is not available in the browser`)}function yt(){throw Error(`gzipSync is not available in the browser`)}var bt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends bt{};function xt(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function St(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Ct(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function wt(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Tt(e,t){return Ct(e,t,``)}function Et(e,t){return wt(e,t,``)}function Dt(e,t){return t.slice(0,Ot(e,t))}function Ot(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function kt(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function At(e){let t=e.match(/^\s*/);return t?t[0]:``}var jt=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Mt=RegExp(`[${jt}]+|\\s+|[^${jt}]`,`ug`);new class extends bt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(Mt)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Nt(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&Nt(n,i,r,null),e}};function Nt(e,t,n,r){if(t&&n){let i=At(t.value),a=kt(t.value),o=At(n.value),s=kt(n.value);if(e){let r=xt(i,o);e.value=wt(e.value,o,r),t.value=Tt(t.value,r),n.value=Tt(n.value,r)}if(r){let e=St(a,s);r.value=Ct(r.value,s,e),t.value=Et(t.value,e),n.value=Et(n.value,e)}}else if(n){if(e){let e=At(n.value);n.value=n.value.substring(e.length)}if(r){let e=At(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=At(r.value),i=At(t.value),a=kt(t.value),o=xt(n,i);t.value=Tt(t.value,o);let s=St(Tt(n,o),a);t.value=Et(t.value,s),r.value=Ct(r.value,n,s),e.value=wt(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=At(r.value),n=Dt(kt(t.value),e);t.value=Et(t.value,n)}else if(e){let n=Dt(kt(e.value),At(t.value));t.value=Tt(t.value,n)}}new class extends bt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${jt}]+|[^\\S\\n\\r]+|[^${jt}]`,`ug`);return e.match(t)||[]}};var Pt=new class extends bt{constructor(){super(...arguments),this.tokenize=It}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
1
+ import{i as e,r as t,t as n}from"./chunk-jRWAZmH_.js";var r=n((e=>{(function(){var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function n(e){return i(o(e),arguments)}function r(e,t){return n.apply(null,[e].concat(t||[]))}function i(e,r){var i=1,a=e.length,o,s=``,c,l,u,d,f,p,m,h;for(c=0;c<a;c++)if(typeof e[c]==`string`)s+=e[c];else if(typeof e[c]==`object`){if(u=e[c],u.keys)for(o=r[i],l=0;l<u.keys.length;l++){if(o==null)throw Error(n(`[sprintf] Cannot access property "%s" of undefined value "%s"`,u.keys[l],u.keys[l-1]));o=o[u.keys[l]]}else o=u.param_no?r[u.param_no]:r[i++];if(t.not_type.test(u.type)&&t.not_primitive.test(u.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(u.type)&&typeof o!=`number`&&isNaN(o))throw TypeError(n(`[sprintf] expecting number but found %T`,o));switch(t.number.test(u.type)&&(m=o>=0),u.type){case`b`:o=parseInt(o,10).toString(2);break;case`c`:o=String.fromCharCode(parseInt(o,10));break;case`d`:case`i`:o=parseInt(o,10);break;case`j`:o=JSON.stringify(o,null,u.width?parseInt(u.width):0);break;case`e`:o=u.precision?parseFloat(o).toExponential(u.precision):parseFloat(o).toExponential();break;case`f`:o=u.precision?parseFloat(o).toFixed(u.precision):parseFloat(o);break;case`g`:o=u.precision?String(Number(o.toPrecision(u.precision))):parseFloat(o);break;case`o`:o=(parseInt(o,10)>>>0).toString(8);break;case`s`:o=String(o),o=u.precision?o.substring(0,u.precision):o;break;case`t`:o=String(!!o),o=u.precision?o.substring(0,u.precision):o;break;case`T`:o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=u.precision?o.substring(0,u.precision):o;break;case`u`:o=parseInt(o,10)>>>0;break;case`v`:o=o.valueOf(),o=u.precision?o.substring(0,u.precision):o;break;case`x`:o=(parseInt(o,10)>>>0).toString(16);break;case`X`:o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(u.type)?s+=o:(t.number.test(u.type)&&(!m||u.sign)?(h=m?`+`:`-`,o=o.toString().replace(t.sign,``)):h=``,f=u.pad_char?u.pad_char===`0`?`0`:u.pad_char.charAt(1):` `,p=u.width-(h+o).length,d=u.width&&p>0?f.repeat(p):``,s+=u.align?h+o+d:f===`0`?h+d+o:d+h+o)}return s}var a=Object.create(null);function o(e){if(a[e])return a[e];for(var n=e,r,i=[],o=0;n;){if((r=t.text.exec(n))!==null)i.push(r[0]);else if((r=t.modulo.exec(n))!==null)i.push(`%`);else if((r=t.placeholder.exec(n))!==null){if(r[2]){o|=1;var s=[],c=r[2],l=[];if((l=t.key.exec(c))!==null)for(s.push(l[1]);(c=c.substring(l[0].length))!==``;)if((l=t.key_access.exec(c))!==null)s.push(l[1]);else if((l=t.index_access.exec(c))!==null)s.push(l[1]);else throw SyntaxError(`[sprintf] failed to parse named argument key`);else throw SyntaxError(`[sprintf] failed to parse named argument key`);r[2]=s}else o|=2;if(o===3)throw Error(`[sprintf] mixing positional and named placeholders is not (yet) supported`);i.push({placeholder:r[0],param_no:r[1],keys:r[2],sign:r[3],pad_char:r[4],align:r[5],width:r[6],precision:r[7],type:r[8]})}else throw SyntaxError(`[sprintf] unexpected placeholder`);n=n.substring(r[0].length)}return a[e]=i}e!==void 0&&(e.sprintf=n,e.vsprintf=r),typeof window<`u`&&(window.sprintf=n,window.vsprintf=r,typeof define==`function`&&define.amd&&define(function(){return{sprintf:n,vsprintf:r}}))})()}))(),i=(e,t,n)=>{let r=e instanceof RegExp?a(e,n):e,i=t instanceof RegExp?a(t,n):t,s=r!==null&&i!=null&&o(r,i,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+r.length,s[1]),post:n.slice(s[1]+i.length)}},a=(e,t)=>{let n=t.match(e);return n?n[0]:null},o=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},s=`\0SLASH`+Math.random()+`\0`,c=`\0OPEN`+Math.random()+`\0`,l=`\0CLOSE`+Math.random()+`\0`,u=`\0COMMA`+Math.random()+`\0`,d=`\0PERIOD`+Math.random()+`\0`,f=new RegExp(s,`g`),p=new RegExp(c,`g`),m=new RegExp(l,`g`),h=new RegExp(u,`g`),g=new RegExp(d,`g`),_=/\\\\/g,v=/\\{/g,y=/\\}/g,ee=/\\,/g,te=/\\\./g,ne=1e5;function b(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function re(e){return e.replace(_,s).replace(v,c).replace(y,l).replace(ee,u).replace(te,d)}function x(e){return e.replace(f,`\\`).replace(p,`{`).replace(m,`}`).replace(h,`,`).replace(g,`.`)}function ie(e){if(!e)return[``];let t=[],n=i(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:a,post:o}=n,s=r.split(`,`);s[s.length-1]+=`{`+a+`}`;let c=ie(o);return o.length&&(s[s.length-1]+=c.shift(),s.push.apply(s,c)),t.push.apply(t,s),t}function ae(e,t={}){if(!e)return[];let{max:n=ne}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),ue(re(e),n,!0).map(x)}function oe(e){return`{`+e+`}`}function se(e){return/^-?0\d/.test(e)}function ce(e,t){return e<=t}function le(e,t){return e>=t}function ue(e,t,n){let r=[],a=i(`{`,`}`,e);if(!a)return[e];let o=a.pre,s=a.post.length?ue(a.post,t,!1):[``];if(/\$$/.test(a.pre))for(let e=0;e<s.length&&e<t;e++){let t=o+`{`+a.body+`}`+s[e];r.push(t)}else{let i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),u=i||c,d=a.body.indexOf(`,`)>=0;if(!u&&!d)return a.post.match(/,(?!,).*\}/)?(e=a.pre+`{`+a.body+l+a.post,ue(e,t,!0)):[e];let f;if(u)f=a.body.split(/\.\./);else if(f=ie(a.body),f.length===1&&f[0]!==void 0&&(f=ue(f[0],t,!1).map(oe),f.length===1))return s.map(e=>a.pre+f[0]+e);let p;if(u&&f[0]!==void 0&&f[1]!==void 0){let e=b(f[0]),t=b(f[1]),n=Math.max(f[0].length,f[1].length),r=f.length===3&&f[2]!==void 0?Math.abs(b(f[2])):1,i=ce;t<e&&(r*=-1,i=le);let a=f.some(se);p=[];for(let o=e;i(o,t);o+=r){let e;if(c)e=String.fromCharCode(o),e===`\\`&&(e=``);else if(e=String(o),a){let t=n-e.length;if(t>0){let n=Array(t+1).join(`0`);e=o<0?`-`+n+e.slice(1):n+e}}p.push(e)}}else{p=[];for(let e=0;e<f.length;e++)p.push.apply(p,ue(f[e],t,!1))}for(let e=0;e<p.length;e++)for(let i=0;i<s.length&&r.length<t;i++){let t=o+p[e]+s[i];(!n||u||t)&&r.push(t)}}return r}var de=1024*64,fe=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>de)throw TypeError(`pattern is too long`)},pe={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},me=e=>e.replace(/[[\]\\-]/g,`\\$&`),he=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ge=e=>e.join(``),_e=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(pe))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(me(d)+`-`+me(t)):t===d&&r.push(me(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(me(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(me(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[he(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+ge(r)+`]`,p=`[`+(l?``:`^`)+ge(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},ve=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^\/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,`$1$2`).replace(/\\([^\/])/g,`$1`):t?e.replace(/\[([^\/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,`$1$2`).replace(/\\([^\/{}])/g,`$1`),ye,be=new Set([`!`,`?`,`+`,`*`,`@`]),xe=e=>be.has(e),Se=e=>xe(e.type),Ce=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),we=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Te=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Ee=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),De=`(?!(?:^|/)\\.\\.?(?:$|/))`,Oe=`(?!\\.)`,ke=new Set([`[`,`.`]),Ae=new Set([`..`,`.`]),je=new Set(`().*{}+?[]^$\\!`),Me=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Ne=`[^/]`,Pe=Ne+`*?`,Fe=Ne+`+?`,Ie=0,Le=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Ie;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof ye&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof ye&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new ye(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&xe(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new ye(n,t);u=ye.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new ye(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&xe(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new ye(n,d);d.push(o),u=ye.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new ye(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,we)}#m(e,t=Ce){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Te){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new ye(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Ee.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Ee.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new ye(null,void 0,t);return ye.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Se(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?ye.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ae.has(this.#r[0]))){let n=ke,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?De:o?Oe:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,ve(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,ve(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Oe:``)+Fe;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Oe:``)+Pe+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,ve(i),this.#t=!!this.#t,this.#n]}#x(){if(Se(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(je.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Fe:Pe,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=_e(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=Ne,t=!0;continue}i+=Me(c)}return[i,ve(e),!!t,a]}};ye=Le;var Re=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),ze=(e,t,n={})=>(fe(t),!n.nocomment&&t.charAt(0)===`#`?!1:new gt(t,n).match(e)),Be=/^\*+([^+@!?\*\[\(]*)$/,Ve=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),He=e=>t=>t.endsWith(e),Ue=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),We=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ge=/^\*+\.\*+$/,Ke=e=>!e.startsWith(`.`)&&e.includes(`.`),qe=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Je=/^\.\*+$/,Ye=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Xe=/^\*+$/,Ze=e=>e.length!==0&&!e.startsWith(`.`),Qe=e=>e.length!==0&&e!==`.`&&e!==`..`,$e=/^\?+([^+@!?\*\[\(]*)?$/,et=([e,t=``])=>{let n=it([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},tt=([e,t=``])=>{let n=at([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},nt=([e,t=``])=>{let n=at([e]);return t?e=>n(e)&&e.endsWith(t):n},rt=([e,t=``])=>{let n=it([e]);return t?e=>n(e)&&e.endsWith(t):n},it=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},at=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ot=typeof process==`object`&&process?{}.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,st={win32:{sep:`\\`},posix:{sep:`/`}};ze.sep=ot===`win32`?st.win32.sep:st.posix.sep;var ct=Symbol(`globstar **`);ze.GLOBSTAR=ct;var lt=`[^/]*?`,ut=`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`,dt=`(?:(?!(?:\\/|^)\\.).)*?`;ze.filter=(e,t={})=>n=>ze(n,e,t);var ft=(e,t={})=>Object.assign({},e,t);ze.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return ze;let t=ze;return Object.assign((n,r,i={})=>t(n,r,ft(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,ft(e,n))}static defaults(n){return t.defaults(ft(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,ft(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,ft(e,r))}},unescape:(n,r={})=>t.unescape(n,ft(e,r)),escape:(n,r={})=>t.escape(n,ft(e,r)),filter:(n,r={})=>t.filter(n,ft(e,r)),defaults:n=>t.defaults(ft(e,n)),makeRe:(n,r={})=>t.makeRe(n,ft(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,ft(e,r)),match:(n,r,i={})=>t.match(n,r,ft(e,i)),sep:t.sep,GLOBSTAR:ct})};var pt=(e,t={})=>(fe(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:ae(e,{max:t.braceExpandMax}));ze.braceExpand=pt,ze.makeRe=(e,t={})=>new gt(e,t).makeRe(),ze.match=(e,t,n={})=>{let r=new gt(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};var mt=/[?*]|[+@!]\(.*?\)|\[|\]/,ht=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),gt=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){fe(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ot,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!mt.test(e[2]))&&!mt.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]===`**`&&(e[t][n]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(ct)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(ct,i),o=t.lastIndexOf(ct),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===ct?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===ct)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return pt(this.pattern,this.options)}parse(e){fe(e);let t=this.options;if(e===`**`)return ct;if(e===``)return``;let n,r=null;(n=e.match(Xe))?r=t.dot?Qe:Ze:(n=e.match(Be))?r=(t.nocase?t.dot?We:Ue:t.dot?He:Ve)(n[1]):(n=e.match($e))?r=(t.nocase?t.dot?tt:et:t.dot?nt:rt)(n):(n=e.match(Ge))?r=t.dot?qe:Ke:(n=e.match(Je))&&(r=Ye);let i=Le.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?lt:t.dot?ut:dt,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?ht(e):e===ct?ct:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==ct||a===ct||(a===void 0?i!==void 0&&i!==ct?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==ct&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=ct))});let i=t.filter(e=>e!==ct);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^\/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e=0;e<i.length;e++){let o=i[e],s=r;if(n.matchBase&&o.length===1&&(s=[a]),this.matchOne(s,o,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return ze.defaults(e).Minimatch}};ze.AST=Le,ze.Minimatch=gt,ze.escape=Re,ze.unescape=ve;var _t={};function vt(){throw Error(`gunzipSync is not available in the browser`)}function yt(){throw Error(`gzipSync is not available in the browser`)}var bt=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}else return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends bt{};function xt(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function St(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Ct(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function wt(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Tt(e,t){return Ct(e,t,``)}function Et(e,t){return wt(e,t,``)}function Dt(e,t){return t.slice(0,Ot(e,t))}function Ot(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function kt(e){let t;for(t=e.length-1;t>=0&&e[t].match(/\s/);t--);return e.substring(t+1)}function At(e){let t=e.match(/^\s*/);return t?t[0]:``}var jt=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Mt=RegExp(`[${jt}]+|\\s+|[^${jt}]`,`ug`);new class extends bt{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=[];for(let t of Array.from(r.segment(e))){let e=t.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}}else n=e.match(Mt)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Nt(n,i,r,e),n=e,r=null,i=null)}),(r||i)&&Nt(n,i,r,null),e}};function Nt(e,t,n,r){if(t&&n){let i=At(t.value),a=kt(t.value),o=At(n.value),s=kt(n.value);if(e){let r=xt(i,o);e.value=wt(e.value,o,r),t.value=Tt(t.value,r),n.value=Tt(n.value,r)}if(r){let e=St(a,s);r.value=Ct(r.value,s,e),t.value=Et(t.value,e),n.value=Et(n.value,e)}}else if(n){if(e){let e=At(n.value);n.value=n.value.substring(e.length)}if(r){let e=At(r.value);r.value=r.value.substring(e.length)}}else if(e&&r){let n=At(r.value),i=At(t.value),a=kt(t.value),o=xt(n,i);t.value=Tt(t.value,o);let s=St(Tt(n,o),a);t.value=Et(t.value,s),r.value=Ct(r.value,n,s),e.value=wt(e.value,n,n.slice(0,n.length-s.length))}else if(r){let e=At(r.value),n=Dt(kt(t.value),e);t.value=Et(t.value,n)}else if(e){let n=Dt(kt(e.value),At(t.value));t.value=Tt(t.value,n)}}new class extends bt{tokenize(e){let t=RegExp(`(\\r?\\n)|[${jt}]+|[^\\S\\n\\r]+|[^${jt}]`,`ug`);return e.match(t)||[]}};var Pt=new class extends bt{constructor(){super(...arguments),this.tokenize=It}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
2
2
  `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
3
3
  `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
4
4
  `)&&(e=e.slice(0,-1)),t.endsWith(`
@@ -58,7 +58,7 @@ import{i as e,r as t,t as n}from"./chunk-zsgVPwQN.js";var r=n((e=>{(function(){v
58
58
  `)+`
59
59
 
60
60
  `,this.references=[]),t}},on.emphasis={filter:[`em`,`i`],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:``}},on.strong={filter:[`strong`,`b`],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:``}},on.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName===`PRE`&&!t;return e.nodeName===`CODE`&&!n},replacement:function(e){if(!e)return``;e=e.replace(/\r?\n|\r/g,` `);for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?` `:``,n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n+="`";return n+t+e+t+n}},on.image={filter:`img`,replacement:function(e,t){var n=sn(t.getAttribute(`alt`)),r=t.getAttribute(`src`)||``,i=sn(t.getAttribute(`title`)),a=i?` "`+i+`"`:``;return r?`![`+n+`](`+r+a+`)`:``}};function sn(e){return e?e.replace(/(\n+\s*)+/g,`
61
- `):``}function cn(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}cn.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return``}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ln(this.array,e,this.options))||(t=ln(this._keep,e,this.options))||(t=ln(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ln(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(un(i,t,n))return i}}function un(e,t,n){var r=e.filter;if(typeof r==`string`){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r==`function`){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function dn(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return e.nodeName===`PRE`};if(!(!t.firstChild||i(t))){for(var a=null,o=!1,s=null,c=pn(s,t,i);c!==t;){if(c.nodeType===3||c.nodeType===4){var l=c.data.replace(/[ \r\n\t]+/g,` `);if((!a||/ $/.test(a.data))&&!o&&l[0]===` `&&(l=l.substr(1)),!l){c=fn(c);continue}c.data=l,a=c}else if(c.nodeType===1)n(c)||c.nodeName===`BR`?(a&&(a.data=a.data.replace(/ $/,``)),a=null,o=!1):r(c)||i(c)?(a=null,o=!0):a&&(o=!1);else{c=fn(c);continue}var u=pn(s,c,i);s=c,c=u}a&&(a.data=a.data.replace(/ $/,``),a.data||fn(a))}}function fn(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function pn(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var mn=typeof window<`u`?window:{};function hn(){var e=mn.DOMParser,t=!1;try{new e().parseFromString(``,`text/html`)&&(t=!0)}catch{}return t}function gn(){var e=function(){};return _n()?e.prototype.parseFromString=function(e){var t=new window.ActiveXObject(`htmlfile`);return t.designMode=`on`,t.open(),t.write(e),t.close(),t}:e.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument(``);return t.open(),t.write(e),t.close(),t},e}function _n(){var e=!1;try{document.implementation.createHTMLDocument(``).open()}catch{mn.ActiveXObject&&(e=!0)}return e}var vn=hn()?mn.DOMParser:gn();function yn(e,t){var n=typeof e==`string`?xn().parseFromString(`<x-turndown id="turndown-root">`+e+`</x-turndown>`,`text/html`).getElementById(`turndown-root`):e.cloneNode(!0);return dn({element:n,isBlock:Xt,isVoid:Qt,isPre:t.preformattedCode?Sn:null}),n}var bn;function xn(){return bn||=new vn,bn}function Sn(e){return e.nodeName===`PRE`||e.nodeName===`CODE`}function Cn(e,t){return e.isBlock=Xt(e),e.isCode=e.nodeName===`CODE`||e.parentNode.isCode,e.isBlank=wn(e),e.flankingWhitespace=Tn(e,t),e}function wn(e){return!Qt(e)&&!tn(e)&&/^\s*$/i.test(e.textContent)&&!$t(e)&&!nn(e)}function Tn(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:``,trailing:``};var n=En(e.textContent);return n.leadingAscii&&Dn(`left`,e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Dn(`right`,e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function En(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Dn(e,t,n){var r,i,a;return e===`left`?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName===`CODE`?a=!1:r.nodeType===1&&!Xt(r)&&(a=i.test(r.textContent))),a}var On=Array.prototype.reduce,kn=[[/\\/g,`\\\\`],[/\*/g,`\\*`],[/^-/g,`\\-`],[/^\+ /g,`\\+ `],[/^(=+)/g,`\\$1`],[/^(#{1,6}) /g,`\\$1 `],[/`/g,"\\`"],[/^~~~/g,`\\~~~`],[/\[/g,`\\[`],[/\]/g,`\\]`],[/^>/g,`\\>`],[/_/g,`\\_`],[/^(\d+)\. /g,`$1\\. `]];function An(e){if(!(this instanceof An))return new An(e);this.options=Wt({},{rules:on,headingStyle:`setext`,hr:`* * *`,bulletListMarker:`*`,codeBlockStyle:`indented`,fence:"```",emDelimiter:`_`,strongDelimiter:`**`,linkStyle:`inlined`,linkReferenceStyle:`full`,br:` `,preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?`
61
+ `):``}function cn(e){for(var t in this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[],e.rules)this.array.push(e.rules[t])}cn.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return``}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=ln(this.array,e,this.options))||(t=ln(this._keep,e,this.options))||(t=ln(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function ln(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(un(i,t,n))return i}}function un(e,t,n){var r=e.filter;if(typeof r==`string`){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r==`function`){if(r.call(e,t,n))return!0}else throw TypeError("`filter` needs to be a string, array, or function")}function dn(e){var t=e.element,n=e.isBlock,r=e.isVoid,i=e.isPre||function(e){return e.nodeName===`PRE`};if(!(!t.firstChild||i(t))){for(var a=null,o=!1,s=null,c=pn(s,t,i);c!==t;){if(c.nodeType===3||c.nodeType===4){var l=c.data.replace(/[ \r\n\t]+/g,` `);if((!a||/ $/.test(a.data))&&!o&&l[0]===` `&&(l=l.substr(1)),!l){c=fn(c);continue}c.data=l,a=c}else if(c.nodeType===1)n(c)||c.nodeName===`BR`?(a&&(a.data=a.data.replace(/ $/,``)),a=null,o=!1):r(c)||i(c)?(a=null,o=!0):a&&(o=!1);else{c=fn(c);continue}var u=pn(s,c,i);s=c,c=u}a&&(a.data=a.data.replace(/ $/,``),a.data||fn(a))}}function fn(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function pn(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var mn=typeof window<`u`?window:{};function hn(){var e=mn.DOMParser,t=!1;try{new e().parseFromString(``,`text/html`)&&(t=!0)}catch{}return t}function gn(){var e=function(){};return _n()?e.prototype.parseFromString=function(e){var t=new window.ActiveXObject(`htmlfile`);return t.designMode=`on`,t.open(),t.write(e),t.close(),t}:e.prototype.parseFromString=function(e){var t=document.implementation.createHTMLDocument(``);return t.open(),t.write(e),t.close(),t},e}function _n(){var e=!1;try{document.implementation.createHTMLDocument(``).open()}catch{mn.ActiveXObject&&(e=!0)}return e}var vn=hn()?mn.DOMParser:gn();function yn(e,t){var n=typeof e==`string`?xn().parseFromString(`<x-turndown id="turndown-root">`+e+`</x-turndown>`,`text/html`).getElementById(`turndown-root`):e.cloneNode(!0);return dn({element:n,isBlock:Xt,isVoid:Qt,isPre:t.preformattedCode?Sn:null}),n}var bn;function xn(){return bn||=new vn,bn}function Sn(e){return e.nodeName===`PRE`||e.nodeName===`CODE`}function Cn(e,t){return e.isBlock=Xt(e),e.isCode=e.nodeName===`CODE`||e.parentNode.isCode,e.isBlank=wn(e),e.flankingWhitespace=Tn(e,t),e}function wn(e){return!Qt(e)&&!tn(e)&&/^\s*$/i.test(e.textContent)&&!$t(e)&&!nn(e)}function Tn(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:``,trailing:``};var n=En(e.textContent);return n.leadingAscii&&Dn(`left`,e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&Dn(`right`,e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function En(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function Dn(e,t,n){var r,i,a;return e===`left`?(r=t.previousSibling,i=/ $/):(r=t.nextSibling,i=/^ /),r&&(r.nodeType===3?a=i.test(r.nodeValue):n.preformattedCode&&r.nodeName===`CODE`?a=!1:r.nodeType===1&&!Xt(r)&&(a=i.test(r.textContent))),a}var On=Array.prototype.reduce,kn=[[/\\/g,`\\\\`],[/\*/g,`\\*`],[/^-/g,`\\-`],[/^\+ /g,`\\+ `],[/^(=+)/g,`\\$1`],[/^(#{1,6}) /g,`\\$1 `],[/`/g,"\\`"],[/^~~~/g,`\\~~~`],[/\[/g,`\\[`],[/\]/g,`\\]`],[/^>/g,`\\>`],[/_/g,`\\_`],[/^(\d+)\. /g,`$1\\. `]];function An(e){if(!(this instanceof An))return new An(e);var t={rules:on,headingStyle:`setext`,hr:`* * *`,bulletListMarker:`*`,codeBlockStyle:`indented`,fence:"```",emDelimiter:`_`,strongDelimiter:`**`,linkStyle:`inlined`,linkReferenceStyle:`full`,br:` `,preformattedCode:!1,blankReplacement:function(e,t){return t.isBlock?`
62
62
 
63
63
  `:``},keepReplacement:function(e,t){return t.isBlock?`
64
64
 
@@ -68,7 +68,7 @@ import{i as e,r as t,t as n}from"./chunk-zsgVPwQN.js";var r=n((e=>{(function(){v
68
68
 
69
69
  `+e+`
70
70
 
71
- `:e}},e),this.rules=new cn(this.options)}An.prototype={turndown:function(e){if(!Fn(e))throw TypeError(e+` is not a string, or an element/document/fragment node.`);if(e===``)return``;var t=jn.call(this,new yn(e,this.options));return Mn.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e==`function`)e(this);else throw TypeError(`plugin must be a Function or an Array of Functions`);return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return kn.reduce(function(e,t){return e.replace(t[0],t[1])},e)}};function jn(e){var t=this;return On.call(e.childNodes,function(e,n){n=new Cn(n,t.options);var r=``;return n.nodeType===3?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):n.nodeType===1&&(r=Nn.call(t,n)),Pn(e,r)},``)}function Mn(e){var t=this;return this.rules.forEach(function(n){typeof n.append==`function`&&(e=Pn(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,``).replace(/[\t\r\n\s]+$/,``)}function Nn(e){var t=this.rules.forNode(e),n=jn.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function Pn(e,t){var n=qt(e),r=Kt(t),i=Math.max(e.length-n.length,t.length-r.length);return n+`
71
+ `:e}};this.options=Wt({},t,e),this.rules=new cn(this.options)}An.prototype={turndown:function(e){if(!Fn(e))throw TypeError(e+` is not a string, or an element/document/fragment node.`);if(e===``)return``;var t=jn.call(this,new yn(e,this.options));return Mn.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e==`function`)e(this);else throw TypeError(`plugin must be a Function or an Array of Functions`);return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return kn.reduce(function(e,t){return e.replace(t[0],t[1])},e)}};function jn(e){var t=this;return On.call(e.childNodes,function(e,n){n=new Cn(n,t.options);var r=``;return n.nodeType===3?r=n.isCode?n.nodeValue:t.escape(n.nodeValue):n.nodeType===1&&(r=Nn.call(t,n)),Pn(e,r)},``)}function Mn(e){var t=this;return this.rules.forEach(function(n){typeof n.append==`function`&&(e=Pn(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,``).replace(/[\t\r\n\s]+$/,``)}function Nn(e){var t=this.rules.forNode(e),n=jn.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function Pn(e,t){var n=qt(e),r=Kt(t),i=Math.max(e.length-n.length,t.length-r.length);return n+`
72
72
 
73
73
  `.substring(0,i)+r}function Fn(e){return e!=null&&(typeof e==`string`||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}var In=Object.create,Ln=Object.defineProperty,Rn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyNames,Bn=Object.getPrototypeOf,Vn=Object.prototype.hasOwnProperty,Hn=(t=>typeof e<`u`?e:typeof Proxy<`u`?new Proxy(t,{get:(t,n)=>(typeof e<`u`?e:t)[n]}):t)(function(t){if(typeof e<`u`)return e.apply(this,arguments);throw Error(`Dynamic require of "`+t+`" is not supported`)}),S=(e,t)=>()=>(e&&(t=e(e=0)),t),Un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),C=(e,t)=>{for(var n in t)Ln(e,n,{get:t[n],enumerable:!0})},Wn=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of zn(t))!Vn.call(e,i)&&i!==n&&Ln(e,i,{get:()=>t[i],enumerable:!(r=Rn(t,i))||r.enumerable});return e},Gn=(e,t,n)=>(n=e==null?{}:In(Bn(e)),Wn(t||!e||!e.__esModule?Ln(n,`default`,{value:e,enumerable:!0}):n,e));function Kn(){let e=[{prop:`Function`,target:globalThis,violationType:`function_constructor`,strategy:`throw`,reason:`Function constructor allows arbitrary code execution`},{prop:`eval`,target:globalThis,violationType:`eval`,strategy:`throw`,reason:`eval() allows arbitrary code execution`},{prop:`setTimeout`,target:globalThis,violationType:`setTimeout`,strategy:`throw`,reason:`setTimeout with string argument allows code execution`},{prop:`setInterval`,target:globalThis,violationType:`setInterval`,strategy:`throw`,reason:`setInterval with string argument allows code execution`},{prop:`setImmediate`,target:globalThis,violationType:`setImmediate`,strategy:`throw`,reason:`setImmediate could be used to escape sandbox context`},{prop:`env`,target:process,violationType:`process_env`,strategy:`throw`,reason:`process.env could leak sensitive environment variables`,allowedKeys:new Set([`NODE_V8_COVERAGE`,`NODE_DEBUG`,`NODE_DEBUG_NATIVE`,`NODE_COMPILE_CACHE`,`WATCH_REPORT_DEPENDENCIES`,`FORCE_COLOR`,`DEBUG`,`UNDICI_NO_FG`,`JEST_WORKER_ID`,`__MINIMATCH_TESTING_PLATFORM__`,`LOG_TOKENS`,`LOG_STREAM`])},{prop:`binding`,target:process,violationType:`process_binding`,strategy:`throw`,reason:`process.binding provides access to native Node.js modules`},{prop:`_linkedBinding`,target:process,violationType:`process_binding`,strategy:`throw`,reason:`process._linkedBinding provides access to native Node.js modules`},{prop:`dlopen`,target:process,violationType:`process_dlopen`,strategy:`throw`,reason:`process.dlopen allows loading native addons`},{prop:`getBuiltinModule`,target:process,violationType:`process_get_builtin_module`,strategy:`throw`,reason:`process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)`},{prop:`exit`,target:process,violationType:`process_exit`,strategy:`throw`,reason:`process.exit could terminate the interpreter`},{prop:`abort`,target:process,violationType:`process_exit`,strategy:`throw`,reason:`process.abort could crash the interpreter`},{prop:`kill`,target:process,violationType:`process_kill`,strategy:`throw`,reason:`process.kill could signal other processes`},{prop:`setuid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setuid could escalate privileges`},{prop:`setgid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setgid could escalate privileges`},{prop:`seteuid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.seteuid could escalate effective user privileges`},{prop:`setegid`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setegid could escalate effective group privileges`},{prop:`initgroups`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.initgroups could modify supplementary group IDs`},{prop:`setgroups`,target:process,violationType:`process_setuid`,strategy:`throw`,reason:`process.setgroups could modify supplementary group IDs`},{prop:`umask`,target:process,violationType:`process_umask`,strategy:`throw`,reason:`process.umask could modify file creation permissions`},{prop:`argv`,target:process,violationType:`process_argv`,strategy:`throw`,reason:`process.argv may contain secrets in CLI arguments`},{prop:`cwd`,target:process,violationType:`process_chdir`,strategy:`throw`,reason:`process.cwd could disclose real host working directory path`},{prop:`chdir`,target:process,violationType:`process_chdir`,strategy:`throw`,reason:`process.chdir could confuse the interpreter's CWD tracking`},{prop:`report`,target:process,violationType:`process_report`,strategy:`throw`,reason:`process.report could disclose full environment, host paths, and system info`},{prop:`loadEnvFile`,target:process,violationType:`process_env`,strategy:`throw`,reason:`process.loadEnvFile could load env files bypassing env proxy`},{prop:`setUncaughtExceptionCaptureCallback`,target:process,violationType:`process_exception_handler`,strategy:`throw`,reason:`setUncaughtExceptionCaptureCallback could intercept security errors`},{prop:`send`,target:process,violationType:`process_send`,strategy:`throw`,reason:`process.send could communicate with parent process in IPC contexts`},{prop:`channel`,target:process,violationType:`process_channel`,strategy:`throw`,reason:`process.channel could access IPC channel to parent process`},{prop:`cpuUsage`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.cpuUsage could enable timing side-channel attacks`},{prop:`memoryUsage`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.memoryUsage could enable timing side-channel attacks`},{prop:`hrtime`,target:process,violationType:`process_timing`,strategy:`throw`,reason:`process.hrtime could enable timing side-channel attacks`},{prop:`WeakRef`,target:globalThis,violationType:`weak_ref`,strategy:`throw`,reason:`WeakRef could be used to leak references outside sandbox`},{prop:`FinalizationRegistry`,target:globalThis,violationType:`finalization_registry`,strategy:`throw`,reason:`FinalizationRegistry could be used to leak references outside sandbox`},{prop:`Reflect`,target:globalThis,violationType:`reflect`,strategy:`freeze`,reason:`Reflect provides introspection capabilities`},{prop:`Proxy`,target:globalThis,violationType:`proxy`,strategy:`throw`,reason:`Proxy allows intercepting and modifying object behavior`},{prop:`WebAssembly`,target:globalThis,violationType:`webassembly`,strategy:`throw`,reason:`WebAssembly allows executing arbitrary compiled code`},{prop:`SharedArrayBuffer`,target:globalThis,violationType:`shared_array_buffer`,strategy:`throw`,reason:`SharedArrayBuffer could enable side-channel communication or timing attacks`},{prop:`Atomics`,target:globalThis,violationType:`atomics`,strategy:`throw`,reason:`Atomics could enable side-channel communication or timing attacks`},{prop:`performance`,target:globalThis,violationType:`performance_timing`,strategy:`throw`,reason:`performance.now() provides sub-millisecond timing for side-channel attacks`},{prop:`stdout`,target:process,violationType:`process_stdout`,strategy:`throw`,reason:`process.stdout could bypass interpreter output to write to host stdout`},{prop:`stderr`,target:process,violationType:`process_stderr`,strategy:`throw`,reason:`process.stderr could bypass interpreter output to write to host stderr`},{prop:`__defineGetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__defineGetter__ allows prototype pollution via getter injection`},{prop:`__defineSetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__defineSetter__ allows prototype pollution via setter injection`},{prop:`__lookupGetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__lookupGetter__ enables introspection for prototype pollution attacks`},{prop:`__lookupSetter__`,target:Object.prototype,violationType:`prototype_mutation`,strategy:`throw`,reason:`__lookupSetter__ enables introspection for prototype pollution attacks`},{prop:`JSON`,target:globalThis,violationType:`json_mutation`,strategy:`freeze`,reason:`Freeze JSON to prevent mutation of parsing/serialization`},{prop:`Math`,target:globalThis,violationType:`math_mutation`,strategy:`freeze`,reason:`Freeze Math to prevent mutation of math utilities`}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&e.push({prop:`constructor`,target:Object.getPrototypeOf(async()=>{}),violationType:`async_function_constructor`,strategy:`throw`,reason:`AsyncFunction constructor allows arbitrary async code execution`})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&e.push({prop:`constructor`,target:Object.getPrototypeOf(function*(){}),violationType:`generator_function_constructor`,strategy:`throw`,reason:`GeneratorFunction constructor allows arbitrary generator code execution`})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&e.push({prop:`constructor`,target:Object.getPrototypeOf(async function*(){}),violationType:`async_generator_function_constructor`,strategy:`throw`,reason:`AsyncGeneratorFunction constructor allows arbitrary async generator code execution`})}catch{}return e.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var qn=S(()=>{});function Jn(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function Yn(e,t,...n){return er.run(e,()=>t(...n))}function Xn(e){return e===void 0?{...nr,enabled:!1}:typeof e==`boolean`?{...nr,enabled:e}:{...nr,...e}}var Zn,Qn,$n,w,er,tr,nr,rr,ir=S(()=>{if(qn(),Zn=!0,Qn=null,!Zn)try{let{AsyncLocalStorage:e}=Hn(`node:async_hooks`);Qn=e}catch{}$n=`
74
74
 
@@ -343,7 +343,7 @@ ${e}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;br
343
343
  `||e===`;`)break;i+=this.advance()}return{type:e,value:t,filename:i.trim(),line:n,column:r}}readExecute(e,t){for(;this.peek()===` `||this.peek()===` `;)this.advance();let n=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`
344
344
  `||e===`;`)break;n+=this.advance()}return{type:B.EXECUTE,value:`e`,command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>=`0`&&e<=`9`}}});function Fl(e,t=!1){let n=!1,r=!1,i=[];for(let t=0;t<e.length;t++){let a=e[t];if(i.length===0&&t===0){let e=a.match(/^#([nr]+)\s*(?:\n|$)/i);if(e){let t=e[1].toLowerCase();t.includes(`n`)&&(n=!0),t.includes(`r`)&&(r=!0),a=a.slice(e[0].length)}}if(i.length>0&&i[i.length-1].endsWith(`\\`)){let e=i[i.length-1];i[i.length-1]=`${e}
345
345
  ${a}`}else i.push(a)}let a=i.join(`
346
- `),o=new zl([a],t||r).parse();if(!o.error&&o.commands.length>0){let e=Il(o.commands);if(e)return{commands:[],error:e,silentMode:n,extendedRegexMode:r}}return{...o,silentMode:n,extendedRegexMode:r}}function Il(e){let t=new Set;Ll(e,t);let n=Rl(e,t);if(n)return`undefined label '${n}'`}function Ll(e,t){for(let n of e)n.type===`label`?t.add(n.name):n.type===`group`&&Ll(n.commands,t)}function Rl(e,t){for(let n of e){if((n.type===`branch`||n.type===`branchOnSubst`||n.type===`branchOnNoSubst`)&&n.label&&!t.has(n.label))return n.label;if(n.type===`group`){let e=Rl(n.commands,t);if(e)return e}}}var zl,Bl=S(()=>{Pl(),zl=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts)for(this.tokens=new Nl(t).tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(B.NEWLINE)||this.check(B.SEMICOLON)){this.advance();continue}let t=this.pos,n=this.parseCommand();if(n.error)return{commands:[],error:n.error};if(n.command&&e.push(n.command),this.pos===t&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(B.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(B.NEWLINE)||this.check(B.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:`command expected`}:{command:null};let n=this.peek();switch(n.type){case B.COMMAND:return this.parseSimpleCommand(n,t);case B.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case B.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case B.LABEL_DEF:return this.advance(),{command:{type:`label`,name:n.label||``}};case B.BRANCH:return this.advance(),{command:{type:`branch`,address:t,label:n.label}};case B.BRANCH_ON_SUBST:return this.advance(),{command:{type:`branchOnSubst`,address:t,label:n.label}};case B.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:`branchOnNoSubst`,address:t,label:n.label}};case B.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case B.FILE_READ:return this.advance(),{command:{type:`readFile`,address:t,filename:n.filename||``}};case B.FILE_READ_LINE:return this.advance(),{command:{type:`readFileLine`,address:t,filename:n.filename||``}};case B.FILE_WRITE:return this.advance(),{command:{type:`writeFile`,address:t,filename:n.filename||``}};case B.FILE_WRITE_LINE:return this.advance(),{command:{type:`writeFirstLine`,address:t,filename:n.filename||``}};case B.EXECUTE:return this.advance(),{command:{type:`execute`,address:t,command:n.command}};case B.VERSION:return this.advance(),{command:{type:`version`,address:t,minVersion:n.label}};case B.LBRACE:return this.parseGroup(t);case B.RBRACE:return{command:null};case B.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:`command expected`}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case`p`:return{command:{type:`print`,address:t}};case`P`:return{command:{type:`printFirstLine`,address:t}};case`d`:return{command:{type:`delete`,address:t}};case`D`:return{command:{type:`deleteFirstLine`,address:t}};case`h`:return{command:{type:`hold`,address:t}};case`H`:return{command:{type:`holdAppend`,address:t}};case`g`:return{command:{type:`get`,address:t}};case`G`:return{command:{type:`getAppend`,address:t}};case`x`:return{command:{type:`exchange`,address:t}};case`n`:return{command:{type:`next`,address:t}};case`N`:return{command:{type:`nextAppend`,address:t}};case`q`:return{command:{type:`quit`,address:t}};case`Q`:return{command:{type:`quitSilent`,address:t}};case`z`:return{command:{type:`zap`,address:t}};case`=`:return{command:{type:`lineNumber`,address:t}};case`l`:return{command:{type:`list`,address:t}};case`F`:return{command:{type:`printFilename`,address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||``,r,i=n.match(/(\d+)/);return i&&(r=parseInt(i[1],10)),{command:{type:`substitute`,address:t,pattern:e.pattern||``,replacement:e.replacement||``,global:n.includes(`g`),ignoreCase:n.includes(`i`)||n.includes(`I`),printOnMatch:n.includes(`p`),nthOccurrence:r,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||``,r=e.dest||``;return n.length===r.length?{command:{type:`transliterate`,address:t,source:n,dest:r}}:{command:null,error:`transliteration sets must have same length`}}parseTextCommand(e,t){let n=e.value,r=e.text||``;switch(n){case`a`:return{command:{type:`append`,address:t,text:r}};case`i`:return{command:{type:`insert`,address:t,text:r}};case`c`:return{command:{type:`change`,address:t,text:r}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(B.RBRACE);){if(this.check(B.NEWLINE)||this.check(B.SEMICOLON)){this.advance();continue}let e=this.pos,n=this.parseCommand();if(n.error)return{command:null,error:n.error};if(n.command&&t.push(n.command),this.pos===e&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(B.RBRACE)?(this.advance(),{command:{type:`group`,address:e,commands:t}}):{command:null,error:`unmatched brace in grouped commands`}}parseAddressRange(){if(this.check(B.COMMA))return{error:`expected context address`};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(B.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(B.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:`expected context address`};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case B.NUMBER:return this.advance(),e.value;case B.DOLLAR:return this.advance(),`$`;case B.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case B.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case B.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:B.EOF,value:``,line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===B.EOF}}}),Vl={};C(Vl,{flagsForFuzzing:()=>Gl,sedCommand:()=>Wl});async function Hl(e,t,n,r={}){let{limits:i,filename:a,fs:o,cwd:s,coverage:c,requireDefenseContext:l}=r;ul(l,`sed`,`processing entry`);let u=(e,t)=>dl(l,`sed`,e,t),d=e.endsWith(`
346
+ `),o=new zl([a],t||r).parse();if(!o.error&&o.commands.length>0){let e=Il(o.commands);if(e)return{commands:[],error:e,silentMode:n,extendedRegexMode:r}}return{...o,silentMode:n,extendedRegexMode:r}}function Il(e){let t=new Set;Ll(e,t);let n=Rl(e,t);if(n)return`undefined label '${n}'`}function Ll(e,t){for(let n of e)n.type===`label`?t.add(n.name):n.type===`group`&&Ll(n.commands,t)}function Rl(e,t){for(let n of e){if((n.type===`branch`||n.type===`branchOnSubst`||n.type===`branchOnNoSubst`)&&n.label&&!t.has(n.label))return n.label;if(n.type===`group`){let e=Rl(n.commands,t);if(e)return e}}}var zl,Bl=S(()=>{Pl(),zl=class{scripts;tokens=[];pos=0;extendedRegex=!1;constructor(e,t=!1){this.scripts=e,this.extendedRegex=t}parse(){let e=[];for(let t of this.scripts){let n=new Nl(t);for(this.tokens=n.tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(B.NEWLINE)||this.check(B.SEMICOLON)){this.advance();continue}let t=this.pos,n=this.parseCommand();if(n.error)return{commands:[],error:n.error};if(n.command&&e.push(n.command),this.pos===t&&!this.isAtEnd())return{commands:[],error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}}return{commands:e}}parseCommand(){let e=this.parseAddressRange();if(e?.error)return{command:null,error:e.error};let t=e?.address;for(this.check(B.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(B.NEWLINE)||this.check(B.SEMICOLON);)this.advance();if(this.isAtEnd())return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:`command expected`}:{command:null};let n=this.peek();switch(n.type){case B.COMMAND:return this.parseSimpleCommand(n,t);case B.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case B.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case B.LABEL_DEF:return this.advance(),{command:{type:`label`,name:n.label||``}};case B.BRANCH:return this.advance(),{command:{type:`branch`,address:t,label:n.label}};case B.BRANCH_ON_SUBST:return this.advance(),{command:{type:`branchOnSubst`,address:t,label:n.label}};case B.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:`branchOnNoSubst`,address:t,label:n.label}};case B.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case B.FILE_READ:return this.advance(),{command:{type:`readFile`,address:t,filename:n.filename||``}};case B.FILE_READ_LINE:return this.advance(),{command:{type:`readFileLine`,address:t,filename:n.filename||``}};case B.FILE_WRITE:return this.advance(),{command:{type:`writeFile`,address:t,filename:n.filename||``}};case B.FILE_WRITE_LINE:return this.advance(),{command:{type:`writeFirstLine`,address:t,filename:n.filename||``}};case B.EXECUTE:return this.advance(),{command:{type:`execute`,address:t,command:n.command}};case B.VERSION:return this.advance(),{command:{type:`version`,address:t,minVersion:n.label}};case B.LBRACE:return this.parseGroup(t);case B.RBRACE:return{command:null};case B.ERROR:return{command:null,error:`invalid command: ${n.value}`};default:return t&&(t.start!==void 0||t.end!==void 0)?{command:null,error:`command expected`}:{command:null}}}parseSimpleCommand(e,t){this.advance();let n=e.value;switch(n){case`p`:return{command:{type:`print`,address:t}};case`P`:return{command:{type:`printFirstLine`,address:t}};case`d`:return{command:{type:`delete`,address:t}};case`D`:return{command:{type:`deleteFirstLine`,address:t}};case`h`:return{command:{type:`hold`,address:t}};case`H`:return{command:{type:`holdAppend`,address:t}};case`g`:return{command:{type:`get`,address:t}};case`G`:return{command:{type:`getAppend`,address:t}};case`x`:return{command:{type:`exchange`,address:t}};case`n`:return{command:{type:`next`,address:t}};case`N`:return{command:{type:`nextAppend`,address:t}};case`q`:return{command:{type:`quit`,address:t}};case`Q`:return{command:{type:`quitSilent`,address:t}};case`z`:return{command:{type:`zap`,address:t}};case`=`:return{command:{type:`lineNumber`,address:t}};case`l`:return{command:{type:`list`,address:t}};case`F`:return{command:{type:`printFilename`,address:t}};default:return{command:null,error:`unknown command: ${n}`}}}parseSubstituteFromToken(e,t){this.advance();let n=e.flags||``,r,i=n.match(/(\d+)/);return i&&(r=parseInt(i[1],10)),{command:{type:`substitute`,address:t,pattern:e.pattern||``,replacement:e.replacement||``,global:n.includes(`g`),ignoreCase:n.includes(`i`)||n.includes(`I`),printOnMatch:n.includes(`p`),nthOccurrence:r,extendedRegex:this.extendedRegex}}}parseTransliterateFromToken(e,t){this.advance();let n=e.source||``,r=e.dest||``;return n.length===r.length?{command:{type:`transliterate`,address:t,source:n,dest:r}}:{command:null,error:`transliteration sets must have same length`}}parseTextCommand(e,t){let n=e.value,r=e.text||``;switch(n){case`a`:return{command:{type:`append`,address:t,text:r}};case`i`:return{command:{type:`insert`,address:t,text:r}};case`c`:return{command:{type:`change`,address:t,text:r}};default:return{command:null,error:`unknown text command: ${n}`}}}parseGroup(e){this.advance();let t=[];for(;!this.isAtEnd()&&!this.check(B.RBRACE);){if(this.check(B.NEWLINE)||this.check(B.SEMICOLON)){this.advance();continue}let e=this.pos,n=this.parseCommand();if(n.error)return{command:null,error:n.error};if(n.command&&t.push(n.command),this.pos===e&&!this.isAtEnd())return{command:null,error:`unknown command: '${this.peek()?.value??this.peek()?.type}'`}}return this.check(B.RBRACE)?(this.advance(),{command:{type:`group`,address:e,commands:t}}):{command:null,error:`unmatched brace in grouped commands`}}parseAddressRange(){if(this.check(B.COMMA))return{error:`expected context address`};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(B.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(B.COMMA)&&(this.advance(),t=this.parseAddress(),t===void 0))return{error:`expected context address`};return{address:{start:e,end:t}}}parseAddress(){let e=this.peek();switch(e.type){case B.NUMBER:return this.advance(),e.value;case B.DOLLAR:return this.advance(),`$`;case B.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case B.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case B.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:B.EOF,value:``,line:0,column:0}}advance(){return this.isAtEnd()||this.pos++,this.tokens[this.pos-1]}check(e){return this.peek().type===e}isAtEnd(){return this.peek().type===B.EOF}}}),Vl={};C(Vl,{flagsForFuzzing:()=>Gl,sedCommand:()=>Wl});async function Hl(e,t,n,r={}){let{limits:i,filename:a,fs:o,cwd:s,coverage:c,requireDefenseContext:l}=r;ul(l,`sed`,`processing entry`);let u=(e,t)=>dl(l,`sed`,e,t),d=e.endsWith(`
347
347
  `),f=e.split(`
348
348
  `);f.length>0&&f[f.length-1]===``&&f.pop();let p=f.length,m=``,h,g=!1,_=i?.maxStringLength??0,v=e=>{if(m+=e,_>0&&m.length>_)throw new k(`sed: output size limit exceeded (${_} bytes)`,`string_length`)},y=``,ee,te=new Map,ne=new Map,b=new Map,re=new Map,x=i?{maxIterations:i.maxSedIterations,maxStringLength:_}:void 0;for(let e=0;e<f.length;e++){let r={...vl(p,a,te),patternSpace:f[e],holdSpace:y,lastPattern:ee,lineNumber:e+1,totalLines:p,substitutionMade:!1,coverage:c},i={lines:f,currentLineIndex:e},l=0;r.linesConsumedInCycle=0;do{if(l++,l>1e4)break;if(r.restartCycle=!1,r.pendingFileReads=[],r.pendingFileWrites=[],Al(t,r,i,x),o&&s){for(let e of r.pendingFileReads){let t=o.resolvePath(s,e.filename);try{if(e.wholeFile){let e=await u(`read command file`,()=>o.readFile(t));r.appendBuffer.push(e.replace(/\n$/,``))}else{if(!ne.has(t)){let e=await u(`read command file line cache`,()=>o.readFile(t));ne.set(t,e.split(`
349
349
  `)),b.set(t,0)}let e=ne.get(t),n=b.get(t);e&&n!==void 0&&n<e.length&&(r.appendBuffer.push(e[n]),b.set(t,n+1))}}catch(e){if(e instanceof w)throw e}}for(let e of r.pendingFileWrites){let t=o.resolvePath(s,e.filename),n=re.get(t)||``;re.set(t,n+e.content)}}}while(r.restartCycle&&!r.deleted&&!r.quit&&!r.quitSilent);if(e+=r.linesConsumedInCycle,y=r.holdSpace,ee=r.lastPattern,!n)for(let e of r.nCommandOutput)v(`${e}
@@ -411,7 +411,7 @@ Addresses:
411
411
  `?(this.advance(),{type:H.NEWLINE,value:`
412
412
  `,line:e,column:t}):n===`"`?this.readString():n===`/`&&this.canBeRegex()?this.readRegex():this.isDigit(n)||n===`.`&&this.isDigit(this.peek(1))?this.readNumber():this.isAlpha(n)||n===`_`?this.readIdentifier():this.readOperator()}canBeRegex(){return new Set([null,H.NEWLINE,H.SEMICOLON,H.LBRACE,H.RBRACE,H.LPAREN,H.LBRACKET,H.COMMA,H.ASSIGN,H.PLUS_ASSIGN,H.MINUS_ASSIGN,H.STAR_ASSIGN,H.SLASH_ASSIGN,H.PERCENT_ASSIGN,H.CARET_ASSIGN,H.AND,H.OR,H.NOT,H.MATCH,H.NOT_MATCH,H.QUESTION,H.COLON,H.LT,H.GT,H.LE,H.GE,H.EQ,H.NE,H.PLUS,H.MINUS,H.STAR,H.PERCENT,H.CARET,H.PRINT,H.PRINTF,H.IF,H.WHILE,H.DO,H.FOR,H.RETURN]).has(this.lastTokenType)}readString(){let e=this.line,t=this.column;this.advance();let n=``;for(;this.pos<this.input.length&&this.peek()!==`"`;)if(this.peek()===`\\`){this.advance();let e=this.advance();switch(e){case`n`:n+=`
413
413
  `;break;case`t`:n+=` `;break;case`r`:n+=`\r`;break;case`f`:n+=`\f`;break;case`b`:n+=`\b`;break;case`v`:n+=`\v`;break;case`a`:n+=`\x07`;break;case`\\`:n+=`\\`;break;case`"`:n+=`"`;break;case`/`:n+=`/`;break;case`x`:{let e=``;for(;e.length<2&&/[0-9a-fA-F]/.test(this.peek());)e+=this.advance();e.length>0?n+=String.fromCharCode(parseInt(e,16)):n+=`x`;break}default:if(/[0-7]/.test(e)){let t=e;for(;t.length<3&&/[0-7]/.test(this.peek());)t+=this.advance();n+=String.fromCharCode(parseInt(t,8))}else n+=e}}else n+=this.advance();return this.peek()===`"`&&this.advance(),{type:H.STRING,value:n,line:e,column:t}}readRegex(){let e=this.line,t=this.column;this.advance();let n=``;for(;this.pos<this.input.length&&this.peek()!==`/`;)if(this.peek()===`\\`)n+=this.advance(),this.pos<this.input.length&&(n+=this.advance());else{if(this.peek()===`
414
- `)break;n+=this.advance()}return this.peek()===`/`&&this.advance(),n=Jd(n),{type:H.REGEX,value:n,line:e,column:t}}readNumber(){let e=this.line,t=this.column,n=``;for(;this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`.`&&this.isDigit(this.peek(1)))for(n+=this.advance();this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`e`||this.peek()===`E`)for(n+=this.advance(),(this.peek()===`+`||this.peek()===`-`)&&(n+=this.advance());this.isDigit(this.peek());)n+=this.advance();return{type:H.NUMBER,value:parseFloat(n),line:e,column:t}}readIdentifier(){let e=this.line,t=this.column,n=``;for(;this.isAlphaNumeric(this.peek())||this.peek()===`_`;)n+=this.advance();let r=Yd.get(n);return r===void 0?{type:H.IDENT,value:n,line:e,column:t}:{type:r,value:n,line:e,column:t}}readOperator(){let e=this.line,t=this.column,n=this.advance(),r=this.peek();switch(n){case`+`:return r===`+`?(this.advance(),{type:H.INCREMENT,value:`++`,line:e,column:t}):r===`=`?(this.advance(),{type:H.PLUS_ASSIGN,value:`+=`,line:e,column:t}):{type:H.PLUS,value:`+`,line:e,column:t};case`-`:return r===`-`?(this.advance(),{type:H.DECREMENT,value:`--`,line:e,column:t}):r===`=`?(this.advance(),{type:H.MINUS_ASSIGN,value:`-=`,line:e,column:t}):{type:H.MINUS,value:`-`,line:e,column:t};case`*`:return r===`*`?(this.advance(),{type:H.CARET,value:`**`,line:e,column:t}):r===`=`?(this.advance(),{type:H.STAR_ASSIGN,value:`*=`,line:e,column:t}):{type:H.STAR,value:`*`,line:e,column:t};case`/`:return r===`=`?(this.advance(),{type:H.SLASH_ASSIGN,value:`/=`,line:e,column:t}):{type:H.SLASH,value:`/`,line:e,column:t};case`%`:return r===`=`?(this.advance(),{type:H.PERCENT_ASSIGN,value:`%=`,line:e,column:t}):{type:H.PERCENT,value:`%`,line:e,column:t};case`^`:return r===`=`?(this.advance(),{type:H.CARET_ASSIGN,value:`^=`,line:e,column:t}):{type:H.CARET,value:`^`,line:e,column:t};case`=`:return r===`=`?(this.advance(),{type:H.EQ,value:`==`,line:e,column:t}):{type:H.ASSIGN,value:`=`,line:e,column:t};case`!`:return r===`=`?(this.advance(),{type:H.NE,value:`!=`,line:e,column:t}):r===`~`?(this.advance(),{type:H.NOT_MATCH,value:`!~`,line:e,column:t}):{type:H.NOT,value:`!`,line:e,column:t};case`<`:return r===`=`?(this.advance(),{type:H.LE,value:`<=`,line:e,column:t}):{type:H.LT,value:`<`,line:e,column:t};case`>`:return r===`=`?(this.advance(),{type:H.GE,value:`>=`,line:e,column:t}):r===`>`?(this.advance(),{type:H.APPEND,value:`>>`,line:e,column:t}):{type:H.GT,value:`>`,line:e,column:t};case`&`:return r===`&`?(this.advance(),{type:H.AND,value:`&&`,line:e,column:t}):{type:H.IDENT,value:`&`,line:e,column:t};case`|`:return r===`|`?(this.advance(),{type:H.OR,value:`||`,line:e,column:t}):{type:H.PIPE,value:`|`,line:e,column:t};case`~`:return{type:H.MATCH,value:`~`,line:e,column:t};case`?`:return{type:H.QUESTION,value:`?`,line:e,column:t};case`:`:return{type:H.COLON,value:`:`,line:e,column:t};case`,`:return{type:H.COMMA,value:`,`,line:e,column:t};case`;`:return{type:H.SEMICOLON,value:`;`,line:e,column:t};case`(`:return{type:H.LPAREN,value:`(`,line:e,column:t};case`)`:return{type:H.RPAREN,value:`)`,line:e,column:t};case`{`:return{type:H.LBRACE,value:`{`,line:e,column:t};case`}`:return{type:H.RBRACE,value:`}`,line:e,column:t};case`[`:return{type:H.LBRACKET,value:`[`,line:e,column:t};case`]`:return{type:H.RBRACKET,value:`]`,line:e,column:t};case`$`:return{type:H.DOLLAR,value:`$`,line:e,column:t};default:return{type:H.IDENT,value:n,line:e,column:t}}}isDigit(e){return e>=`0`&&e<=`9`}isAlpha(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}isAlphaNumeric(e){return this.isDigit(e)||this.isAlpha(e)}}});function Qd(e){e.expect(U.PRINT);let t=[];if(e.check(U.NEWLINE)||e.check(U.SEMICOLON)||e.check(U.RBRACE)||e.check(U.PIPE)||e.check(U.GT)||e.check(U.APPEND))t.push({type:`field`,index:{type:`number`,value:0}});else for(t.push($d(e));e.check(U.COMMA);)e.advance(),t.push($d(e));let n;return e.check(U.GT)?(e.advance(),n={redirect:`>`,file:e.parsePrimary()}):e.check(U.APPEND)&&(e.advance(),n={redirect:`>>`,file:e.parsePrimary()}),{type:`print`,args:t,output:n}}function $d(e){return tf(e)?ef(e,!0):ef(e,!1)}function ef(e,t){let n=t?e.parseTernary():nf(e);if(e.match(U.ASSIGN,U.PLUS_ASSIGN,U.MINUS_ASSIGN,U.STAR_ASSIGN,U.SLASH_ASSIGN,U.PERCENT_ASSIGN,U.CARET_ASSIGN)){let r=e.advance(),i=ef(e,t);if(n.type!==`variable`&&n.type!==`field`&&n.type!==`array_access`)throw Error(`Invalid assignment target`);return{type:`assignment`,operator:new Map([[`=`,`=`],[`+=`,`+=`],[`-=`,`-=`],[`*=`,`*=`],[`/=`,`/=`],[`%=`,`%=`],[`^=`,`^=`]]).get(r.value)??`=`,target:n,value:i}}return n}function tf(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===U.LPAREN&&t++,r.type===U.RPAREN&&t--,r.type===U.QUESTION&&t===0)return!0;if(r.type===U.NEWLINE||r.type===U.SEMICOLON||r.type===U.RBRACE||r.type===U.COMMA||r.type===U.PIPE)return!1;n++}return!1}function nf(e){let t=rf(e);for(;e.check(U.OR);){e.advance();let n=rf(e);t={type:`binary`,operator:`||`,left:t,right:n}}return t}function rf(e){let t=af(e);for(;e.check(U.AND);){e.advance();let n=af(e);t={type:`binary`,operator:`&&`,left:t,right:n}}return t}function af(e){let t=of(e);return e.check(U.IN)?(e.advance(),{type:`in`,key:t,array:String(e.expect(U.IDENT).value)}):t}function of(e){let t=sf(e);for(;lf(e)&&!uf(e);){let n=sf(e);t={type:`binary`,operator:` `,left:t,right:n}}return t}function sf(e){let t=cf(e);for(;e.match(U.MATCH,U.NOT_MATCH);){let n=e.advance().type===U.MATCH?`~`:`!~`,r=cf(e);t={type:`binary`,operator:n,left:t,right:r}}return t}function cf(e){let t=e.parseAddSub();for(;e.match(U.LT,U.LE,U.GE,U.EQ,U.NE);){let n=e.advance(),r=e.parseAddSub();t={type:`binary`,operator:new Map([[`<`,`<`],[`<=`,`<=`],[`>=`,`>=`],[`==`,`==`],[`!=`,`!=`]]).get(n.value)??`==`,left:t,right:r}}return t}function lf(e){return e.match(U.NUMBER,U.STRING,U.IDENT,U.DOLLAR,U.LPAREN,U.NOT,U.MINUS,U.PLUS,U.INCREMENT,U.DECREMENT)}function uf(e){return e.match(U.AND,U.OR,U.QUESTION,U.ASSIGN,U.PLUS_ASSIGN,U.MINUS_ASSIGN,U.STAR_ASSIGN,U.SLASH_ASSIGN,U.PERCENT_ASSIGN,U.CARET_ASSIGN,U.COMMA,U.SEMICOLON,U.NEWLINE,U.RBRACE,U.RPAREN,U.RBRACKET,U.COLON,U.PIPE,U.APPEND,U.GT,U.IN)}function df(e){e.expect(U.PRINTF);let t=e.check(U.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():$d(e),r=[];for(;e.check(U.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():$d(e));t&&(e.skipNewlines(),e.expect(U.RPAREN));let i;return e.check(U.GT)?(e.advance(),i={redirect:`>`,file:e.parsePrimary()}):e.check(U.APPEND)&&(e.advance(),i={redirect:`>>`,file:e.parsePrimary()}),{type:`printf`,format:n,args:r,output:i}}var U,ff=S(()=>{U={LPAREN:`LPAREN`,RPAREN:`RPAREN`,QUESTION:`QUESTION`,NEWLINE:`NEWLINE`,SEMICOLON:`SEMICOLON`,RBRACE:`RBRACE`,COMMA:`COMMA`,PIPE:`PIPE`,GT:`GT`,APPEND:`APPEND`,AND:`AND`,OR:`OR`,ASSIGN:`ASSIGN`,PLUS_ASSIGN:`PLUS_ASSIGN`,MINUS_ASSIGN:`MINUS_ASSIGN`,STAR_ASSIGN:`STAR_ASSIGN`,SLASH_ASSIGN:`SLASH_ASSIGN`,PERCENT_ASSIGN:`PERCENT_ASSIGN`,CARET_ASSIGN:`CARET_ASSIGN`,RBRACKET:`RBRACKET`,COLON:`COLON`,IN:`IN`,PRINT:`PRINT`,PRINTF:`PRINTF`,IDENT:`IDENT`,LT:`LT`,LE:`LE`,GE:`GE`,EQ:`EQ`,NE:`NE`,MATCH:`MATCH`,NOT_MATCH:`NOT_MATCH`,NUMBER:`NUMBER`,STRING:`STRING`,DOLLAR:`DOLLAR`,NOT:`NOT`,MINUS:`MINUS`,PLUS:`PLUS`,INCREMENT:`INCREMENT`,DECREMENT:`DECREMENT`}}),pf,mf=S(()=>{Zd(),ff(),pf=class{tokens=[];pos=0;parse(e){return this.tokens=new Xd(e).tokenize(),this.pos=0,this.parseProgram()}setPos(e){this.pos=e}current(){return this.tokens[this.pos]||{type:H.EOF,value:``,line:0,column:0}}advance(){let e=this.current();return this.pos<this.tokens.length&&this.pos++,e}match(...e){return e.includes(this.current().type)}check(e){return this.current().type===e}expect(e,t){if(!this.check(e)){let n=this.current();throw Error(t||`Expected ${e}, got ${n.type} at line ${n.line}:${n.column}`)}return this.advance()}skipNewlines(){for(;this.check(H.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(H.NEWLINE)||this.check(H.SEMICOLON);)this.advance()}parseProgram(){let e=[],t=[];for(this.skipNewlines();!this.check(H.EOF)&&(this.skipNewlines(),!this.check(H.EOF));)this.check(H.FUNCTION)?e.push(this.parseFunction()):t.push(this.parseRule()),this.skipTerminators();return{functions:e,rules:t}}parseFunction(){this.expect(H.FUNCTION);let e=this.expect(H.IDENT).value;this.expect(H.LPAREN);let t=[];if(!this.check(H.RPAREN))for(t.push(this.expect(H.IDENT).value);this.check(H.COMMA);)this.advance(),t.push(this.expect(H.IDENT).value);return this.expect(H.RPAREN),this.skipNewlines(),{name:e,params:t,body:this.parseBlock()}}parseRule(){let e;if(this.check(H.BEGIN))this.advance(),e={type:`begin`};else if(this.check(H.END))this.advance(),e={type:`end`};else if(this.check(H.LBRACE))e=void 0;else if(this.check(H.REGEX)){let t=this.advance();if(this.check(H.AND)||this.check(H.OR)){let n={type:`binary`,operator:`~`,left:{type:`field`,index:{type:`number`,value:0}},right:{type:`regex`,pattern:t.value}};e={type:`expr_pattern`,expression:this.parseLogicalOrRest(n)}}else{let n={type:`regex_pattern`,pattern:t.value};if(this.check(H.COMMA)){this.advance();let t;t=this.check(H.REGEX)?{type:`regex_pattern`,pattern:this.advance().value}:{type:`expr_pattern`,expression:this.parseExpression()},e={type:`range`,start:n,end:t}}else e=n}}else{let t={type:`expr_pattern`,expression:this.parseExpression()};if(this.check(H.COMMA)){this.advance();let n;n=this.check(H.REGEX)?{type:`regex_pattern`,pattern:this.advance().value}:{type:`expr_pattern`,expression:this.parseExpression()},e={type:`range`,start:t,end:n}}else e=t}this.skipNewlines();let t;return t=this.check(H.LBRACE)?this.parseBlock():{type:`block`,statements:[{type:`print`,args:[{type:`field`,index:{type:`number`,value:0}}]}]},{pattern:e,action:t}}parseBlock(){this.expect(H.LBRACE),this.skipNewlines();let e=[];for(;!this.check(H.RBRACE)&&!this.check(H.EOF);)e.push(this.parseStatement()),this.skipTerminators();return this.expect(H.RBRACE),{type:`block`,statements:e}}parseStatement(){if(this.check(H.SEMICOLON)||this.check(H.NEWLINE))return this.advance(),{type:`block`,statements:[]};if(this.check(H.LBRACE))return this.parseBlock();if(this.check(H.IF))return this.parseIf();if(this.check(H.WHILE))return this.parseWhile();if(this.check(H.DO))return this.parseDoWhile();if(this.check(H.FOR))return this.parseFor();if(this.check(H.BREAK))return this.advance(),{type:`break`};if(this.check(H.CONTINUE))return this.advance(),{type:`continue`};if(this.check(H.NEXT))return this.advance(),{type:`next`};if(this.check(H.NEXTFILE))return this.advance(),{type:`nextfile`};if(this.check(H.EXIT)){this.advance();let e;return!this.check(H.NEWLINE)&&!this.check(H.SEMICOLON)&&!this.check(H.RBRACE)&&!this.check(H.EOF)&&(e=this.parseExpression()),{type:`exit`,code:e}}if(this.check(H.RETURN)){this.advance();let e;return!this.check(H.NEWLINE)&&!this.check(H.SEMICOLON)&&!this.check(H.RBRACE)&&!this.check(H.EOF)&&(e=this.parseExpression()),{type:`return`,value:e}}if(this.check(H.DELETE)){this.advance();let e=this.parsePrimary();if(e.type!==`array_access`&&e.type!==`variable`)throw Error(`delete requires array element or array`);return{type:`delete`,target:e}}return this.check(H.PRINT)?Qd(this):this.check(H.PRINTF)?df(this):{type:`expr_stmt`,expression:this.parseExpression()}}parseIf(){this.expect(H.IF),this.expect(H.LPAREN);let e=this.parseExpression();this.expect(H.RPAREN),this.skipNewlines();let t=this.parseStatement();this.skipTerminators();let n;return this.check(H.ELSE)&&(this.advance(),this.skipNewlines(),n=this.parseStatement()),{type:`if`,condition:e,consequent:t,alternate:n}}parseWhile(){this.expect(H.WHILE),this.expect(H.LPAREN);let e=this.parseExpression();return this.expect(H.RPAREN),this.skipNewlines(),{type:`while`,condition:e,body:this.parseStatement()}}parseDoWhile(){this.expect(H.DO),this.skipNewlines();let e=this.parseStatement();this.skipNewlines(),this.expect(H.WHILE),this.expect(H.LPAREN);let t=this.parseExpression();return this.expect(H.RPAREN),{type:`do_while`,body:e,condition:t}}parseFor(){if(this.expect(H.FOR),this.expect(H.LPAREN),this.check(H.IDENT)){let e=this.advance();if(this.check(H.IN)){this.advance();let t=this.expect(H.IDENT).value;this.expect(H.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:`for_in`,variable:e.value,array:t,body:n}}this.pos--}let e;this.check(H.SEMICOLON)||(e=this.parseExpression()),this.expect(H.SEMICOLON);let t;this.check(H.SEMICOLON)||(t=this.parseExpression()),this.expect(H.SEMICOLON);let n;this.check(H.RPAREN)||(n=this.parseExpression()),this.expect(H.RPAREN),this.skipNewlines();let r=this.parseStatement();return{type:`for`,init:e,condition:t,update:n,body:r}}parseExpression(){return this.parseAssignment()}parseAssignment(){let e=this.parseTernary();if(this.match(H.ASSIGN,H.PLUS_ASSIGN,H.MINUS_ASSIGN,H.STAR_ASSIGN,H.SLASH_ASSIGN,H.PERCENT_ASSIGN,H.CARET_ASSIGN)){let t=this.advance(),n=this.parseAssignment();if(e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid assignment target`);let r=new Set([`=`,`+=`,`-=`,`*=`,`/=`,`%=`,`^=`]),i=t.value;if(!r.has(i))throw Error(`Unknown assignment operator: ${i}`);return{type:`assignment`,operator:i,target:e,value:n}}return e}parseTernary(){let e=this.parsePipeGetline();if(this.check(H.QUESTION)){this.advance();let t=this.parseExpression();this.expect(H.COLON);let n=this.parseExpression();e={type:`ternary`,condition:e,consequent:t,alternate:n}}return e}parsePipeGetline(){let e=this.parseOr();if(this.check(H.PIPE)){if(this.advance(),!this.check(H.GETLINE))throw Error(`Expected 'getline' after '|' in expression context`);this.advance();let t;return this.check(H.IDENT)&&(t=this.advance().value),{type:`getline`,command:e,variable:t}}return e}parseOr(){let e=this.parseAnd();for(;this.check(H.OR);){this.advance();let t=this.parseAnd();e={type:`binary`,operator:`||`,left:e,right:t}}return e}parseLogicalOrRest(e){for(e=this.parseLogicalAndRest(e);this.check(H.OR);){this.advance();let t=this.parseAnd();e={type:`binary`,operator:`||`,left:e,right:t}}return e}parseLogicalAndRest(e){for(;this.check(H.AND);){this.advance();let t=this.parseIn();e={type:`binary`,operator:`&&`,left:e,right:t}}return e}parseAnd(){let e=this.parseIn();for(;this.check(H.AND);){this.advance();let t=this.parseIn();e={type:`binary`,operator:`&&`,left:e,right:t}}return e}parseIn(){let e=this.parseConcatenation();return this.check(H.IN)?(this.advance(),{type:`in`,key:e,array:this.expect(H.IDENT).value}):e}parseConcatenation(){let e=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let t=this.parseMatch();e={type:`binary`,operator:` `,left:e,right:t}}return e}parseMatch(){let e=this.parseComparison();for(;this.match(H.MATCH,H.NOT_MATCH);){let t=this.advance().type===H.MATCH?`~`:`!~`,n=this.parseComparison();e={type:`binary`,operator:t,left:e,right:n}}return e}parseComparison(){let e=this.parseAddSub();for(;this.match(H.LT,H.LE,H.GT,H.GE,H.EQ,H.NE);){let t=this.advance(),n=this.parseAddSub();e={type:`binary`,operator:new Map([[`<`,`<`],[`<=`,`<=`],[`>`,`>`],[`>=`,`>=`],[`==`,`==`],[`!=`,`!=`]]).get(t.value)??`==`,left:e,right:n}}return e}canStartExpression(){return this.match(H.NUMBER,H.STRING,H.IDENT,H.DOLLAR,H.LPAREN,H.NOT,H.MINUS,H.PLUS,H.INCREMENT,H.DECREMENT)}isConcatTerminator(){return this.match(H.AND,H.OR,H.QUESTION,H.ASSIGN,H.PLUS_ASSIGN,H.MINUS_ASSIGN,H.STAR_ASSIGN,H.SLASH_ASSIGN,H.PERCENT_ASSIGN,H.CARET_ASSIGN,H.COMMA,H.SEMICOLON,H.NEWLINE,H.RBRACE,H.RPAREN,H.RBRACKET,H.COLON,H.PIPE,H.APPEND,H.IN)}parseAddSub(){let e=this.parseMulDiv();for(;this.match(H.PLUS,H.MINUS);){let t=this.advance().value,n=this.parseMulDiv();e={type:`binary`,operator:t,left:e,right:n}}return e}parseMulDiv(){let e=this.parseUnary();for(;this.match(H.STAR,H.SLASH,H.PERCENT);){let t=this.advance(),n=this.parseUnary();e={type:`binary`,operator:new Map([[`*`,`*`],[`/`,`/`],[`%`,`%`]]).get(t.value)??`*`,left:e,right:n}}return e}parseUnary(){if(this.check(H.INCREMENT)){this.advance();let e=this.parseUnary();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`+`,operand:{type:`unary`,operator:`+`,operand:e}}:{type:`pre_increment`,operand:e}}if(this.check(H.DECREMENT)){this.advance();let e=this.parseUnary();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`-`,operand:{type:`unary`,operator:`-`,operand:e}}:{type:`pre_decrement`,operand:e}}return this.match(H.NOT,H.MINUS,H.PLUS)?{type:`unary`,operator:this.advance().value,operand:this.parseUnary()}:this.parsePower()}parsePower(){let e=this.parsePostfix();if(this.check(H.CARET)){this.advance();let t=this.parsePower();e={type:`binary`,operator:`^`,left:e,right:t}}return e}parsePostfix(){let e=this.parsePrimary();if(this.check(H.INCREMENT)){if(this.advance(),e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid increment operand`);return{type:`post_increment`,operand:e}}if(this.check(H.DECREMENT)){if(this.advance(),e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid decrement operand`);return{type:`post_decrement`,operand:e}}return e}parseFieldIndex(){if(this.check(H.INCREMENT)){this.advance();let e=this.parseFieldIndex();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`+`,operand:{type:`unary`,operator:`+`,operand:e}}:{type:`pre_increment`,operand:e}}if(this.check(H.DECREMENT)){this.advance();let e=this.parseFieldIndex();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`-`,operand:{type:`unary`,operator:`-`,operand:e}}:{type:`pre_decrement`,operand:e}}return this.match(H.NOT,H.MINUS,H.PLUS)?{type:`unary`,operator:this.advance().value,operand:this.parseFieldIndex()}:this.parseFieldIndexPower()}parseFieldIndexPower(){let e=this.parseFieldIndexPrimary();if(this.check(H.CARET)){this.advance();let t=this.parseFieldIndexPower();e={type:`binary`,operator:`^`,left:e,right:t}}return e}parseFieldIndexPrimary(){if(this.check(H.NUMBER))return{type:`number`,value:this.advance().value};if(this.check(H.STRING))return{type:`string`,value:this.advance().value};if(this.check(H.DOLLAR))return this.advance(),{type:`field`,index:this.parseFieldIndex()};if(this.check(H.LPAREN)){this.advance();let e=this.parseExpression();return this.expect(H.RPAREN),e}if(this.check(H.IDENT)){let e=this.advance().value;if(this.check(H.LPAREN)){this.advance();let t=[];if(!this.check(H.RPAREN))for(t.push(this.parseExpression());this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(H.RPAREN),{type:`call`,name:e,args:t}}if(this.check(H.LBRACKET)){this.advance();let t=this.parseExpression();if(this.check(H.COMMA)){let n=[t];for(;this.check(H.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(H.RBRACKET),{type:`array_access`,array:e,key:n.reduce((e,t)=>({type:`binary`,operator:` `,left:{type:`binary`,operator:` `,left:e,right:{type:`variable`,name:`SUBSEP`}},right:t}))}}return this.expect(H.RBRACKET),{type:`array_access`,array:e,key:t}}return{type:`variable`,name:e}}throw Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(H.NUMBER))return{type:`number`,value:this.advance().value};if(this.check(H.STRING))return{type:`string`,value:this.advance().value};if(this.check(H.REGEX))return{type:`regex`,pattern:this.advance().value};if(this.check(H.DOLLAR))return this.advance(),{type:`field`,index:this.parseFieldIndex()};if(this.check(H.LPAREN)){this.advance();let e=this.parseExpression();if(this.check(H.COMMA)){let t=[e];for(;this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(H.RPAREN),{type:`tuple`,elements:t}}return this.expect(H.RPAREN),e}if(this.check(H.GETLINE)){this.advance();let e,t;return this.check(H.IDENT)&&(e=this.advance().value),this.check(H.LT)&&(this.advance(),t=this.parsePrimary()),{type:`getline`,variable:e,file:t}}if(this.check(H.IDENT)){let e=this.advance().value;if(this.check(H.LPAREN)){this.advance();let t=[];if(this.skipNewlines(),!this.check(H.RPAREN))for(t.push(this.parseExpression());this.check(H.COMMA);)this.advance(),this.skipNewlines(),t.push(this.parseExpression());return this.skipNewlines(),this.expect(H.RPAREN),{type:`call`,name:e,args:t}}if(this.check(H.LBRACKET)){this.advance();let t=[this.parseExpression()];for(;this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());this.expect(H.RBRACKET);let n;if(t.length===1)n=t[0];else{n=t[0];for(let e=1;e<t.length;e++)n={type:`binary`,operator:` `,left:{type:`binary`,operator:` `,left:n,right:{type:`variable`,name:`SUBSEP`}},right:t[e]}}return{type:`array_access`,array:e,key:n}}return{type:`variable`,name:e}}throw Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}}),hf={};C(hf,{awkCommand2:()=>bf,flagsForFuzzing:()=>xf});function gf(e){return e.replace(/\\t/g,` `).replace(/\\n/g,`
414
+ `)break;n+=this.advance()}return this.peek()===`/`&&this.advance(),n=Jd(n),{type:H.REGEX,value:n,line:e,column:t}}readNumber(){let e=this.line,t=this.column,n=``;for(;this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`.`&&this.isDigit(this.peek(1)))for(n+=this.advance();this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`e`||this.peek()===`E`)for(n+=this.advance(),(this.peek()===`+`||this.peek()===`-`)&&(n+=this.advance());this.isDigit(this.peek());)n+=this.advance();return{type:H.NUMBER,value:parseFloat(n),line:e,column:t}}readIdentifier(){let e=this.line,t=this.column,n=``;for(;this.isAlphaNumeric(this.peek())||this.peek()===`_`;)n+=this.advance();let r=Yd.get(n);return r===void 0?{type:H.IDENT,value:n,line:e,column:t}:{type:r,value:n,line:e,column:t}}readOperator(){let e=this.line,t=this.column,n=this.advance(),r=this.peek();switch(n){case`+`:return r===`+`?(this.advance(),{type:H.INCREMENT,value:`++`,line:e,column:t}):r===`=`?(this.advance(),{type:H.PLUS_ASSIGN,value:`+=`,line:e,column:t}):{type:H.PLUS,value:`+`,line:e,column:t};case`-`:return r===`-`?(this.advance(),{type:H.DECREMENT,value:`--`,line:e,column:t}):r===`=`?(this.advance(),{type:H.MINUS_ASSIGN,value:`-=`,line:e,column:t}):{type:H.MINUS,value:`-`,line:e,column:t};case`*`:return r===`*`?(this.advance(),{type:H.CARET,value:`**`,line:e,column:t}):r===`=`?(this.advance(),{type:H.STAR_ASSIGN,value:`*=`,line:e,column:t}):{type:H.STAR,value:`*`,line:e,column:t};case`/`:return r===`=`?(this.advance(),{type:H.SLASH_ASSIGN,value:`/=`,line:e,column:t}):{type:H.SLASH,value:`/`,line:e,column:t};case`%`:return r===`=`?(this.advance(),{type:H.PERCENT_ASSIGN,value:`%=`,line:e,column:t}):{type:H.PERCENT,value:`%`,line:e,column:t};case`^`:return r===`=`?(this.advance(),{type:H.CARET_ASSIGN,value:`^=`,line:e,column:t}):{type:H.CARET,value:`^`,line:e,column:t};case`=`:return r===`=`?(this.advance(),{type:H.EQ,value:`==`,line:e,column:t}):{type:H.ASSIGN,value:`=`,line:e,column:t};case`!`:return r===`=`?(this.advance(),{type:H.NE,value:`!=`,line:e,column:t}):r===`~`?(this.advance(),{type:H.NOT_MATCH,value:`!~`,line:e,column:t}):{type:H.NOT,value:`!`,line:e,column:t};case`<`:return r===`=`?(this.advance(),{type:H.LE,value:`<=`,line:e,column:t}):{type:H.LT,value:`<`,line:e,column:t};case`>`:return r===`=`?(this.advance(),{type:H.GE,value:`>=`,line:e,column:t}):r===`>`?(this.advance(),{type:H.APPEND,value:`>>`,line:e,column:t}):{type:H.GT,value:`>`,line:e,column:t};case`&`:return r===`&`?(this.advance(),{type:H.AND,value:`&&`,line:e,column:t}):{type:H.IDENT,value:`&`,line:e,column:t};case`|`:return r===`|`?(this.advance(),{type:H.OR,value:`||`,line:e,column:t}):{type:H.PIPE,value:`|`,line:e,column:t};case`~`:return{type:H.MATCH,value:`~`,line:e,column:t};case`?`:return{type:H.QUESTION,value:`?`,line:e,column:t};case`:`:return{type:H.COLON,value:`:`,line:e,column:t};case`,`:return{type:H.COMMA,value:`,`,line:e,column:t};case`;`:return{type:H.SEMICOLON,value:`;`,line:e,column:t};case`(`:return{type:H.LPAREN,value:`(`,line:e,column:t};case`)`:return{type:H.RPAREN,value:`)`,line:e,column:t};case`{`:return{type:H.LBRACE,value:`{`,line:e,column:t};case`}`:return{type:H.RBRACE,value:`}`,line:e,column:t};case`[`:return{type:H.LBRACKET,value:`[`,line:e,column:t};case`]`:return{type:H.RBRACKET,value:`]`,line:e,column:t};case`$`:return{type:H.DOLLAR,value:`$`,line:e,column:t};default:return{type:H.IDENT,value:n,line:e,column:t}}}isDigit(e){return e>=`0`&&e<=`9`}isAlpha(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}isAlphaNumeric(e){return this.isDigit(e)||this.isAlpha(e)}}});function Qd(e){e.expect(U.PRINT);let t=[];if(e.check(U.NEWLINE)||e.check(U.SEMICOLON)||e.check(U.RBRACE)||e.check(U.PIPE)||e.check(U.GT)||e.check(U.APPEND))t.push({type:`field`,index:{type:`number`,value:0}});else for(t.push($d(e));e.check(U.COMMA);)e.advance(),t.push($d(e));let n;return e.check(U.GT)?(e.advance(),n={redirect:`>`,file:e.parsePrimary()}):e.check(U.APPEND)&&(e.advance(),n={redirect:`>>`,file:e.parsePrimary()}),{type:`print`,args:t,output:n}}function $d(e){return tf(e)?ef(e,!0):ef(e,!1)}function ef(e,t){let n=t?e.parseTernary():nf(e);if(e.match(U.ASSIGN,U.PLUS_ASSIGN,U.MINUS_ASSIGN,U.STAR_ASSIGN,U.SLASH_ASSIGN,U.PERCENT_ASSIGN,U.CARET_ASSIGN)){let r=e.advance(),i=ef(e,t);if(n.type!==`variable`&&n.type!==`field`&&n.type!==`array_access`)throw Error(`Invalid assignment target`);return{type:`assignment`,operator:new Map([[`=`,`=`],[`+=`,`+=`],[`-=`,`-=`],[`*=`,`*=`],[`/=`,`/=`],[`%=`,`%=`],[`^=`,`^=`]]).get(r.value)??`=`,target:n,value:i}}return n}function tf(e){let t=0,n=e.pos;for(;n<e.tokens.length;){let r=e.tokens[n];if(r.type===U.LPAREN&&t++,r.type===U.RPAREN&&t--,r.type===U.QUESTION&&t===0)return!0;if(r.type===U.NEWLINE||r.type===U.SEMICOLON||r.type===U.RBRACE||r.type===U.COMMA||r.type===U.PIPE)return!1;n++}return!1}function nf(e){let t=rf(e);for(;e.check(U.OR);){e.advance();let n=rf(e);t={type:`binary`,operator:`||`,left:t,right:n}}return t}function rf(e){let t=af(e);for(;e.check(U.AND);){e.advance();let n=af(e);t={type:`binary`,operator:`&&`,left:t,right:n}}return t}function af(e){let t=of(e);return e.check(U.IN)?(e.advance(),{type:`in`,key:t,array:String(e.expect(U.IDENT).value)}):t}function of(e){let t=sf(e);for(;lf(e)&&!uf(e);){let n=sf(e);t={type:`binary`,operator:` `,left:t,right:n}}return t}function sf(e){let t=cf(e);for(;e.match(U.MATCH,U.NOT_MATCH);){let n=e.advance().type===U.MATCH?`~`:`!~`,r=cf(e);t={type:`binary`,operator:n,left:t,right:r}}return t}function cf(e){let t=e.parseAddSub();for(;e.match(U.LT,U.LE,U.GE,U.EQ,U.NE);){let n=e.advance(),r=e.parseAddSub();t={type:`binary`,operator:new Map([[`<`,`<`],[`<=`,`<=`],[`>=`,`>=`],[`==`,`==`],[`!=`,`!=`]]).get(n.value)??`==`,left:t,right:r}}return t}function lf(e){return e.match(U.NUMBER,U.STRING,U.IDENT,U.DOLLAR,U.LPAREN,U.NOT,U.MINUS,U.PLUS,U.INCREMENT,U.DECREMENT)}function uf(e){return e.match(U.AND,U.OR,U.QUESTION,U.ASSIGN,U.PLUS_ASSIGN,U.MINUS_ASSIGN,U.STAR_ASSIGN,U.SLASH_ASSIGN,U.PERCENT_ASSIGN,U.CARET_ASSIGN,U.COMMA,U.SEMICOLON,U.NEWLINE,U.RBRACE,U.RPAREN,U.RBRACKET,U.COLON,U.PIPE,U.APPEND,U.GT,U.IN)}function df(e){e.expect(U.PRINTF);let t=e.check(U.LPAREN);t&&(e.advance(),e.skipNewlines());let n=t?e.parseExpression():$d(e),r=[];for(;e.check(U.COMMA);)e.advance(),t&&e.skipNewlines(),r.push(t?e.parseExpression():$d(e));t&&(e.skipNewlines(),e.expect(U.RPAREN));let i;return e.check(U.GT)?(e.advance(),i={redirect:`>`,file:e.parsePrimary()}):e.check(U.APPEND)&&(e.advance(),i={redirect:`>>`,file:e.parsePrimary()}),{type:`printf`,format:n,args:r,output:i}}var U,ff=S(()=>{U={LPAREN:`LPAREN`,RPAREN:`RPAREN`,QUESTION:`QUESTION`,NEWLINE:`NEWLINE`,SEMICOLON:`SEMICOLON`,RBRACE:`RBRACE`,COMMA:`COMMA`,PIPE:`PIPE`,GT:`GT`,APPEND:`APPEND`,AND:`AND`,OR:`OR`,ASSIGN:`ASSIGN`,PLUS_ASSIGN:`PLUS_ASSIGN`,MINUS_ASSIGN:`MINUS_ASSIGN`,STAR_ASSIGN:`STAR_ASSIGN`,SLASH_ASSIGN:`SLASH_ASSIGN`,PERCENT_ASSIGN:`PERCENT_ASSIGN`,CARET_ASSIGN:`CARET_ASSIGN`,RBRACKET:`RBRACKET`,COLON:`COLON`,IN:`IN`,PRINT:`PRINT`,PRINTF:`PRINTF`,IDENT:`IDENT`,LT:`LT`,LE:`LE`,GE:`GE`,EQ:`EQ`,NE:`NE`,MATCH:`MATCH`,NOT_MATCH:`NOT_MATCH`,NUMBER:`NUMBER`,STRING:`STRING`,DOLLAR:`DOLLAR`,NOT:`NOT`,MINUS:`MINUS`,PLUS:`PLUS`,INCREMENT:`INCREMENT`,DECREMENT:`DECREMENT`}}),pf,mf=S(()=>{Zd(),ff(),pf=class{tokens=[];pos=0;parse(e){let t=new Xd(e);return this.tokens=t.tokenize(),this.pos=0,this.parseProgram()}setPos(e){this.pos=e}current(){return this.tokens[this.pos]||{type:H.EOF,value:``,line:0,column:0}}advance(){let e=this.current();return this.pos<this.tokens.length&&this.pos++,e}match(...e){return e.includes(this.current().type)}check(e){return this.current().type===e}expect(e,t){if(!this.check(e)){let n=this.current();throw Error(t||`Expected ${e}, got ${n.type} at line ${n.line}:${n.column}`)}return this.advance()}skipNewlines(){for(;this.check(H.NEWLINE);)this.advance()}skipTerminators(){for(;this.check(H.NEWLINE)||this.check(H.SEMICOLON);)this.advance()}parseProgram(){let e=[],t=[];for(this.skipNewlines();!this.check(H.EOF)&&(this.skipNewlines(),!this.check(H.EOF));)this.check(H.FUNCTION)?e.push(this.parseFunction()):t.push(this.parseRule()),this.skipTerminators();return{functions:e,rules:t}}parseFunction(){this.expect(H.FUNCTION);let e=this.expect(H.IDENT).value;this.expect(H.LPAREN);let t=[];if(!this.check(H.RPAREN))for(t.push(this.expect(H.IDENT).value);this.check(H.COMMA);)this.advance(),t.push(this.expect(H.IDENT).value);return this.expect(H.RPAREN),this.skipNewlines(),{name:e,params:t,body:this.parseBlock()}}parseRule(){let e;if(this.check(H.BEGIN))this.advance(),e={type:`begin`};else if(this.check(H.END))this.advance(),e={type:`end`};else if(this.check(H.LBRACE))e=void 0;else if(this.check(H.REGEX)){let t=this.advance();if(this.check(H.AND)||this.check(H.OR)){let n={type:`binary`,operator:`~`,left:{type:`field`,index:{type:`number`,value:0}},right:{type:`regex`,pattern:t.value}};e={type:`expr_pattern`,expression:this.parseLogicalOrRest(n)}}else{let n={type:`regex_pattern`,pattern:t.value};if(this.check(H.COMMA)){this.advance();let t;t=this.check(H.REGEX)?{type:`regex_pattern`,pattern:this.advance().value}:{type:`expr_pattern`,expression:this.parseExpression()},e={type:`range`,start:n,end:t}}else e=n}}else{let t={type:`expr_pattern`,expression:this.parseExpression()};if(this.check(H.COMMA)){this.advance();let n;n=this.check(H.REGEX)?{type:`regex_pattern`,pattern:this.advance().value}:{type:`expr_pattern`,expression:this.parseExpression()},e={type:`range`,start:t,end:n}}else e=t}this.skipNewlines();let t;return t=this.check(H.LBRACE)?this.parseBlock():{type:`block`,statements:[{type:`print`,args:[{type:`field`,index:{type:`number`,value:0}}]}]},{pattern:e,action:t}}parseBlock(){this.expect(H.LBRACE),this.skipNewlines();let e=[];for(;!this.check(H.RBRACE)&&!this.check(H.EOF);)e.push(this.parseStatement()),this.skipTerminators();return this.expect(H.RBRACE),{type:`block`,statements:e}}parseStatement(){if(this.check(H.SEMICOLON)||this.check(H.NEWLINE))return this.advance(),{type:`block`,statements:[]};if(this.check(H.LBRACE))return this.parseBlock();if(this.check(H.IF))return this.parseIf();if(this.check(H.WHILE))return this.parseWhile();if(this.check(H.DO))return this.parseDoWhile();if(this.check(H.FOR))return this.parseFor();if(this.check(H.BREAK))return this.advance(),{type:`break`};if(this.check(H.CONTINUE))return this.advance(),{type:`continue`};if(this.check(H.NEXT))return this.advance(),{type:`next`};if(this.check(H.NEXTFILE))return this.advance(),{type:`nextfile`};if(this.check(H.EXIT)){this.advance();let e;return!this.check(H.NEWLINE)&&!this.check(H.SEMICOLON)&&!this.check(H.RBRACE)&&!this.check(H.EOF)&&(e=this.parseExpression()),{type:`exit`,code:e}}if(this.check(H.RETURN)){this.advance();let e;return!this.check(H.NEWLINE)&&!this.check(H.SEMICOLON)&&!this.check(H.RBRACE)&&!this.check(H.EOF)&&(e=this.parseExpression()),{type:`return`,value:e}}if(this.check(H.DELETE)){this.advance();let e=this.parsePrimary();if(e.type!==`array_access`&&e.type!==`variable`)throw Error(`delete requires array element or array`);return{type:`delete`,target:e}}return this.check(H.PRINT)?Qd(this):this.check(H.PRINTF)?df(this):{type:`expr_stmt`,expression:this.parseExpression()}}parseIf(){this.expect(H.IF),this.expect(H.LPAREN);let e=this.parseExpression();this.expect(H.RPAREN),this.skipNewlines();let t=this.parseStatement();this.skipTerminators();let n;return this.check(H.ELSE)&&(this.advance(),this.skipNewlines(),n=this.parseStatement()),{type:`if`,condition:e,consequent:t,alternate:n}}parseWhile(){this.expect(H.WHILE),this.expect(H.LPAREN);let e=this.parseExpression();return this.expect(H.RPAREN),this.skipNewlines(),{type:`while`,condition:e,body:this.parseStatement()}}parseDoWhile(){this.expect(H.DO),this.skipNewlines();let e=this.parseStatement();this.skipNewlines(),this.expect(H.WHILE),this.expect(H.LPAREN);let t=this.parseExpression();return this.expect(H.RPAREN),{type:`do_while`,body:e,condition:t}}parseFor(){if(this.expect(H.FOR),this.expect(H.LPAREN),this.check(H.IDENT)){let e=this.advance();if(this.check(H.IN)){this.advance();let t=this.expect(H.IDENT).value;this.expect(H.RPAREN),this.skipNewlines();let n=this.parseStatement();return{type:`for_in`,variable:e.value,array:t,body:n}}this.pos--}let e;this.check(H.SEMICOLON)||(e=this.parseExpression()),this.expect(H.SEMICOLON);let t;this.check(H.SEMICOLON)||(t=this.parseExpression()),this.expect(H.SEMICOLON);let n;this.check(H.RPAREN)||(n=this.parseExpression()),this.expect(H.RPAREN),this.skipNewlines();let r=this.parseStatement();return{type:`for`,init:e,condition:t,update:n,body:r}}parseExpression(){return this.parseAssignment()}parseAssignment(){let e=this.parseTernary();if(this.match(H.ASSIGN,H.PLUS_ASSIGN,H.MINUS_ASSIGN,H.STAR_ASSIGN,H.SLASH_ASSIGN,H.PERCENT_ASSIGN,H.CARET_ASSIGN)){let t=this.advance(),n=this.parseAssignment();if(e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid assignment target`);let r=new Set([`=`,`+=`,`-=`,`*=`,`/=`,`%=`,`^=`]),i=t.value;if(!r.has(i))throw Error(`Unknown assignment operator: ${i}`);return{type:`assignment`,operator:i,target:e,value:n}}return e}parseTernary(){let e=this.parsePipeGetline();if(this.check(H.QUESTION)){this.advance();let t=this.parseExpression();this.expect(H.COLON);let n=this.parseExpression();e={type:`ternary`,condition:e,consequent:t,alternate:n}}return e}parsePipeGetline(){let e=this.parseOr();if(this.check(H.PIPE)){if(this.advance(),!this.check(H.GETLINE))throw Error(`Expected 'getline' after '|' in expression context`);this.advance();let t;return this.check(H.IDENT)&&(t=this.advance().value),{type:`getline`,command:e,variable:t}}return e}parseOr(){let e=this.parseAnd();for(;this.check(H.OR);){this.advance();let t=this.parseAnd();e={type:`binary`,operator:`||`,left:e,right:t}}return e}parseLogicalOrRest(e){for(e=this.parseLogicalAndRest(e);this.check(H.OR);){this.advance();let t=this.parseAnd();e={type:`binary`,operator:`||`,left:e,right:t}}return e}parseLogicalAndRest(e){for(;this.check(H.AND);){this.advance();let t=this.parseIn();e={type:`binary`,operator:`&&`,left:e,right:t}}return e}parseAnd(){let e=this.parseIn();for(;this.check(H.AND);){this.advance();let t=this.parseIn();e={type:`binary`,operator:`&&`,left:e,right:t}}return e}parseIn(){let e=this.parseConcatenation();return this.check(H.IN)?(this.advance(),{type:`in`,key:e,array:this.expect(H.IDENT).value}):e}parseConcatenation(){let e=this.parseMatch();for(;this.canStartExpression()&&!this.isConcatTerminator();){let t=this.parseMatch();e={type:`binary`,operator:` `,left:e,right:t}}return e}parseMatch(){let e=this.parseComparison();for(;this.match(H.MATCH,H.NOT_MATCH);){let t=this.advance().type===H.MATCH?`~`:`!~`,n=this.parseComparison();e={type:`binary`,operator:t,left:e,right:n}}return e}parseComparison(){let e=this.parseAddSub();for(;this.match(H.LT,H.LE,H.GT,H.GE,H.EQ,H.NE);){let t=this.advance(),n=this.parseAddSub();e={type:`binary`,operator:new Map([[`<`,`<`],[`<=`,`<=`],[`>`,`>`],[`>=`,`>=`],[`==`,`==`],[`!=`,`!=`]]).get(t.value)??`==`,left:e,right:n}}return e}canStartExpression(){return this.match(H.NUMBER,H.STRING,H.IDENT,H.DOLLAR,H.LPAREN,H.NOT,H.MINUS,H.PLUS,H.INCREMENT,H.DECREMENT)}isConcatTerminator(){return this.match(H.AND,H.OR,H.QUESTION,H.ASSIGN,H.PLUS_ASSIGN,H.MINUS_ASSIGN,H.STAR_ASSIGN,H.SLASH_ASSIGN,H.PERCENT_ASSIGN,H.CARET_ASSIGN,H.COMMA,H.SEMICOLON,H.NEWLINE,H.RBRACE,H.RPAREN,H.RBRACKET,H.COLON,H.PIPE,H.APPEND,H.IN)}parseAddSub(){let e=this.parseMulDiv();for(;this.match(H.PLUS,H.MINUS);){let t=this.advance().value,n=this.parseMulDiv();e={type:`binary`,operator:t,left:e,right:n}}return e}parseMulDiv(){let e=this.parseUnary();for(;this.match(H.STAR,H.SLASH,H.PERCENT);){let t=this.advance(),n=this.parseUnary();e={type:`binary`,operator:new Map([[`*`,`*`],[`/`,`/`],[`%`,`%`]]).get(t.value)??`*`,left:e,right:n}}return e}parseUnary(){if(this.check(H.INCREMENT)){this.advance();let e=this.parseUnary();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`+`,operand:{type:`unary`,operator:`+`,operand:e}}:{type:`pre_increment`,operand:e}}if(this.check(H.DECREMENT)){this.advance();let e=this.parseUnary();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`-`,operand:{type:`unary`,operator:`-`,operand:e}}:{type:`pre_decrement`,operand:e}}return this.match(H.NOT,H.MINUS,H.PLUS)?{type:`unary`,operator:this.advance().value,operand:this.parseUnary()}:this.parsePower()}parsePower(){let e=this.parsePostfix();if(this.check(H.CARET)){this.advance();let t=this.parsePower();e={type:`binary`,operator:`^`,left:e,right:t}}return e}parsePostfix(){let e=this.parsePrimary();if(this.check(H.INCREMENT)){if(this.advance(),e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid increment operand`);return{type:`post_increment`,operand:e}}if(this.check(H.DECREMENT)){if(this.advance(),e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`)throw Error(`Invalid decrement operand`);return{type:`post_decrement`,operand:e}}return e}parseFieldIndex(){if(this.check(H.INCREMENT)){this.advance();let e=this.parseFieldIndex();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`+`,operand:{type:`unary`,operator:`+`,operand:e}}:{type:`pre_increment`,operand:e}}if(this.check(H.DECREMENT)){this.advance();let e=this.parseFieldIndex();return e.type!==`variable`&&e.type!==`field`&&e.type!==`array_access`?{type:`unary`,operator:`-`,operand:{type:`unary`,operator:`-`,operand:e}}:{type:`pre_decrement`,operand:e}}return this.match(H.NOT,H.MINUS,H.PLUS)?{type:`unary`,operator:this.advance().value,operand:this.parseFieldIndex()}:this.parseFieldIndexPower()}parseFieldIndexPower(){let e=this.parseFieldIndexPrimary();if(this.check(H.CARET)){this.advance();let t=this.parseFieldIndexPower();e={type:`binary`,operator:`^`,left:e,right:t}}return e}parseFieldIndexPrimary(){if(this.check(H.NUMBER))return{type:`number`,value:this.advance().value};if(this.check(H.STRING))return{type:`string`,value:this.advance().value};if(this.check(H.DOLLAR))return this.advance(),{type:`field`,index:this.parseFieldIndex()};if(this.check(H.LPAREN)){this.advance();let e=this.parseExpression();return this.expect(H.RPAREN),e}if(this.check(H.IDENT)){let e=this.advance().value;if(this.check(H.LPAREN)){this.advance();let t=[];if(!this.check(H.RPAREN))for(t.push(this.parseExpression());this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(H.RPAREN),{type:`call`,name:e,args:t}}if(this.check(H.LBRACKET)){this.advance();let t=this.parseExpression();if(this.check(H.COMMA)){let n=[t];for(;this.check(H.COMMA);)this.advance(),n.push(this.parseExpression());return this.expect(H.RBRACKET),{type:`array_access`,array:e,key:n.reduce((e,t)=>({type:`binary`,operator:` `,left:{type:`binary`,operator:` `,left:e,right:{type:`variable`,name:`SUBSEP`}},right:t}))}}return this.expect(H.RBRACKET),{type:`array_access`,array:e,key:t}}return{type:`variable`,name:e}}throw Error(`Unexpected token in field index: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}parsePrimary(){if(this.check(H.NUMBER))return{type:`number`,value:this.advance().value};if(this.check(H.STRING))return{type:`string`,value:this.advance().value};if(this.check(H.REGEX))return{type:`regex`,pattern:this.advance().value};if(this.check(H.DOLLAR))return this.advance(),{type:`field`,index:this.parseFieldIndex()};if(this.check(H.LPAREN)){this.advance();let e=this.parseExpression();if(this.check(H.COMMA)){let t=[e];for(;this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());return this.expect(H.RPAREN),{type:`tuple`,elements:t}}return this.expect(H.RPAREN),e}if(this.check(H.GETLINE)){this.advance();let e,t;return this.check(H.IDENT)&&(e=this.advance().value),this.check(H.LT)&&(this.advance(),t=this.parsePrimary()),{type:`getline`,variable:e,file:t}}if(this.check(H.IDENT)){let e=this.advance().value;if(this.check(H.LPAREN)){this.advance();let t=[];if(this.skipNewlines(),!this.check(H.RPAREN))for(t.push(this.parseExpression());this.check(H.COMMA);)this.advance(),this.skipNewlines(),t.push(this.parseExpression());return this.skipNewlines(),this.expect(H.RPAREN),{type:`call`,name:e,args:t}}if(this.check(H.LBRACKET)){this.advance();let t=[this.parseExpression()];for(;this.check(H.COMMA);)this.advance(),t.push(this.parseExpression());this.expect(H.RBRACKET);let n;if(t.length===1)n=t[0];else{n=t[0];for(let e=1;e<t.length;e++)n={type:`binary`,operator:` `,left:{type:`binary`,operator:` `,left:n,right:{type:`variable`,name:`SUBSEP`}},right:t[e]}}return{type:`array_access`,array:e,key:n}}return{type:`variable`,name:e}}throw Error(`Unexpected token: ${this.current().type} at line ${this.current().line}:${this.current().column}`)}}}),hf={};C(hf,{awkCommand2:()=>bf,flagsForFuzzing:()=>xf});function gf(e){return e.replace(/\\t/g,` `).replace(/\\n/g,`
415
415
  `).replace(/\\r/g,`\r`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\a/g,`\x07`).replace(/\\v/g,`\v`).replace(/\\\\/g,`\\`)}function _f(e){if(e===` `)return z(`\\s+`);if(/[[\](){}.*+?^$|\\]/.test(e))try{return z(e)}catch{return z(vf(e))}return z(vf(e))}function vf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var yf,bf,xf,Sf=S(()=>{Xl(),A(),xs(),fl(),ir(),O(),qd(),mf(),yf={name:`awk`,summary:`pattern scanning and text processing language`,usage:`awk [OPTIONS] 'PROGRAM' [FILE...]`,options:[`-F FS use FS as field separator`,`-v VAR=VAL assign VAL to variable VAR`,` --help display this help and exit`]},bf={name:`awk`,async execute(e,t){ul(t.requireDefenseContext,`awk`,`execution entry`);let n=(e,n)=>dl(t.requireDefenseContext,`awk`,e,n);if(E(e))return T(yf);let r=new ys(/\s+/),i=` `,a=Object.create(null),o=0;for(let t=0;t<e.length;t++){let n=e[t];if(n===`-F`&&t+1<e.length)i=gf(e[++t]),r=_f(i),o=t+1;else if(n.startsWith(`-F`))i=gf(n.slice(2)),r=_f(i),o=t+1;else if(n===`-v`&&t+1<e.length){let n=e[++t],r=n.indexOf(`=`);if(r>0){let e=n.slice(0,r);a[e]=gf(n.slice(r+1))}o=t+1}else{if(n.startsWith(`--`))return D(`awk`,n);if(n.startsWith(`-`)&&n.length>1){let e=n[1];if(e!==`F`&&e!==`v`)return D(`awk`,`-${e}`);o=t+1}else if(!n.startsWith(`-`)){o=t;break}}}if(o>=e.length)return{stdout:``,stderr:`awk: missing program
416
416
  `,exitCode:1};let s=e[o],c=e.slice(o+1),l=new pf,u;try{u=l.parse(s)}catch(e){return{stdout:``,stderr:`awk: ${e instanceof Error?e.message:String(e)}
417
417
  `,exitCode:1}}let d={readFile:t.fs.readFile.bind(t.fs),writeFile:t.fs.writeFile.bind(t.fs),appendFile:async(e,r)=>{try{let i=await n(`appendFile read`,()=>t.fs.readFile(e));await n(`appendFile write`,()=>t.fs.writeFile(e,i+r))}catch(i){if(i instanceof w)throw i;await n(`appendFile create`,()=>t.fs.writeFile(e,r))}},resolvePath:t.fs.resolvePath.bind(t.fs)},f=t.exec,p=Zl({fieldSep:r,maxIterations:t.limits?.maxAwkIterations,maxOutputSize:t.limits?.maxStringLength,fs:d,cwd:t.cwd,exec:f?e=>n(`command pipe exec`,()=>f(e,{cwd:t.cwd,signal:t.signal})):void 0,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext});p.FS=i,p.vars=Object.assign(Object.create(null),a),p.ARGC=c.length+1,p.ARGV=Object.create(null),p.ARGV[0]=`awk`;for(let e=0;e<c.length;e++)p.ARGV[String(e+1)]=c[e];p.ENVIRON=ql(t.env);let m=new Gd(p);m.execute(u);let h=u.rules.some(e=>e.pattern?.type!==`begin`&&e.pattern?.type!==`end`),g=u.rules.some(e=>e.pattern?.type===`end`);try{if(await n(`BEGIN execution`,()=>m.executeBegin()),p.shouldExit)return await n(`END execution after BEGIN exit`,()=>m.executeEnd()),{stdout:m.getOutput(),stderr:``,exitCode:m.getExitCode()};if(!h&&!g)return{stdout:m.getOutput(),stderr:``,exitCode:m.getExitCode()};let e=[];if(c.length>0)for(let r of c)try{let i=t.fs.resolvePath(t.cwd,r),a=(await n(`input file read`,()=>t.fs.readFile(i))).split(`
@@ -842,7 +842,7 @@ Gid: ${i} ${i} ${i} ${i}
842
842
  `:e===`$`||e==="`"||e===`"`||e===`'`||e===`
843
843
  `||l&&e===`}`,r=o?`*?[]\\`.includes(e):`*?[]\\(){}.^+`.includes(e);n?f+=e:r?(p(),u.push(K.escaped(e))):f+=`\\${e}`,d+=2;continue}if(n===`'`&&!o&&!a){p();let e=t.indexOf(`'`,d+1);if(e===-1){f+=t.slice(d);break}u.push(K.singleQuoted(t.slice(d+1,e))),d=e+1;continue}if(n===`"`&&!a){p();let{part:n,endIndex:r}=Uw(e,t,d+1);u.push(n),d=r+1;continue}if(n===`$`&&t[d+1]===`'`){p();let{part:n,endIndex:r}=ew(e,t,d+2);u.push(n),d=r;continue}if(n===`$`){p();let{part:n,endIndex:r}=Vw(e,t,d);n&&u.push(n),d=r;continue}if(n==="`"){p();let{part:n,endIndex:r}=e.parseBacktickSubstitution(t,d);u.push(n),d=r;continue}if(n===`~`){let n=d>0?t[d-1]:``;if(d===0||n===`=`||i&&n===`:`){let n=JC(e,t,d),r=t[n];if(r===void 0||r===`/`||r===`:`){p();let e=t.slice(d+1,n)||null;u.push({type:`TildeExpansion`,user:e}),d=n;continue}}}if(`@*+?!`.includes(n)&&d+1<t.length&&t[d+1]===`(`){let e=Lw(t,d+1);if(e!==-1){p();let n=t.slice(d,e+1);u.push({type:`Glob`,pattern:n}),d=e+1;continue}}if(n===`*`||n===`?`||n===`[`){p();let{pattern:n,endIndex:r}=QC(e,t,d);u.push({type:`Glob`,pattern:n}),d=r;continue}if(n===`{`&&!i&&!s&&!a){let n=rw(e,t,d,Ww);if(n){p(),u.push(n.part),d=n.endIndex;continue}}f+=n,d++}return p(),u}var Gw=S(()=>{gC(),KC(),hC(),ow()});function Kw(e,t){let n=e.length,r=t+3,i=2,a=!1,o=!1;for(;r<n&&i>0;){let t=e[r];if(a){t===`'`&&(a=!1),r++;continue}if(o){if(t===`\\`){r+=2;continue}t===`"`&&(o=!1),r++;continue}if(t===`'`){a=!0,r++;continue}if(t===`"`){o=!0,r++;continue}if(t===`\\`){r+=2;continue}if(t===`(`){i++,r++;continue}if(t===`)`){if(i--,i===1){let t=r+1;return!(t<n&&e[t]===`)`)}if(i===0)return!1;r++;continue}if(i===1&&(t===`|`&&r+1<n&&e[r+1]===`|`||t===`&`&&r+1<n&&e[r+1]===`&`||t===`|`&&r+1<n&&e[r+1]!==`|`))return!0;r++}return!1}function qw(e,t,n,r){let i=t+2,a=1,o=i,s=!1,c=!1,l=0,u=!1,d=``;for(;o<e.length&&a>0;){let t=e[o];s?t===`'`&&(s=!1):c?t===`\\`&&o+1<e.length?o++:t===`"`&&(c=!1):t===`'`?(s=!0,d=``):t===`"`?(c=!0,d=``):t===`\\`&&o+1<e.length?(o++,d=``):/[a-zA-Z_]/.test(t)?d+=t:(d===`case`?(l++,u=!1):d===`in`&&l>0?u=!0:d===`esac`&&l>0&&(l--,u=!1),d=``,t===`(`?o>0&&e[o-1]===`$`?a++:u||a++:t===`)`?u?u=!1:a--:t===`;`&&l>0&&o+1<e.length&&e[o+1]===`;`&&(u=!0)),a>0&&o++}a>0&&r("unexpected EOF while looking for matching `)'");let f=e.slice(i,o),p=n().parse(f);return{part:K.commandSubstitution(p,!1),endIndex:o+1}}function Jw(e,t,n,r,i){let a=t+1,o=``;for(;a<e.length&&e[a]!=="`";)if(e[a]===`\\`){let t=e[a+1];t===`$`||t==="`"||t===`\\`||t===`
844
844
  `||n&&t===`"`?(t!==`
845
- `&&(o+=t),a+=2):(o+=e[a],a++)}else o+=e[a],a++;a>=e.length&&i("unexpected EOF while looking for matching ``'");let s=r().parse(o);return{part:K.commandSubstitution(s,!0),endIndex:a+1}}var Yw=S(()=>{gC()});function Xw(e,t){return new Zw().parse(e,t)}var Zw,Qw=S(()=>{gC(),KC(),mw(),ww(),Fw(),Gw(),oC(),Yw(),hC(),hC(),Zw=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input=``;getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>lC)throw new mC(`Maximum parse iterations exceeded (possible infinite loop)`,this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>uC)throw new mC(`Maximum parser nesting depth exceeded (${uC})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(e,t){if(e.length>sC)throw new mC(`Input too large: ${e.length} bytes exceeds limit of ${sC}`,1,1);if(this._input=e,this.tokens=new aC(e,t).tokenize(),this.tokens.length>cC)throw new mC(`Too many tokens: ${this.tokens.length} exceeds limit of ${cC}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(e){return this.tokens=e,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){let e=this.current();return this.pos<this.tokens.length-1&&this.pos++,e}getPos(){return this.pos}check(e,t,n,r,...i){let a=this.tokens[this.pos]?.type;return a===e||t!==void 0&&a===t||n!==void 0&&a===n||r!==void 0&&a===r?!0:i.length>0?i.includes(a):!1}expect(e,t){if(this.check(e))return this.advance();let n=this.current();throw new mC(t||`Expected ${e}, got ${n.type}`,n.line,n.column,n)}error(e){let t=this.current();throw new mC(e,t.line,t.column,t)}skipNewlines(){for(;this.check(G.NEWLINE,G.COMMENT);)this.check(G.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(e=!0){for(;;){if(this.check(G.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(G.SEMICOLON,G.COMMENT)){this.advance();continue}if(e&&this.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(e,t,n,r){this.pendingHeredocs.push({redirect:e,delimiter:t,stripTabs:n,quoted:r})}processHeredocs(){for(let e of this.pendingHeredocs)if(this.check(G.HEREDOC_CONTENT)){let t=this.advance(),n;n=e.quoted?K.word([K.literal(t.value)]):this.parseWordFromString(t.value,!1,!1,!1,!0),e.redirect.target=K.hereDoc(e.delimiter,n,e.stripTabs,e.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(G.EOF,G.NEWLINE,G.SEMICOLON,G.AMP,G.AND_AND,G.OR_OR,G.RPAREN,G.RBRACE,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)}isCommandStart(){let e=this.current().type;return e===G.WORD||e===G.NAME||e===G.NUMBER||e===G.ASSIGNMENT_WORD||e===G.IF||e===G.FOR||e===G.WHILE||e===G.UNTIL||e===G.CASE||e===G.LPAREN||e===G.LBRACE||e===G.DPAREN_START||e===G.DBRACK_START||e===G.FUNCTION||e===G.BANG||e===G.TIME||e===G.IN||e===G.LESS||e===G.GREAT||e===G.DLESS||e===G.DGREAT||e===G.LESSAND||e===G.GREATAND||e===G.LESSGREAT||e===G.DLESSDASH||e===G.CLOBBER||e===G.TLESS||e===G.AND_GREAT||e===G.AND_DGREAT}parseScript(){let e=[],t=0;for(this.skipNewlines();!this.check(G.EOF);){t++,t>1e4&&this.error(`Parser stuck: too many iterations (>10000)`);let n=this.checkUnexpectedToken();if(n){e.push(n),this.skipSeparators(!1);continue}let r=this.pos,i=this.parseStatement();i&&e.push(i),this.skipSeparators(!1),this.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===r&&!this.check(G.EOF)&&this.advance()}return K.script(e)}checkUnexpectedToken(){let e=this.current().type,t=this.current().value;if((e===G.DO||e===G.DONE||e===G.THEN||e===G.ELSE||e===G.ELIF||e===G.FI||e===G.ESAC)&&this.error(`syntax error near unexpected token \`${t}'`),e===G.RBRACE||e===G.RPAREN){let e=`syntax error near unexpected token \`${t}'`;return this.advance(),K.statement([K.pipeline([K.simpleCommand(null,[],[],[])])],[],!1,{message:e,token:t})}return(e===G.DSEMI||e===G.SEMI_AND||e===G.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${t}'`),e===G.SEMICOLON&&this.error(`syntax error near unexpected token \`${t}'`),(e===G.PIPE||e===G.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${t}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let e=this.current().start,t=[],n=[],r=!1,i=this.parsePipeline();for(t.push(i);this.check(G.AND_AND,G.OR_OR);){let e=this.advance();n.push(e.type===G.AND_AND?`&&`:`||`),this.skipNewlines();let r=this.parsePipeline();t.push(r)}this.check(G.AMP)&&(this.advance(),r=!0);let a=this.pos>0?this.tokens[this.pos-1].end:e,o=this._input.slice(e,a);return K.statement(t,n,r,void 0,o)}parsePipeline(){let e=!1,t=!1;this.check(G.TIME)&&(this.advance(),e=!0,this.check(G.WORD,G.NAME)&&this.current().value===`-p`&&(this.advance(),t=!0));let n=0;for(;this.check(G.BANG);)this.advance(),n++;let r=n%2==1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(G.PIPE,G.PIPE_AMP);){let e=this.advance();this.skipNewlines(),a.push(e.type===G.PIPE_AMP);let t=this.parseCommand();i.push(t)}return K.pipeline(i,r,e,t,a.length>0?a:void 0)}parseCommand(){return this.check(G.IF)?hw(this):this.check(G.FOR)?gw(this):this.check(G.WHILE)?vw(this):this.check(G.UNTIL)?yw(this):this.check(G.CASE)?bw(this):this.check(G.LPAREN)?Sw(this):this.check(G.LBRACE)?Cw(this):this.check(G.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(G.DBRACK_START)?this.parseConditionalCommand():this.check(G.FUNCTION)||this.check(G.NAME,G.WORD)&&this.peek(1).type===G.LPAREN&&this.peek(2).type===G.RPAREN?this.parseFunctionDef():uw(this)}dparenClosesWithSpacedParens(){let e=1,t=1;for(;t<this.tokens.length-this.pos;){let n=this.peek(t);if(n.type===G.EOF)return!1;if(n.type===G.DPAREN_START||n.type===G.LPAREN)e++;else if(n.type===G.DPAREN_END){if(e-=2,e<=0)return!1}else if(n.type===G.RPAREN&&(e--,e===0&&this.peek(t+1).type===G.RPAREN))return!0;t++}return!1}parseNestedSubshellsFromDparen(){this.advance();let e=this.parseCompoundList();this.expect(G.RPAREN),this.expect(G.RPAREN);let t=this.parseOptionalRedirections(),n=K.subshell(e,[]);return K.subshell([K.statement([K.pipeline([n],!1,!1,!1)])],t)}isWord(){let e=this.current().type;return e===G.WORD||e===G.NAME||e===G.NUMBER||e===G.IF||e===G.FOR||e===G.WHILE||e===G.UNTIL||e===G.CASE||e===G.FUNCTION||e===G.ELSE||e===G.ELIF||e===G.FI||e===G.THEN||e===G.DO||e===G.DONE||e===G.ESAC||e===G.IN||e===G.SELECT||e===G.TIME||e===G.COPROC||e===G.BANG}parseWord(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted)}parseWordNoBraceExpansion(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0)}parseWordForRegex(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0,!0)}parseWordFromString(e,t=!1,n=!1,r=!1,i=!1,a=!1,o=!1){let s=Ww(this,e,t,n,r,i,!1,a,o);return K.word(s)}parseCommandSubstitution(t,n){return qw(t,n,()=>new e,e=>this.error(e))}parseBacktickSubstitution(t,n,r=!1){return Jw(t,n,r,()=>new e,e=>this.error(e))}isDollarDparenSubshell(e,t){return Kw(e,t)}parseArithmeticExpansion(e,t){let n=t+3,r=1,i=0,a=n;for(;a<e.length-1&&r>0;)e[a]===`$`&&e[a+1]===`(`?e[a+2]===`(`?(r++,a+=3):(i++,a+=2):e[a]===`(`&&e[a+1]===`(`?(r++,a+=2):e[a]===`)`&&e[a+1]===`)`?i>0?(i--,a++):(r--,r>0&&(a+=2)):e[a]===`(`?(i++,a++):(e[a]===`)`&&i>0&&i--,a++);let o=e.slice(n,a),s=this.parseArithmeticExpression(o);return{part:K.arithmeticExpansion(s),endIndex:a+2}}parseArithmeticCommand(){let e=this.expect(G.DPAREN_START),t=``,n=1,r=0,i=!1,a=!1;for(;n>0&&!this.check(G.EOF);){if(i){if(i=!1,r>0){r--,t+=`)`;continue}if(this.check(G.RPAREN)){n--,a=!0,this.advance();continue}if(this.check(G.DPAREN_END)){n--,a=!0;continue}t+=`)`;continue}if(this.check(G.DPAREN_START))n++,t+=`((`,this.advance();else if(this.check(G.DPAREN_END))r>=2?(r-=2,t+=`))`,this.advance()):r===1?(r--,t+=`)`,i=!0,this.advance()):(n--,a=!0,n>0&&(t+=`))`),this.advance());else if(this.check(G.LPAREN))r++,t+=`(`,this.advance();else if(this.check(G.RPAREN))r>0&&r--,t+=`)`,this.advance();else{let e=this.current().value,n=t.length>0?t[t.length-1]:``;t.length>0&&!t.endsWith(` `)&&!(e===`=`&&/[|&^+\-*/%<>]$/.test(t))&&!(e===`<`&&n===`<`)&&!(e===`>`&&n===`>`)&&(t+=` `),t+=e,this.advance()}}a||this.expect(G.DPAREN_END);let o=this.parseArithmeticExpression(t.trim()),s=this.parseOptionalRedirections();return K.arithmeticCommand(o,s,e.line)}parseConditionalCommand(){let e=this.expect(G.DBRACK_START),t=Dw(this);this.expect(G.DBRACK_END);let n=this.parseOptionalRedirections();return K.conditionalCommand(t,n,e.line)}parseFunctionDef(){let e;if(this.check(G.FUNCTION)){if(this.advance(),this.check(G.NAME)||this.check(G.WORD))e=this.advance().value;else{let e=this.current();throw new mC(`Expected function name`,e.line,e.column,e)}this.check(G.LPAREN)&&(this.advance(),this.expect(G.RPAREN))}else e=this.advance().value,e.includes(`$`)&&this.error(`\`${e}': not a valid identifier`),this.expect(G.LPAREN),this.expect(G.RPAREN);this.skipNewlines();let t=this.parseCompoundCommandBody({forFunctionBody:!0}),n=this.parseOptionalRedirections();return K.functionDef(e,t,n)}parseCompoundCommandBody(e){let t=e?.forFunctionBody;if(this.check(G.LBRACE))return Cw(this,{skipRedirections:t});if(this.check(G.LPAREN))return Sw(this,{skipRedirections:t});if(this.check(G.IF))return hw(this,{skipRedirections:t});if(this.check(G.FOR))return gw(this,{skipRedirections:t});if(this.check(G.WHILE))return vw(this,{skipRedirections:t});if(this.check(G.UNTIL))return yw(this,{skipRedirections:t});if(this.check(G.CASE))return bw(this,{skipRedirections:t});this.error(`Expected compound command for function body`)}parseCompoundList(){let e=this.enterDepth(),t=[];for(this.skipNewlines();!this.check(G.EOF,G.FI,G.ELSE,G.ELIF,G.THEN,G.DO,G.DONE,G.ESAC,G.RPAREN,G.RBRACE,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let e=this.pos,n=this.parseStatement();if(n&&t.push(n),this.skipSeparators(),this.pos===e&&!n)break}return e(),t}parseOptionalRedirections(){let e=[];for(;sw(this);){this.checkIterationLimit();let t=this.pos;if(e.push(cw(this)),this.pos===t)break}return e}parseArithmeticExpression(e){return TC(this,e)}}});function $w(e){return iT.get(e)??``}function eT(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`[`){for(n+=i,r++,r<e.length&&(e[r]===`!`||e[r]===`^`)&&(n+=e[r],r++),r<e.length&&e[r]===`]`&&(n+=e[r],r++);r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){n+=e.slice(r,t+2),r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]===`]`&&(n+=e[r],r++)}else i===`:`?(n!==``&&t.push(n),n=``,r++):i===`\\`&&r+1<e.length?(n+=i+e[r+1],r+=2):(n+=i,r++)}return n!==``&&t.push(n),t}function tT(e){let t=`^`;for(let n=0;n<e.length;n++){let r=e[n];if(r===`*`)t+=`[^/]*`;else if(r===`?`)t+=`[^/]`;else if(r===`[`){let r=n+1,i=`[`;r<e.length&&(e[r]===`^`||e[r]===`!`)&&(i+=`^`,r++),r<e.length&&e[r]===`]`&&(i+=`\\]`,r++);let a=r;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=r;for(;r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){let n=$w(e.slice(r+2,t));i+=n,r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){i+=`\\${e[r+1]}`,r+=2;continue}if(e[r]===`-`){let e=r===o,t=r+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[r];r++}i+=`]`,t+=i,n=r}else if(r===`\\`&&n+1<e.length){let r=e[n+1];/[.+^${}()|\\*?[\]]/.test(r)?t+=`\\${r}`:t+=r,n++}else /[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+=`$`,z(t)}function nT(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function rT(e){let t=[],n=``,r=0,i=!1,a=0;for(;a<e.length;){let o=e[a];if(o===`'`&&!i){i=!0,n+=`\0QUOTE_START\0`,a++;continue}if(o===`'`&&i){i=!1,n+=`\0QUOTE_END\0`,a++;continue}if(i){n+=o,a++;continue}if(o===`\\`){n+=o,a+1<e.length?(n+=e[a+1],a+=2):a++;continue}o===`(`?(r++,n+=o):o===`)`?(r--,n+=o):o===`|`&&r===0?(t.push(n),n=``):n+=o,a++}return t.push(n),t}var iT,aT=S(()=>{xs(),iT=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9a-fA-F`]])}),oT,sT,cT=S(()=>{A(),xs(),vr(),aT(),oT=5,sT=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(e,t,n,r){this.fs=e,this.cwd=t,typeof r==`boolean`?(this.globstar=r,this.maxOps=1e5):r?(this.globstar=r.globstar??!1,this.nullglob=r.nullglob??!1,this.failglob=r.failglob??!1,this.dotglob=r.dotglob??!1,this.extglob=r.extglob??!1,this.globskipdots=r.globskipdots??!0,this.maxOps=r.maxGlobOperations??1e5):this.maxOps=1e5;let i=n?.get(`GLOBIGNORE`);i!==void 0&&i!==``&&(this.hasGlobignore=!0,this.globignorePatterns=eT(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new k(`Glob operation limit exceeded (${this.maxOps})`,`glob_operations`)}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(e){return!this.hasGlobignore&&!this.globskipdots?e:e.filter(e=>{let t=e.split(`/`).pop()||e;if((this.hasGlobignore||this.globskipdots)&&(t===`.`||t===`..`))return!1;if(this.hasGlobignore){for(let t of this.globignorePatterns)if(this.matchGlobignorePattern(e,t))return!1}return!0})}matchGlobignorePattern(e,t){return tT(t).test(e)}isGlobPattern(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandArgs(e,t){let n=e.map((e,n)=>(t?.[n]??!1)||!this.isGlobPattern(e)?null:this.expand(e)),r=await Promise.all(n.map(e=>e||Promise.resolve(null))),i=[];for(let t=0;t<e.length;t++){let n=r[t];n===null?i.push(e[t]):n.length>0?i.push(...n):i.push(e[t])}return i}async expand(e){if(this.globstar){let t=e.split(`/`),n=0;for(let e of t)if(e===`**`&&(n++,n>oT))throw new k(`Glob pattern has too many ** segments (max ${oT})`,`glob_operations`)}let t;if(e.includes(`**`)&&this.globstar&&this.isGlobstarValid(e))t=await this.expandRecursive(e);else{let n=e.replace(/\*\*+/g,`*`);t=await this.expandSimple(n)}return this.filterGlobignore(t)}isGlobstarValid(e){let t=e.split(`/`);for(let e of t)if(e.includes(`**`)&&e!==`**`)return!1;return!0}hasGlobChars(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandSimple(e){let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e!==``),r=-1;for(let e=0;e<n.length;e++)if(this.hasGlobChars(n[e])){r=e;break}if(r===-1)return[e];let i,a;if(r===0)t?(i=`/`,a=`/`):(i=this.cwd,a=``);else{let e=n.slice(0,r);t?(i=`/${e.join(`/`)}`,a=`/${e.join(`/`)}`):(i=this.fs.resolvePath(this.cwd,e.join(`/`)),a=e.join(`/`))}let o=n.slice(r);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(e,t,n){if(this.checkOpsLimit(),n.length===0)return[t];let[r,...i]=n,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let n=await this.fs.readdirWithFileTypes(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;if(r.startsWith(`.`)||this.dotglob){let e=n.some(e=>e.name===`.`),t=n.some(e=>e.name===`..`);e||s.push({name:`.`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}),t||s.push({name:`..`,isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let n of s)if(!(n.name.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n.name,r)){let r=e===`/`?`/${n.name}`:`${e}/${n.name}`,a;a=t===``?n.name:t===`/`?`/${n.name}`:`${t}/${n.name}`,i.length===0?o.push(Promise.resolve([a])):n.isDirectory&&o.push(this.expandSegments(r,a,i))}let l=await Promise.all(o);for(let e of l)a.push(...e)}else{this.checkOpsLimit();let n=await this.fs.readdir(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;(r.startsWith(`.`)||this.dotglob)&&(n.includes(`.`)||s.push(`.`),n.includes(`..`)||s.push(`..`));for(let n of s)if(!(n.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n,r)){let r=e===`/`?`/${n}`:`${e}/${n}`,a;a=t===``?n:t===`/`?`/${n}`:`${t}/${n}`,i.length===0?o.push(Promise.resolve([a])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory)return this.expandSegments(r,a,i)}catch(e){if(e instanceof k)throw e}return[]})())}let l=await Promise.all(o);for(let e of l)a.push(...e)}}catch(e){if(e instanceof k)throw e}return a}async expandRecursive(e){let t=[],n=e.indexOf(`**`),r=e.slice(0,n).replace(/\/$/,``)||`.`,i=e.slice(n+2).replace(/^\//,``);return i.includes(`**`)&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(r,i,t),[...new Set(t)].sort()):(await this.walkDirectory(r,i,t),t.sort())}async walkDirectoryMultiGlobstar(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(r):null;if(i){let r=[];for(let t of i){let n=e===`.`?t.name:`${e}/${t.name}`;t.isDirectory&&r.push(n)}let a=e===`.`?t:`${e}/${t}`,o=await this.expandRecursive(a);n.push(...o);for(let e=0;e<r.length;e+=100){let i=r.slice(e,e+100);await Promise.all(i.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t of i){let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory&&a.push(n)}catch(e){if(e instanceof k)throw e}}let o=e===`.`?t:`${e}/${t}`,s=await this.expandRecursive(o);n.push(...s);for(let e=0;e<a.length;e+=100){let r=a.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}}catch(e){if(e instanceof k)throw e}}async walkDirectory(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(r),a=[],o=[];for(let n of i){let r=e===`.`?n.name:`${e}/${n.name}`;n.isDirectory?o.push(r):t&&this.matchPattern(n.name,t)&&a.push(r)}n.push(...a);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t=0;t<i.length;t+=100){let n=i.slice(t,t+100),r=await Promise.all(n.map(async t=>{let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{return this.checkOpsLimit(),{name:t,path:n,isDirectory:(await this.fs.stat(r)).isDirectory}}catch(e){if(e instanceof k)throw e;return null}}));a.push(...r.filter(e=>e!==null))}for(let e of a)!e.isDirectory&&t&&this.matchPattern(e.name,t)&&n.push(e.path);let o=a.filter(e=>e.isDirectory);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e.path,t,n)))}}}catch(e){if(e instanceof k)throw e}}matchPattern(e,t){return this.patternToRegex(t).test(e)}patternToRegex(e){return z(`^${this.patternToRegexStr(e)}$`)}patternToRegexStr(e){let t=``,n=!1;for(let r=0;r<e.length;r++){if(e.slice(r,r+13)===`\0QUOTE_START\0`){n=!0,r+=12;continue}if(e.slice(r,r+11)===`\0QUOTE_END\0`){n=!1,r+=10;continue}let i=e[r];if(n){/[.+^${}()|\\*?[\]]/.test(i)?t+=`\\${i}`:t+=i;continue}if(this.extglob&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let n=nT(e,r+1);if(n!==-1){let a=rT(e.slice(r+2,n)),o=a.map(e=>this.patternToRegexStr(e)),s=o.length>0?o.join(`|`):`(?:)`;if(i===`@`)t+=`(?:${s})`;else if(i===`*`)t+=`(?:${s})*`;else if(i===`+`)t+=`(?:${s})+`;else if(i===`?`)t+=`(?:${s})?`;else if(i===`!`)if(n<e.length-1){let e=a.map(e=>this.computePatternLength(e));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let n=e[0];if(n===0)t+=`(?:.+)`;else{let e=[];n>0&&e.push(`.{0,${n-1}}`),e.push(`.{${n+1},}`),e.push(`(?!(?:${s})).{${n}}`),t+=`(?:${e.join(`|`)})`}}else t+=`(?:(?!(?:${s})).)*?`}else t+=`(?!(?:${s})$).*`;r=n;continue}}if(i===`*`)t+=`.*`;else if(i===`?`)t+=`.`;else if(i===`[`){let n=r+1,i=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(i+=`^`,n++),n<e.length&&e[n]===`]`&&(i+=`\\]`,n++);let a=n;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=n;for(;n<e.length&&e[n]!==`]`;){if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=$w(e.slice(n+2,t));i+=r,n=t+2;continue}}if(e[n]===`\\`&&n+1<e.length){i+=`\\${e[n+1]}`,n+=2;continue}if(e[n]===`-`){let e=n===o,t=n+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[n];n++}i+=`]`,t+=i,r=n}else if(i===`\\`&&r+1<e.length){let n=e[r+1];/[.+^${}()|\\*?[\]]/.test(n)?t+=`\\${n}`:t+=n,r++}else /[.+^${}()|]/.test(i)?t+=`\\${i}`:t+=i}return t}computePatternLength(e){let t=0,n=0,r=!1;for(;n<e.length;){if(e.slice(n,n+13)===`\0QUOTE_START\0`){r=!0,n+=13;continue}if(e.slice(n,n+11)===`\0QUOTE_END\0`){r=!1,n+=11;continue}let i=e[n];if(r){t+=1,n++;continue}if((i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&n+1<e.length&&e[n+1]===`(`){let r=nT(e,n+1);if(r!==-1){if(i===`@`){let i=rT(e.slice(n+2,r)).map(e=>this.computePatternLength(e));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){t+=i[0],n=r+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){t+=1,n++;continue}if(i===`[`){let r=e.indexOf(`]`,n+1);if(r!==-1){t+=1,n=r+1;continue}t+=1,n++;continue}if(i===`\\`){t+=1,n+=2;continue}t+=1,n++}return t}}});function lT(e){for(let t=0;t<e.length;t++){if(e[t]===`\\`){t++;continue}if(e[t]===`$`){let n=e[t+1];if(n===`{`||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function uT(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n)return!1;for(let e of n)if(e.type===`DoubleQuoted`||e.type===`SingleQuoted`)return!0;return!1}function dT(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n||n.length===0)return!1;for(let e of n)if(e.type!==`DoubleQuoted`&&e.type!==`SingleQuoted`)return!1;return!0}function fT(e){let t=!1,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let c of e){if((c.type===`SingleQuoted`||c.type===`DoubleQuoted`)&&(t=!0,c.type===`DoubleQuoted`))for(let e of c.parts)e.type===`ParameterExpansion`&&(e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!e.operation||e.operation.type===`PatternRemoval`||e.operation.type===`PatternReplacement`)&&(i=!0),(e.operation?.type===`VarNamePrefix`||e.operation?.type===`ArrayKeys`)&&(o=!0),e.operation?.type===`Indirection`&&(s=!0));c.type===`CommandSubstitution`&&(n=!0),c.type===`ParameterExpansion`&&(a=!0,(c.parameter===`@`||c.parameter===`*`)&&(r=!0),uT(c)&&(t=!0),(c.operation?.type===`VarNamePrefix`||c.operation?.type===`ArrayKeys`)&&(o=!0),c.operation?.type===`Indirection`&&(s=!0)),c.type===`Glob`&&lT(c.pattern)&&(a=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:i,hasParamExpansion:a,hasVarNamePrefixExpansion:o,hasIndirection:s}}var pT=S(()=>{});function mT(e,t){let n=`${t}_`,r=[];for(let t of e.state.env.keys())if(t.startsWith(n)){let e=t.slice(n.length),i=Number.parseInt(e,10);!Number.isNaN(i)&&String(i)===e&&r.push(i)}return r.sort((e,t)=>e-t)}function hT(e,t){let n=`${t}_`;for(let t of e.state.env.keys())t.startsWith(n)&&e.state.env.delete(t)}function gT(e,t){let n=`${t}_`,r=`${t}__length`,i=[];for(let t of e.state.env.keys())if(t!==r&&t.startsWith(n)){let e=t.slice(n.length);if(e.startsWith(`_length`))continue;i.push(e)}return i.sort()}function _T(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function vT(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!==`Glob`||!t.pattern.startsWith(`[`))return null;let r,i=n,a=1;if(n.type===`Literal`&&n.value.startsWith(`]`)){let o=n.value.slice(1);if(o.startsWith(`+=`)||o.startsWith(`=`))r=t.pattern.slice(1);else if(o===``){if(e.parts.length<3)return null;let n=e.parts[2];if(n.type!==`Literal`||!n.value.startsWith(`=`)&&!n.value.startsWith(`+=`))return null;r=t.pattern.slice(1),i=n,a=2}else return null}else if(t.pattern===`[`&&(n.type===`DoubleQuoted`||n.type===`SingleQuoted`)){if(e.parts.length<3)return null;let t=e.parts[2];if(t.type!==`Literal`||!t.value.startsWith(`]=`)&&!t.value.startsWith(`]+=`))return null;if(n.type===`SingleQuoted`)r=n.value;else{r=``;for(let e of n.parts)(e.type===`Literal`||e.type===`Escaped`)&&(r+=e.value)}i=t,a=2}else if(t.pattern.endsWith(`]`)){if(n.type!==`Literal`||!n.value.startsWith(`=`)&&!n.value.startsWith(`+=`))return null;r=t.pattern.slice(1,-1)}else return null;r=_T(r);let o;if(i.type!==`Literal`)return null;o=i.value.startsWith(`]=`)||i.value.startsWith(`]+=`)?i.value.slice(1):i.value;let s=o.startsWith(`+=`);if(!s&&!o.startsWith(`=`))return null;let c=[],l=s?2:1,u=o.slice(l);u&&c.push({type:`Literal`,value:u});for(let t=a+1;t<e.parts.length;t++){let n=e.parts[t];n.type===`BraceExpansion`?c.push({type:`Literal`,value:yT(n)}):c.push(n)}return{key:r,valueParts:c,append:s}}function yT(e){return`{${e.items.map(e=>{if(e.type===`Range`){let t=`${e.startStr??String(e.start)}..${e.endStr??String(e.end)}`;return e.step&&(t+=`..${e.step}`),t}return bT(e.word)}).join(`,`)}}`}function bT(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:t+=n.value;break;case`Glob`:t+=n.pattern;break;case`SingleQuoted`:t+=n.value;break;case`DoubleQuoted`:for(let e of n.parts)(e.type===`Literal`||e.type===`Escaped`)&&(t+=e.value);break;case`Escaped`:t+=n.value;break;case`BraceExpansion`:t+=`{`,t+=n.items.map(e=>e.type===`Range`?`${e.startStr}..${e.endStr}${e.step?`..${e.step}`:``}`:bT(e.word)).join(`,`),t+=`}`;break;case`TildeExpansion`:t+=`~`,n.user&&(t+=n.user);break}return t}var xT=S(()=>{});function ST(e){return e.get(`IFS`)??`
845
+ `&&(o+=t),a+=2):(o+=e[a],a++)}else o+=e[a],a++;a>=e.length&&i("unexpected EOF while looking for matching ``'");let s=r().parse(o);return{part:K.commandSubstitution(s,!0),endIndex:a+1}}var Yw=S(()=>{gC()});function Xw(e,t){return new Zw().parse(e,t)}var Zw,Qw=S(()=>{gC(),KC(),mw(),ww(),Fw(),Gw(),oC(),Yw(),hC(),hC(),Zw=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input=``;getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>lC)throw new mC(`Maximum parse iterations exceeded (possible infinite loop)`,this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>uC)throw new mC(`Maximum parser nesting depth exceeded (${uC})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(e,t){if(e.length>sC)throw new mC(`Input too large: ${e.length} bytes exceeds limit of ${sC}`,1,1);this._input=e;let n=new aC(e,t);if(this.tokens=n.tokenize(),this.tokens.length>cC)throw new mC(`Too many tokens: ${this.tokens.length} exceeds limit of ${cC}`,1,1);return this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}parseTokens(e){return this.tokens=e,this.pos=0,this.pendingHeredocs=[],this.parseIterations=0,this.parseDepth=0,this.parseScript()}current(){return this.tokens[this.pos]||this.tokens[this.tokens.length-1]}peek(e=0){return this.tokens[this.pos+e]||this.tokens[this.tokens.length-1]}advance(){let e=this.current();return this.pos<this.tokens.length-1&&this.pos++,e}getPos(){return this.pos}check(e,t,n,r,...i){let a=this.tokens[this.pos]?.type;return a===e||t!==void 0&&a===t||n!==void 0&&a===n||r!==void 0&&a===r?!0:i.length>0?i.includes(a):!1}expect(e,t){if(this.check(e))return this.advance();let n=this.current();throw new mC(t||`Expected ${e}, got ${n.type}`,n.line,n.column,n)}error(e){let t=this.current();throw new mC(e,t.line,t.column,t)}skipNewlines(){for(;this.check(G.NEWLINE,G.COMMENT);)this.check(G.NEWLINE)?(this.advance(),this.processHeredocs()):this.advance()}skipSeparators(e=!0){for(;;){if(this.check(G.NEWLINE)){this.advance(),this.processHeredocs();continue}if(this.check(G.SEMICOLON,G.COMMENT)){this.advance();continue}if(e&&this.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)){this.advance();continue}break}}addPendingHeredoc(e,t,n,r){this.pendingHeredocs.push({redirect:e,delimiter:t,stripTabs:n,quoted:r})}processHeredocs(){for(let e of this.pendingHeredocs)if(this.check(G.HEREDOC_CONTENT)){let t=this.advance(),n;n=e.quoted?K.word([K.literal(t.value)]):this.parseWordFromString(t.value,!1,!1,!1,!0),e.redirect.target=K.hereDoc(e.delimiter,n,e.stripTabs,e.quoted)}this.pendingHeredocs=[]}isStatementEnd(){return this.check(G.EOF,G.NEWLINE,G.SEMICOLON,G.AMP,G.AND_AND,G.OR_OR,G.RPAREN,G.RBRACE,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)}isCommandStart(){let e=this.current().type;return e===G.WORD||e===G.NAME||e===G.NUMBER||e===G.ASSIGNMENT_WORD||e===G.IF||e===G.FOR||e===G.WHILE||e===G.UNTIL||e===G.CASE||e===G.LPAREN||e===G.LBRACE||e===G.DPAREN_START||e===G.DBRACK_START||e===G.FUNCTION||e===G.BANG||e===G.TIME||e===G.IN||e===G.LESS||e===G.GREAT||e===G.DLESS||e===G.DGREAT||e===G.LESSAND||e===G.GREATAND||e===G.LESSGREAT||e===G.DLESSDASH||e===G.CLOBBER||e===G.TLESS||e===G.AND_GREAT||e===G.AND_DGREAT}parseScript(){let e=[],t=0;for(this.skipNewlines();!this.check(G.EOF);){t++,t>1e4&&this.error(`Parser stuck: too many iterations (>10000)`);let n=this.checkUnexpectedToken();if(n){e.push(n),this.skipSeparators(!1);continue}let r=this.pos,i=this.parseStatement();i&&e.push(i),this.skipSeparators(!1),this.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${this.current().value}'`),this.pos===r&&!this.check(G.EOF)&&this.advance()}return K.script(e)}checkUnexpectedToken(){let e=this.current().type,t=this.current().value;if((e===G.DO||e===G.DONE||e===G.THEN||e===G.ELSE||e===G.ELIF||e===G.FI||e===G.ESAC)&&this.error(`syntax error near unexpected token \`${t}'`),e===G.RBRACE||e===G.RPAREN){let e=`syntax error near unexpected token \`${t}'`;return this.advance(),K.statement([K.pipeline([K.simpleCommand(null,[],[],[])])],[],!1,{message:e,token:t})}return(e===G.DSEMI||e===G.SEMI_AND||e===G.SEMI_SEMI_AND)&&this.error(`syntax error near unexpected token \`${t}'`),e===G.SEMICOLON&&this.error(`syntax error near unexpected token \`${t}'`),(e===G.PIPE||e===G.PIPE_AMP)&&this.error(`syntax error near unexpected token \`${t}'`),null}parseStatement(){if(this.skipNewlines(),!this.isCommandStart())return null;let e=this.current().start,t=[],n=[],r=!1,i=this.parsePipeline();for(t.push(i);this.check(G.AND_AND,G.OR_OR);){let e=this.advance();n.push(e.type===G.AND_AND?`&&`:`||`),this.skipNewlines();let r=this.parsePipeline();t.push(r)}this.check(G.AMP)&&(this.advance(),r=!0);let a=this.pos>0?this.tokens[this.pos-1].end:e,o=this._input.slice(e,a);return K.statement(t,n,r,void 0,o)}parsePipeline(){let e=!1,t=!1;this.check(G.TIME)&&(this.advance(),e=!0,this.check(G.WORD,G.NAME)&&this.current().value===`-p`&&(this.advance(),t=!0));let n=0;for(;this.check(G.BANG);)this.advance(),n++;let r=n%2==1,i=[],a=[],o=this.parseCommand();for(i.push(o);this.check(G.PIPE,G.PIPE_AMP);){let e=this.advance();this.skipNewlines(),a.push(e.type===G.PIPE_AMP);let t=this.parseCommand();i.push(t)}return K.pipeline(i,r,e,t,a.length>0?a:void 0)}parseCommand(){return this.check(G.IF)?hw(this):this.check(G.FOR)?gw(this):this.check(G.WHILE)?vw(this):this.check(G.UNTIL)?yw(this):this.check(G.CASE)?bw(this):this.check(G.LPAREN)?Sw(this):this.check(G.LBRACE)?Cw(this):this.check(G.DPAREN_START)?this.dparenClosesWithSpacedParens()?this.parseNestedSubshellsFromDparen():this.parseArithmeticCommand():this.check(G.DBRACK_START)?this.parseConditionalCommand():this.check(G.FUNCTION)||this.check(G.NAME,G.WORD)&&this.peek(1).type===G.LPAREN&&this.peek(2).type===G.RPAREN?this.parseFunctionDef():uw(this)}dparenClosesWithSpacedParens(){let e=1,t=1;for(;t<this.tokens.length-this.pos;){let n=this.peek(t);if(n.type===G.EOF)return!1;if(n.type===G.DPAREN_START||n.type===G.LPAREN)e++;else if(n.type===G.DPAREN_END){if(e-=2,e<=0)return!1}else if(n.type===G.RPAREN&&(e--,e===0&&this.peek(t+1).type===G.RPAREN))return!0;t++}return!1}parseNestedSubshellsFromDparen(){this.advance();let e=this.parseCompoundList();this.expect(G.RPAREN),this.expect(G.RPAREN);let t=this.parseOptionalRedirections(),n=K.subshell(e,[]);return K.subshell([K.statement([K.pipeline([n],!1,!1,!1)])],t)}isWord(){let e=this.current().type;return e===G.WORD||e===G.NAME||e===G.NUMBER||e===G.IF||e===G.FOR||e===G.WHILE||e===G.UNTIL||e===G.CASE||e===G.FUNCTION||e===G.ELSE||e===G.ELIF||e===G.FI||e===G.THEN||e===G.DO||e===G.DONE||e===G.ESAC||e===G.IN||e===G.SELECT||e===G.TIME||e===G.COPROC||e===G.BANG}parseWord(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted)}parseWordNoBraceExpansion(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0)}parseWordForRegex(){let e=this.advance();return this.parseWordFromString(e.value,e.quoted,e.singleQuoted,!1,!1,!0,!0)}parseWordFromString(e,t=!1,n=!1,r=!1,i=!1,a=!1,o=!1){let s=Ww(this,e,t,n,r,i,!1,a,o);return K.word(s)}parseCommandSubstitution(t,n){return qw(t,n,()=>new e,e=>this.error(e))}parseBacktickSubstitution(t,n,r=!1){return Jw(t,n,r,()=>new e,e=>this.error(e))}isDollarDparenSubshell(e,t){return Kw(e,t)}parseArithmeticExpansion(e,t){let n=t+3,r=1,i=0,a=n;for(;a<e.length-1&&r>0;)e[a]===`$`&&e[a+1]===`(`?e[a+2]===`(`?(r++,a+=3):(i++,a+=2):e[a]===`(`&&e[a+1]===`(`?(r++,a+=2):e[a]===`)`&&e[a+1]===`)`?i>0?(i--,a++):(r--,r>0&&(a+=2)):e[a]===`(`?(i++,a++):(e[a]===`)`&&i>0&&i--,a++);let o=e.slice(n,a),s=this.parseArithmeticExpression(o);return{part:K.arithmeticExpansion(s),endIndex:a+2}}parseArithmeticCommand(){let e=this.expect(G.DPAREN_START),t=``,n=1,r=0,i=!1,a=!1;for(;n>0&&!this.check(G.EOF);){if(i){if(i=!1,r>0){r--,t+=`)`;continue}if(this.check(G.RPAREN)){n--,a=!0,this.advance();continue}if(this.check(G.DPAREN_END)){n--,a=!0;continue}t+=`)`;continue}if(this.check(G.DPAREN_START))n++,t+=`((`,this.advance();else if(this.check(G.DPAREN_END))r>=2?(r-=2,t+=`))`,this.advance()):r===1?(r--,t+=`)`,i=!0,this.advance()):(n--,a=!0,n>0&&(t+=`))`),this.advance());else if(this.check(G.LPAREN))r++,t+=`(`,this.advance();else if(this.check(G.RPAREN))r>0&&r--,t+=`)`,this.advance();else{let e=this.current().value,n=t.length>0?t[t.length-1]:``;t.length>0&&!t.endsWith(` `)&&!(e===`=`&&/[|&^+\-*/%<>]$/.test(t))&&!(e===`<`&&n===`<`)&&!(e===`>`&&n===`>`)&&(t+=` `),t+=e,this.advance()}}a||this.expect(G.DPAREN_END);let o=this.parseArithmeticExpression(t.trim()),s=this.parseOptionalRedirections();return K.arithmeticCommand(o,s,e.line)}parseConditionalCommand(){let e=this.expect(G.DBRACK_START),t=Dw(this);this.expect(G.DBRACK_END);let n=this.parseOptionalRedirections();return K.conditionalCommand(t,n,e.line)}parseFunctionDef(){let e;if(this.check(G.FUNCTION)){if(this.advance(),this.check(G.NAME)||this.check(G.WORD))e=this.advance().value;else{let e=this.current();throw new mC(`Expected function name`,e.line,e.column,e)}this.check(G.LPAREN)&&(this.advance(),this.expect(G.RPAREN))}else e=this.advance().value,e.includes(`$`)&&this.error(`\`${e}': not a valid identifier`),this.expect(G.LPAREN),this.expect(G.RPAREN);this.skipNewlines();let t=this.parseCompoundCommandBody({forFunctionBody:!0}),n=this.parseOptionalRedirections();return K.functionDef(e,t,n)}parseCompoundCommandBody(e){let t=e?.forFunctionBody;if(this.check(G.LBRACE))return Cw(this,{skipRedirections:t});if(this.check(G.LPAREN))return Sw(this,{skipRedirections:t});if(this.check(G.IF))return hw(this,{skipRedirections:t});if(this.check(G.FOR))return gw(this,{skipRedirections:t});if(this.check(G.WHILE))return vw(this,{skipRedirections:t});if(this.check(G.UNTIL))return yw(this,{skipRedirections:t});if(this.check(G.CASE))return bw(this,{skipRedirections:t});this.error(`Expected compound command for function body`)}parseCompoundList(){let e=this.enterDepth(),t=[];for(this.skipNewlines();!this.check(G.EOF,G.FI,G.ELSE,G.ELIF,G.THEN,G.DO,G.DONE,G.ESAC,G.RPAREN,G.RBRACE,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND)&&this.isCommandStart();){this.checkIterationLimit();let e=this.pos,n=this.parseStatement();if(n&&t.push(n),this.skipSeparators(),this.pos===e&&!n)break}return e(),t}parseOptionalRedirections(){let e=[];for(;sw(this);){this.checkIterationLimit();let t=this.pos;if(e.push(cw(this)),this.pos===t)break}return e}parseArithmeticExpression(e){return TC(this,e)}}});function $w(e){return iT.get(e)??``}function eT(e){let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];if(i===`[`){for(n+=i,r++,r<e.length&&(e[r]===`!`||e[r]===`^`)&&(n+=e[r],r++),r<e.length&&e[r]===`]`&&(n+=e[r],r++);r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){n+=e.slice(r,t+2),r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){n+=e[r]+e[r+1],r+=2;continue}n+=e[r],r++}r<e.length&&e[r]===`]`&&(n+=e[r],r++)}else i===`:`?(n!==``&&t.push(n),n=``,r++):i===`\\`&&r+1<e.length?(n+=i+e[r+1],r+=2):(n+=i,r++)}return n!==``&&t.push(n),t}function tT(e){let t=`^`;for(let n=0;n<e.length;n++){let r=e[n];if(r===`*`)t+=`[^/]*`;else if(r===`?`)t+=`[^/]`;else if(r===`[`){let r=n+1,i=`[`;r<e.length&&(e[r]===`^`||e[r]===`!`)&&(i+=`^`,r++),r<e.length&&e[r]===`]`&&(i+=`\\]`,r++);let a=r;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=r;for(;r<e.length&&e[r]!==`]`;){if(e[r]===`[`&&r+1<e.length&&e[r+1]===`:`){let t=e.indexOf(`:]`,r+2);if(t!==-1){let n=$w(e.slice(r+2,t));i+=n,r=t+2;continue}}if(e[r]===`\\`&&r+1<e.length){i+=`\\${e[r+1]}`,r+=2;continue}if(e[r]===`-`){let e=r===o,t=r+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[r];r++}i+=`]`,t+=i,n=r}else if(r===`\\`&&n+1<e.length){let r=e[n+1];/[.+^${}()|\\*?[\]]/.test(r)?t+=`\\${r}`:t+=r,n++}else /[.+^${}()|]/.test(r)?t+=`\\${r}`:t+=r}return t+=`$`,z(t)}function nT(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function rT(e){let t=[],n=``,r=0,i=!1,a=0;for(;a<e.length;){let o=e[a];if(o===`'`&&!i){i=!0,n+=`\0QUOTE_START\0`,a++;continue}if(o===`'`&&i){i=!1,n+=`\0QUOTE_END\0`,a++;continue}if(i){n+=o,a++;continue}if(o===`\\`){n+=o,a+1<e.length?(n+=e[a+1],a+=2):a++;continue}o===`(`?(r++,n+=o):o===`)`?(r--,n+=o):o===`|`&&r===0?(t.push(n),n=``):n+=o,a++}return t.push(n),t}var iT,aT=S(()=>{xs(),iT=new Map([[`alnum`,`a-zA-Z0-9`],[`alpha`,`a-zA-Z`],[`ascii`,`\\x00-\\x7F`],[`blank`,` \\t`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`digit`,`0-9`],[`graph`,`!-~`],[`lower`,`a-z`],[`print`,` -~`],[`punct`,"!-/:-@\\[-`{-~"],[`space`,` \\t\\n\\r\\f\\v`],[`upper`,`A-Z`],[`word`,`a-zA-Z0-9_`],[`xdigit`,`0-9a-fA-F`]])}),oT,sT,cT=S(()=>{A(),xs(),vr(),aT(),oT=5,sT=class{fs;cwd;globignorePatterns=[];hasGlobignore=!1;globstar=!1;nullglob=!1;failglob=!1;dotglob=!1;extglob=!1;globskipdots=!0;ops={count:0};maxOps;constructor(e,t,n,r){this.fs=e,this.cwd=t,typeof r==`boolean`?(this.globstar=r,this.maxOps=1e5):r?(this.globstar=r.globstar??!1,this.nullglob=r.nullglob??!1,this.failglob=r.failglob??!1,this.dotglob=r.dotglob??!1,this.extglob=r.extglob??!1,this.globskipdots=r.globskipdots??!0,this.maxOps=r.maxGlobOperations??1e5):this.maxOps=1e5;let i=n?.get(`GLOBIGNORE`);i!==void 0&&i!==``&&(this.hasGlobignore=!0,this.globignorePatterns=eT(i))}checkOpsLimit(){if(++this.ops.count>this.maxOps)throw new k(`Glob operation limit exceeded (${this.maxOps})`,`glob_operations`)}hasNullglob(){return this.nullglob}hasFailglob(){return this.failglob}filterGlobignore(e){return!this.hasGlobignore&&!this.globskipdots?e:e.filter(e=>{let t=e.split(`/`).pop()||e;if((this.hasGlobignore||this.globskipdots)&&(t===`.`||t===`..`))return!1;if(this.hasGlobignore){for(let t of this.globignorePatterns)if(this.matchGlobignorePattern(e,t))return!1}return!0})}matchGlobignorePattern(e,t){return tT(t).test(e)}isGlobPattern(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandArgs(e,t){let n=e.map((e,n)=>(t?.[n]??!1)||!this.isGlobPattern(e)?null:this.expand(e)),r=await Promise.all(n.map(e=>e||Promise.resolve(null))),i=[];for(let t=0;t<e.length;t++){let n=r[t];n===null?i.push(e[t]):n.length>0?i.push(...n):i.push(e[t])}return i}async expand(e){if(this.globstar){let t=e.split(`/`),n=0;for(let e of t)if(e===`**`&&(n++,n>oT))throw new k(`Glob pattern has too many ** segments (max ${oT})`,`glob_operations`)}let t;if(e.includes(`**`)&&this.globstar&&this.isGlobstarValid(e))t=await this.expandRecursive(e);else{let n=e.replace(/\*\*+/g,`*`);t=await this.expandSimple(n)}return this.filterGlobignore(t)}isGlobstarValid(e){let t=e.split(`/`);for(let e of t)if(e.includes(`**`)&&e!==`**`)return!1;return!0}hasGlobChars(e){return!!(e.includes(`*`)||e.includes(`?`)||/\[.*\]/.test(e)||this.extglob&&/[@*+?!]\(/.test(e))}async expandSimple(e){let t=e.startsWith(`/`),n=e.split(`/`).filter(e=>e!==``),r=-1;for(let e=0;e<n.length;e++)if(this.hasGlobChars(n[e])){r=e;break}if(r===-1)return[e];let i,a;if(r===0)t?(i=`/`,a=`/`):(i=this.cwd,a=``);else{let e=n.slice(0,r);t?(i=`/${e.join(`/`)}`,a=`/${e.join(`/`)}`):(i=this.fs.resolvePath(this.cwd,e.join(`/`)),a=e.join(`/`))}let o=n.slice(r);return(await this.expandSegments(i,a,o)).sort()}async expandSegments(e,t,n){if(this.checkOpsLimit(),n.length===0)return[t];let[r,...i]=n,a=[];try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let n=await this.fs.readdirWithFileTypes(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;if(r.startsWith(`.`)||this.dotglob){let e=n.some(e=>e.name===`.`),t=n.some(e=>e.name===`..`);e||s.push({name:`.`,isFile:!1,isDirectory:!0,isSymbolicLink:!1}),t||s.push({name:`..`,isFile:!1,isDirectory:!0,isSymbolicLink:!1})}for(let n of s)if(!(n.name.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n.name,r)){let r=e===`/`?`/${n.name}`:`${e}/${n.name}`,a;a=t===``?n.name:t===`/`?`/${n.name}`:`${t}/${n.name}`,i.length===0?o.push(Promise.resolve([a])):n.isDirectory&&o.push(this.expandSegments(r,a,i))}let l=await Promise.all(o);for(let e of l)a.push(...e)}else{this.checkOpsLimit();let n=await this.fs.readdir(e),o=[],s=[...n],c=this.dotglob||this.hasGlobignore;(r.startsWith(`.`)||this.dotglob)&&(n.includes(`.`)||s.push(`.`),n.includes(`..`)||s.push(`..`));for(let n of s)if(!(n.startsWith(`.`)&&!r.startsWith(`.`)&&!c)&&this.matchPattern(n,r)){let r=e===`/`?`/${n}`:`${e}/${n}`,a;a=t===``?n:t===`/`?`/${n}`:`${t}/${n}`,i.length===0?o.push(Promise.resolve([a])):o.push((async()=>{try{if(this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory)return this.expandSegments(r,a,i)}catch(e){if(e instanceof k)throw e}return[]})())}let l=await Promise.all(o);for(let e of l)a.push(...e)}}catch(e){if(e instanceof k)throw e}return a}async expandRecursive(e){let t=[],n=e.indexOf(`**`),r=e.slice(0,n).replace(/\/$/,``)||`.`,i=e.slice(n+2).replace(/^\//,``);return i.includes(`**`)&&this.isGlobstarValid(i)?(await this.walkDirectoryMultiGlobstar(r,i,t),[...new Set(t)].sort()):(await this.walkDirectory(r,i,t),t.sort())}async walkDirectoryMultiGlobstar(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{this.checkOpsLimit();let i=this.fs.readdirWithFileTypes?await this.fs.readdirWithFileTypes(r):null;if(i){let r=[];for(let t of i){let n=e===`.`?t.name:`${e}/${t.name}`;t.isDirectory&&r.push(n)}let a=e===`.`?t:`${e}/${t}`,o=await this.expandRecursive(a);n.push(...o);for(let e=0;e<r.length;e+=100){let i=r.slice(e,e+100);await Promise.all(i.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t of i){let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{this.checkOpsLimit(),(await this.fs.stat(r)).isDirectory&&a.push(n)}catch(e){if(e instanceof k)throw e}}let o=e===`.`?t:`${e}/${t}`,s=await this.expandRecursive(o);n.push(...s);for(let e=0;e<a.length;e+=100){let r=a.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectoryMultiGlobstar(e,t,n)))}}}catch(e){if(e instanceof k)throw e}}async walkDirectory(e,t,n){this.checkOpsLimit();let r=this.fs.resolvePath(this.cwd,e);try{if(this.fs.readdirWithFileTypes){this.checkOpsLimit();let i=await this.fs.readdirWithFileTypes(r),a=[],o=[];for(let n of i){let r=e===`.`?n.name:`${e}/${n.name}`;n.isDirectory?o.push(r):t&&this.matchPattern(n.name,t)&&a.push(r)}n.push(...a);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e,t,n)))}}else{this.checkOpsLimit();let i=await this.fs.readdir(r),a=[];for(let t=0;t<i.length;t+=100){let n=i.slice(t,t+100),r=await Promise.all(n.map(async t=>{let n=e===`.`?t:`${e}/${t}`,r=this.fs.resolvePath(this.cwd,n);try{return this.checkOpsLimit(),{name:t,path:n,isDirectory:(await this.fs.stat(r)).isDirectory}}catch(e){if(e instanceof k)throw e;return null}}));a.push(...r.filter(e=>e!==null))}for(let e of a)!e.isDirectory&&t&&this.matchPattern(e.name,t)&&n.push(e.path);let o=a.filter(e=>e.isDirectory);for(let e=0;e<o.length;e+=100){let r=o.slice(e,e+100);await Promise.all(r.map(e=>this.walkDirectory(e.path,t,n)))}}}catch(e){if(e instanceof k)throw e}}matchPattern(e,t){return this.patternToRegex(t).test(e)}patternToRegex(e){return z(`^${this.patternToRegexStr(e)}$`)}patternToRegexStr(e){let t=``,n=!1;for(let r=0;r<e.length;r++){if(e.slice(r,r+13)===`\0QUOTE_START\0`){n=!0,r+=12;continue}if(e.slice(r,r+11)===`\0QUOTE_END\0`){n=!1,r+=10;continue}let i=e[r];if(n){/[.+^${}()|\\*?[\]]/.test(i)?t+=`\\${i}`:t+=i;continue}if(this.extglob&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let n=nT(e,r+1);if(n!==-1){let a=rT(e.slice(r+2,n)),o=a.map(e=>this.patternToRegexStr(e)),s=o.length>0?o.join(`|`):`(?:)`;if(i===`@`)t+=`(?:${s})`;else if(i===`*`)t+=`(?:${s})*`;else if(i===`+`)t+=`(?:${s})+`;else if(i===`?`)t+=`(?:${s})?`;else if(i===`!`)if(n<e.length-1){let e=a.map(e=>this.computePatternLength(e));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let n=e[0];if(n===0)t+=`(?:.+)`;else{let e=[];n>0&&e.push(`.{0,${n-1}}`),e.push(`.{${n+1},}`),e.push(`(?!(?:${s})).{${n}}`),t+=`(?:${e.join(`|`)})`}}else t+=`(?:(?!(?:${s})).)*?`}else t+=`(?!(?:${s})$).*`;r=n;continue}}if(i===`*`)t+=`.*`;else if(i===`?`)t+=`.`;else if(i===`[`){let n=r+1,i=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(i+=`^`,n++),n<e.length&&e[n]===`]`&&(i+=`\\]`,n++);let a=n;for(;a<e.length;){if(e[a]===`\\`&&a+1<e.length){a+=2;continue}if(e[a]===`[`&&a+1<e.length&&e[a+1]===`:`){let t=e.indexOf(`:]`,a+2);if(t!==-1){a=t+2;continue}}if(e[a]===`]`)break;a++}let o=n;for(;n<e.length&&e[n]!==`]`;){if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=$w(e.slice(n+2,t));i+=r,n=t+2;continue}}if(e[n]===`\\`&&n+1<e.length){i+=`\\${e[n+1]}`,n+=2;continue}if(e[n]===`-`){let e=n===o,t=n+1===a;e||t?i+=`\\-`:i+=`-`}else i+=e[n];n++}i+=`]`,t+=i,r=n}else if(i===`\\`&&r+1<e.length){let n=e[r+1];/[.+^${}()|\\*?[\]]/.test(n)?t+=`\\${n}`:t+=n,r++}else /[.+^${}()|]/.test(i)?t+=`\\${i}`:t+=i}return t}computePatternLength(e){let t=0,n=0,r=!1;for(;n<e.length;){if(e.slice(n,n+13)===`\0QUOTE_START\0`){r=!0,n+=13;continue}if(e.slice(n,n+11)===`\0QUOTE_END\0`){r=!1,n+=11;continue}let i=e[n];if(r){t+=1,n++;continue}if((i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&n+1<e.length&&e[n+1]===`(`){let r=nT(e,n+1);if(r!==-1){if(i===`@`){let i=rT(e.slice(n+2,r)).map(e=>this.computePatternLength(e));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){t+=i[0],n=r+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){t+=1,n++;continue}if(i===`[`){let r=e.indexOf(`]`,n+1);if(r!==-1){t+=1,n=r+1;continue}t+=1,n++;continue}if(i===`\\`){t+=1,n+=2;continue}t+=1,n++}return t}}});function lT(e){for(let t=0;t<e.length;t++){if(e[t]===`\\`){t++;continue}if(e[t]===`$`){let n=e[t+1];if(n===`{`||n&&/[a-zA-Z_]/.test(n))return!0}}return!1}function uT(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n)return!1;for(let e of n)if(e.type===`DoubleQuoted`||e.type===`SingleQuoted`)return!0;return!1}function dT(e){if(!e.operation)return!1;let t=e.operation,n;if((t.type===`DefaultValue`||t.type===`AssignDefault`||t.type===`UseAlternative`||t.type===`ErrorIfUnset`)&&(n=t.word?.parts),!n||n.length===0)return!1;for(let e of n)if(e.type!==`DoubleQuoted`&&e.type!==`SingleQuoted`)return!1;return!0}function fT(e){let t=!1,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let c of e){if((c.type===`SingleQuoted`||c.type===`DoubleQuoted`)&&(t=!0,c.type===`DoubleQuoted`))for(let e of c.parts)e.type===`ParameterExpansion`&&(e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/)&&(!e.operation||e.operation.type===`PatternRemoval`||e.operation.type===`PatternReplacement`)&&(i=!0),(e.operation?.type===`VarNamePrefix`||e.operation?.type===`ArrayKeys`)&&(o=!0),e.operation?.type===`Indirection`&&(s=!0));c.type===`CommandSubstitution`&&(n=!0),c.type===`ParameterExpansion`&&(a=!0,(c.parameter===`@`||c.parameter===`*`)&&(r=!0),uT(c)&&(t=!0),(c.operation?.type===`VarNamePrefix`||c.operation?.type===`ArrayKeys`)&&(o=!0),c.operation?.type===`Indirection`&&(s=!0)),c.type===`Glob`&&lT(c.pattern)&&(a=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:i,hasParamExpansion:a,hasVarNamePrefixExpansion:o,hasIndirection:s}}var pT=S(()=>{});function mT(e,t){let n=`${t}_`,r=[];for(let t of e.state.env.keys())if(t.startsWith(n)){let e=t.slice(n.length),i=Number.parseInt(e,10);!Number.isNaN(i)&&String(i)===e&&r.push(i)}return r.sort((e,t)=>e-t)}function hT(e,t){let n=`${t}_`;for(let t of e.state.env.keys())t.startsWith(n)&&e.state.env.delete(t)}function gT(e,t){let n=`${t}_`,r=`${t}__length`,i=[];for(let t of e.state.env.keys())if(t!==r&&t.startsWith(n)){let e=t.slice(n.length);if(e.startsWith(`_length`))continue;i.push(e)}return i.sort()}function _T(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function vT(e){if(e.parts.length<2)return null;let t=e.parts[0],n=e.parts[1];if(t.type!==`Glob`||!t.pattern.startsWith(`[`))return null;let r,i=n,a=1;if(n.type===`Literal`&&n.value.startsWith(`]`)){let o=n.value.slice(1);if(o.startsWith(`+=`)||o.startsWith(`=`))r=t.pattern.slice(1);else if(o===``){if(e.parts.length<3)return null;let n=e.parts[2];if(n.type!==`Literal`||!n.value.startsWith(`=`)&&!n.value.startsWith(`+=`))return null;r=t.pattern.slice(1),i=n,a=2}else return null}else if(t.pattern===`[`&&(n.type===`DoubleQuoted`||n.type===`SingleQuoted`)){if(e.parts.length<3)return null;let t=e.parts[2];if(t.type!==`Literal`||!t.value.startsWith(`]=`)&&!t.value.startsWith(`]+=`))return null;if(n.type===`SingleQuoted`)r=n.value;else{r=``;for(let e of n.parts)(e.type===`Literal`||e.type===`Escaped`)&&(r+=e.value)}i=t,a=2}else if(t.pattern.endsWith(`]`)){if(n.type!==`Literal`||!n.value.startsWith(`=`)&&!n.value.startsWith(`+=`))return null;r=t.pattern.slice(1,-1)}else return null;r=_T(r);let o;if(i.type!==`Literal`)return null;o=i.value.startsWith(`]=`)||i.value.startsWith(`]+=`)?i.value.slice(1):i.value;let s=o.startsWith(`+=`);if(!s&&!o.startsWith(`=`))return null;let c=[],l=s?2:1,u=o.slice(l);u&&c.push({type:`Literal`,value:u});for(let t=a+1;t<e.parts.length;t++){let n=e.parts[t];n.type===`BraceExpansion`?c.push({type:`Literal`,value:yT(n)}):c.push(n)}return{key:r,valueParts:c,append:s}}function yT(e){return`{${e.items.map(e=>{if(e.type===`Range`){let t=`${e.startStr??String(e.start)}..${e.endStr??String(e.end)}`;return e.step&&(t+=`..${e.step}`),t}return bT(e.word)}).join(`,`)}}`}function bT(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:t+=n.value;break;case`Glob`:t+=n.pattern;break;case`SingleQuoted`:t+=n.value;break;case`DoubleQuoted`:for(let e of n.parts)(e.type===`Literal`||e.type===`Escaped`)&&(t+=e.value);break;case`Escaped`:t+=n.value;break;case`BraceExpansion`:t+=`{`,t+=n.items.map(e=>e.type===`Range`?`${e.startStr}..${e.endStr}${e.step?`..${e.step}`:``}`:bT(e.word)).join(`,`),t+=`}`;break;case`TildeExpansion`:t+=`~`,n.user&&(t+=n.user);break}return t}var xT=S(()=>{});function ST(e){return e.get(`IFS`)??`
846
846
  `}function CT(e){return e.get(`IFS`)===``}function wT(e){let t=ST(e);if(t===``)return!0;for(let e of t)if(e!==` `&&e!==` `&&e!==`
847
847
  `)return!1;return!0}function TT(e){let t=!1,n=[];for(let r of e.split(``))r===`-`?t=!0:/[\\^$.*+?()[\]{}|]/.test(r)?n.push(`\\${r}`):r===` `?n.push(`\\t`):r===`
848
848
  `?n.push(`\\n`):n.push(r);return t&&n.push(`\\-`),n.join(``)}function q(e){let t=e.get(`IFS`);return t===void 0?` `:t[0]||``}function ET(e){return NT.includes(e)}function DT(e){let t=new Set,n=new Set;for(let r of e)ET(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function OT(e,t,n,r){if(t===``)return e===``?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:i,nonWhitespace:a}=DT(t),o=[],s=[],c=0;for(;c<e.length&&i.has(e[c]);)c++;if(c>=e.length)return{words:[],wordStarts:[]};if(a.has(e[c]))for(o.push(``),s.push(c),c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&!(n!==void 0&&o.length>=n);){let t=c;for(s.push(t);c<e.length;){let t=e[c];if(!r&&t===`\\`){c++,c<e.length&&c++;continue}if(i.has(t)||a.has(t))break;c++}if(o.push(e.substring(t,c)),c>=e.length)break;for(;c<e.length&&i.has(e[c]);)c++;if(c<e.length&&a.has(e[c])){for(c++;c<e.length&&i.has(e[c]);)c++;for(;c<e.length&&a.has(e[c])&&!(n!==void 0&&o.length>=n);)for(o.push(``),s.push(c),c++;c<e.length&&i.has(e[c]);)c++}}return{words:o,wordStarts:s}}function kT(e,t){if(t===``)return{words:e?[e]:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};if(e===``)return{words:[],hadLeadingDelimiter:!1,hadTrailingDelimiter:!1};let{whitespace:n,nonWhitespace:r}=DT(t),i=[],a=0,o=!1,s=!1,c=a;for(;a<e.length&&n.has(e[a]);)a++;if(a>c&&(o=!0),a>=e.length)return{words:[],hadLeadingDelimiter:!0,hadTrailingDelimiter:!0};if(r.has(e[a]))for(i.push(``),a++;a<e.length&&n.has(e[a]);)a++;for(;a<e.length;){let t=a;for(;a<e.length;){let t=e[a];if(n.has(t)||r.has(t))break;a++}if(i.push(e.substring(t,a)),a>=e.length){s=!1;break}let o=a;for(;a<e.length&&n.has(e[a]);)a++;if(a<e.length&&r.has(e[a])){for(a++;a<e.length&&n.has(e[a]);)a++;for(;a<e.length&&r.has(e[a]);)for(i.push(``),a++;a<e.length&&n.has(e[a]);)a++}a>=e.length&&a>o&&(s=!0)}return{words:i,hadLeadingDelimiter:o,hadTrailingDelimiter:s}}function AT(e,t){return kT(e,t).words}function jT(e,t){for(let n of e)if(t.has(n))return!0;return!1}function MT(e,t,n){if(t===``)return e;let{whitespace:r,nonWhitespace:i}=DT(t),a=e.length;for(;a>0&&r.has(e[a-1]);){if(!n&&a>=2){let t=0,n=a-2;for(;n>=0&&e[n]===`\\`;)t++,n--;if(t%2==1)break}a--}let o=e.substring(0,a);if(o.length>=1&&i.has(o[o.length-1])){if(!n&&o.length>=2){let e=0,t=o.length-2;for(;t>=0&&o[t]===`\\`;)e++,t--;if(e%2==1)return o}let e=o.substring(0,o.length-1);if(!jT(e,i))return e}return o}var NT,PT=S(()=>{NT=`