sliccy 1.56.0 → 1.57.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.
@@ -231,57 +231,57 @@ Options:
231
231
  `,a+=`Access: (${t}/${n})
232
232
  `,a+=`Modify: ${i.mtime.toISOString()}
233
233
  `}}catch{o+=`stat: cannot stat '${e}': No such file or directory
234
- `,s=!0}}return{stdout:a,stderr:o,exitCode:+!!s}}},_o={name:`stat`,flags:[{flag:`-c`,type:`value`,valueHint:`format`},{flag:`-L`,type:`boolean`}],needsArgs:!0}}),j,M,N,yo,P,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,F,Io,Lo,Ro,I,zo,Bo,Vo,Ho,L,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs=S(()=>{j=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},M=class{static CODES=new Map([[`\x07`,7],[`\b`,8],[` `,9],[`
235
- `,10],[`\v`,11],[`\f`,12],[`\r`,13],[` `,32],[`"`,34],[`$`,36],[`&`,38],[`(`,40],[`)`,41],[`*`,42],[`+`,43],[`-`,45],[`.`,46],[`0`,48],[`1`,49],[`2`,50],[`3`,51],[`4`,52],[`5`,53],[`6`,54],[`7`,55],[`8`,56],[`9`,57],[`:`,58],[`<`,60],[`>`,62],[`?`,63],[`A`,65],[`B`,66],[`C`,67],[`F`,70],[`P`,80],[`Q`,81],[`U`,85],[`Z`,90],[`[`,91],[`\\`,92],[`]`,93],[`^`,94],[`_`,95],[`a`,97],[`b`,98],[`f`,102],[`i`,105],[`m`,109],[`n`,110],[`r`,114],[`s`,115],[`t`,116],[`v`,118],[`x`,120],[`z`,122],[`{`,123],[`|`,124],[`}`,125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}},N=class{SIZE=3;constructor(e){this.data=e}getLo(e){return this.data[e*this.SIZE]}getHi(e){return this.data[e*this.SIZE+1]}getStride(e){return this.data[e*this.SIZE+2]}get(e){let t=e*this.SIZE;return[this.data[t],this.data[t+1],this.data[t+2]]}get length(){return this.data.length/this.SIZE}},yo=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new N(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new N(new Uint32Array([0,31,1,127,159,1]));static Cf=new N(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new N(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new N(new Uint32Array([55296,57343,1]));static L=new N(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new N(new Uint32Array([837,837,1]));static Ll=new N(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new N(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new N(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new N(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new N(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new N(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new N(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new N(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new N(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new N(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new N(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new N(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new N(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new N(new Uint32Array([921,953,32,8126,8126,1]));static N=new N(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new N(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new N(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new N(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new N(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new N(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new N(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new N(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new N(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new N(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new N(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new N(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new N(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new N(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new N(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new N(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new N(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new N(new Uint32Array([8232,8232,1]));static Zp=new N(new Uint32Array([8233,8233,1]));static Zs=new N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new N(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new N(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new N(new Uint32Array([82944,83526,1]));static Arabic=new N(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new N(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new N(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new N(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new N(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new N(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new N(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new N(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new N(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new N(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new N(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new N(new Uint32Array([10240,10495,1]));static Buginese=new N(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new N(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new N(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new N(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new N(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new N(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new N(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new N(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new N(new Uint32Array([69552,69579,1]));static Common=new N(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new N(new Uint32Array([924,956,32]));static Coptic=new N(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new N(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new N(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new N(new Uint32Array([77712,77810,1]));static Cyrillic=new N(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new N(new Uint32Array([66560,66639,1]));static Devanagari=new N(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new N(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new N(new Uint32Array([71680,71739,1]));static Duployan=new N(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new N(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new N(new Uint32Array([66816,66855,1]));static Elymaic=new N(new Uint32Array([69600,69622,1]));static Ethiopic=new N(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new N(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new N(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new N(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new N(new Uint32Array([66352,66378,1]));static Grantha=new N(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new N(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new N(new Uint32Array([181,837,656]));static Gujarati=new N(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new N(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new N(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new N(new Uint32Array([90368,90425,1]));static Han=new N(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new N(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new N(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new N(new Uint32Array([5920,5940,1]));static Hatran=new N(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new N(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new N(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new N(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new N(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new N(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new N(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new N(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new N(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new N(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new N(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new N(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new N(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new N(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new N(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new N(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new N(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new N(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new N(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new N(new Uint32Array([93504,93561,1]));static Lao=new N(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new N(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new N(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new N(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new N(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new N(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new N(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new N(new Uint32Array([66176,66204,1]));static Lydian=new N(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new N(new Uint32Array([69968,70006,1]));static Makasar=new N(new Uint32Array([73440,73464,1]));static Malayalam=new N(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new N(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new N(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new N(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new N(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new N(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new N(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new N(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new N(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new N(new Uint32Array([67968,67999,1]));static Miao=new N(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new N(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new N(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new N(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new N(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new N(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new N(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new N(new Uint32Array([124112,124153,1]));static Nandinagari=new N(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new N(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new N(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new N(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new N(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new N(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new N(new Uint32Array([5760,5788,1]));static Ol_Chiki=new N(new Uint32Array([7248,7295,1]));static Ol_Onal=new N(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new N(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new N(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new N(new Uint32Array([68224,68255,1]));static Old_Permic=new N(new Uint32Array([66384,66426,1]));static Old_Persian=new N(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new N(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new N(new Uint32Array([68192,68223,1]));static Old_Turkic=new N(new Uint32Array([68608,68680,1]));static Old_Uyghur=new N(new Uint32Array([69488,69513,1]));static Oriya=new N(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new N(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new N(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new N(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new N(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new N(new Uint32Array([72384,72440,1]));static Phags_Pa=new N(new Uint32Array([43072,43127,1]));static Phoenician=new N(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new N(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new N(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new N(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new N(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new N(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new N(new Uint32Array([70016,70111,1]));static Shavian=new N(new Uint32Array([66640,66687,1]));static Siddham=new N(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new N(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new N(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new N(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new N(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new N(new Uint32Array([72272,72354,1]));static Sundanese=new N(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new N(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new N(new Uint32Array([43008,43052,1]));static Syriac=new N(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new N(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new N(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new N(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new N(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new N(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new N(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new N(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new N(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new N(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new N(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new N(new Uint32Array([1920,1969,1]));static Thai=new N(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new N(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new N(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new N(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new N(new Uint32Array([67008,67059,1]));static Toto=new N(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new N(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new N(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new N(new Uint32Array([42240,42539,1]));static Vithkuqi=new N(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new N(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new N(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new N(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new N(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new N(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([[`C`,e.C],[`Cc`,e.Cc],[`Cf`,e.Cf],[`Co`,e.Co],[`Cs`,e.Cs],[`L`,e.L],[`Ll`,e.Ll],[`Lm`,e.Lm],[`Lo`,e.Lo],[`Lt`,e.Lt],[`Lu`,e.Lu],[`M`,e.M],[`Mc`,e.Mc],[`Me`,e.Me],[`Mn`,e.Mn],[`N`,e.N],[`Nd`,e.Nd],[`Nl`,e.Nl],[`No`,e.No],[`P`,e.P],[`Pc`,e.Pc],[`Pd`,e.Pd],[`Pe`,e.Pe],[`Pf`,e.Pf],[`Pi`,e.Pi],[`Po`,e.Po],[`Ps`,e.Ps],[`S`,e.S],[`Sc`,e.Sc],[`Sk`,e.Sk],[`Sm`,e.Sm],[`So`,e.So],[`Z`,e.Z],[`Zl`,e.Zl],[`Zp`,e.Zp],[`Zs`,e.Zs]]);static SCRIPTS=new Map([[`Adlam`,e.Adlam],[`Ahom`,e.Ahom],[`Anatolian_Hieroglyphs`,e.Anatolian_Hieroglyphs],[`Arabic`,e.Arabic],[`Armenian`,e.Armenian],[`Avestan`,e.Avestan],[`Balinese`,e.Balinese],[`Bamum`,e.Bamum],[`Bassa_Vah`,e.Bassa_Vah],[`Batak`,e.Batak],[`Bengali`,e.Bengali],[`Bhaiksuki`,e.Bhaiksuki],[`Bopomofo`,e.Bopomofo],[`Brahmi`,e.Brahmi],[`Braille`,e.Braille],[`Buginese`,e.Buginese],[`Buhid`,e.Buhid],[`Canadian_Aboriginal`,e.Canadian_Aboriginal],[`Carian`,e.Carian],[`Caucasian_Albanian`,e.Caucasian_Albanian],[`Chakma`,e.Chakma],[`Cham`,e.Cham],[`Cherokee`,e.Cherokee],[`Chorasmian`,e.Chorasmian],[`Common`,e.Common],[`Coptic`,e.Coptic],[`Cuneiform`,e.Cuneiform],[`Cypriot`,e.Cypriot],[`Cypro_Minoan`,e.Cypro_Minoan],[`Cyrillic`,e.Cyrillic],[`Deseret`,e.Deseret],[`Devanagari`,e.Devanagari],[`Dives_Akuru`,e.Dives_Akuru],[`Dogra`,e.Dogra],[`Duployan`,e.Duployan],[`Egyptian_Hieroglyphs`,e.Egyptian_Hieroglyphs],[`Elbasan`,e.Elbasan],[`Elymaic`,e.Elymaic],[`Ethiopic`,e.Ethiopic],[`Garay`,e.Garay],[`Georgian`,e.Georgian],[`Glagolitic`,e.Glagolitic],[`Gothic`,e.Gothic],[`Grantha`,e.Grantha],[`Greek`,e.Greek],[`Gujarati`,e.Gujarati],[`Gunjala_Gondi`,e.Gunjala_Gondi],[`Gurmukhi`,e.Gurmukhi],[`Gurung_Khema`,e.Gurung_Khema],[`Han`,e.Han],[`Hangul`,e.Hangul],[`Hanifi_Rohingya`,e.Hanifi_Rohingya],[`Hanunoo`,e.Hanunoo],[`Hatran`,e.Hatran],[`Hebrew`,e.Hebrew],[`Hiragana`,e.Hiragana],[`Imperial_Aramaic`,e.Imperial_Aramaic],[`Inherited`,e.Inherited],[`Inscriptional_Pahlavi`,e.Inscriptional_Pahlavi],[`Inscriptional_Parthian`,e.Inscriptional_Parthian],[`Javanese`,e.Javanese],[`Kaithi`,e.Kaithi],[`Kannada`,e.Kannada],[`Katakana`,e.Katakana],[`Kawi`,e.Kawi],[`Kayah_Li`,e.Kayah_Li],[`Kharoshthi`,e.Kharoshthi],[`Khitan_Small_Script`,e.Khitan_Small_Script],[`Khmer`,e.Khmer],[`Khojki`,e.Khojki],[`Khudawadi`,e.Khudawadi],[`Kirat_Rai`,e.Kirat_Rai],[`Lao`,e.Lao],[`Latin`,e.Latin],[`Lepcha`,e.Lepcha],[`Limbu`,e.Limbu],[`Linear_A`,e.Linear_A],[`Linear_B`,e.Linear_B],[`Lisu`,e.Lisu],[`Lycian`,e.Lycian],[`Lydian`,e.Lydian],[`Mahajani`,e.Mahajani],[`Makasar`,e.Makasar],[`Malayalam`,e.Malayalam],[`Mandaic`,e.Mandaic],[`Manichaean`,e.Manichaean],[`Marchen`,e.Marchen],[`Masaram_Gondi`,e.Masaram_Gondi],[`Medefaidrin`,e.Medefaidrin],[`Meetei_Mayek`,e.Meetei_Mayek],[`Mende_Kikakui`,e.Mende_Kikakui],[`Meroitic_Cursive`,e.Meroitic_Cursive],[`Meroitic_Hieroglyphs`,e.Meroitic_Hieroglyphs],[`Miao`,e.Miao],[`Modi`,e.Modi],[`Mongolian`,e.Mongolian],[`Mro`,e.Mro],[`Multani`,e.Multani],[`Myanmar`,e.Myanmar],[`Nabataean`,e.Nabataean],[`Nag_Mundari`,e.Nag_Mundari],[`Nandinagari`,e.Nandinagari],[`New_Tai_Lue`,e.New_Tai_Lue],[`Newa`,e.Newa],[`Nko`,e.Nko],[`Nushu`,e.Nushu],[`Nyiakeng_Puachue_Hmong`,e.Nyiakeng_Puachue_Hmong],[`Ogham`,e.Ogham],[`Ol_Chiki`,e.Ol_Chiki],[`Ol_Onal`,e.Ol_Onal],[`Old_Hungarian`,e.Old_Hungarian],[`Old_Italic`,e.Old_Italic],[`Old_North_Arabian`,e.Old_North_Arabian],[`Old_Permic`,e.Old_Permic],[`Old_Persian`,e.Old_Persian],[`Old_Sogdian`,e.Old_Sogdian],[`Old_South_Arabian`,e.Old_South_Arabian],[`Old_Turkic`,e.Old_Turkic],[`Old_Uyghur`,e.Old_Uyghur],[`Oriya`,e.Oriya],[`Osage`,e.Osage],[`Osmanya`,e.Osmanya],[`Pahawh_Hmong`,e.Pahawh_Hmong],[`Palmyrene`,e.Palmyrene],[`Pau_Cin_Hau`,e.Pau_Cin_Hau],[`Phags_Pa`,e.Phags_Pa],[`Phoenician`,e.Phoenician],[`Psalter_Pahlavi`,e.Psalter_Pahlavi],[`Rejang`,e.Rejang],[`Runic`,e.Runic],[`Samaritan`,e.Samaritan],[`Saurashtra`,e.Saurashtra],[`Sharada`,e.Sharada],[`Shavian`,e.Shavian],[`Siddham`,e.Siddham],[`SignWriting`,e.SignWriting],[`Sinhala`,e.Sinhala],[`Sogdian`,e.Sogdian],[`Sora_Sompeng`,e.Sora_Sompeng],[`Soyombo`,e.Soyombo],[`Sundanese`,e.Sundanese],[`Sunuwar`,e.Sunuwar],[`Syloti_Nagri`,e.Syloti_Nagri],[`Syriac`,e.Syriac],[`Tagalog`,e.Tagalog],[`Tagbanwa`,e.Tagbanwa],[`Tai_Le`,e.Tai_Le],[`Tai_Tham`,e.Tai_Tham],[`Tai_Viet`,e.Tai_Viet],[`Takri`,e.Takri],[`Tamil`,e.Tamil],[`Tangsa`,e.Tangsa],[`Tangut`,e.Tangut],[`Telugu`,e.Telugu],[`Thaana`,e.Thaana],[`Thai`,e.Thai],[`Tibetan`,e.Tibetan],[`Tifinagh`,e.Tifinagh],[`Tirhuta`,e.Tirhuta],[`Todhri`,e.Todhri],[`Toto`,e.Toto],[`Tulu_Tigalari`,e.Tulu_Tigalari],[`Ugaritic`,e.Ugaritic],[`Vai`,e.Vai],[`Vithkuqi`,e.Vithkuqi],[`Wancho`,e.Wancho],[`Warang_Citi`,e.Warang_Citi],[`Yezidi`,e.Yezidi],[`Yi`,e.Yi],[`Zanabazar_Square`,e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([[`L`,e.foldL],[`Ll`,e.foldLl],[`Lt`,e.foldLt],[`Lu`,e.foldLu],[`M`,e.foldM],[`Mn`,e.foldMn]]);static FOLD_SCRIPT=new Map([[`Common`,e.foldCommon],[`Greek`,e.foldGreek],[`Inherited`,e.foldInherited]]);static Print=new N(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},P=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e.getLo(i),o=e.getHi(i);if(a<=t&&t<=o){let n=e.getStride(i);return(t-a)%n===0}t<a?r=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n=0;n<e.length;n++){if(t>e.getHi(n))continue;let r=e.getLo(n);if(t<r)return!1;let i=e.getStride(n);return(t-r)%i===0}return!1}return e.length>0&&t>=e.getLo(0)&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(yo.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<this.MAX_ASCII||e>=161&&e!==173:this.is(yo.Print,e)}static simpleFold(e){if(yo.CASE_ORBIT.has(e))return yo.CASE_ORBIT.get(e);let t=M.toLowerCase(e);return t===e?M.toUpperCase(e):t}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return M.CODES.get(`A`)<=e&&e<=M.CODES.get(`Z`)&&(e|=32),M.CODES.get(`A`)<=t&&t<=M.CODES.get(`Z`)&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}},bo=class{static METACHARACTERS=`\\.+*?()|[]{}^$`;static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return M.CODES.get(`0`)<=e&&e<=M.CODES.get(`9`)||M.CODES.get(`a`)<=e&&e<=M.CODES.get(`z`)||M.CODES.get(`A`)<=e&&e<=M.CODES.get(`Z`)}static unhex(e){return M.CODES.get(`0`)<=e&&e<=M.CODES.get(`9`)?e-M.CODES.get(`0`):M.CODES.get(`a`)<=e&&e<=M.CODES.get(`f`)?e-M.CODES.get(`a`)+10:M.CODES.get(`A`)<=e&&e<=M.CODES.get(`F`)?e-M.CODES.get(`A`)+10:-1}static escapeRune(e){let t=``;if(P.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+=`\\`),t+=String.fromCodePoint(e);else switch(e){case M.CODES.get(`"`):t+=`\\"`;break;case M.CODES.get(`\\`):t+=`\\\\`;break;case M.CODES.get(` `):t+=`\\t`;break;case M.CODES.get(`
234
+ `,s=!0}}return{stdout:a,stderr:o,exitCode:+!!s}}},_o={name:`stat`,flags:[{flag:`-c`,type:`value`,valueHint:`format`},{flag:`-L`,type:`boolean`}],needsArgs:!0}}),j,M,N,yo,P,F,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,I,Fo,Io,Lo,L,Ro,zo,Bo,Vo,R,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs=S(()=>{j=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},M=class{static CODES=new Map([[`\x07`,7],[`\b`,8],[` `,9],[`
235
+ `,10],[`\v`,11],[`\f`,12],[`\r`,13],[` `,32],[`"`,34],[`$`,36],[`&`,38],[`(`,40],[`)`,41],[`*`,42],[`+`,43],[`-`,45],[`.`,46],[`0`,48],[`1`,49],[`2`,50],[`3`,51],[`4`,52],[`5`,53],[`6`,54],[`7`,55],[`8`,56],[`9`,57],[`:`,58],[`<`,60],[`>`,62],[`?`,63],[`A`,65],[`B`,66],[`C`,67],[`F`,70],[`P`,80],[`Q`,81],[`U`,85],[`Z`,90],[`[`,91],[`\\`,92],[`]`,93],[`^`,94],[`_`,95],[`a`,97],[`b`,98],[`f`,102],[`i`,105],[`m`,109],[`n`,110],[`r`,114],[`s`,115],[`t`,116],[`v`,118],[`x`,120],[`z`,122],[`{`,123],[`|`,124],[`}`,125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}},N=class{SIZE=3;constructor(e){this.data=e}getLo(e){return this.data[e*this.SIZE]}getHi(e){return this.data[e*this.SIZE+1]}getStride(e){return this.data[e*this.SIZE+2]}get(e){let t=e*this.SIZE;return[this.data[t],this.data[t+1],this.data[t+2]]}get length(){return this.data.length/this.SIZE}},yo=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[68944,68976],[68976,68944],[68945,68977],[68977,68945],[68946,68978],[68978,68946],[68947,68979],[68979,68947],[68948,68980],[68980,68948],[68949,68981],[68981,68949],[68950,68982],[68982,68950],[68951,68983],[68983,68951],[68952,68984],[68984,68952],[68953,68985],[68985,68953],[68954,68986],[68986,68954],[68955,68987],[68987,68955],[68956,68988],[68988,68956],[68957,68989],[68989,68957],[68958,68990],[68990,68958],[68959,68991],[68991,68959],[68960,68992],[68992,68960],[68961,68993],[68993,68961],[68962,68994],[68994,68962],[68963,68995],[68995,68963],[68964,68996],[68996,68964],[68965,68997],[68997,68965],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[93777,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=new N(new Uint32Array([0,31,1,127,159,1,173,888,715,889,896,7,897,899,1,907,909,2,930,1328,398,1367,1368,1,1419,1420,1,1424,1480,56,1481,1487,1,1515,1518,1,1525,1541,1,1564,1757,193,1806,1807,1,1867,1868,1,1970,1983,1,2043,2044,1,2094,2095,1,2111,2140,29,2141,2143,2,2155,2159,1,2191,2198,1,2274,2436,162,2445,2446,1,2449,2450,1,2473,2481,8,2483,2485,1,2490,2491,1,2501,2502,1,2505,2506,1,2511,2518,1,2520,2523,1,2526,2532,6,2533,2559,26,2560,2564,4,2571,2574,1,2577,2578,1,2601,2609,8,2612,2618,3,2619,2621,2,2627,2630,1,2633,2634,1,2638,2640,1,2642,2648,1,2653,2655,2,2656,2661,1,2679,2688,1,2692,2702,10,2706,2729,23,2737,2740,3,2746,2747,1,2758,2766,4,2767,2769,2,2770,2783,1,2788,2789,1,2802,2808,1,2816,2820,4,2829,2830,1,2833,2834,1,2857,2865,8,2868,2874,6,2875,2885,10,2886,2889,3,2890,2894,4,2895,2900,1,2904,2907,1,2910,2916,6,2917,2936,19,2937,2945,1,2948,2955,7,2956,2957,1,2961,2966,5,2967,2968,1,2971,2973,2,2976,2978,1,2981,2983,1,2987,2989,1,3002,3005,1,3011,3013,1,3017,3022,5,3023,3025,2,3026,3030,1,3032,3045,1,3067,3071,1,3085,3089,4,3113,3130,17,3131,3141,10,3145,3150,5,3151,3156,1,3159,3163,4,3164,3166,2,3167,3172,5,3173,3184,11,3185,3190,1,3213,3217,4,3241,3252,11,3258,3259,1,3269,3273,4,3278,3284,1,3287,3292,1,3295,3300,5,3301,3312,11,3316,3327,1,3341,3345,4,3397,3401,4,3408,3411,1,3428,3429,1,3456,3460,4,3479,3481,1,3506,3516,10,3518,3519,1,3527,3529,1,3531,3534,1,3541,3543,2,3552,3557,1,3568,3569,1,3573,3584,1,3643,3646,1,3676,3712,1,3715,3717,2,3723,3748,25,3750,3774,24,3775,3781,6,3783,3791,8,3802,3803,1,3808,3839,1,3912,3949,37,3950,3952,1,3992,4029,37,4045,4059,14,4060,4095,1,4294,4296,2,4297,4300,1,4302,4303,1,4681,4686,5,4687,4695,8,4697,4702,5,4703,4745,42,4750,4751,1,4785,4790,5,4791,4799,8,4801,4806,5,4807,4823,16,4881,4886,5,4887,4955,68,4956,4989,33,4990,4991,1,5018,5023,1,5110,5111,1,5118,5119,1,5789,5791,1,5881,5887,1,5910,5918,1,5943,5951,1,5972,5983,1,5997,6001,4,6004,6015,1,6110,6111,1,6122,6127,1,6138,6143,1,6158,6170,12,6171,6175,1,6265,6271,1,6315,6319,1,6390,6399,1,6431,6444,13,6445,6447,1,6460,6463,1,6465,6467,1,6510,6511,1,6517,6527,1,6572,6575,1,6602,6607,1,6619,6621,1,6684,6685,1,6751,6781,30,6782,6794,12,6795,6799,1,6810,6815,1,6830,6831,1,6863,6911,1,6989,7156,167,7157,7163,1,7224,7226,1,7242,7244,1,7307,7311,1,7355,7356,1,7368,7375,1,7419,7423,1,7958,7959,1,7966,7967,1,8006,8007,1,8014,8015,1,8024,8030,2,8062,8063,1,8117,8133,16,8148,8149,1,8156,8176,20,8177,8181,4,8191,8203,12,8204,8207,1,8234,8238,1,8288,8303,1,8306,8307,1,8335,8349,14,8350,8351,1,8385,8399,1,8433,8447,1,8588,8591,1,9258,9279,1,9291,9311,1,11124,11125,1,11158,11508,350,11509,11512,1,11558,11560,2,11561,11564,1,11566,11567,1,11624,11630,1,11633,11646,1,11671,11679,1,11687,11743,8,11870,11903,1,11930,12020,90,12021,12031,1,12246,12271,1,12352,12439,87,12440,12544,104,12545,12548,1,12592,12687,95,12774,12782,1,12831,42125,29294,42126,42127,1,42183,42191,1,42540,42559,1,42744,42751,1,42958,42959,1,42962,42964,2,42973,42993,1,43053,43055,1,43066,43071,1,43128,43135,1,43206,43213,1,43226,43231,1,43348,43358,1,43389,43391,1,43470,43482,12,43483,43485,1,43519,43575,56,43576,43583,1,43598,43599,1,43610,43611,1,43715,43738,1,43767,43776,1,43783,43784,1,43791,43792,1,43799,43807,1,43815,43823,8,43884,43887,1,44014,44015,1,44026,44031,1,55204,55215,1,55239,55242,1,55292,63743,1,64110,64111,1,64218,64255,1,64263,64274,1,64280,64284,1,64311,64317,6,64319,64325,3,64451,64466,1,64912,64913,1,64968,64974,1,64976,65007,1,65050,65055,1,65107,65127,20,65132,65135,1,65141,65277,136,65278,65280,1,65471,65473,1,65480,65481,1,65488,65489,1,65496,65497,1,65501,65503,1,65511,65519,8,65520,65531,1,65534,65535,1,65548,65575,27,65595,65598,3,65614,65615,1,65630,65663,1,65787,65791,1,65795,65798,1,65844,65846,1,65935,65949,14,65950,65951,1,65953,65999,1,66046,66175,1,66205,66207,1,66257,66271,1,66300,66303,1,66340,66348,1,66379,66383,1,66427,66431,1,66462,66500,38,66501,66503,1,66518,66559,1,66718,66719,1,66730,66735,1,66772,66775,1,66812,66815,1,66856,66863,1,66916,66926,1,66939,66955,16,66963,66966,3,66978,66994,16,67002,67005,3,67006,67007,1,67060,67071,1,67383,67391,1,67414,67423,1,67432,67455,1,67462,67505,43,67515,67583,1,67590,67591,1,67593,67638,45,67641,67643,1,67645,67646,1,67670,67743,73,67744,67750,1,67760,67807,1,67827,67830,3,67831,67834,1,67868,67870,1,67898,67902,1,67904,67967,1,68024,68027,1,68048,68049,1,68100,68103,3,68104,68107,1,68116,68120,4,68150,68151,1,68155,68158,1,68169,68175,1,68185,68191,1,68256,68287,1,68327,68330,1,68343,68351,1,68406,68408,1,68438,68439,1,68467,68471,1,68498,68504,1,68509,68520,1,68528,68607,1,68681,68735,1,68787,68799,1,68851,68857,1,68904,68911,1,68922,68927,1,68966,68968,1,68998,69005,1,69008,69215,1,69247,69290,43,69294,69295,1,69298,69313,1,69317,69371,1,69416,69423,1,69466,69487,1,69514,69551,1,69580,69599,1,69623,69631,1,69710,69713,1,69750,69758,1,69821,69827,6,69828,69839,1,69865,69871,1,69882,69887,1,69941,69960,19,69961,69967,1,70007,70015,1,70112,70133,21,70134,70143,1,70162,70210,48,70211,70271,1,70279,70281,2,70286,70302,16,70314,70319,1,70379,70383,1,70394,70399,1,70404,70413,9,70414,70417,3,70418,70441,23,70449,70452,3,70458,70469,11,70470,70473,3,70474,70478,4,70479,70481,2,70482,70486,1,70488,70492,1,70500,70501,1,70509,70511,1,70517,70527,1,70538,70540,2,70541,70543,2,70582,70593,11,70595,70596,1,70598,70603,5,70614,70617,3,70618,70624,1,70627,70655,1,70748,70754,6,70755,70783,1,70856,70863,1,70874,71039,1,71094,71095,1,71134,71167,1,71237,71247,1,71258,71263,1,71277,71295,1,71354,71359,1,71370,71375,1,71396,71423,1,71451,71452,1,71468,71471,1,71495,71679,1,71740,71839,1,71923,71934,1,71943,71944,1,71946,71947,1,71956,71959,3,71990,71993,3,71994,72007,13,72008,72015,1,72026,72095,1,72104,72105,1,72152,72153,1,72165,72191,1,72264,72271,1,72355,72367,1,72441,72447,1,72458,72639,1,72674,72687,1,72698,72703,1,72713,72759,46,72774,72783,1,72813,72815,1,72848,72849,1,72872,72887,15,72888,72959,1,72967,72970,3,73015,73017,1,73019,73022,3,73032,73039,1,73050,73055,1,73062,73065,3,73103,73106,3,73113,73119,1,73130,73439,1,73465,73471,1,73489,73531,42,73532,73533,1,73563,73647,1,73649,73663,1,73714,73726,1,74650,74751,1,74863,74869,6,74870,74879,1,75076,77711,1,77811,77823,1,78896,78911,1,78934,78943,1,82939,82943,1,83527,90367,1,90426,92159,1,92729,92735,1,92767,92778,11,92779,92781,1,92863,92874,11,92875,92879,1,92910,92911,1,92918,92927,1,92998,93007,1,93018,93026,8,93048,93052,1,93072,93503,1,93562,93759,1,93851,93951,1,94027,94030,1,94088,94094,1,94112,94175,1,94181,94191,1,94194,94207,1,100344,100351,1,101590,101630,1,101641,110575,1,110580,110588,8,110591,110883,292,110884,110897,1,110899,110927,1,110931,110932,1,110934,110947,1,110952,110959,1,111356,113663,1,113771,113775,1,113789,113791,1,113801,113807,1,113818,113819,1,113824,117759,1,118010,118015,1,118452,118527,1,118574,118575,1,118599,118607,1,118724,118783,1,119030,119039,1,119079,119080,1,119155,119162,1,119275,119295,1,119366,119487,1,119508,119519,1,119540,119551,1,119639,119647,1,119673,119807,1,119893,119965,72,119968,119969,1,119971,119972,1,119975,119976,1,119981,119994,13,119996,120004,8,120070,120075,5,120076,120085,9,120093,120122,29,120127,120133,6,120135,120137,1,120145,120486,341,120487,120780,293,120781,121484,703,121485,121498,1,121504,121520,16,121521,122623,1,122655,122660,1,122667,122879,1,122887,122905,18,122906,122914,8,122917,122923,6,122924,122927,1,122990,123022,1,123024,123135,1,123181,123183,1,123198,123199,1,123210,123213,1,123216,123535,1,123567,123583,1,123642,123646,1,123648,124111,1,124154,124367,1,124411,124414,1,124416,124895,1,124903,124908,5,124911,124927,16,125125,125126,1,125143,125183,1,125260,125263,1,125274,125277,1,125280,126064,1,126133,126208,1,126270,126463,1,126468,126496,28,126499,126501,2,126502,126504,2,126515,126520,5,126522,126524,2,126525,126529,1,126531,126534,1,126536,126540,2,126544,126547,3,126549,126550,1,126552,126560,2,126563,126565,2,126566,126571,5,126579,126589,5,126591,126602,11,126620,126624,1,126628,126634,6,126652,126703,1,126706,126975,1,127020,127023,1,127124,127135,1,127151,127152,1,127168,127184,16,127222,127231,1,127406,127461,1,127491,127503,1,127548,127551,1,127561,127567,1,127570,127583,1,127590,127743,1,128728,128731,1,128749,128751,1,128765,128767,1,128887,128890,1,128986,128991,1,129004,129007,1,129009,129023,1,129036,129039,1,129096,129103,1,129114,129119,1,129160,129167,1,129198,129199,1,129212,129215,1,129218,129279,1,129620,129631,1,129646,129647,1,129661,129663,1,129674,129678,1,129735,129741,1,129757,129758,1,129770,129775,1,129785,129791,1,129939,130042,103,130043,131071,1,173792,173823,1,177978,177983,1,178206,178207,1,183970,183983,1,191457,191471,1,192094,194559,1,195102,196607,1,201547,201551,1,205744,917759,1,918e3,1114111,1]));static Cc=new N(new Uint32Array([0,31,1,127,159,1]));static Cf=new N(new Uint32Array([173,1536,1363,1537,1541,1,1564,1757,193,1807,2192,385,2193,2274,81,6158,8203,2045,8204,8207,1,8234,8238,1,8288,8292,1,8294,8303,1,65279,65529,250,65530,65531,1,69821,69837,16,78896,78911,1,113824,113827,1,119155,119162,1,917505,917536,31,917537,917631,1]));static Co=new N(new Uint32Array([57344,63743,1,983040,1048573,1,1048576,1114109,1]));static Cs=new N(new Uint32Array([55296,57343,1]));static L=new N(new Uint32Array([65,90,1,97,122,1,170,181,11,186,192,6,193,214,1,216,246,1,248,705,1,710,721,1,736,740,1,748,750,2,880,884,1,886,887,1,890,893,1,895,902,7,904,906,1,908,910,2,911,929,1,931,1013,1,1015,1153,1,1162,1327,1,1329,1366,1,1369,1376,7,1377,1416,1,1488,1514,1,1519,1522,1,1568,1610,1,1646,1647,1,1649,1747,1,1749,1765,16,1766,1774,8,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2036,2037,1,2042,2048,6,2049,2069,1,2074,2084,10,2088,2112,24,2113,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2249,1,2308,2361,1,2365,2384,19,2392,2401,1,2417,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3654,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3782,3804,22,3805,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4256,18,4257,4293,1,4295,4301,6,4304,4346,1,4348,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5024,5109,1,5112,5117,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6103,6108,5,6176,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6823,6917,94,6918,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7293,1,7296,7306,1,7312,7354,1,7357,7359,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,7424,6,7425,7615,1,7680,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8124,1,8126,8130,4,8131,8132,1,8134,8140,1,8144,8147,1,8150,8155,1,8160,8172,1,8178,8180,1,8182,8188,1,8305,8319,14,8336,8348,1,8450,8455,5,8458,8467,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8495,8505,1,8508,8511,1,8517,8521,1,8526,8579,53,8580,11264,2684,11265,11492,1,11499,11502,1,11506,11507,1,11520,11557,1,11559,11565,6,11568,11623,1,11631,11648,17,11649,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11823,12293,470,12294,12337,43,12338,12341,1,12347,12348,1,12353,12438,1,12445,12447,1,12449,12538,1,12540,12543,1,12549,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,42124,1,42192,42237,1,42240,42508,1,42512,42527,1,42538,42539,1,42560,42606,1,42623,42653,1,42656,42725,1,42775,42783,1,42786,42888,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43471,43488,17,43489,43492,1,43494,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43741,1,43744,43754,1,43762,43764,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43866,1,43868,43881,1,43888,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65313,65338,1,65345,65370,1,65382,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66560,66717,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68736,68786,1,68800,68850,1,68864,68899,1,68938,68965,1,68975,68997,1,69248,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71840,71903,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,92992,92995,1,93027,93047,1,93053,93071,1,93504,93548,1,93760,93823,1,93952,94026,1,94032,94099,67,94100,94111,1,94176,94177,1,94179,94208,29,94209,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120512,1,120514,120538,1,120540,120570,1,120572,120596,1,120598,120628,1,120630,120654,1,120656,120686,1,120688,120712,1,120714,120744,1,120746,120770,1,120772,120779,1,122624,122654,1,122661,122666,1,122928,122989,1,123136,123180,1,123191,123197,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124139,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125184,125251,1,125259,126464,1205,126465,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static foldL=new N(new Uint32Array([837,837,1]));static Ll=new N(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,311,2,312,328,2,329,375,2,378,382,2,383,384,1,387,389,2,392,396,4,397,402,5,405,409,4,410,411,1,414,417,3,419,421,2,424,426,2,427,429,2,432,436,4,438,441,3,442,445,3,446,447,1,454,460,3,462,476,2,477,495,2,496,499,3,501,505,4,507,563,2,564,569,1,572,575,3,576,578,2,583,591,2,592,659,1,661,687,1,881,883,2,887,891,4,892,893,1,912,940,28,941,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1020,1072,52,1073,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1376,1416,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7424,118,7425,7467,1,7531,7543,1,7545,7578,1,7681,7829,2,7830,7837,1,7839,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8016,8023,1,8032,8039,1,8048,8061,1,8064,8071,1,8080,8087,1,8096,8103,1,8112,8116,1,8118,8119,1,8126,8130,4,8131,8132,1,8134,8135,1,8144,8147,1,8150,8151,1,8160,8167,1,8178,8180,1,8182,8183,1,8458,8462,4,8463,8467,4,8495,8505,5,8508,8509,1,8518,8521,1,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11377,11379,2,11380,11382,2,11383,11387,1,11393,11491,2,11492,11500,8,11502,11507,5,11520,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42800,42801,1,42803,42865,2,42866,42872,1,42874,42876,2,42879,42887,2,42892,42894,2,42897,42899,2,42900,42901,1,42903,42921,2,42927,42933,6,42935,42947,2,42952,42954,2,42957,42961,4,42963,42971,2,42998,43002,4,43824,43866,1,43872,43880,1,43888,43967,1,64256,64262,1,64275,64279,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,119834,119859,1,119886,119892,1,119894,119911,1,119938,119963,1,119990,119993,1,119995,119997,2,119998,120003,1,120005,120015,1,120042,120067,1,120094,120119,1,120146,120171,1,120198,120223,1,120250,120275,1,120302,120327,1,120354,120379,1,120406,120431,1,120458,120485,1,120514,120538,1,120540,120545,1,120572,120596,1,120598,120603,1,120630,120654,1,120656,120661,1,120688,120712,1,120714,120719,1,120746,120770,1,120772,120777,1,120779,122624,1845,122625,122633,1,122635,122654,1,122661,122666,1,125218,125251,1]));static foldLl=new N(new Uint32Array([65,90,1,192,214,1,216,222,1,256,302,2,306,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,453,1,455,456,1,458,459,1,461,475,2,478,494,2,497,498,1,500,502,2,503,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,837,880,43,882,886,4,895,902,7,904,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,984,9,986,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8072,8079,1,8088,8095,1,8104,8111,1,8120,8124,1,8136,8140,1,8152,8155,1,8168,8172,1,8184,8188,1,8486,8490,4,8491,8498,7,8579,11264,2685,11265,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,125184,125217,1]));static Lm=new N(new Uint32Array([688,705,1,710,721,1,736,740,1,748,750,2,884,890,6,1369,1600,231,1765,1766,1,2036,2037,1,2042,2074,32,2084,2088,4,2249,2417,168,3654,3782,128,4348,6103,1755,6211,6823,612,7288,7293,1,7468,7530,1,7544,7579,35,7580,7615,1,8305,8319,14,8336,8348,1,11388,11389,1,11631,11823,192,12293,12337,44,12338,12341,1,12347,12445,98,12446,12540,94,12541,12542,1,40981,42232,1251,42233,42237,1,42508,42623,115,42652,42653,1,42775,42783,1,42864,42888,24,42994,42996,1,43e3,43001,1,43471,43494,23,43632,43741,109,43763,43764,1,43868,43871,1,43881,65392,21511,65438,65439,1,67456,67461,1,67463,67504,1,67506,67514,1,68942,68975,33,92992,92995,1,93504,93506,1,93547,93548,1,94099,94111,1,94176,94177,1,94179,110576,16397,110577,110579,1,110581,110587,1,110589,110590,1,122928,122989,1,123191,123197,1,124139,125259,1120]));static Lo=new N(new Uint32Array([170,186,16,443,448,5,449,451,1,660,1488,828,1489,1514,1,1519,1522,1,1568,1599,1,1601,1610,1,1646,1647,1,1649,1747,1,1749,1774,25,1775,1786,11,1787,1788,1,1791,1808,17,1810,1839,1,1869,1957,1,1969,1994,25,1995,2026,1,2048,2069,1,2112,2136,1,2144,2154,1,2160,2183,1,2185,2190,1,2208,2248,1,2308,2361,1,2365,2384,19,2392,2401,1,2418,2432,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2493,2510,17,2524,2525,1,2527,2529,1,2544,2545,1,2556,2565,9,2566,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2649,2652,1,2654,2674,20,2675,2676,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2749,2768,19,2784,2785,1,2809,2821,12,2822,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2877,2908,31,2909,2911,2,2912,2913,1,2929,2947,18,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3024,3077,53,3078,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3133,3160,27,3161,3162,1,3165,3168,3,3169,3200,31,3205,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3261,3293,32,3294,3296,2,3297,3313,16,3314,3332,18,3333,3340,1,3342,3344,1,3346,3386,1,3389,3406,17,3412,3414,1,3423,3425,1,3450,3455,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3585,3632,1,3634,3635,1,3648,3653,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3760,1,3762,3763,1,3773,3776,3,3777,3780,1,3804,3807,1,3840,3904,64,3905,3911,1,3913,3948,1,3976,3980,1,4096,4138,1,4159,4176,17,4177,4181,1,4186,4189,1,4193,4197,4,4198,4206,8,4207,4208,1,4213,4225,1,4238,4352,114,4353,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4992,5007,1,5121,5740,1,5743,5759,1,5761,5786,1,5792,5866,1,5873,5880,1,5888,5905,1,5919,5937,1,5952,5969,1,5984,5996,1,5998,6e3,1,6016,6067,1,6108,6176,68,6177,6210,1,6212,6264,1,6272,6276,1,6279,6312,1,6314,6320,6,6321,6389,1,6400,6430,1,6480,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6656,6678,1,6688,6740,1,6917,6963,1,6981,6988,1,7043,7072,1,7086,7087,1,7098,7141,1,7168,7203,1,7245,7247,1,7258,7287,1,7401,7404,1,7406,7411,1,7413,7414,1,7418,8501,1083,8502,8504,1,11568,11623,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,12294,12348,54,12353,12438,1,12447,12449,2,12450,12538,1,12543,12549,6,12550,12591,1,12593,12686,1,12704,12735,1,12784,12799,1,13312,19903,1,19968,40980,1,40982,42124,1,42192,42231,1,42240,42507,1,42512,42527,1,42538,42539,1,42606,42656,50,42657,42725,1,42895,42999,104,43003,43009,1,43011,43013,1,43015,43018,1,43020,43042,1,43072,43123,1,43138,43187,1,43250,43255,1,43259,43261,2,43262,43274,12,43275,43301,1,43312,43334,1,43360,43388,1,43396,43442,1,43488,43492,1,43495,43503,1,43514,43518,1,43520,43560,1,43584,43586,1,43588,43595,1,43616,43631,1,43633,43638,1,43642,43646,4,43647,43695,1,43697,43701,4,43702,43705,3,43706,43709,1,43712,43714,2,43739,43740,1,43744,43754,1,43762,43777,15,43778,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43968,44002,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64285,64287,2,64288,64296,1,64298,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64433,1,64467,64829,1,64848,64911,1,64914,64967,1,65008,65019,1,65136,65140,1,65142,65276,1,65382,65391,1,65393,65437,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,66176,66204,1,66208,66256,1,66304,66335,1,66349,66368,1,66370,66377,1,66384,66421,1,66432,66461,1,66464,66499,1,66504,66511,1,66640,66717,1,66816,66855,1,66864,66915,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67680,67702,1,67712,67742,1,67808,67826,1,67828,67829,1,67840,67861,1,67872,67897,1,67968,68023,1,68030,68031,1,68096,68112,16,68113,68115,1,68117,68119,1,68121,68149,1,68192,68220,1,68224,68252,1,68288,68295,1,68297,68324,1,68352,68405,1,68416,68437,1,68448,68466,1,68480,68497,1,68608,68680,1,68864,68899,1,68938,68941,1,68943,69248,305,69249,69289,1,69296,69297,1,69314,69316,1,69376,69404,1,69415,69424,9,69425,69445,1,69488,69505,1,69552,69572,1,69600,69622,1,69635,69687,1,69745,69746,1,69749,69763,14,69764,69807,1,69840,69864,1,69891,69926,1,69956,69959,3,69968,70002,1,70006,70019,13,70020,70066,1,70081,70084,1,70106,70108,2,70144,70161,1,70163,70187,1,70207,70208,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70312,1,70320,70366,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70461,70480,19,70493,70497,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70609,26,70611,70656,45,70657,70708,1,70727,70730,1,70751,70753,1,70784,70831,1,70852,70853,1,70855,71040,185,71041,71086,1,71128,71131,1,71168,71215,1,71236,71296,60,71297,71338,1,71352,71424,72,71425,71450,1,71488,71494,1,71680,71723,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71983,1,71999,72001,2,72096,72103,1,72106,72144,1,72161,72163,2,72192,72203,11,72204,72242,1,72250,72272,22,72284,72329,1,72349,72368,19,72369,72440,1,72640,72672,1,72704,72712,1,72714,72750,1,72768,72818,50,72819,72847,1,72960,72966,1,72968,72969,1,72971,73008,1,73030,73056,26,73057,73061,1,73063,73064,1,73066,73097,1,73112,73440,328,73441,73458,1,73474,73476,2,73477,73488,1,73490,73523,1,73648,73728,80,73729,74649,1,74880,75075,1,77712,77808,1,77824,78895,1,78913,78918,1,78944,82938,1,82944,83526,1,90368,90397,1,92160,92728,1,92736,92766,1,92784,92862,1,92880,92909,1,92928,92975,1,93027,93047,1,93053,93071,1,93507,93546,1,93952,94026,1,94032,94208,176,94209,100343,1,100352,101589,1,101631,101640,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,122634,123136,502,123137,123180,1,123214,123536,322,123537,123565,1,123584,123627,1,124112,124138,1,124368,124397,1,124400,124896,496,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Lt=new N(new Uint32Array([453,459,3,498,8072,7574,8073,8079,1,8088,8095,1,8104,8111,1,8124,8140,16,8188,8188,1]));static foldLt=new N(new Uint32Array([452,454,2,455,457,2,458,460,2,497,499,2,8064,8071,1,8080,8087,1,8096,8103,1,8115,8131,16,8179,8179,1]));static Lu=new N(new Uint32Array([65,90,1,192,214,1,216,222,1,256,310,2,313,327,2,330,376,2,377,381,2,385,386,1,388,390,2,391,393,2,394,395,1,398,401,1,403,404,1,406,408,1,412,413,1,415,416,1,418,422,2,423,425,2,428,430,2,431,433,2,434,435,1,437,439,2,440,444,4,452,461,3,463,475,2,478,494,2,497,500,3,502,504,1,506,562,2,570,571,1,573,574,1,577,579,2,580,582,1,584,590,2,880,882,2,886,895,9,902,904,2,905,906,1,908,910,2,911,913,2,914,929,1,931,939,1,975,978,3,979,980,1,984,1006,2,1012,1015,3,1017,1018,1,1021,1071,1,1120,1152,2,1162,1216,2,1217,1229,2,1232,1326,2,1329,1366,1,4256,4293,1,4295,4301,6,5024,5109,1,7305,7312,7,7313,7354,1,7357,7359,1,7680,7828,2,7838,7934,2,7944,7951,1,7960,7965,1,7976,7983,1,7992,7999,1,8008,8013,1,8025,8031,2,8040,8047,1,8120,8123,1,8136,8139,1,8152,8155,1,8168,8172,1,8184,8187,1,8450,8455,5,8459,8461,1,8464,8466,1,8469,8473,4,8474,8477,1,8484,8490,2,8491,8493,1,8496,8499,1,8510,8511,1,8517,8579,62,11264,11311,1,11360,11362,2,11363,11364,1,11367,11373,2,11374,11376,1,11378,11381,3,11390,11392,1,11394,11490,2,11499,11501,2,11506,42560,31054,42562,42604,2,42624,42650,2,42786,42798,2,42802,42862,2,42873,42877,2,42878,42886,2,42891,42893,2,42896,42898,2,42902,42922,2,42923,42926,1,42928,42932,1,42934,42948,2,42949,42951,1,42953,42955,2,42956,42960,4,42966,42972,2,42997,65313,22316,65314,65338,1,66560,66599,1,66736,66771,1,66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,68736,68786,1,68944,68965,1,71840,71871,1,93760,93791,1,119808,119833,1,119860,119885,1,119912,119937,1,119964,119966,2,119967,119973,3,119974,119977,3,119978,119980,1,119982,119989,1,120016,120041,1,120068,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120120,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120172,120197,1,120224,120249,1,120276,120301,1,120328,120353,1,120380,120405,1,120432,120457,1,120488,120512,1,120546,120570,1,120604,120628,1,120662,120686,1,120720,120744,1,120778,125184,4406,125185,125217,1]));static Upper=this.Lu;static foldLu=new N(new Uint32Array([97,122,1,181,223,42,224,246,1,248,255,1,257,303,2,307,311,2,314,328,2,331,375,2,378,382,2,383,384,1,387,389,2,392,396,4,402,405,3,409,411,1,414,417,3,419,421,2,424,429,5,432,436,4,438,441,3,445,447,2,453,454,1,456,457,1,459,460,1,462,476,2,477,495,2,498,499,1,501,505,4,507,543,2,547,563,2,572,575,3,576,578,2,583,591,2,592,596,1,598,599,1,601,603,2,604,608,4,609,611,2,612,614,1,616,620,1,623,625,2,626,629,3,637,640,3,642,643,1,647,652,1,658,669,11,670,837,167,881,883,2,887,891,4,892,893,1,940,943,1,945,974,1,976,977,1,981,983,1,985,1007,2,1008,1011,1,1013,1019,3,1072,1119,1,1121,1153,2,1163,1215,2,1218,1230,2,1231,1327,2,1377,1414,1,4304,4346,1,4349,4351,1,5112,5117,1,7296,7304,1,7306,7545,239,7549,7566,17,7681,7829,2,7835,7841,6,7843,7935,2,7936,7943,1,7952,7957,1,7968,7975,1,7984,7991,1,8e3,8005,1,8017,8023,2,8032,8039,1,8048,8061,1,8112,8113,1,8126,8144,18,8145,8160,15,8161,8165,4,8526,8580,54,11312,11359,1,11361,11365,4,11366,11372,2,11379,11382,3,11393,11491,2,11500,11502,2,11507,11520,13,11521,11557,1,11559,11565,6,42561,42605,2,42625,42651,2,42787,42799,2,42803,42863,2,42874,42876,2,42879,42887,2,42892,42897,5,42899,42900,1,42903,42921,2,42933,42947,2,42952,42954,2,42957,42961,4,42967,42971,2,42998,43859,861,43888,43967,1,65345,65370,1,66600,66639,1,66776,66811,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,68800,68850,1,68976,68997,1,71872,71903,1,93792,93823,1,125218,125251,1]));static M=new N(new Uint32Array([768,879,1,1155,1161,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2307,1,2362,2364,1,2366,2383,1,2385,2391,1,2402,2403,1,2433,2435,1,2492,2494,2,2495,2500,1,2503,2504,1,2507,2509,1,2519,2530,11,2531,2558,27,2561,2563,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2672,31,2673,2677,4,2689,2691,1,2748,2750,2,2751,2757,1,2759,2761,1,2763,2765,1,2786,2787,1,2810,2815,1,2817,2819,1,2876,2878,2,2879,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2914,2915,1,2946,3006,60,3007,3010,1,3014,3016,1,3018,3021,1,3031,3072,41,3073,3076,1,3132,3134,2,3135,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3203,1,3260,3262,2,3263,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3298,3299,1,3315,3328,13,3329,3331,1,3387,3388,1,3390,3396,1,3398,3400,1,3402,3405,1,3415,3426,11,3427,3457,30,3458,3459,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3570,3571,1,3633,3636,3,3637,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3902,3903,1,3953,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4139,101,4140,4158,1,4182,4185,1,4190,4192,1,4194,4196,1,4199,4205,1,4209,4212,1,4226,4237,1,4239,4250,11,4251,4253,1,4957,4959,1,5906,5909,1,5938,5940,1,5970,5971,1,6002,6003,1,6068,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6443,1,6448,6459,1,6679,6683,1,6741,6750,1,6752,6780,1,6783,6832,49,6833,6862,1,6912,6916,1,6964,6980,1,7019,7027,1,7040,7042,1,7073,7085,1,7142,7155,1,7204,7223,1,7376,7378,1,7380,7400,1,7405,7412,7,7415,7417,1,7616,7679,1,8400,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12335,1,12441,12442,1,42607,42610,1,42612,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43043,24,43044,43047,1,43052,43136,84,43137,43188,51,43189,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43347,1,43392,43395,1,43443,43456,1,43493,43561,68,43562,43574,1,43587,43596,9,43597,43643,46,43644,43645,1,43696,43698,2,43699,43700,1,43703,43704,1,43710,43711,1,43713,43755,42,43756,43759,1,43765,43766,1,44003,44010,1,44012,44013,1,64286,65024,738,65025,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69632,69634,1,69688,69702,1,69744,69747,3,69748,69759,11,69760,69762,1,69808,69818,1,69826,69888,62,69889,69890,1,69927,69940,1,69957,69958,1,70003,70016,13,70017,70018,1,70067,70080,1,70089,70092,1,70094,70095,1,70188,70199,1,70206,70209,3,70367,70378,1,70400,70403,1,70459,70460,1,70462,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70502,3,70503,70508,1,70512,70516,1,70584,70592,1,70594,70597,3,70599,70602,1,70604,70608,1,70610,70625,15,70626,70709,83,70710,70726,1,70750,70832,82,70833,70851,1,71087,71093,1,71096,71104,1,71132,71133,1,71216,71232,1,71339,71351,1,71453,71467,1,71724,71738,1,71984,71989,1,71991,71992,1,71995,71998,1,72e3,72002,2,72003,72145,142,72146,72151,1,72154,72160,1,72164,72193,29,72194,72202,1,72243,72249,1,72251,72254,1,72263,72273,10,72274,72283,1,72330,72345,1,72751,72758,1,72760,72767,1,72850,72871,1,72873,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73098,67,73099,73102,1,73104,73105,1,73107,73111,1,73459,73462,1,73472,73473,1,73475,73524,49,73525,73530,1,73534,73538,1,73562,78912,5350,78919,78933,1,90398,90415,1,92912,92916,1,92976,92982,1,94031,94033,2,94034,94087,1,94095,94098,1,94180,94192,12,94193,113821,19628,113822,118528,4706,118529,118573,1,118576,118598,1,119141,119145,1,119149,119154,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldM=new N(new Uint32Array([921,953,32,8126,8126,1]));static Mc=new N(new Uint32Array([2307,2363,56,2366,2368,1,2377,2380,1,2382,2383,1,2434,2435,1,2494,2496,1,2503,2504,1,2507,2508,1,2519,2563,44,2622,2624,1,2691,2750,59,2751,2752,1,2761,2763,2,2764,2818,54,2819,2878,59,2880,2887,7,2888,2891,3,2892,2903,11,3006,3007,1,3009,3010,1,3014,3016,1,3018,3020,1,3031,3073,42,3074,3075,1,3137,3140,1,3202,3203,1,3262,3264,2,3265,3268,1,3271,3272,1,3274,3275,1,3285,3286,1,3315,3330,15,3331,3390,59,3391,3392,1,3398,3400,1,3402,3404,1,3415,3458,43,3459,3535,76,3536,3537,1,3544,3551,1,3570,3571,1,3902,3903,1,3967,4139,172,4140,4145,5,4152,4155,3,4156,4182,26,4183,4194,11,4195,4196,1,4199,4205,1,4227,4228,1,4231,4236,1,4239,4250,11,4251,4252,1,5909,5940,31,6070,6078,8,6079,6085,1,6087,6088,1,6435,6438,1,6441,6443,1,6448,6449,1,6451,6456,1,6681,6682,1,6741,6743,2,6753,6755,2,6756,6765,9,6766,6770,1,6916,6965,49,6971,6973,2,6974,6977,1,6979,6980,1,7042,7073,31,7078,7079,1,7082,7143,61,7146,7148,1,7150,7154,4,7155,7204,49,7205,7211,1,7220,7221,1,7393,7415,22,12334,12335,1,43043,43044,1,43047,43136,89,43137,43188,51,43189,43203,1,43346,43347,1,43395,43444,49,43445,43450,5,43451,43454,3,43455,43456,1,43567,43568,1,43571,43572,1,43597,43643,46,43645,43755,110,43758,43759,1,43765,44003,238,44004,44006,2,44007,44009,2,44010,44012,2,69632,69634,2,69762,69808,46,69809,69810,1,69815,69816,1,69932,69957,25,69958,70018,60,70067,70069,1,70079,70080,1,70094,70188,94,70189,70190,1,70194,70195,1,70197,70368,171,70369,70370,1,70402,70403,1,70462,70463,1,70465,70468,1,70471,70472,1,70475,70477,1,70487,70498,11,70499,70584,85,70585,70586,1,70594,70597,3,70599,70602,1,70604,70605,1,70607,70709,102,70710,70711,1,70720,70721,1,70725,70832,107,70833,70834,1,70841,70843,2,70844,70846,1,70849,71087,238,71088,71089,1,71096,71099,1,71102,71216,114,71217,71218,1,71227,71228,1,71230,71340,110,71342,71343,1,71350,71454,104,71456,71457,1,71462,71724,262,71725,71726,1,71736,71984,248,71985,71989,1,71991,71992,1,71997,72e3,3,72002,72145,143,72146,72147,1,72156,72159,1,72164,72249,85,72279,72280,1,72343,72751,408,72766,72873,107,72881,72884,3,73098,73102,1,73107,73108,1,73110,73461,351,73462,73475,13,73524,73525,1,73534,73535,1,73537,90410,16873,90411,90412,1,94033,94087,1,94192,94193,1,119141,119142,1,119149,119154,1]));static Me=new N(new Uint32Array([1160,1161,1,6846,8413,1567,8414,8416,1,8418,8420,1,42608,42610,1]));static Mn=new N(new Uint32Array([768,879,1,1155,1159,1,1425,1469,1,1471,1473,2,1474,1476,2,1477,1479,2,1552,1562,1,1611,1631,1,1648,1750,102,1751,1756,1,1759,1764,1,1767,1768,1,1770,1773,1,1809,1840,31,1841,1866,1,1958,1968,1,2027,2035,1,2045,2070,25,2071,2073,1,2075,2083,1,2085,2087,1,2089,2093,1,2137,2139,1,2199,2207,1,2250,2273,1,2275,2306,1,2362,2364,2,2369,2376,1,2381,2385,4,2386,2391,1,2402,2403,1,2433,2492,59,2497,2500,1,2509,2530,21,2531,2558,27,2561,2562,1,2620,2625,5,2626,2631,5,2632,2635,3,2636,2637,1,2641,2672,31,2673,2677,4,2689,2690,1,2748,2753,5,2754,2757,1,2759,2760,1,2765,2786,21,2787,2810,23,2811,2815,1,2817,2876,59,2879,2881,2,2882,2884,1,2893,2901,8,2902,2914,12,2915,2946,31,3008,3021,13,3072,3076,4,3132,3134,2,3135,3136,1,3142,3144,1,3146,3149,1,3157,3158,1,3170,3171,1,3201,3260,59,3263,3270,7,3276,3277,1,3298,3299,1,3328,3329,1,3387,3388,1,3393,3396,1,3405,3426,21,3427,3457,30,3530,3538,8,3539,3540,1,3542,3633,91,3636,3642,1,3655,3662,1,3761,3764,3,3765,3772,1,3784,3790,1,3864,3865,1,3893,3897,2,3953,3966,1,3968,3972,1,3974,3975,1,3981,3991,1,3993,4028,1,4038,4141,103,4142,4144,1,4146,4151,1,4153,4154,1,4157,4158,1,4184,4185,1,4190,4192,1,4209,4212,1,4226,4229,3,4230,4237,7,4253,4957,704,4958,4959,1,5906,5908,1,5938,5939,1,5970,5971,1,6002,6003,1,6068,6069,1,6071,6077,1,6086,6089,3,6090,6099,1,6109,6155,46,6156,6157,1,6159,6277,118,6278,6313,35,6432,6434,1,6439,6440,1,6450,6457,7,6458,6459,1,6679,6680,1,6683,6742,59,6744,6750,1,6752,6754,2,6757,6764,1,6771,6780,1,6783,6832,49,6833,6845,1,6847,6862,1,6912,6915,1,6964,6966,2,6967,6970,1,6972,6978,6,7019,7027,1,7040,7041,1,7074,7077,1,7080,7081,1,7083,7085,1,7142,7144,2,7145,7149,4,7151,7153,1,7212,7219,1,7222,7223,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8400,8412,1,8417,8421,4,8422,8432,1,11503,11505,1,11647,11744,97,11745,11775,1,12330,12333,1,12441,12442,1,42607,42612,5,42613,42621,1,42654,42655,1,42736,42737,1,43010,43014,4,43019,43045,26,43046,43052,6,43204,43205,1,43232,43249,1,43263,43302,39,43303,43309,1,43335,43345,1,43392,43394,1,43443,43446,3,43447,43449,1,43452,43453,1,43493,43561,68,43562,43566,1,43569,43570,1,43573,43574,1,43587,43596,9,43644,43696,52,43698,43700,1,43703,43704,1,43710,43711,1,43713,43756,43,43757,43766,9,44005,44008,3,44013,64286,20273,65024,65039,1,65056,65071,1,66045,66272,227,66422,66426,1,68097,68099,1,68101,68102,1,68108,68111,1,68152,68154,1,68159,68325,166,68326,68900,574,68901,68903,1,68969,68973,1,69291,69292,1,69372,69375,1,69446,69456,1,69506,69509,1,69633,69688,55,69689,69702,1,69744,69747,3,69748,69759,11,69760,69761,1,69811,69814,1,69817,69818,1,69826,69888,62,69889,69890,1,69927,69931,1,69933,69940,1,70003,70016,13,70017,70070,53,70071,70078,1,70089,70092,1,70095,70191,96,70192,70193,1,70196,70198,2,70199,70206,7,70209,70367,158,70371,70378,1,70400,70401,1,70459,70460,1,70464,70502,38,70503,70508,1,70512,70516,1,70587,70592,1,70606,70610,2,70625,70626,1,70712,70719,1,70722,70724,1,70726,70750,24,70835,70840,1,70842,70847,5,70848,70850,2,70851,71090,239,71091,71093,1,71100,71101,1,71103,71104,1,71132,71133,1,71219,71226,1,71229,71231,2,71232,71339,107,71341,71344,3,71345,71349,1,71351,71453,102,71455,71458,3,71459,71461,1,71463,71467,1,71727,71735,1,71737,71738,1,71995,71996,1,71998,72003,5,72148,72151,1,72154,72155,1,72160,72193,33,72194,72202,1,72243,72248,1,72251,72254,1,72263,72273,10,72274,72278,1,72281,72283,1,72330,72342,1,72344,72345,1,72752,72758,1,72760,72765,1,72767,72850,83,72851,72871,1,72874,72880,1,72882,72883,1,72885,72886,1,73009,73014,1,73018,73020,2,73021,73023,2,73024,73029,1,73031,73104,73,73105,73109,4,73111,73459,348,73460,73472,12,73473,73526,53,73527,73530,1,73536,73538,2,73562,78912,5350,78919,78933,1,90398,90409,1,90413,90415,1,92912,92916,1,92976,92982,1,94031,94095,64,94096,94098,1,94180,113821,19641,113822,118528,4706,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,119362,119364,1,121344,121398,1,121403,121452,1,121461,121476,15,121499,121503,1,121505,121519,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,123023,123184,161,123185,123190,1,123566,123628,62,123629,123631,1,124140,124143,1,124398,124399,1,125136,125142,1,125252,125258,1,917760,917999,1]));static foldMn=new N(new Uint32Array([921,953,32,8126,8126,1]));static N=new N(new Uint32Array([48,57,1,178,179,1,185,188,3,189,190,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2548,2553,1,2662,2671,1,2790,2799,1,2918,2927,1,2930,2935,1,3046,3058,1,3174,3183,1,3192,3198,1,3302,3311,1,3416,3422,1,3430,3448,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3891,1,4160,4169,1,4240,4249,1,4969,4988,1,5870,5872,1,6112,6121,1,6128,6137,1,6160,6169,1,6470,6479,1,6608,6618,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,8304,8308,4,8309,8313,1,8320,8329,1,8528,8578,1,8581,8585,1,9312,9371,1,9450,9471,1,10102,10131,1,11517,12295,778,12321,12329,1,12344,12346,1,12690,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,42528,42537,1,42726,42735,1,43056,43061,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,65799,65843,1,65856,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,66369,66378,9,66513,66517,1,66720,66729,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,68912,68921,1,68928,68937,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70113,70132,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71483,1,71904,71922,1,72016,72025,1,72688,72697,1,72784,72812,1,73040,73049,1,73120,73129,1,73552,73561,1,73664,73684,1,74752,74862,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93019,93025,1,93552,93561,1,93824,93846,1,118e3,118009,1,119488,119507,1,119520,119539,1,119648,119672,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125127,125135,1,125264,125273,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1,130032,130041,1]));static Nd=new N(new Uint32Array([48,57,1,1632,1641,1,1776,1785,1,1984,1993,1,2406,2415,1,2534,2543,1,2662,2671,1,2790,2799,1,2918,2927,1,3046,3055,1,3174,3183,1,3302,3311,1,3430,3439,1,3558,3567,1,3664,3673,1,3792,3801,1,3872,3881,1,4160,4169,1,4240,4249,1,6112,6121,1,6160,6169,1,6470,6479,1,6608,6617,1,6784,6793,1,6800,6809,1,6992,7001,1,7088,7097,1,7232,7241,1,7248,7257,1,42528,42537,1,43216,43225,1,43264,43273,1,43472,43481,1,43504,43513,1,43600,43609,1,44016,44025,1,65296,65305,1,66720,66729,1,68912,68921,1,68928,68937,1,69734,69743,1,69872,69881,1,69942,69951,1,70096,70105,1,70384,70393,1,70736,70745,1,70864,70873,1,71248,71257,1,71360,71369,1,71376,71395,1,71472,71481,1,71904,71913,1,72016,72025,1,72688,72697,1,72784,72793,1,73040,73049,1,73120,73129,1,73552,73561,1,90416,90425,1,92768,92777,1,92864,92873,1,93008,93017,1,93552,93561,1,118e3,118009,1,120782,120831,1,123200,123209,1,123632,123641,1,124144,124153,1,124401,124410,1,125264,125273,1,130032,130041,1]));static Nl=new N(new Uint32Array([5870,5872,1,8544,8578,1,8581,8584,1,12295,12321,26,12322,12329,1,12344,12346,1,42726,42735,1,65856,65908,1,66369,66378,9,66513,66517,1,74752,74862,1]));static No=new N(new Uint32Array([178,179,1,185,188,3,189,190,1,2548,2553,1,2930,2935,1,3056,3058,1,3192,3198,1,3416,3422,1,3440,3448,1,3882,3891,1,4969,4988,1,6128,6137,1,6618,8304,1686,8308,8313,1,8320,8329,1,8528,8543,1,8585,9312,727,9313,9371,1,9450,9471,1,10102,10131,1,11517,12690,1173,12691,12693,1,12832,12841,1,12872,12879,1,12881,12895,1,12928,12937,1,12977,12991,1,43056,43061,1,65799,65843,1,65909,65912,1,65930,65931,1,66273,66299,1,66336,66339,1,67672,67679,1,67705,67711,1,67751,67759,1,67835,67839,1,67862,67867,1,68028,68029,1,68032,68047,1,68050,68095,1,68160,68168,1,68221,68222,1,68253,68255,1,68331,68335,1,68440,68447,1,68472,68479,1,68521,68527,1,68858,68863,1,69216,69246,1,69405,69414,1,69457,69460,1,69573,69579,1,69714,69733,1,70113,70132,1,71482,71483,1,71914,71922,1,72794,72812,1,73664,73684,1,93019,93025,1,93824,93846,1,119488,119507,1,119520,119539,1,119648,119672,1,125127,125135,1,126065,126123,1,126125,126127,1,126129,126132,1,126209,126253,1,126255,126269,1,127232,127244,1]));static P=new N(new Uint32Array([33,35,1,37,42,1,44,47,1,58,59,1,63,64,1,91,93,1,95,123,28,125,161,36,167,171,4,182,183,1,187,191,4,894,903,9,1370,1375,1,1417,1418,1,1470,1472,2,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3898,38,3899,3901,1,3973,4048,75,4049,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5120,5742,622,5787,5788,1,5867,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8208,829,8209,8231,1,8240,8259,1,8261,8273,1,8275,8286,1,8317,8318,1,8333,8334,1,8968,8971,1,9001,9002,1,10088,10101,1,10181,10182,1,10214,10223,1,10627,10648,1,10712,10715,1,10748,10749,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11822,1,11824,11855,1,11858,11869,1,12289,12291,1,12296,12305,1,12308,12319,1,12336,12349,13,12448,12539,91,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,64830,20819,64831,65040,209,65041,65049,1,65072,65106,1,65108,65121,1,65123,65128,5,65130,65131,1,65281,65283,1,65285,65290,1,65292,65295,1,65306,65307,1,65311,65312,1,65339,65341,1,65343,65371,28,65373,65375,2,65376,65381,1,65792,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,68974,69293,319,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Pc=new N(new Uint32Array([95,8255,8160,8256,8276,20,65075,65076,1,65101,65103,1,65343,65343,1]));static Pd=new N(new Uint32Array([45,1418,1373,1470,5120,3650,6150,8208,2058,8209,8213,1,11799,11802,3,11834,11835,1,11840,11869,29,12316,12336,20,12448,65073,52625,65074,65112,38,65123,65293,170,68974,69293,319]));static Pe=new N(new Uint32Array([41,93,52,125,3899,3774,3901,5788,1887,8262,8318,56,8334,8969,635,8971,9002,31,10089,10101,2,10182,10215,33,10217,10223,2,10628,10648,2,10713,10715,2,10749,11811,1062,11813,11817,2,11862,11868,2,12297,12305,2,12309,12315,2,12318,12319,1,64830,65048,218,65078,65092,2,65096,65114,18,65116,65118,2,65289,65341,52,65373,65379,3]));static Pf=new N(new Uint32Array([187,8217,8030,8221,8250,29,11779,11781,2,11786,11789,3,11805,11809,4]));static Pi=new N(new Uint32Array([171,8216,8045,8219,8220,1,8223,8249,26,11778,11780,2,11785,11788,3,11804,11808,4]));static Po=new N(new Uint32Array([33,35,1,37,39,1,42,46,2,47,58,11,59,63,4,64,92,28,161,167,6,182,183,1,191,894,703,903,1370,467,1371,1375,1,1417,1472,55,1475,1478,3,1523,1524,1,1545,1546,1,1548,1549,1,1563,1565,2,1566,1567,1,1642,1645,1,1748,1792,44,1793,1805,1,2039,2041,1,2096,2110,1,2142,2404,262,2405,2416,11,2557,2678,121,2800,3191,391,3204,3572,368,3663,3674,11,3675,3844,169,3845,3858,1,3860,3973,113,4048,4052,1,4057,4058,1,4170,4175,1,4347,4960,613,4961,4968,1,5742,5867,125,5868,5869,1,5941,5942,1,6100,6102,1,6104,6106,1,6144,6149,1,6151,6154,1,6468,6469,1,6686,6687,1,6816,6822,1,6824,6829,1,6990,6991,1,7002,7008,1,7037,7039,1,7164,7167,1,7227,7231,1,7294,7295,1,7360,7367,1,7379,8214,835,8215,8224,9,8225,8231,1,8240,8248,1,8251,8254,1,8257,8259,1,8263,8273,1,8275,8277,2,8278,8286,1,11513,11516,1,11518,11519,1,11632,11776,144,11777,11782,5,11783,11784,1,11787,11790,3,11791,11798,1,11800,11801,1,11803,11806,3,11807,11818,11,11819,11822,1,11824,11833,1,11836,11839,1,11841,11843,2,11844,11855,1,11858,11860,1,12289,12291,1,12349,12539,190,42238,42239,1,42509,42511,1,42611,42622,11,42738,42743,1,43124,43127,1,43214,43215,1,43256,43258,1,43260,43310,50,43311,43359,48,43457,43469,1,43486,43487,1,43612,43615,1,43742,43743,1,43760,43761,1,44011,65040,21029,65041,65046,1,65049,65072,23,65093,65094,1,65097,65100,1,65104,65106,1,65108,65111,1,65119,65121,1,65128,65130,2,65131,65281,150,65282,65283,1,65285,65287,1,65290,65294,2,65295,65306,11,65307,65311,4,65312,65340,28,65377,65380,3,65381,65792,411,65793,65794,1,66463,66512,49,66927,67671,744,67871,67903,32,68176,68184,1,68223,68336,113,68337,68342,1,68409,68415,1,68505,68508,1,69461,69465,1,69510,69513,1,69703,69709,1,69819,69820,1,69822,69825,1,69952,69955,1,70004,70005,1,70085,70088,1,70093,70107,14,70109,70111,1,70200,70205,1,70313,70612,299,70613,70615,2,70616,70731,115,70732,70735,1,70746,70747,1,70749,70854,105,71105,71127,1,71233,71235,1,71264,71276,1,71353,71484,131,71485,71486,1,71739,72004,265,72005,72006,1,72162,72255,93,72256,72262,1,72346,72348,1,72350,72354,1,72448,72457,1,72673,72769,96,72770,72773,1,72816,72817,1,73463,73464,1,73539,73551,1,73727,74864,1137,74865,74868,1,77809,77810,1,92782,92783,1,92917,92983,66,92984,92987,1,92996,93549,553,93550,93551,1,93847,93850,1,94178,113823,19645,121479,121483,1,124415,125278,863,125279,125279,1]));static Ps=new N(new Uint32Array([40,91,51,123,3898,3775,3900,5787,1887,8218,8222,4,8261,8317,56,8333,8968,635,8970,9001,31,10088,10100,2,10181,10214,33,10216,10222,2,10627,10647,2,10712,10714,2,10748,11810,1062,11812,11816,2,11842,11861,19,11863,11867,2,12296,12304,2,12308,12314,2,12317,64831,52514,65047,65077,30,65079,65091,2,65095,65113,18,65115,65117,2,65288,65339,51,65371,65375,4,65378,65378,1]));static S=new N(new Uint32Array([36,43,7,60,62,1,94,96,2,124,126,2,162,166,1,168,169,1,172,174,2,175,177,1,180,184,4,215,247,32,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,1014,113,1154,1421,267,1422,1423,1,1542,1544,1,1547,1550,3,1551,1758,207,1769,1789,20,1790,2038,248,2046,2047,1,2184,2546,362,2547,2554,7,2555,2801,246,2928,3059,131,3060,3066,1,3199,3407,208,3449,3647,198,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6107,366,6464,6622,158,6623,6655,1,7009,7018,1,7028,7036,1,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,8260,8274,14,8314,8316,1,8330,8332,1,8352,8384,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8472,1,8478,8483,1,8485,8489,2,8494,8506,12,8507,8512,5,8513,8516,1,8522,8525,1,8527,8586,59,8587,8592,5,8593,8967,1,8972,9e3,1,9003,9257,1,9280,9290,1,9372,9449,1,9472,10087,1,10132,10180,1,10183,10213,1,10224,10626,1,10649,10711,1,10716,10747,1,10750,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12443,12444,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,42752,42774,1,42784,42785,1,42889,42890,1,43048,43051,1,43062,43065,1,43639,43641,1,43867,43882,15,43883,64297,20414,64434,64450,1,64832,64847,1,64975,65020,45,65021,65023,1,65122,65124,2,65125,65126,1,65129,65284,155,65291,65308,17,65309,65310,1,65342,65344,2,65372,65374,2,65504,65510,1,65512,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,69006,710,69007,71487,2480,73685,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,123647,432,126124,126128,4,126254,126704,450,126705,126976,271,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Sc=new N(new Uint32Array([36,162,126,163,165,1,1423,1547,124,2046,2047,1,2546,2547,1,2555,2801,246,3065,3647,582,6107,8352,2245,8353,8384,1,43064,65020,21956,65129,65284,155,65504,65505,1,65509,65510,1,73693,73696,1,123647,126128,2481]));static Sk=new N(new Uint32Array([94,96,2,168,175,7,180,184,4,706,709,1,722,735,1,741,747,1,749,751,2,752,767,1,885,900,15,901,2184,1283,8125,8127,2,8128,8129,1,8141,8143,1,8157,8159,1,8173,8175,1,8189,8190,1,12443,12444,1,42752,42774,1,42784,42785,1,42889,42890,1,43867,43882,15,43883,64434,20551,64435,64450,1,65342,65344,2,65507,127995,62488,127996,127999,1]));static Sm=new N(new Uint32Array([43,60,17,61,62,1,124,126,2,172,177,5,215,247,32,1014,1542,528,1543,1544,1,8260,8274,14,8314,8316,1,8330,8332,1,8472,8512,40,8513,8516,1,8523,8592,69,8593,8596,1,8602,8603,1,8608,8614,3,8622,8654,32,8655,8658,3,8660,8692,32,8693,8959,1,8992,8993,1,9084,9115,31,9116,9139,1,9180,9185,1,9655,9665,10,9720,9727,1,9839,10176,337,10177,10180,1,10183,10213,1,10224,10239,1,10496,10626,1,10649,10711,1,10716,10747,1,10750,11007,1,11056,11076,1,11079,11084,1,64297,65122,825,65124,65126,1,65291,65308,17,65309,65310,1,65372,65374,2,65506,65513,7,65514,65516,1,69006,69007,1,120513,120539,26,120571,120597,26,120629,120655,26,120687,120713,26,120745,120771,26,126704,126705,1]));static So=new N(new Uint32Array([166,169,3,174,176,2,1154,1421,267,1422,1550,128,1551,1758,207,1769,1789,20,1790,2038,248,2554,2928,374,3059,3064,1,3066,3199,133,3407,3449,42,3841,3843,1,3859,3861,2,3862,3863,1,3866,3871,1,3892,3896,2,4030,4037,1,4039,4044,1,4046,4047,1,4053,4056,1,4254,4255,1,5008,5017,1,5741,6464,723,6622,6655,1,7009,7018,1,7028,7036,1,8448,8449,1,8451,8454,1,8456,8457,1,8468,8470,2,8471,8478,7,8479,8483,1,8485,8489,2,8494,8506,12,8507,8522,15,8524,8525,1,8527,8586,59,8587,8597,10,8598,8601,1,8604,8607,1,8609,8610,1,8612,8613,1,8615,8621,1,8623,8653,1,8656,8657,1,8659,8661,2,8662,8691,1,8960,8967,1,8972,8991,1,8994,9e3,1,9003,9083,1,9085,9114,1,9140,9179,1,9186,9257,1,9280,9290,1,9372,9449,1,9472,9654,1,9656,9664,1,9666,9719,1,9728,9838,1,9840,10087,1,10132,10175,1,10240,10495,1,11008,11055,1,11077,11078,1,11085,11123,1,11126,11157,1,11159,11263,1,11493,11498,1,11856,11857,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12292,12306,14,12307,12320,13,12342,12343,1,12350,12351,1,12688,12689,1,12694,12703,1,12736,12773,1,12783,12800,17,12801,12830,1,12842,12871,1,12880,12896,16,12897,12927,1,12938,12976,1,12992,13311,1,19904,19967,1,42128,42182,1,43048,43051,1,43062,43063,1,43065,43639,574,43640,43641,1,64832,64847,1,64975,65021,46,65022,65023,1,65508,65512,4,65517,65518,1,65532,65533,1,65847,65855,1,65913,65929,1,65932,65934,1,65936,65948,1,65952,66e3,48,66001,66044,1,67703,67704,1,68296,71487,3191,73685,73692,1,73697,73713,1,92988,92991,1,92997,113820,20823,117760,117999,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119140,1,119146,119148,1,119171,119172,1,119180,119209,1,119214,119274,1,119296,119361,1,119365,119552,187,119553,119638,1,120832,121343,1,121399,121402,1,121453,121460,1,121462,121475,1,121477,121478,1,123215,126124,2909,126254,126976,722,126977,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127245,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,127994,1,128e3,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130031,1]));static Z=new N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8232,8233,1,8239,8287,48,12288,12288,1]));static Zl=new N(new Uint32Array([8232,8232,1]));static Zp=new N(new Uint32Array([8233,8233,1]));static Zs=new N(new Uint32Array([32,160,128,5760,8192,2432,8193,8202,1,8239,8287,48,12288,12288,1]));static Adlam=new N(new Uint32Array([125184,125259,1,125264,125273,1,125278,125279,1]));static Ahom=new N(new Uint32Array([71424,71450,1,71453,71467,1,71472,71494,1]));static Anatolian_Hieroglyphs=new N(new Uint32Array([82944,83526,1]));static Arabic=new N(new Uint32Array([1536,1540,1,1542,1547,1,1549,1562,1,1564,1566,1,1568,1599,1,1601,1610,1,1622,1647,1,1649,1756,1,1758,1791,1,1872,1919,1,2160,2190,1,2192,2193,1,2199,2273,1,2275,2303,1,64336,64450,1,64467,64829,1,64832,64911,1,64914,64967,1,64975,65008,33,65009,65023,1,65136,65140,1,65142,65276,1,69216,69246,1,69314,69316,1,69372,69375,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1]));static Armenian=new N(new Uint32Array([1329,1366,1,1369,1418,1,1421,1423,1,64275,64279,1]));static Avestan=new N(new Uint32Array([68352,68405,1,68409,68415,1]));static Balinese=new N(new Uint32Array([6912,6988,1,6990,7039,1]));static Bamum=new N(new Uint32Array([42656,42743,1,92160,92728,1]));static Bassa_Vah=new N(new Uint32Array([92880,92909,1,92912,92917,1]));static Batak=new N(new Uint32Array([7104,7155,1,7164,7167,1]));static Bengali=new N(new Uint32Array([2432,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1]));static Bhaiksuki=new N(new Uint32Array([72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1]));static Bopomofo=new N(new Uint32Array([746,747,1,12549,12591,1,12704,12735,1]));static Brahmi=new N(new Uint32Array([69632,69709,1,69714,69749,1,69759,69759,1]));static Braille=new N(new Uint32Array([10240,10495,1]));static Buginese=new N(new Uint32Array([6656,6683,1,6686,6687,1]));static Buhid=new N(new Uint32Array([5952,5971,1]));static Canadian_Aboriginal=new N(new Uint32Array([5120,5759,1,6320,6389,1,72368,72383,1]));static Carian=new N(new Uint32Array([66208,66256,1]));static Caucasian_Albanian=new N(new Uint32Array([66864,66915,1,66927,66927,1]));static Chakma=new N(new Uint32Array([69888,69940,1,69942,69959,1]));static Cham=new N(new Uint32Array([43520,43574,1,43584,43597,1,43600,43609,1,43612,43615,1]));static Cherokee=new N(new Uint32Array([5024,5109,1,5112,5117,1,43888,43967,1]));static Chorasmian=new N(new Uint32Array([69552,69579,1]));static Common=new N(new Uint32Array([0,64,1,91,96,1,123,169,1,171,185,1,187,191,1,215,247,32,697,735,1,741,745,1,748,767,1,884,894,10,901,903,2,1541,1548,7,1563,1567,4,1600,1757,157,2274,2404,130,2405,3647,1242,4053,4056,1,4347,5867,1520,5868,5869,1,5941,5942,1,6146,6147,1,6149,7379,1230,7393,7401,8,7402,7404,1,7406,7411,1,7413,7415,1,7418,8192,774,8193,8203,1,8206,8292,1,8294,8304,1,8308,8318,1,8320,8334,1,8352,8384,1,8448,8485,1,8487,8489,1,8492,8497,1,8499,8525,1,8527,8543,1,8585,8587,1,8592,9257,1,9280,9290,1,9312,10239,1,10496,11123,1,11126,11157,1,11159,11263,1,11776,11869,1,12272,12292,1,12294,12296,2,12297,12320,1,12336,12343,1,12348,12351,1,12443,12444,1,12448,12539,91,12540,12688,148,12689,12703,1,12736,12773,1,12783,12832,49,12833,12895,1,12927,13007,1,13055,13144,89,13145,13311,1,19904,19967,1,42752,42785,1,42888,42890,1,43056,43065,1,43310,43471,161,43867,43882,15,43883,64830,20947,64831,65040,209,65041,65049,1,65072,65106,1,65108,65126,1,65128,65131,1,65279,65281,2,65282,65312,1,65339,65344,1,65371,65381,1,65392,65438,46,65439,65504,65,65505,65510,1,65512,65518,1,65529,65533,1,65792,65794,1,65799,65843,1,65847,65855,1,65936,65948,1,66e3,66044,1,66273,66299,1,113824,113827,1,117760,118009,1,118016,118451,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119142,1,119146,119162,1,119171,119172,1,119180,119209,1,119214,119274,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,120831,1,126065,126132,1,126209,126269,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127487,1,127489,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,917505,917536,31,917537,917631,1]));static foldCommon=new N(new Uint32Array([924,956,32]));static Coptic=new N(new Uint32Array([994,1007,1,11392,11507,1,11513,11519,1]));static Cuneiform=new N(new Uint32Array([73728,74649,1,74752,74862,1,74864,74868,1,74880,75075,1]));static Cypriot=new N(new Uint32Array([67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3]));static Cypro_Minoan=new N(new Uint32Array([77712,77810,1]));static Cyrillic=new N(new Uint32Array([1024,1156,1,1159,1327,1,7296,7306,1,7467,7544,77,11744,11775,1,42560,42655,1,65070,65071,1,122928,122989,1,123023,123023,1]));static Deseret=new N(new Uint32Array([66560,66639,1]));static Devanagari=new N(new Uint32Array([2304,2384,1,2389,2403,1,2406,2431,1,43232,43263,1,72448,72457,1]));static Dives_Akuru=new N(new Uint32Array([71936,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1]));static Dogra=new N(new Uint32Array([71680,71739,1]));static Duployan=new N(new Uint32Array([113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1]));static Egyptian_Hieroglyphs=new N(new Uint32Array([77824,78933,1,78944,82938,1]));static Elbasan=new N(new Uint32Array([66816,66855,1]));static Elymaic=new N(new Uint32Array([69600,69622,1]));static Ethiopic=new N(new Uint32Array([4608,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,11648,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,124896,124902,1,124904,124907,1,124909,124910,1,124912,124926,1]));static Garay=new N(new Uint32Array([68928,68965,1,68969,68997,1,69006,69007,1]));static Georgian=new N(new Uint32Array([4256,4293,1,4295,4301,6,4304,4346,1,4348,4351,1,7312,7354,1,7357,7359,1,11520,11557,1,11559,11565,6]));static Glagolitic=new N(new Uint32Array([11264,11359,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1]));static Gothic=new N(new Uint32Array([66352,66378,1]));static Grantha=new N(new Uint32Array([70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70460,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1]));static Greek=new N(new Uint32Array([880,883,1,885,887,1,890,893,1,895,900,5,902,904,2,905,906,1,908,910,2,911,929,1,931,993,1,1008,1023,1,7462,7466,1,7517,7521,1,7526,7530,1,7615,7936,321,7937,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8486,43877,35391,65856,65934,1,65952,119296,53344,119297,119365,1]));static foldGreek=new N(new Uint32Array([181,837,656]));static Gujarati=new N(new Uint32Array([2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1]));static Gunjala_Gondi=new N(new Uint32Array([73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1]));static Gurmukhi=new N(new Uint32Array([2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1]));static Gurung_Khema=new N(new Uint32Array([90368,90425,1]));static Han=new N(new Uint32Array([11904,11929,1,11931,12019,1,12032,12245,1,12293,12295,2,12321,12329,1,12344,12347,1,13312,19903,1,19968,40959,1,63744,64109,1,64112,64217,1,94178,94179,1,94192,94193,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1]));static Hangul=new N(new Uint32Array([4352,4607,1,12334,12335,1,12593,12686,1,12800,12830,1,12896,12926,1,43360,43388,1,44032,55203,1,55216,55238,1,55243,55291,1,65440,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1]));static Hanifi_Rohingya=new N(new Uint32Array([68864,68903,1,68912,68921,1]));static Hanunoo=new N(new Uint32Array([5920,5940,1]));static Hatran=new N(new Uint32Array([67808,67826,1,67828,67829,1,67835,67839,1]));static Hebrew=new N(new Uint32Array([1425,1479,1,1488,1514,1,1519,1524,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64335,1]));static Hiragana=new N(new Uint32Array([12353,12438,1,12445,12447,1,110593,110879,1,110898,110928,30,110929,110930,1,127488,127488,1]));static Imperial_Aramaic=new N(new Uint32Array([67648,67669,1,67671,67679,1]));static Inherited=new N(new Uint32Array([768,879,1,1157,1158,1,1611,1621,1,1648,2385,737,2386,2388,1,6832,6862,1,7376,7378,1,7380,7392,1,7394,7400,1,7405,7412,7,7416,7417,1,7616,7679,1,8204,8205,1,8400,8432,1,12330,12333,1,12441,12442,1,65024,65039,1,65056,65069,1,66045,66272,227,70459,118528,48069,118529,118573,1,118576,118598,1,119143,119145,1,119163,119170,1,119173,119179,1,119210,119213,1,917760,917999,1]));static foldInherited=new N(new Uint32Array([921,953,32,8126,8126,1]));static Inscriptional_Pahlavi=new N(new Uint32Array([68448,68466,1,68472,68479,1]));static Inscriptional_Parthian=new N(new Uint32Array([68416,68437,1,68440,68447,1]));static Javanese=new N(new Uint32Array([43392,43469,1,43472,43481,1,43486,43487,1]));static Kaithi=new N(new Uint32Array([69760,69826,1,69837,69837,1]));static Kannada=new N(new Uint32Array([3200,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1]));static Katakana=new N(new Uint32Array([12449,12538,1,12541,12543,1,12784,12799,1,13008,13054,1,13056,13143,1,65382,65391,1,65393,65437,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110880,288,110881,110882,1,110933,110948,15,110949,110951,1]));static Kawi=new N(new Uint32Array([73472,73488,1,73490,73530,1,73534,73562,1]));static Kayah_Li=new N(new Uint32Array([43264,43309,1,43311,43311,1]));static Kharoshthi=new N(new Uint32Array([68096,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1]));static Khitan_Small_Script=new N(new Uint32Array([94180,101120,6940,101121,101589,1,101631,101631,1]));static Khmer=new N(new Uint32Array([6016,6109,1,6112,6121,1,6128,6137,1,6624,6655,1]));static Khojki=new N(new Uint32Array([70144,70161,1,70163,70209,1]));static Khudawadi=new N(new Uint32Array([70320,70378,1,70384,70393,1]));static Kirat_Rai=new N(new Uint32Array([93504,93561,1]));static Lao=new N(new Uint32Array([3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1]));static Latin=new N(new Uint32Array([65,90,1,97,122,1,170,186,16,192,214,1,216,246,1,248,696,1,736,740,1,7424,7461,1,7468,7516,1,7522,7525,1,7531,7543,1,7545,7614,1,7680,7935,1,8305,8319,14,8336,8348,1,8490,8491,1,8498,8526,28,8544,8584,1,11360,11391,1,42786,42887,1,42891,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43007,1,43824,43866,1,43868,43876,1,43878,43881,1,64256,64262,1,65313,65338,1,65345,65370,1,67456,67461,1,67463,67504,1,67506,67514,1,122624,122654,1,122661,122666,1]));static Lepcha=new N(new Uint32Array([7168,7223,1,7227,7241,1,7245,7247,1]));static Limbu=new N(new Uint32Array([6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6479,1]));static Linear_A=new N(new Uint32Array([67072,67382,1,67392,67413,1,67424,67431,1]));static Linear_B=new N(new Uint32Array([65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1]));static Lisu=new N(new Uint32Array([42192,42239,1,73648,73648,1]));static Lycian=new N(new Uint32Array([66176,66204,1]));static Lydian=new N(new Uint32Array([67872,67897,1,67903,67903,1]));static Mahajani=new N(new Uint32Array([69968,70006,1]));static Makasar=new N(new Uint32Array([73440,73464,1]));static Malayalam=new N(new Uint32Array([3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1]));static Mandaic=new N(new Uint32Array([2112,2139,1,2142,2142,1]));static Manichaean=new N(new Uint32Array([68288,68326,1,68331,68342,1]));static Marchen=new N(new Uint32Array([72816,72847,1,72850,72871,1,72873,72886,1]));static Masaram_Gondi=new N(new Uint32Array([72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1]));static Medefaidrin=new N(new Uint32Array([93760,93850,1]));static Meetei_Mayek=new N(new Uint32Array([43744,43766,1,43968,44013,1,44016,44025,1]));static Mende_Kikakui=new N(new Uint32Array([124928,125124,1,125127,125142,1]));static Meroitic_Cursive=new N(new Uint32Array([68e3,68023,1,68028,68047,1,68050,68095,1]));static Meroitic_Hieroglyphs=new N(new Uint32Array([67968,67999,1]));static Miao=new N(new Uint32Array([93952,94026,1,94031,94087,1,94095,94111,1]));static Modi=new N(new Uint32Array([71168,71236,1,71248,71257,1]));static Mongolian=new N(new Uint32Array([6144,6145,1,6148,6150,2,6151,6169,1,6176,6264,1,6272,6314,1,71264,71276,1]));static Mro=new N(new Uint32Array([92736,92766,1,92768,92777,1,92782,92783,1]));static Multani=new N(new Uint32Array([70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1]));static Myanmar=new N(new Uint32Array([4096,4255,1,43488,43518,1,43616,43647,1,71376,71395,1]));static Nabataean=new N(new Uint32Array([67712,67742,1,67751,67759,1]));static Nag_Mundari=new N(new Uint32Array([124112,124153,1]));static Nandinagari=new N(new Uint32Array([72096,72103,1,72106,72151,1,72154,72164,1]));static New_Tai_Lue=new N(new Uint32Array([6528,6571,1,6576,6601,1,6608,6618,1,6622,6623,1]));static Newa=new N(new Uint32Array([70656,70747,1,70749,70753,1]));static Nko=new N(new Uint32Array([1984,2042,1,2045,2047,1]));static Nushu=new N(new Uint32Array([94177,110960,16783,110961,111355,1]));static Nyiakeng_Puachue_Hmong=new N(new Uint32Array([123136,123180,1,123184,123197,1,123200,123209,1,123214,123215,1]));static Ogham=new N(new Uint32Array([5760,5788,1]));static Ol_Chiki=new N(new Uint32Array([7248,7295,1]));static Ol_Onal=new N(new Uint32Array([124368,124410,1,124415,124415,1]));static Old_Hungarian=new N(new Uint32Array([68736,68786,1,68800,68850,1,68858,68863,1]));static Old_Italic=new N(new Uint32Array([66304,66339,1,66349,66351,1]));static Old_North_Arabian=new N(new Uint32Array([68224,68255,1]));static Old_Permic=new N(new Uint32Array([66384,66426,1]));static Old_Persian=new N(new Uint32Array([66464,66499,1,66504,66517,1]));static Old_Sogdian=new N(new Uint32Array([69376,69415,1]));static Old_South_Arabian=new N(new Uint32Array([68192,68223,1]));static Old_Turkic=new N(new Uint32Array([68608,68680,1]));static Old_Uyghur=new N(new Uint32Array([69488,69513,1]));static Oriya=new N(new Uint32Array([2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1]));static Osage=new N(new Uint32Array([66736,66771,1,66776,66811,1]));static Osmanya=new N(new Uint32Array([66688,66717,1,66720,66729,1]));static Pahawh_Hmong=new N(new Uint32Array([92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1]));static Palmyrene=new N(new Uint32Array([67680,67711,1]));static Pau_Cin_Hau=new N(new Uint32Array([72384,72440,1]));static Phags_Pa=new N(new Uint32Array([43072,43127,1]));static Phoenician=new N(new Uint32Array([67840,67867,1,67871,67871,1]));static Psalter_Pahlavi=new N(new Uint32Array([68480,68497,1,68505,68508,1,68521,68527,1]));static Rejang=new N(new Uint32Array([43312,43347,1,43359,43359,1]));static Runic=new N(new Uint32Array([5792,5866,1,5870,5880,1]));static Samaritan=new N(new Uint32Array([2048,2093,1,2096,2110,1]));static Saurashtra=new N(new Uint32Array([43136,43205,1,43214,43225,1]));static Sharada=new N(new Uint32Array([70016,70111,1]));static Shavian=new N(new Uint32Array([66640,66687,1]));static Siddham=new N(new Uint32Array([71040,71093,1,71096,71133,1]));static SignWriting=new N(new Uint32Array([120832,121483,1,121499,121503,1,121505,121519,1]));static Sinhala=new N(new Uint32Array([3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,70113,70132,1]));static Sogdian=new N(new Uint32Array([69424,69465,1]));static Sora_Sompeng=new N(new Uint32Array([69840,69864,1,69872,69881,1]));static Soyombo=new N(new Uint32Array([72272,72354,1]));static Sundanese=new N(new Uint32Array([7040,7103,1,7360,7367,1]));static Sunuwar=new N(new Uint32Array([72640,72673,1,72688,72697,1]));static Syloti_Nagri=new N(new Uint32Array([43008,43052,1]));static Syriac=new N(new Uint32Array([1792,1805,1,1807,1866,1,1869,1871,1,2144,2154,1]));static Tagalog=new N(new Uint32Array([5888,5909,1,5919,5919,1]));static Tagbanwa=new N(new Uint32Array([5984,5996,1,5998,6e3,1,6002,6003,1]));static Tai_Le=new N(new Uint32Array([6480,6509,1,6512,6516,1]));static Tai_Tham=new N(new Uint32Array([6688,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1]));static Tai_Viet=new N(new Uint32Array([43648,43714,1,43739,43743,1]));static Takri=new N(new Uint32Array([71296,71353,1,71360,71369,1]));static Tamil=new N(new Uint32Array([2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,73664,73713,1,73727,73727,1]));static Tangsa=new N(new Uint32Array([92784,92862,1,92864,92873,1]));static Tangut=new N(new Uint32Array([94176,94208,32,94209,100343,1,100352,101119,1,101632,101640,1]));static Telugu=new N(new Uint32Array([3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3199,1]));static Thaana=new N(new Uint32Array([1920,1969,1]));static Thai=new N(new Uint32Array([3585,3642,1,3648,3675,1]));static Tibetan=new N(new Uint32Array([3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4052,1,4057,4058,1]));static Tifinagh=new N(new Uint32Array([11568,11623,1,11631,11632,1,11647,11647,1]));static Tirhuta=new N(new Uint32Array([70784,70855,1,70864,70873,1]));static Todhri=new N(new Uint32Array([67008,67059,1]));static Toto=new N(new Uint32Array([123536,123566,1]));static Tulu_Tigalari=new N(new Uint32Array([70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1]));static Ugaritic=new N(new Uint32Array([66432,66461,1,66463,66463,1]));static Vai=new N(new Uint32Array([42240,42539,1]));static Vithkuqi=new N(new Uint32Array([66928,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1]));static Wancho=new N(new Uint32Array([123584,123641,1,123647,123647,1]));static Warang_Citi=new N(new Uint32Array([71840,71922,1,71935,71935,1]));static Yezidi=new N(new Uint32Array([69248,69289,1,69291,69293,1,69296,69297,1]));static Yi=new N(new Uint32Array([40960,42124,1,42128,42182,1]));static Zanabazar_Square=new N(new Uint32Array([72192,72263,1]));static CATEGORIES=new Map([[`C`,e.C],[`Cc`,e.Cc],[`Cf`,e.Cf],[`Co`,e.Co],[`Cs`,e.Cs],[`L`,e.L],[`Ll`,e.Ll],[`Lm`,e.Lm],[`Lo`,e.Lo],[`Lt`,e.Lt],[`Lu`,e.Lu],[`M`,e.M],[`Mc`,e.Mc],[`Me`,e.Me],[`Mn`,e.Mn],[`N`,e.N],[`Nd`,e.Nd],[`Nl`,e.Nl],[`No`,e.No],[`P`,e.P],[`Pc`,e.Pc],[`Pd`,e.Pd],[`Pe`,e.Pe],[`Pf`,e.Pf],[`Pi`,e.Pi],[`Po`,e.Po],[`Ps`,e.Ps],[`S`,e.S],[`Sc`,e.Sc],[`Sk`,e.Sk],[`Sm`,e.Sm],[`So`,e.So],[`Z`,e.Z],[`Zl`,e.Zl],[`Zp`,e.Zp],[`Zs`,e.Zs]]);static SCRIPTS=new Map([[`Adlam`,e.Adlam],[`Ahom`,e.Ahom],[`Anatolian_Hieroglyphs`,e.Anatolian_Hieroglyphs],[`Arabic`,e.Arabic],[`Armenian`,e.Armenian],[`Avestan`,e.Avestan],[`Balinese`,e.Balinese],[`Bamum`,e.Bamum],[`Bassa_Vah`,e.Bassa_Vah],[`Batak`,e.Batak],[`Bengali`,e.Bengali],[`Bhaiksuki`,e.Bhaiksuki],[`Bopomofo`,e.Bopomofo],[`Brahmi`,e.Brahmi],[`Braille`,e.Braille],[`Buginese`,e.Buginese],[`Buhid`,e.Buhid],[`Canadian_Aboriginal`,e.Canadian_Aboriginal],[`Carian`,e.Carian],[`Caucasian_Albanian`,e.Caucasian_Albanian],[`Chakma`,e.Chakma],[`Cham`,e.Cham],[`Cherokee`,e.Cherokee],[`Chorasmian`,e.Chorasmian],[`Common`,e.Common],[`Coptic`,e.Coptic],[`Cuneiform`,e.Cuneiform],[`Cypriot`,e.Cypriot],[`Cypro_Minoan`,e.Cypro_Minoan],[`Cyrillic`,e.Cyrillic],[`Deseret`,e.Deseret],[`Devanagari`,e.Devanagari],[`Dives_Akuru`,e.Dives_Akuru],[`Dogra`,e.Dogra],[`Duployan`,e.Duployan],[`Egyptian_Hieroglyphs`,e.Egyptian_Hieroglyphs],[`Elbasan`,e.Elbasan],[`Elymaic`,e.Elymaic],[`Ethiopic`,e.Ethiopic],[`Garay`,e.Garay],[`Georgian`,e.Georgian],[`Glagolitic`,e.Glagolitic],[`Gothic`,e.Gothic],[`Grantha`,e.Grantha],[`Greek`,e.Greek],[`Gujarati`,e.Gujarati],[`Gunjala_Gondi`,e.Gunjala_Gondi],[`Gurmukhi`,e.Gurmukhi],[`Gurung_Khema`,e.Gurung_Khema],[`Han`,e.Han],[`Hangul`,e.Hangul],[`Hanifi_Rohingya`,e.Hanifi_Rohingya],[`Hanunoo`,e.Hanunoo],[`Hatran`,e.Hatran],[`Hebrew`,e.Hebrew],[`Hiragana`,e.Hiragana],[`Imperial_Aramaic`,e.Imperial_Aramaic],[`Inherited`,e.Inherited],[`Inscriptional_Pahlavi`,e.Inscriptional_Pahlavi],[`Inscriptional_Parthian`,e.Inscriptional_Parthian],[`Javanese`,e.Javanese],[`Kaithi`,e.Kaithi],[`Kannada`,e.Kannada],[`Katakana`,e.Katakana],[`Kawi`,e.Kawi],[`Kayah_Li`,e.Kayah_Li],[`Kharoshthi`,e.Kharoshthi],[`Khitan_Small_Script`,e.Khitan_Small_Script],[`Khmer`,e.Khmer],[`Khojki`,e.Khojki],[`Khudawadi`,e.Khudawadi],[`Kirat_Rai`,e.Kirat_Rai],[`Lao`,e.Lao],[`Latin`,e.Latin],[`Lepcha`,e.Lepcha],[`Limbu`,e.Limbu],[`Linear_A`,e.Linear_A],[`Linear_B`,e.Linear_B],[`Lisu`,e.Lisu],[`Lycian`,e.Lycian],[`Lydian`,e.Lydian],[`Mahajani`,e.Mahajani],[`Makasar`,e.Makasar],[`Malayalam`,e.Malayalam],[`Mandaic`,e.Mandaic],[`Manichaean`,e.Manichaean],[`Marchen`,e.Marchen],[`Masaram_Gondi`,e.Masaram_Gondi],[`Medefaidrin`,e.Medefaidrin],[`Meetei_Mayek`,e.Meetei_Mayek],[`Mende_Kikakui`,e.Mende_Kikakui],[`Meroitic_Cursive`,e.Meroitic_Cursive],[`Meroitic_Hieroglyphs`,e.Meroitic_Hieroglyphs],[`Miao`,e.Miao],[`Modi`,e.Modi],[`Mongolian`,e.Mongolian],[`Mro`,e.Mro],[`Multani`,e.Multani],[`Myanmar`,e.Myanmar],[`Nabataean`,e.Nabataean],[`Nag_Mundari`,e.Nag_Mundari],[`Nandinagari`,e.Nandinagari],[`New_Tai_Lue`,e.New_Tai_Lue],[`Newa`,e.Newa],[`Nko`,e.Nko],[`Nushu`,e.Nushu],[`Nyiakeng_Puachue_Hmong`,e.Nyiakeng_Puachue_Hmong],[`Ogham`,e.Ogham],[`Ol_Chiki`,e.Ol_Chiki],[`Ol_Onal`,e.Ol_Onal],[`Old_Hungarian`,e.Old_Hungarian],[`Old_Italic`,e.Old_Italic],[`Old_North_Arabian`,e.Old_North_Arabian],[`Old_Permic`,e.Old_Permic],[`Old_Persian`,e.Old_Persian],[`Old_Sogdian`,e.Old_Sogdian],[`Old_South_Arabian`,e.Old_South_Arabian],[`Old_Turkic`,e.Old_Turkic],[`Old_Uyghur`,e.Old_Uyghur],[`Oriya`,e.Oriya],[`Osage`,e.Osage],[`Osmanya`,e.Osmanya],[`Pahawh_Hmong`,e.Pahawh_Hmong],[`Palmyrene`,e.Palmyrene],[`Pau_Cin_Hau`,e.Pau_Cin_Hau],[`Phags_Pa`,e.Phags_Pa],[`Phoenician`,e.Phoenician],[`Psalter_Pahlavi`,e.Psalter_Pahlavi],[`Rejang`,e.Rejang],[`Runic`,e.Runic],[`Samaritan`,e.Samaritan],[`Saurashtra`,e.Saurashtra],[`Sharada`,e.Sharada],[`Shavian`,e.Shavian],[`Siddham`,e.Siddham],[`SignWriting`,e.SignWriting],[`Sinhala`,e.Sinhala],[`Sogdian`,e.Sogdian],[`Sora_Sompeng`,e.Sora_Sompeng],[`Soyombo`,e.Soyombo],[`Sundanese`,e.Sundanese],[`Sunuwar`,e.Sunuwar],[`Syloti_Nagri`,e.Syloti_Nagri],[`Syriac`,e.Syriac],[`Tagalog`,e.Tagalog],[`Tagbanwa`,e.Tagbanwa],[`Tai_Le`,e.Tai_Le],[`Tai_Tham`,e.Tai_Tham],[`Tai_Viet`,e.Tai_Viet],[`Takri`,e.Takri],[`Tamil`,e.Tamil],[`Tangsa`,e.Tangsa],[`Tangut`,e.Tangut],[`Telugu`,e.Telugu],[`Thaana`,e.Thaana],[`Thai`,e.Thai],[`Tibetan`,e.Tibetan],[`Tifinagh`,e.Tifinagh],[`Tirhuta`,e.Tirhuta],[`Todhri`,e.Todhri],[`Toto`,e.Toto],[`Tulu_Tigalari`,e.Tulu_Tigalari],[`Ugaritic`,e.Ugaritic],[`Vai`,e.Vai],[`Vithkuqi`,e.Vithkuqi],[`Wancho`,e.Wancho],[`Warang_Citi`,e.Warang_Citi],[`Yezidi`,e.Yezidi],[`Yi`,e.Yi],[`Zanabazar_Square`,e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([[`L`,e.foldL],[`Ll`,e.foldLl],[`Lt`,e.foldLt],[`Lu`,e.foldLu],[`M`,e.foldM],[`Mn`,e.foldMn]]);static FOLD_SCRIPT=new Map([[`Common`,e.foldCommon],[`Greek`,e.foldGreek],[`Inherited`,e.foldInherited]]);static Print=new N(new Uint32Array([33,126,1,161,172,1,174,887,1,890,895,1,900,906,1,908,910,2,911,929,1,931,1327,1,1329,1366,1,1369,1418,1,1421,1423,1,1425,1479,1,1488,1514,1,1519,1524,1,1542,1563,1,1565,1756,1,1758,1805,1,1808,1866,1,1869,1969,1,1984,2042,1,2045,2093,1,2096,2110,1,2112,2139,1,2142,2144,2,2145,2154,1,2160,2190,1,2199,2273,1,2275,2435,1,2437,2444,1,2447,2448,1,2451,2472,1,2474,2480,1,2482,2486,4,2487,2489,1,2492,2500,1,2503,2504,1,2507,2510,1,2519,2524,5,2525,2527,2,2528,2531,1,2534,2558,1,2561,2563,1,2565,2570,1,2575,2576,1,2579,2600,1,2602,2608,1,2610,2611,1,2613,2614,1,2616,2617,1,2620,2622,2,2623,2626,1,2631,2632,1,2635,2637,1,2641,2649,8,2650,2652,1,2654,2662,8,2663,2678,1,2689,2691,1,2693,2701,1,2703,2705,1,2707,2728,1,2730,2736,1,2738,2739,1,2741,2745,1,2748,2757,1,2759,2761,1,2763,2765,1,2768,2784,16,2785,2787,1,2790,2801,1,2809,2815,1,2817,2819,1,2821,2828,1,2831,2832,1,2835,2856,1,2858,2864,1,2866,2867,1,2869,2873,1,2876,2884,1,2887,2888,1,2891,2893,1,2901,2903,1,2908,2909,1,2911,2915,1,2918,2935,1,2946,2947,1,2949,2954,1,2958,2960,1,2962,2965,1,2969,2970,1,2972,2974,2,2975,2979,4,2980,2984,4,2985,2986,1,2990,3001,1,3006,3010,1,3014,3016,1,3018,3021,1,3024,3031,7,3046,3066,1,3072,3084,1,3086,3088,1,3090,3112,1,3114,3129,1,3132,3140,1,3142,3144,1,3146,3149,1,3157,3158,1,3160,3162,1,3165,3168,3,3169,3171,1,3174,3183,1,3191,3212,1,3214,3216,1,3218,3240,1,3242,3251,1,3253,3257,1,3260,3268,1,3270,3272,1,3274,3277,1,3285,3286,1,3293,3294,1,3296,3299,1,3302,3311,1,3313,3315,1,3328,3340,1,3342,3344,1,3346,3396,1,3398,3400,1,3402,3407,1,3412,3427,1,3430,3455,1,3457,3459,1,3461,3478,1,3482,3505,1,3507,3515,1,3517,3520,3,3521,3526,1,3530,3535,5,3536,3540,1,3542,3544,2,3545,3551,1,3558,3567,1,3570,3572,1,3585,3642,1,3647,3675,1,3713,3714,1,3716,3718,2,3719,3722,1,3724,3747,1,3749,3751,2,3752,3773,1,3776,3780,1,3782,3784,2,3785,3790,1,3792,3801,1,3804,3807,1,3840,3911,1,3913,3948,1,3953,3991,1,3993,4028,1,4030,4044,1,4046,4058,1,4096,4293,1,4295,4301,6,4304,4680,1,4682,4685,1,4688,4694,1,4696,4698,2,4699,4701,1,4704,4744,1,4746,4749,1,4752,4784,1,4786,4789,1,4792,4798,1,4800,4802,2,4803,4805,1,4808,4822,1,4824,4880,1,4882,4885,1,4888,4954,1,4957,4988,1,4992,5017,1,5024,5109,1,5112,5117,1,5120,5759,1,5761,5788,1,5792,5880,1,5888,5909,1,5919,5942,1,5952,5971,1,5984,5996,1,5998,6e3,1,6002,6003,1,6016,6109,1,6112,6121,1,6128,6137,1,6144,6157,1,6159,6169,1,6176,6264,1,6272,6314,1,6320,6389,1,6400,6430,1,6432,6443,1,6448,6459,1,6464,6468,4,6469,6509,1,6512,6516,1,6528,6571,1,6576,6601,1,6608,6618,1,6622,6683,1,6686,6750,1,6752,6780,1,6783,6793,1,6800,6809,1,6816,6829,1,6832,6862,1,6912,6988,1,6990,7155,1,7164,7223,1,7227,7241,1,7245,7306,1,7312,7354,1,7357,7367,1,7376,7418,1,7424,7957,1,7960,7965,1,7968,8005,1,8008,8013,1,8016,8023,1,8025,8031,2,8032,8061,1,8064,8116,1,8118,8132,1,8134,8147,1,8150,8155,1,8157,8175,1,8178,8180,1,8182,8190,1,8208,8231,1,8240,8286,1,8304,8305,1,8308,8334,1,8336,8348,1,8352,8384,1,8400,8432,1,8448,8587,1,8592,9257,1,9280,9290,1,9312,11123,1,11126,11157,1,11159,11507,1,11513,11557,1,11559,11565,6,11568,11623,1,11631,11632,1,11647,11670,1,11680,11686,1,11688,11694,1,11696,11702,1,11704,11710,1,11712,11718,1,11720,11726,1,11728,11734,1,11736,11742,1,11744,11869,1,11904,11929,1,11931,12019,1,12032,12245,1,12272,12287,1,12289,12351,1,12353,12438,1,12441,12543,1,12549,12591,1,12593,12686,1,12688,12773,1,12783,12830,1,12832,42124,1,42128,42182,1,42192,42539,1,42560,42743,1,42752,42957,1,42960,42961,1,42963,42965,2,42966,42972,1,42994,43052,1,43056,43065,1,43072,43127,1,43136,43205,1,43214,43225,1,43232,43347,1,43359,43388,1,43392,43469,1,43471,43481,1,43486,43518,1,43520,43574,1,43584,43597,1,43600,43609,1,43612,43714,1,43739,43766,1,43777,43782,1,43785,43790,1,43793,43798,1,43808,43814,1,43816,43822,1,43824,43883,1,43888,44013,1,44016,44025,1,44032,55203,1,55216,55238,1,55243,55291,1,63744,64109,1,64112,64217,1,64256,64262,1,64275,64279,1,64285,64310,1,64312,64316,1,64318,64320,2,64321,64323,2,64324,64326,2,64327,64450,1,64467,64911,1,64914,64967,1,64975,65008,33,65009,65049,1,65056,65106,1,65108,65126,1,65128,65131,1,65136,65140,1,65142,65276,1,65281,65470,1,65474,65479,1,65482,65487,1,65490,65495,1,65498,65500,1,65504,65510,1,65512,65518,1,65532,65533,1,65536,65547,1,65549,65574,1,65576,65594,1,65596,65597,1,65599,65613,1,65616,65629,1,65664,65786,1,65792,65794,1,65799,65843,1,65847,65934,1,65936,65948,1,65952,66e3,48,66001,66045,1,66176,66204,1,66208,66256,1,66272,66299,1,66304,66339,1,66349,66378,1,66384,66426,1,66432,66461,1,66463,66499,1,66504,66517,1,66560,66717,1,66720,66729,1,66736,66771,1,66776,66811,1,66816,66855,1,66864,66915,1,66927,66938,1,66940,66954,1,66956,66962,1,66964,66965,1,66967,66977,1,66979,66993,1,66995,67001,1,67003,67004,1,67008,67059,1,67072,67382,1,67392,67413,1,67424,67431,1,67456,67461,1,67463,67504,1,67506,67514,1,67584,67589,1,67592,67594,2,67595,67637,1,67639,67640,1,67644,67647,3,67648,67669,1,67671,67742,1,67751,67759,1,67808,67826,1,67828,67829,1,67835,67867,1,67871,67897,1,67903,67968,65,67969,68023,1,68028,68047,1,68050,68099,1,68101,68102,1,68108,68115,1,68117,68119,1,68121,68149,1,68152,68154,1,68159,68168,1,68176,68184,1,68192,68255,1,68288,68326,1,68331,68342,1,68352,68405,1,68409,68437,1,68440,68466,1,68472,68497,1,68505,68508,1,68521,68527,1,68608,68680,1,68736,68786,1,68800,68850,1,68858,68903,1,68912,68921,1,68928,68965,1,68969,68997,1,69006,69007,1,69216,69246,1,69248,69289,1,69291,69293,1,69296,69297,1,69314,69316,1,69372,69415,1,69424,69465,1,69488,69513,1,69552,69579,1,69600,69622,1,69632,69709,1,69714,69749,1,69759,69820,1,69822,69826,1,69840,69864,1,69872,69881,1,69888,69940,1,69942,69959,1,69968,70006,1,70016,70111,1,70113,70132,1,70144,70161,1,70163,70209,1,70272,70278,1,70280,70282,2,70283,70285,1,70287,70301,1,70303,70313,1,70320,70378,1,70384,70393,1,70400,70403,1,70405,70412,1,70415,70416,1,70419,70440,1,70442,70448,1,70450,70451,1,70453,70457,1,70459,70468,1,70471,70472,1,70475,70477,1,70480,70487,7,70493,70499,1,70502,70508,1,70512,70516,1,70528,70537,1,70539,70542,3,70544,70581,1,70583,70592,1,70594,70597,3,70599,70602,1,70604,70613,1,70615,70616,1,70625,70626,1,70656,70747,1,70749,70753,1,70784,70855,1,70864,70873,1,71040,71093,1,71096,71133,1,71168,71236,1,71248,71257,1,71264,71276,1,71296,71353,1,71360,71369,1,71376,71395,1,71424,71450,1,71453,71467,1,71472,71494,1,71680,71739,1,71840,71922,1,71935,71942,1,71945,71948,3,71949,71955,1,71957,71958,1,71960,71989,1,71991,71992,1,71995,72006,1,72016,72025,1,72096,72103,1,72106,72151,1,72154,72164,1,72192,72263,1,72272,72354,1,72368,72440,1,72448,72457,1,72640,72673,1,72688,72697,1,72704,72712,1,72714,72758,1,72760,72773,1,72784,72812,1,72816,72847,1,72850,72871,1,72873,72886,1,72960,72966,1,72968,72969,1,72971,73014,1,73018,73020,2,73021,73023,2,73024,73031,1,73040,73049,1,73056,73061,1,73063,73064,1,73066,73102,1,73104,73105,1,73107,73112,1,73120,73129,1,73440,73464,1,73472,73488,1,73490,73530,1,73534,73562,1,73648,73664,16,73665,73713,1,73727,74649,1,74752,74862,1,74864,74868,1,74880,75075,1,77712,77810,1,77824,78895,1,78912,78933,1,78944,82938,1,82944,83526,1,90368,90425,1,92160,92728,1,92736,92766,1,92768,92777,1,92782,92862,1,92864,92873,1,92880,92909,1,92912,92917,1,92928,92997,1,93008,93017,1,93019,93025,1,93027,93047,1,93053,93071,1,93504,93561,1,93760,93850,1,93952,94026,1,94031,94087,1,94095,94111,1,94176,94180,1,94192,94193,1,94208,100343,1,100352,101589,1,101631,101640,1,110576,110579,1,110581,110587,1,110589,110590,1,110592,110882,1,110898,110928,30,110929,110930,1,110933,110948,15,110949,110951,1,110960,111355,1,113664,113770,1,113776,113788,1,113792,113800,1,113808,113817,1,113820,113823,1,117760,118009,1,118016,118451,1,118528,118573,1,118576,118598,1,118608,118723,1,118784,119029,1,119040,119078,1,119081,119154,1,119163,119274,1,119296,119365,1,119488,119507,1,119520,119539,1,119552,119638,1,119648,119672,1,119808,119892,1,119894,119964,1,119966,119967,1,119970,119973,3,119974,119977,3,119978,119980,1,119982,119993,1,119995,119997,2,119998,120003,1,120005,120069,1,120071,120074,1,120077,120084,1,120086,120092,1,120094,120121,1,120123,120126,1,120128,120132,1,120134,120138,4,120139,120144,1,120146,120485,1,120488,120779,1,120782,121483,1,121499,121503,1,121505,121519,1,122624,122654,1,122661,122666,1,122880,122886,1,122888,122904,1,122907,122913,1,122915,122916,1,122918,122922,1,122928,122989,1,123023,123136,113,123137,123180,1,123184,123197,1,123200,123209,1,123214,123215,1,123536,123566,1,123584,123641,1,123647,124112,465,124113,124153,1,124368,124410,1,124415,124896,481,124897,124902,1,124904,124907,1,124909,124910,1,124912,124926,1,124928,125124,1,125127,125142,1,125184,125259,1,125264,125273,1,125278,125279,1,126065,126132,1,126209,126269,1,126464,126467,1,126469,126495,1,126497,126498,1,126500,126503,3,126505,126514,1,126516,126519,1,126521,126523,2,126530,126535,5,126537,126541,2,126542,126543,1,126545,126546,1,126548,126551,3,126553,126561,2,126562,126564,2,126567,126570,1,126572,126578,1,126580,126583,1,126585,126588,1,126590,126592,2,126593,126601,1,126603,126619,1,126625,126627,1,126629,126633,1,126635,126651,1,126704,126705,1,126976,127019,1,127024,127123,1,127136,127150,1,127153,127167,1,127169,127183,1,127185,127221,1,127232,127405,1,127462,127490,1,127504,127547,1,127552,127560,1,127568,127569,1,127584,127589,1,127744,128727,1,128732,128748,1,128752,128764,1,128768,128886,1,128891,128985,1,128992,129003,1,129008,129024,16,129025,129035,1,129040,129095,1,129104,129113,1,129120,129159,1,129168,129197,1,129200,129211,1,129216,129217,1,129280,129619,1,129632,129645,1,129648,129660,1,129664,129673,1,129679,129734,1,129742,129756,1,129759,129769,1,129776,129784,1,129792,129938,1,129940,130041,1,131072,173791,1,173824,177977,1,177984,178205,1,178208,183969,1,183984,191456,1,191472,192093,1,194560,195101,1,196608,201546,1,201552,205743,1,917760,917999,1]))},P=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e.getLo(i),o=e.getHi(i);if(a<=t&&t<=o){let n=e.getStride(i);return(t-a)%n===0}t<a?r=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n=0;n<e.length;n++){if(t>e.getHi(n))continue;let r=e.getLo(n);if(t<r)return!1;let i=e.getStride(n);return(t-r)%i===0}return!1}return e.length>0&&t>=e.getLo(0)&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(yo.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<this.MAX_ASCII||e>=161&&e!==173:this.is(yo.Print,e)}static simpleFold(e){if(yo.CASE_ORBIT.has(e))return yo.CASE_ORBIT.get(e);let t=M.toLowerCase(e);return t===e?M.toUpperCase(e):t}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return M.CODES.get(`A`)<=e&&e<=M.CODES.get(`Z`)&&(e|=32),M.CODES.get(`A`)<=t&&t<=M.CODES.get(`Z`)&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}},F=class{static METACHARACTERS=`\\.+*?()|[]{}^$`;static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return M.CODES.get(`0`)<=e&&e<=M.CODES.get(`9`)||M.CODES.get(`a`)<=e&&e<=M.CODES.get(`z`)||M.CODES.get(`A`)<=e&&e<=M.CODES.get(`Z`)}static unhex(e){return M.CODES.get(`0`)<=e&&e<=M.CODES.get(`9`)?e-M.CODES.get(`0`):M.CODES.get(`a`)<=e&&e<=M.CODES.get(`f`)?e-M.CODES.get(`a`)+10:M.CODES.get(`A`)<=e&&e<=M.CODES.get(`F`)?e-M.CODES.get(`A`)+10:-1}static escapeRune(e){let t=``;if(P.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+=`\\`),t+=String.fromCodePoint(e);else switch(e){case M.CODES.get(`"`):t+=`\\"`;break;case M.CODES.get(`\\`):t+=`\\\\`;break;case M.CODES.get(` `):t+=`\\t`;break;case M.CODES.get(`
236
236
  `):t+=`\\n`;break;case M.CODES.get(`\r`):t+=`\\r`;break;case M.CODES.get(`\b`):t+=`\\b`;break;case M.CODES.get(`\f`):t+=`\\f`;break;default:{let n=e.toString(16);e<256?(t+=`\\x`,n.length===1&&(t+=`0`),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split(``).map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return M.CODES.get(`a`)<=e&&e<=M.CODES.get(`z`)||M.CODES.get(`A`)<=e&&e<=M.CODES.get(`Z`)||M.CODES.get(`0`)<=e&&e<=M.CODES.get(`9`)||e===M.CODES.get(`_`)}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===M.CODES.get(`
237
237
  `)&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===M.CODES.get(`
238
- `)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)===this.isWordRune(t)?n|=this.EMPTY_NO_WORD_BOUNDARY:n|=this.EMPTY_WORD_BOUNDARY,n}static quoteMeta(e){return e.split(``).map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join(``)}static charCount(e){return e>P.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder(`utf-8`).decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)}}},xo=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t+r;n[i]=a,n[a]=i}return Object.freeze(n)},So=class e{static Encoding=xo([`UTF_16`,`UTF_8`]);getEncoding(){throw Error(`not implemented`)}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},Co=class extends So{constructor(e=null){super(),this.bytes=e}getEncoding(){return So.Encoding.UTF_8}asCharSequence(){return bo.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},wo=class extends So{constructor(e=null){super(),this.charSequence=e}getEncoding(){return So.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split(``).map(e=>e.codePointAt(0))}length(){return this.charSequence.length}},To=class{static utf16(e){return new wo(e)}static utf8(e){return Array.isArray(e)?new Co(e):new Co(bo.stringToUtf8ByteArray(e))}},Eo=class extends Error{constructor(e){super(e),this.name=`RE2JSException`}},Do=class extends Eo{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name=`RE2JSSyntaxException`,this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Oo=class extends Eo{constructor(e){super(e),this.name=`RE2JSCompileException`}},ko=class extends Eo{constructor(e){super(e),this.name=`RE2JSGroupException`}},Ao=class extends Eo{constructor(e){super(e),this.name=`RE2JSFlagsException`}},jo=class{static quoteReplacement(e){return e.indexOf(`\\`)<0&&e.indexOf(`$`)<0?e:e.split(``).map(e=>{let t=e.codePointAt(0);return t===M.CODES[`\\`]||t===M.CODES.$?`\\${e}`:e}).join(``)}constructor(e,t){if(e===null)throw Error(`pattern is null`);this.patternInput=e;let n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.numberOfInstructions=n.numberOfInstructions(),t instanceof So?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(To.utf8(t)):this.resetMatcherInput(To.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw Error(`input is null`);return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new ko(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new ko(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}programSize(){return this.numberOfInstructions}group(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new ko(`group '${e}' not found`);e=t}let t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new ko(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new ko(`perhaps no match attempted`);if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new ko(`inconsistency in matching group data`);this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,j.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,j.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new ko(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,j.UNANCHORED)}genMatch(e,t){let n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?bo.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n=``,r=this.start(),i=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++){if(e.codePointAt(i)===M.CODES.get(`\\`)){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===M.CODES.get(`$`)){let a=e.codePointAt(i+1);if(M.CODES.get(`0`)<=a&&a<=M.CODES.get(`9`)){let o=a-M.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<M.CODES.get(`0`)||a>M.CODES.get(`9`)||o*10+a-M.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-M.CODES.get(`0`);if(o>this.patternGroupCount)throw new ko(`n > number of groups: ${o}`);let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===M.CODES.get(`{`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==M.CODES.get(`}`)&&e.codePointAt(r)!==M.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==M.CODES.get(`}`))throw new ko(`named capture group is missing trailing '}'`);let a=e.substring(i+1,r);t+=this.group(a),n=r+1}}}return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++)if(e.codePointAt(i)===M.CODES.get(`$`)){let a=e.codePointAt(i+1);if(M.CODES.get(`$`)===a){n<i&&(t+=e.substring(n,i)),t+=`$`,i++,n=i+1;continue}else if(M.CODES.get(`&`)===a){n<i&&(t+=e.substring(n,i));let r=this.group(0);r===null?t+=`$&`:t+=r,i++,n=i+1;continue}else if(M.CODES.get(`1`)<=a&&a<=M.CODES.get(`9`)){let o=a-M.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<M.CODES.get(`0`)||a>M.CODES.get(`9`)||o*10+a-M.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-M.CODES.get(`0`);if(o>this.patternGroupCount){t+=`$${o}`,n=i,i--;continue}let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===M.CODES.get(`<`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==M.CODES.get(`>`)&&e.codePointAt(r)!==M.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==M.CODES.get(`>`)){t+=e.substring(i-1,r+1),n=r+1;continue}let a=e.substring(i+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,a)?t+=this.group(a):t+=`$<${a}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r=``;for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}},Mo=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},No=class extends Mo{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return Mo.EOF();let t=this.bytes[e++]&255;return t&128?(t&224)==192?(t&=31,e>=this.end?Mo.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)==224?(t&=15,e+1>=this.end?Mo.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t&=7,e+2>=this.end?Mo.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4)):t<<3|1}index(e,t){t+=this.start;let n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&(this.bytes[n]&192)==128;)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}let n=e<this.end?this.step(e)>>3:-1;return bo.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(r===0)return-1;let i=e.length;for(let a=n;a<=i-r;a++)for(let n=0;n<r&&e[a+n]===t[n];n++)if(n===r-1)return a;return-1}},Po=class extends Mo{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){let t=this.charSequence.codePointAt(e);return t<<3|bo.charCount(t)}else return Mo.EOF()}index(e,t){t+=this.start;let n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;let t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return bo.emptyOpContext(t,n)}},Fo=class{static fromUTF8(e,t=0,n=e.length){return new No(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new Po(e,t,n)}},F=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t=`"`;for(let n of e)t+=bo.escapeRune(n);return t+=`"`,t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=[]}matchRune(e){if(this.runes.length===1){let t=this.runes[0];return(this.arg&j.FOLD_CASE)===0?e===t:P.equalsIgnoreCase(t,e)}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){let r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return`match`;case e.FAIL:return`fail`;case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?`rune <null>`:[`rune `,e.escapeRunes(this.runes),(this.arg&j.FOLD_CASE)===0?``:`/i`,` -> `,this.out].join(``);case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw Error(`unhandled case in Inst.toString`)}}},Io=class{constructor(){this.inst=null,this.cap=[]}},Lo=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){let t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e=`{`;for(let t=0;t<this.size;t++)t!==0&&(e+=`, `),e+=this.densePcs[t];return e+=`}`,e}},Ro=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Lo(n.prog.numInst()),n.q1=new Lo(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?bo.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new Io,t.inst=e,t}freeQueue(e,t=0){let n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,r)));for(let n=t;n<e.size;n++){let t=e.denseThreads[n];t!==null&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){let r=this.re2.cond;if(r===bo.EMPTY_ALL||(n===j.ANCHOR_START||n===j.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,o=e.step(t),s=o>>3,c=o&7,l=-1,u=0;o!==Mo.EOF()&&(o=e.step(t+c),l=o>>3,u=o&7);let d;for(d=t===0?bo.emptyOpContext(-1,s):e.context(t);;){if(i.isEmpty()){if((r&bo.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&l!==this.re2.prefixRune&&e.canCheckPrefix()){let n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),s=o>>3,c=o&7,o=e.step(t+c),l=o>>3,u=o&7}}!this.matched&&(t===0||n===j.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,d,null));let f=t+c;if(d=e.context(f),this.step(i,a,t,f,s,d,n,t===e.endPos()),c===0||this.ncap===0&&this.matched)break;t+=c,s=l,c=u,s!==-1&&(o=e.step(t+c),l=o>>3,u=o&7);let p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,i,a,o,s){let c=this.re2.longest;for(let l=0;l<e.size;l++){let u=e.denseThreads[l];if(u===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<u.cap[0]){this.freeThread(u);continue}let d=u.inst,f=!1;switch(d.op){case F.MATCH:if(o===j.ANCHOR_BOTH&&!s)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(u.cap[1]=n,this.matchcap=u.cap.slice(0,this.ncap)),c||this.freeQueue(e,l+1),this.matched=!0;break;case F.RUNE:f=d.matchRune(i);break;case F.RUNE1:f=i===d.runes[0];break;case F.RUNE_ANY:f=!0;break;case F.RUNE_ANY_NOT_NL:f=i!==M.CODES.get(`
239
- `);break;default:throw Error(`bad inst`)}f&&(u=this.add(t,d.out,r,u.cap,a,u)),u!==null&&(this.freeThread(u),e.denseThreads[l]=null)}e.clear()}add(e,t,n,r,i,a){if(t===0||e.contains(t))return a;let o=e.add(t),s=this.prog.inst[t];switch(s.op){case F.FAIL:break;case F.ALT:case F.ALT_MATCH:a=this.add(e,s.out,n,r,i,a),a=this.add(e,s.arg,n,r,i,a);break;case F.EMPTY_WIDTH:(s.arg&~i)===0&&(a=this.add(e,s.out,n,r,i,a));break;case F.NOP:a=this.add(e,s.out,n,r,i,a);break;case F.CAPTURE:if(s.arg<this.ncap){let t=r[s.arg];r[s.arg]=n,this.add(e,s.out,n,r,i,null),r[s.arg]=t}else a=this.add(e,s.out,n,r,i,a);break;case F.MATCH:case F.RUNE:case F.RUNE1:case F.RUNE_ANY:case F.RUNE_ANY_NOT_NL:a===null?a=this.alloc(s):a.inst=s,this.ncap>0&&a.cap!==r&&(a.cap=r.slice(0,this.ncap)),e.denseThreads[o]=a,a=null;break;default:throw Error(`unhandled`)}return a}},I=class e{static Op=xo([`NO_MATCH`,`EMPTY_MATCH`,`LITERAL`,`CHAR_CLASS`,`ANY_CHAR_NOT_NL`,`ANY_CHAR`,`BEGIN_LINE`,`END_LINE`,`BEGIN_TEXT`,`END_TEXT`,`WORD_BOUNDARY`,`NO_WORD_BOUNDARY`,`CAPTURE`,`STAR`,`PLUS`,`QUEST`,`REPEAT`,`CONCAT`,`ALTERNATE`,`LEFT_PAREN`,`VERTICAL_BAR`]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===M.CODES.get(`-`)?`\\`:``}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t=``;switch(this.op){case e.Op.NO_MATCH:t+=`[^\\x00-\\x{10FFFF}]`;break;case e.Op.EMPTY_MATCH:t+=`(?:)`;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+=`*`;break;case e.Op.PLUS:t+=`+`;break;case e.Op.QUEST:t+=`?`;break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=`,`,this.max>=0&&(t+=this.max)),t+=`}`;break}(this.flags&j.NON_GREEDY)!==0&&(t+=`?`);break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e=``;for(let n of this.subs)t+=e,e=`|`,t+=n.appendTo();break}case e.Op.LITERAL:(this.flags&j.FOLD_CASE)!==0&&(t+=`(?i:`);for(let e of this.runes)t+=bo.escapeRune(e);(this.flags&j.FOLD_CASE)!==0&&(t+=`)`);break;case e.Op.ANY_CHAR_NOT_NL:t+=`(?-s:.)`;break;case e.Op.ANY_CHAR:t+=`(?s:.)`;break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+=`(`:t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=`)`;break;case e.Op.BEGIN_TEXT:t+=`\\A`;break;case e.Op.END_TEXT:(this.flags&j.WAS_DOLLAR)===0?t+=`\\z`:t+=`(?-m:$)`;break;case e.Op.BEGIN_LINE:t+=`^`;break;case e.Op.END_LINE:t+=`$`;break;case e.Op.WORD_BOUNDARY:t+=`\\b`;break;case e.Op.NO_WORD_BOUNDARY:t+=`\\B`;break;case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+=`[invalid char class]`;break}if(t+=`[`,this.runes.length===0)t+=`^\\x00-\\x{10FFFF}`;else if(this.runes[0]===0&&this.runes[this.runes.length-1]===P.MAX_RUNE){t+=`^`;for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,i=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=bo.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=bo.escapeRune(i))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],i=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=bo.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=bo.escapeRune(i))}t+=`]`;break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let e of this.subs){let n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&j.WAS_DOLLAR)!==(t.flags&j.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&j.NON_GREEDY)!==(t.flags&j.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&j.NON_GREEDY)!==(t.flags&j.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}return!0}},zo=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new F(e))}skipNop(e){let t=this.inst[e];for(;t.op===F.NOP||t.op===F.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e=``,t=this.skipNop(this.start);if(!F.isRuneOp(t.op)||t.runes.length!==1)return[t.op===F.MATCH,e];for(;F.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&j.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===F.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){let n=this.inst[t];switch(n.op){case F.EMPTY_WIDTH:e|=n.arg;break;case F.FAIL:return-1;case F.CAPTURE:case F.NOP:break;default:break e}t=n.out}return e}next(e){let t=this.inst[e>>1];return e&1?t.arg:t.out}patch(e,t){for(;e!==0;){let n=this.inst[e>>1];e&1?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){let e=this.next(n);if(e===0)break;n=e}let r=this.inst[n>>1];return n&1?r.arg=t:r.out=t,e}toString(){let e=``;for(let t=0;t<this.inst.length;t++){let n=e.length;e+=t,t===this.start&&(e+=`*`),e+=` `.substring(e.length-n),e+=this.inst[t],e+=`
240
- `}return e}},Bo=class{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}},Vo=class e{static ANY_RUNE_NOT_NL(){return[0,M.CODES.get(`
238
+ `)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)===this.isWordRune(t)?n|=this.EMPTY_NO_WORD_BOUNDARY:n|=this.EMPTY_WORD_BOUNDARY,n}static quoteMeta(e){return e.split(``).map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join(``)}static charCount(e){return e>P.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder(`utf-8`).decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)}}},bo=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t+r;n[i]=a,n[a]=i}return Object.freeze(n)},xo=class e{static Encoding=bo([`UTF_16`,`UTF_8`]);getEncoding(){throw Error(`not implemented`)}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},So=class extends xo{constructor(e=null){super(),this.bytes=e}getEncoding(){return xo.Encoding.UTF_8}asCharSequence(){return F.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Co=class extends xo{constructor(e=null){super(),this.charSequence=e}getEncoding(){return xo.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split(``).map(e=>e.codePointAt(0))}length(){return this.charSequence.length}},wo=class{static utf16(e){return new Co(e)}static utf8(e){return Array.isArray(e)?new So(e):new So(F.stringToUtf8ByteArray(e))}},To=class extends Error{constructor(e){super(e),this.name=`RE2JSException`}},Eo=class extends To{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name=`RE2JSSyntaxException`,this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Do=class extends To{constructor(e){super(e),this.name=`RE2JSCompileException`}},Oo=class extends To{constructor(e){super(e),this.name=`RE2JSGroupException`}},ko=class extends To{constructor(e){super(e),this.name=`RE2JSFlagsException`}},Ao=class{static quoteReplacement(e){return e.indexOf(`\\`)<0&&e.indexOf(`$`)<0?e:e.split(``).map(e=>{let t=e.codePointAt(0);return t===M.CODES[`\\`]||t===M.CODES.$?`\\${e}`:e}).join(``)}constructor(e,t){if(e===null)throw Error(`pattern is null`);this.patternInput=e;let n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,this.numberOfInstructions=n.numberOfInstructions(),t instanceof xo?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(wo.utf8(t)):this.resetMatcherInput(wo.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw Error(`input is null`);return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Oo(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Oo(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}programSize(){return this.numberOfInstructions}group(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Oo(`group '${e}' not found`);e=t}let t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new Oo(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new Oo(`perhaps no match attempted`);if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new Oo(`inconsistency in matching group data`);this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,j.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,j.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new Oo(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,j.UNANCHORED)}genMatch(e,t){let n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?F.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n=``,r=this.start(),i=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++){if(e.codePointAt(i)===M.CODES.get(`\\`)){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===M.CODES.get(`$`)){let a=e.codePointAt(i+1);if(M.CODES.get(`0`)<=a&&a<=M.CODES.get(`9`)){let o=a-M.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<M.CODES.get(`0`)||a>M.CODES.get(`9`)||o*10+a-M.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-M.CODES.get(`0`);if(o>this.patternGroupCount)throw new Oo(`n > number of groups: ${o}`);let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===M.CODES.get(`{`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==M.CODES.get(`}`)&&e.codePointAt(r)!==M.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==M.CODES.get(`}`))throw new Oo(`named capture group is missing trailing '}'`);let a=e.substring(i+1,r);t+=this.group(a),n=r+1}}}return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++)if(e.codePointAt(i)===M.CODES.get(`$`)){let a=e.codePointAt(i+1);if(M.CODES.get(`$`)===a){n<i&&(t+=e.substring(n,i)),t+=`$`,i++,n=i+1;continue}else if(M.CODES.get(`&`)===a){n<i&&(t+=e.substring(n,i));let r=this.group(0);r===null?t+=`$&`:t+=r,i++,n=i+1;continue}else if(M.CODES.get(`1`)<=a&&a<=M.CODES.get(`9`)){let o=a-M.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<M.CODES.get(`0`)||a>M.CODES.get(`9`)||o*10+a-M.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-M.CODES.get(`0`);if(o>this.patternGroupCount){t+=`$${o}`,n=i,i--;continue}let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===M.CODES.get(`<`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==M.CODES.get(`>`)&&e.codePointAt(r)!==M.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==M.CODES.get(`>`)){t+=e.substring(i-1,r+1),n=r+1;continue}let a=e.substring(i+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,a)?t+=this.group(a):t+=`$<${a}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherInputLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r=``;for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}},jo=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Mo=class extends jo{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return jo.EOF();let t=this.bytes[e++]&255;return t&128?(t&224)==192?(t&=31,e>=this.end?jo.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)==224?(t&=15,e+1>=this.end?jo.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t&=7,e+2>=this.end?jo.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4)):t<<3|1}index(e,t){t+=this.start;let n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&(this.bytes[n]&192)==128;)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}let n=e<this.end?this.step(e)>>3:-1;return F.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(r===0)return-1;let i=e.length;for(let a=n;a<=i-r;a++)for(let n=0;n<r&&e[a+n]===t[n];n++)if(n===r-1)return a;return-1}},No=class extends jo{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){let t=this.charSequence.codePointAt(e);return t<<3|F.charCount(t)}else return jo.EOF()}index(e,t){t+=this.start;let n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;let t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return F.emptyOpContext(t,n)}},Po=class{static fromUTF8(e,t=0,n=e.length){return new Mo(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new No(e,t,n)}},I=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t=`"`;for(let n of e)t+=F.escapeRune(n);return t+=`"`,t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=[]}matchRune(e){if(this.runes.length===1){let t=this.runes[0];return(this.arg&j.FOLD_CASE)===0?e===t:P.equalsIgnoreCase(t,e)}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){let r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return`match`;case e.FAIL:return`fail`;case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?`rune <null>`:[`rune `,e.escapeRunes(this.runes),(this.arg&j.FOLD_CASE)===0?``:`/i`,` -> `,this.out].join(``);case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw Error(`unhandled case in Inst.toString`)}}},Fo=class{constructor(){this.inst=null,this.cap=[]}},Io=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){let t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e=`{`;for(let t=0;t<this.size;t++)t!==0&&(e+=`, `),e+=this.densePcs[t];return e+=`}`,e}},Lo=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new Io(n.prog.numInst()),n.q1=new Io(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?F.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new Fo,t.inst=e,t}freeQueue(e,t=0){let n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,r)));for(let n=t;n<e.size;n++){let t=e.denseThreads[n];t!==null&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){let r=this.re2.cond;if(r===F.EMPTY_ALL||(n===j.ANCHOR_START||n===j.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,o=e.step(t),s=o>>3,c=o&7,l=-1,u=0;o!==jo.EOF()&&(o=e.step(t+c),l=o>>3,u=o&7);let d;for(d=t===0?F.emptyOpContext(-1,s):e.context(t);;){if(i.isEmpty()){if((r&F.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&l!==this.re2.prefixRune&&e.canCheckPrefix()){let n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),s=o>>3,c=o&7,o=e.step(t+c),l=o>>3,u=o&7}}!this.matched&&(t===0||n===j.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,d,null));let f=t+c;if(d=e.context(f),this.step(i,a,t,f,s,d,n,t===e.endPos()),c===0||this.ncap===0&&this.matched)break;t+=c,s=l,c=u,s!==-1&&(o=e.step(t+c),l=o>>3,u=o&7);let p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,i,a,o,s){let c=this.re2.longest;for(let l=0;l<e.size;l++){let u=e.denseThreads[l];if(u===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<u.cap[0]){this.freeThread(u);continue}let d=u.inst,f=!1;switch(d.op){case I.MATCH:if(o===j.ANCHOR_BOTH&&!s)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(u.cap[1]=n,this.matchcap=u.cap.slice(0,this.ncap)),c||this.freeQueue(e,l+1),this.matched=!0;break;case I.RUNE:f=d.matchRune(i);break;case I.RUNE1:f=i===d.runes[0];break;case I.RUNE_ANY:f=!0;break;case I.RUNE_ANY_NOT_NL:f=i!==M.CODES.get(`
239
+ `);break;default:throw Error(`bad inst`)}f&&(u=this.add(t,d.out,r,u.cap,a,u)),u!==null&&(this.freeThread(u),e.denseThreads[l]=null)}e.clear()}add(e,t,n,r,i,a){if(t===0||e.contains(t))return a;let o=e.add(t),s=this.prog.inst[t];switch(s.op){case I.FAIL:break;case I.ALT:case I.ALT_MATCH:a=this.add(e,s.out,n,r,i,a),a=this.add(e,s.arg,n,r,i,a);break;case I.EMPTY_WIDTH:(s.arg&~i)===0&&(a=this.add(e,s.out,n,r,i,a));break;case I.NOP:a=this.add(e,s.out,n,r,i,a);break;case I.CAPTURE:if(s.arg<this.ncap){let t=r[s.arg];r[s.arg]=n,this.add(e,s.out,n,r,i,null),r[s.arg]=t}else a=this.add(e,s.out,n,r,i,a);break;case I.MATCH:case I.RUNE:case I.RUNE1:case I.RUNE_ANY:case I.RUNE_ANY_NOT_NL:a===null?a=this.alloc(s):a.inst=s,this.ncap>0&&a.cap!==r&&(a.cap=r.slice(0,this.ncap)),e.denseThreads[o]=a,a=null;break;default:throw Error(`unhandled`)}return a}},L=class e{static Op=bo([`NO_MATCH`,`EMPTY_MATCH`,`LITERAL`,`CHAR_CLASS`,`ANY_CHAR_NOT_NL`,`ANY_CHAR`,`BEGIN_LINE`,`END_LINE`,`BEGIN_TEXT`,`END_TEXT`,`WORD_BOUNDARY`,`NO_WORD_BOUNDARY`,`CAPTURE`,`STAR`,`PLUS`,`QUEST`,`REPEAT`,`CONCAT`,`ALTERNATE`,`LEFT_PAREN`,`VERTICAL_BAR`]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===M.CODES.get(`-`)?`\\`:``}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=[],this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t=``;switch(this.op){case e.Op.NO_MATCH:t+=`[^\\x00-\\x{10FFFF}]`;break;case e.Op.EMPTY_MATCH:t+=`(?:)`;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+=`*`;break;case e.Op.PLUS:t+=`+`;break;case e.Op.QUEST:t+=`?`;break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=`,`,this.max>=0&&(t+=this.max)),t+=`}`;break}(this.flags&j.NON_GREEDY)!==0&&(t+=`?`);break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e=``;for(let n of this.subs)t+=e,e=`|`,t+=n.appendTo();break}case e.Op.LITERAL:(this.flags&j.FOLD_CASE)!==0&&(t+=`(?i:`);for(let e of this.runes)t+=F.escapeRune(e);(this.flags&j.FOLD_CASE)!==0&&(t+=`)`);break;case e.Op.ANY_CHAR_NOT_NL:t+=`(?-s:.)`;break;case e.Op.ANY_CHAR:t+=`(?s:.)`;break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+=`(`:t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=`)`;break;case e.Op.BEGIN_TEXT:t+=`\\A`;break;case e.Op.END_TEXT:(this.flags&j.WAS_DOLLAR)===0?t+=`\\z`:t+=`(?-m:$)`;break;case e.Op.BEGIN_LINE:t+=`^`;break;case e.Op.END_LINE:t+=`$`;break;case e.Op.WORD_BOUNDARY:t+=`\\b`;break;case e.Op.NO_WORD_BOUNDARY:t+=`\\B`;break;case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+=`[invalid char class]`;break}if(t+=`[`,this.runes.length===0)t+=`^\\x00-\\x{10FFFF}`;else if(this.runes[0]===0&&this.runes[this.runes.length-1]===P.MAX_RUNE){t+=`^`;for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,i=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=F.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=F.escapeRune(i))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],i=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=F.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=F.escapeRune(i))}t+=`]`;break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let e of this.subs){let n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&j.WAS_DOLLAR)!==(t.flags&j.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&j.NON_GREEDY)!==(t.flags&j.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&j.NON_GREEDY)!==(t.flags&j.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}return!0}},Ro=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new I(e))}skipNop(e){let t=this.inst[e];for(;t.op===I.NOP||t.op===I.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e=``,t=this.skipNop(this.start);if(!I.isRuneOp(t.op)||t.runes.length!==1)return[t.op===I.MATCH,e];for(;I.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&j.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===I.MATCH,e]}startCond(){let e=0,t=this.start;e:for(;;){let n=this.inst[t];switch(n.op){case I.EMPTY_WIDTH:e|=n.arg;break;case I.FAIL:return-1;case I.CAPTURE:case I.NOP:break;default:break e}t=n.out}return e}next(e){let t=this.inst[e>>1];return e&1?t.arg:t.out}patch(e,t){for(;e!==0;){let n=this.inst[e>>1];e&1?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){let e=this.next(n);if(e===0)break;n=e}let r=this.inst[n>>1];return n&1?r.arg=t:r.out=t,e}toString(){let e=``;for(let t=0;t<this.inst.length;t++){let n=e.length;e+=t,t===this.start&&(e+=`*`),e+=` `.substring(e.length-n),e+=this.inst[t],e+=`
240
+ `}return e}},zo=class{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}},Bo=class e{static ANY_RUNE_NOT_NL(){return[0,M.CODES.get(`
241
241
  `)-1,M.CODES.get(`
242
- `)+1,P.MAX_RUNE]}static ANY_RUNE(){return[0,P.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(F.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new zo,this.newInst(F.FAIL)}newInst(e){return this.prog.addInst(e),new Bo(this.prog.numInst()-1,0,!0)}nop(){let e=this.newInst(F.NOP);return e.out=e.i<<1,e}fail(){return new Bo}cap(e){let t=this.newInst(F.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new Bo(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;let n=this.newInst(F.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){let n=this.newInst(F.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){let n=this.newInst(F.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new Bo(e.i,this.loop(e,t).out,e.nullable)}empty(e){let t=this.newInst(F.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){let n=this.newInst(F.RUNE);n.nullable=!1;let r=this.prog.getInst(n.i);return r.runes=e,t&=j.FOLD_CASE,(e.length!==1||P.simpleFold(e[0])===e[0])&&(t&=-2),r.arg=t,n.out=n.i<<1,(t&j.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?r.op=F.RUNE1:e.length===2&&e[0]===0&&e[1]===P.MAX_RUNE?r.op=F.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===M.CODES.get(`
242
+ `)+1,P.MAX_RUNE]}static ANY_RUNE(){return[0,P.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(I.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new Ro,this.newInst(I.FAIL)}newInst(e){return this.prog.addInst(e),new zo(this.prog.numInst()-1,0,!0)}nop(){let e=this.newInst(I.NOP);return e.out=e.i<<1,e}fail(){return new zo}cap(e){let t=this.newInst(I.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new zo(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;let n=this.newInst(I.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){let n=this.newInst(I.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){let n=this.newInst(I.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new zo(e.i,this.loop(e,t).out,e.nullable)}empty(e){let t=this.newInst(I.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){let n=this.newInst(I.RUNE);n.nullable=!1;let r=this.prog.getInst(n.i);return r.runes=e,t&=j.FOLD_CASE,(e.length!==1||P.simpleFold(e[0])===e[0])&&(t&=-2),r.arg=t,n.out=n.i<<1,(t&j.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?r.op=I.RUNE1:e.length===2&&e[0]===0&&e[1]===P.MAX_RUNE?r.op=I.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===M.CODES.get(`
243
243
  `)-1&&e[2]===M.CODES.get(`
244
- `)+1&&e[3]===P.MAX_RUNE&&(r.op=F.RUNE_ANY_NOT_NL),n}compile(t){switch(t.op){case I.Op.NO_MATCH:return this.fail();case I.Op.EMPTY_MATCH:return this.nop();case I.Op.LITERAL:if(t.runes.length===0)return this.nop();{let e=null;for(let n of t.runes){let r=this.rune([n],t.flags);e=e===null?r:this.cat(e,r)}return e}case I.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case I.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case I.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case I.Op.BEGIN_LINE:return this.empty(bo.EMPTY_BEGIN_LINE);case I.Op.END_LINE:return this.empty(bo.EMPTY_END_LINE);case I.Op.BEGIN_TEXT:return this.empty(bo.EMPTY_BEGIN_TEXT);case I.Op.END_TEXT:return this.empty(bo.EMPTY_END_TEXT);case I.Op.WORD_BOUNDARY:return this.empty(bo.EMPTY_WORD_BOUNDARY);case I.Op.NO_WORD_BOUNDARY:return this.empty(bo.EMPTY_NO_WORD_BOUNDARY);case I.Op.CAPTURE:{let e=this.cap(t.cap<<1),n=this.compile(t.subs[0]),r=this.cap(t.cap<<1|1);return this.cat(this.cat(e,n),r)}case I.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case I.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case I.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case I.Op.CONCAT:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.cat(e,t)}return e}case I.Op.ALTERNATE:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.alt(e,t)}return e}default:throw new Oo(`regexp: unhandled case in compile`)}}},Ho=class e{static simplify(t){if(t===null)return null;switch(t.op){case I.Op.CAPTURE:case I.Op.CONCAT:case I.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let i=t.subs[r],a=e.simplify(i);n===t&&a!==i&&(n=I.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=a)}return n}case I.Op.STAR:case I.Op.PLUS:case I.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case I.Op.REPEAT:{if(t.min===0&&t.max===0)return new I(I.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(I.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(I.Op.PLUS,t.flags,n,null);let r=new I(I.Op.CONCAT),i=[];for(let e=0;e<t.min-1;e++)i.push(n);return i.push(e.simplify1(I.Op.PLUS,t.flags,n,null)),r.subs=i.slice(0),r}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let e=0;e<t.min;e++)r.push(n)}if(t.max>t.min){let i=e.simplify1(I.Op.QUEST,t.flags,n,null);for(let r=t.min+1;r<t.max;r++){let r=new I(I.Op.CONCAT);r.subs=[n,i],i=e.simplify1(I.Op.QUEST,t.flags,r,null)}if(r===null)return i;r.push(i)}if(r!==null){let e=new I(I.Op.CONCAT);return e.subs=r.slice(0),e}return new I(I.Op.NO_MATCH)}}return t}static simplify1(e,t,n,r){return n.op===I.Op.EMPTY_MATCH||e===n.op&&(t&j.NON_GREEDY)===(n.flags&j.NON_GREEDY)?n:(r!==null&&r.op===e&&(r.flags&j.NON_GREEDY)===(t&j.NON_GREEDY)&&n===r.subs[0]||(r=new I(e),r.flags=t,r.subs=[n]),r)}},L=class{constructor(e,t){this.sign=e,this.cls=t}},Uo=[48,57],Wo=[9,10,12,13,32,32],Go=[48,57,65,90,95,95,97,122],Ko=new Map([[`\\d`,new L(1,Uo)],[`\\D`,new L(-1,Uo)],[`\\s`,new L(1,Wo)],[`\\S`,new L(-1,Wo)],[`\\w`,new L(1,Go)],[`\\W`,new L(-1,Go)]]),qo=[48,57,65,90,97,122],Jo=[65,90,97,122],Yo=[0,127],Xo=[9,9,32,32],Zo=[0,31,127,127],Qo=[48,57],$o=[33,126],es=[97,122],ts=[32,126],ns=[33,47,58,64,91,96,123,126],rs=[9,13,32,32],is=[65,90],as=[48,57,65,90,95,95,97,122],os=[48,57,65,70,97,102],ss=new Map([[`[:alnum:]`,new L(1,qo)],[`[:^alnum:]`,new L(-1,qo)],[`[:alpha:]`,new L(1,Jo)],[`[:^alpha:]`,new L(-1,Jo)],[`[:ascii:]`,new L(1,Yo)],[`[:^ascii:]`,new L(-1,Yo)],[`[:blank:]`,new L(1,Xo)],[`[:^blank:]`,new L(-1,Xo)],[`[:cntrl:]`,new L(1,Zo)],[`[:^cntrl:]`,new L(-1,Zo)],[`[:digit:]`,new L(1,Qo)],[`[:^digit:]`,new L(-1,Qo)],[`[:graph:]`,new L(1,$o)],[`[:^graph:]`,new L(-1,$o)],[`[:lower:]`,new L(1,es)],[`[:^lower:]`,new L(-1,es)],[`[:print:]`,new L(1,ts)],[`[:^print:]`,new L(-1,ts)],[`[:punct:]`,new L(1,ns)],[`[:^punct:]`,new L(-1,ns)],[`[:space:]`,new L(1,rs)],[`[:^space:]`,new L(-1,rs)],[`[:upper:]`,new L(1,is)],[`[:^upper:]`,new L(-1,is)],[`[:word:]`,new L(1,as)],[`[:^word:]`,new L(-1,as)],[`[:xdigit:]`,new L(1,os)],[`[:^xdigit:]`,new L(-1,os)]]),cs=class e{static charClassToString(e,t){let n=`[`;for(let r=0;r<t;r+=2){r>0&&(n+=` `);let t=e[r],i=e[r+1];t===i?n+=`0x${t.toString(16)}`:n+=`0x${t.toString(16)}-0x${i.toString(16)}`}return n+=`]`,n}static cmp(e,t,n,r){let i=e[t]-n;return i===0?r-e[t+1]:i}static qsortIntPair(t,n,r){let i=((n+r)/2|0)&-2,a=t[i],o=t[i+1],s=n,c=r;for(;s<=c;){for(;s<r&&e.cmp(t,s,a,o)<0;)s+=2;for(;c>n&&e.cmp(t,c,a,o)>0;)c-=2;if(s<=c){if(s!==c){let e=t[s];t[s]=t[c],t[c]=e,e=t[s+1],t[s+1]=t[c+1],t[c+1]=e}s+=2,c-=2}}n<c&&e.qsortIntPair(t,n,c),s<r&&e.qsortIntPair(t,s,r)}constructor(e=bo.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let e=2;e<this.len;e+=2){let n=this.r[e],r=this.r[e+1];if(n<=this.r[t-1]+1){r>this.r[t-1]&&(this.r[t-1]=r);continue}this.r[t]=n,this.r[t+1]=r,t+=2}return this.len=t,this}appendLiteral(e,t){return(t&j.FOLD_CASE)===0?this.appendRange(e,e):this.appendFoldedRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let r=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=P.MIN_FOLD&&t>=P.MAX_FOLD||t<P.MIN_FOLD||e>P.MAX_FOLD)return this.appendRange(e,t);e<P.MIN_FOLD&&(this.appendRange(e,P.MIN_FOLD-1),e=P.MIN_FOLD),t>P.MAX_FOLD&&(this.appendRange(P.MAX_FOLD+1,t),t=P.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=P.simpleFold(n);e!==n;e=P.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=i+1}return t<=P.MAX_RUNE&&this.appendRange(t,P.MAX_RUNE),this}appendTable(e){for(let t=0;t<e.length;++t){let n=e.getLo(t),r=e.getHi(t),i=e.getStride(t);if(i===1){this.appendRange(n,r);continue}for(let e=n;e<=r;e+=i)this.appendRange(e,e)}return this}appendNegatedTable(e){let t=0;for(let n=0;n<e.length;++n){let r=e.getLo(n),i=e.getHi(n),a=e.getStride(n);if(a===1){t<=r-1&&this.appendRange(t,r-1),t=i+1;continue}for(let e=r;e<=i;e+=a)t<=e-1&&this.appendRange(t,e-1),t=e+1}return t<=P.MAX_RUNE&&this.appendRange(t,P.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){let r=this.r[n],i=this.r[n+1];e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=i+1}return this.len=t,e<=P.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=P.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},ls=class e{static of(t,n){return new e(t,n)}constructor(e,t){this.first=e,this.second=t}},us=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){let e=this.str.codePointAt(this.position);return this.position+=bo.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},ds=class e{static ERR_INTERNAL_ERROR=`regexp/syntax: internal error`;static ERR_INVALID_CHAR_RANGE=`invalid character class range`;static ERR_INVALID_ESCAPE=`invalid escape sequence`;static ERR_INVALID_NAMED_CAPTURE=`invalid named capture`;static ERR_INVALID_PERL_OP=`invalid or unsupported Perl syntax`;static ERR_INVALID_REPEAT_OP=`invalid nested repetition operator`;static ERR_INVALID_REPEAT_SIZE=`invalid repeat count`;static ERR_MISSING_BRACKET=`missing closing ]`;static ERR_MISSING_PAREN=`missing closing )`;static ERR_MISSING_REPEAT_ARGUMENT=`missing argument to repetition operator`;static ERR_TRAILING_BACKSLASH=`trailing backslash at end of expression`;static ERR_DUPLICATE_NAMED_CAPTURE=`duplicate capture group name`;static ERR_UNEXPECTED_PAREN=`unexpected )`;static ERR_NESTING_DEPTH=`expression nests too deeply`;static ERR_LARGE=`expression too large`;static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new N(new Uint32Array([0,P.MAX_RUNE,1]));static unicodeTable(t){return t===`Any`?ls.of(e.ANY_TABLE,e.ANY_TABLE):yo.CATEGORIES.has(t)?ls.of(yo.CATEGORIES.get(t),yo.FOLD_CATEGORIES.get(t)):yo.SCRIPTS.has(t)?ls.of(yo.SCRIPTS.get(t),yo.FOLD_SCRIPT.get(t)):null}static minFoldRune(e){if(e<P.MIN_FOLD||e>P.MAX_FOLD)return e;let t=e,n=e;for(e=P.simpleFold(e);e!==n;e=P.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===I.Op.EMPTY_MATCH)return null;if(e.op===I.Op.CONCAT&&e.subs.length>0){let t=e.subs[0];return t.op===I.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){let n=new I(I.Op.LITERAL);return n.flags=t,n.runes=bo.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt(`{`))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let i;if(!t.lookingAt(`,`))i=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt(`}`))i=-1;else if((i=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt(`}`))return-1;if(t.skip(1),r<0||r>1e3||i===-2||i>1e3||i>=0&&r>i)throw new Do(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|i&P.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n!==M.CODES.get(`_`)&&!bo.isalnum(n))return!1}return!0}static parseInt(e){let t=e.pos();for(;e.more()&&e.peek()>=M.CODES.get(`0`)&&e.peek()<=M.CODES.get(`9`);)e.skip(1);let n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===M.CODES.get(`0`)?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===I.Op.LITERAL&&e.runes.length===1||e.op===I.Op.CHAR_CLASS||e.op===I.Op.ANY_CHAR_NOT_NL||e.op===I.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case I.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case I.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case I.Op.ANY_CHAR_NOT_NL:return t!==M.CODES.get(`
245
- `);case I.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case I.Op.ANY_CHAR:break;case I.Op.ANY_CHAR_NOT_NL:e.matchRune(n,M.CODES.get(`
246
- `))&&(t.op=I.Op.ANY_CHAR);break;case I.Op.CHAR_CLASS:n.op===I.Op.LITERAL?t.runes=new cs(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new cs(t.runes).appendClass(n.runes).toArray();break;case I.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=I.Op.CHAR_CLASS,t.runes=new cs().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new Do(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case M.CODES.get(`1`):case M.CODES.get(`2`):case M.CODES.get(`3`):case M.CODES.get(`4`):case M.CODES.get(`5`):case M.CODES.get(`6`):case M.CODES.get(`7`):if(!t.more()||t.peek()<M.CODES.get(`0`)||t.peek()>M.CODES.get(`7`))break;case M.CODES.get(`0`):{let e=r-M.CODES.get(`0`);for(let n=1;n<3&&!(!t.more()||t.peek()<M.CODES.get(`0`)||t.peek()>M.CODES.get(`7`));n++)e=e*8+t.peek()-M.CODES.get(`0`),t.skip(1);return e}case M.CODES.get(`x`):{if(!t.more())break;if(r=t.pop(),r===M.CODES.get(`{`)){let e=0,n=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===M.CODES.get(`}`))break;let i=bo.unhex(r);if(i<0||(n=n*16+i,n>P.MAX_RUNE))break e;e++}if(e===0)break e;return n}let e=bo.unhex(r);if(!t.more())break;r=t.pop();let n=bo.unhex(r);if(e<0||n<0)break;return e*16+n}case M.CODES.get(`a`):return M.CODES.get(`\x07`);case M.CODES.get(`f`):return M.CODES.get(`\f`);case M.CODES.get(`n`):return M.CODES.get(`
247
- `);case M.CODES.get(`r`):return M.CODES.get(`\r`);case M.CODES.get(`t`):return M.CODES.get(` `);case M.CODES.get(`v`):return M.CODES.get(`\v`);default:if(r<=P.MAX_ASCII&&!bo.isalnum(r))return r;break}throw new Do(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new Do(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt(`\\`)?e.parseEscape(t):t.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):(t=new I(e),this.numRegexp+=1),t}reuse(e){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,e)&&delete this.height[e],e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new Do(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===I.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>e.MAX_SIZE/this.repeats?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<e.MAX_SIZE/this.repeats)return;this.size={};for(let e of this.stack)this.checkSize(e)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new Do(e.ERR_LARGE)}calcSize(e,t=!1){if(!t&&Object.prototype.hasOwnProperty.call(this.size,e))return this.size[e];let n=0;switch(e.op){case I.Op.LITERAL:n=e.runes.length;break;case I.Op.CAPTURE:case I.Op.STAR:n=2+this.calcSize(e.subs[0]);break;case I.Op.PLUS:case I.Op.QUEST:n=1+this.calcSize(e.subs[0]);break;case I.Op.CONCAT:for(let t of e.subs)n+=this.calcSize(t);break;case I.Op.ALTERNATE:for(let t of e.subs)n+=this.calcSize(t);e.subs.length>1&&(n=n+e.subs.length-1);break;case I.Op.REPEAT:{let t=this.calcSize(e.subs[0]);if(e.max===-1){n=e.min===0?2+t:1+e.min*t;break}n=e.max*t+(e.max-e.min);break}}return n=Math.max(1,n),this.size[e]=n,n}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let e of this.stack)this.checkHeight(e)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new Do(e.ERR_NESTING_DEPTH)}}calcHeight(e,t=!1){if(!t&&Object.prototype.hasOwnProperty.call(this.height,e))return this.height[e];let n=1;for(let t of e.subs){let e=this.calcHeight(t);n<1+e&&(n=1+e)}return this.height[e]=n,n}pop(){return this.stack.pop()}popToPseudo(){let e=this.stack.length,t=e;for(;t>0&&!I.isPseudoOp(this.stack[t-1].op);)t--;let n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(this.numRunes+=e.runes.length,e.op===I.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=I.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===I.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&P.simpleFold(e.runes[0])===e.runes[2]&&P.simpleFold(e.runes[2])===e.runes[0]||e.op===I.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&P.simpleFold(e.runes[0])===e.runes[1]&&P.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|j.FOLD_CASE))return null;e.op=I.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|j.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),this.checkLimits(e),e}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let i=this.stack[r-1],a=this.stack[r-2];return i.op!==I.Op.LITERAL||a.op!==I.Op.LITERAL||(i.flags&j.FOLD_CASE)!==(a.flags&j.FOLD_CASE)?!1:(a.runes=e.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=n,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,n){let r=this.newRegexp(I.Op.LITERAL);return r.flags=n,(n&j.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){let t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,r,i,a,o){let s=this.flags;if((s&j.PERL_X)!==0&&(a.more()&&a.lookingAt(`?`)&&(a.skip(1),s^=j.NON_GREEDY),o!==-1))throw new Do(e.ERR_INVALID_REPEAT_OP,a.from(o));let c=this.stack.length;if(c===0)throw new Do(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let l=this.stack[c-1];if(I.isPseudoOp(l.op))throw new Do(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=s,u.subs=[l],this.stack[c-1]=u,this.checkLimits(u),t===I.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new Do(e.ERR_INVALID_REPEAT_SIZE,a.from(i))}repeatIsValid(e,t){if(e.op===I.Op.REPEAT){let n=e.max;if(n===0)return!0;if(n<0&&(n=e.min),n>t)return!1;n>0&&(t=Math.trunc(t/n))}for(let n of e.subs)if(!this.repeatIsValid(n,t))return!1;return!0}concat(){this.maybeConcat(-1,0);let e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(I.Op.EMPTY_MATCH)):this.push(this.collapse(e,I.Op.CONCAT))}alternate(){let e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(I.Op.NO_MATCH)):this.push(this.collapse(e,I.Op.ALTERNATE))}cleanAlt(e){e.op===I.Op.CHAR_CLASS&&(e.runes=new cs(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===P.MAX_RUNE?(e.runes=[],e.op=I.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===M.CODES.get(`
244
+ `)+1&&e[3]===P.MAX_RUNE&&(r.op=I.RUNE_ANY_NOT_NL),n}compile(t){switch(t.op){case L.Op.NO_MATCH:return this.fail();case L.Op.EMPTY_MATCH:return this.nop();case L.Op.LITERAL:if(t.runes.length===0)return this.nop();{let e=null;for(let n of t.runes){let r=this.rune([n],t.flags);e=e===null?r:this.cat(e,r)}return e}case L.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case L.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case L.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case L.Op.BEGIN_LINE:return this.empty(F.EMPTY_BEGIN_LINE);case L.Op.END_LINE:return this.empty(F.EMPTY_END_LINE);case L.Op.BEGIN_TEXT:return this.empty(F.EMPTY_BEGIN_TEXT);case L.Op.END_TEXT:return this.empty(F.EMPTY_END_TEXT);case L.Op.WORD_BOUNDARY:return this.empty(F.EMPTY_WORD_BOUNDARY);case L.Op.NO_WORD_BOUNDARY:return this.empty(F.EMPTY_NO_WORD_BOUNDARY);case L.Op.CAPTURE:{let e=this.cap(t.cap<<1),n=this.compile(t.subs[0]),r=this.cap(t.cap<<1|1);return this.cat(this.cat(e,n),r)}case L.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case L.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case L.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&j.NON_GREEDY)!==0);case L.Op.CONCAT:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.cat(e,t)}return e}case L.Op.ALTERNATE:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.alt(e,t)}return e}default:throw new Do(`regexp: unhandled case in compile`)}}},Vo=class e{static simplify(t){if(t===null)return null;switch(t.op){case L.Op.CAPTURE:case L.Op.CONCAT:case L.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let i=t.subs[r],a=e.simplify(i);n===t&&a!==i&&(n=L.fromRegexp(t),n.runes=[],n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=a)}return n}case L.Op.STAR:case L.Op.PLUS:case L.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case L.Op.REPEAT:{if(t.min===0&&t.max===0)return new L(L.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(L.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(L.Op.PLUS,t.flags,n,null);let r=new L(L.Op.CONCAT),i=[];for(let e=0;e<t.min-1;e++)i.push(n);return i.push(e.simplify1(L.Op.PLUS,t.flags,n,null)),r.subs=i.slice(0),r}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let e=0;e<t.min;e++)r.push(n)}if(t.max>t.min){let i=e.simplify1(L.Op.QUEST,t.flags,n,null);for(let r=t.min+1;r<t.max;r++){let r=new L(L.Op.CONCAT);r.subs=[n,i],i=e.simplify1(L.Op.QUEST,t.flags,r,null)}if(r===null)return i;r.push(i)}if(r!==null){let e=new L(L.Op.CONCAT);return e.subs=r.slice(0),e}return new L(L.Op.NO_MATCH)}}return t}static simplify1(e,t,n,r){return n.op===L.Op.EMPTY_MATCH||e===n.op&&(t&j.NON_GREEDY)===(n.flags&j.NON_GREEDY)?n:(r!==null&&r.op===e&&(r.flags&j.NON_GREEDY)===(t&j.NON_GREEDY)&&n===r.subs[0]||(r=new L(e),r.flags=t,r.subs=[n]),r)}},R=class{constructor(e,t){this.sign=e,this.cls=t}},Ho=[48,57],Uo=[9,10,12,13,32,32],Wo=[48,57,65,90,95,95,97,122],Go=new Map([[`\\d`,new R(1,Ho)],[`\\D`,new R(-1,Ho)],[`\\s`,new R(1,Uo)],[`\\S`,new R(-1,Uo)],[`\\w`,new R(1,Wo)],[`\\W`,new R(-1,Wo)]]),Ko=[48,57,65,90,97,122],qo=[65,90,97,122],Jo=[0,127],Yo=[9,9,32,32],Xo=[0,31,127,127],Zo=[48,57],Qo=[33,126],$o=[97,122],es=[32,126],ts=[33,47,58,64,91,96,123,126],ns=[9,13,32,32],rs=[65,90],is=[48,57,65,90,95,95,97,122],as=[48,57,65,70,97,102],os=new Map([[`[:alnum:]`,new R(1,Ko)],[`[:^alnum:]`,new R(-1,Ko)],[`[:alpha:]`,new R(1,qo)],[`[:^alpha:]`,new R(-1,qo)],[`[:ascii:]`,new R(1,Jo)],[`[:^ascii:]`,new R(-1,Jo)],[`[:blank:]`,new R(1,Yo)],[`[:^blank:]`,new R(-1,Yo)],[`[:cntrl:]`,new R(1,Xo)],[`[:^cntrl:]`,new R(-1,Xo)],[`[:digit:]`,new R(1,Zo)],[`[:^digit:]`,new R(-1,Zo)],[`[:graph:]`,new R(1,Qo)],[`[:^graph:]`,new R(-1,Qo)],[`[:lower:]`,new R(1,$o)],[`[:^lower:]`,new R(-1,$o)],[`[:print:]`,new R(1,es)],[`[:^print:]`,new R(-1,es)],[`[:punct:]`,new R(1,ts)],[`[:^punct:]`,new R(-1,ts)],[`[:space:]`,new R(1,ns)],[`[:^space:]`,new R(-1,ns)],[`[:upper:]`,new R(1,rs)],[`[:^upper:]`,new R(-1,rs)],[`[:word:]`,new R(1,is)],[`[:^word:]`,new R(-1,is)],[`[:xdigit:]`,new R(1,as)],[`[:^xdigit:]`,new R(-1,as)]]),ss=class e{static charClassToString(e,t){let n=`[`;for(let r=0;r<t;r+=2){r>0&&(n+=` `);let t=e[r],i=e[r+1];t===i?n+=`0x${t.toString(16)}`:n+=`0x${t.toString(16)}-0x${i.toString(16)}`}return n+=`]`,n}static cmp(e,t,n,r){let i=e[t]-n;return i===0?r-e[t+1]:i}static qsortIntPair(t,n,r){let i=((n+r)/2|0)&-2,a=t[i],o=t[i+1],s=n,c=r;for(;s<=c;){for(;s<r&&e.cmp(t,s,a,o)<0;)s+=2;for(;c>n&&e.cmp(t,c,a,o)>0;)c-=2;if(s<=c){if(s!==c){let e=t[s];t[s]=t[c],t[c]=e,e=t[s+1],t[s+1]=t[c+1],t[c+1]=e}s+=2,c-=2}}n<c&&e.qsortIntPair(t,n,c),s<r&&e.qsortIntPair(t,s,r)}constructor(e=F.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let e=2;e<this.len;e+=2){let n=this.r[e],r=this.r[e+1];if(n<=this.r[t-1]+1){r>this.r[t-1]&&(this.r[t-1]=r);continue}this.r[t]=n,this.r[t+1]=r,t+=2}return this.len=t,this}appendLiteral(e,t){return(t&j.FOLD_CASE)===0?this.appendRange(e,e):this.appendFoldedRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let r=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=P.MIN_FOLD&&t>=P.MAX_FOLD||t<P.MIN_FOLD||e>P.MAX_FOLD)return this.appendRange(e,t);e<P.MIN_FOLD&&(this.appendRange(e,P.MIN_FOLD-1),e=P.MIN_FOLD),t>P.MAX_FOLD&&(this.appendRange(P.MAX_FOLD+1,t),t=P.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=P.simpleFold(n);e!==n;e=P.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=i+1}return t<=P.MAX_RUNE&&this.appendRange(t,P.MAX_RUNE),this}appendTable(e){for(let t=0;t<e.length;++t){let n=e.getLo(t),r=e.getHi(t),i=e.getStride(t);if(i===1){this.appendRange(n,r);continue}for(let e=n;e<=r;e+=i)this.appendRange(e,e)}return this}appendNegatedTable(e){let t=0;for(let n=0;n<e.length;++n){let r=e.getLo(n),i=e.getHi(n),a=e.getStride(n);if(a===1){t<=r-1&&this.appendRange(t,r-1),t=i+1;continue}for(let e=r;e<=i;e+=a)t<=e-1&&this.appendRange(t,e-1),t=e+1}return t<=P.MAX_RUNE&&this.appendRange(t,P.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){let r=this.r[n],i=this.r[n+1];e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=i+1}return this.len=t,e<=P.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=P.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},cs=class e{static of(t,n){return new e(t,n)}constructor(e,t){this.first=e,this.second=t}},ls=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){let e=this.str.codePointAt(this.position);return this.position+=F.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},us=class e{static ERR_INTERNAL_ERROR=`regexp/syntax: internal error`;static ERR_INVALID_CHAR_RANGE=`invalid character class range`;static ERR_INVALID_ESCAPE=`invalid escape sequence`;static ERR_INVALID_NAMED_CAPTURE=`invalid named capture`;static ERR_INVALID_PERL_OP=`invalid or unsupported Perl syntax`;static ERR_INVALID_REPEAT_OP=`invalid nested repetition operator`;static ERR_INVALID_REPEAT_SIZE=`invalid repeat count`;static ERR_MISSING_BRACKET=`missing closing ]`;static ERR_MISSING_PAREN=`missing closing )`;static ERR_MISSING_REPEAT_ARGUMENT=`missing argument to repetition operator`;static ERR_TRAILING_BACKSLASH=`trailing backslash at end of expression`;static ERR_DUPLICATE_NAMED_CAPTURE=`duplicate capture group name`;static ERR_UNEXPECTED_PAREN=`unexpected )`;static ERR_NESTING_DEPTH=`expression nests too deeply`;static ERR_LARGE=`expression too large`;static MAX_HEIGHT=1e3;static MAX_SIZE=3355443;static MAX_RUNES=33554432;static ANY_TABLE=new N(new Uint32Array([0,P.MAX_RUNE,1]));static unicodeTable(t){return t===`Any`?cs.of(e.ANY_TABLE,e.ANY_TABLE):yo.CATEGORIES.has(t)?cs.of(yo.CATEGORIES.get(t),yo.FOLD_CATEGORIES.get(t)):yo.SCRIPTS.has(t)?cs.of(yo.SCRIPTS.get(t),yo.FOLD_SCRIPT.get(t)):null}static minFoldRune(e){if(e<P.MIN_FOLD||e>P.MAX_FOLD)return e;let t=e,n=e;for(e=P.simpleFold(e);e!==n;e=P.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===L.Op.EMPTY_MATCH)return null;if(e.op===L.Op.CONCAT&&e.subs.length>0){let t=e.subs[0];return t.op===L.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){let n=new L(L.Op.LITERAL);return n.flags=t,n.runes=F.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt(`{`))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let i;if(!t.lookingAt(`,`))i=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt(`}`))i=-1;else if((i=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt(`}`))return-1;if(t.skip(1),r<0||r>1e3||i===-2||i>1e3||i>=0&&r>i)throw new Eo(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|i&P.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n!==M.CODES.get(`_`)&&!F.isalnum(n))return!1}return!0}static parseInt(e){let t=e.pos();for(;e.more()&&e.peek()>=M.CODES.get(`0`)&&e.peek()<=M.CODES.get(`9`);)e.skip(1);let n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===M.CODES.get(`0`)?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===L.Op.LITERAL&&e.runes.length===1||e.op===L.Op.CHAR_CLASS||e.op===L.Op.ANY_CHAR_NOT_NL||e.op===L.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case L.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case L.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case L.Op.ANY_CHAR_NOT_NL:return t!==M.CODES.get(`
245
+ `);case L.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case L.Op.ANY_CHAR:break;case L.Op.ANY_CHAR_NOT_NL:e.matchRune(n,M.CODES.get(`
246
+ `))&&(t.op=L.Op.ANY_CHAR);break;case L.Op.CHAR_CLASS:n.op===L.Op.LITERAL?t.runes=new ss(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new ss(t.runes).appendClass(n.runes).toArray();break;case L.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=L.Op.CHAR_CLASS,t.runes=new ss().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new Eo(e.ERR_TRAILING_BACKSLASH);let r=t.pop();e:switch(r){case M.CODES.get(`1`):case M.CODES.get(`2`):case M.CODES.get(`3`):case M.CODES.get(`4`):case M.CODES.get(`5`):case M.CODES.get(`6`):case M.CODES.get(`7`):if(!t.more()||t.peek()<M.CODES.get(`0`)||t.peek()>M.CODES.get(`7`))break;case M.CODES.get(`0`):{let e=r-M.CODES.get(`0`);for(let n=1;n<3&&!(!t.more()||t.peek()<M.CODES.get(`0`)||t.peek()>M.CODES.get(`7`));n++)e=e*8+t.peek()-M.CODES.get(`0`),t.skip(1);return e}case M.CODES.get(`x`):{if(!t.more())break;if(r=t.pop(),r===M.CODES.get(`{`)){let e=0,n=0;for(;;){if(!t.more())break e;if(r=t.pop(),r===M.CODES.get(`}`))break;let i=F.unhex(r);if(i<0||(n=n*16+i,n>P.MAX_RUNE))break e;e++}if(e===0)break e;return n}let e=F.unhex(r);if(!t.more())break;r=t.pop();let n=F.unhex(r);if(e<0||n<0)break;return e*16+n}case M.CODES.get(`a`):return M.CODES.get(`\x07`);case M.CODES.get(`f`):return M.CODES.get(`\f`);case M.CODES.get(`n`):return M.CODES.get(`
247
+ `);case M.CODES.get(`r`):return M.CODES.get(`\r`);case M.CODES.get(`t`):return M.CODES.get(` `);case M.CODES.get(`v`):return M.CODES.get(`\v`);default:if(r<=P.MAX_ASCII&&!F.isalnum(r))return r;break}throw new Eo(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new Eo(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt(`\\`)?e.parseEscape(t):t.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null,this.numRegexp=0,this.numRunes=0,this.repeats=0,this.height=null,this.size=null}newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):(t=new L(e),this.numRegexp+=1),t}reuse(e){this.height!==null&&Object.prototype.hasOwnProperty.call(this.height,e)&&delete this.height[e],e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}checkLimits(t){if(this.numRunes>e.MAX_RUNES)throw new Eo(e.ERR_LARGE);this.checkSize(t),this.checkHeight(t)}checkSize(t){if(this.size===null){if(this.repeats===0&&(this.repeats=1),t.op===L.Op.REPEAT){let n=t.max;n===-1&&(n=t.min),n<=0&&(n=1),n>e.MAX_SIZE/this.repeats?this.repeats=e.MAX_SIZE:this.repeats*=n}if(this.numRegexp<e.MAX_SIZE/this.repeats)return;this.size={};for(let e of this.stack)this.checkSize(e)}if(this.calcSize(t,!0)>e.MAX_SIZE)throw new Eo(e.ERR_LARGE)}calcSize(e,t=!1){if(!t&&Object.prototype.hasOwnProperty.call(this.size,e))return this.size[e];let n=0;switch(e.op){case L.Op.LITERAL:n=e.runes.length;break;case L.Op.CAPTURE:case L.Op.STAR:n=2+this.calcSize(e.subs[0]);break;case L.Op.PLUS:case L.Op.QUEST:n=1+this.calcSize(e.subs[0]);break;case L.Op.CONCAT:for(let t of e.subs)n+=this.calcSize(t);break;case L.Op.ALTERNATE:for(let t of e.subs)n+=this.calcSize(t);e.subs.length>1&&(n=n+e.subs.length-1);break;case L.Op.REPEAT:{let t=this.calcSize(e.subs[0]);if(e.max===-1){n=e.min===0?2+t:1+e.min*t;break}n=e.max*t+(e.max-e.min);break}}return n=Math.max(1,n),this.size[e]=n,n}checkHeight(t){if(!(this.numRegexp<e.MAX_HEIGHT)){if(this.height===null){this.height={};for(let e of this.stack)this.checkHeight(e)}if(this.calcHeight(t,!0)>e.MAX_HEIGHT)throw new Eo(e.ERR_NESTING_DEPTH)}}calcHeight(e,t=!1){if(!t&&Object.prototype.hasOwnProperty.call(this.height,e))return this.height[e];let n=1;for(let t of e.subs){let e=this.calcHeight(t);n<1+e&&(n=1+e)}return this.height[e]=n,n}pop(){return this.stack.pop()}popToPseudo(){let e=this.stack.length,t=e;for(;t>0&&!L.isPseudoOp(this.stack[t-1].op);)t--;let n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(this.numRunes+=e.runes.length,e.op===L.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&-2))return null;e.op=L.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&-2}else if(e.op===L.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&P.simpleFold(e.runes[0])===e.runes[2]&&P.simpleFold(e.runes[2])===e.runes[0]||e.op===L.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&P.simpleFold(e.runes[0])===e.runes[1]&&P.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|j.FOLD_CASE))return null;e.op=L.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|j.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),this.checkLimits(e),e}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let i=this.stack[r-1],a=this.stack[r-2];return i.op!==L.Op.LITERAL||a.op!==L.Op.LITERAL||(i.flags&j.FOLD_CASE)!==(a.flags&j.FOLD_CASE)?!1:(a.runes=e.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=n,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,n){let r=this.newRegexp(L.Op.LITERAL);return r.flags=n,(n&j.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){let t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,r,i,a,o){let s=this.flags;if((s&j.PERL_X)!==0&&(a.more()&&a.lookingAt(`?`)&&(a.skip(1),s^=j.NON_GREEDY),o!==-1))throw new Eo(e.ERR_INVALID_REPEAT_OP,a.from(o));let c=this.stack.length;if(c===0)throw new Eo(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let l=this.stack[c-1];if(L.isPseudoOp(l.op))throw new Eo(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.newRegexp(t);if(u.min=n,u.max=r,u.flags=s,u.subs=[l],this.stack[c-1]=u,this.checkLimits(u),t===L.Op.REPEAT&&(n>=2||r>=2)&&!this.repeatIsValid(u,1e3))throw new Eo(e.ERR_INVALID_REPEAT_SIZE,a.from(i))}repeatIsValid(e,t){if(e.op===L.Op.REPEAT){let n=e.max;if(n===0)return!0;if(n<0&&(n=e.min),n>t)return!1;n>0&&(t=Math.trunc(t/n))}for(let n of e.subs)if(!this.repeatIsValid(n,t))return!1;return!0}concat(){this.maybeConcat(-1,0);let e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(L.Op.EMPTY_MATCH)):this.push(this.collapse(e,L.Op.CONCAT))}alternate(){let e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(L.Op.NO_MATCH)):this.push(this.collapse(e,L.Op.ALTERNATE))}cleanAlt(e){e.op===L.Op.CHAR_CLASS&&(e.runes=new ss(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===P.MAX_RUNE?(e.runes=[],e.op=L.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===M.CODES.get(`
248
248
  `)-1&&e.runes[2]===M.CODES.get(`
249
- `)+1&&e.runes[3]===P.MAX_RUNE&&(e.runes=[],e.op=I.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=Array(n).fill(null),i=0;for(let n of e)n.op===t?(r.splice(i,n.subs.length,...n.subs),i+=n.subs.length,this.reuse(n)):r[i++]=n;let a=this.newRegexp(t);if(a.subs=r,t===I.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let e=a;a=a.subs[0],this.reuse(e)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,i=0,a=null,o=0,s=0,c=0;for(let e=0;e<=r;e++){let l=null,u=0,d=0;if(e<r){let r=t[n+e];if(r.op===I.Op.CONCAT&&r.subs.length>0&&(r=r.subs[0]),r.op===I.Op.LITERAL&&(l=r.runes,u=r.runes.length,d=r.flags&j.FOLD_CASE),d===s){let e=0;for(;e<o&&e<u&&a[e]===l[e];)e++;if(e>0){o=e;continue}}}if(e!==c)if(e===c+1)t[i++]=t[n+c];else{let r=this.newRegexp(I.Op.LITERAL);r.flags=s,r.runes=a.slice(0,o);for(let r=c;r<e;r++)t[n+r]=this.removeLeadingString(t[n+r],o),this.checkLimits(t[n+r]);let l=this.collapse(t.slice(n+c,n+e),I.Op.ALTERNATE),u=this.newRegexp(I.Op.CONCAT);u.subs=[r,l],t[i++]=u}c=e,a=l,o=u,s=d}r=i,n=0,c=0,i=0;let l=null;for(let a=0;a<=r;a++){let o=null;if(!(a<r&&(o=e.leadingRegexp(t[n+a]),l!==null&&l.equals(o)&&(e.isCharClass(l)||l.op===I.Op.REPEAT&&l.min===l.max&&e.isCharClass(l.subs[0]))))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let e=l;for(let e=c;e<a;e++){let r=e!==c;t[n+e]=this.removeLeadingRegexp(t[n+e],r),this.checkLimits(t[n+e])}let r=this.collapse(t.slice(n+c,n+a),I.Op.ALTERNATE),o=this.newRegexp(I.Op.CONCAT);o.subs=[e,r],t[i++]=o}c=a,l=o}}r=i,n=0,c=0,i=0;for(let a=0;a<=r;a++)if(!(a<r&&e.isCharClass(t[n+a]))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let r=c;for(let e=c+1;e<a;e++){let i=t[n+r],a=t[n+e];(i.op<a.op||i.op===a.op&&(i.runes===null?0:i.runes.length)<(a.runes===null?0:a.runes.length))&&(r=e)}let o=t[n+c];t[n+c]=t[n+r],t[n+r]=o;for(let r=c+1;r<a;r++)e.mergeCharClass(t[n+c],t[n+r]),this.reuse(t[n+r]);this.cleanAlt(t[n+c]),t[i++]=t[n+c]}a<r&&(t[i++]=t[n+a]),c=a+1}r=i,n=0,c=0,i=0;for(let e=0;e<r;++e)e+1<r&&t[n+e].op===I.Op.EMPTY_MATCH&&t[n+e+1].op===I.Op.EMPTY_MATCH||(t[i++]=t[n+e]);return r=i,n=0,t.slice(n,r)}removeLeadingString(e,t){if(e.op===I.Op.CONCAT&&e.subs.length>0){let n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===I.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=I.Op.EMPTY_MATCH,e.subs=null;break;case 2:{let t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===I.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=I.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===I.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=I.Op.EMPTY_MATCH,e.subs=I.emptySubs();break;case 1:{let t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(I.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&j.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,i=new us(this.wholeRegexp);for(;i.more();){let a=-1;e:switch(i.peek()){case M.CODES.get(`(`):if((this.flags&j.PERL_X)!==0&&i.lookingAt(`(?`)){this.parsePerlFlags(i);break}this.op(I.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case M.CODES.get(`|`):this.parseVerticalBar(),i.skip(1);break;case M.CODES.get(`)`):this.parseRightParen(),i.skip(1);break;case M.CODES.get(`^`):(this.flags&j.ONE_LINE)===0?this.op(I.Op.BEGIN_LINE):this.op(I.Op.BEGIN_TEXT),i.skip(1);break;case M.CODES.get(`$`):(this.flags&j.ONE_LINE)===0?this.op(I.Op.END_LINE):this.op(I.Op.END_TEXT).flags|=j.WAS_DOLLAR,i.skip(1);break;case M.CODES.get(`.`):(this.flags&j.DOT_NL)===0?this.op(I.Op.ANY_CHAR_NOT_NL):this.op(I.Op.ANY_CHAR),i.skip(1);break;case M.CODES.get(`[`):this.parseClass(i);break;case M.CODES.get(`*`):case M.CODES.get(`+`):case M.CODES.get(`?`):{a=i.pos();let e=null;switch(i.pop()){case M.CODES.get(`*`):e=I.Op.STAR;break;case M.CODES.get(`+`):e=I.Op.PLUS;break;case M.CODES.get(`?`):e=I.Op.QUEST;break}this.repeat(e,n,r,a,i,t);break}case M.CODES.get(`{`):{a=i.pos();let o=e.parseRepeat(i);if(o<0){i.rewindTo(a),this.literal(i.pop());break}n=o>>16,r=(o&P.MAX_BMP)<<16>>16,this.repeat(I.Op.REPEAT,n,r,a,i,t);break}case M.CODES.get(`\\`):{let t=i.pos();if(i.skip(1),(this.flags&j.PERL_X)!==0&&i.more())switch(i.pop()){case M.CODES.get(`A`):this.op(I.Op.BEGIN_TEXT);break e;case M.CODES.get(`b`):this.op(I.Op.WORD_BOUNDARY);break e;case M.CODES.get(`B`):this.op(I.Op.NO_WORD_BOUNDARY);break e;case M.CODES.get(`C`):throw new Do(e.ERR_INVALID_ESCAPE,`\\C`);case M.CODES.get(`Q`):{let e=i.rest(),t=e.indexOf(`\\E`);t>=0&&(e=e.substring(0,t)),i.skipString(e),i.skipString(`\\E`);let n=0;for(;n<e.length;){let t=e.codePointAt(n);this.literal(t),n+=bo.charCount(t)}break e}case M.CODES.get(`z`):this.op(I.Op.END_TEXT);break e;default:i.rewindTo(t);break}let n=this.newRegexp(I.Op.CHAR_CLASS);if(n.flags=this.flags,i.lookingAt(`\\p`)||i.lookingAt(`\\P`)){let e=new cs;if(this.parseUnicodeClass(i,e)){n.runes=e.toArray(),this.push(n);break e}}let r=new cs;if(this.parsePerlClassEscape(i,r)){n.runes=r.toArray(),this.push(n);break e}i.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(i));break}default:this.literal(i.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Do(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith(`(?P<`)||r.startsWith(`(?<`)){let n=r.charAt(2)===`P`?4:3,i=r.indexOf(`>`);if(i<0)throw new Do(e.ERR_INVALID_NAMED_CAPTURE,r);let a=r.substring(n,i);if(t.skipString(a),t.skip(n+1),!e.isValidCaptureName(a))throw new Do(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,i+1));let o=this.op(I.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[a])throw new Do(e.ERR_DUPLICATE_NAMED_CAPTURE,a);this.namedGroups[a]=this.numCap,o.name=a;return}t.skip(2);let i=this.flags,a=1,o=!1;e:for(;t.more();){let e=t.pop();switch(e){case M.CODES.get(`i`):i|=j.FOLD_CASE,o=!0;break;case M.CODES.get(`m`):i&=-17,o=!0;break;case M.CODES.get(`s`):i|=j.DOT_NL,o=!0;break;case M.CODES.get(`U`):i|=j.NON_GREEDY,o=!0;break;case M.CODES.get(`-`):if(a<0)break e;a=-1,i=~i,o=!1;break;case M.CODES.get(`:`):case M.CODES.get(`)`):if(a<0){if(!o)break e;i=~i}e===M.CODES.get(`:`)&&this.op(I.Op.LEFT_PAREN),this.flags=i;return;default:break e}}throw new Do(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(I.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===I.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let e=r;r=n,n=e,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let e=this.stack[t-1],n=this.stack[t-2];if(n.op===I.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Do(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let t=this.pop(),n=this.pop();if(n.op!==I.Op.LEFT_PAREN)throw new Do(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=I.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){let n=e.pos();if((this.flags&j.PERL_X)===0||!e.more()||e.pop()!==M.CODES.get(`\\`)||!e.more())return!1;e.pop();let r=e.from(n),i=Ko.has(r)?Ko.get(r):null;return i===null?!1:(t.appendGroup(i,(this.flags&j.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),i=r.indexOf(`:]`);if(i<0)return!1;let a=r.substring(0,i+2);t.skipString(a);let o=ss.has(a)?ss.get(a):null;if(o===null)throw new Do(e.ERR_INVALID_CHAR_RANGE,a);return n.appendGroup(o,(this.flags&j.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&j.UNICODE_GROUPS)===0||!t.lookingAt(`\\p`)&&!t.lookingAt(`\\P`))return!1;t.skip(1);let i=1,a=t.pop();if(a===M.CODES.get(`P`)&&(i=-1),!t.more())throw t.rewindTo(r),new Do(e.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let o;if(a!==M.CODES.get(`{`))o=bo.runeToString(a);else{let n=t.rest(),i=n.indexOf(`}`);if(i<0)throw t.rewindTo(r),new Do(e.ERR_INVALID_CHAR_RANGE,t.rest());o=n.substring(0,i),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===M.CODES.get(`^`)&&(i=0-i,o=o.substring(1));let s=e.unicodeTable(o);if(s===null)throw new Do(e.ERR_INVALID_CHAR_RANGE,t.from(r));let c=s.first,l=s.second;if((this.flags&j.FOLD_CASE)===0||l===null)n.appendTableWithSign(c,i);else{let e=new cs().appendTable(c).appendTable(l).cleanClass().toArray();n.appendClassWithSign(e,i)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(I.Op.CHAR_CLASS);r.flags=this.flags;let i=new cs,a=1;t.more()&&t.lookingAt(`^`)&&(a=-1,t.skip(1),(this.flags&j.CLASS_NL)===0&&i.appendRange(M.CODES.get(`
249
+ `)+1&&e.runes[3]===P.MAX_RUNE&&(e.runes=[],e.op=L.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=Array(n).fill(null),i=0;for(let n of e)n.op===t?(r.splice(i,n.subs.length,...n.subs),i+=n.subs.length,this.reuse(n)):r[i++]=n;let a=this.newRegexp(t);if(a.subs=r,t===L.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let e=a;a=a.subs[0],this.reuse(e)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,i=0,a=null,o=0,s=0,c=0;for(let e=0;e<=r;e++){let l=null,u=0,d=0;if(e<r){let r=t[n+e];if(r.op===L.Op.CONCAT&&r.subs.length>0&&(r=r.subs[0]),r.op===L.Op.LITERAL&&(l=r.runes,u=r.runes.length,d=r.flags&j.FOLD_CASE),d===s){let e=0;for(;e<o&&e<u&&a[e]===l[e];)e++;if(e>0){o=e;continue}}}if(e!==c)if(e===c+1)t[i++]=t[n+c];else{let r=this.newRegexp(L.Op.LITERAL);r.flags=s,r.runes=a.slice(0,o);for(let r=c;r<e;r++)t[n+r]=this.removeLeadingString(t[n+r],o),this.checkLimits(t[n+r]);let l=this.collapse(t.slice(n+c,n+e),L.Op.ALTERNATE),u=this.newRegexp(L.Op.CONCAT);u.subs=[r,l],t[i++]=u}c=e,a=l,o=u,s=d}r=i,n=0,c=0,i=0;let l=null;for(let a=0;a<=r;a++){let o=null;if(!(a<r&&(o=e.leadingRegexp(t[n+a]),l!==null&&l.equals(o)&&(e.isCharClass(l)||l.op===L.Op.REPEAT&&l.min===l.max&&e.isCharClass(l.subs[0]))))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let e=l;for(let e=c;e<a;e++){let r=e!==c;t[n+e]=this.removeLeadingRegexp(t[n+e],r),this.checkLimits(t[n+e])}let r=this.collapse(t.slice(n+c,n+a),L.Op.ALTERNATE),o=this.newRegexp(L.Op.CONCAT);o.subs=[e,r],t[i++]=o}c=a,l=o}}r=i,n=0,c=0,i=0;for(let a=0;a<=r;a++)if(!(a<r&&e.isCharClass(t[n+a]))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let r=c;for(let e=c+1;e<a;e++){let i=t[n+r],a=t[n+e];(i.op<a.op||i.op===a.op&&(i.runes===null?0:i.runes.length)<(a.runes===null?0:a.runes.length))&&(r=e)}let o=t[n+c];t[n+c]=t[n+r],t[n+r]=o;for(let r=c+1;r<a;r++)e.mergeCharClass(t[n+c],t[n+r]),this.reuse(t[n+r]);this.cleanAlt(t[n+c]),t[i++]=t[n+c]}a<r&&(t[i++]=t[n+a]),c=a+1}r=i,n=0,c=0,i=0;for(let e=0;e<r;++e)e+1<r&&t[n+e].op===L.Op.EMPTY_MATCH&&t[n+e+1].op===L.Op.EMPTY_MATCH||(t[i++]=t[n+e]);return r=i,n=0,t.slice(n,r)}removeLeadingString(e,t){if(e.op===L.Op.CONCAT&&e.subs.length>0){let n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===L.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=L.Op.EMPTY_MATCH,e.subs=null;break;case 2:{let t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===L.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=L.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===L.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=L.Op.EMPTY_MATCH,e.subs=L.emptySubs();break;case 1:{let t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(L.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&j.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,i=new ls(this.wholeRegexp);for(;i.more();){let a=-1;e:switch(i.peek()){case M.CODES.get(`(`):if((this.flags&j.PERL_X)!==0&&i.lookingAt(`(?`)){this.parsePerlFlags(i);break}this.op(L.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case M.CODES.get(`|`):this.parseVerticalBar(),i.skip(1);break;case M.CODES.get(`)`):this.parseRightParen(),i.skip(1);break;case M.CODES.get(`^`):(this.flags&j.ONE_LINE)===0?this.op(L.Op.BEGIN_LINE):this.op(L.Op.BEGIN_TEXT),i.skip(1);break;case M.CODES.get(`$`):(this.flags&j.ONE_LINE)===0?this.op(L.Op.END_LINE):this.op(L.Op.END_TEXT).flags|=j.WAS_DOLLAR,i.skip(1);break;case M.CODES.get(`.`):(this.flags&j.DOT_NL)===0?this.op(L.Op.ANY_CHAR_NOT_NL):this.op(L.Op.ANY_CHAR),i.skip(1);break;case M.CODES.get(`[`):this.parseClass(i);break;case M.CODES.get(`*`):case M.CODES.get(`+`):case M.CODES.get(`?`):{a=i.pos();let e=null;switch(i.pop()){case M.CODES.get(`*`):e=L.Op.STAR;break;case M.CODES.get(`+`):e=L.Op.PLUS;break;case M.CODES.get(`?`):e=L.Op.QUEST;break}this.repeat(e,n,r,a,i,t);break}case M.CODES.get(`{`):{a=i.pos();let o=e.parseRepeat(i);if(o<0){i.rewindTo(a),this.literal(i.pop());break}n=o>>16,r=(o&P.MAX_BMP)<<16>>16,this.repeat(L.Op.REPEAT,n,r,a,i,t);break}case M.CODES.get(`\\`):{let t=i.pos();if(i.skip(1),(this.flags&j.PERL_X)!==0&&i.more())switch(i.pop()){case M.CODES.get(`A`):this.op(L.Op.BEGIN_TEXT);break e;case M.CODES.get(`b`):this.op(L.Op.WORD_BOUNDARY);break e;case M.CODES.get(`B`):this.op(L.Op.NO_WORD_BOUNDARY);break e;case M.CODES.get(`C`):throw new Eo(e.ERR_INVALID_ESCAPE,`\\C`);case M.CODES.get(`Q`):{let e=i.rest(),t=e.indexOf(`\\E`);t>=0&&(e=e.substring(0,t)),i.skipString(e),i.skipString(`\\E`);let n=0;for(;n<e.length;){let t=e.codePointAt(n);this.literal(t),n+=F.charCount(t)}break e}case M.CODES.get(`z`):this.op(L.Op.END_TEXT);break e;default:i.rewindTo(t);break}let n=this.newRegexp(L.Op.CHAR_CLASS);if(n.flags=this.flags,i.lookingAt(`\\p`)||i.lookingAt(`\\P`)){let e=new ss;if(this.parseUnicodeClass(i,e)){n.runes=e.toArray(),this.push(n);break e}}let r=new ss;if(this.parsePerlClassEscape(i,r)){n.runes=r.toArray(),this.push(n);break e}i.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(i));break}default:this.literal(i.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Eo(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith(`(?P<`)||r.startsWith(`(?<`)){let n=r.charAt(2)===`P`?4:3,i=r.indexOf(`>`);if(i<0)throw new Eo(e.ERR_INVALID_NAMED_CAPTURE,r);let a=r.substring(n,i);if(t.skipString(a),t.skip(n+1),!e.isValidCaptureName(a))throw new Eo(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,i+1));let o=this.op(L.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[a])throw new Eo(e.ERR_DUPLICATE_NAMED_CAPTURE,a);this.namedGroups[a]=this.numCap,o.name=a;return}t.skip(2);let i=this.flags,a=1,o=!1;e:for(;t.more();){let e=t.pop();switch(e){case M.CODES.get(`i`):i|=j.FOLD_CASE,o=!0;break;case M.CODES.get(`m`):i&=-17,o=!0;break;case M.CODES.get(`s`):i|=j.DOT_NL,o=!0;break;case M.CODES.get(`U`):i|=j.NON_GREEDY,o=!0;break;case M.CODES.get(`-`):if(a<0)break e;a=-1,i=~i,o=!1;break;case M.CODES.get(`:`):case M.CODES.get(`)`):if(a<0){if(!o)break e;i=~i}e===M.CODES.get(`:`)&&this.op(L.Op.LEFT_PAREN),this.flags=i;return;default:break e}}throw new Eo(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(L.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===L.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let e=r;r=n,n=e,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let e=this.stack[t-1],n=this.stack[t-2];if(n.op===L.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Eo(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let t=this.pop(),n=this.pop();if(n.op!==L.Op.LEFT_PAREN)throw new Eo(e.ERR_UNEXPECTED_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=L.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){let n=e.pos();if((this.flags&j.PERL_X)===0||!e.more()||e.pop()!==M.CODES.get(`\\`)||!e.more())return!1;e.pop();let r=e.from(n),i=Go.has(r)?Go.get(r):null;return i===null?!1:(t.appendGroup(i,(this.flags&j.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),i=r.indexOf(`:]`);if(i<0)return!1;let a=r.substring(0,i+2);t.skipString(a);let o=os.has(a)?os.get(a):null;if(o===null)throw new Eo(e.ERR_INVALID_CHAR_RANGE,a);return n.appendGroup(o,(this.flags&j.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&j.UNICODE_GROUPS)===0||!t.lookingAt(`\\p`)&&!t.lookingAt(`\\P`))return!1;t.skip(1);let i=1,a=t.pop();if(a===M.CODES.get(`P`)&&(i=-1),!t.more())throw t.rewindTo(r),new Eo(e.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let o;if(a!==M.CODES.get(`{`))o=F.runeToString(a);else{let n=t.rest(),i=n.indexOf(`}`);if(i<0)throw t.rewindTo(r),new Eo(e.ERR_INVALID_CHAR_RANGE,t.rest());o=n.substring(0,i),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===M.CODES.get(`^`)&&(i=0-i,o=o.substring(1));let s=e.unicodeTable(o);if(s===null)throw new Eo(e.ERR_INVALID_CHAR_RANGE,t.from(r));let c=s.first,l=s.second;if((this.flags&j.FOLD_CASE)===0||l===null)n.appendTableWithSign(c,i);else{let e=new ss().appendTable(c).appendTable(l).cleanClass().toArray();n.appendClassWithSign(e,i)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(L.Op.CHAR_CLASS);r.flags=this.flags;let i=new ss,a=1;t.more()&&t.lookingAt(`^`)&&(a=-1,t.skip(1),(this.flags&j.CLASS_NL)===0&&i.appendRange(M.CODES.get(`
250
250
  `),M.CODES.get(`
251
- `)));let o=!0;for(;!t.more()||t.peek()!==M.CODES.get(`]`)||o;){if(t.more()&&t.lookingAt(`-`)&&(this.flags&j.PERL_X)===0&&!o){let r=t.rest();if(r===`-`||!r.startsWith(`-]`))throw t.rewindTo(n),new Do(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let r=t.pos();if(t.lookingAt(`[:`)){if(this.parseNamedClass(t,i))continue;t.rewindTo(r)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(r);let a=e.parseClassChar(t,n),s=a;if(t.more()&&t.lookingAt(`-`)){if(t.skip(1),t.more()&&t.lookingAt(`]`))t.skip(-1);else if(s=e.parseClassChar(t,n),s<a)throw new Do(e.ERR_INVALID_CHAR_RANGE,t.from(r))}(this.flags&j.FOLD_CASE)===0?i.appendRange(a,s):i.appendFoldedRange(a,s)}t.skip(1),i.cleanClass(),a<0&&i.negateClass(),r.runes=i.toArray(),this.push(r)}},fs=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}},ps=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,j.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,j.POSIX,!0)}static compileImpl(t,n,r){let i=ds.parse(t,n),a=i.maxCap();i=Ho.simplify(i);let o=Vo.compileRegexp(i),s=new e(t,o,a,r),[c,l]=o.prefix();return s.prefixComplete=c,s.prefix=l,s.prefixUTF8=bo.stringToUtf8ByteArray(s.prefix),s.prefix.length>0&&(s.prefixRune=s.prefix.codePointAt(0)),s.namedGroups=i.namedGroups,s}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new fs}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=Ro.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let i=this.get(),a=!1;i?i.next!==null&&(i=Ro.fromMachine(i),a=!0):(i=Ro.fromRE2(this),a=!0),i.init(r);let o=i.match(e,t,n)?i.submatches():null;return this.put(i,a),o}match(e){return this.doExecute(Fo.fromUTF16(e),0,j.UNANCHORED,0)!==null}matchWithGroup(e,t,n,r,i){return e instanceof So||(e=To.utf16(e)),this.matchMachineInput(e,t,n,r,i)}matchMachineInput(e,t,n,r,i){if(t>n)return[!1,null];let a=e.isUTF16Encoding()?Fo.fromUTF16(e.asCharSequence(),0,n):Fo.fromUTF8(e.asBytes(),0,n),o=this.doExecute(a,t,r,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(e){return this.doExecute(Fo.fromUTF8(e),0,j.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,i=0,a=``,o=Fo.fromUTF16(e),s=0;for(;i<=e.length;){let c=this.doExecute(o,i,j.UNANCHORED,2);if(c===null||c.length===0)break;a+=e.substring(r,c[0]),(c[1]>r||c[0]===0)&&(a+=t(e.substring(c[0],c[1])),s++),r=c[1];let l=o.step(i)&7;if(i+l>c[1]?i+=l:i+1>c[1]?i++:i=c[1],s>=n)break}return a+=e.substring(r),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[],i=e.endPos();t<0&&(t=i+1);let a=0,o=0,s=-1;for(;o<t&&a<=i;){let t=this.doExecute(e,a,j.UNANCHORED,this.prog.numCap);if(t===null||t.length===0)break;let c=!0;if(t[1]===a){t[0]===s&&(c=!1);let n=e.step(a);n<0?a=i+1:a+=n&7}else a=t[1];s=t[1],c&&(r.push(n(this.pad(t))),o++)}return r}findUTF8(e){let t=this.doExecute(Fo.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){let t=this.doExecute(Fo.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){let t=this.doExecute(Fo.fromUTF16(e),0,j.UNANCHORED,2);return t===null?``:e.substring(t[0],t[1])}findIndex(e){return this.doExecute(Fo.fromUTF16(e),0,j.UNANCHORED,2)}findUTF8Submatch(e){let t=this.doExecute(Fo.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(Fo.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap))}findSubmatch(e){let t=this.doExecute(Fo.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(Fo.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){let n=this.allMatches(Fo.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return n.length===0?null:n}findAllUTF8Index(e,t){let n=this.allMatches(Fo.fromUTF8(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAll(e,t){let n=this.allMatches(Fo.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return n.length===0?null:n}findAllIndex(e,t){let n=this.allMatches(Fo.fromUTF16(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){let n=this.allMatches(Fo.fromUTF8(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){let n=this.allMatches(Fo.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){let n=this.allMatches(Fo.fromUTF16(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllSubmatchIndex(e,t){let n=this.allMatches(Fo.fromUTF16(e),t);return n.length===0?null:n}},ms=class e{static isUpperCaseAlpha(e){return`A`<=e&&e<=`Z`}static isHexadecimal(e){return`0`<=e&&e<=`9`||`A`<=e&&e<=`F`||`a`<=e&&e<=`f`}static getUtf8CharSize(e){let t=e.charCodeAt(0);return t<128?1:t<2048?2:t<65536?3:4}static translate(t){if(typeof t!=`string`)return t;let n=``,r=!1,i=t.length;i===0&&(n=`(?:)`,r=!0);let a=0;for(;a<i;){let o=t[a];if(o===`\\`){if(a+1<i)switch(o=t[a+1],o){case`\\`:n+=`\\\\`,a+=2;continue;case`c`:if(a+2<i){let i=t[a+2];if(e.isUpperCaseAlpha(i)){n+=`\\x`,n+=(i.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(i.charCodeAt(0)-64&15).toString(16).toUpperCase(),a+=3,r=!0;continue}}n+=`\\c`,a+=2;continue;case`u`:if(a+2<i){let o=t[a+2];if(e.isHexadecimal(o)){n+=`\\x{`+o,a+=3;for(let r=0;r<3&&a<i&&(o=t[a],e.isHexadecimal(o));++a,++r)n+=o;n+=`}`,r=!0;continue}else if(o===`{`){n+=`\\x`,a+=2,r=!0;continue}}n+=`\\u`,a+=2;continue;default:{n+=`\\`;let r=e.getUtf8CharSize(o);n+=t.substring(a+1,a+1+r),a+=r+1;continue}}}else if(o===`/`){n+=`\\/`,a+=1,r=!0;continue}else if(o===`(`&&a+2<i&&t[a+1]===`?`&&t[a+2]===`<`&&(a+3>=i||t[a+3]!==`=`&&t[a+3]!==`!`)){n+=`(?P<`,a+=3,r=!0;continue}let s=e.getUtf8CharSize(o);n+=t.substring(a,a+s),a+=s}return r?n:t}},hs=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return bo.quoteMeta(e)}static translateRegExp(e){return ms.translate(e)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new Ao(`Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH`);let i=j.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(i&=-129);let a=new e(t,n);return a.re2Input=ps.compileImpl(r,i,(n&e.LONGEST_MATCH)!==0),a}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw Error(`pattern is null`);if(r==null)throw Error(`re2 is null`);let i=new e(t,n);return i.re2Input=r,i}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=To.utf8(e)),new jo(this,e)}split(e,t=0){let n=this.matcher(e),r=[],i=0,a=0;for(;n.find();){if(a===0&&n.end()===0){a=n.end();continue}if(t>0&&r.length===t-1)break;if(a===n.start()){if(t===0){i+=1,a=n.end();continue}}else for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.start())),a=n.end()}if(t===0&&a!==n.inputLength()){for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.inputLength()))}return(t!==0||r.length===0)&&r.push(n.substring(a,n.inputLength())),r}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}}});function _s(e){let t=0;return e.includes(`i`)&&(t|=hs.CASE_INSENSITIVE),e.includes(`m`)&&(t|=hs.MULTILINE),e.includes(`s`)&&(t|=hs.DOTALL),t}function vs(e){return hs.translateRegExp(e)}function R(e,t=``){return new ys(e,t)}var ys,bs,xs=S(()=>{gs(),ys=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;constructor(e,t=``){this._pattern=e,this._flags=t,this._global=t.includes(`g`),this._ignoreCase=t.includes(`i`),this._multiline=t.includes(`m`);try{let n=vs(e),r=_s(t);this._re2=hs.compile(n,r)}catch(t){if(t instanceof Do){let n=t.message||``,r=``;throw n.includes(`(?=`)||n.includes(`(?!`)||n.includes(`(?<`)||n.includes(`(?<!`)||e.includes(`(?=`)||e.includes(`(?!`)||e.includes(`(?<=`)||e.includes(`(?<!`)?r=` Lookahead (?=, ?!) and lookbehind (?<=, ?<!) assertions are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support these features.`:(n.includes(`backreference`)||/\\[1-9]/.test(e))&&(r=` Backreferences (\\1, \\2, etc.) are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support backreferences.`),SyntaxError(`Invalid regular expression: /${e}/: ${n}${r}`)}throw t}}test(e){return this._global&&(this._lastIndex=0),this._re2.matcher(e).find()}exec(e){let t=this._re2.matcher(e),n=this._global?this._lastIndex:0;if(!t.find(n))return this._global&&(this._lastIndex=0),null;let r=this._re2.groupCount(),i=[];i.push(t.group(0)??``);for(let e=1;e<=r;e++){let n=t.group(e);i.push(n)}let a=i;a.index=t.start(0),a.input=e;let o=this._re2.namedGroups();if(o&&Object.keys(o).length>0){let e=Object.create(null);for(let[n,r]of Object.entries(o)){let i=t.group(r);i!==null&&(e[n]=i)}a.groups=e}return this._global&&(this._lastIndex=t.end(0),t.start(0)===t.end(0)&&this._lastIndex++),a}match(e){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(e);let t=[],n=this._re2.matcher(e),r=0;for(;n.find(r);){let i=n.group(0)??``;if(t.push(i),r=n.end(0),n.start(0)===n.end(0)&&r++,r>e.length)break}return t.length>0?t:null}replace(e,t){if(this._global&&(this._lastIndex=0),typeof t==`string`){let n=this._re2.matcher(e);return this._global?n.replaceAll(t,!0):n.replaceFirst(t,!0)}let n=[],r=this._re2.matcher(e),i=0,a=0,o=this._re2.groupCount(),s=this._re2.namedGroups();for(;r.find(a);){n.push(e.slice(i,r.start(0)));let c=[],l=r.group(0)??``;for(let e=1;e<=o;e++)c.push(r.group(e));if(c.push(r.start(0)),c.push(e),s&&Object.keys(s).length>0){let e=Object.create(null);for(let[t,n]of Object.entries(s))e[t]=r.group(n)??``;c.push(e)}if(n.push(t(l,...c)),i=r.end(0),a=i,r.start(0)===r.end(0)&&a++,!this._global||a>e.length)break}return n.push(e.slice(i)),n.join(``)}split(e,t){return t===void 0||t<0?this._re2.split(e,-1):t===0?[]:this._re2.split(e,-1).slice(0,t)}search(e){let t=this._re2.matcher(e);return t.find()?t.start(0):-1}*matchAll(e){if(!this._global)throw Error(`matchAll requires global flag`);this._lastIndex=0;let t=this._re2.matcher(e),n=this._re2.groupCount(),r=this._re2.namedGroups(),i=0;for(;t.find(i);){let a=[];a.push(t.group(0)??``);for(let e=1;e<=n;e++)a.push(t.group(e));let o=a;if(o.index=t.start(0),o.input=e,r&&Object.keys(r).length>0){let e=Object.create(null);for(let[n,i]of Object.entries(r)){let r=t.group(i);r!==null&&(e[n]=r)}o.groups=e}if(yield o,i=t.end(0),t.start(0)===t.end(0)&&i++,i>e.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=RegExp(``,this._flags),Object.defineProperty(this._nativeRegex,`source`,{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(e){this._lastIndex=e}},bs=class{_regex;constructor(e){this._regex=e}test(e){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(e)}exec(e){return this._regex.exec(e)}match(e){return this._regex.global&&(this._regex.lastIndex=0),e.match(this._regex)}replace(e,t){return this._regex.global&&(this._regex.lastIndex=0),e.replace(this._regex,t)}split(e,t){return e.split(this._regex,t)}search(e){return e.search(this._regex)}*matchAll(e){if(!this._regex.global)throw Error(`matchAll requires global flag`);this._regex.lastIndex=0;let t=this._regex.exec(e);for(;t!==null;)yield t,t[0].length===0&&this._regex.lastIndex++,t=this._regex.exec(e)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(e){this._regex.lastIndex=e}}}),Ss=S(()=>{xs()});function Cs(e,t,n){let r=typeof n==`boolean`?{ignoreCase:n}:n??{},i=t;r.stripQuotes&&(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1));let a=r.ignoreCase?`i:${i}`:i,o=Es.get(a);if(!o){if(o=ws(i,r.ignoreCase),Es.size>=Ts){let e=Es.keys().next().value;e!==void 0&&Es.delete(e)}Es.set(a,o)}return o.test(e)}function ws(e,t){let n=`^`;for(let t=0;t<e.length;t++){let r=e[t];if(r===`*`)n+=`.*`;else if(r===`?`)n+=`.`;else if(r===`[`){let r=t+1;for(;r<e.length&&e[r]!==`]`;)r++;n+=e.slice(t,r+1),t=r}else r===`.`||r===`+`||r===`^`||r===`$`||r===`{`||r===`}`||r===`(`||r===`)`||r===`|`||r===`\\`?n+=`\\${r}`:n+=r}return n+=`$`,R(n,t?`i`:``)}var Ts,Es,Ds=S(()=>{Ss(),Ts=2048,Es=new Map});function Os(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(e,n,r)=>n===`&`?t[0]:r===void 0?t[parseInt(n,10)]??``:t.groups?.[r]??``)}function ks(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:i=!1,countOnly:a=!1,countMatches:o=!1,filename:s=``,onlyMatching:c=!1,beforeContext:l=0,afterContext:u=0,maxCount:d=0,contextSeparator:f=`--`,showColumn:p=!1,vimgrep:m=!1,showByteOffset:h=!1,replace:g=null,passthru:_=!1,multiline:v=!1,kResetGroup:y}=n;if(v)return As(e,t,{invertMatch:r,showLineNumbers:i,countOnly:a,countMatches:o,filename:s,onlyMatching:c,beforeContext:l,afterContext:u,maxCount:d,contextSeparator:f,showColumn:p,showByteOffset:h,replace:g,kResetGroup:y});let ee=e.split(`
251
+ `)));let o=!0;for(;!t.more()||t.peek()!==M.CODES.get(`]`)||o;){if(t.more()&&t.lookingAt(`-`)&&(this.flags&j.PERL_X)===0&&!o){let r=t.rest();if(r===`-`||!r.startsWith(`-]`))throw t.rewindTo(n),new Eo(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let r=t.pos();if(t.lookingAt(`[:`)){if(this.parseNamedClass(t,i))continue;t.rewindTo(r)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(r);let a=e.parseClassChar(t,n),s=a;if(t.more()&&t.lookingAt(`-`)){if(t.skip(1),t.more()&&t.lookingAt(`]`))t.skip(-1);else if(s=e.parseClassChar(t,n),s<a)throw new Eo(e.ERR_INVALID_CHAR_RANGE,t.from(r))}(this.flags&j.FOLD_CASE)===0?i.appendRange(a,s):i.appendFoldedRange(a,s)}t.skip(1),i.cleanClass(),a<0&&i.negateClass(),r.runes=i.toArray(),this.push(r)}},ds=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}},fs=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,j.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,j.POSIX,!0)}static compileImpl(t,n,r){let i=us.parse(t,n),a=i.maxCap();i=Vo.simplify(i);let o=Bo.compileRegexp(i),s=new e(t,o,a,r),[c,l]=o.prefix();return s.prefixComplete=c,s.prefix=l,s.prefixUTF8=F.stringToUtf8ByteArray(s.prefix),s.prefix.length>0&&(s.prefixRune=s.prefix.codePointAt(0)),s.namedGroups=i.namedGroups,s}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new ds}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=Lo.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let i=this.get(),a=!1;i?i.next!==null&&(i=Lo.fromMachine(i),a=!0):(i=Lo.fromRE2(this),a=!0),i.init(r);let o=i.match(e,t,n)?i.submatches():null;return this.put(i,a),o}match(e){return this.doExecute(Po.fromUTF16(e),0,j.UNANCHORED,0)!==null}matchWithGroup(e,t,n,r,i){return e instanceof xo||(e=wo.utf16(e)),this.matchMachineInput(e,t,n,r,i)}matchMachineInput(e,t,n,r,i){if(t>n)return[!1,null];let a=e.isUTF16Encoding()?Po.fromUTF16(e.asCharSequence(),0,n):Po.fromUTF8(e.asBytes(),0,n),o=this.doExecute(a,t,r,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(e){return this.doExecute(Po.fromUTF8(e),0,j.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,i=0,a=``,o=Po.fromUTF16(e),s=0;for(;i<=e.length;){let c=this.doExecute(o,i,j.UNANCHORED,2);if(c===null||c.length===0)break;a+=e.substring(r,c[0]),(c[1]>r||c[0]===0)&&(a+=t(e.substring(c[0],c[1])),s++),r=c[1];let l=o.step(i)&7;if(i+l>c[1]?i+=l:i+1>c[1]?i++:i=c[1],s>=n)break}return a+=e.substring(r),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[],i=e.endPos();t<0&&(t=i+1);let a=0,o=0,s=-1;for(;o<t&&a<=i;){let t=this.doExecute(e,a,j.UNANCHORED,this.prog.numCap);if(t===null||t.length===0)break;let c=!0;if(t[1]===a){t[0]===s&&(c=!1);let n=e.step(a);n<0?a=i+1:a+=n&7}else a=t[1];s=t[1],c&&(r.push(n(this.pad(t))),o++)}return r}findUTF8(e){let t=this.doExecute(Po.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){let t=this.doExecute(Po.fromUTF8(e),0,j.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){let t=this.doExecute(Po.fromUTF16(e),0,j.UNANCHORED,2);return t===null?``:e.substring(t[0],t[1])}findIndex(e){return this.doExecute(Po.fromUTF16(e),0,j.UNANCHORED,2)}findUTF8Submatch(e){let t=this.doExecute(Po.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(Po.fromUTF8(e),0,j.UNANCHORED,this.prog.numCap))}findSubmatch(e){let t=this.doExecute(Po.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(Po.fromUTF16(e),0,j.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){let n=this.allMatches(Po.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return n.length===0?null:n}findAllUTF8Index(e,t){let n=this.allMatches(Po.fromUTF8(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAll(e,t){let n=this.allMatches(Po.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return n.length===0?null:n}findAllIndex(e,t){let n=this.allMatches(Po.fromUTF16(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){let n=this.allMatches(Po.fromUTF8(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){let n=this.allMatches(Po.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){let n=this.allMatches(Po.fromUTF16(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllSubmatchIndex(e,t){let n=this.allMatches(Po.fromUTF16(e),t);return n.length===0?null:n}},ps=class e{static isUpperCaseAlpha(e){return`A`<=e&&e<=`Z`}static isHexadecimal(e){return`0`<=e&&e<=`9`||`A`<=e&&e<=`F`||`a`<=e&&e<=`f`}static getUtf8CharSize(e){let t=e.charCodeAt(0);return t<128?1:t<2048?2:t<65536?3:4}static translate(t){if(typeof t!=`string`)return t;let n=``,r=!1,i=t.length;i===0&&(n=`(?:)`,r=!0);let a=0;for(;a<i;){let o=t[a];if(o===`\\`){if(a+1<i)switch(o=t[a+1],o){case`\\`:n+=`\\\\`,a+=2;continue;case`c`:if(a+2<i){let i=t[a+2];if(e.isUpperCaseAlpha(i)){n+=`\\x`,n+=(i.charCodeAt(0)-64>>4).toString(16).toUpperCase(),n+=(i.charCodeAt(0)-64&15).toString(16).toUpperCase(),a+=3,r=!0;continue}}n+=`\\c`,a+=2;continue;case`u`:if(a+2<i){let o=t[a+2];if(e.isHexadecimal(o)){n+=`\\x{`+o,a+=3;for(let r=0;r<3&&a<i&&(o=t[a],e.isHexadecimal(o));++a,++r)n+=o;n+=`}`,r=!0;continue}else if(o===`{`){n+=`\\x`,a+=2,r=!0;continue}}n+=`\\u`,a+=2;continue;default:{n+=`\\`;let r=e.getUtf8CharSize(o);n+=t.substring(a+1,a+1+r),a+=r+1;continue}}}else if(o===`/`){n+=`\\/`,a+=1,r=!0;continue}else if(o===`(`&&a+2<i&&t[a+1]===`?`&&t[a+2]===`<`&&(a+3>=i||t[a+3]!==`=`&&t[a+3]!==`!`)){n+=`(?P<`,a+=3,r=!0;continue}let s=e.getUtf8CharSize(o);n+=t.substring(a,a+s),a+=s}return r?n:t}},ms=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return F.quoteMeta(e)}static translateRegExp(e){return ps.translate(e)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new ko(`Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH`);let i=j.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(i&=-129);let a=new e(t,n);return a.re2Input=fs.compileImpl(r,i,(n&e.LONGEST_MATCH)!==0),a}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw Error(`pattern is null`);if(r==null)throw Error(`re2 is null`);let i=new e(t,n);return i.re2Input=r,i}constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=wo.utf8(e)),new Ao(this,e)}split(e,t=0){let n=this.matcher(e),r=[],i=0,a=0;for(;n.find();){if(a===0&&n.end()===0){a=n.end();continue}if(t>0&&r.length===t-1)break;if(a===n.start()){if(t===0){i+=1,a=n.end();continue}}else for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.start())),a=n.end()}if(t===0&&a!==n.inputLength()){for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.inputLength()))}return(t!==0||r.length===0)&&r.push(n.substring(a,n.inputLength())),r}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}}});function gs(e){let t=0;return e.includes(`i`)&&(t|=ms.CASE_INSENSITIVE),e.includes(`m`)&&(t|=ms.MULTILINE),e.includes(`s`)&&(t|=ms.DOTALL),t}function _s(e){return ms.translateRegExp(e)}function z(e,t=``){return new vs(e,t)}var vs,ys,bs=S(()=>{hs(),vs=class{_re2;_pattern;_flags;_global;_ignoreCase;_multiline;_lastIndex=0;_nativeRegex=null;constructor(e,t=``){this._pattern=e,this._flags=t,this._global=t.includes(`g`),this._ignoreCase=t.includes(`i`),this._multiline=t.includes(`m`);try{let n=_s(e),r=gs(t);this._re2=ms.compile(n,r)}catch(t){if(t instanceof Eo){let n=t.message||``,r=``;throw n.includes(`(?=`)||n.includes(`(?!`)||n.includes(`(?<`)||n.includes(`(?<!`)||e.includes(`(?=`)||e.includes(`(?!`)||e.includes(`(?<=`)||e.includes(`(?<!`)?r=` Lookahead (?=, ?!) and lookbehind (?<=, ?<!) assertions are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support these features.`:(n.includes(`backreference`)||/\\[1-9]/.test(e))&&(r=` Backreferences (\\1, \\2, etc.) are not supported in this environment because the regex engine uses RE2 for ReDoS protection. RE2 guarantees linear-time matching but cannot support backreferences.`),SyntaxError(`Invalid regular expression: /${e}/: ${n}${r}`)}throw t}}test(e){return this._global&&(this._lastIndex=0),this._re2.matcher(e).find()}exec(e){let t=this._re2.matcher(e),n=this._global?this._lastIndex:0;if(!t.find(n))return this._global&&(this._lastIndex=0),null;let r=this._re2.groupCount(),i=[];i.push(t.group(0)??``);for(let e=1;e<=r;e++){let n=t.group(e);i.push(n)}let a=i;a.index=t.start(0),a.input=e;let o=this._re2.namedGroups();if(o&&Object.keys(o).length>0){let e=Object.create(null);for(let[n,r]of Object.entries(o)){let i=t.group(r);i!==null&&(e[n]=i)}a.groups=e}return this._global&&(this._lastIndex=t.end(0),t.start(0)===t.end(0)&&this._lastIndex++),a}match(e){if(this._global&&(this._lastIndex=0),!this._global)return this.exec(e);let t=[],n=this._re2.matcher(e),r=0;for(;n.find(r);){let i=n.group(0)??``;if(t.push(i),r=n.end(0),n.start(0)===n.end(0)&&r++,r>e.length)break}return t.length>0?t:null}replace(e,t){if(this._global&&(this._lastIndex=0),typeof t==`string`){let n=this._re2.matcher(e);return this._global?n.replaceAll(t,!0):n.replaceFirst(t,!0)}let n=[],r=this._re2.matcher(e),i=0,a=0,o=this._re2.groupCount(),s=this._re2.namedGroups();for(;r.find(a);){n.push(e.slice(i,r.start(0)));let c=[],l=r.group(0)??``;for(let e=1;e<=o;e++)c.push(r.group(e));if(c.push(r.start(0)),c.push(e),s&&Object.keys(s).length>0){let e=Object.create(null);for(let[t,n]of Object.entries(s))e[t]=r.group(n)??``;c.push(e)}if(n.push(t(l,...c)),i=r.end(0),a=i,r.start(0)===r.end(0)&&a++,!this._global||a>e.length)break}return n.push(e.slice(i)),n.join(``)}split(e,t){return t===void 0||t<0?this._re2.split(e,-1):t===0?[]:this._re2.split(e,-1).slice(0,t)}search(e){let t=this._re2.matcher(e);return t.find()?t.start(0):-1}*matchAll(e){if(!this._global)throw Error(`matchAll requires global flag`);this._lastIndex=0;let t=this._re2.matcher(e),n=this._re2.groupCount(),r=this._re2.namedGroups(),i=0;for(;t.find(i);){let a=[];a.push(t.group(0)??``);for(let e=1;e<=n;e++)a.push(t.group(e));let o=a;if(o.index=t.start(0),o.input=e,r&&Object.keys(r).length>0){let e=Object.create(null);for(let[n,i]of Object.entries(r)){let r=t.group(i);r!==null&&(e[n]=r)}o.groups=e}if(yield o,i=t.end(0),t.start(0)===t.end(0)&&i++,i>e.length)break}}get native(){if(!this._nativeRegex)try{this._nativeRegex=new RegExp(this._pattern,this._flags)}catch{this._nativeRegex=RegExp(``,this._flags),Object.defineProperty(this._nativeRegex,`source`,{value:this._pattern,writable:!1})}return this._nativeRegex}get source(){return this._pattern}get flags(){return this._flags}get global(){return this._global}get ignoreCase(){return this._ignoreCase}get multiline(){return this._multiline}get lastIndex(){return this._lastIndex}set lastIndex(e){this._lastIndex=e}},ys=class{_regex;constructor(e){this._regex=e}test(e){return this._regex.global&&(this._regex.lastIndex=0),this._regex.test(e)}exec(e){return this._regex.exec(e)}match(e){return this._regex.global&&(this._regex.lastIndex=0),e.match(this._regex)}replace(e,t){return this._regex.global&&(this._regex.lastIndex=0),e.replace(this._regex,t)}split(e,t){return e.split(this._regex,t)}search(e){return e.search(this._regex)}*matchAll(e){if(!this._regex.global)throw Error(`matchAll requires global flag`);this._regex.lastIndex=0;let t=this._regex.exec(e);for(;t!==null;)yield t,t[0].length===0&&this._regex.lastIndex++,t=this._regex.exec(e)}get native(){return this._regex}get source(){return this._regex.source}get flags(){return this._regex.flags}get global(){return this._regex.global}get ignoreCase(){return this._regex.ignoreCase}get multiline(){return this._regex.multiline}get lastIndex(){return this._regex.lastIndex}set lastIndex(e){this._regex.lastIndex=e}}}),xs=S(()=>{bs()});function Ss(e,t,n){let r=typeof n==`boolean`?{ignoreCase:n}:n??{},i=t;r.stripQuotes&&(i.startsWith(`"`)&&i.endsWith(`"`)||i.startsWith(`'`)&&i.endsWith(`'`))&&(i=i.slice(1,-1));let a=r.ignoreCase?`i:${i}`:i,o=Ts.get(a);if(!o){if(o=Cs(i,r.ignoreCase),Ts.size>=ws){let e=Ts.keys().next().value;e!==void 0&&Ts.delete(e)}Ts.set(a,o)}return o.test(e)}function Cs(e,t){let n=`^`;for(let t=0;t<e.length;t++){let r=e[t];if(r===`*`)n+=`.*`;else if(r===`?`)n+=`.`;else if(r===`[`){let r=t+1;for(;r<e.length&&e[r]!==`]`;)r++;n+=e.slice(t,r+1),t=r}else r===`.`||r===`+`||r===`^`||r===`$`||r===`{`||r===`}`||r===`(`||r===`)`||r===`|`||r===`\\`?n+=`\\${r}`:n+=r}return n+=`$`,z(n,t?`i`:``)}var ws,Ts,Es=S(()=>{xs(),ws=2048,Ts=new Map});function Ds(e,t){return e.replace(/\$(&|\d+|<([^>]+)>)/g,(e,n,r)=>n===`&`?t[0]:r===void 0?t[parseInt(n,10)]??``:t.groups?.[r]??``)}function Os(e,t,n={}){let{invertMatch:r=!1,showLineNumbers:i=!1,countOnly:a=!1,countMatches:o=!1,filename:s=``,onlyMatching:c=!1,beforeContext:l=0,afterContext:u=0,maxCount:d=0,contextSeparator:f=`--`,showColumn:p=!1,vimgrep:m=!1,showByteOffset:h=!1,replace:g=null,passthru:_=!1,multiline:v=!1,kResetGroup:y}=n;if(v)return ks(e,t,{invertMatch:r,showLineNumbers:i,countOnly:a,countMatches:o,filename:s,onlyMatching:c,beforeContext:l,afterContext:u,maxCount:d,contextSeparator:f,showColumn:p,showByteOffset:h,replace:g,kResetGroup:y});let ee=e.split(`
252
252
  `),te=ee.length,ne=te>0&&ee[te-1]===``?te-1:te;if(a||o){let e=0,n=(o||c)&&!r;for(let i=0;i<ne;i++)if(t.lastIndex=0,n)for(let n=t.exec(ee[i]);n!==null;n=t.exec(ee[i]))e++,n[0].length===0&&t.lastIndex++;else t.test(ee[i])!==r&&e++;return{output:`${s?`${s}:${e}`:String(e)}
253
- `,matched:e>0,matchCount:e}}if(l===0&&u===0&&!_){let e=[],n=!1,a=0,o=0;for(let l=0;l<ne&&!(d>0&&a>=d);l++){let u=ee[l];if(t.lastIndex=0,t.test(u)!==r)if(n=!0,a++,c){t.lastIndex=0;for(let n=t.exec(u);n!==null;n=t.exec(u)){let r=y===void 0?n[0]:n[y]??``,a=g===null?r:Os(g,n),c=s?`${s}:`:``;h&&(c+=`${o+n.index}:`),i&&(c+=`${l+1}:`),p&&(c+=`${n.index+1}:`),e.push(c+a),n[0].length===0&&t.lastIndex++}}else if(m){t.lastIndex=0;for(let n=t.exec(u);n!==null;n=t.exec(u)){let r=s?`${s}:`:``;h&&(r+=`${o+n.index}:`),i&&(r+=`${l+1}:`),p&&(r+=`${n.index+1}:`),e.push(r+u),n[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let n=t.exec(u),r=n?n.index+1:1,a=u;g!==null&&(t.lastIndex=0,a=t.replace(u,(...e)=>{if(e[0].length===0)return``;let t=e,n=e[e.length-1];return typeof n==`object`&&n?(t.groups=n,t.input=e[e.length-2],t.index=e[e.length-3]):(t.input=e[e.length-1],t.index=e[e.length-2]),Os(g,t)}));let c=s?`${s}:`:``;h&&(c+=`${o+(n?n.index:0)}:`),i&&(c+=`${l+1}:`),p&&(c+=`${r}:`),e.push(c+a)}o+=u.length+1}return{output:e.length>0?`${e.join(`
253
+ `,matched:e>0,matchCount:e}}if(l===0&&u===0&&!_){let e=[],n=!1,a=0,o=0;for(let l=0;l<ne&&!(d>0&&a>=d);l++){let u=ee[l];if(t.lastIndex=0,t.test(u)!==r)if(n=!0,a++,c){t.lastIndex=0;for(let n=t.exec(u);n!==null;n=t.exec(u)){let r=y===void 0?n[0]:n[y]??``,a=g===null?r:Ds(g,n),c=s?`${s}:`:``;h&&(c+=`${o+n.index}:`),i&&(c+=`${l+1}:`),p&&(c+=`${n.index+1}:`),e.push(c+a),n[0].length===0&&t.lastIndex++}}else if(m){t.lastIndex=0;for(let n=t.exec(u);n!==null;n=t.exec(u)){let r=s?`${s}:`:``;h&&(r+=`${o+n.index}:`),i&&(r+=`${l+1}:`),p&&(r+=`${n.index+1}:`),e.push(r+u),n[0].length===0&&t.lastIndex++}}else{t.lastIndex=0;let n=t.exec(u),r=n?n.index+1:1,a=u;g!==null&&(t.lastIndex=0,a=t.replace(u,(...e)=>{if(e[0].length===0)return``;let t=e,n=e[e.length-1];return typeof n==`object`&&n?(t.groups=n,t.input=e[e.length-2],t.index=e[e.length-3]):(t.input=e[e.length-1],t.index=e[e.length-2]),Ds(g,t)}));let c=s?`${s}:`:``;h&&(c+=`${o+(n?n.index:0)}:`),i&&(c+=`${l+1}:`),p&&(c+=`${r}:`),e.push(c+a)}o+=u.length+1}return{output:e.length>0?`${e.join(`
254
254
  `)}
255
255
  `:``,matched:n,matchCount:a}}if(_){let e=[],n=!1,a=0;for(let o=0;o<ne;o++){let c=ee[o];t.lastIndex=0;let l=t.test(c)!==r;l&&(n=!0,a++);let u=l?`:`:`-`,d=s?`${s}${u}`:``;i&&(d+=`${o+1}${u}`),e.push(d+c)}return{output:e.length>0?`${e.join(`
256
256
  `)}
257
257
  `:``,matched:n,matchCount:a}}let b=[],re=0,x=new Set,ie=-1,ae=[];for(let e=0;e<ne&&!(d>0&&re>=d);e++)t.lastIndex=0,t.test(ee[e])!==r&&(ae.push(e),re++);for(let e of ae){let n=Math.max(0,e-l);ie>=0&&n>ie+1&&b.push(f);for(let t=n;t<e;t++)if(!x.has(t)){x.add(t),ie=t;let e=ee[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),b.push(e)}if(!x.has(e)){x.add(e),ie=e;let n=ee[e];if(c){t.lastIndex=0;for(let r=t.exec(n);r!==null;r=t.exec(n)){let n=y===void 0?r[0]:r[y]??``,a=g===null?n:g,o=s?`${s}:`:``;i&&(o+=`${e+1}:`),p&&(o+=`${r.index+1}:`),b.push(o+a),r[0].length===0&&t.lastIndex++}}else{let t=n;i&&(t=`${e+1}:${t}`),s&&(t=`${s}:${t}`),b.push(t)}}let r=Math.min(ne-1,e+u);for(let t=e+1;t<=r;t++)if(!x.has(t)){x.add(t),ie=t;let e=ee[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),b.push(e)}}return{output:b.length>0?`${b.join(`
258
258
  `)}
259
- `:``,matched:re>0,matchCount:re}}function As(e,t,n){let{invertMatch:r,showLineNumbers:i,countOnly:a,countMatches:o,filename:s,onlyMatching:c,beforeContext:l,afterContext:u,maxCount:d,contextSeparator:f,showColumn:p,showByteOffset:m,replace:h,kResetGroup:g}=n,_=e.split(`
259
+ `:``,matched:re>0,matchCount:re}}function ks(e,t,n){let{invertMatch:r,showLineNumbers:i,countOnly:a,countMatches:o,filename:s,onlyMatching:c,beforeContext:l,afterContext:u,maxCount:d,contextSeparator:f,showColumn:p,showByteOffset:m,replace:h,kResetGroup:g}=n,_=e.split(`
260
260
  `),v=_.length,y=v>0&&_[v-1]===``?v-1:v,ee=[0];for(let t=0;t<e.length;t++)e[t]===`
261
261
  `&&ee.push(t+1);let te=e=>{let t=0;for(let n=0;n<ee.length&&!(ee[n]>e);n++)t=n;return t},ne=e=>e-ee[te(e)]+1,b=[];t.lastIndex=0;for(let n=t.exec(e);n!==null&&!(d>0&&b.length>=d);n=t.exec(e)){let e=te(n.index),r=te(n.index+Math.max(0,n[0].length-1)),i=g===void 0?n[0]:n[g]??``;b.push({startLine:e,endLine:r,byteOffset:n.index,column:ne(n.index),matchText:i}),n[0].length===0&&t.lastIndex++}if(a||o){let e;if(o)e=r?0:b.length;else{let t=new Set;for(let e of b)for(let n=e.startLine;n<=e.endLine;n++)t.add(n);e=r?y-t.size:t.size}return{output:`${s?`${s}:${e}`:String(e)}
262
262
  `,matched:e>0,matchCount:e}}if(r){let e=new Set;for(let t of b)for(let n=t.startLine;n<=t.endLine;n++)e.add(n);let t=[];for(let n=0;n<y;n++)if(!e.has(n)){let e=_[n];i&&(e=`${n+1}:${e}`),s&&(e=`${s}:${e}`),t.push(e)}return{output:t.length>0?`${t.join(`
263
263
  `)}
264
264
  `:``,matched:t.length>0,matchCount:t.length}}if(b.length===0)return{output:``,matched:!1,matchCount:0};let re=new Set,x=-1,ie=[];for(let e of b){let n=Math.max(0,e.startLine-l),r=Math.min(y-1,e.endLine+u);x>=0&&n>x+1&&ie.push(f);for(let t=n;t<e.startLine;t++)if(!re.has(t)){re.add(t),x=t;let e=_[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),ie.push(e)}if(c){let t=h===null?e.matchText:h,n=s?`${s}:`:``;m&&(n+=`${e.byteOffset}:`),i&&(n+=`${e.startLine+1}:`),p&&(n+=`${e.column}:`),ie.push(n+t);for(let t=e.startLine;t<=e.endLine;t++)re.add(t),x=t}else for(let n=e.startLine;n<=e.endLine&&n<y;n++)if(!re.has(n)){re.add(n),x=n;let r=_[n];h!==null&&n===e.startLine&&(t.lastIndex=0,r=t.replace(r,h));let a=s?`${s}:`:``;m&&n===e.startLine&&(a+=`${e.byteOffset}:`),i&&(a+=`${n+1}:`),p&&n===e.startLine&&(a+=`${e.column}:`),ie.push(a+r)}for(let t=e.endLine+1;t<=r;t++)if(!re.has(t)){re.add(t),x=t;let e=_[t];i&&(e=`${t+1}-${e}`),s&&(e=`${s}-${e}`),ie.push(e)}}return{output:ie.length>0?`${ie.join(`
265
265
  `)}
266
- `:``,matched:!0,matchCount:b.length}}var js=S(()=>{});function Ms(e){let t=``,n=0;for(;n<e.length;){if(e.slice(n,n+7)===`[[:<:]]`){t+=`\\b`,n+=7;continue}if(e.slice(n,n+7)===`[[:>:]]`){t+=`\\b`,n+=7;continue}if(e[n]===`[`){let r=`[`;for(n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(r+=`^`,n++),n<e.length&&e[n]===`]`&&(r+=`\\]`,n++);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 i=e.slice(n+2,t),a=Gs.get(i);if(a){r+=a,n=t+2;continue}}}if(e[n]===`\\`&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]===`]`&&(r+=`]`,n++),t+=r;continue}if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function Ns(e,t){let n,r;switch(t.mode){case`fixed`:n=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);break;case`extended`:case`perl`:if(n=Ms(e),n=n.replace(/\(\?P<([^>]+)>/g,`(?<$1>`),t.mode===`perl`){n=Ps(n),n=Fs(n),n=Is(n);let e=Bs(n);n=e.pattern,r=e.kResetGroup}break;default:n=Ms(e),n=Ws(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^${n}$`);let i=/\\u\{[0-9A-Fa-f]+\}/.test(n),a=`g`+(t.ignoreCase?`i`:``)+(t.multiline?`m`:``)+(t.multilineDotall?`s`:``)+(i?`u`:``);return{regex:R(n,a),kResetGroup:r}}function Ps(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`Q`){n+=2;let r=``;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`E`){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}else t+=e[n],n++;return t}function Fs(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,`\\u{$1}`)}function Is(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`(`&&n+1<e.length&&e[n+1]===`?`){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let i=r[1]||``,a=r[2]||``,o=r[3];if(o===`:`){let o=n+r[0].length-1,s=Ls(e,n);if(s!==-1){let r=Rs(e.slice(o+1,s),i,a);t+=`(?:${r})`,n=s+1;continue}}else if(o===`)`||o===``){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Ls(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]===`\\`){r+=2;continue}if(e[r]===`[`){for(r++;r<e.length&&e[r]!==`]`;)e[r]===`\\`&&r++,r++;r++;continue}if(e[r]===`(`)n++;else if(e[r]===`)`&&(n--,n===0))return r;r++}return-1}function Rs(e,t,n){let r=e;return t.includes(`i`)&&(r=zs(r)),r}function zs(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`\\`){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r===`[`){t+=r,n++,n<e.length&&e[n]===`^`&&(t+=e[n],n++);let i=[];for(;n<e.length&&e[n]!==`]`;)if(e[n]===`\\`)i.push(e[n]),n++,n<e.length&&(i.push(e[n]),n++);else if(e[n]===`-`&&i.length>0&&n+1<e.length&&e[n+1]!==`]`){let t=i[i.length-1],r=e[n+1];i.push(`-`),i.push(r),/[a-z]/.test(t)&&/[a-z]/.test(r)?(i.push(t.toUpperCase()),i.push(`-`),i.push(r.toUpperCase())):/[A-Z]/.test(t)&&/[A-Z]/.test(r)&&(i.push(t.toLowerCase()),i.push(`-`),i.push(r.toLowerCase())),n+=2}else{let t=e[n];if(i.push(t),/[a-zA-Z]/.test(t)){let e=t===t.toLowerCase()?t.toUpperCase():t.toLowerCase();i.includes(e)||i.push(e)}n++}t+=i.join(``),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let e=r.toLowerCase(),n=r.toUpperCase();t+=`[${n}${e}]`}else t+=r;n++}return t}function Bs(e){let t=Vs(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),i=Hs(n);return{pattern:`(?:${n})(${r})`,kResetGroup:i+1}}function Vs(e){let t=0;for(;t<e.length-1;)if(e[t]===`\\`){if(e[t+1]===`K`){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;if(n%2==0)return t}t+=2}else t++;return-1}function Hs(e){let t=0,n=0;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`[`){for(n++;n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n++,n++;n++;continue}if(e[n]===`(`)if(n+1<e.length&&e[n+1]===`?`){if(n+2<e.length){let r=e[n+2];if(r===`:`||r===`=`||r===`!`){n++;continue}if(r===`<`&&n+3<e.length){let r=e[n+3];if(r===`=`||r===`!`){n++;continue}t++,n++;continue}}}else t++;n++}return t}function Us(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,`$$&`);return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,`$$<$1>`),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,`$$<$1>`),t}function Ws(e){let t=``,n=0,r=!0,i=0;for(;n<e.length;){let a=e[n];if(a===`[`){for(t+=a,n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(t+=e[n],n++),n<e.length&&e[n]===`]`&&(t+=e[n],n++);n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]===`]`&&(t+=e[n],n++),r=!1;continue}if(a===`\\`&&n+1<e.length){let o=e[n+1];if(o===`|`){t+=`|`,n+=2,r=!0;continue}if(o===`(`){t+=`(`,n+=2,i++,r=!0;continue}if(o===`)`){t+=`)`,n+=2,i=Math.max(0,i-1),r=!1;continue}if(o===`{`){let i=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(i){let e=i[1],a=i[2]!==void 0,o=i[3]||``;a?t+=`{${e},${o}}`:t+=`{${e}}`,n+=i[0].length,r=!1;continue}t+=`\\{`,n+=2,r=!1;continue}if(o===`}`){t+=`\\}`,n+=2,r=!1;continue}t+=a+o,n+=2,r=!1;continue}if(a===`*`&&r){t+=`\\*`,n++;continue}if(a===`^`){if(r){t+=`^`,n++;continue}t+=`\\^`,n++;continue}if(a===`$`){let i=n===e.length-1,a=n+2<e.length&&e[n+1]===`\\`&&e[n+2]===`)`;i||a?t+=`$`:t+=`\\$`,n++,r=!1;continue}a===`+`||a===`?`||a===`|`||a===`(`||a===`)`||a===`{`||a===`}`?t+=`\\${a}`:t+=a,n++,r=!1}return t}var Gs,Ks=S(()=>{Ss(),Gs=new Map([[`alpha`,`a-zA-Z`],[`digit`,`0-9`],[`alnum`,`a-zA-Z0-9`],[`lower`,`a-z`],[`upper`,`A-Z`],[`xdigit`,`0-9A-Fa-f`],[`space`,` \\t\\n\\r\\f\\v`],[`blank`,` \\t`],[`punct`,"!-/:-@\\[-`{-~"],[`graph`,`!-~`],[`print`,` -~`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`ascii`,`\\x00-\\x7F`],[`word`,`a-zA-Z0-9_`]])}),qs=S(()=>{js(),Ks()}),Js={};C(Js,{egrepCommand:()=>nc,egrepFlagsForFuzzing:()=>ac,fgrepCommand:()=>tc,fgrepFlagsForFuzzing:()=>ic,flagsForFuzzing:()=>rc,grepCommand:()=>$s});async function Ys(e,t,n,r,i=0){if(i>=ec)return;let a=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(a)).isDirectory){let n=e.split(`/`).pop()||``;t&&Cs(n,t.replace(/^\//,``),{stripQuotes:!0})&&r.push(e);return}let o=await n.fs.readdir(a);for(let a of o){let o=e===`.`?a:`${e}/${a}`,s=n.fs.resolvePath(n.cwd,o);(await n.fs.stat(s)).isDirectory?await Ys(o,t,n,r,i+1):t&&Cs(a,t.replace(/^\//,``),{stripQuotes:!0})&&r.push(o)}}catch{}}async function Xs(e,t){let n=[],r=e.lastIndexOf(`/`),i,a;if(r===-1?(i=t.cwd,a=e):(i=e.slice(0,r)||`/`,a=e.slice(r+1)),e.includes(`**`)){let n=[],r=e.split(`**`);return await Ys(r[0].replace(/\/$/,``)||`.`,r[1]||``,t,n),n.map(e=>({path:e}))}let o=t.fs.resolvePath(t.cwd,i);try{if(t.fs.readdirWithFileTypes){let e=await t.fs.readdirWithFileTypes(o);for(let t of e)if(Cs(t.name,a,{stripQuotes:!0})){let e=r===-1?t.name:`${i}/${t.name}`;n.push({path:e,isFile:t.isFile})}}else{let e=await t.fs.readdir(o);for(let t of e)if(Cs(t,a,{stripQuotes:!0})){let e=r===-1?t:`${i}/${t}`;n.push({path:e})}}}catch{}return n.sort((e,t)=>e.path.localeCompare(t.path))}async function Zs(e,t,n=[],r=[],i=[],a,o=0){if(o>=ec)return[];let s=t.fs.resolvePath(t.cwd,e),c=[];try{let l,u;if(a!==void 0)l=a,u=!a;else{let e=await t.fs.stat(s);l=e.isFile,u=e.isDirectory}if(l){let t=e.split(`/`).pop()||e;return r.length>0&&r.some(e=>Cs(t,e,{stripQuotes:!0}))||n.length>0&&!n.some(e=>Cs(t,e,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!u)return[];let d=e.split(`/`).pop()||e;if(i.length>0&&i.some(e=>Cs(d,e,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let a=await t.fs.readdirWithFileTypes(s);for(let s of a){if(s.name.startsWith(`.`))continue;let a=await Zs(e===`.`?s.name:`${e}/${s.name}`,t,n,r,i,s.isFile,o+1);c.push(...a)}}else{let a=await t.fs.readdir(s);for(let s of a){if(s.startsWith(`.`))continue;let a=await Zs(e===`.`?s:`${e}/${s}`,t,n,r,i,void 0,o+1);c.push(...a)}}}catch{}return c}var Qs,$s,ec,tc,nc,rc,ic,ac,oc=S(()=>{Ds(),O(),qs(),Qs={name:`grep`,summary:`print lines that match patterns`,usage:`grep [OPTION]... PATTERN [FILE]...`,options:[`-E, --extended-regexp PATTERN is an extended regular expression`,`-P, --perl-regexp PATTERN is a Perl regular expression`,`-F, --fixed-strings PATTERN is a set of newline-separated strings`,`-i, --ignore-case ignore case distinctions`,`-v, --invert-match select non-matching lines`,`-w, --word-regexp match only whole words`,`-x, --line-regexp match only whole lines`,`-c, --count print only a count of matching lines`,`-l, --files-with-matches print only names of files with matches`,`-L, --files-without-match print names of files with no matches`,`-m NUM, --max-count=NUM stop after NUM matches`,`-n, --line-number print line number with output lines`,`-h, --no-filename suppress the file name prefix on output`,`-o, --only-matching show only nonempty parts of lines that match`,`-q, --quiet, --silent suppress all normal output`,`-r, -R, --recursive search directories recursively`,`-A NUM print NUM lines of trailing context`,`-B NUM print NUM lines of leading context`,`-C NUM print NUM lines of context`,`-e PATTERN use PATTERN for matching`,` --include=GLOB search only files matching GLOB`,` --exclude=GLOB skip files matching GLOB`,` --exclude-dir=DIR skip directories matching DIR`,` --help display this help and exit`]},$s={name:`grep`,async execute(e,t){if(E(e))return T(Qs);let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!1,f=!1,p=!1,m=!1,h=!1,g=!1,_=0,v=0,y=0,ee=[],te=[],ne=[],b=null,re=[];for(let t=0;t<e.length;t++){let x=e[t];if(x.startsWith(`-`)&&x!==`-`){if(x===`-e`&&t+1<e.length){b=e[++t];continue}if(x.startsWith(`--include=`)){ee.push(x.slice(10));continue}if(x.startsWith(`--exclude=`)){te.push(x.slice(10));continue}if(x.startsWith(`--exclude-dir=`)){ne.push(x.slice(14));continue}if(x.startsWith(`--max-count=`)){_=parseInt(x.slice(12),10);continue}let re=x.match(/^-m(\d+)$/);if(re){_=parseInt(re[1],10);continue}if(x===`-m`&&t+1<e.length){_=parseInt(e[++t],10);continue}let ie=x.match(/^-([ABC])(\d+)$/);if(ie){let e=parseInt(ie[2],10);ie[1]===`A`?y=e:ie[1]===`B`?v=e:ie[1]===`C`&&(v=e,y=e);continue}if((x===`-A`||x===`-B`||x===`-C`)&&t+1<e.length){let n=parseInt(e[++t],10);x===`-A`?y=n:x===`-B`?v=n:(v=n,y=n);continue}let ae=x.startsWith(`--`)?[x]:x.slice(1).split(``);for(let e of ae)if(e===`i`||e===`--ignore-case`)n=!0;else if(e===`n`||e===`--line-number`)r=!0;else if(e===`v`||e===`--invert-match`)i=!0;else if(e===`c`||e===`--count`)a=!0;else if(e===`l`||e===`--files-with-matches`)o=!0;else if(e===`L`||e===`--files-without-match`)s=!0;else if(e===`r`||e===`R`||e===`--recursive`)c=!0;else if(e===`w`||e===`--word-regexp`)l=!0;else if(e===`x`||e===`--line-regexp`)u=!0;else if(e===`E`||e===`--extended-regexp`)d=!0;else if(e===`P`||e===`--perl-regexp`)f=!0;else if(e===`F`||e===`--fixed-strings`)p=!0;else if(e===`o`||e===`--only-matching`)m=!0;else if(e===`h`||e===`--no-filename`)h=!0;else if(e===`q`||e===`--quiet`||e===`--silent`)g=!0;else{if(e.startsWith(`--`))return D(`grep`,e);if(e.length===1)return D(`grep`,`-${e}`)}}else b===null?b=x:re.push(x)}if(b===null)return{stdout:``,stderr:`grep: missing pattern
267
- `,exitCode:2};let x=p?`fixed`:d?`extended`:f?`perl`:`basic`,ie,ae;try{let e=Ns(b,{mode:x,ignoreCase:n,wholeWord:l,lineRegexp:u});ie=e.regex,ae=e.kResetGroup}catch{return{stdout:``,stderr:`grep: invalid regular expression: ${b}
268
- `,exitCode:2}}if(re.length===0&&t.stdin!==void 0){let e=ks(t.stdin,ie,{invertMatch:i,showLineNumbers:r,countOnly:a,filename:``,onlyMatching:m,beforeContext:v,afterContext:y,maxCount:_,kResetGroup:ae});return g?{stdout:``,stderr:``,exitCode:+!e.matched}:{stdout:e.output,stderr:``,exitCode:+!e.matched}}if(re.length===0)return{stdout:``,stderr:`grep: no input files
269
- `,exitCode:2};let oe=``,se=``,ce=!1,le=!1,ue=[];for(let e of re)if(e.includes(`*`)||e.includes(`?`)||e.includes(`[`)){let n=await Xs(e,t);if(c)for(let e of n){let n=await Zs(e.path,t,ee,te,ne,e.isFile);ue.push(...n)}else ue.push(...n)}else if(c){let n=await Zs(e,t,ee,te,ne);ue.push(...n)}else ue.push({path:e});let de=(ue.length>1||c)&&!h;for(let e=0;e<ue.length;e+=50){let n=ue.slice(e,e+50),l=await Promise.all(n.map(async e=>{let n=e.path,o=n.split(`/`).pop()||n;if(te.length>0&&!c&&te.some(e=>Cs(o,e,{stripQuotes:!0}))||ee.length>0&&!c&&!ee.some(e=>Cs(o,e,{stripQuotes:!0})))return null;try{let o=t.fs.resolvePath(t.cwd,n),s=!1;return s=e.isFile===void 0?(await t.fs.stat(o)).isDirectory:!e.isFile,s?c?null:{error:`grep: ${n}: Is a directory
270
- `}:{file:n,result:ks(await t.fs.readFile(o),ie,{invertMatch:i,showLineNumbers:r,countOnly:a,filename:de?n:``,onlyMatching:m,beforeContext:v,afterContext:y,maxCount:_,kResetGroup:ae})}}catch{return{error:`grep: ${n}: No such file or directory
266
+ `:``,matched:!0,matchCount:b.length}}var As=S(()=>{});function js(e){let t=``,n=0;for(;n<e.length;){if(e.slice(n,n+7)===`[[:<:]]`){t+=`\\b`,n+=7;continue}if(e.slice(n,n+7)===`[[:>:]]`){t+=`\\b`,n+=7;continue}if(e[n]===`[`){let r=`[`;for(n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(r+=`^`,n++),n<e.length&&e[n]===`]`&&(r+=`\\]`,n++);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 i=e.slice(n+2,t),a=Ws.get(i);if(a){r+=a,n=t+2;continue}}}if(e[n]===`\\`&&n+1<e.length){r+=e[n]+e[n+1],n+=2;continue}r+=e[n],n++}n<e.length&&e[n]===`]`&&(r+=`]`,n++),t+=r;continue}if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++}return t}function Ms(e,t){let n,r;switch(t.mode){case`fixed`:n=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);break;case`extended`:case`perl`:if(n=js(e),n=n.replace(/\(\?P<([^>]+)>/g,`(?<$1>`),t.mode===`perl`){n=Ns(n),n=Ps(n),n=Fs(n);let e=zs(n);n=e.pattern,r=e.kResetGroup}break;default:n=js(e),n=Us(n);break}t.wholeWord&&(n=`\\b(?:${n})\\b`),t.lineRegexp&&(n=`^${n}$`);let i=/\\u\{[0-9A-Fa-f]+\}/.test(n),a=`g`+(t.ignoreCase?`i`:``)+(t.multiline?`m`:``)+(t.multilineDotall?`s`:``)+(i?`u`:``);return{regex:z(n,a),kResetGroup:r}}function Ns(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`Q`){n+=2;let r=``;for(;n<e.length;){if(e[n]===`\\`&&n+1<e.length&&e[n+1]===`E`){n+=2;break}r+=e[n],n++}t+=r.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}else t+=e[n],n++;return t}function Ps(e){return e.replace(/\\x\{([0-9A-Fa-f]+)\}/g,`\\u{$1}`)}function Fs(e){let t=``,n=0;for(;n<e.length;){if(e[n]===`(`&&n+1<e.length&&e[n+1]===`?`){let r=e.slice(n).match(/^\(\?([imsx]*)(-[imsx]*)?(:|$|\))/);if(r){let i=r[1]||``,a=r[2]||``,o=r[3];if(o===`:`){let o=n+r[0].length-1,s=Is(e,n);if(s!==-1){let r=Ls(e.slice(o+1,s),i,a);t+=`(?:${r})`,n=s+1;continue}}else if(o===`)`||o===``){n+=r[0].length;continue}}}t+=e[n],n++}return t}function Is(e,t){let n=0,r=t;for(;r<e.length;){if(e[r]===`\\`){r+=2;continue}if(e[r]===`[`){for(r++;r<e.length&&e[r]!==`]`;)e[r]===`\\`&&r++,r++;r++;continue}if(e[r]===`(`)n++;else if(e[r]===`)`&&(n--,n===0))return r;r++}return-1}function Ls(e,t,n){let r=e;return t.includes(`i`)&&(r=Rs(r)),r}function Rs(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r===`\\`){n+1<e.length?(t+=r+e[n+1],n+=2):(t+=r,n++);continue}if(r===`[`){t+=r,n++,n<e.length&&e[n]===`^`&&(t+=e[n],n++);let i=[];for(;n<e.length&&e[n]!==`]`;)if(e[n]===`\\`)i.push(e[n]),n++,n<e.length&&(i.push(e[n]),n++);else if(e[n]===`-`&&i.length>0&&n+1<e.length&&e[n+1]!==`]`){let t=i[i.length-1],r=e[n+1];i.push(`-`),i.push(r),/[a-z]/.test(t)&&/[a-z]/.test(r)?(i.push(t.toUpperCase()),i.push(`-`),i.push(r.toUpperCase())):/[A-Z]/.test(t)&&/[A-Z]/.test(r)&&(i.push(t.toLowerCase()),i.push(`-`),i.push(r.toLowerCase())),n+=2}else{let t=e[n];if(i.push(t),/[a-zA-Z]/.test(t)){let e=t===t.toLowerCase()?t.toUpperCase():t.toLowerCase();i.includes(e)||i.push(e)}n++}t+=i.join(``),n<e.length&&(t+=e[n],n++);continue}if(/[a-zA-Z]/.test(r)){let e=r.toLowerCase(),n=r.toUpperCase();t+=`[${n}${e}]`}else t+=r;n++}return t}function zs(e){let t=Bs(e);if(t===-1)return{pattern:e};let n=e.slice(0,t),r=e.slice(t+2),i=Vs(n);return{pattern:`(?:${n})(${r})`,kResetGroup:i+1}}function Bs(e){let t=0;for(;t<e.length-1;)if(e[t]===`\\`){if(e[t+1]===`K`){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;if(n%2==0)return t}t+=2}else t++;return-1}function Vs(e){let t=0,n=0;for(;n<e.length;){if(e[n]===`\\`){n+=2;continue}if(e[n]===`[`){for(n++;n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n++,n++;n++;continue}if(e[n]===`(`)if(n+1<e.length&&e[n+1]===`?`){if(n+2<e.length){let r=e[n+2];if(r===`:`||r===`=`||r===`!`){n++;continue}if(r===`<`&&n+3<e.length){let r=e[n+3];if(r===`=`||r===`!`){n++;continue}t++,n++;continue}}}else t++;n++}return t}function Hs(e){let t=e.replace(/\$\{0\}|\$0(?![0-9])/g,`$$&`);return t=t.replace(/\$\{([^0-9}][^}]*)\}/g,`$$<$1>`),t=t.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)(?![>0-9])/g,`$$<$1>`),t}function Us(e){let t=``,n=0,r=!0,i=0;for(;n<e.length;){let a=e[n];if(a===`[`){for(t+=a,n++,n<e.length&&(e[n]===`^`||e[n]===`!`)&&(t+=e[n],n++),n<e.length&&e[n]===`]`&&(t+=e[n],n++);n<e.length&&e[n]!==`]`;)e[n]===`\\`&&n+1<e.length?(t+=e[n]+e[n+1],n+=2):(t+=e[n],n++);n<e.length&&e[n]===`]`&&(t+=e[n],n++),r=!1;continue}if(a===`\\`&&n+1<e.length){let o=e[n+1];if(o===`|`){t+=`|`,n+=2,r=!0;continue}if(o===`(`){t+=`(`,n+=2,i++,r=!0;continue}if(o===`)`){t+=`)`,n+=2,i=Math.max(0,i-1),r=!1;continue}if(o===`{`){let i=e.slice(n).match(/^\\{(\d+)(,(\d*)?)?\\}/);if(i){let e=i[1],a=i[2]!==void 0,o=i[3]||``;a?t+=`{${e},${o}}`:t+=`{${e}}`,n+=i[0].length,r=!1;continue}t+=`\\{`,n+=2,r=!1;continue}if(o===`}`){t+=`\\}`,n+=2,r=!1;continue}t+=a+o,n+=2,r=!1;continue}if(a===`*`&&r){t+=`\\*`,n++;continue}if(a===`^`){if(r){t+=`^`,n++;continue}t+=`\\^`,n++;continue}if(a===`$`){let i=n===e.length-1,a=n+2<e.length&&e[n+1]===`\\`&&e[n+2]===`)`;i||a?t+=`$`:t+=`\\$`,n++,r=!1;continue}a===`+`||a===`?`||a===`|`||a===`(`||a===`)`||a===`{`||a===`}`?t+=`\\${a}`:t+=a,n++,r=!1}return t}var Ws,Gs=S(()=>{xs(),Ws=new Map([[`alpha`,`a-zA-Z`],[`digit`,`0-9`],[`alnum`,`a-zA-Z0-9`],[`lower`,`a-z`],[`upper`,`A-Z`],[`xdigit`,`0-9A-Fa-f`],[`space`,` \\t\\n\\r\\f\\v`],[`blank`,` \\t`],[`punct`,"!-/:-@\\[-`{-~"],[`graph`,`!-~`],[`print`,` -~`],[`cntrl`,`\\x00-\\x1F\\x7F`],[`ascii`,`\\x00-\\x7F`],[`word`,`a-zA-Z0-9_`]])}),Ks=S(()=>{As(),Gs()}),qs={};C(qs,{egrepCommand:()=>tc,egrepFlagsForFuzzing:()=>ic,fgrepCommand:()=>ec,fgrepFlagsForFuzzing:()=>rc,flagsForFuzzing:()=>nc,grepCommand:()=>Qs});async function Js(e,t,n,r,i=0){if(i>=$s)return;let a=n.fs.resolvePath(n.cwd,e);try{if(!(await n.fs.stat(a)).isDirectory){let n=e.split(`/`).pop()||``;t&&Ss(n,t.replace(/^\//,``),{stripQuotes:!0})&&r.push(e);return}let o=await n.fs.readdir(a);for(let a of o){let o=e===`.`?a:`${e}/${a}`,s=n.fs.resolvePath(n.cwd,o);(await n.fs.stat(s)).isDirectory?await Js(o,t,n,r,i+1):t&&Ss(a,t.replace(/^\//,``),{stripQuotes:!0})&&r.push(o)}}catch{}}async function Ys(e,t){let n=[],r=e.lastIndexOf(`/`),i,a;if(r===-1?(i=t.cwd,a=e):(i=e.slice(0,r)||`/`,a=e.slice(r+1)),e.includes(`**`)){let n=[],r=e.split(`**`);return await Js(r[0].replace(/\/$/,``)||`.`,r[1]||``,t,n),n.map(e=>({path:e}))}let o=t.fs.resolvePath(t.cwd,i);try{if(t.fs.readdirWithFileTypes){let e=await t.fs.readdirWithFileTypes(o);for(let t of e)if(Ss(t.name,a,{stripQuotes:!0})){let e=r===-1?t.name:`${i}/${t.name}`;n.push({path:e,isFile:t.isFile})}}else{let e=await t.fs.readdir(o);for(let t of e)if(Ss(t,a,{stripQuotes:!0})){let e=r===-1?t:`${i}/${t}`;n.push({path:e})}}}catch{}return n.sort((e,t)=>e.path.localeCompare(t.path))}async function Xs(e,t,n=[],r=[],i=[],a,o=0){if(o>=$s)return[];let s=t.fs.resolvePath(t.cwd,e),c=[];try{let l,u;if(a!==void 0)l=a,u=!a;else{let e=await t.fs.stat(s);l=e.isFile,u=e.isDirectory}if(l){let t=e.split(`/`).pop()||e;return r.length>0&&r.some(e=>Ss(t,e,{stripQuotes:!0}))||n.length>0&&!n.some(e=>Ss(t,e,{stripQuotes:!0}))?[]:[{path:e,isFile:!0}]}if(!u)return[];let d=e.split(`/`).pop()||e;if(i.length>0&&i.some(e=>Ss(d,e,{stripQuotes:!0})))return[];if(t.fs.readdirWithFileTypes){let a=await t.fs.readdirWithFileTypes(s);for(let s of a){if(s.name.startsWith(`.`))continue;let a=await Xs(e===`.`?s.name:`${e}/${s.name}`,t,n,r,i,s.isFile,o+1);c.push(...a)}}else{let a=await t.fs.readdir(s);for(let s of a){if(s.startsWith(`.`))continue;let a=await Xs(e===`.`?s:`${e}/${s}`,t,n,r,i,void 0,o+1);c.push(...a)}}}catch{}return c}var Zs,Qs,$s,ec,tc,nc,rc,ic,ac=S(()=>{Es(),O(),Ks(),Zs={name:`grep`,summary:`print lines that match patterns`,usage:`grep [OPTION]... PATTERN [FILE]...`,options:[`-E, --extended-regexp PATTERN is an extended regular expression`,`-P, --perl-regexp PATTERN is a Perl regular expression`,`-F, --fixed-strings PATTERN is a set of newline-separated strings`,`-i, --ignore-case ignore case distinctions`,`-v, --invert-match select non-matching lines`,`-w, --word-regexp match only whole words`,`-x, --line-regexp match only whole lines`,`-c, --count print only a count of matching lines`,`-l, --files-with-matches print only names of files with matches`,`-L, --files-without-match print names of files with no matches`,`-m NUM, --max-count=NUM stop after NUM matches`,`-n, --line-number print line number with output lines`,`-h, --no-filename suppress the file name prefix on output`,`-o, --only-matching show only nonempty parts of lines that match`,`-q, --quiet, --silent suppress all normal output`,`-r, -R, --recursive search directories recursively`,`-A NUM print NUM lines of trailing context`,`-B NUM print NUM lines of leading context`,`-C NUM print NUM lines of context`,`-e PATTERN use PATTERN for matching`,` --include=GLOB search only files matching GLOB`,` --exclude=GLOB skip files matching GLOB`,` --exclude-dir=DIR skip directories matching DIR`,` --help display this help and exit`]},Qs={name:`grep`,async execute(e,t){if(E(e))return T(Zs);let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!1,f=!1,p=!1,m=!1,h=!1,g=!1,_=0,v=0,y=0,ee=[],te=[],ne=[],b=null,re=[];for(let t=0;t<e.length;t++){let x=e[t];if(x.startsWith(`-`)&&x!==`-`){if(x===`-e`&&t+1<e.length){b=e[++t];continue}if(x.startsWith(`--include=`)){ee.push(x.slice(10));continue}if(x.startsWith(`--exclude=`)){te.push(x.slice(10));continue}if(x.startsWith(`--exclude-dir=`)){ne.push(x.slice(14));continue}if(x.startsWith(`--max-count=`)){_=parseInt(x.slice(12),10);continue}let re=x.match(/^-m(\d+)$/);if(re){_=parseInt(re[1],10);continue}if(x===`-m`&&t+1<e.length){_=parseInt(e[++t],10);continue}let ie=x.match(/^-([ABC])(\d+)$/);if(ie){let e=parseInt(ie[2],10);ie[1]===`A`?y=e:ie[1]===`B`?v=e:ie[1]===`C`&&(v=e,y=e);continue}if((x===`-A`||x===`-B`||x===`-C`)&&t+1<e.length){let n=parseInt(e[++t],10);x===`-A`?y=n:x===`-B`?v=n:(v=n,y=n);continue}let ae=x.startsWith(`--`)?[x]:x.slice(1).split(``);for(let e of ae)if(e===`i`||e===`--ignore-case`)n=!0;else if(e===`n`||e===`--line-number`)r=!0;else if(e===`v`||e===`--invert-match`)i=!0;else if(e===`c`||e===`--count`)a=!0;else if(e===`l`||e===`--files-with-matches`)o=!0;else if(e===`L`||e===`--files-without-match`)s=!0;else if(e===`r`||e===`R`||e===`--recursive`)c=!0;else if(e===`w`||e===`--word-regexp`)l=!0;else if(e===`x`||e===`--line-regexp`)u=!0;else if(e===`E`||e===`--extended-regexp`)d=!0;else if(e===`P`||e===`--perl-regexp`)f=!0;else if(e===`F`||e===`--fixed-strings`)p=!0;else if(e===`o`||e===`--only-matching`)m=!0;else if(e===`h`||e===`--no-filename`)h=!0;else if(e===`q`||e===`--quiet`||e===`--silent`)g=!0;else{if(e.startsWith(`--`))return D(`grep`,e);if(e.length===1)return D(`grep`,`-${e}`)}}else b===null?b=x:re.push(x)}if(b===null)return{stdout:``,stderr:`grep: missing pattern
267
+ `,exitCode:2};let x=p?`fixed`:d?`extended`:f?`perl`:`basic`,ie,ae;try{let e=Ms(b,{mode:x,ignoreCase:n,wholeWord:l,lineRegexp:u});ie=e.regex,ae=e.kResetGroup}catch{return{stdout:``,stderr:`grep: invalid regular expression: ${b}
268
+ `,exitCode:2}}if(re.length===0&&t.stdin!==void 0){let e=Os(t.stdin,ie,{invertMatch:i,showLineNumbers:r,countOnly:a,filename:``,onlyMatching:m,beforeContext:v,afterContext:y,maxCount:_,kResetGroup:ae});return g?{stdout:``,stderr:``,exitCode:+!e.matched}:{stdout:e.output,stderr:``,exitCode:+!e.matched}}if(re.length===0)return{stdout:``,stderr:`grep: no input files
269
+ `,exitCode:2};let oe=``,se=``,ce=!1,le=!1,ue=[];for(let e of re)if(e.includes(`*`)||e.includes(`?`)||e.includes(`[`)){let n=await Ys(e,t);if(c)for(let e of n){let n=await Xs(e.path,t,ee,te,ne,e.isFile);ue.push(...n)}else ue.push(...n)}else if(c){let n=await Xs(e,t,ee,te,ne);ue.push(...n)}else ue.push({path:e});let de=(ue.length>1||c)&&!h;for(let e=0;e<ue.length;e+=50){let n=ue.slice(e,e+50),l=await Promise.all(n.map(async e=>{let n=e.path,o=n.split(`/`).pop()||n;if(te.length>0&&!c&&te.some(e=>Ss(o,e,{stripQuotes:!0}))||ee.length>0&&!c&&!ee.some(e=>Ss(o,e,{stripQuotes:!0})))return null;try{let o=t.fs.resolvePath(t.cwd,n),s=!1;return s=e.isFile===void 0?(await t.fs.stat(o)).isDirectory:!e.isFile,s?c?null:{error:`grep: ${n}: Is a directory
270
+ `}:{file:n,result:Os(await t.fs.readFile(o),ie,{invertMatch:i,showLineNumbers:r,countOnly:a,filename:de?n:``,onlyMatching:m,beforeContext:v,afterContext:y,maxCount:_,kResetGroup:ae})}}catch{return{error:`grep: ${n}: No such file or directory
271
271
  `}}}));for(let e of l){if(e===null)continue;if(`error`in e&&e.error){se+=e.error,e.error.includes(`Is a directory`)||(le=!0);continue}if(!(`file`in e)||!e.result)continue;let{file:t,result:n}=e;if(n.matched){if(ce=!0,g)return{stdout:``,stderr:``,exitCode:0};o?oe+=`${t}
272
272
  `:s||(oe+=n.output)}else s?oe+=`${t}
273
- `:a&&!o&&(oe+=n.output)}}let fe;return fe=le?2:s?oe.length>0?0:1:+!ce,g?{stdout:``,stderr:``,exitCode:fe}:{stdout:oe,stderr:se,exitCode:fe}}},ec=256,tc={name:`fgrep`,async execute(e,t){return $s.execute([`-F`,...e],t)}},nc={name:`egrep`,async execute(e,t){return $s.execute([`-E`,...e],t)}},rc={name:`grep`,flags:[{flag:`-E`,type:`boolean`},{flag:`-F`,type:`boolean`},{flag:`-P`,type:`boolean`},{flag:`-i`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-w`,type:`boolean`},{flag:`-x`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-L`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-h`,type:`boolean`},{flag:`-o`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-m`,type:`value`,valueHint:`number`},{flag:`-A`,type:`value`,valueHint:`number`},{flag:`-B`,type:`value`,valueHint:`number`},{flag:`-C`,type:`value`,valueHint:`number`},{flag:`-e`,type:`value`,valueHint:`pattern`}],stdinType:`text`,needsArgs:!0},ic={name:`fgrep`,flags:[],stdinType:`text`,needsArgs:!0},ac={name:`egrep`,flags:[],stdinType:`text`,needsArgs:!0}});function sc(e,t){if(Array.isArray(e))throw TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw TypeError(`${t}: expected null-prototype object, got prototypal object`)}function cc(e){return!gc.has(e)}function lc(e,t,n){sc(e,`safeSet`),cc(t)&&(e[t]=n)}function uc(e,t){return sc(e,`safeHasOwn`),Object.hasOwn(e,t)}function dc(e){let t=new WeakMap,n=e=>{if(typeof e!=`object`||!e||e instanceof Date)return e;let r=t.get(e);if(r!==void 0)return r;if(Array.isArray(e)){let r=[];t.set(e,r);for(let t of e)r.push(n(t));return r}let i=Object.create(null);t.set(e,i);for(let t of Object.keys(e))i[t]=n(e[t]);return i};return n(e)}function fc(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function pc(e){return Object.assign(Object.create(null),e)}function mc(e){return Object.assign(Object.create(null),e)}function hc(...e){return Object.assign(Object.create(null),...e)}var gc,_c=S(()=>{gc=new Set([`__proto__`,`constructor`,`prototype`]),new Set([...gc,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`])});function vc(){let e=[];for(let[t,n]of Object.entries(yc).sort()){let r=[];for(let e of n.extensions)r.push(`*${e}`);for(let e of n.globs)r.push(e);e.push(`${t}: ${r.join(`, `)}`)}return`${e.join(`
273
+ `:a&&!o&&(oe+=n.output)}}let fe;return fe=le?2:s?oe.length>0?0:1:+!ce,g?{stdout:``,stderr:``,exitCode:fe}:{stdout:oe,stderr:se,exitCode:fe}}},$s=256,ec={name:`fgrep`,async execute(e,t){return Qs.execute([`-F`,...e],t)}},tc={name:`egrep`,async execute(e,t){return Qs.execute([`-E`,...e],t)}},nc={name:`grep`,flags:[{flag:`-E`,type:`boolean`},{flag:`-F`,type:`boolean`},{flag:`-P`,type:`boolean`},{flag:`-i`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-w`,type:`boolean`},{flag:`-x`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-L`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-h`,type:`boolean`},{flag:`-o`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-m`,type:`value`,valueHint:`number`},{flag:`-A`,type:`value`,valueHint:`number`},{flag:`-B`,type:`value`,valueHint:`number`},{flag:`-C`,type:`value`,valueHint:`number`},{flag:`-e`,type:`value`,valueHint:`pattern`}],stdinType:`text`,needsArgs:!0},rc={name:`fgrep`,flags:[],stdinType:`text`,needsArgs:!0},ic={name:`egrep`,flags:[],stdinType:`text`,needsArgs:!0}});function oc(e,t){if(Array.isArray(e))throw TypeError(`${t}: expected object, got array`);if(Object.getPrototypeOf(e)!==null)throw TypeError(`${t}: expected null-prototype object, got prototypal object`)}function sc(e){return!hc.has(e)}function cc(e,t,n){oc(e,`safeSet`),sc(t)&&(e[t]=n)}function lc(e,t){return oc(e,`safeHasOwn`),Object.hasOwn(e,t)}function uc(e){let t=new WeakMap,n=e=>{if(typeof e!=`object`||!e||e instanceof Date)return e;let r=t.get(e);if(r!==void 0)return r;if(Array.isArray(e)){let r=[];t.set(e,r);for(let t of e)r.push(n(t));return r}let i=Object.create(null);t.set(e,i);for(let t of Object.keys(e))i[t]=n(e[t]);return i};return n(e)}function dc(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function fc(e){return Object.assign(Object.create(null),e)}function pc(e){return Object.assign(Object.create(null),e)}function mc(...e){return Object.assign(Object.create(null),...e)}var hc,gc=S(()=>{hc=new Set([`__proto__`,`constructor`,`prototype`]),new Set([...hc,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`toLocaleString`,`toString`,`valueOf`])});function _c(){let e=[];for(let[t,n]of Object.entries(vc).sort()){let r=[];for(let e of n.extensions)r.push(`*${e}`);for(let e of n.globs)r.push(e);e.push(`${t}: ${r.join(`, `)}`)}return`${e.join(`
274
274
  `)}
275
- `}var yc,bc,xc=S(()=>{Ss(),_c(),yc=pc({js:{extensions:[`.js`,`.mjs`,`.cjs`,`.jsx`],globs:[]},ts:{extensions:[`.ts`,`.tsx`,`.mts`,`.cts`],globs:[]},html:{extensions:[`.html`,`.htm`,`.xhtml`],globs:[]},css:{extensions:[`.css`,`.scss`,`.sass`,`.less`],globs:[]},json:{extensions:[`.json`,`.jsonc`,`.json5`],globs:[]},xml:{extensions:[`.xml`,`.xsl`,`.xslt`],globs:[]},c:{extensions:[`.c`,`.h`],globs:[]},cpp:{extensions:[`.cpp`,`.cc`,`.cxx`,`.hpp`,`.hh`,`.hxx`,`.h`],globs:[]},rust:{extensions:[`.rs`],globs:[]},go:{extensions:[`.go`],globs:[]},zig:{extensions:[`.zig`],globs:[]},java:{extensions:[`.java`],globs:[]},kotlin:{extensions:[`.kt`,`.kts`],globs:[]},scala:{extensions:[`.scala`,`.sc`],globs:[]},clojure:{extensions:[`.clj`,`.cljc`,`.cljs`,`.edn`],globs:[]},py:{extensions:[`.py`,`.pyi`,`.pyw`],globs:[]},rb:{extensions:[`.rb`,`.rake`,`.gemspec`],globs:[`Rakefile`,`Gemfile`]},php:{extensions:[`.php`,`.phtml`,`.php3`,`.php4`,`.php5`],globs:[]},perl:{extensions:[`.pl`,`.pm`,`.pod`,`.t`],globs:[]},lua:{extensions:[`.lua`],globs:[]},sh:{extensions:[`.sh`,`.bash`,`.zsh`,`.fish`],globs:[`.bashrc`,`.zshrc`,`.profile`]},bat:{extensions:[`.bat`,`.cmd`],globs:[]},ps:{extensions:[`.ps1`,`.psm1`,`.psd1`],globs:[]},yaml:{extensions:[`.yaml`,`.yml`],globs:[]},toml:{extensions:[`.toml`],globs:[`Cargo.toml`,`pyproject.toml`]},ini:{extensions:[`.ini`,`.cfg`,`.conf`],globs:[]},csv:{extensions:[`.csv`,`.tsv`],globs:[]},md:{extensions:[`.md`,`.mdx`,`.markdown`,`.mdown`,`.mkd`],globs:[]},markdown:{extensions:[`.md`,`.mdx`,`.markdown`,`.mdown`,`.mkd`],globs:[]},rst:{extensions:[`.rst`],globs:[]},txt:{extensions:[`.txt`,`.text`],globs:[]},tex:{extensions:[`.tex`,`.ltx`,`.sty`,`.cls`],globs:[]},sql:{extensions:[`.sql`],globs:[]},graphql:{extensions:[`.graphql`,`.gql`],globs:[]},proto:{extensions:[`.proto`],globs:[]},make:{extensions:[`.mk`,`.mak`],globs:[`Makefile`,`GNUmakefile`,`makefile`]},docker:{extensions:[],globs:[`Dockerfile`,`Dockerfile.*`,`*.dockerfile`]},tf:{extensions:[`.tf`,`.tfvars`],globs:[]}}),bc=class{types;constructor(){this.types=new Map(Object.entries(yc).map(([e,t])=>[e,{extensions:[...t.extensions],globs:[...t.globs]}]))}addType(e){let t=e.indexOf(`:`);if(t===-1)return;let n=e.slice(0,t),r=e.slice(t+1);if(r.startsWith(`include:`)){let e=r.slice(8),t=this.types.get(e);if(t){let e=this.types.get(n)||{extensions:[],globs:[]};e.extensions.push(...t.extensions),e.globs.push(...t.globs),this.types.set(n,e)}}else{let e=this.types.get(n)||{extensions:[],globs:[]};if(r.startsWith(`*.`)&&!r.slice(2).includes(`*`)){let t=r.slice(1);e.extensions.includes(t)||e.extensions.push(t)}else e.globs.includes(r)||e.globs.push(r);this.types.set(n,e)}}clearType(e){let t=this.types.get(e);t&&(t.extensions=[],t.globs=[])}getType(e){return this.types.get(e)}getAllTypes(){return this.types}matchesType(e,t){let n=e.toLowerCase();for(let r of t){if(r===`all`){if(this.matchesAnyType(e))return!0;continue}let t=this.types.get(r);if(t){for(let e of t.extensions)if(n.endsWith(e))return!0;for(let r of t.globs)if(r.includes(`*`)){if(R(`^${r.replace(/\./g,`\\.`).replace(/\*/g,`.*`)}$`,`i`).test(e))return!0}else if(n===r.toLowerCase())return!0}}return!1}matchesAnyType(e){let t=e.toLowerCase();for(let n of this.types.values()){for(let e of n.extensions)if(t.endsWith(e))return!0;for(let r of n.globs)if(r.includes(`*`)){if(R(`^${r.replace(/\./g,`\\.`).replace(/\*/g,`.*`)}$`,`i`).test(e))return!0}else if(t===r.toLowerCase())return!0}return!1}}});function Sc(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:`--`,quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:`path`,json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var Cc=S(()=>{});function wc(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||``).toUpperCase()){case`K`:return n*1024;case`M`:return n*1024*1024;case`G`:return n*1024*1024*1024;default:return n}}function Tc(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:``,stderr:`rg: invalid --max-filesize value: ${e}
276
- `,exitCode:1}}function Ec(e){return null}function Dc(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function Oc(e,t,n){let r=e[t];for(let i of Fc){if(r.startsWith(`--${i.long}=`)){let e=Ac(n,i,r.slice(`--${i.long}=`.length));return e?{newIndex:t,error:e}:{newIndex:t}}if(i.short&&r.startsWith(`-${i.short}`)&&r.length>2){let e=Ac(n,i,r.slice(2));return e?{newIndex:t,error:e}:{newIndex:t}}if(i.short&&r===`-${i.short}`||r===`--${i.long}`){if(t+1>=e.length)return null;let r=e[t+1],a=Ac(n,i,r);return a?{newIndex:t+1,error:a}:{newIndex:t+1}}}return null}function kc(e){return Fc.find(t=>t.short===e)}function Ac(e,t,n){if(t.validate){let e=t.validate(n);if(e)return e}let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function jc(e,t){let n=e[t];if(n===`--sort`&&t+1<e.length){let n=e[t+1];if(n===`path`||n===`none`)return{value:n,newIndex:t+1}}if(n.startsWith(`--sort=`)){let e=n.slice(7);if(e===`path`||e===`none`)return{value:e,newIndex:t}}return null}function Mc(e,t){let n=e[t],r=n.match(/^-([ABC])(\d+)$/);return r?{flag:r[1],value:parseInt(r[2],10),newIndex:t}:(n===`-A`||n===`-B`||n===`-C`)&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function Nc(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Pc(e){let t=Sc(),n=null,r=[],i=-1,a=-1,o=-1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];if(l.startsWith(`-`)&&l!==`-`){let n=Mc(e,c);if(n){let{flag:e,value:t,newIndex:r}=n;e===`A`?i=Math.max(i,t):e===`B`?a=Math.max(a,t):o=t,c=r;continue}let r=Nc(l);if(r!==null){t.maxCount=r;continue}let u=Oc(e,c,t);if(u){if(u.error)return{success:!1,error:u.error};c=u.newIndex;continue}let d=jc(e,c);if(d){t.sort=d.value,c=d.newIndex;continue}let f=l.startsWith(`--`)?[l]:l.slice(1).split(``);for(let n of f){if(Lc.has(n)){t.lineNumber=!0,s=!0;continue}if(n===`u`||n===`--unrestricted`){Dc(t);continue}if(n===`P`||n===`--pcre2`)return{success:!1,error:{stdout:``,stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
277
- `,exitCode:1}};if(n.length===1){let r=kc(n);if(r){if(c+1>=e.length)return{success:!1,error:D(`rg`,`-${n}`)};let i=Ac(t,r,e[c+1]);if(i)return{success:!1,error:i};c++;continue}}let r=Ic.get(n);if(r){r(t);continue}if(n.startsWith(`--`))return{success:!1,error:D(`rg`,n)};if(n.length===1)return{success:!1,error:D(`rg`,`-${n}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=l:r.push(l)}return(i>=0||o>=0)&&(t.afterContext=Math.max(i>=0?i:0,o>=0?o:0)),(a>=0||o>=0)&&(t.beforeContext=Math.max(a>=0?a:0,o>=0?o:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(s=!0),{success:!0,options:t,paths:r,explicitLineNumbers:s}}var Fc,Ic,Lc,Rc=S(()=>{O(),Cc(),Fc=[{short:`g`,long:`glob`,target:`globs`,multi:!0},{long:`iglob`,target:`iglobs`,multi:!0},{short:`t`,long:`type`,target:`types`,multi:!0,validate:Ec},{short:`T`,long:`type-not`,target:`typesNot`,multi:!0,validate:Ec},{long:`type-add`,target:`typeAdd`,multi:!0},{long:`type-clear`,target:`typeClear`,multi:!0},{short:`m`,long:`max-count`,target:`maxCount`,parse:parseInt},{short:`e`,long:`regexp`,target:`patterns`,multi:!0},{short:`f`,long:`file`,target:`patternFiles`,multi:!0},{short:`r`,long:`replace`,target:`replace`},{short:`d`,long:`max-depth`,target:`maxDepth`,parse:parseInt},{long:`max-filesize`,target:`maxFilesize`,parse:wc,validate:Tc},{long:`context-separator`,target:`contextSeparator`},{short:`j`,long:`threads`,target:`maxDepth`,parse:()=>1/0},{long:`ignore-file`,target:`ignoreFiles`,multi:!0},{long:`pre`,target:`preprocessor`},{long:`pre-glob`,target:`preprocessorGlobs`,multi:!0}],Ic=new Map([[`i`,e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],[`--ignore-case`,e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],[`s`,e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],[`--case-sensitive`,e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],[`S`,e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],[`--smart-case`,e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],[`F`,e=>{e.fixedStrings=!0}],[`--fixed-strings`,e=>{e.fixedStrings=!0}],[`w`,e=>{e.wordRegexp=!0}],[`--word-regexp`,e=>{e.wordRegexp=!0}],[`x`,e=>{e.lineRegexp=!0}],[`--line-regexp`,e=>{e.lineRegexp=!0}],[`v`,e=>{e.invertMatch=!0}],[`--invert-match`,e=>{e.invertMatch=!0}],[`U`,e=>{e.multiline=!0}],[`--multiline`,e=>{e.multiline=!0}],[`--multiline-dotall`,e=>{e.multilineDotall=!0,e.multiline=!0}],[`c`,e=>{e.count=!0}],[`--count`,e=>{e.count=!0}],[`--count-matches`,e=>{e.countMatches=!0}],[`l`,e=>{e.filesWithMatches=!0}],[`--files`,e=>{e.files=!0}],[`--files-with-matches`,e=>{e.filesWithMatches=!0}],[`--files-without-match`,e=>{e.filesWithoutMatch=!0}],[`--stats`,e=>{e.stats=!0}],[`o`,e=>{e.onlyMatching=!0}],[`--only-matching`,e=>{e.onlyMatching=!0}],[`q`,e=>{e.quiet=!0}],[`--quiet`,e=>{e.quiet=!0}],[`N`,e=>{e.lineNumber=!1}],[`--no-line-number`,e=>{e.lineNumber=!1}],[`H`,e=>{e.withFilename=!0}],[`--with-filename`,e=>{e.withFilename=!0}],[`I`,e=>{e.noFilename=!0}],[`--no-filename`,e=>{e.noFilename=!0}],[`0`,e=>{e.nullSeparator=!0}],[`--null`,e=>{e.nullSeparator=!0}],[`b`,e=>{e.byteOffset=!0}],[`--byte-offset`,e=>{e.byteOffset=!0}],[`--column`,e=>{e.column=!0,e.lineNumber=!0}],[`--no-column`,e=>{e.column=!1}],[`--vimgrep`,e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],[`--json`,e=>{e.json=!0}],[`--hidden`,e=>{e.hidden=!0}],[`--no-ignore`,e=>{e.noIgnore=!0}],[`--no-ignore-dot`,e=>{e.noIgnoreDot=!0}],[`--no-ignore-vcs`,e=>{e.noIgnoreVcs=!0}],[`L`,e=>{e.followSymlinks=!0}],[`--follow`,e=>{e.followSymlinks=!0}],[`z`,e=>{e.searchZip=!0}],[`--search-zip`,e=>{e.searchZip=!0}],[`a`,e=>{e.searchBinary=!0}],[`--text`,e=>{e.searchBinary=!0}],[`--heading`,e=>{e.heading=!0}],[`--passthru`,e=>{e.passthru=!0}],[`--include-zero`,e=>{e.includeZero=!0}],[`--glob-case-insensitive`,e=>{e.globCaseInsensitive=!0}]]),Lc=new Set([`n`,`--line-number`])});function zc(e){return`'${e.replace(/'/g,`'\\''`)}'`}function Bc(e){return e.map(zc).join(` `)}var Vc=S(()=>{});async function Hc(e,t,n=!1,r=!1,i=[]){let a=new Wc(e,t,n,r);await a.load(t);for(let n of i)try{let r=e.resolvePath(t,n),i=await e.readFile(r);a.addPatternsFromContent(i,t)}catch{}return a}var Uc,Wc,Gc=S(()=>{Ss(),Uc=class{patterns=[];basePath;constructor(e=`/`){this.basePath=e}parse(e){let t=e.split(`
278
- `);for(let e of t){let t=e.replace(/\s+$/,``);if(!t||t.startsWith(`#`))continue;let n=!1;t.startsWith(`!`)&&(n=!0,t=t.slice(1));let r=!1;t.endsWith(`/`)&&(r=!0,t=t.slice(0,-1));let i=!1;t.startsWith(`/`)?(i=!0,t=t.slice(1)):t.includes(`/`)&&!t.startsWith(`**/`)&&(i=!0);let a=this.patternToRegex(t,i);this.patterns.push({pattern:e,regex:a,negated:n,directoryOnly:r,rooted:i})}}patternToRegex(e,t){let n=``;n=t?`^`:`(?:^|/)`;let r=0;for(;r<e.length;){let t=e[r];if(t===`*`)e[r+1]===`*`?e[r+2]===`/`?(n+=`(?:.*/)?`,r+=3):(r+2,e.length,n+=`.*`,r+=2):(n+=`[^/]*`,r++);else if(t===`?`)n+=`[^/]`,r++;else if(t===`[`){let t=r+1;for(t<e.length&&e[t]===`!`&&t++,t<e.length&&e[t]===`]`&&t++;t<e.length&&e[t]!==`]`;)t++;if(t<e.length){let i=e.slice(r,t+1);i.startsWith(`[!`)&&(i=`[^${i.slice(2)}`),n+=i,r=t+1}else n+=`\\[`,r++}else t===`/`?(n+=`/`,r++):(n+=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r++)}return n+=`(?:/.*)?$`,R(n)}matches(e,t){let n=e.replace(/^\.\//,``);n=n.replace(/^\//,``);let r=!1;for(let e of this.patterns)e.directoryOnly&&!t||e.regex.test(n)&&(r=!e.negated);return r}isWhitelisted(e,t){let n=e.replace(/^\.\//,``);n=n.replace(/^\//,``);for(let e of this.patterns)if(!(e.directoryOnly&&!t)&&e.negated&&e.regex.test(n))return!0;return!1}getBasePath(){return this.basePath}},Wc=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(e,t,n=!1,r=!1){this.fs=e,this.skipDotIgnore=n,this.skipVcsIgnore=r}async load(e){let t=[],n=e;for(;;){t.unshift(n);let e=this.fs.resolvePath(n,`..`);if(e===n)break;n=e}let r=[];this.skipVcsIgnore||r.push(`.gitignore`),this.skipDotIgnore||r.push(`.rgignore`,`.ignore`);for(let e of t){this.loadedDirs.add(e);for(let t of r){let n=this.fs.resolvePath(e,t);try{let t=await this.fs.readFile(n),r=new Uc(e);r.parse(t),this.parsers.push(r)}catch{}}}}async loadForDirectory(e){if(this.loadedDirs.has(e))return;this.loadedDirs.add(e);let t=[];this.skipVcsIgnore||t.push(`.gitignore`),this.skipDotIgnore||t.push(`.rgignore`,`.ignore`);for(let n of t){let t=this.fs.resolvePath(e,n);try{let n=await this.fs.readFile(t),r=new Uc(e);r.parse(n),this.parsers.push(r)}catch{}}}addPatternsFromContent(e,t){let n=new Uc(t);n.parse(e),this.parsers.push(n)}matches(e,t){for(let n of this.parsers){let r=n.getBasePath();if(!e.startsWith(r))continue;let i=e.slice(r.length).replace(/^\//,``);if(n.matches(i,t))return!0}return!1}isWhitelisted(e,t){for(let n of this.parsers){let r=n.getBasePath();if(!e.startsWith(r))continue;let i=e.slice(r.length).replace(/^\//,``);if(n.isWhitelisted(i,t))return!0}return!1}static isCommonIgnored(e){return new Set([`node_modules`,`.git`,`.svn`,`.hg`,`__pycache__`,`.pytest_cache`,`.mypy_cache`,`venv`,`.venv`,`.next`,`.nuxt`,`.cargo`]).has(e)}}});function Kc(e){return e.length>=2&&e[0]===31&&e[1]===139}function qc(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r===`[`&&!t?t=!0:r===`]`&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function Jc(e){let{ctx:t,options:n,paths:r,explicitLineNumbers:i}=e;for(let e of n.globs){let t=qc(e.startsWith(`!`)?e.slice(1):e);if(t)return{stdout:``,stderr:`${t}
279
- `,exitCode:1}}if(n.files)return tl(t,[...n.patterns,...r],n);let a=[...n.patterns];for(let e of n.patternFiles)try{let n;if(e===`-`)n=t.stdin;else{let r=t.fs.resolvePath(t.cwd,e);n=await t.fs.readFile(r)}let r=n.split(`
275
+ `}var vc,yc,bc=S(()=>{xs(),gc(),vc=fc({js:{extensions:[`.js`,`.mjs`,`.cjs`,`.jsx`],globs:[]},ts:{extensions:[`.ts`,`.tsx`,`.mts`,`.cts`],globs:[]},html:{extensions:[`.html`,`.htm`,`.xhtml`],globs:[]},css:{extensions:[`.css`,`.scss`,`.sass`,`.less`],globs:[]},json:{extensions:[`.json`,`.jsonc`,`.json5`],globs:[]},xml:{extensions:[`.xml`,`.xsl`,`.xslt`],globs:[]},c:{extensions:[`.c`,`.h`],globs:[]},cpp:{extensions:[`.cpp`,`.cc`,`.cxx`,`.hpp`,`.hh`,`.hxx`,`.h`],globs:[]},rust:{extensions:[`.rs`],globs:[]},go:{extensions:[`.go`],globs:[]},zig:{extensions:[`.zig`],globs:[]},java:{extensions:[`.java`],globs:[]},kotlin:{extensions:[`.kt`,`.kts`],globs:[]},scala:{extensions:[`.scala`,`.sc`],globs:[]},clojure:{extensions:[`.clj`,`.cljc`,`.cljs`,`.edn`],globs:[]},py:{extensions:[`.py`,`.pyi`,`.pyw`],globs:[]},rb:{extensions:[`.rb`,`.rake`,`.gemspec`],globs:[`Rakefile`,`Gemfile`]},php:{extensions:[`.php`,`.phtml`,`.php3`,`.php4`,`.php5`],globs:[]},perl:{extensions:[`.pl`,`.pm`,`.pod`,`.t`],globs:[]},lua:{extensions:[`.lua`],globs:[]},sh:{extensions:[`.sh`,`.bash`,`.zsh`,`.fish`],globs:[`.bashrc`,`.zshrc`,`.profile`]},bat:{extensions:[`.bat`,`.cmd`],globs:[]},ps:{extensions:[`.ps1`,`.psm1`,`.psd1`],globs:[]},yaml:{extensions:[`.yaml`,`.yml`],globs:[]},toml:{extensions:[`.toml`],globs:[`Cargo.toml`,`pyproject.toml`]},ini:{extensions:[`.ini`,`.cfg`,`.conf`],globs:[]},csv:{extensions:[`.csv`,`.tsv`],globs:[]},md:{extensions:[`.md`,`.mdx`,`.markdown`,`.mdown`,`.mkd`],globs:[]},markdown:{extensions:[`.md`,`.mdx`,`.markdown`,`.mdown`,`.mkd`],globs:[]},rst:{extensions:[`.rst`],globs:[]},txt:{extensions:[`.txt`,`.text`],globs:[]},tex:{extensions:[`.tex`,`.ltx`,`.sty`,`.cls`],globs:[]},sql:{extensions:[`.sql`],globs:[]},graphql:{extensions:[`.graphql`,`.gql`],globs:[]},proto:{extensions:[`.proto`],globs:[]},make:{extensions:[`.mk`,`.mak`],globs:[`Makefile`,`GNUmakefile`,`makefile`]},docker:{extensions:[],globs:[`Dockerfile`,`Dockerfile.*`,`*.dockerfile`]},tf:{extensions:[`.tf`,`.tfvars`],globs:[]}}),yc=class{types;constructor(){this.types=new Map(Object.entries(vc).map(([e,t])=>[e,{extensions:[...t.extensions],globs:[...t.globs]}]))}addType(e){let t=e.indexOf(`:`);if(t===-1)return;let n=e.slice(0,t),r=e.slice(t+1);if(r.startsWith(`include:`)){let e=r.slice(8),t=this.types.get(e);if(t){let e=this.types.get(n)||{extensions:[],globs:[]};e.extensions.push(...t.extensions),e.globs.push(...t.globs),this.types.set(n,e)}}else{let e=this.types.get(n)||{extensions:[],globs:[]};if(r.startsWith(`*.`)&&!r.slice(2).includes(`*`)){let t=r.slice(1);e.extensions.includes(t)||e.extensions.push(t)}else e.globs.includes(r)||e.globs.push(r);this.types.set(n,e)}}clearType(e){let t=this.types.get(e);t&&(t.extensions=[],t.globs=[])}getType(e){return this.types.get(e)}getAllTypes(){return this.types}matchesType(e,t){let n=e.toLowerCase();for(let r of t){if(r===`all`){if(this.matchesAnyType(e))return!0;continue}let t=this.types.get(r);if(t){for(let e of t.extensions)if(n.endsWith(e))return!0;for(let r of t.globs)if(r.includes(`*`)){if(z(`^${r.replace(/\./g,`\\.`).replace(/\*/g,`.*`)}$`,`i`).test(e))return!0}else if(n===r.toLowerCase())return!0}}return!1}matchesAnyType(e){let t=e.toLowerCase();for(let n of this.types.values()){for(let e of n.extensions)if(t.endsWith(e))return!0;for(let r of n.globs)if(r.includes(`*`)){if(z(`^${r.replace(/\./g,`\\.`).replace(/\*/g,`.*`)}$`,`i`).test(e))return!0}else if(t===r.toLowerCase())return!0}return!1}}});function xc(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:`--`,quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:`path`,json:!1,globs:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}var Sc=S(()=>{});function Cc(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||``).toUpperCase()){case`K`:return n*1024;case`M`:return n*1024*1024;case`G`:return n*1024*1024*1024;default:return n}}function wc(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:``,stderr:`rg: invalid --max-filesize value: ${e}
276
+ `,exitCode:1}}function Tc(e){return null}function Ec(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function Dc(e,t,n){let r=e[t];for(let i of Pc){if(r.startsWith(`--${i.long}=`)){let e=kc(n,i,r.slice(`--${i.long}=`.length));return e?{newIndex:t,error:e}:{newIndex:t}}if(i.short&&r.startsWith(`-${i.short}`)&&r.length>2){let e=kc(n,i,r.slice(2));return e?{newIndex:t,error:e}:{newIndex:t}}if(i.short&&r===`-${i.short}`||r===`--${i.long}`){if(t+1>=e.length)return null;let r=e[t+1],a=kc(n,i,r);return a?{newIndex:t+1,error:a}:{newIndex:t+1}}}return null}function Oc(e){return Pc.find(t=>t.short===e)}function kc(e,t,n){if(t.validate){let e=t.validate(n);if(e)return e}let r=t.parse?t.parse(n):n;t.multi?e[t.target].push(r):e[t.target]=r}function Ac(e,t){let n=e[t];if(n===`--sort`&&t+1<e.length){let n=e[t+1];if(n===`path`||n===`none`)return{value:n,newIndex:t+1}}if(n.startsWith(`--sort=`)){let e=n.slice(7);if(e===`path`||e===`none`)return{value:e,newIndex:t}}return null}function jc(e,t){let n=e[t],r=n.match(/^-([ABC])(\d+)$/);return r?{flag:r[1],value:parseInt(r[2],10),newIndex:t}:(n===`-A`||n===`-B`||n===`-C`)&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function Mc(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function Nc(e){let t=xc(),n=null,r=[],i=-1,a=-1,o=-1,s=!1;for(let c=0;c<e.length;c++){let l=e[c];if(l.startsWith(`-`)&&l!==`-`){let n=jc(e,c);if(n){let{flag:e,value:t,newIndex:r}=n;e===`A`?i=Math.max(i,t):e===`B`?a=Math.max(a,t):o=t,c=r;continue}let r=Mc(l);if(r!==null){t.maxCount=r;continue}let u=Dc(e,c,t);if(u){if(u.error)return{success:!1,error:u.error};c=u.newIndex;continue}let d=Ac(e,c);if(d){t.sort=d.value,c=d.newIndex;continue}let f=l.startsWith(`--`)?[l]:l.slice(1).split(``);for(let n of f){if(Ic.has(n)){t.lineNumber=!0,s=!0;continue}if(n===`u`||n===`--unrestricted`){Ec(t);continue}if(n===`P`||n===`--pcre2`)return{success:!1,error:{stdout:``,stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
277
+ `,exitCode:1}};if(n.length===1){let r=Oc(n);if(r){if(c+1>=e.length)return{success:!1,error:D(`rg`,`-${n}`)};let i=kc(t,r,e[c+1]);if(i)return{success:!1,error:i};c++;continue}}let r=Fc.get(n);if(r){r(t);continue}if(n.startsWith(`--`))return{success:!1,error:D(`rg`,n)};if(n.length===1)return{success:!1,error:D(`rg`,`-${n}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=l:r.push(l)}return(i>=0||o>=0)&&(t.afterContext=Math.max(i>=0?i:0,o>=0?o:0)),(a>=0||o>=0)&&(t.beforeContext=Math.max(a>=0?a:0,o>=0?o:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(s=!0),{success:!0,options:t,paths:r,explicitLineNumbers:s}}var Pc,Fc,Ic,Lc=S(()=>{O(),Sc(),Pc=[{short:`g`,long:`glob`,target:`globs`,multi:!0},{long:`iglob`,target:`iglobs`,multi:!0},{short:`t`,long:`type`,target:`types`,multi:!0,validate:Tc},{short:`T`,long:`type-not`,target:`typesNot`,multi:!0,validate:Tc},{long:`type-add`,target:`typeAdd`,multi:!0},{long:`type-clear`,target:`typeClear`,multi:!0},{short:`m`,long:`max-count`,target:`maxCount`,parse:parseInt},{short:`e`,long:`regexp`,target:`patterns`,multi:!0},{short:`f`,long:`file`,target:`patternFiles`,multi:!0},{short:`r`,long:`replace`,target:`replace`},{short:`d`,long:`max-depth`,target:`maxDepth`,parse:parseInt},{long:`max-filesize`,target:`maxFilesize`,parse:Cc,validate:wc},{long:`context-separator`,target:`contextSeparator`},{short:`j`,long:`threads`,target:`maxDepth`,parse:()=>1/0},{long:`ignore-file`,target:`ignoreFiles`,multi:!0},{long:`pre`,target:`preprocessor`},{long:`pre-glob`,target:`preprocessorGlobs`,multi:!0}],Fc=new Map([[`i`,e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],[`--ignore-case`,e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1}],[`s`,e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],[`--case-sensitive`,e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1}],[`S`,e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],[`--smart-case`,e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1}],[`F`,e=>{e.fixedStrings=!0}],[`--fixed-strings`,e=>{e.fixedStrings=!0}],[`w`,e=>{e.wordRegexp=!0}],[`--word-regexp`,e=>{e.wordRegexp=!0}],[`x`,e=>{e.lineRegexp=!0}],[`--line-regexp`,e=>{e.lineRegexp=!0}],[`v`,e=>{e.invertMatch=!0}],[`--invert-match`,e=>{e.invertMatch=!0}],[`U`,e=>{e.multiline=!0}],[`--multiline`,e=>{e.multiline=!0}],[`--multiline-dotall`,e=>{e.multilineDotall=!0,e.multiline=!0}],[`c`,e=>{e.count=!0}],[`--count`,e=>{e.count=!0}],[`--count-matches`,e=>{e.countMatches=!0}],[`l`,e=>{e.filesWithMatches=!0}],[`--files`,e=>{e.files=!0}],[`--files-with-matches`,e=>{e.filesWithMatches=!0}],[`--files-without-match`,e=>{e.filesWithoutMatch=!0}],[`--stats`,e=>{e.stats=!0}],[`o`,e=>{e.onlyMatching=!0}],[`--only-matching`,e=>{e.onlyMatching=!0}],[`q`,e=>{e.quiet=!0}],[`--quiet`,e=>{e.quiet=!0}],[`N`,e=>{e.lineNumber=!1}],[`--no-line-number`,e=>{e.lineNumber=!1}],[`H`,e=>{e.withFilename=!0}],[`--with-filename`,e=>{e.withFilename=!0}],[`I`,e=>{e.noFilename=!0}],[`--no-filename`,e=>{e.noFilename=!0}],[`0`,e=>{e.nullSeparator=!0}],[`--null`,e=>{e.nullSeparator=!0}],[`b`,e=>{e.byteOffset=!0}],[`--byte-offset`,e=>{e.byteOffset=!0}],[`--column`,e=>{e.column=!0,e.lineNumber=!0}],[`--no-column`,e=>{e.column=!1}],[`--vimgrep`,e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0}],[`--json`,e=>{e.json=!0}],[`--hidden`,e=>{e.hidden=!0}],[`--no-ignore`,e=>{e.noIgnore=!0}],[`--no-ignore-dot`,e=>{e.noIgnoreDot=!0}],[`--no-ignore-vcs`,e=>{e.noIgnoreVcs=!0}],[`L`,e=>{e.followSymlinks=!0}],[`--follow`,e=>{e.followSymlinks=!0}],[`z`,e=>{e.searchZip=!0}],[`--search-zip`,e=>{e.searchZip=!0}],[`a`,e=>{e.searchBinary=!0}],[`--text`,e=>{e.searchBinary=!0}],[`--heading`,e=>{e.heading=!0}],[`--passthru`,e=>{e.passthru=!0}],[`--include-zero`,e=>{e.includeZero=!0}],[`--glob-case-insensitive`,e=>{e.globCaseInsensitive=!0}]]),Ic=new Set([`n`,`--line-number`])});function Rc(e){return`'${e.replace(/'/g,`'\\''`)}'`}function zc(e){return e.map(Rc).join(` `)}var Bc=S(()=>{});async function Vc(e,t,n=!1,r=!1,i=[]){let a=new Uc(e,t,n,r);await a.load(t);for(let n of i)try{let r=e.resolvePath(t,n),i=await e.readFile(r);a.addPatternsFromContent(i,t)}catch{}return a}var Hc,Uc,Wc=S(()=>{xs(),Hc=class{patterns=[];basePath;constructor(e=`/`){this.basePath=e}parse(e){let t=e.split(`
278
+ `);for(let e of t){let t=e.replace(/\s+$/,``);if(!t||t.startsWith(`#`))continue;let n=!1;t.startsWith(`!`)&&(n=!0,t=t.slice(1));let r=!1;t.endsWith(`/`)&&(r=!0,t=t.slice(0,-1));let i=!1;t.startsWith(`/`)?(i=!0,t=t.slice(1)):t.includes(`/`)&&!t.startsWith(`**/`)&&(i=!0);let a=this.patternToRegex(t,i);this.patterns.push({pattern:e,regex:a,negated:n,directoryOnly:r,rooted:i})}}patternToRegex(e,t){let n=``;n=t?`^`:`(?:^|/)`;let r=0;for(;r<e.length;){let t=e[r];if(t===`*`)e[r+1]===`*`?e[r+2]===`/`?(n+=`(?:.*/)?`,r+=3):(r+2,e.length,n+=`.*`,r+=2):(n+=`[^/]*`,r++);else if(t===`?`)n+=`[^/]`,r++;else if(t===`[`){let t=r+1;for(t<e.length&&e[t]===`!`&&t++,t<e.length&&e[t]===`]`&&t++;t<e.length&&e[t]!==`]`;)t++;if(t<e.length){let i=e.slice(r,t+1);i.startsWith(`[!`)&&(i=`[^${i.slice(2)}`),n+=i,r=t+1}else n+=`\\[`,r++}else t===`/`?(n+=`/`,r++):(n+=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r++)}return n+=`(?:/.*)?$`,z(n)}matches(e,t){let n=e.replace(/^\.\//,``);n=n.replace(/^\//,``);let r=!1;for(let e of this.patterns)e.directoryOnly&&!t||e.regex.test(n)&&(r=!e.negated);return r}isWhitelisted(e,t){let n=e.replace(/^\.\//,``);n=n.replace(/^\//,``);for(let e of this.patterns)if(!(e.directoryOnly&&!t)&&e.negated&&e.regex.test(n))return!0;return!1}getBasePath(){return this.basePath}},Uc=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(e,t,n=!1,r=!1){this.fs=e,this.skipDotIgnore=n,this.skipVcsIgnore=r}async load(e){let t=[],n=e;for(;;){t.unshift(n);let e=this.fs.resolvePath(n,`..`);if(e===n)break;n=e}let r=[];this.skipVcsIgnore||r.push(`.gitignore`),this.skipDotIgnore||r.push(`.rgignore`,`.ignore`);for(let e of t){this.loadedDirs.add(e);for(let t of r){let n=this.fs.resolvePath(e,t);try{let t=await this.fs.readFile(n),r=new Hc(e);r.parse(t),this.parsers.push(r)}catch{}}}}async loadForDirectory(e){if(this.loadedDirs.has(e))return;this.loadedDirs.add(e);let t=[];this.skipVcsIgnore||t.push(`.gitignore`),this.skipDotIgnore||t.push(`.rgignore`,`.ignore`);for(let n of t){let t=this.fs.resolvePath(e,n);try{let n=await this.fs.readFile(t),r=new Hc(e);r.parse(n),this.parsers.push(r)}catch{}}}addPatternsFromContent(e,t){let n=new Hc(t);n.parse(e),this.parsers.push(n)}matches(e,t){for(let n of this.parsers){let r=n.getBasePath();if(!e.startsWith(r))continue;let i=e.slice(r.length).replace(/^\//,``);if(n.matches(i,t))return!0}return!1}isWhitelisted(e,t){for(let n of this.parsers){let r=n.getBasePath();if(!e.startsWith(r))continue;let i=e.slice(r.length).replace(/^\//,``);if(n.isWhitelisted(i,t))return!0}return!1}static isCommonIgnored(e){return new Set([`node_modules`,`.git`,`.svn`,`.hg`,`__pycache__`,`.pytest_cache`,`.mypy_cache`,`venv`,`.venv`,`.next`,`.nuxt`,`.cargo`]).has(e)}}});function Gc(e){return e.length>=2&&e[0]===31&&e[1]===139}function Kc(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r===`[`&&!t?t=!0:r===`]`&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function qc(e){let{ctx:t,options:n,paths:r,explicitLineNumbers:i}=e;for(let e of n.globs){let t=Kc(e.startsWith(`!`)?e.slice(1):e);if(t)return{stdout:``,stderr:`${t}
279
+ `,exitCode:1}}if(n.files)return el(t,[...n.patterns,...r],n);let a=[...n.patterns];for(let e of n.patternFiles)try{let n;if(e===`-`)n=t.stdin;else{let r=t.fs.resolvePath(t.cwd,e);n=await t.fs.readFile(r)}let r=n.split(`
280
280
  `).filter(e=>e.length>0);a.push(...r)}catch{return{stdout:``,stderr:`rg: ${e}: No such file or directory
281
281
  `,exitCode:2}}if(a.length===0)return n.patternFiles.length>0?{stdout:``,stderr:``,exitCode:1}:{stdout:``,stderr:`rg: no pattern given
282
- `,exitCode:2};let o=r.length===0?[`.`]:r,s=Yc(n,a),c,l;try{let e=Xc(a,n,s);c=e.regex,l=e.kResetGroup}catch{return{stdout:``,stderr:`rg: invalid regex: ${a.join(`, `)}
283
- `,exitCode:2}}let u=null;n.noIgnore||(u=await Hc(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new bc;for(let e of n.typeClear)d.clearType(e);for(let e of n.typeAdd)d.addType(e);let{files:f,singleExplicitFile:p}=await Zc(t,o,n,u,d);if(f.length===0)return{stdout:``,stderr:``,exitCode:1};let m=!n.noFilename&&(n.withFilename||!p||f.length>1),h=n.lineNumber;return i||(p&&f.length===1&&(h=!1),n.onlyMatching&&(h=!1)),il(t,f,c,n,m,h,l)}function Yc(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(e=>/[A-Z]/.test(e)):!1}function Xc(e,t,n){let r;return r=e.length===1?e[0]:e.map(e=>t.fixedStrings?e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`):`(?:${e})`).join(`|`),Ns(r,{mode:t.fixedStrings&&e.length===1?`fixed`:`perl`,ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function Zc(e,t,n,r,i){let a=[],o=0,s=0;for(let c of t){let t=e.fs.resolvePath(e.cwd,c);try{let l=await e.fs.stat(t);if(l.isFile){if(o++,n.maxFilesize>0&&l.size>n.maxFilesize)continue;$c(c,n,r,t,i)&&a.push(c)}else l.isDirectory&&(s++,await Qc(e,c,t,0,n,r,i,a))}catch{}}return{files:n.sort===`path`?a.sort():a,singleExplicitFile:o===1&&s===0}}async function Qc(e,t,n,r,i,a,o,s){if(!(r>=i.maxDepth)){a&&await a.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(e=>({name:e,isFile:void 0}));for(let l of c){let c=l.name;if(!i.noIgnore&&Wc.isCommonIgnored(c))continue;let u=c.startsWith(`.`),d=t===`.`?c:t===`./`?`./${c}`:t.endsWith(`/`)?`${t}${c}`:`${t}/${c}`,f=e.fs.resolvePath(n,c),p,m,h=!1;if(l.isFile!==void 0&&`isDirectory`in l){let t=l;if(h=t.isSymbolicLink===!0,h&&!i.followSymlinks)continue;if(h&&i.followSymlinks)try{let t=await e.fs.stat(f);p=t.isFile,m=t.isDirectory}catch{continue}else p=t.isFile,m=t.isDirectory}else try{let t=e.fs.lstat?await e.fs.lstat(f):await e.fs.stat(f);if(h=t.isSymbolicLink===!0,h&&!i.followSymlinks)continue;let n=h&&i.followSymlinks?await e.fs.stat(f):t;p=n.isFile,m=n.isDirectory}catch{continue}if(!a?.matches(f,m)&&!(u&&!i.hidden&&!a?.isWhitelisted(f,m))){if(m)await Qc(e,d,f,r+1,i,a,o,s);else if(p){if(i.maxFilesize>0)try{if((await e.fs.stat(f)).size>i.maxFilesize)continue}catch{continue}$c(d,i,a,f,o)&&s.push(d)}}}}catch{}}}function $c(e,t,n,r,i){let a=e.split(`/`).pop()||e;if(n?.matches(r,!1)||t.types.length>0&&!i.matchesType(a,t.types)||t.typesNot.length>0&&i.matchesType(a,t.typesNot))return!1;if(t.globs.length>0){let n=t.globCaseInsensitive,r=t.globs.filter(e=>!e.startsWith(`!`)),i=t.globs.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1));if(r.length>0){let t=!1;for(let i of r)if(el(a,i,n)||el(e,i,n)){t=!0;break}if(!t)return!1}for(let t of i)if(t.startsWith(`/`)){if(el(e,t.slice(1),n))return!1}else if(el(a,t,n)||el(e,t,n))return!1}if(t.iglobs.length>0){let n=t.iglobs.filter(e=>!e.startsWith(`!`)),r=t.iglobs.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1));if(n.length>0){let t=!1;for(let r of n)if(el(a,r,!0)||el(e,r,!0)){t=!0;break}if(!t)return!1}for(let t of r)if(t.startsWith(`/`)){if(el(e,t.slice(1),!0))return!1}else if(el(a,t,!0)||el(e,t,!0))return!1}return!0}function el(e,t,n=!1){let r=`^`;for(let e=0;e<t.length;e++){let n=t[e];if(n===`*`)t[e+1]===`*`?(r+=`.*`,e++):r+=`[^/]*`;else if(n===`?`)r+=`[^/]`;else if(n===`[`){let n=e+1;for(n<t.length&&t[n]===`!`&&n++,n<t.length&&t[n]===`]`&&n++;n<t.length&&t[n]!==`]`;)n++;if(n<t.length){let i=t.slice(e,n+1);i.startsWith(`[!`)&&(i=`[^${i.slice(2)}`),r+=i,e=n}else r+=`\\[`}else r+=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}return r+=`$`,R(r,n?`i`:``).test(e)}async function tl(e,t,n){let r=null;n.noIgnore||(r=await Hc(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let i=new bc;for(let e of n.typeClear)i.clearType(e);for(let e of n.typeAdd)i.addType(e);let{files:a}=await Zc(e,t.length===0?[`.`]:t,n,r,i);if(a.length===0)return{stdout:``,stderr:``,exitCode:1};if(n.quiet)return{stdout:``,stderr:``,exitCode:0};let o=n.nullSeparator?`\0`:`
284
- `;return{stdout:a.map(e=>e+o).join(``),stderr:``,exitCode:0}}function nl(e,t){if(t.length===0)return!0;for(let n of t)if(el(e,n,!1))return!0;return!1}async function rl(e,t,n,r){try{if(r.preprocessor&&e.exec&&nl(n.split(`/`).pop()||n,r.preprocessorGlobs)){let n=await e.exec(Bc([r.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(n.exitCode===0&&n.stdout){let e=n.stdout.slice(0,8192);return{content:n.stdout,isBinary:e.includes(`\0`)}}}if(r.searchZip&&n.endsWith(`.gz`)){let n=await e.fs.readFileBuffer(t);if(Kc(n))try{let e=vt(n),t=new TextDecoder().decode(e);return{content:t,isBinary:t.slice(0,8192).includes(`\0`)}}catch{return null}}let i=await e.fs.readFile(t);return{content:i,isBinary:i.slice(0,8192).includes(`\0`)}}catch{return null}}async function il(e,t,n,r,i,a,o){let s=``,c=!1,l=[],u=0,d=0,f=0;e:for(let p=0;p<t.length;p+=50){let m=t.slice(p,p+50),h=await Promise.all(m.map(async t=>{let s=await rl(e,e.fs.resolvePath(e.cwd,t),t,r);if(!s)return null;let{content:c,isBinary:l}=s;if(f+=c.length,l&&!r.searchBinary)return null;let u=i&&!r.heading?t:``,d=ks(c,n,{invertMatch:r.invertMatch,showLineNumbers:a,countOnly:r.count,countMatches:r.countMatches,filename:u,onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace===null?null:Us(r.replace),passthru:r.passthru,multiline:r.multiline,kResetGroup:o});return r.json&&d.matched?{file:t,result:d,content:c,isBinary:!1}:{file:t,result:d}}));for(let e of h){if(!e)continue;let{file:t,result:i}=e;if(i.matched){if(c=!0,d++,u+=i.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let a=e.content||``;l.push(JSON.stringify({type:`begin`,data:{path:{text:t}}}));let o=a.split(`
282
+ `,exitCode:2};let o=r.length===0?[`.`]:r,s=Jc(n,a),c,l;try{let e=Yc(a,n,s);c=e.regex,l=e.kResetGroup}catch{return{stdout:``,stderr:`rg: invalid regex: ${a.join(`, `)}
283
+ `,exitCode:2}}let u=null;n.noIgnore||(u=await Vc(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new yc;for(let e of n.typeClear)d.clearType(e);for(let e of n.typeAdd)d.addType(e);let{files:f,singleExplicitFile:p}=await Xc(t,o,n,u,d);if(f.length===0)return{stdout:``,stderr:``,exitCode:1};let m=!n.noFilename&&(n.withFilename||!p||f.length>1),h=n.lineNumber;return i||(p&&f.length===1&&(h=!1),n.onlyMatching&&(h=!1)),rl(t,f,c,n,m,h,l)}function Jc(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(e=>/[A-Z]/.test(e)):!1}function Yc(e,t,n){let r;return r=e.length===1?e[0]:e.map(e=>t.fixedStrings?e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`):`(?:${e})`).join(`|`),Ms(r,{mode:t.fixedStrings&&e.length===1?`fixed`:`perl`,ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function Xc(e,t,n,r,i){let a=[],o=0,s=0;for(let c of t){let t=e.fs.resolvePath(e.cwd,c);try{let l=await e.fs.stat(t);if(l.isFile){if(o++,n.maxFilesize>0&&l.size>n.maxFilesize)continue;Qc(c,n,r,t,i)&&a.push(c)}else l.isDirectory&&(s++,await Zc(e,c,t,0,n,r,i,a))}catch{}}return{files:n.sort===`path`?a.sort():a,singleExplicitFile:o===1&&s===0}}async function Zc(e,t,n,r,i,a,o,s){if(!(r>=i.maxDepth)){a&&await a.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(e=>({name:e,isFile:void 0}));for(let l of c){let c=l.name;if(!i.noIgnore&&Uc.isCommonIgnored(c))continue;let u=c.startsWith(`.`),d=t===`.`?c:t===`./`?`./${c}`:t.endsWith(`/`)?`${t}${c}`:`${t}/${c}`,f=e.fs.resolvePath(n,c),p,m,h=!1;if(l.isFile!==void 0&&`isDirectory`in l){let t=l;if(h=t.isSymbolicLink===!0,h&&!i.followSymlinks)continue;if(h&&i.followSymlinks)try{let t=await e.fs.stat(f);p=t.isFile,m=t.isDirectory}catch{continue}else p=t.isFile,m=t.isDirectory}else try{let t=e.fs.lstat?await e.fs.lstat(f):await e.fs.stat(f);if(h=t.isSymbolicLink===!0,h&&!i.followSymlinks)continue;let n=h&&i.followSymlinks?await e.fs.stat(f):t;p=n.isFile,m=n.isDirectory}catch{continue}if(!a?.matches(f,m)&&!(u&&!i.hidden&&!a?.isWhitelisted(f,m))){if(m)await Zc(e,d,f,r+1,i,a,o,s);else if(p){if(i.maxFilesize>0)try{if((await e.fs.stat(f)).size>i.maxFilesize)continue}catch{continue}Qc(d,i,a,f,o)&&s.push(d)}}}}catch{}}}function Qc(e,t,n,r,i){let a=e.split(`/`).pop()||e;if(n?.matches(r,!1)||t.types.length>0&&!i.matchesType(a,t.types)||t.typesNot.length>0&&i.matchesType(a,t.typesNot))return!1;if(t.globs.length>0){let n=t.globCaseInsensitive,r=t.globs.filter(e=>!e.startsWith(`!`)),i=t.globs.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1));if(r.length>0){let t=!1;for(let i of r)if($c(a,i,n)||$c(e,i,n)){t=!0;break}if(!t)return!1}for(let t of i)if(t.startsWith(`/`)){if($c(e,t.slice(1),n))return!1}else if($c(a,t,n)||$c(e,t,n))return!1}if(t.iglobs.length>0){let n=t.iglobs.filter(e=>!e.startsWith(`!`)),r=t.iglobs.filter(e=>e.startsWith(`!`)).map(e=>e.slice(1));if(n.length>0){let t=!1;for(let r of n)if($c(a,r,!0)||$c(e,r,!0)){t=!0;break}if(!t)return!1}for(let t of r)if(t.startsWith(`/`)){if($c(e,t.slice(1),!0))return!1}else if($c(a,t,!0)||$c(e,t,!0))return!1}return!0}function $c(e,t,n=!1){let r=`^`;for(let e=0;e<t.length;e++){let n=t[e];if(n===`*`)t[e+1]===`*`?(r+=`.*`,e++):r+=`[^/]*`;else if(n===`?`)r+=`[^/]`;else if(n===`[`){let n=e+1;for(n<t.length&&t[n]===`!`&&n++,n<t.length&&t[n]===`]`&&n++;n<t.length&&t[n]!==`]`;)n++;if(n<t.length){let i=t.slice(e,n+1);i.startsWith(`[!`)&&(i=`[^${i.slice(2)}`),r+=i,e=n}else r+=`\\[`}else r+=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}return r+=`$`,z(r,n?`i`:``).test(e)}async function el(e,t,n){let r=null;n.noIgnore||(r=await Vc(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let i=new yc;for(let e of n.typeClear)i.clearType(e);for(let e of n.typeAdd)i.addType(e);let{files:a}=await Xc(e,t.length===0?[`.`]:t,n,r,i);if(a.length===0)return{stdout:``,stderr:``,exitCode:1};if(n.quiet)return{stdout:``,stderr:``,exitCode:0};let o=n.nullSeparator?`\0`:`
284
+ `;return{stdout:a.map(e=>e+o).join(``),stderr:``,exitCode:0}}function tl(e,t){if(t.length===0)return!0;for(let n of t)if($c(e,n,!1))return!0;return!1}async function nl(e,t,n,r){try{if(r.preprocessor&&e.exec&&tl(n.split(`/`).pop()||n,r.preprocessorGlobs)){let n=await e.exec(zc([r.preprocessor]),{cwd:e.cwd,signal:e.signal,args:[t]});if(n.exitCode===0&&n.stdout){let e=n.stdout.slice(0,8192);return{content:n.stdout,isBinary:e.includes(`\0`)}}}if(r.searchZip&&n.endsWith(`.gz`)){let n=await e.fs.readFileBuffer(t);if(Gc(n))try{let e=vt(n),t=new TextDecoder().decode(e);return{content:t,isBinary:t.slice(0,8192).includes(`\0`)}}catch{return null}}let i=await e.fs.readFile(t);return{content:i,isBinary:i.slice(0,8192).includes(`\0`)}}catch{return null}}async function rl(e,t,n,r,i,a,o){let s=``,c=!1,l=[],u=0,d=0,f=0;e:for(let p=0;p<t.length;p+=50){let m=t.slice(p,p+50),h=await Promise.all(m.map(async t=>{let s=await nl(e,e.fs.resolvePath(e.cwd,t),t,r);if(!s)return null;let{content:c,isBinary:l}=s;if(f+=c.length,l&&!r.searchBinary)return null;let u=i&&!r.heading?t:``,d=Os(c,n,{invertMatch:r.invertMatch,showLineNumbers:a,countOnly:r.count,countMatches:r.countMatches,filename:u,onlyMatching:r.onlyMatching,beforeContext:r.beforeContext,afterContext:r.afterContext,maxCount:r.maxCount,contextSeparator:r.contextSeparator,showColumn:r.column,vimgrep:r.vimgrep,showByteOffset:r.byteOffset,replace:r.replace===null?null:Hs(r.replace),passthru:r.passthru,multiline:r.multiline,kResetGroup:o});return r.json&&d.matched?{file:t,result:d,content:c,isBinary:!1}:{file:t,result:d}}));for(let e of h){if(!e)continue;let{file:t,result:i}=e;if(i.matched){if(c=!0,d++,u+=i.matchCount,r.quiet&&!r.json)break e;if(r.json&&!r.quiet){let a=e.content||``;l.push(JSON.stringify({type:`begin`,data:{path:{text:t}}}));let o=a.split(`
285
285
  `);n.lastIndex=0;let s=0;for(let e=0;e<o.length;e++){let i=o[e];n.lastIndex=0;let a=[];for(let e=n.exec(i);e!==null;e=n.exec(i)){let t={match:{text:e[0]},start:e.index,end:e.index+e[0].length};r.replace!==null&&(t.replacement={text:r.replace}),a.push(t),e[0].length===0&&n.lastIndex++}if(a.length>0){let n={type:`match`,data:{path:{text:t},lines:{text:`${i}
286
286
  `},line_number:e+1,absolute_offset:s,submatches:a}};l.push(JSON.stringify(n))}s+=i.length+1}l.push(JSON.stringify({type:`end`,data:{path:{text:t},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:`0s`},searches:1,searches_with_match:1,bytes_searched:a.length,bytes_printed:0,matched_lines:i.matchCount,matches:i.matchCount}}}))}else if(r.filesWithMatches){let e=r.nullSeparator?`\0`:`
287
287
  `;s+=`${t}${e}`}else r.filesWithoutMatch||(r.heading&&!r.noFilename&&(s+=`${t}
@@ -290,7 +290,7 @@ Options:
290
290
  `)}
291
291
  `);let p=r.quiet&&!r.json?``:s;if(r.stats&&!r.json){let e=[``,`${u} matches`,`${u} matched lines`,`${d} files contained matches`,`${t.length} files searched`,`${f} bytes searched`].join(`
292
292
  `);p+=`${e}
293
- `}let m;return m=r.filesWithoutMatch?s.length>0?0:1:+!c,{stdout:p,stderr:``,exitCode:m}}var al=S(()=>{Vc(),Ss(),qs(),xc(),Gc()}),ol={};C(ol,{flagsForFuzzing:()=>ll,rgCommand:()=>cl});var sl,cl,ll,ul=S(()=>{O(),xc(),Rc(),al(),sl={name:`rg`,summary:`recursively search for a pattern`,usage:`rg [OPTIONS] PATTERN [PATH ...]`,description:`rg (ripgrep) recursively searches directories for a regex pattern.
293
+ `}let m;return m=r.filesWithoutMatch?s.length>0?0:1:+!c,{stdout:p,stderr:``,exitCode:m}}var il=S(()=>{Bc(),xs(),Ks(),bc(),Wc()}),al={};C(al,{flagsForFuzzing:()=>cl,rgCommand:()=>sl});var ol,sl,cl,ll=S(()=>{O(),bc(),Lc(),il(),ol={name:`rg`,summary:`recursively search for a pattern`,usage:`rg [OPTIONS] PATTERN [PATH ...]`,description:`rg (ripgrep) recursively searches directories for a regex pattern.
294
294
  Unlike grep, rg is recursive by default and respects .gitignore files.
295
295
 
296
296
  EXAMPLES:
@@ -301,51 +301,51 @@ EXAMPLES:
301
301
  rg -t js foo Search only JavaScript files
302
302
  rg -g '*.ts' foo Search files matching glob
303
303
  rg --hidden foo Include hidden files
304
- rg -l foo List files with matches only`,options:[`-e, --regexp PATTERN search for PATTERN (can be used multiple times)`,`-f, --file FILE read patterns from FILE, one per line`,`-i, --ignore-case case-insensitive search`,`-s, --case-sensitive case-sensitive search (overrides smart-case)`,`-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)`,`-F, --fixed-strings treat pattern as literal string`,`-w, --word-regexp match whole words only`,`-x, --line-regexp match whole lines only`,`-v, --invert-match select non-matching lines`,`-r, --replace TEXT replace matches with TEXT`,`-c, --count print count of matching lines per file`,` --count-matches print count of individual matches per file`,`-l, --files-with-matches print only file names with matches`,` --files-without-match print file names without matches`,` --files list files that would be searched`,`-o, --only-matching print only matching parts`,`-m, --max-count NUM stop after NUM matches per file`,`-q, --quiet suppress output, exit 0 on match`,` --stats print search statistics`,`-n, --line-number print line numbers (default: on)`,`-N, --no-line-number do not print line numbers`,`-I, --no-filename suppress the prefixing of file names`,`-0, --null use NUL as filename separator`,`-b, --byte-offset show byte offset of each match`,` --column show column number of first match`,` --vimgrep show results in vimgrep format`,` --json show results in JSON Lines format`,`-A NUM print NUM lines after each match`,`-B NUM print NUM lines before each match`,`-C NUM print NUM lines before and after each match`,` --context-separator SEP separator for context groups (default: --)`,`-U, --multiline match patterns across lines`,`-z, --search-zip search in compressed files (gzip only)`,`-g, --glob GLOB include files matching GLOB`,`-t, --type TYPE only search files of TYPE (e.g., js, py, ts)`,`-T, --type-not TYPE exclude files of TYPE`,`-L, --follow follow symbolic links`,`-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)`,`-a, --text search binary files as text`,` --hidden search hidden files and directories`,` --no-ignore don't respect .gitignore/.ignore files`,`-d, --max-depth NUM maximum search depth`,` --sort TYPE sort files (path, none)`,` --heading show file path above matches`,` --passthru print all lines (non-matches use - separator)`,` --include-zero include files with 0 matches in count output`,` --type-list list all available file types`,` --help display this help and exit`]},cl={name:`rg`,async execute(e,t){if(E(e))return T(sl);if(e.includes(`--type-list`))return{stdout:vc(),stderr:``,exitCode:0};let n=Pc(e);return n.success?Jc({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},ll={name:`rg`,flags:[{flag:`-i`,type:`boolean`},{flag:`-s`,type:`boolean`},{flag:`-S`,type:`boolean`},{flag:`-F`,type:`boolean`},{flag:`-w`,type:`boolean`},{flag:`-x`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-o`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-N`,type:`boolean`},{flag:`--hidden`,type:`boolean`},{flag:`--no-ignore`,type:`boolean`},{flag:`-m`,type:`value`,valueHint:`number`},{flag:`-A`,type:`value`,valueHint:`number`},{flag:`-B`,type:`value`,valueHint:`number`},{flag:`-C`,type:`value`,valueHint:`number`},{flag:`-g`,type:`value`,valueHint:`pattern`},{flag:`-t`,type:`value`,valueHint:`string`},{flag:`-T`,type:`value`,valueHint:`string`}],needsArgs:!0}});function dl(e,t,n){if(!e||rr.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new w(r,{timestamp:Date.now(),type:`missing_defense_context`,message:r,path:`DefenseInDepthBox.context`,stack:Error().stack,executionId:rr.getCurrentExecutionId()})}async function fl(e,t,n,r){dl(e,t,`${n} (pre-await)`);let i=await r();return dl(e,t,`${n} (post-await)`),i}var pl=S(()=>{ir()});function ml(e){let t=``,n=0,r=!1;for(;n<e.length;){if(e[n]===`[`&&!r){if(e[n+1]===`[`&&e[n+2]===`:`){let r=e.indexOf(`:]]`,n+3);if(r!==-1){let i=e.slice(n+3,r),a=_l.get(i);if(a){t+=`[${a}]`,n=r+3;continue}}}if(e[n+1]===`^`&&e[n+2]===`[`&&e[n+3]===`:`){let r=e.indexOf(`:]]`,n+4);if(r!==-1){let i=e.slice(n+4,r),a=_l.get(i);if(a){t+=`[^${a}]`,n=r+3;continue}}}t+=`[`,n++,r=!0,n<e.length&&e[n]===`^`&&(t+=`^`,n++),n<e.length&&e[n]===`]`&&(t+=`\\]`,n++);continue}if(r){if(e[n]===`]`){t+=`]`,n++,r=!1;continue}if(e[n]===`[`&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r),a=_l.get(i);if(a){t+=a,n=r+2;continue}}}if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]===`\\`&&n+1<e.length){let r=e[n+1];if(r===`+`||r===`?`||r===`|`){t+=r,n+=2;continue}if(r===`(`||r===`)`){t+=r,n+=2;continue}if(r===`{`||r===`}`){t+=r,n+=2;continue}if(r===`t`){t+=` `,n+=2;continue}if(r===`n`){t+=`
305
- `,n+=2;continue}if(r===`r`){t+=`\r`,n+=2;continue}t+=e[n]+r,n+=2;continue}if(e[n]===`+`||e[n]===`?`||e[n]===`|`||e[n]===`(`||e[n]===`)`){t+=`\\${e[n]}`,n++;continue}if(e[n]===`^`&&!(t===``||t.endsWith(`(`))){t+=`\\^`,n++;continue}if(e[n]===`$`){let r=n===e.length-1,i=n+2<e.length&&e[n+1]===`\\`&&e[n+2]===`)`;if(!r&&!i){t+=`\\$`,n++;continue}}t+=e[n],n++}return t}function hl(e){let t=``,n=!1;for(let r=0;r<e.length;r++)e[r]===`[`&&!n?(n=!0,t+=`[`,r++,r<e.length&&e[r]===`^`&&(t+=`^`,r++),r<e.length&&e[r]===`]`&&(t+=`]`,r++),r--):e[r]===`]`&&n?(n=!1,t+=`]`):!n&&e[r]===`{`&&e[r+1]===`,`?(t+=`{0,`,r++):t+=e[r];return t}function gl(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n],i=r.charCodeAt(0);r===`\\`?t+=`\\\\`:r===` `?t+=`\\t`:r===`
304
+ rg -l foo List files with matches only`,options:[`-e, --regexp PATTERN search for PATTERN (can be used multiple times)`,`-f, --file FILE read patterns from FILE, one per line`,`-i, --ignore-case case-insensitive search`,`-s, --case-sensitive case-sensitive search (overrides smart-case)`,`-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)`,`-F, --fixed-strings treat pattern as literal string`,`-w, --word-regexp match whole words only`,`-x, --line-regexp match whole lines only`,`-v, --invert-match select non-matching lines`,`-r, --replace TEXT replace matches with TEXT`,`-c, --count print count of matching lines per file`,` --count-matches print count of individual matches per file`,`-l, --files-with-matches print only file names with matches`,` --files-without-match print file names without matches`,` --files list files that would be searched`,`-o, --only-matching print only matching parts`,`-m, --max-count NUM stop after NUM matches per file`,`-q, --quiet suppress output, exit 0 on match`,` --stats print search statistics`,`-n, --line-number print line numbers (default: on)`,`-N, --no-line-number do not print line numbers`,`-I, --no-filename suppress the prefixing of file names`,`-0, --null use NUL as filename separator`,`-b, --byte-offset show byte offset of each match`,` --column show column number of first match`,` --vimgrep show results in vimgrep format`,` --json show results in JSON Lines format`,`-A NUM print NUM lines after each match`,`-B NUM print NUM lines before each match`,`-C NUM print NUM lines before and after each match`,` --context-separator SEP separator for context groups (default: --)`,`-U, --multiline match patterns across lines`,`-z, --search-zip search in compressed files (gzip only)`,`-g, --glob GLOB include files matching GLOB`,`-t, --type TYPE only search files of TYPE (e.g., js, py, ts)`,`-T, --type-not TYPE exclude files of TYPE`,`-L, --follow follow symbolic links`,`-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)`,`-a, --text search binary files as text`,` --hidden search hidden files and directories`,` --no-ignore don't respect .gitignore/.ignore files`,`-d, --max-depth NUM maximum search depth`,` --sort TYPE sort files (path, none)`,` --heading show file path above matches`,` --passthru print all lines (non-matches use - separator)`,` --include-zero include files with 0 matches in count output`,` --type-list list all available file types`,` --help display this help and exit`]},sl={name:`rg`,async execute(e,t){if(E(e))return T(ol);if(e.includes(`--type-list`))return{stdout:_c(),stderr:``,exitCode:0};let n=Nc(e);return n.success?qc({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},cl={name:`rg`,flags:[{flag:`-i`,type:`boolean`},{flag:`-s`,type:`boolean`},{flag:`-S`,type:`boolean`},{flag:`-F`,type:`boolean`},{flag:`-w`,type:`boolean`},{flag:`-x`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-o`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-N`,type:`boolean`},{flag:`--hidden`,type:`boolean`},{flag:`--no-ignore`,type:`boolean`},{flag:`-m`,type:`value`,valueHint:`number`},{flag:`-A`,type:`value`,valueHint:`number`},{flag:`-B`,type:`value`,valueHint:`number`},{flag:`-C`,type:`value`,valueHint:`number`},{flag:`-g`,type:`value`,valueHint:`pattern`},{flag:`-t`,type:`value`,valueHint:`string`},{flag:`-T`,type:`value`,valueHint:`string`}],needsArgs:!0}});function ul(e,t,n){if(!e||rr.isInSandboxedContext())return;let r=`${t} ${n} attempted outside defense context`;throw new w(r,{timestamp:Date.now(),type:`missing_defense_context`,message:r,path:`DefenseInDepthBox.context`,stack:Error().stack,executionId:rr.getCurrentExecutionId()})}async function dl(e,t,n,r){ul(e,t,`${n} (pre-await)`);let i=await r();return ul(e,t,`${n} (post-await)`),i}var fl=S(()=>{ir()});function pl(e){let t=``,n=0,r=!1;for(;n<e.length;){if(e[n]===`[`&&!r){if(e[n+1]===`[`&&e[n+2]===`:`){let r=e.indexOf(`:]]`,n+3);if(r!==-1){let i=e.slice(n+3,r),a=gl.get(i);if(a){t+=`[${a}]`,n=r+3;continue}}}if(e[n+1]===`^`&&e[n+2]===`[`&&e[n+3]===`:`){let r=e.indexOf(`:]]`,n+4);if(r!==-1){let i=e.slice(n+4,r),a=gl.get(i);if(a){t+=`[^${a}]`,n=r+3;continue}}}t+=`[`,n++,r=!0,n<e.length&&e[n]===`^`&&(t+=`^`,n++),n<e.length&&e[n]===`]`&&(t+=`\\]`,n++);continue}if(r){if(e[n]===`]`){t+=`]`,n++,r=!1;continue}if(e[n]===`[`&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r),a=gl.get(i);if(a){t+=a,n=r+2;continue}}}if(e[n]===`\\`&&n+1<e.length){t+=e[n]+e[n+1],n+=2;continue}t+=e[n],n++;continue}if(e[n]===`\\`&&n+1<e.length){let r=e[n+1];if(r===`+`||r===`?`||r===`|`){t+=r,n+=2;continue}if(r===`(`||r===`)`){t+=r,n+=2;continue}if(r===`{`||r===`}`){t+=r,n+=2;continue}if(r===`t`){t+=` `,n+=2;continue}if(r===`n`){t+=`
305
+ `,n+=2;continue}if(r===`r`){t+=`\r`,n+=2;continue}t+=e[n]+r,n+=2;continue}if(e[n]===`+`||e[n]===`?`||e[n]===`|`||e[n]===`(`||e[n]===`)`){t+=`\\${e[n]}`,n++;continue}if(e[n]===`^`&&!(t===``||t.endsWith(`(`))){t+=`\\^`,n++;continue}if(e[n]===`$`){let r=n===e.length-1,i=n+2<e.length&&e[n+1]===`\\`&&e[n+2]===`)`;if(!r&&!i){t+=`\\$`,n++;continue}}t+=e[n],n++}return t}function ml(e){let t=``,n=!1;for(let r=0;r<e.length;r++)e[r]===`[`&&!n?(n=!0,t+=`[`,r++,r<e.length&&e[r]===`^`&&(t+=`^`,r++),r<e.length&&e[r]===`]`&&(t+=`]`,r++),r--):e[r]===`]`&&n?(n=!1,t+=`]`):!n&&e[r]===`{`&&e[r+1]===`,`?(t+=`{0,`,r++):t+=e[r];return t}function hl(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n],i=r.charCodeAt(0);r===`\\`?t+=`\\\\`:r===` `?t+=`\\t`:r===`
306
306
  `?t+=`$
307
- `:r===`\r`?t+=`\\r`:r===`\x07`?t+=`\\a`:r===`\b`?t+=`\\b`:r===`\f`?t+=`\\f`:r===`\v`?t+=`\\v`:i<32||i>=127?t+=`\\${i.toString(8).padStart(3,`0`)}`:t+=r}return`${t}$`}var _l,vl=S(()=>{_l=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`]])});function yl(e,t,n){return{patternSpace:``,holdSpace:``,lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:n||new Map,linesConsumedInCycle:0}}function bl(e){return typeof e==`object`&&`first`in e&&`step`in e}function xl(e){return typeof e==`object`&&`offset`in e}function Sl(e,t,n,r,i){if(e===`$`)return t===n;if(typeof e==`number`)return t===e;if(bl(e)){let{first:n,step:r}=e;return r===0?t===n:(t-n)%r===0&&t>=n}if(typeof e==`object`&&`pattern`in e)try{let t=e.pattern;return t===``&&i?.lastPattern?t=i.lastPattern:t!==``&&i&&(i.lastPattern=t),R(hl(ml(t))).test(r)}catch{return!1}return!1}function Cl(e){let t=e=>e===void 0?`undefined`:e===`$`?`$`:typeof e==`number`?String(e):`pattern`in e?`/${e.pattern}/`:`first`in e?`${e.first}~${e.step}`:`unknown`;return`${t(e.start)},${t(e.end)}`}function wl(e,t,n,r,i,a){if(!e||!e.start&&!e.end)return!0;let o=e.start,s=e.end;if(o!==void 0&&s===void 0)return Sl(o,t,n,r,a);if(o!==void 0&&s!==void 0){let c=typeof o==`object`&&`pattern`in o,l=typeof s==`object`&&`pattern`in s,u=xl(s);if(u&&i){let c=Cl(e),l=i.get(c);return l||(l={active:!1},i.set(c,l)),l.active?(t>=(l.startLine||t)+s.offset&&(l.active=!1,i.set(c,l)),!0):Sl(o,t,n,r,a)?(l.active=!0,l.startLine=t,i.set(c,l),s.offset===0&&(l.active=!1,i.set(c,l)),!0):!1}if(!c&&!l&&!u){let r=typeof o==`number`?o:o===`$`?n:1,a=typeof s==`number`?s:n;if(r<=a)return t>=r&&t<=a;if(i){let n=Cl(e),a=i.get(n);return a||(a={active:!1},i.set(n,a)),!a.completed&&t>=r?(a.completed=!0,i.set(n,a),!0):!1}return!1}if(i){let c=Cl(e),l=i.get(c);if(l||(l={active:!1},i.set(c,l)),l.active)return Sl(s,t,n,r,a)&&(l.active=!1,typeof o==`number`&&(l.completed=!0),i.set(c,l)),!0;{if(l.completed)return!1;let e=!1;return e=typeof o==`number`?t>=o:Sl(o,t,n,r,a),e?(l.active=!0,l.startLine=t,i.set(c,l),Sl(s,t,n,r,a)&&(l.active=!1,typeof o==`number`&&(l.completed=!0),i.set(c,l)),!0):!1}}return Sl(o,t,n,r,a)}return!0}function Tl(e,t,n,r,i,a){let o=wl(e,t,n,r,i,a);return e?.negated?!o:o}function El(e,t,n,r){let i=``,a=0,o=!1;for(;a<=e.length;){t.lastIndex=a;let n=t.exec(e);if(!n){i+=e.slice(a);break}if(n.index!==a){i+=e.slice(a,n.index),a=n.index,o=!1;continue}let s=n[0],c=n.slice(1);if(o&&s.length===0){if(a<e.length)i+=e[a],a++;else break;o=!1;continue}if(i+=r(s,c),o=!1,s.length===0)if(a<e.length)i+=e[a],a++;else break;else a+=s.length,o=!0}return i}function Dl(e,t,n){let r=``,i=0;for(;i<e.length;){if(e[i]===`\\`&&i+1<e.length){let a=e[i+1];if(a===`&`){r+=`&`,i+=2;continue}if(a===`n`){r+=`
308
- `,i+=2;continue}if(a===`t`){r+=` `,i+=2;continue}if(a===`r`){r+=`\r`,i+=2;continue}let o=parseInt(a,10);if(o===0){r+=t,i+=2;continue}if(o>=1&&o<=9){r+=n[o-1]||``,i+=2;continue}r+=a,i+=2;continue}if(e[i]===`&`){r+=t,i++;continue}r+=e[i],i++}return r}function Ol(e,t,n){if(t>0&&e.length>t)throw new k(`sed: ${n} size limit exceeded (${t} bytes)`,`string_length`)}function kl(e,t,n){let{lineNumber:r,totalLines:i,patternSpace:a}=t;if(e.type===`label`){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(Tl(e.address,r,i,a,t.rangeStates,t))switch(t.coverage?.hit(`sed:cmd:${e.type}`),e.type){case`substitute`:{let n=e,r=``;n.global&&(r+=`g`),n.ignoreCase&&(r+=`i`);let i=n.pattern;i===``&&t.lastPattern?i=t.lastPattern:i!==``&&(t.lastPattern=i);let a=hl(n.extendedRegex?i:ml(i));try{let e=R(a,r),i=e.test(t.patternSpace);if(e.lastIndex=0,i){if(t.substitutionMade=!0,n.nthOccurrence&&n.nthOccurrence>0&&!n.global){let e=0,r=n.nthOccurrence;t.patternSpace=R(a,`g${n.ignoreCase?`i`:``}`).replace(t.patternSpace,(t,...i)=>{if(e++,e===r){let e=i.slice(0,-2);return Dl(n.replacement,t,e)}return t})}else if(n.global){let e=R(a,`g${n.ignoreCase?`i`:``}`);t.patternSpace=El(t.patternSpace,e,n.replacement,(e,t)=>Dl(n.replacement,e,t))}else t.patternSpace=e.replace(t.patternSpace,(e,...t)=>{let r=t.slice(0,-2);return Dl(n.replacement,e,r)});n.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case`print`:t.lineNumberOutput.push(t.patternSpace);break;case`printFirstLine`:{let e=t.patternSpace.indexOf(`
307
+ `:r===`\r`?t+=`\\r`:r===`\x07`?t+=`\\a`:r===`\b`?t+=`\\b`:r===`\f`?t+=`\\f`:r===`\v`?t+=`\\v`:i<32||i>=127?t+=`\\${i.toString(8).padStart(3,`0`)}`:t+=r}return`${t}$`}var gl,_l=S(()=>{gl=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`]])});function vl(e,t,n){return{patternSpace:``,holdSpace:``,lineNumber:0,totalLines:e,deleted:!1,printed:!1,quit:!1,quitSilent:!1,exitCode:void 0,errorMessage:void 0,appendBuffer:[],substitutionMade:!1,lineNumberOutput:[],nCommandOutput:[],restartCycle:!1,inDRestartedCycle:!1,currentFilename:t,pendingFileReads:[],pendingFileWrites:[],rangeStates:n||new Map,linesConsumedInCycle:0}}function yl(e){return typeof e==`object`&&`first`in e&&`step`in e}function bl(e){return typeof e==`object`&&`offset`in e}function xl(e,t,n,r,i){if(e===`$`)return t===n;if(typeof e==`number`)return t===e;if(yl(e)){let{first:n,step:r}=e;return r===0?t===n:(t-n)%r===0&&t>=n}if(typeof e==`object`&&`pattern`in e)try{let t=e.pattern;return t===``&&i?.lastPattern?t=i.lastPattern:t!==``&&i&&(i.lastPattern=t),z(ml(pl(t))).test(r)}catch{return!1}return!1}function Sl(e){let t=e=>e===void 0?`undefined`:e===`$`?`$`:typeof e==`number`?String(e):`pattern`in e?`/${e.pattern}/`:`first`in e?`${e.first}~${e.step}`:`unknown`;return`${t(e.start)},${t(e.end)}`}function Cl(e,t,n,r,i,a){if(!e||!e.start&&!e.end)return!0;let o=e.start,s=e.end;if(o!==void 0&&s===void 0)return xl(o,t,n,r,a);if(o!==void 0&&s!==void 0){let c=typeof o==`object`&&`pattern`in o,l=typeof s==`object`&&`pattern`in s,u=bl(s);if(u&&i){let c=Sl(e),l=i.get(c);return l||(l={active:!1},i.set(c,l)),l.active?(t>=(l.startLine||t)+s.offset&&(l.active=!1,i.set(c,l)),!0):xl(o,t,n,r,a)?(l.active=!0,l.startLine=t,i.set(c,l),s.offset===0&&(l.active=!1,i.set(c,l)),!0):!1}if(!c&&!l&&!u){let r=typeof o==`number`?o:o===`$`?n:1,a=typeof s==`number`?s:n;if(r<=a)return t>=r&&t<=a;if(i){let n=Sl(e),a=i.get(n);return a||(a={active:!1},i.set(n,a)),!a.completed&&t>=r?(a.completed=!0,i.set(n,a),!0):!1}return!1}if(i){let c=Sl(e),l=i.get(c);if(l||(l={active:!1},i.set(c,l)),l.active)return xl(s,t,n,r,a)&&(l.active=!1,typeof o==`number`&&(l.completed=!0),i.set(c,l)),!0;{if(l.completed)return!1;let e=!1;return e=typeof o==`number`?t>=o:xl(o,t,n,r,a),e?(l.active=!0,l.startLine=t,i.set(c,l),xl(s,t,n,r,a)&&(l.active=!1,typeof o==`number`&&(l.completed=!0),i.set(c,l)),!0):!1}}return xl(o,t,n,r,a)}return!0}function wl(e,t,n,r,i,a){let o=Cl(e,t,n,r,i,a);return e?.negated?!o:o}function Tl(e,t,n,r){let i=``,a=0,o=!1;for(;a<=e.length;){t.lastIndex=a;let n=t.exec(e);if(!n){i+=e.slice(a);break}if(n.index!==a){i+=e.slice(a,n.index),a=n.index,o=!1;continue}let s=n[0],c=n.slice(1);if(o&&s.length===0){if(a<e.length)i+=e[a],a++;else break;o=!1;continue}if(i+=r(s,c),o=!1,s.length===0)if(a<e.length)i+=e[a],a++;else break;else a+=s.length,o=!0}return i}function El(e,t,n){let r=``,i=0;for(;i<e.length;){if(e[i]===`\\`&&i+1<e.length){let a=e[i+1];if(a===`&`){r+=`&`,i+=2;continue}if(a===`n`){r+=`
308
+ `,i+=2;continue}if(a===`t`){r+=` `,i+=2;continue}if(a===`r`){r+=`\r`,i+=2;continue}let o=parseInt(a,10);if(o===0){r+=t,i+=2;continue}if(o>=1&&o<=9){r+=n[o-1]||``,i+=2;continue}r+=a,i+=2;continue}if(e[i]===`&`){r+=t,i++;continue}r+=e[i],i++}return r}function Dl(e,t,n){if(t>0&&e.length>t)throw new k(`sed: ${n} size limit exceeded (${t} bytes)`,`string_length`)}function Ol(e,t,n){let{lineNumber:r,totalLines:i,patternSpace:a}=t;if(e.type===`label`){t.coverage?.hit(`sed:cmd:${e.type}`);return}if(wl(e.address,r,i,a,t.rangeStates,t))switch(t.coverage?.hit(`sed:cmd:${e.type}`),e.type){case`substitute`:{let n=e,r=``;n.global&&(r+=`g`),n.ignoreCase&&(r+=`i`);let i=n.pattern;i===``&&t.lastPattern?i=t.lastPattern:i!==``&&(t.lastPattern=i);let a=ml(n.extendedRegex?i:pl(i));try{let e=z(a,r),i=e.test(t.patternSpace);if(e.lastIndex=0,i){if(t.substitutionMade=!0,n.nthOccurrence&&n.nthOccurrence>0&&!n.global){let e=0,r=n.nthOccurrence;t.patternSpace=z(a,`g${n.ignoreCase?`i`:``}`).replace(t.patternSpace,(t,...i)=>{if(e++,e===r){let e=i.slice(0,-2);return El(n.replacement,t,e)}return t})}else if(n.global){let e=z(a,`g${n.ignoreCase?`i`:``}`);t.patternSpace=Tl(t.patternSpace,e,n.replacement,(e,t)=>El(n.replacement,e,t))}else t.patternSpace=e.replace(t.patternSpace,(e,...t)=>{let r=t.slice(0,-2);return El(n.replacement,e,r)});n.printOnMatch&&t.lineNumberOutput.push(t.patternSpace)}}catch{}break}case`print`:t.lineNumberOutput.push(t.patternSpace);break;case`printFirstLine`:{let e=t.patternSpace.indexOf(`
309
309
  `);e===-1?t.lineNumberOutput.push(t.patternSpace):t.lineNumberOutput.push(t.patternSpace.slice(0,e));break}case`delete`:t.deleted=!0;break;case`deleteFirstLine`:{let e=t.patternSpace.indexOf(`
310
310
  `);e===-1?t.deleted=!0:(t.patternSpace=t.patternSpace.slice(e+1),t.restartCycle=!0,t.inDRestartedCycle=!0);break}case`zap`:t.patternSpace=``;break;case`append`:t.appendBuffer.push(e.text);break;case`insert`:t.appendBuffer.unshift(`__INSERT__${e.text}`);break;case`change`:t.deleted=!0,t.changedText=e.text;break;case`hold`:t.holdSpace=t.patternSpace;break;case`holdAppend`:t.holdSpace?t.holdSpace+=`
311
- ${t.patternSpace}`:t.holdSpace=t.patternSpace,Ol(t.holdSpace,n?.maxStringLength??0,`hold space`);break;case`get`:t.patternSpace=t.holdSpace;break;case`getAppend`:t.patternSpace+=`
312
- ${t.holdSpace}`,Ol(t.patternSpace,n?.maxStringLength??0,`pattern space`);break;case`exchange`:{let e=t.patternSpace;t.patternSpace=t.holdSpace,t.holdSpace=e;break}case`next`:t.printed=!0;break;case`quit`:t.quit=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case`quitSilent`:t.quit=!0,t.quitSilent=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case`list`:{let e=gl(t.patternSpace);t.lineNumberOutput.push(e);break}case`printFilename`:t.currentFilename&&t.lineNumberOutput.push(t.currentFilename);break;case`version`:{let n=[4,8,0];if(e.minVersion){let r=e.minVersion.split(`.`),i=[],a=!1;for(let n of r){let r=parseInt(n,10);if(Number.isNaN(r)||r<0){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: invalid version string: ${e.minVersion}`,a=!0;break}i.push(r)}if(!a){for(;i.length<3;)i.push(0);for(let r=0;r<3;r++){if(i[r]>n[r]){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: this is not GNU sed version ${e.minVersion}`;break}if(i[r]<n[r])break}}}break}case`readFile`:t.pendingFileReads.push({filename:e.filename,wholeFile:!0});break;case`readFileLine`:t.pendingFileReads.push({filename:e.filename,wholeFile:!1});break;case`writeFile`:t.pendingFileWrites.push({filename:e.filename,content:`${t.patternSpace}
311
+ ${t.patternSpace}`:t.holdSpace=t.patternSpace,Dl(t.holdSpace,n?.maxStringLength??0,`hold space`);break;case`get`:t.patternSpace=t.holdSpace;break;case`getAppend`:t.patternSpace+=`
312
+ ${t.holdSpace}`,Dl(t.patternSpace,n?.maxStringLength??0,`pattern space`);break;case`exchange`:{let e=t.patternSpace;t.patternSpace=t.holdSpace,t.holdSpace=e;break}case`next`:t.printed=!0;break;case`quit`:t.quit=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case`quitSilent`:t.quit=!0,t.quitSilent=!0,e.exitCode!==void 0&&(t.exitCode=e.exitCode);break;case`list`:{let e=hl(t.patternSpace);t.lineNumberOutput.push(e);break}case`printFilename`:t.currentFilename&&t.lineNumberOutput.push(t.currentFilename);break;case`version`:{let n=[4,8,0];if(e.minVersion){let r=e.minVersion.split(`.`),i=[],a=!1;for(let n of r){let r=parseInt(n,10);if(Number.isNaN(r)||r<0){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: invalid version string: ${e.minVersion}`,a=!0;break}i.push(r)}if(!a){for(;i.length<3;)i.push(0);for(let r=0;r<3;r++){if(i[r]>n[r]){t.quit=!0,t.exitCode=1,t.errorMessage=`sed: this is not GNU sed version ${e.minVersion}`;break}if(i[r]<n[r])break}}}break}case`readFile`:t.pendingFileReads.push({filename:e.filename,wholeFile:!0});break;case`readFileLine`:t.pendingFileReads.push({filename:e.filename,wholeFile:!1});break;case`writeFile`:t.pendingFileWrites.push({filename:e.filename,content:`${t.patternSpace}
313
313
  `});break;case`writeFirstLine`:{let n=t.patternSpace.indexOf(`
314
314
  `),r=n===-1?t.patternSpace:t.patternSpace.slice(0,n);t.pendingFileWrites.push({filename:e.filename,content:`${r}
315
- `});break}case`execute`:t.errorMessage=`sed: e command (shell execution) is not supported in sandboxed environment`,t.quit=!0;break;case`transliterate`:t.patternSpace=Al(t.patternSpace,e);break;case`lineNumber`:t.lineNumberOutput.push(String(t.lineNumber));break;case`branch`:break;case`branchOnSubst`:break;case`branchOnNoSubst`:break;case`group`:break}}function Al(e,t){let n=``;for(let r of e){let e=t.source.indexOf(r);e===-1?n+=r:n+=t.dest[e]}return n}function jl(e,t,n,r){let i=new Map;for(let t=0;t<e.length;t++){let n=e[t];n.type===`label`&&i.set(n.name,t)}let a=r?.maxIterations??Ml,o=0,s=0;for(;s<e.length;){if(o++,o>a)throw new k(`sed: command execution exceeded maximum iterations (${a})`,`iterations`);if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let c=e[s];if(c.type===`next`){if(Tl(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:next`),t.nCommandOutput.push(t.patternSpace),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length)t.linesConsumedInCycle++,t.patternSpace=n.lines[n.currentLineIndex+t.linesConsumedInCycle],t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1,t.substitutionMade=!1;else{t.quit=!0,t.deleted=!0;break}s++;continue}if(c.type===`nextAppend`){if(Tl(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:nextAppend`),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let e=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace+=`
316
- ${e}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}s++;continue}if(c.type===`branch`){let e=c;if(Tl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)){if(t.coverage?.hit(`sed:cmd:branch`),e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnSubst`){let e=c;if(Tl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnSubst`),t.substitutionMade)){if(t.substitutionMade=!1,e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnNoSubst`){let e=c;if(Tl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnNoSubst`),!t.substitutionMade)){if(e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`group`){let e=c;if(Tl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:group`),jl(e.commands,t,n,r),t.branchRequest)){let e=i.get(t.branchRequest);if(e!==void 0){t.branchRequest=void 0,s=e;continue}break}s++;continue}kl(c,t,r),s++}return t.linesConsumedInCycle}var Ml,Nl=S(()=>{A(),Ss(),vl(),Ml=1e4}),z,Pl,Fl=S(()=>{(function(e){e.NUMBER=`NUMBER`,e.DOLLAR=`DOLLAR`,e.PATTERN=`PATTERN`,e.STEP=`STEP`,e.RELATIVE_OFFSET=`RELATIVE_OFFSET`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.SEMICOLON=`SEMICOLON`,e.NEWLINE=`NEWLINE`,e.COMMA=`COMMA`,e.NEGATION=`NEGATION`,e.COMMAND=`COMMAND`,e.SUBSTITUTE=`SUBSTITUTE`,e.TRANSLITERATE=`TRANSLITERATE`,e.LABEL_DEF=`LABEL_DEF`,e.BRANCH=`BRANCH`,e.BRANCH_ON_SUBST=`BRANCH_ON_SUBST`,e.BRANCH_ON_NO_SUBST=`BRANCH_ON_NO_SUBST`,e.TEXT_CMD=`TEXT_CMD`,e.FILE_READ=`FILE_READ`,e.FILE_READ_LINE=`FILE_READ_LINE`,e.FILE_WRITE=`FILE_WRITE`,e.FILE_WRITE_LINE=`FILE_WRITE_LINE`,e.EXECUTE=`EXECUTE`,e.VERSION=`VERSION`,e.EOF=`EOF`,e.ERROR=`ERROR`})(z||={}),Pl=class{input;pos=0;line=1;column=1;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&e.push(t)}return e.push(this.makeToken(z.EOF,``)),e}makeToken(e,t,n){return{type:e,value:t,line:this.line,column:this.column,...n}}peek(e=0){return this.input[this.pos+e]||``}advance(){let e=this.input[this.pos++]||``;return e===`
315
+ `});break}case`execute`:t.errorMessage=`sed: e command (shell execution) is not supported in sandboxed environment`,t.quit=!0;break;case`transliterate`:t.patternSpace=kl(t.patternSpace,e);break;case`lineNumber`:t.lineNumberOutput.push(String(t.lineNumber));break;case`branch`:break;case`branchOnSubst`:break;case`branchOnNoSubst`:break;case`group`:break}}function kl(e,t){let n=``;for(let r of e){let e=t.source.indexOf(r);e===-1?n+=r:n+=t.dest[e]}return n}function Al(e,t,n,r){let i=new Map;for(let t=0;t<e.length;t++){let n=e[t];n.type===`label`&&i.set(n.name,t)}let a=r?.maxIterations??jl,o=0,s=0;for(;s<e.length;){if(o++,o>a)throw new k(`sed: command execution exceeded maximum iterations (${a})`,`iterations`);if(t.deleted||t.quit||t.quitSilent||t.restartCycle)break;let c=e[s];if(c.type===`next`){if(wl(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:next`),t.nCommandOutput.push(t.patternSpace),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length)t.linesConsumedInCycle++,t.patternSpace=n.lines[n.currentLineIndex+t.linesConsumedInCycle],t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1,t.substitutionMade=!1;else{t.quit=!0,t.deleted=!0;break}s++;continue}if(c.type===`nextAppend`){if(wl(c.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t))if(t.coverage?.hit(`sed:cmd:nextAppend`),n&&n.currentLineIndex+t.linesConsumedInCycle+1<n.lines.length){t.linesConsumedInCycle++;let e=n.lines[n.currentLineIndex+t.linesConsumedInCycle];t.patternSpace+=`
316
+ ${e}`,t.lineNumber=n.currentLineIndex+t.linesConsumedInCycle+1}else{t.quit=!0;break}s++;continue}if(c.type===`branch`){let e=c;if(wl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)){if(t.coverage?.hit(`sed:cmd:branch`),e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnSubst`){let e=c;if(wl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnSubst`),t.substitutionMade)){if(t.substitutionMade=!1,e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`branchOnNoSubst`){let e=c;if(wl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:branchOnNoSubst`),!t.substitutionMade)){if(e.label){let n=i.get(e.label);if(n!==void 0){s=n;continue}t.branchRequest=e.label;break}break}s++;continue}if(c.type===`group`){let e=c;if(wl(e.address,t.lineNumber,t.totalLines,t.patternSpace,t.rangeStates,t)&&(t.coverage?.hit(`sed:cmd:group`),Al(e.commands,t,n,r),t.branchRequest)){let e=i.get(t.branchRequest);if(e!==void 0){t.branchRequest=void 0,s=e;continue}break}s++;continue}Ol(c,t,r),s++}return t.linesConsumedInCycle}var jl,Ml=S(()=>{A(),xs(),_l(),jl=1e4}),B,Nl,Pl=S(()=>{(function(e){e.NUMBER=`NUMBER`,e.DOLLAR=`DOLLAR`,e.PATTERN=`PATTERN`,e.STEP=`STEP`,e.RELATIVE_OFFSET=`RELATIVE_OFFSET`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.SEMICOLON=`SEMICOLON`,e.NEWLINE=`NEWLINE`,e.COMMA=`COMMA`,e.NEGATION=`NEGATION`,e.COMMAND=`COMMAND`,e.SUBSTITUTE=`SUBSTITUTE`,e.TRANSLITERATE=`TRANSLITERATE`,e.LABEL_DEF=`LABEL_DEF`,e.BRANCH=`BRANCH`,e.BRANCH_ON_SUBST=`BRANCH_ON_SUBST`,e.BRANCH_ON_NO_SUBST=`BRANCH_ON_NO_SUBST`,e.TEXT_CMD=`TEXT_CMD`,e.FILE_READ=`FILE_READ`,e.FILE_READ_LINE=`FILE_READ_LINE`,e.FILE_WRITE=`FILE_WRITE`,e.FILE_WRITE_LINE=`FILE_WRITE_LINE`,e.EXECUTE=`EXECUTE`,e.VERSION=`VERSION`,e.EOF=`EOF`,e.ERROR=`ERROR`})(B||={}),Nl=class{input;pos=0;line=1;column=1;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&e.push(t)}return e.push(this.makeToken(B.EOF,``)),e}makeToken(e,t,n){return{type:e,value:t,line:this.line,column:this.column,...n}}peek(e=0){return this.input[this.pos+e]||``}advance(){let e=this.input[this.pos++]||``;return e===`
317
317
  `?(this.line++,this.column=1):this.column++,e}readEscapedString(e){let t=``;for(;this.pos<this.input.length&&this.peek()!==e;)if(this.peek()===`\\`){this.advance();let e=this.advance();e===`n`?t+=`
318
318
  `:e===`t`?t+=` `:t+=e}else{if(this.peek()===`
319
319
  `)return null;t+=this.advance()}return t}skipWhitespace(){for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`\r`)this.advance();else if(e===`#`)for(;this.pos<this.input.length&&this.peek()!==`
320
320
  `;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let e=this.line,t=this.column,n=this.peek();return n===`
321
- `?(this.advance(),{type:z.NEWLINE,value:`
322
- `,line:e,column:t}):n===`;`?(this.advance(),{type:z.SEMICOLON,value:`;`,line:e,column:t}):n===`{`?(this.advance(),{type:z.LBRACE,value:`{`,line:e,column:t}):n===`}`?(this.advance(),{type:z.RBRACE,value:`}`,line:e,column:t}):n===`,`?(this.advance(),{type:z.COMMA,value:`,`,line:e,column:t}):n===`!`?(this.advance(),{type:z.NEGATION,value:`!`,line:e,column:t}):n===`$`?(this.advance(),{type:z.DOLLAR,value:`$`,line:e,column:t}):this.isDigit(n)?this.readNumber():n===`+`&&this.isDigit(this.input[this.pos+1]||``)?this.readRelativeOffset():n===`/`?this.readPattern():n===`:`?this.readLabelDef():this.readCommand()}readNumber(){let e=this.line,t=this.column,n=``;for(;this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`~`){this.advance();let r=``;for(;this.isDigit(this.peek());)r+=this.advance();let i=parseInt(n,10),a=parseInt(r,10)||0;return{type:z.STEP,value:`${i}~${a}`,first:i,step:a,line:e,column:t}}return{type:z.NUMBER,value:parseInt(n,10),line:e,column:t}}readRelativeOffset(){let e=this.line,t=this.column;this.advance();let n=``;for(;this.isDigit(this.peek());)n+=this.advance();let r=parseInt(n,10)||0;return{type:z.RELATIVE_OFFSET,value:`+${r}`,offset:r,line:e,column:t}}readPattern(){let e=this.line,t=this.column;this.advance();let n=``,r=!1;for(;this.pos<this.input.length;){let e=this.peek();if(e===`/`&&!r)break;if(e===`\\`)n+=this.advance(),this.pos<this.input.length&&this.peek()!==`
321
+ `?(this.advance(),{type:B.NEWLINE,value:`
322
+ `,line:e,column:t}):n===`;`?(this.advance(),{type:B.SEMICOLON,value:`;`,line:e,column:t}):n===`{`?(this.advance(),{type:B.LBRACE,value:`{`,line:e,column:t}):n===`}`?(this.advance(),{type:B.RBRACE,value:`}`,line:e,column:t}):n===`,`?(this.advance(),{type:B.COMMA,value:`,`,line:e,column:t}):n===`!`?(this.advance(),{type:B.NEGATION,value:`!`,line:e,column:t}):n===`$`?(this.advance(),{type:B.DOLLAR,value:`$`,line:e,column:t}):this.isDigit(n)?this.readNumber():n===`+`&&this.isDigit(this.input[this.pos+1]||``)?this.readRelativeOffset():n===`/`?this.readPattern():n===`:`?this.readLabelDef():this.readCommand()}readNumber(){let e=this.line,t=this.column,n=``;for(;this.isDigit(this.peek());)n+=this.advance();if(this.peek()===`~`){this.advance();let r=``;for(;this.isDigit(this.peek());)r+=this.advance();let i=parseInt(n,10),a=parseInt(r,10)||0;return{type:B.STEP,value:`${i}~${a}`,first:i,step:a,line:e,column:t}}return{type:B.NUMBER,value:parseInt(n,10),line:e,column:t}}readRelativeOffset(){let e=this.line,t=this.column;this.advance();let n=``;for(;this.isDigit(this.peek());)n+=this.advance();let r=parseInt(n,10)||0;return{type:B.RELATIVE_OFFSET,value:`+${r}`,offset:r,line:e,column:t}}readPattern(){let e=this.line,t=this.column;this.advance();let n=``,r=!1;for(;this.pos<this.input.length;){let e=this.peek();if(e===`/`&&!r)break;if(e===`\\`)n+=this.advance(),this.pos<this.input.length&&this.peek()!==`
323
323
  `&&(n+=this.advance());else{if(e===`
324
- `)break;e===`[`&&!r?(r=!0,n+=this.advance(),this.peek()===`^`&&(n+=this.advance()),this.peek()===`]`&&(n+=this.advance())):(e===`]`&&r&&(r=!1),n+=this.advance())}}return this.peek()===`/`&&this.advance(),{type:z.PATTERN,value:n,pattern:n,line:e,column:t}}readLabelDef(){let e=this.line,t=this.column;for(this.advance();this.peek()===` `||this.peek()===` `;)this.advance();let n=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`
325
- `||e===`;`||e===`}`||e===`{`)break;n+=this.advance()}return{type:z.LABEL_DEF,value:n,label:n,line:e,column:t}}readCommand(){let e=this.line,t=this.column,n=this.advance();switch(n){case`s`:return this.readSubstitute(e,t);case`y`:return this.readTransliterate(e,t);case`a`:case`i`:case`c`:return this.readTextCommand(n,e,t);case`b`:return this.readBranch(z.BRANCH,`b`,e,t);case`t`:return this.readBranch(z.BRANCH_ON_SUBST,`t`,e,t);case`T`:return this.readBranch(z.BRANCH_ON_NO_SUBST,`T`,e,t);case`r`:return this.readFileCommand(z.FILE_READ,`r`,e,t);case`R`:return this.readFileCommand(z.FILE_READ_LINE,`R`,e,t);case`w`:return this.readFileCommand(z.FILE_WRITE,`w`,e,t);case`W`:return this.readFileCommand(z.FILE_WRITE_LINE,`W`,e,t);case`e`:return this.readExecute(e,t);case`p`:case`P`:case`d`:case`D`:case`h`:case`H`:case`g`:case`G`:case`x`:case`n`:case`N`:case`q`:case`Q`:case`z`:case`=`:case`l`:case`F`:return{type:z.COMMAND,value:n,line:e,column:t};case`v`:return this.readVersion(e,t);default:return{type:z.ERROR,value:n,line:e,column:t}}}readSubstitute(e,t){let n=this.advance();if(!n||n===`
326
- `)return{type:z.ERROR,value:`s`,line:e,column:t};let r=``,i=!1;for(;this.pos<this.input.length;){let e=this.peek();if(e===n&&!i)break;if(e===`\\`)this.advance(),this.pos<this.input.length&&this.peek()!==`
324
+ `)break;e===`[`&&!r?(r=!0,n+=this.advance(),this.peek()===`^`&&(n+=this.advance()),this.peek()===`]`&&(n+=this.advance())):(e===`]`&&r&&(r=!1),n+=this.advance())}}return this.peek()===`/`&&this.advance(),{type:B.PATTERN,value:n,pattern:n,line:e,column:t}}readLabelDef(){let e=this.line,t=this.column;for(this.advance();this.peek()===` `||this.peek()===` `;)this.advance();let n=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`
325
+ `||e===`;`||e===`}`||e===`{`)break;n+=this.advance()}return{type:B.LABEL_DEF,value:n,label:n,line:e,column:t}}readCommand(){let e=this.line,t=this.column,n=this.advance();switch(n){case`s`:return this.readSubstitute(e,t);case`y`:return this.readTransliterate(e,t);case`a`:case`i`:case`c`:return this.readTextCommand(n,e,t);case`b`:return this.readBranch(B.BRANCH,`b`,e,t);case`t`:return this.readBranch(B.BRANCH_ON_SUBST,`t`,e,t);case`T`:return this.readBranch(B.BRANCH_ON_NO_SUBST,`T`,e,t);case`r`:return this.readFileCommand(B.FILE_READ,`r`,e,t);case`R`:return this.readFileCommand(B.FILE_READ_LINE,`R`,e,t);case`w`:return this.readFileCommand(B.FILE_WRITE,`w`,e,t);case`W`:return this.readFileCommand(B.FILE_WRITE_LINE,`W`,e,t);case`e`:return this.readExecute(e,t);case`p`:case`P`:case`d`:case`D`:case`h`:case`H`:case`g`:case`G`:case`x`:case`n`:case`N`:case`q`:case`Q`:case`z`:case`=`:case`l`:case`F`:return{type:B.COMMAND,value:n,line:e,column:t};case`v`:return this.readVersion(e,t);default:return{type:B.ERROR,value:n,line:e,column:t}}}readSubstitute(e,t){let n=this.advance();if(!n||n===`
326
+ `)return{type:B.ERROR,value:`s`,line:e,column:t};let r=``,i=!1;for(;this.pos<this.input.length;){let e=this.peek();if(e===n&&!i)break;if(e===`\\`)this.advance(),this.pos<this.input.length&&this.peek()!==`
327
327
  `?(this.peek()===n&&!i||(r+=`\\`),r+=this.advance()):r+=`\\`;else{if(e===`
328
- `)break;e===`[`&&!i?(i=!0,r+=this.advance(),this.peek()===`^`&&(r+=this.advance()),this.peek()===`]`&&(r+=this.advance())):(e===`]`&&i&&(i=!1),r+=this.advance())}}if(this.peek()!==n)return{type:z.ERROR,value:`unterminated substitution pattern`,line:e,column:t};this.advance();let a=``;for(;this.pos<this.input.length&&this.peek()!==n;)if(this.peek()===`\\`)if(this.advance(),this.pos<this.input.length){let e=this.peek();e===`\\`?(this.advance(),this.pos<this.input.length&&this.peek()===`
328
+ `)break;e===`[`&&!i?(i=!0,r+=this.advance(),this.peek()===`^`&&(r+=this.advance()),this.peek()===`]`&&(r+=this.advance())):(e===`]`&&i&&(i=!1),r+=this.advance())}}if(this.peek()!==n)return{type:B.ERROR,value:`unterminated substitution pattern`,line:e,column:t};this.advance();let a=``;for(;this.pos<this.input.length&&this.peek()!==n;)if(this.peek()===`\\`)if(this.advance(),this.pos<this.input.length){let e=this.peek();e===`\\`?(this.advance(),this.pos<this.input.length&&this.peek()===`
329
329
  `?(a+=`
330
330
  `,this.advance()):a+=`\\`):e===`
331
331
  `?(a+=`
332
332
  `,this.advance()):a+=`\\${this.advance()}`}else a+=`\\`;else{if(this.peek()===`
333
- `)break;a+=this.advance()}this.peek()===n&&this.advance();let o=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`g`||e===`i`||e===`p`||e===`I`||this.isDigit(e))o+=this.advance();else break}return{type:z.SUBSTITUTE,value:`s${n}${r}${n}${a}${n}${o}`,pattern:r,replacement:a,flags:o,line:e,column:t}}readTransliterate(e,t){let n=this.advance();if(!n||n===`
334
- `)return{type:z.ERROR,value:`y`,line:e,column:t};let r=this.readEscapedString(n);if(r===null||this.peek()!==n)return{type:z.ERROR,value:`unterminated transliteration source`,line:e,column:t};this.advance();let i=this.readEscapedString(n);if(i===null||this.peek()!==n)return{type:z.ERROR,value:`unterminated transliteration dest`,line:e,column:t};this.advance();let a=this.peek();for(;a===` `||a===` `;)this.advance(),a=this.peek();return a!==``&&a!==`;`&&a!==`
335
- `&&a!==`}`?{type:z.ERROR,value:`extra text at the end of a transform command`,line:e,column:t}:{type:z.TRANSLITERATE,value:`y${n}${r}${n}${i}${n}`,source:r,dest:i,line:e,column:t}}readTextCommand(e,t,n){let r=!1;this.peek()===`\\`&&this.pos+1<this.input.length&&(this.input[this.pos+1]===`
333
+ `)break;a+=this.advance()}this.peek()===n&&this.advance();let o=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`g`||e===`i`||e===`p`||e===`I`||this.isDigit(e))o+=this.advance();else break}return{type:B.SUBSTITUTE,value:`s${n}${r}${n}${a}${n}${o}`,pattern:r,replacement:a,flags:o,line:e,column:t}}readTransliterate(e,t){let n=this.advance();if(!n||n===`
334
+ `)return{type:B.ERROR,value:`y`,line:e,column:t};let r=this.readEscapedString(n);if(r===null||this.peek()!==n)return{type:B.ERROR,value:`unterminated transliteration source`,line:e,column:t};this.advance();let i=this.readEscapedString(n);if(i===null||this.peek()!==n)return{type:B.ERROR,value:`unterminated transliteration dest`,line:e,column:t};this.advance();let a=this.peek();for(;a===` `||a===` `;)this.advance(),a=this.peek();return a!==``&&a!==`;`&&a!==`
335
+ `&&a!==`}`?{type:B.ERROR,value:`extra text at the end of a transform command`,line:e,column:t}:{type:B.TRANSLITERATE,value:`y${n}${r}${n}${i}${n}`,source:r,dest:i,line:e,column:t}}readTextCommand(e,t,n){let r=!1;this.peek()===`\\`&&this.pos+1<this.input.length&&(this.input[this.pos+1]===`
336
336
  `||this.input[this.pos+1]===` `||this.input[this.pos+1]===` `)&&(r=!0,this.advance()),(this.peek()===` `||this.peek()===` `)&&this.advance(),this.peek()===`\\`&&this.pos+1<this.input.length&&(this.input[this.pos+1]===` `||this.input[this.pos+1]===` `)&&this.advance(),r&&this.peek()===`
337
337
  `&&this.advance();let i=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`
338
338
  `){if(i.endsWith(`\\`)){i=`${i.slice(0,-1)}
339
339
  `,this.advance();continue}break}if(e===`\\`&&this.pos+1<this.input.length){let e=this.input[this.pos+1];if(e===`n`){i+=`
340
- `,this.advance(),this.advance();continue}if(e===`t`){i+=` `,this.advance(),this.advance();continue}if(e===`r`){i+=`\r`,this.advance(),this.advance();continue}}i+=this.advance()}return{type:z.TEXT_CMD,value:e,text:i,line:t,column:n}}readBranch(e,t,n,r){for(;this.peek()===` `||this.peek()===` `;)this.advance();let i=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`
340
+ `,this.advance(),this.advance();continue}if(e===`t`){i+=` `,this.advance(),this.advance();continue}if(e===`r`){i+=`\r`,this.advance(),this.advance();continue}}i+=this.advance()}return{type:B.TEXT_CMD,value:e,text:i,line:t,column:n}}readBranch(e,t,n,r){for(;this.peek()===` `||this.peek()===` `;)this.advance();let i=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`
341
341
  `||e===`;`||e===`}`||e===`{`)break;i+=this.advance()}return{type:e,value:t,label:i||void 0,line:n,column:r}}readVersion(e,t){for(;this.peek()===` `||this.peek()===` `;)this.advance();let n=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`
342
- `||e===`;`||e===`}`||e===`{`)break;n+=this.advance()}return{type:z.VERSION,value:`v`,label:n||void 0,line:e,column:t}}readFileCommand(e,t,n,r){for(;this.peek()===` `||this.peek()===` `;)this.advance();let i=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`
342
+ `||e===`;`||e===`}`||e===`{`)break;n+=this.advance()}return{type:B.VERSION,value:`v`,label:n||void 0,line:e,column:t}}readFileCommand(e,t,n,r){for(;this.peek()===` `||this.peek()===` `;)this.advance();let i=``;for(;this.pos<this.input.length;){let e=this.peek();if(e===`
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
- `||e===`;`)break;n+=this.advance()}return{type:z.EXECUTE,value:`e`,command:n.trim()||void 0,line:e,column:t}}isDigit(e){return e>=`0`&&e<=`9`}}});function Il(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}
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 Bl([a],t||r).parse();if(!o.error&&o.commands.length>0){let e=Ll(o.commands);if(e)return{commands:[],error:e,silentMode:n,extendedRegexMode:r}}return{...o,silentMode:n,extendedRegexMode:r}}function Ll(e){let t=new Set;Rl(e,t);let n=zl(e,t);if(n)return`undefined label '${n}'`}function Rl(e,t){for(let n of e)n.type===`label`?t.add(n.name):n.type===`group`&&Rl(n.commands,t)}function zl(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=zl(n.commands,t);if(e)return e}}}var Bl,Vl=S(()=>{Fl(),Bl=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 Pl(t).tokenize(),this.pos=0;!this.isAtEnd();){if(this.check(z.NEWLINE)||this.check(z.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(z.NEGATION)&&(this.advance(),t&&(t.negated=!0));this.check(z.NEWLINE)||this.check(z.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 z.COMMAND:return this.parseSimpleCommand(n,t);case z.SUBSTITUTE:return this.parseSubstituteFromToken(n,t);case z.TRANSLITERATE:return this.parseTransliterateFromToken(n,t);case z.LABEL_DEF:return this.advance(),{command:{type:`label`,name:n.label||``}};case z.BRANCH:return this.advance(),{command:{type:`branch`,address:t,label:n.label}};case z.BRANCH_ON_SUBST:return this.advance(),{command:{type:`branchOnSubst`,address:t,label:n.label}};case z.BRANCH_ON_NO_SUBST:return this.advance(),{command:{type:`branchOnNoSubst`,address:t,label:n.label}};case z.TEXT_CMD:return this.advance(),this.parseTextCommand(n,t);case z.FILE_READ:return this.advance(),{command:{type:`readFile`,address:t,filename:n.filename||``}};case z.FILE_READ_LINE:return this.advance(),{command:{type:`readFileLine`,address:t,filename:n.filename||``}};case z.FILE_WRITE:return this.advance(),{command:{type:`writeFile`,address:t,filename:n.filename||``}};case z.FILE_WRITE_LINE:return this.advance(),{command:{type:`writeFirstLine`,address:t,filename:n.filename||``}};case z.EXECUTE:return this.advance(),{command:{type:`execute`,address:t,command:n.command}};case z.VERSION:return this.advance(),{command:{type:`version`,address:t,minVersion:n.label}};case z.LBRACE:return this.parseGroup(t);case z.RBRACE:return{command:null};case z.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(z.RBRACE);){if(this.check(z.NEWLINE)||this.check(z.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(z.RBRACE)?(this.advance(),{command:{type:`group`,address:e,commands:t}}):{command:null,error:`unmatched brace in grouped commands`}}parseAddressRange(){if(this.check(z.COMMA))return{error:`expected context address`};let e=this.parseAddress();if(e===void 0)return;let t;if(this.check(z.RELATIVE_OFFSET))t={offset:this.advance().offset||0};else if(this.check(z.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 z.NUMBER:return this.advance(),e.value;case z.DOLLAR:return this.advance(),`$`;case z.PATTERN:return this.advance(),{pattern:e.pattern||e.value};case z.STEP:return this.advance(),{first:e.first||0,step:e.step||0};case z.RELATIVE_OFFSET:return this.advance(),{offset:e.offset||0};default:return}}peek(){return this.tokens[this.pos]||{type:z.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===z.EOF}}}),Hl={};C(Hl,{flagsForFuzzing:()=>Kl,sedCommand:()=>Gl});async function Ul(e,t,n,r={}){let{limits:i,filename:a,fs:o,cwd:s,coverage:c,requireDefenseContext:l}=r;dl(l,`sed`,`processing entry`);let u=(e,t)=>fl(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)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(`
347
347
  `),f=e.split(`
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={...yl(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=[],jl(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(`
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}
350
350
  `);let d=r.lineNumberOutput.length>0;for(let e of r.lineNumberOutput)v(`${e}
351
351
  `);let m=[],_=[];for(let e of r.appendBuffer)e.startsWith(`__INSERT__`)?m.push(e.slice(10)):_.push(e);for(let e of m)v(`${e}
@@ -354,7 +354,7 @@ ${a}`}else i.push(a)}let a=i.join(`
354
354
  `),ie=!0):r.changedText!==void 0&&(v(`${r.changedText}
355
355
  `),ie=!0);for(let e of _)v(`${e}
356
356
  `);if(g=(d||ie)&&_.length===0,r.quit||r.quitSilent){if(r.exitCode!==void 0&&(h=r.exitCode),r.errorMessage)return{output:``,exitCode:h||1,errorMessage:r.errorMessage};break}}if(o&&s)for(let[e,t]of re)try{await u(`flush pending file writes`,()=>o.writeFile(e,t))}catch(e){if(e instanceof w)throw e}return!d&&g&&m.endsWith(`
357
- `)&&(m=m.slice(0,-1)),{output:m,exitCode:h}}var Wl,Gl,Kl,ql=S(()=>{Li(),A(),pl(),ir(),O(),Nl(),Vl(),Wl={name:`sed`,summary:`stream editor for filtering and transforming text`,usage:`sed [OPTION]... {script} [input-file]...`,options:[`-n, --quiet, --silent suppress automatic printing of pattern space`,`-e script add the script to commands to be executed`,`-f script-file read script from file`,`-i, --in-place edit files in place`,`-E, -r, --regexp-extended use extended regular expressions`,` --help display this help and exit`],description:`Commands:
357
+ `)&&(m=m.slice(0,-1)),{output:m,exitCode:h}}var Ul,Wl,Gl,Kl=S(()=>{Li(),A(),fl(),ir(),O(),Ml(),Bl(),Ul={name:`sed`,summary:`stream editor for filtering and transforming text`,usage:`sed [OPTION]... {script} [input-file]...`,options:[`-n, --quiet, --silent suppress automatic printing of pattern space`,`-e script add the script to commands to be executed`,`-f script-file read script from file`,`-i, --in-place edit files in place`,`-E, -r, --regexp-extended use extended regular expressions`,` --help display this help and exit`],description:`Commands:
358
358
  s/regexp/replacement/[flags] substitute
359
359
  d delete pattern space
360
360
  p print pattern space
@@ -383,28 +383,28 @@ Addresses:
383
383
  $ last line
384
384
  /regexp/ lines matching regexp
385
385
  N,M range from line N to M
386
- first~step every step-th line starting at first`},Gl={name:`sed`,async execute(e,t){dl(t.requireDefenseContext,`sed`,`execution entry`);let n=(e,n)=>fl(t.requireDefenseContext,`sed`,e,n);if(E(e))return T(Wl);let r=[],i=[],a=!1,o=!1,s=!1,c=[];for(let t=0;t<e.length;t++){let n=e[t];if(n===`-n`||n===`--quiet`||n===`--silent`)a=!0;else if(n===`-i`||n===`--in-place`)o=!0;else if(n.startsWith(`-i`))o=!0;else if(n===`-E`||n===`-r`||n===`--regexp-extended`)s=!0;else if(n===`-e`)t+1<e.length&&r.push(e[++t]);else if(n===`-f`)t+1<e.length&&i.push(e[++t]);else{if(n.startsWith(`--`))return D(`sed`,n);if(n===`-`)c.push(n);else if(n.startsWith(`-`)&&n.length>1){for(let e of n.slice(1))if(e!==`n`&&e!==`e`&&e!==`f`&&e!==`i`&&e!==`E`&&e!==`r`)return D(`sed`,`-${e}`);n.includes(`n`)&&(a=!0),n.includes(`i`)&&(o=!0),(n.includes(`E`)||n.includes(`r`))&&(s=!0),n.includes(`e`)&&!n.includes(`n`)&&!n.includes(`i`)&&t+1<e.length&&r.push(e[++t]),n.includes(`f`)&&!n.includes(`e`)&&t+1<e.length&&i.push(e[++t])}else !n.startsWith(`-`)&&r.length===0&&i.length===0?r.push(n):n.startsWith(`-`)||c.push(n)}}for(let e of i){let i=t.fs.resolvePath(t.cwd,e);try{let e=await n(`script file read`,()=>t.fs.readFile(i));for(let t of e.split(`
386
+ first~step every step-th line starting at first`},Wl={name:`sed`,async execute(e,t){ul(t.requireDefenseContext,`sed`,`execution entry`);let n=(e,n)=>dl(t.requireDefenseContext,`sed`,e,n);if(E(e))return T(Ul);let r=[],i=[],a=!1,o=!1,s=!1,c=[];for(let t=0;t<e.length;t++){let n=e[t];if(n===`-n`||n===`--quiet`||n===`--silent`)a=!0;else if(n===`-i`||n===`--in-place`)o=!0;else if(n.startsWith(`-i`))o=!0;else if(n===`-E`||n===`-r`||n===`--regexp-extended`)s=!0;else if(n===`-e`)t+1<e.length&&r.push(e[++t]);else if(n===`-f`)t+1<e.length&&i.push(e[++t]);else{if(n.startsWith(`--`))return D(`sed`,n);if(n===`-`)c.push(n);else if(n.startsWith(`-`)&&n.length>1){for(let e of n.slice(1))if(e!==`n`&&e!==`e`&&e!==`f`&&e!==`i`&&e!==`E`&&e!==`r`)return D(`sed`,`-${e}`);n.includes(`n`)&&(a=!0),n.includes(`i`)&&(o=!0),(n.includes(`E`)||n.includes(`r`))&&(s=!0),n.includes(`e`)&&!n.includes(`n`)&&!n.includes(`i`)&&t+1<e.length&&r.push(e[++t]),n.includes(`f`)&&!n.includes(`e`)&&t+1<e.length&&i.push(e[++t])}else !n.startsWith(`-`)&&r.length===0&&i.length===0?r.push(n):n.startsWith(`-`)||c.push(n)}}for(let e of i){let i=t.fs.resolvePath(t.cwd,e);try{let e=await n(`script file read`,()=>t.fs.readFile(i));for(let t of e.split(`
387
387
  `)){let e=t.trim();e&&!e.startsWith(`#`)&&r.push(e)}}catch(t){if(t instanceof w)throw t;return{stdout:``,stderr:`sed: couldn't open file ${e}: No such file or directory
388
388
  `,exitCode:1}}}if(r.length===0)return{stdout:``,stderr:`sed: no script specified
389
- `,exitCode:1};let{commands:l,error:u,silentMode:d}=Il(r,s);if(u)return{stdout:``,stderr:`sed: ${u}
389
+ `,exitCode:1};let{commands:l,error:u,silentMode:d}=Fl(r,s);if(u)return{stdout:``,stderr:`sed: ${u}
390
390
  `,exitCode:1};let f=!!(a||d);if(o){if(c.length===0)return{stdout:``,stderr:`sed: -i requires at least one file argument
391
- `,exitCode:1};for(let e of c){if(e===`-`)continue;let r=t.fs.resolvePath(t.cwd,e);try{let i=await n(`in-place input read`,()=>t.fs.readFile(r)),a=await n(`in-place processing`,()=>Ul(i,l,f,{limits:t.limits,filename:e,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(a.errorMessage)return{stdout:``,stderr:`${a.errorMessage}
391
+ `,exitCode:1};for(let e of c){if(e===`-`)continue;let r=t.fs.resolvePath(t.cwd,e);try{let i=await n(`in-place input read`,()=>t.fs.readFile(r)),a=await n(`in-place processing`,()=>Hl(i,l,f,{limits:t.limits,filename:e,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));if(a.errorMessage)return{stdout:``,stderr:`${a.errorMessage}
392
392
  `,exitCode:a.exitCode??1};await n(`in-place output write`,()=>t.fs.writeFile(r,a.output))}catch(t){if(t instanceof w)throw t;return t instanceof k?{stdout:``,stderr:`sed: ${Ii(t.message)}
393
393
  `,exitCode:k.EXIT_CODE}:{stdout:``,stderr:`sed: ${e}: No such file or directory
394
- `,exitCode:1}}}return{stdout:``,stderr:``,exitCode:0}}let p=``;if(c.length===0){p=t.stdin;try{let e=await n(`stdin processing`,()=>Ul(p,l,f,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:e.output,stderr:e.errorMessage?`${e.errorMessage}
394
+ `,exitCode:1}}}return{stdout:``,stderr:``,exitCode:0}}let p=``;if(c.length===0){p=t.stdin;try{let e=await n(`stdin processing`,()=>Hl(p,l,f,{limits:t.limits,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:e.output,stderr:e.errorMessage?`${e.errorMessage}
395
395
  `:``,exitCode:e.exitCode??0}}catch(e){if(e instanceof w)throw e;if(e instanceof k)return{stdout:``,stderr:`sed: ${Ii(e.message)}
396
396
  `,exitCode:k.EXIT_CODE};throw e}}let m=!1;for(let e of c){let r;if(e===`-`)m?r=``:(r=t.stdin,m=!0);else{let i=t.fs.resolvePath(t.cwd,e);try{r=await n(`input file read`,()=>t.fs.readFile(i))}catch(t){if(t instanceof w)throw t;return t instanceof k?{stdout:``,stderr:`sed: ${Ii(t.message)}
397
397
  `,exitCode:k.EXIT_CODE}:{stdout:``,stderr:`sed: ${e}: No such file or directory
398
398
  `,exitCode:1}}}p.length>0&&r.length>0&&!p.endsWith(`
399
399
  `)&&(p+=`
400
- `),p+=r}try{let e=await n(`final processing`,()=>Ul(p,l,f,{limits:t.limits,filename:c.length===1?c[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:e.output,stderr:e.errorMessage?`${e.errorMessage}
400
+ `),p+=r}try{let e=await n(`final processing`,()=>Hl(p,l,f,{limits:t.limits,filename:c.length===1?c[0]:void 0,fs:t.fs,cwd:t.cwd,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext}));return{stdout:e.output,stderr:e.errorMessage?`${e.errorMessage}
401
401
  `:``,exitCode:e.exitCode??0}}catch(e){if(e instanceof w)throw e;if(e instanceof k)return{stdout:``,stderr:`sed: ${Ii(e.message)}
402
- `,exitCode:k.EXIT_CODE};throw e}}},Kl={name:`sed`,flags:[{flag:`-n`,type:`boolean`},{flag:`-i`,type:`boolean`},{flag:`-E`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-e`,type:`value`,valueHint:`string`}],stdinType:`text`,needsArgs:!0}});function Jl(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function Yl(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Xl(...e){return Object.assign(Object.create(null),...e)}var Zl=S(()=>{});function Ql(e={}){let{fieldSep:t=tu,maxIterations:n=$l,maxRecursionDepth:r=eu,maxOutputSize:i=0,fs:a,cwd:o,exec:s,coverage:c,requireDefenseContext:l}=e;return{FS:` `,OFS:` `,ORS:`
403
- `,OFMT:`%.6g`,NR:0,NF:0,FNR:0,FILENAME:``,RSTART:0,RLENGTH:-1,SUBSEP:``,fields:[],line:``,vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:i,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:``,openedFiles:new Set,fs:a,cwd:o,exec:s,coverage:c,requireDefenseContext:l}}var $l,eu,tu,nu=S(()=>{Ss(),$l=1e4,eu=100,tu=new bs(/\s+/)});function ru(e,t,n){switch(n){case`+`:return e+t;case`-`:return e-t;case`*`:return e*t;case`/`:return t===0?0:e/t;case`%`:return t===0?0:e%t;case`^`:case`**`:return e**t;default:return 0}}var iu=S(()=>{});function au(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function ou(e){return typeof e==`string`?e:String(e)}async function su(e,t){if(e.type===`regex`)return e.pattern;let n=ou(await t.evalExpr(e));return n.startsWith(`/`)&&n.endsWith(`/`)&&(n=n.slice(1,-1)),n}async function cu(e,t){return e?e.type===`variable`?e.name:e.type===`field`?`$${Math.floor(au(await t.evalExpr(e.index)))}`:`$0`:`$0`}function lu(e,t){if(e===`$0`)return t.line;if(e.startsWith(`$`)){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||``}return ou(t.vars[e]??``)}function uu(e,t,n){if(e===`$0`)n.line=t,n.fields=n.FS===` `?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith(`$`)){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push(``);n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function du(e,t,n){return e.length===0?t.line.length:ou(await n.evalExpr(e[0])).length}async function fu(e,t,n){if(e.length<2)return``;let r=ou(await n.evalExpr(e[0])),i=Math.floor(au(await n.evalExpr(e[1])))-1;if(e.length>=3){let t=Math.floor(au(await n.evalExpr(e[2])));return r.substr(Math.max(0,i),t)}return r.substr(Math.max(0,i))}async function pu(e,t,n){if(e.length<2)return 0;let r=ou(await n.evalExpr(e[0])),i=ou(await n.evalExpr(e[1])),a=r.indexOf(i);return a===-1?0:a+1}async function mu(e,t,n){if(e.length<2)return 0;let r=ou(await n.evalExpr(e[0])),i=e[1];if(i.type!==`variable`)return 0;let a=i.name,o=t.FS;if(e.length>=3){let t=e[2];if(t.type===`regex`)o=R(t.pattern);else{let e=ou(await n.evalExpr(t));o=e===` `?R(`\\s+`):e}}else t.FS===` `&&(o=R(`\\s+`));let s=typeof o==`string`?r.split(o):o.split(r);t.arrays[a]=Object.create(null);for(let e=0;e<s.length;e++)t.arrays[a][String(e+1)]=s[e];return s.length}async function hu(e,t,n){if(e.length<2)return 0;let r=await su(e[0],n),i=ou(await n.evalExpr(e[1])),a=await cu(e[2],n),o=lu(a,t);try{let e=R(r).replace(o,_u(i)),n=e===o?0:1;return uu(a,e,t),n}catch{return 0}}async function gu(e,t,n){if(e.length<2)return 0;let r=await su(e[0],n),i=ou(await n.evalExpr(e[1])),a=await cu(e[2],n),o=lu(a,t);try{let e=R(r,`g`),n=e.match(o),s=n?n.length:0;return uu(a,e.replace(o,_u(i)),t),s}catch{return 0}}function _u(e){return t=>{let n=``,r=0;for(;r<e.length;)if(e[r]===`\\`&&r+1<e.length){let t=e[r+1];t===`&`?(n+=`&`,r+=2):t===`\\`?(n+=`\\`,r+=2):(n+=e[r+1],r+=2)}else e[r]===`&`?(n+=t,r++):(n+=e[r],r++);return n}}async function vu(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=ou(await n.evalExpr(e[0])),i=await su(e[1],n);try{let e=R(i).exec(r);if(e)return t.RSTART=e.index+1,t.RLENGTH=e[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function yu(e,t,n){if(e.length<3)return``;let r=await su(e[0],n),i=ou(await n.evalExpr(e[1])),a=ou(await n.evalExpr(e[2])),o=e.length>=4?ou(await n.evalExpr(e[3])):t.line;try{let e=a.toLowerCase()===`g`,t=e?0:parseInt(a,10)||1;if(e)return R(r,`g`).replace(o,(e,...t)=>bu(i,e,t.slice(0,-2)));{let e=0;return R(r,`g`).replace(o,(n,...r)=>(e++,e===t?bu(i,n,r.slice(0,-2)):n))}}catch{return o}}function bu(e,t,n){let r=``,i=0;for(;i<e.length;)if(e[i]===`\\`&&i+1<e.length){let a=e[i+1];if(a===`&`)r+=`&`,i+=2;else if(a===`0`)r+=t,i+=2;else if(a>=`1`&&a<=`9`){let e=parseInt(a,10)-1;r+=n[e]||``,i+=2}else a===`n`?(r+=`
404
- `,i+=2):a===`t`?(r+=` `,i+=2):(r+=a,i+=2)}else e[i]===`&`?(r+=t,i++):(r+=e[i],i++);return r}async function xu(e,t,n){return e.length===0?``:ou(await n.evalExpr(e[0])).toLowerCase()}async function Su(e,t,n){return e.length===0?``:ou(await n.evalExpr(e[0])).toUpperCase()}async function Cu(e,t,n){if(e.length===0)return``;let r=ou(await n.evalExpr(e[0])),i=[];for(let t=1;t<e.length;t++)i.push(await n.evalExpr(e[t]));return Fu(r,i)}async function wu(e,t,n){return e.length===0?0:Math.floor(au(await n.evalExpr(e[0])))}async function Tu(e,t,n){return e.length===0?0:Math.sqrt(au(await n.evalExpr(e[0])))}async function Eu(e,t,n){return e.length===0?0:Math.sin(au(await n.evalExpr(e[0])))}async function Du(e,t,n){return e.length===0?0:Math.cos(au(await n.evalExpr(e[0])))}async function Ou(e,t,n){let r=e.length>0?au(await n.evalExpr(e[0])):0,i=e.length>1?au(await n.evalExpr(e[1])):0;return Math.atan2(r,i)}async function ku(e,t,n){return e.length===0?0:Math.log(au(await n.evalExpr(e[0])))}async function Au(e,t,n){return e.length===0?1:Math.exp(au(await n.evalExpr(e[0])))}function ju(e,t,n){return t.random?t.random():Math.random()}async function Mu(e,t,n){let r=e.length>0?au(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function Nu(e,t){return()=>{throw Error(`${e}() is not supported - ${t}`)}}function Pu(e){return()=>{throw Error(`function '${e}()' is not implemented`)}}function Fu(e,t){let n=0,r=``,i=0;for(;i<e.length;)if(e[i]===`%`&&i+1<e.length){let a=i+1,o=``,s=``,c=``,l,u=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>u&&e[a]===`$`?(l=parseInt(e.substring(u,a),10)-1,a++):a=u;let d=()=>{if(a<e.length){if(a+1<e.length&&(e[a]===`h`&&e[a+1]===`h`||e[a]===`l`&&e[a+1]===`l`)){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]===`*`){let e=t[n++],r=e===void 0?0:Math.floor(Number(e));r<0?(o+=`-`,s=String(Math.min(-r,Iu))):s=String(Math.min(r,Iu)),a++}else for(;a<e.length&&/\d/.test(e[a]);)s+=e[a++];if(s&&parseInt(s,10)>Iu&&(s=String(Iu)),e[a]===`.`){if(a++,e[a]===`*`){let e=t[n++];c=String(Math.min(e===void 0?0:Math.floor(Number(e)),Iu)),a++}else for(;a<e.length&&/\d/.test(e[a]);)c+=e[a++];c&&parseInt(c,10)>Iu&&(c=String(Iu))}d();let f=e[a],p=t[l===void 0?n:l];switch(f){case`s`:{let e=p===void 0?``:String(p);if(c&&(e=e.substring(0,parseInt(c,10))),s){let t=parseInt(s,10);e=o.includes(`-`)?e.padEnd(t):e.padStart(t)}r+=e,l===void 0&&n++;break}case`d`:case`i`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=e<0,i=Math.abs(e).toString();if(c){let e=parseInt(c,10);i=i.padStart(e,`0`)}let a=``;t?a=`-`:o.includes(`+`)?a=`+`:o.includes(` `)&&(a=` `);let u=a+i;if(s){let e=parseInt(s,10);u=o.includes(`-`)?u.padEnd(e):o.includes(`0`)&&!c?a+i.padStart(e-a.length,`0`):u.padStart(e)}r+=u,l===void 0&&n++;break}case`f`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toFixed(t);if(s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`e`:case`E`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toExponential(t);if(f===`E`&&(i=i.toUpperCase()),s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`g`:case`G`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e===0?0:Math.floor(Math.log10(Math.abs(e))),a;if(e===0?a=`0`:i<-4||i>=t?(a=e.toExponential(t-1),f===`G`&&(a=a.toUpperCase())):a=e.toPrecision(t),a.includes(`.`)&&(a=a.replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)),a.includes(`e`)&&(a=a.replace(/\.?0+e/,`e`)),s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):a.padStart(e)}r+=a,l===void 0&&n++;break}case`x`:case`X`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(16);if(f===`X`&&(t=t.toUpperCase()),c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`o`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(8);if(c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`c`:typeof p==`number`?r+=String.fromCharCode(p):r+=String(p??``).charAt(0)||``,l===void 0&&n++;break;case`%`:r+=`%`;break;default:r+=e.substring(i,a+1)}i=a+1}else if(e[i]===`\\`&&i+1<e.length){let t=e[i+1];switch(t){case`n`:r+=`
405
- `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;default:r+=t}i+=2}else r+=e[i++];return r}var Iu,Lu,Ru=S(()=>{Ss(),Iu=1e4,Lu=new Map([[`length`,du],[`substr`,fu],[`index`,pu],[`split`,mu],[`sub`,hu],[`gsub`,gu],[`match`,vu],[`gensub`,yu],[`tolower`,xu],[`toupper`,Su],[`sprintf`,Cu],[`int`,wu],[`sqrt`,Tu],[`sin`,Eu],[`cos`,Du],[`atan2`,Ou],[`log`,ku],[`exp`,Au],[`rand`,ju],[`srand`,Mu],[`system`,Nu(`system`,`shell execution not allowed in sandboxed environment`)],[`close`,()=>0],[`fflush`,()=>0],[`systime`,Pu(`systime`)],[`mktime`,Pu(`mktime`)],[`strftime`,Pu(`strftime`)]])});function zu(e){return typeof e==`number`?e!==0:!(e===``||e===`0`)}function Bu(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Vu(e){return typeof e==`string`?e:String(e)}function Hu(e){if(typeof e==`number`)return!0;let t=String(e).trim();return t===``?!1:!Number.isNaN(Number(t))}function Uu(e,t){try{return R(e).test(t)}catch{return!1}}var Wu=S(()=>{Ss()});function Gu(e,t){return t===``?[]:e.FS===` `?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Ku(e,t){return t===0?e.line:t<0||t>e.fields.length?``:e.fields[t-1]??``}function qu(e,t,n){if(t===0)e.line=Vu(n),e.fields=Gu(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push(``);e.fields[t-1]=Vu(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function Ju(e,t){e.line=t,e.fields=Gu(e,t),e.NF=e.fields.length}function Yu(e,t){if(e.FS=t,t===` `)e.fieldSep=new bs(/\s+/);else try{e.fieldSep=R(t)}catch{e.fieldSep=R(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}}var Xu=S(()=>{Ss(),Wu()});function Zu(e,t){switch(t){case`FS`:return e.FS;case`OFS`:return e.OFS;case`ORS`:return e.ORS;case`OFMT`:return e.OFMT;case`NR`:return e.NR;case`NF`:return e.NF;case`FNR`:return e.FNR;case`FILENAME`:return e.FILENAME;case`RSTART`:return e.RSTART;case`RLENGTH`:return e.RLENGTH;case`SUBSEP`:return e.SUBSEP;case`ARGC`:return e.ARGC}return e.vars[t]??``}function Qu(e,t,n){switch(t){case`FS`:Yu(e,Vu(n));return;case`OFS`:e.OFS=Vu(n);return;case`ORS`:e.ORS=Vu(n);return;case`OFMT`:e.OFMT=Vu(n);return;case`NR`:e.NR=Math.floor(Bu(n));return;case`NF`:{let t=Math.floor(Bu(n));if(t<e.NF)e.fields=e.fields.slice(0,t),e.line=e.fields.join(e.OFS);else if(t>e.NF){for(;e.fields.length<t;)e.fields.push(``);e.line=e.fields.join(e.OFS)}e.NF=t;return}case`FNR`:e.FNR=Math.floor(Bu(n));return;case`FILENAME`:e.FILENAME=Vu(n);return;case`RSTART`:e.RSTART=Math.floor(Bu(n));return;case`RLENGTH`:e.RLENGTH=Math.floor(Bu(n));return;case`SUBSEP`:e.SUBSEP=Vu(n);return}e.vars[t]=n}function $u(e,t){let n=t,r=new Set,i=e.arrayAliases.get(n);for(;i!==void 0&&!r.has(n);)r.add(n),n=i,i=e.arrayAliases.get(n);return n}function ed(e,t,n){if(t===`ARGV`)return e.ARGV[n]??``;if(t===`ENVIRON`)return e.ENVIRON[n]??``;let r=$u(e,t);return e.arrays[r]?.[n]??``}function td(e,t,n,r){let i=$u(e,t);e.arrays[i]||(e.arrays[i]=Object.create(null)),e.arrays[i][n]=r}function nd(e,t,n){if(t===`ARGV`)return e.ARGV[n]!==void 0;if(t===`ENVIRON`)return e.ENVIRON[n]!==void 0;let r=$u(e,t);return e.arrays[r]?.[n]!==void 0}function rd(e,t,n){let r=$u(e,t);e.arrays[r]&&delete e.arrays[r][n]}function id(e,t){let n=$u(e,t);delete e.arrays[n]}var ad=S(()=>{Xu(),Wu()});function od(e){Od=e}function sd(e,t){dl(e.requireDefenseContext,`awk`,t)}function cd(e,t,n){return fl(e.requireDefenseContext,`awk`,t,n)}async function B(e,t){switch(sd(e,`expression evaluation`),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case`number`:return t.value;case`string`:return t.value;case`regex`:return+!!Uu(t.pattern,e.line);case`field`:return ld(e,t);case`variable`:return Zu(e,t.name);case`array_access`:return ud(e,t);case`binary`:return dd(e,t);case`unary`:return md(e,t);case`ternary`:return zu(await cd(e,`ternary condition evaluation`,()=>B(e,t.condition)))?await cd(e,`ternary consequent evaluation`,()=>B(e,t.consequent)):await cd(e,`ternary alternate evaluation`,()=>B(e,t.alternate));case`call`:return hd(e,t.name,t.args);case`assignment`:return _d(e,t);case`pre_increment`:return yd(e,t.operand);case`pre_decrement`:return bd(e,t.operand);case`post_increment`:return xd(e,t.operand);case`post_decrement`:return Sd(e,t.operand);case`in`:return Cd(e,t.key,t.array);case`getline`:return wd(e,t.variable,t.file,t.command);case`tuple`:return Dd(e,t.elements);default:return``}}async function ld(e,t){return sd(e,`field reference evaluation`),Ku(e,Math.floor(Bu(await cd(e,`field index evaluation`,()=>B(e,t.index)))))}async function ud(e,t){sd(e,`array access evaluation`);let n=Vu(await cd(e,`array key evaluation`,()=>B(e,t.key)));return ed(e,t.array,n)}async function dd(e,t){sd(e,`binary expression evaluation`);let n=t.operator;if(n===`||`)return zu(await cd(e,`logical-or left evaluation`,()=>B(e,t.left)))||zu(await cd(e,`logical-or right evaluation`,()=>B(e,t.right)))?1:0;if(n===`&&`)return zu(await cd(e,`logical-and left evaluation`,()=>B(e,t.left)))&&zu(await cd(e,`logical-and right evaluation`,()=>B(e,t.right)))?1:0;if(n===`~`){let n=await cd(e,`regex left evaluation`,()=>B(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:Vu(await cd(e,`regex right evaluation`,()=>B(e,t.right)));try{return+!!R(r).test(Vu(n))}catch{return 0}}if(n===`!~`){let n=await cd(e,`negated-regex left evaluation`,()=>B(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:Vu(await cd(e,`negated-regex right evaluation`,()=>B(e,t.right)));try{return+!R(r).test(Vu(n))}catch{return 1}}let r=await cd(e,`binary left evaluation`,()=>B(e,t.left)),i=await cd(e,`binary right evaluation`,()=>B(e,t.right));if(n===` `){let t=Vu(r)+Vu(i);if(e.maxOutputSize>0&&t.length>e.maxOutputSize)throw new k(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output);return t}return fd(n)?pd(r,i,n):ru(Bu(r),Bu(i),n)}function fd(e){return[`<`,`<=`,`>`,`>=`,`==`,`!=`].includes(e)}function pd(e,t,n){let r=Hu(e),i=Hu(t);if(r&&i){let r=Bu(e),i=Bu(t);switch(n){case`<`:return+(r<i);case`<=`:return+(r<=i);case`>`:return+(r>i);case`>=`:return+(r>=i);case`==`:return+(r===i);case`!=`:return r===i?0:1}}let a=Vu(e),o=Vu(t);switch(n){case`<`:return+(a<o);case`<=`:return+(a<=o);case`>`:return+(a>o);case`>=`:return+(a>=o);case`==`:return+(a===o);case`!=`:return a===o?0:1}return 0}async function md(e,t){sd(e,`unary expression evaluation`);let n=await cd(e,`unary operand evaluation`,()=>B(e,t.operand));switch(t.operator){case`!`:return+!zu(n);case`-`:return-Bu(n);case`+`:return+Bu(n);default:return n}}async function hd(e,t,n){sd(e,`function call evaluation`);let r=Lu.get(t);if(r)return r(n,e,{evalExpr:t=>B(e,t)});let i=e.functions.get(t);return i?gd(e,i,n):``}async function gd(e,t,n){if(sd(e,`user function call`),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new k(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,`recursion`,e.output);let r=Object.create(null);for(let n of t.params)r[n]=e.vars[n];let i=[];for(let r=0;r<t.params.length;r++){let a=t.params[r];if(r<n.length){let t=n[r];t.type===`variable`&&(e.arrayAliases.set(a,t.name),i.push(a));let o=await cd(e,`user function argument evaluation`,()=>B(e,t));e.vars[a]=o}else e.vars[a]=``}e.hasReturn=!1,e.returnValue=void 0;let a=Od;a&&await cd(e,`user function body execution`,()=>a(e,t.body.statements));let o=e.returnValue??``;for(let n of t.params)r[n]===void 0?delete e.vars[n]:e.vars[n]=r[n];for(let t of i)e.arrayAliases.delete(t);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function _d(e,t){sd(e,`assignment evaluation`);let n=await cd(e,`assignment value evaluation`,()=>B(e,t.value)),r=t.target,i=t.operator,a;if(i===`=`)a=n;else{let t;if(r.type===`field`)t=Ku(e,Math.floor(Bu(await cd(e,`assignment field index`,()=>B(e,r.index)))));else if(r.type===`variable`)t=Zu(e,r.name);else{let n=Vu(await cd(e,`assignment array key`,()=>B(e,r.key)));t=ed(e,r.array,n)}let o=Bu(t),s=Bu(n);switch(i){case`+=`:a=o+s;break;case`-=`:a=o-s;break;case`*=`:a=o*s;break;case`/=`:a=s===0?0:o/s;break;case`%=`:a=s===0?0:o%s;break;case`^=`:a=o**s;break;default:a=n}}if(r.type===`field`)qu(e,Math.floor(Bu(await cd(e,`assignment target field index`,()=>B(e,r.index)))),a);else if(r.type===`variable`)Qu(e,r.name,a);else{let t=Vu(await cd(e,`assignment target array key`,()=>B(e,r.key)));td(e,r.array,t,a)}return a}async function vd(e,t,n,r){sd(e,`inc/dec evaluation`);let i;if(t.type===`field`){let r=Math.floor(Bu(await cd(e,`inc/dec field index`,()=>B(e,t.index))));i=Bu(Ku(e,r)),qu(e,r,i+n)}else if(t.type===`variable`)i=Bu(Zu(e,t.name)),Qu(e,t.name,i+n);else{let r=Vu(await cd(e,`inc/dec array key`,()=>B(e,t.key)));i=Bu(ed(e,t.array,r)),td(e,t.array,r,i+n)}return r?i+n:i}async function yd(e,t){return vd(e,t,1,!0)}async function bd(e,t){return vd(e,t,-1,!0)}async function xd(e,t){return vd(e,t,1,!1)}async function Sd(e,t){return vd(e,t,-1,!1)}async function Cd(e,t,n){sd(e,`in-expression evaluation`);let r;if(t.type===`tuple`){e.coverage?.hit(`awk:expr:tuple`);let n=[];for(let r of t.elements)n.push(Vu(await cd(e,`tuple key element evaluation`,()=>B(e,r))));r=n.join(e.SUBSEP)}else r=Vu(await cd(e,`in-expression key evaluation`,()=>B(e,t)));return+!!nd(e,n,r)}async function wd(e,t,n,r){if(sd(e,`getline evaluation`),r)return Td(e,t,r);if(n)return Ed(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let i=e.lineIndex+1;if(i>=e.lines.length)return 0;let a=e.lines[i];return t?Qu(e,t,a):Ju(e,a),e.NR++,e.lineIndex=i,1}async function Td(e,t,n){let r=e.exec;if(!r)return-1;sd(e,`getline command source`);let i=Vu(await cd(e,`getline command expression`,()=>B(e,n))),a=`__cmd_${i}`,o=`__cmdi_${i}`,s,c;if(e.vars[a]===void 0)try{s=(await cd(e,`getline command exec`,()=>r(i))).stdout.split(`
406
- `),s.length>0&&s[s.length-1]===``&&s.pop(),e.vars[a]=JSON.stringify(s),e.vars[o]=-1,c=-1}catch(e){if(e instanceof w)throw e;return-1}else s=JSON.parse(e.vars[a]),c=e.vars[o];let l=c+1;if(l>=s.length)return 0;let u=s[l];return e.vars[o]=l,t?Qu(e,t,u):Ju(e,u),1}async function Ed(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;sd(e,`getline file source`);let i=Vu(await cd(e,`getline filename evaluation`,()=>B(e,n)));if(i===`/dev/null`)return 0;let a=r.resolvePath(e.cwd,i),o=`__fc_${a}`,s=`__fi_${a}`,c,l;if(e.vars[o]===void 0)try{c=(await cd(e,`getline file read`,()=>r.readFile(a))).split(`
407
- `),c.length>0&&c[c.length-1]===``&&c.pop(),e.vars[o]=JSON.stringify(c),e.vars[s]=-1,l=-1}catch(e){if(e instanceof w)throw e;return-1}else c=JSON.parse(e.vars[o]),l=e.vars[s];let u=l+1;if(u>=c.length)return 0;let d=c[u];return e.vars[s]=u,t?Qu(e,t,d):Ju(e,d),1}async function Dd(e,t){if(sd(e,`tuple evaluation`),t.length===0)return``;for(let n=0;n<t.length-1;n++)await cd(e,`tuple intermediate element`,()=>B(e,t[n]));return cd(e,`tuple final element`,()=>B(e,t[t.length-1]))}var Od,kd=S(()=>{A(),Ss(),pl(),ir(),iu(),Ru(),Xu(),Wu(),ad(),Od=null});function Ad(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new k(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output)}function jd(e,t){dl(e.requireDefenseContext,`awk`,t)}function V(e,t,n){return fl(e.requireDefenseContext,`awk`,t,n)}async function Md(e,t){jd(e,`block execution`);for(let n of t)if(await V(e,`statement execution`,()=>Pd(e,n)),Nd(e))break}function Nd(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Pd(e,t){switch(jd(e,`single statement execution`),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case`block`:await V(e,`nested block statement`,()=>Md(e,t.statements));break;case`expr_stmt`:await V(e,`expression statement`,()=>B(e,t.expression));break;case`print`:await V(e,`print statement`,()=>Fd(e,t.args,t.output));break;case`printf`:await V(e,`printf statement`,()=>Id(e,t.format,t.args,t.output));break;case`if`:await V(e,`if statement`,()=>Rd(e,t));break;case`while`:await V(e,`while statement`,()=>zd(e,t));break;case`do_while`:await V(e,`do-while statement`,()=>Bd(e,t));break;case`for`:await V(e,`for statement`,()=>Vd(e,t));break;case`for_in`:await V(e,`for-in statement`,()=>Hd(e,t));break;case`break`:e.loopBreak=!0;break;case`continue`:e.loopContinue=!0;break;case`next`:e.shouldNext=!0;break;case`nextfile`:e.shouldNextFile=!0;break;case`exit`:e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(Bu(await V(e,`exit code expression`,()=>B(e,n)))):0}break;case`return`:e.hasReturn=!0;{let n=t.value;e.returnValue=n?await V(e,`return expression`,()=>B(e,n)):``}break;case`delete`:await V(e,`delete statement`,()=>Ud(e,t.target));break}}async function Fd(e,t,n){jd(e,`print execution`);let r=[];for(let n of t){let t=await V(e,`print argument evaluation`,()=>B(e,n));typeof t==`number`?Number.isInteger(t)&&Math.abs(t)<2**53-1?r.push(String(t)):r.push(Fu(e.OFMT,[t])):r.push(Vu(t))}let i=r.join(e.OFS)+e.ORS;n?await V(e,`print redirection write`,()=>Ld(e,n.redirect,n.file,i)):(e.output+=i,Ad(e))}async function Id(e,t,n,r){jd(e,`printf execution`);let i=Vu(await V(e,`printf format evaluation`,()=>B(e,t))),a=[];for(let t of n)a.push(await V(e,`printf argument evaluation`,()=>B(e,t)));let o=Fu(i,a);r?await V(e,`printf redirection write`,()=>Ld(e,r.redirect,r.file,o)):(e.output+=o,Ad(e))}async function Ld(e,t,n,r){jd(e,`file write execution`);let i=e.fs;if(!i||!e.cwd){e.output+=r,Ad(e);return}let a=Vu(await V(e,`redirection filename evaluation`,()=>B(e,n))),o=i.resolvePath(e.cwd,a);t===`>`?e.openedFiles.has(o)?await V(e,`redirection append write`,()=>i.appendFile(o,r)):(await V(e,`redirection overwrite write`,()=>i.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await V(e,`redirection append mode write`,()=>i.appendFile(o,r)))}async function Rd(e,t){if(jd(e,`if execution`),zu(await V(e,`if condition evaluation`,()=>B(e,t.condition))))await V(e,`if consequent execution`,()=>Pd(e,t.consequent));else if(t.alternate){let n=t.alternate;await V(e,`if alternate execution`,()=>Pd(e,n))}}async function zd(e,t){jd(e,`while execution`);let n=0;for(;zu(await V(e,`while condition evaluation`,()=>B(e,t.condition)));){if(n++,n>e.maxIterations)throw new k(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await V(e,`while body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Bd(e,t){jd(e,`do-while execution`);let n=0;do{if(n++,n>e.maxIterations)throw new k(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await V(e,`do-while body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(zu(await V(e,`do-while condition evaluation`,()=>B(e,t.condition))))}async function Vd(e,t){jd(e,`for execution`);let n=t.init,r=t.condition,i=t.update;n&&await V(e,`for init evaluation`,()=>B(e,n));let a=0;for(;!r||zu(await V(e,`for condition evaluation`,()=>B(e,r)));){if(a++,a>e.maxIterations)throw new k(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await V(e,`for body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;i&&await V(e,`for update evaluation`,()=>B(e,i))}}async function Hd(e,t){jd(e,`for-in execution`);let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await V(e,`for-in body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Ud(e,t){if(jd(e,`delete execution`),t.type===`array_access`){let n=Vu(await V(e,`delete key evaluation`,()=>B(e,t.key)));rd(e,t.array,n)}else t.type===`variable`&&id(e,t.name)}var Wd=S(()=>{A(),pl(),Ru(),kd(),Wu(),ad(),od(Md)}),Gd,Kd=S(()=>{pl(),kd(),Xu(),Wd(),Wu(),Gd=class{ctx;program=null;rangeStates=[];constructor(e){this.ctx=e}assertDefenseContext(e){dl(this.ctx.requireDefenseContext,`awk`,e)}withDefenseContext(e,t){return fl(this.ctx.requireDefenseContext,`awk`,e,t)}execute(e){this.assertDefenseContext(`program initialization`),this.program=e,this.ctx.output=``;for(let t of e.functions)this.ctx.functions.set(t.name,t);this.rangeStates=e.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext(`BEGIN execution entry`),this.program){for(let e of this.program.rules)if(e.pattern?.type===`begin`&&(await this.withDefenseContext(`BEGIN block execution`,()=>Md(this.ctx,e.action.statements)),this.ctx.shouldExit))break}}async executeLine(e){if(this.assertDefenseContext(`line execution entry`),!(!this.program||this.ctx.shouldExit)){Ju(this.ctx,e),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let e=0;e<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);e++){let t=this.program.rules[e];t.pattern?.type===`begin`||t.pattern?.type===`end`||await this.withDefenseContext(`rule match`,()=>this.matchesRule(t,e))&&await this.withDefenseContext(`rule block execution`,()=>Md(this.ctx,t.action.statements))}}}async executeEnd(){if(this.assertDefenseContext(`END execution entry`),this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let e of this.program.rules)if(e.pattern?.type===`end`&&(await this.withDefenseContext(`END block execution`,()=>Md(this.ctx,e.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(e,t){this.assertDefenseContext(`rule matching`);let n=e.pattern;if(!n)return!0;switch(n.type){case`begin`:case`end`:return!1;case`regex_pattern`:return Uu(n.pattern,this.ctx.line);case`expr_pattern`:return zu(await this.withDefenseContext(`expression pattern evaluation`,()=>B(this.ctx,n.expression)));case`range`:{let e=await this.withDefenseContext(`range start pattern`,()=>this.matchPattern(n.start)),r=await this.withDefenseContext(`range end pattern`,()=>this.matchPattern(n.end));return this.rangeStates[t]?(r&&(this.rangeStates[t]=!1),!0):e?(this.rangeStates[t]=!0,r&&(this.rangeStates[t]=!1),!0):!1}default:return!1}}async matchPattern(e){switch(this.assertDefenseContext(`pattern matching`),e.type){case`regex_pattern`:return Uu(e.pattern,this.ctx.line);case`expr_pattern`:return zu(await this.withDefenseContext(`nested expression pattern`,()=>B(this.ctx,e.expression)));default:return!1}}}}),qd=S(()=>{nu(),Kd()});function Jd(e){return e.replace(/\[\[:space:\]\]/g,`[ \\t\\n\\r\\f\\v]`).replace(/\[\[:blank:\]\]/g,`[ \\t]`).replace(/\[\[:alpha:\]\]/g,`[a-zA-Z]`).replace(/\[\[:digit:\]\]/g,`[0-9]`).replace(/\[\[:alnum:\]\]/g,`[a-zA-Z0-9]`).replace(/\[\[:upper:\]\]/g,`[A-Z]`).replace(/\[\[:lower:\]\]/g,`[a-z]`).replace(/\[\[:punct:\]\]/g,`[!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~]`).replace(/\[\[:xdigit:\]\]/g,`[0-9A-Fa-f]`).replace(/\[\[:graph:\]\]/g,`[!-~]`).replace(/\[\[:print:\]\]/g,`[ -~]`).replace(/\[\[:cntrl:\]\]/g,`[\\x00-\\x1f\\x7f]`)}var H,Yd,Xd,Zd=S(()=>{(function(e){e.NUMBER=`NUMBER`,e.STRING=`STRING`,e.REGEX=`REGEX`,e.IDENT=`IDENT`,e.BEGIN=`BEGIN`,e.END=`END`,e.IF=`IF`,e.ELSE=`ELSE`,e.WHILE=`WHILE`,e.DO=`DO`,e.FOR=`FOR`,e.IN=`IN`,e.BREAK=`BREAK`,e.CONTINUE=`CONTINUE`,e.NEXT=`NEXT`,e.NEXTFILE=`NEXTFILE`,e.EXIT=`EXIT`,e.RETURN=`RETURN`,e.DELETE=`DELETE`,e.FUNCTION=`FUNCTION`,e.PRINT=`PRINT`,e.PRINTF=`PRINTF`,e.GETLINE=`GETLINE`,e.PLUS=`PLUS`,e.MINUS=`MINUS`,e.STAR=`STAR`,e.SLASH=`SLASH`,e.PERCENT=`PERCENT`,e.CARET=`CARET`,e.EQ=`EQ`,e.NE=`NE`,e.LT=`LT`,e.GT=`GT`,e.LE=`LE`,e.GE=`GE`,e.MATCH=`MATCH`,e.NOT_MATCH=`NOT_MATCH`,e.AND=`AND`,e.OR=`OR`,e.NOT=`NOT`,e.ASSIGN=`ASSIGN`,e.PLUS_ASSIGN=`PLUS_ASSIGN`,e.MINUS_ASSIGN=`MINUS_ASSIGN`,e.STAR_ASSIGN=`STAR_ASSIGN`,e.SLASH_ASSIGN=`SLASH_ASSIGN`,e.PERCENT_ASSIGN=`PERCENT_ASSIGN`,e.CARET_ASSIGN=`CARET_ASSIGN`,e.INCREMENT=`INCREMENT`,e.DECREMENT=`DECREMENT`,e.QUESTION=`QUESTION`,e.COLON=`COLON`,e.COMMA=`COMMA`,e.SEMICOLON=`SEMICOLON`,e.NEWLINE=`NEWLINE`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.LBRACKET=`LBRACKET`,e.RBRACKET=`RBRACKET`,e.DOLLAR=`DOLLAR`,e.APPEND=`APPEND`,e.PIPE=`PIPE`,e.EOF=`EOF`})(H||={}),Yd=new Map([[`BEGIN`,H.BEGIN],[`END`,H.END],[`if`,H.IF],[`else`,H.ELSE],[`while`,H.WHILE],[`do`,H.DO],[`for`,H.FOR],[`in`,H.IN],[`break`,H.BREAK],[`continue`,H.CONTINUE],[`next`,H.NEXT],[`nextfile`,H.NEXTFILE],[`exit`,H.EXIT],[`return`,H.RETURN],[`delete`,H.DELETE],[`function`,H.FUNCTION],[`print`,H.PRINT],[`printf`,H.PRINTF],[`getline`,H.GETLINE]]),Xd=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&(e.push(t),this.lastTokenType=t.type)}return e.push(this.makeToken(H.EOF,``)),e}makeToken(e,t){return{type:e,value:t,line:this.line,column:this.column}}peek(e=0){return this.input[this.pos+e]||``}advance(){let e=this.input[this.pos++]||``;return e===`
402
+ `,exitCode:k.EXIT_CODE};throw e}}},Gl={name:`sed`,flags:[{flag:`-n`,type:`boolean`},{flag:`-i`,type:`boolean`},{flag:`-E`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-e`,type:`value`,valueHint:`string`}],stdinType:`text`,needsArgs:!0}});function ql(e){return Object.assign(Object.create(null),Object.fromEntries(e))}function Jl(e,t){return Object.assign(Object.create(null),Object.fromEntries(e),t)}function Yl(...e){return Object.assign(Object.create(null),...e)}var Xl=S(()=>{});function Zl(e={}){let{fieldSep:t=eu,maxIterations:n=Ql,maxRecursionDepth:r=$l,maxOutputSize:i=0,fs:a,cwd:o,exec:s,coverage:c,requireDefenseContext:l}=e;return{FS:` `,OFS:` `,ORS:`
403
+ `,OFMT:`%.6g`,NR:0,NF:0,FNR:0,FILENAME:``,RSTART:0,RLENGTH:-1,SUBSEP:``,fields:[],line:``,vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:r,maxOutputSize:i,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:``,openedFiles:new Set,fs:a,cwd:o,exec:s,coverage:c,requireDefenseContext:l}}var Ql,$l,eu,tu=S(()=>{xs(),Ql=1e4,$l=100,eu=new ys(/\s+/)});function nu(e,t,n){switch(n){case`+`:return e+t;case`-`:return e-t;case`*`:return e*t;case`/`:return t===0?0:e/t;case`%`:return t===0?0:e%t;case`^`:case`**`:return e**t;default:return 0}}var ru=S(()=>{});function iu(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function au(e){return typeof e==`string`?e:String(e)}async function ou(e,t){if(e.type===`regex`)return e.pattern;let n=au(await t.evalExpr(e));return n.startsWith(`/`)&&n.endsWith(`/`)&&(n=n.slice(1,-1)),n}async function su(e,t){return e?e.type===`variable`?e.name:e.type===`field`?`$${Math.floor(iu(await t.evalExpr(e.index)))}`:`$0`:`$0`}function cu(e,t){if(e===`$0`)return t.line;if(e.startsWith(`$`)){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||``}return au(t.vars[e]??``)}function lu(e,t,n){if(e===`$0`)n.line=t,n.fields=n.FS===` `?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith(`$`)){let r=parseInt(e.slice(1),10)-1;for(;n.fields.length<=r;)n.fields.push(``);n.fields[r]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function uu(e,t,n){return e.length===0?t.line.length:au(await n.evalExpr(e[0])).length}async function du(e,t,n){if(e.length<2)return``;let r=au(await n.evalExpr(e[0])),i=Math.floor(iu(await n.evalExpr(e[1])))-1;if(e.length>=3){let t=Math.floor(iu(await n.evalExpr(e[2])));return r.substr(Math.max(0,i),t)}return r.substr(Math.max(0,i))}async function fu(e,t,n){if(e.length<2)return 0;let r=au(await n.evalExpr(e[0])),i=au(await n.evalExpr(e[1])),a=r.indexOf(i);return a===-1?0:a+1}async function pu(e,t,n){if(e.length<2)return 0;let r=au(await n.evalExpr(e[0])),i=e[1];if(i.type!==`variable`)return 0;let a=i.name,o=t.FS;if(e.length>=3){let t=e[2];if(t.type===`regex`)o=z(t.pattern);else{let e=au(await n.evalExpr(t));o=e===` `?z(`\\s+`):e}}else t.FS===` `&&(o=z(`\\s+`));let s=typeof o==`string`?r.split(o):o.split(r);t.arrays[a]=Object.create(null);for(let e=0;e<s.length;e++)t.arrays[a][String(e+1)]=s[e];return s.length}async function mu(e,t,n){if(e.length<2)return 0;let r=await ou(e[0],n),i=au(await n.evalExpr(e[1])),a=await su(e[2],n),o=cu(a,t);try{let e=z(r).replace(o,gu(i)),n=e===o?0:1;return lu(a,e,t),n}catch{return 0}}async function hu(e,t,n){if(e.length<2)return 0;let r=await ou(e[0],n),i=au(await n.evalExpr(e[1])),a=await su(e[2],n),o=cu(a,t);try{let e=z(r,`g`),n=e.match(o),s=n?n.length:0;return lu(a,e.replace(o,gu(i)),t),s}catch{return 0}}function gu(e){return t=>{let n=``,r=0;for(;r<e.length;)if(e[r]===`\\`&&r+1<e.length){let t=e[r+1];t===`&`?(n+=`&`,r+=2):t===`\\`?(n+=`\\`,r+=2):(n+=e[r+1],r+=2)}else e[r]===`&`?(n+=t,r++):(n+=e[r],r++);return n}}async function _u(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let r=au(await n.evalExpr(e[0])),i=await ou(e[1],n);try{let e=z(i).exec(r);if(e)return t.RSTART=e.index+1,t.RLENGTH=e[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function vu(e,t,n){if(e.length<3)return``;let r=await ou(e[0],n),i=au(await n.evalExpr(e[1])),a=au(await n.evalExpr(e[2])),o=e.length>=4?au(await n.evalExpr(e[3])):t.line;try{let e=a.toLowerCase()===`g`,t=e?0:parseInt(a,10)||1;if(e)return z(r,`g`).replace(o,(e,...t)=>yu(i,e,t.slice(0,-2)));{let e=0;return z(r,`g`).replace(o,(n,...r)=>(e++,e===t?yu(i,n,r.slice(0,-2)):n))}}catch{return o}}function yu(e,t,n){let r=``,i=0;for(;i<e.length;)if(e[i]===`\\`&&i+1<e.length){let a=e[i+1];if(a===`&`)r+=`&`,i+=2;else if(a===`0`)r+=t,i+=2;else if(a>=`1`&&a<=`9`){let e=parseInt(a,10)-1;r+=n[e]||``,i+=2}else a===`n`?(r+=`
404
+ `,i+=2):a===`t`?(r+=` `,i+=2):(r+=a,i+=2)}else e[i]===`&`?(r+=t,i++):(r+=e[i],i++);return r}async function bu(e,t,n){return e.length===0?``:au(await n.evalExpr(e[0])).toLowerCase()}async function xu(e,t,n){return e.length===0?``:au(await n.evalExpr(e[0])).toUpperCase()}async function Su(e,t,n){if(e.length===0)return``;let r=au(await n.evalExpr(e[0])),i=[];for(let t=1;t<e.length;t++)i.push(await n.evalExpr(e[t]));return Pu(r,i)}async function Cu(e,t,n){return e.length===0?0:Math.floor(iu(await n.evalExpr(e[0])))}async function wu(e,t,n){return e.length===0?0:Math.sqrt(iu(await n.evalExpr(e[0])))}async function Tu(e,t,n){return e.length===0?0:Math.sin(iu(await n.evalExpr(e[0])))}async function Eu(e,t,n){return e.length===0?0:Math.cos(iu(await n.evalExpr(e[0])))}async function Du(e,t,n){let r=e.length>0?iu(await n.evalExpr(e[0])):0,i=e.length>1?iu(await n.evalExpr(e[1])):0;return Math.atan2(r,i)}async function Ou(e,t,n){return e.length===0?0:Math.log(iu(await n.evalExpr(e[0])))}async function ku(e,t,n){return e.length===0?1:Math.exp(iu(await n.evalExpr(e[0])))}function Au(e,t,n){return t.random?t.random():Math.random()}async function ju(e,t,n){let r=e.length>0?iu(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=r,r}function Mu(e,t){return()=>{throw Error(`${e}() is not supported - ${t}`)}}function Nu(e){return()=>{throw Error(`function '${e}()' is not implemented`)}}function Pu(e,t){let n=0,r=``,i=0;for(;i<e.length;)if(e[i]===`%`&&i+1<e.length){let a=i+1,o=``,s=``,c=``,l,u=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>u&&e[a]===`$`?(l=parseInt(e.substring(u,a),10)-1,a++):a=u;let d=()=>{if(a<e.length){if(a+1<e.length&&(e[a]===`h`&&e[a+1]===`h`||e[a]===`l`&&e[a+1]===`l`)){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]===`*`){let e=t[n++],r=e===void 0?0:Math.floor(Number(e));r<0?(o+=`-`,s=String(Math.min(-r,Fu))):s=String(Math.min(r,Fu)),a++}else for(;a<e.length&&/\d/.test(e[a]);)s+=e[a++];if(s&&parseInt(s,10)>Fu&&(s=String(Fu)),e[a]===`.`){if(a++,e[a]===`*`){let e=t[n++];c=String(Math.min(e===void 0?0:Math.floor(Number(e)),Fu)),a++}else for(;a<e.length&&/\d/.test(e[a]);)c+=e[a++];c&&parseInt(c,10)>Fu&&(c=String(Fu))}d();let f=e[a],p=t[l===void 0?n:l];switch(f){case`s`:{let e=p===void 0?``:String(p);if(c&&(e=e.substring(0,parseInt(c,10))),s){let t=parseInt(s,10);e=o.includes(`-`)?e.padEnd(t):e.padStart(t)}r+=e,l===void 0&&n++;break}case`d`:case`i`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=e<0,i=Math.abs(e).toString();if(c){let e=parseInt(c,10);i=i.padStart(e,`0`)}let a=``;t?a=`-`:o.includes(`+`)?a=`+`:o.includes(` `)&&(a=` `);let u=a+i;if(s){let e=parseInt(s,10);u=o.includes(`-`)?u.padEnd(e):o.includes(`0`)&&!c?a+i.padStart(e-a.length,`0`):u.padStart(e)}r+=u,l===void 0&&n++;break}case`f`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toFixed(t);if(s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`e`:case`E`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e.toExponential(t);if(f===`E`&&(i=i.toUpperCase()),s){let e=parseInt(s,10);i=o.includes(`-`)?i.padEnd(e):i.padStart(e)}r+=i,l===void 0&&n++;break}case`g`:case`G`:{let e=p===void 0?0:Number(p);Number.isNaN(e)&&(e=0);let t=c?parseInt(c,10):6,i=e===0?0:Math.floor(Math.log10(Math.abs(e))),a;if(e===0?a=`0`:i<-4||i>=t?(a=e.toExponential(t-1),f===`G`&&(a=a.toUpperCase())):a=e.toPrecision(t),a.includes(`.`)&&(a=a.replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)),a.includes(`e`)&&(a=a.replace(/\.?0+e/,`e`)),s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):a.padStart(e)}r+=a,l===void 0&&n++;break}case`x`:case`X`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(16);if(f===`X`&&(t=t.toUpperCase()),c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`o`:{let e=p===void 0?0:Math.floor(Number(p));Number.isNaN(e)&&(e=0);let t=Math.abs(e).toString(8);if(c){let e=parseInt(c,10);t=t.padStart(e,`0`)}let i=e<0?`-`:``,a=i+t;if(s){let e=parseInt(s,10);a=o.includes(`-`)?a.padEnd(e):o.includes(`0`)&&!c?i+t.padStart(e-i.length,`0`):a.padStart(e)}r+=a,l===void 0&&n++;break}case`c`:typeof p==`number`?r+=String.fromCharCode(p):r+=String(p??``).charAt(0)||``,l===void 0&&n++;break;case`%`:r+=`%`;break;default:r+=e.substring(i,a+1)}i=a+1}else if(e[i]===`\\`&&i+1<e.length){let t=e[i+1];switch(t){case`n`:r+=`
405
+ `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;default:r+=t}i+=2}else r+=e[i++];return r}var Fu,Iu,Lu=S(()=>{xs(),Fu=1e4,Iu=new Map([[`length`,uu],[`substr`,du],[`index`,fu],[`split`,pu],[`sub`,mu],[`gsub`,hu],[`match`,_u],[`gensub`,vu],[`tolower`,bu],[`toupper`,xu],[`sprintf`,Su],[`int`,Cu],[`sqrt`,wu],[`sin`,Tu],[`cos`,Eu],[`atan2`,Du],[`log`,Ou],[`exp`,ku],[`rand`,Au],[`srand`,ju],[`system`,Mu(`system`,`shell execution not allowed in sandboxed environment`)],[`close`,()=>0],[`fflush`,()=>0],[`systime`,Nu(`systime`)],[`mktime`,Nu(`mktime`)],[`strftime`,Nu(`strftime`)]])});function Ru(e){return typeof e==`number`?e!==0:!(e===``||e===`0`)}function zu(e){if(typeof e==`number`)return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function Bu(e){return typeof e==`string`?e:String(e)}function Vu(e){if(typeof e==`number`)return!0;let t=String(e).trim();return t===``?!1:!Number.isNaN(Number(t))}function Hu(e,t){try{return z(e).test(t)}catch{return!1}}var Uu=S(()=>{xs()});function Wu(e,t){return t===``?[]:e.FS===` `?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Gu(e,t){return t===0?e.line:t<0||t>e.fields.length?``:e.fields[t-1]??``}function Ku(e,t,n){if(t===0)e.line=Bu(n),e.fields=Wu(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push(``);e.fields[t-1]=Bu(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function qu(e,t){e.line=t,e.fields=Wu(e,t),e.NF=e.fields.length}function Ju(e,t){if(e.FS=t,t===` `)e.fieldSep=new ys(/\s+/);else try{e.fieldSep=z(t)}catch{e.fieldSep=z(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}}var Yu=S(()=>{xs(),Uu()});function Xu(e,t){switch(t){case`FS`:return e.FS;case`OFS`:return e.OFS;case`ORS`:return e.ORS;case`OFMT`:return e.OFMT;case`NR`:return e.NR;case`NF`:return e.NF;case`FNR`:return e.FNR;case`FILENAME`:return e.FILENAME;case`RSTART`:return e.RSTART;case`RLENGTH`:return e.RLENGTH;case`SUBSEP`:return e.SUBSEP;case`ARGC`:return e.ARGC}return e.vars[t]??``}function Zu(e,t,n){switch(t){case`FS`:Ju(e,Bu(n));return;case`OFS`:e.OFS=Bu(n);return;case`ORS`:e.ORS=Bu(n);return;case`OFMT`:e.OFMT=Bu(n);return;case`NR`:e.NR=Math.floor(zu(n));return;case`NF`:{let t=Math.floor(zu(n));if(t<e.NF)e.fields=e.fields.slice(0,t),e.line=e.fields.join(e.OFS);else if(t>e.NF){for(;e.fields.length<t;)e.fields.push(``);e.line=e.fields.join(e.OFS)}e.NF=t;return}case`FNR`:e.FNR=Math.floor(zu(n));return;case`FILENAME`:e.FILENAME=Bu(n);return;case`RSTART`:e.RSTART=Math.floor(zu(n));return;case`RLENGTH`:e.RLENGTH=Math.floor(zu(n));return;case`SUBSEP`:e.SUBSEP=Bu(n);return}e.vars[t]=n}function Qu(e,t){let n=t,r=new Set,i=e.arrayAliases.get(n);for(;i!==void 0&&!r.has(n);)r.add(n),n=i,i=e.arrayAliases.get(n);return n}function $u(e,t,n){if(t===`ARGV`)return e.ARGV[n]??``;if(t===`ENVIRON`)return e.ENVIRON[n]??``;let r=Qu(e,t);return e.arrays[r]?.[n]??``}function ed(e,t,n,r){let i=Qu(e,t);e.arrays[i]||(e.arrays[i]=Object.create(null)),e.arrays[i][n]=r}function td(e,t,n){if(t===`ARGV`)return e.ARGV[n]!==void 0;if(t===`ENVIRON`)return e.ENVIRON[n]!==void 0;let r=Qu(e,t);return e.arrays[r]?.[n]!==void 0}function nd(e,t,n){let r=Qu(e,t);e.arrays[r]&&delete e.arrays[r][n]}function rd(e,t){let n=Qu(e,t);delete e.arrays[n]}var id=S(()=>{Yu(),Uu()});function ad(e){Dd=e}function od(e,t){ul(e.requireDefenseContext,`awk`,t)}function sd(e,t,n){return dl(e.requireDefenseContext,`awk`,t,n)}async function V(e,t){switch(od(e,`expression evaluation`),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case`number`:return t.value;case`string`:return t.value;case`regex`:return+!!Hu(t.pattern,e.line);case`field`:return cd(e,t);case`variable`:return Xu(e,t.name);case`array_access`:return ld(e,t);case`binary`:return ud(e,t);case`unary`:return pd(e,t);case`ternary`:return Ru(await sd(e,`ternary condition evaluation`,()=>V(e,t.condition)))?await sd(e,`ternary consequent evaluation`,()=>V(e,t.consequent)):await sd(e,`ternary alternate evaluation`,()=>V(e,t.alternate));case`call`:return md(e,t.name,t.args);case`assignment`:return gd(e,t);case`pre_increment`:return vd(e,t.operand);case`pre_decrement`:return yd(e,t.operand);case`post_increment`:return bd(e,t.operand);case`post_decrement`:return xd(e,t.operand);case`in`:return Sd(e,t.key,t.array);case`getline`:return Cd(e,t.variable,t.file,t.command);case`tuple`:return Ed(e,t.elements);default:return``}}async function cd(e,t){return od(e,`field reference evaluation`),Gu(e,Math.floor(zu(await sd(e,`field index evaluation`,()=>V(e,t.index)))))}async function ld(e,t){od(e,`array access evaluation`);let n=Bu(await sd(e,`array key evaluation`,()=>V(e,t.key)));return $u(e,t.array,n)}async function ud(e,t){od(e,`binary expression evaluation`);let n=t.operator;if(n===`||`)return Ru(await sd(e,`logical-or left evaluation`,()=>V(e,t.left)))||Ru(await sd(e,`logical-or right evaluation`,()=>V(e,t.right)))?1:0;if(n===`&&`)return Ru(await sd(e,`logical-and left evaluation`,()=>V(e,t.left)))&&Ru(await sd(e,`logical-and right evaluation`,()=>V(e,t.right)))?1:0;if(n===`~`){let n=await sd(e,`regex left evaluation`,()=>V(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:Bu(await sd(e,`regex right evaluation`,()=>V(e,t.right)));try{return+!!z(r).test(Bu(n))}catch{return 0}}if(n===`!~`){let n=await sd(e,`negated-regex left evaluation`,()=>V(e,t.left));t.right.type===`regex`&&e.coverage?.hit(`awk:expr:regex`);let r=t.right.type===`regex`?t.right.pattern:Bu(await sd(e,`negated-regex right evaluation`,()=>V(e,t.right)));try{return+!z(r).test(Bu(n))}catch{return 1}}let r=await sd(e,`binary left evaluation`,()=>V(e,t.left)),i=await sd(e,`binary right evaluation`,()=>V(e,t.right));if(n===` `){let t=Bu(r)+Bu(i);if(e.maxOutputSize>0&&t.length>e.maxOutputSize)throw new k(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output);return t}return dd(n)?fd(r,i,n):nu(zu(r),zu(i),n)}function dd(e){return[`<`,`<=`,`>`,`>=`,`==`,`!=`].includes(e)}function fd(e,t,n){let r=Vu(e),i=Vu(t);if(r&&i){let r=zu(e),i=zu(t);switch(n){case`<`:return+(r<i);case`<=`:return+(r<=i);case`>`:return+(r>i);case`>=`:return+(r>=i);case`==`:return+(r===i);case`!=`:return r===i?0:1}}let a=Bu(e),o=Bu(t);switch(n){case`<`:return+(a<o);case`<=`:return+(a<=o);case`>`:return+(a>o);case`>=`:return+(a>=o);case`==`:return+(a===o);case`!=`:return a===o?0:1}return 0}async function pd(e,t){od(e,`unary expression evaluation`);let n=await sd(e,`unary operand evaluation`,()=>V(e,t.operand));switch(t.operator){case`!`:return+!Ru(n);case`-`:return-zu(n);case`+`:return+zu(n);default:return n}}async function md(e,t,n){od(e,`function call evaluation`);let r=Iu.get(t);if(r)return r(n,e,{evalExpr:t=>V(e,t)});let i=e.functions.get(t);return i?hd(e,i,n):``}async function hd(e,t,n){if(od(e,`user function call`),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new k(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,`recursion`,e.output);let r=Object.create(null);for(let n of t.params)r[n]=e.vars[n];let i=[];for(let r=0;r<t.params.length;r++){let a=t.params[r];if(r<n.length){let t=n[r];t.type===`variable`&&(e.arrayAliases.set(a,t.name),i.push(a));let o=await sd(e,`user function argument evaluation`,()=>V(e,t));e.vars[a]=o}else e.vars[a]=``}e.hasReturn=!1,e.returnValue=void 0;let a=Dd;a&&await sd(e,`user function body execution`,()=>a(e,t.body.statements));let o=e.returnValue??``;for(let n of t.params)r[n]===void 0?delete e.vars[n]:e.vars[n]=r[n];for(let t of i)e.arrayAliases.delete(t);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function gd(e,t){od(e,`assignment evaluation`);let n=await sd(e,`assignment value evaluation`,()=>V(e,t.value)),r=t.target,i=t.operator,a;if(i===`=`)a=n;else{let t;if(r.type===`field`)t=Gu(e,Math.floor(zu(await sd(e,`assignment field index`,()=>V(e,r.index)))));else if(r.type===`variable`)t=Xu(e,r.name);else{let n=Bu(await sd(e,`assignment array key`,()=>V(e,r.key)));t=$u(e,r.array,n)}let o=zu(t),s=zu(n);switch(i){case`+=`:a=o+s;break;case`-=`:a=o-s;break;case`*=`:a=o*s;break;case`/=`:a=s===0?0:o/s;break;case`%=`:a=s===0?0:o%s;break;case`^=`:a=o**s;break;default:a=n}}if(r.type===`field`)Ku(e,Math.floor(zu(await sd(e,`assignment target field index`,()=>V(e,r.index)))),a);else if(r.type===`variable`)Zu(e,r.name,a);else{let t=Bu(await sd(e,`assignment target array key`,()=>V(e,r.key)));ed(e,r.array,t,a)}return a}async function _d(e,t,n,r){od(e,`inc/dec evaluation`);let i;if(t.type===`field`){let r=Math.floor(zu(await sd(e,`inc/dec field index`,()=>V(e,t.index))));i=zu(Gu(e,r)),Ku(e,r,i+n)}else if(t.type===`variable`)i=zu(Xu(e,t.name)),Zu(e,t.name,i+n);else{let r=Bu(await sd(e,`inc/dec array key`,()=>V(e,t.key)));i=zu($u(e,t.array,r)),ed(e,t.array,r,i+n)}return r?i+n:i}async function vd(e,t){return _d(e,t,1,!0)}async function yd(e,t){return _d(e,t,-1,!0)}async function bd(e,t){return _d(e,t,1,!1)}async function xd(e,t){return _d(e,t,-1,!1)}async function Sd(e,t,n){od(e,`in-expression evaluation`);let r;if(t.type===`tuple`){e.coverage?.hit(`awk:expr:tuple`);let n=[];for(let r of t.elements)n.push(Bu(await sd(e,`tuple key element evaluation`,()=>V(e,r))));r=n.join(e.SUBSEP)}else r=Bu(await sd(e,`in-expression key evaluation`,()=>V(e,t)));return+!!td(e,n,r)}async function Cd(e,t,n,r){if(od(e,`getline evaluation`),r)return wd(e,t,r);if(n)return Td(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let i=e.lineIndex+1;if(i>=e.lines.length)return 0;let a=e.lines[i];return t?Zu(e,t,a):qu(e,a),e.NR++,e.lineIndex=i,1}async function wd(e,t,n){let r=e.exec;if(!r)return-1;od(e,`getline command source`);let i=Bu(await sd(e,`getline command expression`,()=>V(e,n))),a=`__cmd_${i}`,o=`__cmdi_${i}`,s,c;if(e.vars[a]===void 0)try{s=(await sd(e,`getline command exec`,()=>r(i))).stdout.split(`
406
+ `),s.length>0&&s[s.length-1]===``&&s.pop(),e.vars[a]=JSON.stringify(s),e.vars[o]=-1,c=-1}catch(e){if(e instanceof w)throw e;return-1}else s=JSON.parse(e.vars[a]),c=e.vars[o];let l=c+1;if(l>=s.length)return 0;let u=s[l];return e.vars[o]=l,t?Zu(e,t,u):qu(e,u),1}async function Td(e,t,n){let r=e.fs;if(!r||!e.cwd)return-1;od(e,`getline file source`);let i=Bu(await sd(e,`getline filename evaluation`,()=>V(e,n)));if(i===`/dev/null`)return 0;let a=r.resolvePath(e.cwd,i),o=`__fc_${a}`,s=`__fi_${a}`,c,l;if(e.vars[o]===void 0)try{c=(await sd(e,`getline file read`,()=>r.readFile(a))).split(`
407
+ `),c.length>0&&c[c.length-1]===``&&c.pop(),e.vars[o]=JSON.stringify(c),e.vars[s]=-1,l=-1}catch(e){if(e instanceof w)throw e;return-1}else c=JSON.parse(e.vars[o]),l=e.vars[s];let u=l+1;if(u>=c.length)return 0;let d=c[u];return e.vars[s]=u,t?Zu(e,t,d):qu(e,d),1}async function Ed(e,t){if(od(e,`tuple evaluation`),t.length===0)return``;for(let n=0;n<t.length-1;n++)await sd(e,`tuple intermediate element`,()=>V(e,t[n]));return sd(e,`tuple final element`,()=>V(e,t[t.length-1]))}var Dd,Od=S(()=>{A(),xs(),fl(),ir(),ru(),Lu(),Yu(),Uu(),id(),Dd=null});function kd(e){if(e.maxOutputSize>0&&e.output.length>e.maxOutputSize)throw new k(`awk: output size limit exceeded (${e.maxOutputSize} bytes)`,`string_length`,e.output)}function Ad(e,t){ul(e.requireDefenseContext,`awk`,t)}function jd(e,t,n){return dl(e.requireDefenseContext,`awk`,t,n)}async function Md(e,t){Ad(e,`block execution`);for(let n of t)if(await jd(e,`statement execution`,()=>Pd(e,n)),Nd(e))break}function Nd(e){return e.shouldExit||e.shouldNext||e.shouldNextFile||e.loopBreak||e.loopContinue||e.hasReturn}async function Pd(e,t){switch(Ad(e,`single statement execution`),e.coverage?.hit(`awk:stmt:${t.type}`),t.type){case`block`:await jd(e,`nested block statement`,()=>Md(e,t.statements));break;case`expr_stmt`:await jd(e,`expression statement`,()=>V(e,t.expression));break;case`print`:await jd(e,`print statement`,()=>Fd(e,t.args,t.output));break;case`printf`:await jd(e,`printf statement`,()=>Id(e,t.format,t.args,t.output));break;case`if`:await jd(e,`if statement`,()=>Rd(e,t));break;case`while`:await jd(e,`while statement`,()=>zd(e,t));break;case`do_while`:await jd(e,`do-while statement`,()=>Bd(e,t));break;case`for`:await jd(e,`for statement`,()=>Vd(e,t));break;case`for_in`:await jd(e,`for-in statement`,()=>Hd(e,t));break;case`break`:e.loopBreak=!0;break;case`continue`:e.loopContinue=!0;break;case`next`:e.shouldNext=!0;break;case`nextfile`:e.shouldNextFile=!0;break;case`exit`:e.shouldExit=!0;{let n=t.code;e.exitCode=n?Math.floor(zu(await jd(e,`exit code expression`,()=>V(e,n)))):0}break;case`return`:e.hasReturn=!0;{let n=t.value;e.returnValue=n?await jd(e,`return expression`,()=>V(e,n)):``}break;case`delete`:await jd(e,`delete statement`,()=>Ud(e,t.target));break}}async function Fd(e,t,n){Ad(e,`print execution`);let r=[];for(let n of t){let t=await jd(e,`print argument evaluation`,()=>V(e,n));typeof t==`number`?Number.isInteger(t)&&Math.abs(t)<2**53-1?r.push(String(t)):r.push(Pu(e.OFMT,[t])):r.push(Bu(t))}let i=r.join(e.OFS)+e.ORS;n?await jd(e,`print redirection write`,()=>Ld(e,n.redirect,n.file,i)):(e.output+=i,kd(e))}async function Id(e,t,n,r){Ad(e,`printf execution`);let i=Bu(await jd(e,`printf format evaluation`,()=>V(e,t))),a=[];for(let t of n)a.push(await jd(e,`printf argument evaluation`,()=>V(e,t)));let o=Pu(i,a);r?await jd(e,`printf redirection write`,()=>Ld(e,r.redirect,r.file,o)):(e.output+=o,kd(e))}async function Ld(e,t,n,r){Ad(e,`file write execution`);let i=e.fs;if(!i||!e.cwd){e.output+=r,kd(e);return}let a=Bu(await jd(e,`redirection filename evaluation`,()=>V(e,n))),o=i.resolvePath(e.cwd,a);t===`>`?e.openedFiles.has(o)?await jd(e,`redirection append write`,()=>i.appendFile(o,r)):(await jd(e,`redirection overwrite write`,()=>i.writeFile(o,r)),e.openedFiles.add(o)):(e.openedFiles.has(o)||e.openedFiles.add(o),await jd(e,`redirection append mode write`,()=>i.appendFile(o,r)))}async function Rd(e,t){if(Ad(e,`if execution`),Ru(await jd(e,`if condition evaluation`,()=>V(e,t.condition))))await jd(e,`if consequent execution`,()=>Pd(e,t.consequent));else if(t.alternate){let n=t.alternate;await jd(e,`if alternate execution`,()=>Pd(e,n))}}async function zd(e,t){Ad(e,`while execution`);let n=0;for(;Ru(await jd(e,`while condition evaluation`,()=>V(e,t.condition)));){if(n++,n>e.maxIterations)throw new k(`awk: while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await jd(e,`while body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Bd(e,t){Ad(e,`do-while execution`);let n=0;do{if(n++,n>e.maxIterations)throw new k(`awk: do-while loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await jd(e,`do-while body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}while(Ru(await jd(e,`do-while condition evaluation`,()=>V(e,t.condition))))}async function Vd(e,t){Ad(e,`for execution`);let n=t.init,r=t.condition,i=t.update;n&&await jd(e,`for init evaluation`,()=>V(e,n));let a=0;for(;!r||Ru(await jd(e,`for condition evaluation`,()=>V(e,r)));){if(a++,a>e.maxIterations)throw new k(`awk: for loop exceeded maximum iterations (${e.maxIterations})`,`iterations`,e.output);if(e.loopContinue=!1,await jd(e,`for body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break;i&&await jd(e,`for update evaluation`,()=>V(e,i))}}async function Hd(e,t){Ad(e,`for-in execution`);let n=e.arrays[t.array];if(n)for(let r of Object.keys(n)){if(e.vars[t.variable]=r,e.loopContinue=!1,await jd(e,`for-in body execution`,()=>Pd(e,t.body)),e.loopBreak){e.loopBreak=!1;break}if(e.shouldExit||e.shouldNext||e.hasReturn)break}}async function Ud(e,t){if(Ad(e,`delete execution`),t.type===`array_access`){let n=Bu(await jd(e,`delete key evaluation`,()=>V(e,t.key)));nd(e,t.array,n)}else t.type===`variable`&&rd(e,t.name)}var Wd=S(()=>{A(),fl(),Lu(),Od(),Uu(),id(),ad(Md)}),Gd,Kd=S(()=>{fl(),Od(),Yu(),Wd(),Uu(),Gd=class{ctx;program=null;rangeStates=[];constructor(e){this.ctx=e}assertDefenseContext(e){ul(this.ctx.requireDefenseContext,`awk`,e)}withDefenseContext(e,t){return dl(this.ctx.requireDefenseContext,`awk`,e,t)}execute(e){this.assertDefenseContext(`program initialization`),this.program=e,this.ctx.output=``;for(let t of e.functions)this.ctx.functions.set(t.name,t);this.rangeStates=e.rules.map(()=>!1)}async executeBegin(){if(this.assertDefenseContext(`BEGIN execution entry`),this.program){for(let e of this.program.rules)if(e.pattern?.type===`begin`&&(await this.withDefenseContext(`BEGIN block execution`,()=>Md(this.ctx,e.action.statements)),this.ctx.shouldExit))break}}async executeLine(e){if(this.assertDefenseContext(`line execution entry`),!(!this.program||this.ctx.shouldExit)){qu(this.ctx,e),this.ctx.NR++,this.ctx.FNR++,this.ctx.shouldNext=!1;for(let e=0;e<this.program.rules.length&&!(this.ctx.shouldExit||this.ctx.shouldNext||this.ctx.shouldNextFile);e++){let t=this.program.rules[e];t.pattern?.type===`begin`||t.pattern?.type===`end`||await this.withDefenseContext(`rule match`,()=>this.matchesRule(t,e))&&await this.withDefenseContext(`rule block execution`,()=>Md(this.ctx,t.action.statements))}}}async executeEnd(){if(this.assertDefenseContext(`END execution entry`),this.program&&!this.ctx.inEndBlock){this.ctx.inEndBlock=!0,this.ctx.shouldExit=!1;for(let e of this.program.rules)if(e.pattern?.type===`end`&&(await this.withDefenseContext(`END block execution`,()=>Md(this.ctx,e.action.statements)),this.ctx.shouldExit))break;this.ctx.inEndBlock=!1}}getOutput(){return this.ctx.output}getExitCode(){return this.ctx.exitCode}getContext(){return this.ctx}async matchesRule(e,t){this.assertDefenseContext(`rule matching`);let n=e.pattern;if(!n)return!0;switch(n.type){case`begin`:case`end`:return!1;case`regex_pattern`:return Hu(n.pattern,this.ctx.line);case`expr_pattern`:return Ru(await this.withDefenseContext(`expression pattern evaluation`,()=>V(this.ctx,n.expression)));case`range`:{let e=await this.withDefenseContext(`range start pattern`,()=>this.matchPattern(n.start)),r=await this.withDefenseContext(`range end pattern`,()=>this.matchPattern(n.end));return this.rangeStates[t]?(r&&(this.rangeStates[t]=!1),!0):e?(this.rangeStates[t]=!0,r&&(this.rangeStates[t]=!1),!0):!1}default:return!1}}async matchPattern(e){switch(this.assertDefenseContext(`pattern matching`),e.type){case`regex_pattern`:return Hu(e.pattern,this.ctx.line);case`expr_pattern`:return Ru(await this.withDefenseContext(`nested expression pattern`,()=>V(this.ctx,e.expression)));default:return!1}}}}),qd=S(()=>{tu(),Kd()});function Jd(e){return e.replace(/\[\[:space:\]\]/g,`[ \\t\\n\\r\\f\\v]`).replace(/\[\[:blank:\]\]/g,`[ \\t]`).replace(/\[\[:alpha:\]\]/g,`[a-zA-Z]`).replace(/\[\[:digit:\]\]/g,`[0-9]`).replace(/\[\[:alnum:\]\]/g,`[a-zA-Z0-9]`).replace(/\[\[:upper:\]\]/g,`[A-Z]`).replace(/\[\[:lower:\]\]/g,`[a-z]`).replace(/\[\[:punct:\]\]/g,`[!"#$%&'()*+,\\-./:;<=>?@\\[\\]\\\\^_\`{|}~]`).replace(/\[\[:xdigit:\]\]/g,`[0-9A-Fa-f]`).replace(/\[\[:graph:\]\]/g,`[!-~]`).replace(/\[\[:print:\]\]/g,`[ -~]`).replace(/\[\[:cntrl:\]\]/g,`[\\x00-\\x1f\\x7f]`)}var H,Yd,Xd,Zd=S(()=>{(function(e){e.NUMBER=`NUMBER`,e.STRING=`STRING`,e.REGEX=`REGEX`,e.IDENT=`IDENT`,e.BEGIN=`BEGIN`,e.END=`END`,e.IF=`IF`,e.ELSE=`ELSE`,e.WHILE=`WHILE`,e.DO=`DO`,e.FOR=`FOR`,e.IN=`IN`,e.BREAK=`BREAK`,e.CONTINUE=`CONTINUE`,e.NEXT=`NEXT`,e.NEXTFILE=`NEXTFILE`,e.EXIT=`EXIT`,e.RETURN=`RETURN`,e.DELETE=`DELETE`,e.FUNCTION=`FUNCTION`,e.PRINT=`PRINT`,e.PRINTF=`PRINTF`,e.GETLINE=`GETLINE`,e.PLUS=`PLUS`,e.MINUS=`MINUS`,e.STAR=`STAR`,e.SLASH=`SLASH`,e.PERCENT=`PERCENT`,e.CARET=`CARET`,e.EQ=`EQ`,e.NE=`NE`,e.LT=`LT`,e.GT=`GT`,e.LE=`LE`,e.GE=`GE`,e.MATCH=`MATCH`,e.NOT_MATCH=`NOT_MATCH`,e.AND=`AND`,e.OR=`OR`,e.NOT=`NOT`,e.ASSIGN=`ASSIGN`,e.PLUS_ASSIGN=`PLUS_ASSIGN`,e.MINUS_ASSIGN=`MINUS_ASSIGN`,e.STAR_ASSIGN=`STAR_ASSIGN`,e.SLASH_ASSIGN=`SLASH_ASSIGN`,e.PERCENT_ASSIGN=`PERCENT_ASSIGN`,e.CARET_ASSIGN=`CARET_ASSIGN`,e.INCREMENT=`INCREMENT`,e.DECREMENT=`DECREMENT`,e.QUESTION=`QUESTION`,e.COLON=`COLON`,e.COMMA=`COMMA`,e.SEMICOLON=`SEMICOLON`,e.NEWLINE=`NEWLINE`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.LBRACKET=`LBRACKET`,e.RBRACKET=`RBRACKET`,e.DOLLAR=`DOLLAR`,e.APPEND=`APPEND`,e.PIPE=`PIPE`,e.EOF=`EOF`})(H||={}),Yd=new Map([[`BEGIN`,H.BEGIN],[`END`,H.END],[`if`,H.IF],[`else`,H.ELSE],[`while`,H.WHILE],[`do`,H.DO],[`for`,H.FOR],[`in`,H.IN],[`break`,H.BREAK],[`continue`,H.CONTINUE],[`next`,H.NEXT],[`nextfile`,H.NEXTFILE],[`exit`,H.EXIT],[`return`,H.RETURN],[`delete`,H.DELETE],[`function`,H.FUNCTION],[`print`,H.PRINT],[`printf`,H.PRINTF],[`getline`,H.GETLINE]]),Xd=class{input;pos=0;line=1;column=1;lastTokenType=null;constructor(e){this.input=e}tokenize(){let e=[];for(;this.pos<this.input.length;){let t=this.nextToken();t&&(e.push(t),this.lastTokenType=t.type)}return e.push(this.makeToken(H.EOF,``)),e}makeToken(e,t){return{type:e,value:t,line:this.line,column:this.column}}peek(e=0){return this.input[this.pos+e]||``}advance(){let e=this.input[this.pos++]||``;return e===`
408
408
  `?(this.line++,this.column=1):this.column++,e}skipWhitespace(){for(;this.pos<this.input.length;){let e=this.peek();if(e===` `||e===` `||e===`\r`)this.advance();else if(e===`\\`)if(this.peek(1)===`
409
409
  `)this.advance(),this.advance();else break;else if(e===`#`)for(;this.pos<this.input.length&&this.peek()!==`
410
410
  `;)this.advance();else break}}nextToken(){if(this.skipWhitespace(),this.pos>=this.input.length)return null;let e=this.line,t=this.column,n=this.peek();return n===`
@@ -412,9 +412,9 @@ Addresses:
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
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,`
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 R(`\\s+`);if(/[[\](){}.*+?^$|\\]/.test(e))try{return R(e)}catch{return R(vf(e))}return R(vf(e))}function vf(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var yf,bf,xf,Sf=S(()=>{Zl(),A(),Ss(),pl(),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){dl(t.requireDefenseContext,`awk`,`execution entry`);let n=(e,n)=>fl(t.requireDefenseContext,`awk`,e,n);if(E(e))return T(yf);let r=new bs(/\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
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
- `,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=Ql({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=Jl(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(`
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(`
418
418
  `);a.length>0&&a[a.length-1]===``&&a.pop(),e.push({filename:r,lines:a})}catch(e){if(e instanceof w)throw e;return{stdout:``,stderr:`awk: ${r}: No such file or directory
419
419
  `,exitCode:1}}else{let n=t.stdin.split(`
420
420
  `);n.length>0&&n[n.length-1]===``&&n.pop(),e.push({filename:``,lines:n})}for(let t of e){for(p.FILENAME=t.filename,p.FNR=0,p.lines=t.lines,p.lineIndex=-1,p.shouldNextFile=!1;p.lineIndex<t.lines.length-1;){p.lineIndex++;let e=p.lineIndex;if(await n(`line execution`,()=>m.executeLine(t.lines[e])),p.shouldExit||p.shouldNextFile)break}if(p.shouldExit)break}return await n(`END execution`,()=>m.executeEnd()),{stdout:m.getOutput(),stderr:``,exitCode:m.getExitCode()}}catch(e){if(e instanceof w)throw e;let t=e instanceof Error?e.message:String(e),n=e instanceof k?k.EXIT_CODE:2;return{stdout:m.getOutput(),stderr:`awk: ${t}
@@ -568,15 +568,15 @@ Try 'comm --help' for more information.
568
568
  `)&&r[r.length-1]===``&&r.pop(),r.filter(e=>e.length>0).map(e=>Lm(e,n.separator,t,n.ignoreCase))},s=o(a[0],n.field1),c=o(a[1],n.field2),l=new Map;for(let e of c){let t=l.get(e.joinKey);t?t.push(e):l.set(e.joinKey,[e])}let u=[],d=new Set;for(let e of s){let t=l.get(e.joinKey);if(t&&t.length>0){if(d.add(e.joinKey),n.onlyUnpairable.size===0)for(let r of t)u.push(Rm(e,r,n))}else (n.printUnpairable.has(1)||n.onlyUnpairable.has(1))&&u.push(Rm(e,null,n))}if(n.printUnpairable.has(2)||n.onlyUnpairable.has(2))for(let e of c)d.has(e.joinKey)||u.push(Rm(null,e,n));return{exitCode:0,stdout:u.length>0?`${u.join(`
569
569
  `)}
570
570
  `:``,stderr:``}}},Hm={name:`join`,flags:[{flag:`-1`,type:`value`,valueHint:`number`},{flag:`-2`,type:`value`,valueHint:`number`},{flag:`-t`,type:`value`,valueHint:`delimiter`},{flag:`-a`,type:`value`,valueHint:`number`},{flag:`-v`,type:`value`,valueHint:`number`},{flag:`-e`,type:`value`,valueHint:`string`},{flag:`-o`,type:`value`,valueHint:`format`},{flag:`-i`,type:`boolean`}],needsArgs:!0,minArgs:2}}),Wm={};C(Wm,{flagsForFuzzing:()=>Jm,teeCommand:()=>qm});var Gm,Km,qm,Jm,Ym=S(()=>{_r(),O(),Gm={name:`tee`,summary:`read from stdin and write to stdout and files`,usage:`tee [OPTION]... [FILE]...`,options:[`-a, --append append to the given FILEs, do not overwrite`,` --help display this help and exit`]},Km={append:{short:`a`,long:`append`,type:`boolean`}},qm={name:`tee`,async execute(e,t){if(E(e))return T(Gm);let n=gr(`tee`,e,Km);if(!n.ok)return n.error;let{append:r}=n.result.flags,i=n.result.positional,a=t.stdin,o=``,s=0;for(let e of i)try{let n=t.fs.resolvePath(t.cwd,e);r?await t.fs.appendFile(n,a):await t.fs.writeFile(n,a)}catch{o+=`tee: ${e}: No such file or directory
571
- `,s=1}return{stdout:a,stderr:o,exitCode:s}}},Jm={name:`tee`,flags:[{flag:`-a`,type:`boolean`}],stdinType:`text`,needsArgs:!0}});function Xm(e,t){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Cs(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let n=e.pattern,r=t.relativePath,i=n.split(`/`);for(let t=0;t<i.length-1;t++){let n=i[t];if(n&&n!==`.`&&n!==`..`&&!n.includes(`*`)&&!n.includes(`?`)&&!n.includes(`[`)){let t=`/${n}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let a=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let t=a[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:Cs(r,n,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let n=e.ignoreCase?`i`:``;return{matches:R(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType===`d`?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`empty`:return{matches:t.isEmpty,pruned:!1,printed:!1};case`mtime`:{let n=(Date.now()-t.mtime)/(1e3*60*60*24),r;return r=e.comparison===`more`?n>e.days:e.comparison===`less`?n<e.days:Math.floor(n)===e.days,{matches:r,pruned:!1,printed:!1}}case`newer`:{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case`size`:{let n=e.value;switch(e.unit){case`c`:n=e.value;break;case`k`:n=e.value*1024;break;case`M`:n=e.value*1024*1024;break;case`G`:n=e.value*1024*1024*1024;break;case`b`:n=e.value*512;break}let r;return r=e.comparison===`more`?t.size>n:e.comparison===`less`?t.size<n:e.unit===`b`?Math.ceil(t.size/512)===e.value:t.size===n,{matches:r,pruned:!1,printed:!1}}case`perm`:{let n=t.mode&511,r=e.mode&511,i;return i=e.matchType===`exact`?n===r:e.matchType===`all`?(n&r)===r:(n&r)!==0,{matches:i,pruned:!1,printed:!1}}case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let n=Xm(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case`and`:{let n=Xm(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=Xm(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case`or`:{let n=Xm(e.left,t);if(n.matches)return n;let r=Xm(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function Zm(e){if(!e)return!1;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!1;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!0;case`not`:return Zm(e.expr);case`and`:case`or`:return Zm(e.left)||Zm(e.right)}}function Qm(e){if(!e)return!1;switch(e.type){case`empty`:return!0;case`not`:return Qm(e.expr);case`and`:case`or`:return Qm(e.left)||Qm(e.right);default:return!1}}function $m(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=eh(e);if(th(e)&&n.length===1){let e=n[0].split(`/`).filter(e=>e.length>0);if(e.length>=2)for(let n=e.length-2;n>=0;n--){let r=e[n];if(!r.includes(`*`)&&!r.includes(`?`)&&!r.includes(`[`)&&r!==`.`&&r!==`..`){let i=e[n+1];if(i&&(i.includes(`*`)||i.includes(`?`))){t.terminalDirName=r;let e=i.match(/^\*(\.[a-zA-Z0-9]+)$/);e&&(t.requiredExtension=e[1])}break}}}return t}function eh(e){let t=[],n=e=>{e.type===`path`?t.push(e.pattern):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right))};return n(e),t}function th(e){let t=e=>e.type===`type`&&e.fileType===`f`?!0:e.type===`not`?t(e.expr):e.type===`and`||e.type===`or`?t(e.left)||t(e.right):!1;return t(e)}function nh(e){let t=[],n=e=>{e&&(e.type===`newer`?t.push(e.refPath):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right)))};return n(e),t}function rh(e){if(!e)return!0;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return rh(e.expr);case`and`:case`or`:return rh(e.left)&&rh(e.right)}}function ih(e,t,n,r,i){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Cs(t,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let t=e.pattern,r=t.split(`/`);for(let t=0;t<r.length-1;t++){let i=r[t];if(i&&i!==`.`&&i!==`..`&&!i.includes(`*`)&&!i.includes(`?`)&&!i.includes(`[`)){let t=`/${i}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let i=t.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let t=i[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:Cs(n,t,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let t=e.ignoreCase?`i`:``;return{matches:R(e.pattern,t).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:r,pruned:!1,printed:!1}:e.fileType===`d`?{matches:i,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let a=ih(e.expr,t,n,r,i);return{matches:!a.matches,pruned:a.pruned,printed:!1}}case`and`:{let a=ih(e.left,t,n,r,i);if(!a.matches)return{matches:!1,pruned:a.pruned,printed:!1};let o=ih(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:a.printed||o.printed}}case`or`:{let a=ih(e.left,t,n,r,i);if(a.matches)return a;let o=ih(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function ah(e){if(!e)return!1;switch(e.type){case`prune`:return!0;case`not`:return ah(e.expr);case`and`:case`or`:return ah(e.left)||ah(e.right);default:return!1}}function oh(e){switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return oh(e.expr);case`and`:case`or`:return oh(e.left)&&oh(e.right)}}function sh(e,t){return!e||!t.isDirectory?{shouldPrune:!1}:oh(e)?{shouldPrune:Xm(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned}:ch(e,t)}function ch(e,t){switch(e.type){case`or`:if(oh(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(Xm(e.left,n).pruned)return{shouldPrune:!0}}return ch(e.right,t);case`and`:if(oh(e.left)&&oh(e.right))return{shouldPrune:Xm(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned};if(oh(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return Xm(e.left,n).matches?ch(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1};case`not`:return{shouldPrune:!1};default:return{shouldPrune:!1}}}var lh=S(()=>{Ss(),Ds()});function uh(e,t){let n=[],r=[],i=t;for(;i<e.length;){let t=e[i];if(t===`(`||t===`\\(`){n.push({type:`lparen`}),i++;continue}if(t===`)`||t===`\\)`){n.push({type:`rparen`}),i++;continue}if(t===`-name`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i]}});else if(t===`-iname`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i],ignoreCase:!0}});else if(t===`-path`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i]}});else if(t===`-ipath`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i],ignoreCase:!0}});else if(t===`-regex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i]}});else if(t===`-iregex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i],ignoreCase:!0}});else if(t===`-type`&&i+1<e.length){let t=e[++i];if(t===`f`||t===`d`)n.push({type:`expr`,expr:{type:`type`,fileType:t}});else return{expr:null,pathIndex:i,error:`find: Unknown argument to -type: ${t}
571
+ `,s=1}return{stdout:a,stderr:o,exitCode:s}}},Jm={name:`tee`,flags:[{flag:`-a`,type:`boolean`}],stdinType:`text`,needsArgs:!0}});function Xm(e,t){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Ss(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let n=e.pattern,r=t.relativePath,i=n.split(`/`);for(let t=0;t<i.length-1;t++){let n=i[t];if(n&&n!==`.`&&n!==`..`&&!n.includes(`*`)&&!n.includes(`?`)&&!n.includes(`[`)){let t=`/${n}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let a=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let t=a[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:Ss(r,n,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let n=e.ignoreCase?`i`:``;return{matches:z(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType===`d`?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`empty`:return{matches:t.isEmpty,pruned:!1,printed:!1};case`mtime`:{let n=(Date.now()-t.mtime)/(1e3*60*60*24),r;return r=e.comparison===`more`?n>e.days:e.comparison===`less`?n<e.days:Math.floor(n)===e.days,{matches:r,pruned:!1,printed:!1}}case`newer`:{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case`size`:{let n=e.value;switch(e.unit){case`c`:n=e.value;break;case`k`:n=e.value*1024;break;case`M`:n=e.value*1024*1024;break;case`G`:n=e.value*1024*1024*1024;break;case`b`:n=e.value*512;break}let r;return r=e.comparison===`more`?t.size>n:e.comparison===`less`?t.size<n:e.unit===`b`?Math.ceil(t.size/512)===e.value:t.size===n,{matches:r,pruned:!1,printed:!1}}case`perm`:{let n=t.mode&511,r=e.mode&511,i;return i=e.matchType===`exact`?n===r:e.matchType===`all`?(n&r)===r:(n&r)!==0,{matches:i,pruned:!1,printed:!1}}case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let n=Xm(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case`and`:{let n=Xm(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=Xm(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case`or`:{let n=Xm(e.left,t);if(n.matches)return n;let r=Xm(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function Zm(e){if(!e)return!1;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!1;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!0;case`not`:return Zm(e.expr);case`and`:case`or`:return Zm(e.left)||Zm(e.right)}}function Qm(e){if(!e)return!1;switch(e.type){case`empty`:return!0;case`not`:return Qm(e.expr);case`and`:case`or`:return Qm(e.left)||Qm(e.right);default:return!1}}function $m(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=eh(e);if(th(e)&&n.length===1){let e=n[0].split(`/`).filter(e=>e.length>0);if(e.length>=2)for(let n=e.length-2;n>=0;n--){let r=e[n];if(!r.includes(`*`)&&!r.includes(`?`)&&!r.includes(`[`)&&r!==`.`&&r!==`..`){let i=e[n+1];if(i&&(i.includes(`*`)||i.includes(`?`))){t.terminalDirName=r;let e=i.match(/^\*(\.[a-zA-Z0-9]+)$/);e&&(t.requiredExtension=e[1])}break}}}return t}function eh(e){let t=[],n=e=>{e.type===`path`?t.push(e.pattern):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right))};return n(e),t}function th(e){let t=e=>e.type===`type`&&e.fileType===`f`?!0:e.type===`not`?t(e.expr):e.type===`and`||e.type===`or`?t(e.left)||t(e.right):!1;return t(e)}function nh(e){let t=[],n=e=>{e&&(e.type===`newer`?t.push(e.refPath):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right)))};return n(e),t}function rh(e){if(!e)return!0;switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return rh(e.expr);case`and`:case`or`:return rh(e.left)&&rh(e.right)}}function ih(e,t,n,r,i){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Ss(t,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let t=e.pattern,r=t.split(`/`);for(let t=0;t<r.length-1;t++){let i=r[t];if(i&&i!==`.`&&i!==`..`&&!i.includes(`*`)&&!i.includes(`?`)&&!i.includes(`[`)){let t=`/${i}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let i=t.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let t=i[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:Ss(n,t,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let t=e.ignoreCase?`i`:``;return{matches:z(e.pattern,t).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return e.fileType===`f`?{matches:r,pruned:!1,printed:!1}:e.fileType===`d`?{matches:i,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`prune`:return{matches:!0,pruned:!0,printed:!1};case`print`:return{matches:!0,pruned:!1,printed:!0};case`not`:{let a=ih(e.expr,t,n,r,i);return{matches:!a.matches,pruned:a.pruned,printed:!1}}case`and`:{let a=ih(e.left,t,n,r,i);if(!a.matches)return{matches:!1,pruned:a.pruned,printed:!1};let o=ih(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:a.printed||o.printed}}case`or`:{let a=ih(e.left,t,n,r,i);if(a.matches)return a;let o=ih(e.right,t,n,r,i);return{matches:o.matches,pruned:a.pruned||o.pruned,printed:o.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function ah(e){if(!e)return!1;switch(e.type){case`prune`:return!0;case`not`:return ah(e.expr);case`and`:case`or`:return ah(e.left)||ah(e.right);default:return!1}}function oh(e){switch(e.type){case`name`:case`path`:case`regex`:case`type`:case`prune`:case`print`:return!0;case`empty`:case`mtime`:case`newer`:case`size`:case`perm`:return!1;case`not`:return oh(e.expr);case`and`:case`or`:return oh(e.left)&&oh(e.right)}}function sh(e,t){return!e||!t.isDirectory?{shouldPrune:!1}:oh(e)?{shouldPrune:Xm(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned}:ch(e,t)}function ch(e,t){switch(e.type){case`or`:if(oh(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(Xm(e.left,n).pruned)return{shouldPrune:!0}}return ch(e.right,t);case`and`:if(oh(e.left)&&oh(e.right))return{shouldPrune:Xm(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned};if(oh(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return Xm(e.left,n).matches?ch(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1};case`not`:return{shouldPrune:!1};default:return{shouldPrune:!1}}}var lh=S(()=>{xs(),Es()});function uh(e,t){let n=[],r=[],i=t;for(;i<e.length;){let t=e[i];if(t===`(`||t===`\\(`){n.push({type:`lparen`}),i++;continue}if(t===`)`||t===`\\)`){n.push({type:`rparen`}),i++;continue}if(t===`-name`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i]}});else if(t===`-iname`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i],ignoreCase:!0}});else if(t===`-path`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i]}});else if(t===`-ipath`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i],ignoreCase:!0}});else if(t===`-regex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i]}});else if(t===`-iregex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i],ignoreCase:!0}});else if(t===`-type`&&i+1<e.length){let t=e[++i];if(t===`f`||t===`d`)n.push({type:`expr`,expr:{type:`type`,fileType:t}});else return{expr:null,pathIndex:i,error:`find: Unknown argument to -type: ${t}
572
572
  `,actions:[]}}else if(t===`-empty`)n.push({type:`expr`,expr:{type:`empty`}});else if(t===`-mtime`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`+`)?(r=`more`,a=t.slice(1)):t.startsWith(`-`)&&(r=`less`,a=t.slice(1));let o=parseInt(a,10);Number.isNaN(o)||n.push({type:`expr`,expr:{type:`mtime`,days:o,comparison:r}})}else if(t===`-newer`&&i+1<e.length){let t=e[++i];n.push({type:`expr`,expr:{type:`newer`,refPath:t}})}else if(t===`-size`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`+`)?(r=`more`,a=t.slice(1)):t.startsWith(`-`)&&(r=`less`,a=t.slice(1));let o=a.match(/^(\d+)([ckMGb])?$/);if(o){let e=parseInt(o[1],10),t=o[2]||`b`;n.push({type:`expr`,expr:{type:`size`,value:e,unit:t,comparison:r}})}}else if(t===`-perm`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`-`)?(r=`all`,a=t.slice(1)):t.startsWith(`/`)&&(r=`any`,a=t.slice(1));let o=parseInt(a,8);Number.isNaN(o)||n.push({type:`expr`,expr:{type:`perm`,mode:o,matchType:r}})}else if(t===`-prune`)n.push({type:`expr`,expr:{type:`prune`}});else if(t===`-not`||t===`!`)n.push({type:`not`});else if(t===`-o`||t===`-or`)n.push({type:`op`,op:`or`});else if(t===`-a`||t===`-and`)n.push({type:`op`,op:`and`});else if(t===`-maxdepth`||t===`-mindepth`)i++;else if(t!==`-depth`)if(t===`-exec`){let t=[];for(i++;i<e.length&&e[i]!==`;`&&e[i]!==`+`;)t.push(e[i]),i++;if(i>=e.length)return{expr:null,pathIndex:i,error:`find: missing argument to \`-exec'
573
573
  `,actions:[]};let n=e[i]===`+`;r.push({type:`exec`,command:t,batchMode:n})}else if(t===`-print`)n.push({type:`expr`,expr:{type:`print`}}),r.push({type:`print`});else if(t===`-print0`)r.push({type:`print0`});else if(t===`-printf`&&i+1<e.length){let t=e[++i];r.push({type:`printf`,format:t})}else if(t===`-delete`)r.push({type:`delete`});else{if(t.startsWith(`-`))return{expr:null,pathIndex:i,error:`find: unknown predicate '${t}'
574
- `,actions:[]};if(n.length===0){i++;continue}break}i++}if(n.length===0)return{expr:null,pathIndex:i,actions:r};let a=dh(n);return a.error?{expr:null,pathIndex:i,error:a.error,actions:r}:{expr:a.expr,pathIndex:i,actions:r}}function dh(e){let t=0;function n(){let n=r();if(!n)return null;for(;t<e.length;){let i=e[t];if(i.type===`op`&&i.op===`or`){t++;let e=r();if(!e)return n;n={type:`or`,left:n,right:e}}else break}return n}function r(){let n=i();if(!n)return null;for(;t<e.length;){let r=e[t];if(r.type===`op`&&r.op===`and`){t++;let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else if(r.type===`expr`||r.type===`not`||r.type===`lparen`){let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else break}return n}function i(){if(t<e.length&&e[t].type===`not`){t++;let e=i();return e?{type:`not`,expr:e}:null}return a()}function a(){if(t>=e.length)return null;let r=e[t];if(r.type===`lparen`){t++;let r=n();return t<e.length&&e[t].type===`rparen`&&t++,r}return r.type===`expr`?(t++,r.expr):(r.type,null)}return{expr:n()}}var fh=S(()=>{}),ph={};C(ph,{findCommand:()=>Sh,flagsForFuzzing:()=>Ch});function mh(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function hh(e,t,n){e({category:`find`,name:`summary`,durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function gh(e,t){let n=Jr(e),r=``,i=0;for(;i<n.length;)if(n[i]===`%`&&i+1<n.length){if(i++,n[i]===`%`){r+=`%`,i++;continue}let[e,a,o]=qr(n,i);if(i+=o,i>=n.length){r+=`%`;break}let s=n[i],c;switch(s){case`f`:c=t.name,i++;break;case`h`:{let e=t.path.lastIndexOf(`/`);c=e>0?t.path.slice(0,e):`.`,i++;break}case`p`:c=t.path,i++;break;case`P`:{let e=t.startingPoint;c=t.path===e?``:t.path.startsWith(`${e}/`)?t.path.slice(e.length+1):e===`.`&&t.path.startsWith(`./`)?t.path.slice(2):t.path,i++;break}case`s`:c=String(t.size),i++;break;case`d`:c=String(t.depth),i++;break;case`m`:c=(t.mode&511).toString(8),i++;break;case`M`:c=uo(t.mode,t.isDirectory),i++;break;case`t`:c=_h(new Date(t.mtime)),i++;break;case`T`:if(i+1<n.length){let e=n[i+1];c=vh(new Date(t.mtime),e),i+=2}else c=`%T`,i++;break;default:r+=`%${e!==0||a!==-1?`${e}.${a}`:``}${s}`,i++;continue}r+=Kr(c,e,a)}else r+=n[i],i++;return r}function _h(e){return`${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][e.getDay()]} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][e.getMonth()]} ${String(e.getDate()).padStart(2,` `)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)} ${e.getFullYear()}`}function vh(e,t){switch(t){case`@`:return String(e.getTime()/1e3);case`Y`:return String(e.getFullYear());case`m`:return String(e.getMonth()+1).padStart(2,`0`);case`d`:return String(e.getDate()).padStart(2,`0`);case`H`:return String(e.getHours()).padStart(2,`0`);case`M`:return String(e.getMinutes()).padStart(2,`0`);case`S`:return String(e.getSeconds()).padStart(2,`0`);case`T`:return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`;case`F`:return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;default:return`%T${t}`}}var yh,bh,xh,Sh,Ch,wh=S(()=>{Vc(),fo(),O(),Yr(),lh(),fh(),yh=500,bh={name:`find`,summary:`search for files in a directory hierarchy`,usage:`find [path...] [expression]`,options:`-name PATTERN file name matches shell pattern PATTERN.-iname PATTERN like -name but case insensitive.-path PATTERN file path matches shell pattern PATTERN.-ipath PATTERN like -path but case insensitive.-regex PATTERN file path matches regular expression PATTERN.-iregex PATTERN like -regex but case insensitive.-type TYPE file is of type: f (regular file), d (directory).-empty file is empty or directory is empty.-mtime N file's data was modified N*24 hours ago.-newer FILE file was modified more recently than FILE.-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks).-perm MODE file's permission bits are exactly MODE (octal).-perm -MODE all permission bits MODE are set.-perm /MODE any permission bits MODE are set.-maxdepth LEVELS descend at most LEVELS directories.-mindepth LEVELS do not apply tests at levels less than LEVELS.-depth process directory contents before directory itself.-prune do not descend into this directory.-not, ! negate the following expression.-a, -and logical AND (default).-o, -or logical OR.-exec CMD {} ; execute CMD on each file ({} is replaced by filename).-exec CMD {} + execute CMD with multiple files at once.-print print the full file name (default action).-print0 print the full file name followed by a null character.-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t.-delete delete found files/directories. --help display this help and exit`.split(`.`)},xh=new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-type`,`-maxdepth`,`-mindepth`,`-mtime`,`-newer`,`-size`,`-perm`]),Sh={name:`find`,async execute(e,t){if(E(e))return T(bh);let n=[],r=null,i=null,a=!1,o=!1;for(let t=0;t<e.length;t++){let s=e[t];if(s===`-maxdepth`&&t+1<e.length)o=!0,r=parseInt(e[++t],10);else if(s===`-mindepth`&&t+1<e.length)o=!0,i=parseInt(e[++t],10);else if(s===`-depth`)o=!0,a=!0;else if(s===`-exec`)for(o=!0,t++;t<e.length&&e[t]!==`;`&&e[t]!==`+`;)t++;else !s.startsWith(`-`)&&s!==`;`&&s!==`+`&&s!==`(`&&s!==`)`&&s!==`\\(`&&s!==`\\)`&&s!==`!`?o||n.push(s):xh.has(s)?(o=!0,t++):(s.startsWith(`-`)||s===`(`||s===`\\(`||s===`!`)&&(o=!0)}n.length===0&&n.push(`.`);let{expr:s,error:c,actions:l}=uh(e,0);if(c)return{stdout:``,stderr:c,exitCode:1};let u=l.some(e=>e.type===`print`),d=l.length===0,f=[],p=l.some(e=>e.type===`printf`),m=[],h=``,g=0,_=nh(s),v=new Map;for(let e of _){let n=t.fs.resolvePath(t.cwd,e);try{let r=await t.fs.stat(n);v.set(e,r.mtime?.getTime()??Date.now())}catch{}}let y=l.some(e=>{if(e.type!==`printf`)return!1;let t=e.format.replace(/%%/g,``);return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(t)}),ee=Zm(s)||y,te=Qm(s),ne=$m(s),b=ah(s),re=rh(s),x=typeof t.fs.readdirWithFileTypes==`function`;for(let e of n){let n=function(t){let n=i===null||t.depth>=i,r=!1;if(n&&s!==null){let e=Date.now(),i;i=re?ih(s,t.name,t.relativePath,t.isFile,t.isDirectory):Xm(s,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:t.isEmpty,mtime:t.stat?.mtime?.getTime()??Date.now(),size:t.stat?.size??0,mode:t.stat?.mode??420,newerRefTimes:v}),n=i.matches,r=u?i.printed:n,c.evalCalls++,c.evalTime+=Date.now()-e}else n&&(r=!0);return r?{print:!0,printfData:p?{path:t.relativePath,name:t.name,size:t.stat?.size??0,mtime:t.stat?.mtime?.getTime()??Date.now(),mode:t.stat?.mode??420,isDirectory:t.isDirectory,depth:t.depth,startingPoint:e}:null}:{print:!1,printfData:null}};e.length>1&&e.endsWith(`/`)&&(e=e.slice(0,-1));let o=t.fs.resolvePath(t.cwd,e);try{await t.fs.stat(o)}catch{h+=`find: ${e}: No such file or directory
574
+ `,actions:[]};if(n.length===0){i++;continue}break}i++}if(n.length===0)return{expr:null,pathIndex:i,actions:r};let a=dh(n);return a.error?{expr:null,pathIndex:i,error:a.error,actions:r}:{expr:a.expr,pathIndex:i,actions:r}}function dh(e){let t=0;function n(){let n=r();if(!n)return null;for(;t<e.length;){let i=e[t];if(i.type===`op`&&i.op===`or`){t++;let e=r();if(!e)return n;n={type:`or`,left:n,right:e}}else break}return n}function r(){let n=i();if(!n)return null;for(;t<e.length;){let r=e[t];if(r.type===`op`&&r.op===`and`){t++;let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else if(r.type===`expr`||r.type===`not`||r.type===`lparen`){let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else break}return n}function i(){if(t<e.length&&e[t].type===`not`){t++;let e=i();return e?{type:`not`,expr:e}:null}return a()}function a(){if(t>=e.length)return null;let r=e[t];if(r.type===`lparen`){t++;let r=n();return t<e.length&&e[t].type===`rparen`&&t++,r}return r.type===`expr`?(t++,r.expr):(r.type,null)}return{expr:n()}}var fh=S(()=>{}),ph={};C(ph,{findCommand:()=>Sh,flagsForFuzzing:()=>Ch});function mh(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function hh(e,t,n){e({category:`find`,name:`summary`,durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}function gh(e,t){let n=Jr(e),r=``,i=0;for(;i<n.length;)if(n[i]===`%`&&i+1<n.length){if(i++,n[i]===`%`){r+=`%`,i++;continue}let[e,a,o]=qr(n,i);if(i+=o,i>=n.length){r+=`%`;break}let s=n[i],c;switch(s){case`f`:c=t.name,i++;break;case`h`:{let e=t.path.lastIndexOf(`/`);c=e>0?t.path.slice(0,e):`.`,i++;break}case`p`:c=t.path,i++;break;case`P`:{let e=t.startingPoint;c=t.path===e?``:t.path.startsWith(`${e}/`)?t.path.slice(e.length+1):e===`.`&&t.path.startsWith(`./`)?t.path.slice(2):t.path,i++;break}case`s`:c=String(t.size),i++;break;case`d`:c=String(t.depth),i++;break;case`m`:c=(t.mode&511).toString(8),i++;break;case`M`:c=uo(t.mode,t.isDirectory),i++;break;case`t`:c=_h(new Date(t.mtime)),i++;break;case`T`:if(i+1<n.length){let e=n[i+1];c=vh(new Date(t.mtime),e),i+=2}else c=`%T`,i++;break;default:r+=`%${e!==0||a!==-1?`${e}.${a}`:``}${s}`,i++;continue}r+=Kr(c,e,a)}else r+=n[i],i++;return r}function _h(e){return`${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][e.getDay()]} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][e.getMonth()]} ${String(e.getDate()).padStart(2,` `)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)} ${e.getFullYear()}`}function vh(e,t){switch(t){case`@`:return String(e.getTime()/1e3);case`Y`:return String(e.getFullYear());case`m`:return String(e.getMonth()+1).padStart(2,`0`);case`d`:return String(e.getDate()).padStart(2,`0`);case`H`:return String(e.getHours()).padStart(2,`0`);case`M`:return String(e.getMinutes()).padStart(2,`0`);case`S`:return String(e.getSeconds()).padStart(2,`0`);case`T`:return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`;case`F`:return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;default:return`%T${t}`}}var yh,bh,xh,Sh,Ch,wh=S(()=>{Bc(),fo(),O(),Yr(),lh(),fh(),yh=500,bh={name:`find`,summary:`search for files in a directory hierarchy`,usage:`find [path...] [expression]`,options:`-name PATTERN file name matches shell pattern PATTERN.-iname PATTERN like -name but case insensitive.-path PATTERN file path matches shell pattern PATTERN.-ipath PATTERN like -path but case insensitive.-regex PATTERN file path matches regular expression PATTERN.-iregex PATTERN like -regex but case insensitive.-type TYPE file is of type: f (regular file), d (directory).-empty file is empty or directory is empty.-mtime N file's data was modified N*24 hours ago.-newer FILE file was modified more recently than FILE.-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks).-perm MODE file's permission bits are exactly MODE (octal).-perm -MODE all permission bits MODE are set.-perm /MODE any permission bits MODE are set.-maxdepth LEVELS descend at most LEVELS directories.-mindepth LEVELS do not apply tests at levels less than LEVELS.-depth process directory contents before directory itself.-prune do not descend into this directory.-not, ! negate the following expression.-a, -and logical AND (default).-o, -or logical OR.-exec CMD {} ; execute CMD on each file ({} is replaced by filename).-exec CMD {} + execute CMD with multiple files at once.-print print the full file name (default action).-print0 print the full file name followed by a null character.-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t.-delete delete found files/directories. --help display this help and exit`.split(`.`)},xh=new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-type`,`-maxdepth`,`-mindepth`,`-mtime`,`-newer`,`-size`,`-perm`]),Sh={name:`find`,async execute(e,t){if(E(e))return T(bh);let n=[],r=null,i=null,a=!1,o=!1;for(let t=0;t<e.length;t++){let s=e[t];if(s===`-maxdepth`&&t+1<e.length)o=!0,r=parseInt(e[++t],10);else if(s===`-mindepth`&&t+1<e.length)o=!0,i=parseInt(e[++t],10);else if(s===`-depth`)o=!0,a=!0;else if(s===`-exec`)for(o=!0,t++;t<e.length&&e[t]!==`;`&&e[t]!==`+`;)t++;else !s.startsWith(`-`)&&s!==`;`&&s!==`+`&&s!==`(`&&s!==`)`&&s!==`\\(`&&s!==`\\)`&&s!==`!`?o||n.push(s):xh.has(s)?(o=!0,t++):(s.startsWith(`-`)||s===`(`||s===`\\(`||s===`!`)&&(o=!0)}n.length===0&&n.push(`.`);let{expr:s,error:c,actions:l}=uh(e,0);if(c)return{stdout:``,stderr:c,exitCode:1};let u=l.some(e=>e.type===`print`),d=l.length===0,f=[],p=l.some(e=>e.type===`printf`),m=[],h=``,g=0,_=nh(s),v=new Map;for(let e of _){let n=t.fs.resolvePath(t.cwd,e);try{let r=await t.fs.stat(n);v.set(e,r.mtime?.getTime()??Date.now())}catch{}}let y=l.some(e=>{if(e.type!==`printf`)return!1;let t=e.format.replace(/%%/g,``);return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(t)}),ee=Zm(s)||y,te=Qm(s),ne=$m(s),b=ah(s),re=rh(s),x=typeof t.fs.readdirWithFileTypes==`function`;for(let e of n){let n=function(t){let n=i===null||t.depth>=i,r=!1;if(n&&s!==null){let e=Date.now(),i;i=re?ih(s,t.name,t.relativePath,t.isFile,t.isDirectory):Xm(s,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:t.isEmpty,mtime:t.stat?.mtime?.getTime()??Date.now(),size:t.stat?.size??0,mode:t.stat?.mode??420,newerRefTimes:v}),n=i.matches,r=u?i.printed:n,c.evalCalls++,c.evalTime+=Date.now()-e}else n&&(r=!0);return r?{print:!0,printfData:p?{path:t.relativePath,name:t.name,size:t.stat?.size??0,mtime:t.stat?.mtime?.getTime()??Date.now(),mode:t.stat?.mode??420,isDirectory:t.isDirectory,depth:t.depth,startingPoint:e}:null}:{print:!1,printfData:null}};e.length>1&&e.endsWith(`/`)&&(e=e.slice(0,-1));let o=t.fs.resolvePath(t.cwd,e);try{await t.fs.stat(o)}catch{h+=`find: ${e}: No such file or directory
575
575
  `,g=1;continue}let c=mh(),l=Date.now();async function d(n){let{path:i,depth:l,typeInfo:u}=n;if(c.nodeCount++,l>(r??256))return null;let d,f,p;if(u&&!ee)d=u.isFile,f=u.isDirectory;else{try{let e=Date.now();p=await t.fs.stat(i),c.statCalls++,c.statTime+=Date.now()-e}catch{return null}if(!p)return null;d=p.isFile,f=p.isDirectory}let m;m=i===o?e.split(`/`).pop()||e:i.split(`/`).pop()||``;let h=i===o?e:e===`.`?`./${i.slice(o===`/`?o.length:o.length+1)}`:e+i.slice(o.length),g=[],_=null,y=null,re=!1;f&&b&&!a&&(re=sh(s,{name:m,relativePath:h,isFile:d,isDirectory:f}).shouldPrune,re&&c.earlyPrunes++);let ie=l>=(r??256),ae=ne.terminalDirName!==null&&m===ne.terminalDirName,oe=!ie&&!ae&&!re;if(f&&(oe||te||ae)&&!re){let e=Date.now();if(x&&t.fs.readdirWithFileTypes){if(_=await t.fs.readdirWithFileTypes(i),y=_.map(e=>e.name),c.readdirCalls++,c.readdirTime+=Date.now()-e,oe)g=_.map((e,t)=>({path:i===`/`?`/${e.name}`:`${i}/${e.name}`,depth:l+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}));else if(ae){let e=ne.requiredExtension;g=_.filter(t=>t.isFile&&(!e||t.name.endsWith(e))).map((e,t)=>({path:i===`/`?`/${e.name}`:`${i}/${e.name}`,depth:l+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}))}}else y=await t.fs.readdir(i),c.readdirCalls++,c.readdirTime+=Date.now()-e,oe&&(g=y.map((e,t)=>({path:i===`/`?`/${e}`:`${i}/${e}`,depth:l+1,resultIndex:t})))}let se=d?(p?.size??0)===0:y!==null&&y.length===0,ce=re;if(!a&&s!==null&&!re&&b){let e=Date.now();ce=Xm(s,{name:m,relativePath:h,isFile:d,isDirectory:f,isEmpty:se,mtime:p?.mtime?.getTime()??Date.now(),size:p?.size??0,mode:p?.mode??420,newerRefTimes:v}).pruned,c.evalCalls++,c.evalTime+=Date.now()-e}return{relativePath:h,name:m,isFile:d,isDirectory:f,isEmpty:se,stat:p,depth:l,children:ce?[]:g,pruned:ce}}async function _(){let e={paths:[],printfData:[]};if(a){let t=function(e){let i={paths:[],printfData:[]},a=r[e];if(!a)return i;for(let e of a.childIndices){let n=t(e);i.paths.push(...n.paths),i.printfData.push(...n.printfData)}let{print:o,printfData:s}=n(a.node);return o&&(i.paths.push(a.node.relativePath),s&&i.printfData.push(s)),i},r=[],i=[{item:{path:o,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],a=new Map;for(;i.length>0;){let e=Date.now(),t=i.splice(0,yh),n=await Promise.all(t.map(e=>d(e.item)));c.batchCount++,c.batchTime+=Date.now()-e;for(let e=0;e<t.length;e++){let o=n[e],s=t[e];if(!o)continue;let c=r.length;if(s.parentIndex>=0){let e=a.get(s.parentIndex)||[];e.push(c),a.set(s.parentIndex,e)}r.push({node:o,parentIndex:s.parentIndex,childIndices:[]});for(let e=0;e<o.children.length;e++)i.push({item:o.children[e],parentIndex:c,childOrderInParent:e})}}for(let[e,t]of a)e>=0&&e<r.length&&(r[e].childIndices=t);if(r.length>0){let n=t(0);e.paths.push(...n.paths),e.printfData.push(...n.printfData)}}else{let t=function(n){let i=r.get(n);i&&(e.paths.push(i.path),i.printfData&&e.printfData.push(i.printfData));let a=s.get(n);if(a)for(let e of a)t(e)},r=new Map,i=0,a=[{item:{path:o,depth:0,resultIndex:0},orderIndex:i++}],s=new Map;for(;a.length>0;){let e=Date.now(),t=a.splice(0,yh),o=await Promise.all(t.map(async({item:e,orderIndex:t})=>{let n=await d(e);return n?{node:n,orderIndex:t}:null}));c.batchCount++,c.batchTime+=Date.now()-e;for(let e of o){if(!e)continue;let{node:t,orderIndex:o}=e,{print:c,printfData:l}=n(t);if(c&&r.set(o,{path:t.relativePath,printfData:l}),t.children.length>0){let e=[];for(let n of t.children){let t=i++;e.push(t),a.push({item:n,orderIndex:t})}s.set(o,e)}}}t(0)}return e}let y=await _();if(f.push(...y.paths),m.push(...y.printfData),t.trace){let n=Date.now()-l;hh(t.trace,c,n),t.trace({category:`find`,name:`searchPath`,durationMs:n,details:{path:e,resultsFound:y.paths.length}})}}let ie=``;if(l.length>0)for(let e of l)switch(e.type){case`print`:ie+=f.length>0?`${f.join(`
576
576
  `)}
577
577
  `:``;break;case`print0`:ie+=f.length>0?`${f.join(`\0`)}\0`:``;break;case`delete`:{let e=[...f].sort((e,t)=>t.length-e.length);for(let n of e){let e=t.fs.resolvePath(t.cwd,n);try{await t.fs.rm(e,{recursive:!1})}catch(e){let t=e instanceof Error?e.message:String(e);h+=`find: cannot delete '${n}': ${t}
578
578
  `,g=1}}break}case`printf`:for(let t of m)ie+=gh(e.format,t);break;case`exec`:if(!t.exec)return{stdout:``,stderr:`find: -exec not supported in this context
579
- `,exitCode:1};if(e.batchMode){let n=[];for(let t of e.command)t===`{}`?n.push(...f):n.push(t);let r=await t.exec(Bc([n[0]]),{cwd:t.cwd,signal:t.signal,args:n.slice(1)});ie+=r.stdout,h+=r.stderr,r.exitCode!==0&&(g=r.exitCode)}else for(let n of f){let r=e.command.map(e=>e===`{}`?n:e),i=await t.exec(Bc([r[0]]),{cwd:t.cwd,signal:t.signal,args:r.slice(1)});ie+=i.stdout,h+=i.stderr,i.exitCode!==0&&(g=i.exitCode)}break}else d&&(ie=f.length>0?`${f.join(`
579
+ `,exitCode:1};if(e.batchMode){let n=[];for(let t of e.command)t===`{}`?n.push(...f):n.push(t);let r=await t.exec(zc([n[0]]),{cwd:t.cwd,signal:t.signal,args:n.slice(1)});ie+=r.stdout,h+=r.stderr,r.exitCode!==0&&(g=r.exitCode)}else for(let n of f){let r=e.command.map(e=>e===`{}`?n:e),i=await t.exec(zc([r[0]]),{cwd:t.cwd,signal:t.signal,args:r.slice(1)});ie+=i.stdout,h+=i.stderr,i.exitCode!==0&&(g=i.exitCode)}break}else d&&(ie=f.length>0?`${f.join(`
580
580
  `)}
581
581
  `:``);return{stdout:ie,stderr:h,exitCode:g}}},Ch={name:`find`,flags:[{flag:`-name`,type:`value`,valueHint:`pattern`},{flag:`-iname`,type:`value`,valueHint:`pattern`},{flag:`-type`,type:`value`,valueHint:`string`},{flag:`-maxdepth`,type:`value`,valueHint:`number`},{flag:`-mindepth`,type:`value`,valueHint:`number`},{flag:`-empty`,type:`boolean`},{flag:`-print`,type:`boolean`},{flag:`-print0`,type:`boolean`}],needsFiles:!0}}),Th={};C(Th,{basenameCommand:()=>Dh,flagsForFuzzing:()=>Oh});var Eh,Dh,Oh,kh=S(()=>{O(),Eh={name:`basename`,summary:`strip directory and suffix from filenames`,usage:`basename NAME [SUFFIX]
582
582
  basename OPTION... NAME...`,options:[`-a, --multiple support multiple arguments`,`-s, --suffix=SUFFIX remove a trailing SUFFIX`,` --help display this help and exit`]},Dh={name:`basename`,async execute(e,t){if(E(e))return T(Eh);let n=!1,r=``,i=[];for(let t=0;t<e.length;t++){let a=e[t];a===`-a`||a===`--multiple`?n=!0:a===`-s`&&t+1<e.length?(r=e[++t],n=!0):a.startsWith(`--suffix=`)?(r=a.slice(9),n=!0):a.startsWith(`-`)||i.push(a)}if(i.length===0)return{stdout:``,stderr:`basename: missing operand
@@ -601,10 +601,10 @@ ${s} director${s===1?`y`:`ies`}`,r.directoriesOnly||(a+=`, ${c} file${c===1?``:`
601
601
  `)}catch{a.stderr=`du: cannot read directory '${n}': Permission denied
602
602
  `}return a}function Gh(e,t){return t?e<1024?`${e}`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`:String(Math.ceil(e/1024)||1)}var Kh,qh,Jh,Yh,Xh,Zh=S(()=>{_r(),vr(),O(),Kh={name:`du`,summary:`estimate file space usage`,usage:`du [OPTION]... [FILE]...`,options:[`-a write counts for all files, not just directories`,`-h print sizes in human readable format`,`-s display only a total for each argument`,`-c produce a grand total`,`--max-depth=N print total for directory only if N or fewer levels deep`,` --help display this help and exit`]},qh={allFiles:{short:`a`,type:`boolean`},humanReadable:{short:`h`,type:`boolean`},summarize:{short:`s`,type:`boolean`},grandTotal:{short:`c`,type:`boolean`},maxDepth:{long:`max-depth`,type:`number`}},Jh={name:`du`,async execute(e,t){if(E(e))return T(Kh);let n=gr(`du`,e,qh);if(!n.ok)return n.error;let r={allFiles:n.result.flags.allFiles,humanReadable:n.result.flags.humanReadable,summarize:n.result.flags.summarize,grandTotal:n.result.flags.grandTotal,maxDepth:n.result.flags.maxDepth??null},i=n.result.positional;i.length===0&&i.push(`.`);let a=``,o=``,s=0;for(let e of i){let n=t.fs.resolvePath(t.cwd,e);try{await t.fs.stat(n);let i=await Wh(t,n,e,r,0);a+=i.output,s+=i.totalSize,o+=i.stderr}catch{o+=`du: cannot access '${e}': No such file or directory
603
603
  `}}return r.grandTotal&&i.length>0&&(a+=`${Gh(s,r.humanReadable)} total
604
- `),{stdout:a,stderr:o,exitCode:+!!o}}},Yh=1e3,Xh={name:`du`,flags:[{flag:`-a`,type:`boolean`},{flag:`-h`,type:`boolean`},{flag:`-s`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`--max-depth`,type:`value`,valueHint:`number`}],needsFiles:!0}}),Qh={};C(Qh,{envCommand:()=>eg,flagsForFuzzing:()=>rg,printenvCommand:()=>ng,printenvFlagsForFuzzing:()=>ig});var $h,eg,tg,ng,rg,ig,ag=S(()=>{Zl(),O(),$h={name:`env`,summary:`run a program in a modified environment`,usage:`env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]`,options:[`-i, --ignore-environment start with an empty environment`,`-u NAME, --unset=NAME remove NAME from the environment`,` --help display this help and exit`]},eg={name:`env`,async execute(e,t){if(E(e))return T($h);let n=!1,r=[],i=new Map,a=-1;for(let t=0;t<e.length;t++){let o=e[t];if(o===`-i`||o===`--ignore-environment`)n=!0;else if(o===`-u`&&t+1<e.length)r.push(e[++t]);else if(o.startsWith(`-u`))r.push(o.slice(2));else if(o.startsWith(`--unset=`))r.push(o.slice(8));else{if(o.startsWith(`--`)&&o!==`--`)return D(`env`,o);if(o.startsWith(`-`)&&o!==`-`){for(let e of o.slice(1))if(e!==`i`&&e!==`u`)return D(`env`,`-${e}`);o.includes(`i`)&&(n=!0)}else if(o.includes(`=`)&&a===-1){let e=o.indexOf(`=`),t=o.slice(0,e),n=o.slice(e+1);i.set(t,n)}else{a=t;break}}}let o;if(n)o=new Map(i);else{o=new Map(t.env);for(let e of r)o.delete(e);for(let[e,t]of i)o.set(e,t)}if(a===-1){let e=[];for(let[t,n]of o)e.push(`${t}=${n}`);return{stdout:e.join(`
604
+ `),{stdout:a,stderr:o,exitCode:+!!o}}},Yh=1e3,Xh={name:`du`,flags:[{flag:`-a`,type:`boolean`},{flag:`-h`,type:`boolean`},{flag:`-s`,type:`boolean`},{flag:`-c`,type:`boolean`},{flag:`--max-depth`,type:`value`,valueHint:`number`}],needsFiles:!0}}),Qh={};C(Qh,{envCommand:()=>eg,flagsForFuzzing:()=>rg,printenvCommand:()=>ng,printenvFlagsForFuzzing:()=>ig});var $h,eg,tg,ng,rg,ig,ag=S(()=>{Xl(),O(),$h={name:`env`,summary:`run a program in a modified environment`,usage:`env [OPTION]... [NAME=VALUE]... [COMMAND [ARG]...]`,options:[`-i, --ignore-environment start with an empty environment`,`-u NAME, --unset=NAME remove NAME from the environment`,` --help display this help and exit`]},eg={name:`env`,async execute(e,t){if(E(e))return T($h);let n=!1,r=[],i=new Map,a=-1;for(let t=0;t<e.length;t++){let o=e[t];if(o===`-i`||o===`--ignore-environment`)n=!0;else if(o===`-u`&&t+1<e.length)r.push(e[++t]);else if(o.startsWith(`-u`))r.push(o.slice(2));else if(o.startsWith(`--unset=`))r.push(o.slice(8));else{if(o.startsWith(`--`)&&o!==`--`)return D(`env`,o);if(o.startsWith(`-`)&&o!==`-`){for(let e of o.slice(1))if(e!==`i`&&e!==`u`)return D(`env`,`-${e}`);o.includes(`i`)&&(n=!0)}else if(o.includes(`=`)&&a===-1){let e=o.indexOf(`=`),t=o.slice(0,e),n=o.slice(e+1);i.set(t,n)}else{a=t;break}}}let o;if(n)o=new Map(i);else{o=new Map(t.env);for(let e of r)o.delete(e);for(let[e,t]of i)o.set(e,t)}if(a===-1){let e=[];for(let[t,n]of o)e.push(`${t}=${n}`);return{stdout:e.join(`
605
605
  `)+(e.length>0?`
606
606
  `:``),stderr:``,exitCode:0}}if(!t.exec)return{stdout:``,stderr:`env: command execution not supported in this context
607
- `,exitCode:1};let s=e.slice(a);return t.exec(`command`,{cwd:t.cwd,env:Jl(o),replaceEnv:!0,stdin:t.stdin,signal:t.signal,args:s})}},tg={name:`printenv`,summary:`print all or part of environment`,usage:`printenv [OPTION]... [VARIABLE]...`,options:[` --help display this help and exit`]},ng={name:`printenv`,async execute(e,t){if(E(e))return T(tg);let n=e.filter(e=>!e.startsWith(`-`));if(n.length===0){let e=[];for(let[n,r]of t.env)e.push(`${n}=${r}`);return{stdout:e.join(`
607
+ `,exitCode:1};let s=e.slice(a);return t.exec(`command`,{cwd:t.cwd,env:ql(o),replaceEnv:!0,stdin:t.stdin,signal:t.signal,args:s})}},tg={name:`printenv`,summary:`print all or part of environment`,usage:`printenv [OPTION]... [VARIABLE]...`,options:[` --help display this help and exit`]},ng={name:`printenv`,async execute(e,t){if(E(e))return T(tg);let n=e.filter(e=>!e.startsWith(`-`));if(n.length===0){let e=[];for(let[n,r]of t.env)e.push(`${n}=${r}`);return{stdout:e.join(`
608
608
  `)+(e.length>0?`
609
609
  `:``),stderr:``,exitCode:0}}let r=[],i=0;for(let e of n){let n=t.env.get(e);n===void 0?i=1:r.push(n)}return{stdout:r.join(`
610
610
  `)+(r.length>0?`
@@ -614,24 +614,24 @@ ${s} director${s===1?`y`:`ies`}`,r.directoriesOnly||(a+=`, ${c} file${c===1?``:`
614
614
  `,exitCode:1}}else{let r=e.slice(0,n),i=e.slice(n+1);(i.startsWith(`'`)&&i.endsWith(`'`)||i.startsWith(`"`)&&i.endsWith(`"`))&&(i=i.slice(1,-1)),t.env.set(cg+r,i)}}return{stdout:``,stderr:``,exitCode:0}}},ug={name:`unalias`,async execute(e,t){if(E(e))return T({name:`unalias`,summary:`remove alias definitions`,usage:`unalias name [name ...]`,options:[`-a remove all aliases`,` --help display this help and exit`]});if(e.length===0)return{stdout:``,stderr:`unalias: usage: unalias [-a] name [name ...]
615
615
  `,exitCode:1};if(e[0]===`-a`){for(let e of t.env.keys())e.startsWith(cg)&&t.env.delete(e);return{stdout:``,stderr:``,exitCode:0}}let n=e[0]===`--`?e.slice(1):e,r=!1,i=``;for(let e of n){let n=cg+e;t.env.get(n)?t.env.delete(n):(i+=`unalias: ${e}: not found
616
616
  `,r=!0)}return{stdout:``,stderr:i,exitCode:+!!r}}},dg={name:`alias`,flags:[]},fg={name:`unalias`,flags:[{flag:`-a`,type:`boolean`}]}}),mg={};C(mg,{flagsForFuzzing:()=>vg,historyCommand:()=>_g});var hg,gg,_g,vg,yg=S(()=>{O(),hg={name:`history`,summary:`display command history`,usage:`history [n]`,options:[`-c clear the history list`,` --help display this help and exit`]},gg=`BASH_HISTORY`,_g={name:`history`,async execute(e,t){if(E(e))return T(hg);let n=t.env.get(gg)||`[]`,r;try{r=JSON.parse(n)}catch{r=[]}if(e[0]===`-c`)return t.env.set(gg,`[]`),{stdout:``,stderr:``,exitCode:0};let i=r.length;e[0]&&/^\d+$/.test(e[0])&&(i=Math.min(parseInt(e[0],10),r.length));let a=r.length-i,o=``;for(let e=a;e<r.length;e++){let t=(e+1).toString().padStart(5,` `);o+=`${t} ${r[e]}
617
- `}return{stdout:o,stderr:``,exitCode:0}}},vg={name:`history`,flags:[{flag:`-c`,type:`boolean`}]}}),bg={};C(bg,{flagsForFuzzing:()=>Cg,xargsCommand:()=>Sg});var xg,Sg,Cg,wg=S(()=>{Vc(),O(),xg={name:`xargs`,summary:`build and execute command lines from standard input`,usage:`xargs [OPTION]... [COMMAND [INITIAL-ARGS]]`,options:[`-I REPLACE replace occurrences of REPLACE with input`,`-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)`,`-n NUM use at most NUM arguments per command line`,`-P NUM run at most NUM processes at a time`,`-0, --null items are separated by null, not whitespace`,`-t, --verbose print commands before executing`,`-r, --no-run-if-empty do not run command if input is empty`,` --help display this help and exit`]},Sg={name:`xargs`,async execute(e,t){if(E(e))return T(xg);let n=null,r=null,i=null,a=null,o=!1,s=!1,c=0;for(let t=0;t<e.length;t++){let l=e[t];if(l===`-I`&&t+1<e.length)n=e[++t],c=t+1;else if(l===`-d`&&t+1<e.length)r=e[++t].replace(/\\n/g,`
617
+ `}return{stdout:o,stderr:``,exitCode:0}}},vg={name:`history`,flags:[{flag:`-c`,type:`boolean`}]}}),bg={};C(bg,{flagsForFuzzing:()=>Cg,xargsCommand:()=>Sg});var xg,Sg,Cg,wg=S(()=>{Bc(),O(),xg={name:`xargs`,summary:`build and execute command lines from standard input`,usage:`xargs [OPTION]... [COMMAND [INITIAL-ARGS]]`,options:[`-I REPLACE replace occurrences of REPLACE with input`,`-d DELIM use DELIM as input delimiter (e.g., -d '\\n' for newline)`,`-n NUM use at most NUM arguments per command line`,`-P NUM run at most NUM processes at a time`,`-0, --null items are separated by null, not whitespace`,`-t, --verbose print commands before executing`,`-r, --no-run-if-empty do not run command if input is empty`,` --help display this help and exit`]},Sg={name:`xargs`,async execute(e,t){if(E(e))return T(xg);let n=null,r=null,i=null,a=null,o=!1,s=!1,c=0;for(let t=0;t<e.length;t++){let l=e[t];if(l===`-I`&&t+1<e.length)n=e[++t],c=t+1;else if(l===`-d`&&t+1<e.length)r=e[++t].replace(/\\n/g,`
618
618
  `).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\0/g,`\0`).replace(/\\\\/g,`\\`),c=t+1;else if(l===`-n`&&t+1<e.length)i=parseInt(e[++t],10),c=t+1;else if(l===`-P`&&t+1<e.length)a=parseInt(e[++t],10),c=t+1;else if(l===`-0`||l===`--null`)o=!0,c=t+1;else if(l===`-t`||l===`--verbose`)s=!0,c=t+1;else if(l===`-r`||l===`--no-run-if-empty`)c=t+1;else{if(l.startsWith(`--`))return D(`xargs`,l);if(l.startsWith(`-`)&&l.length>1){for(let e of l.slice(1))if(!`0tr`.includes(e))return D(`xargs`,`-${e}`);l.includes(`0`)&&(o=!0),l.includes(`t`)&&(s=!0),l.includes(`r`),c=t+1}else if(!l.startsWith(`-`)){c=t;break}}}let l=e.slice(c);l.length===0&&l.push(`echo`);let u;if(u=o?t.stdin.split(`\0`).filter(e=>e.length>0):r===null?t.stdin.split(/\s+/).map(e=>e.trim()).filter(e=>e.length>0):t.stdin.replace(/\n$/,``).split(r).filter(e=>e.length>0),u.length===0)return{stdout:``,stderr:``,exitCode:0};let d=``,f=``,p=0,m=e=>/[\s"'\\$`!*?[\]{}();&|<>#]/.test(e)?`"${e.replace(/([\\"`$])/g,`\\$1`)}"`:e,h=async e=>{if(s){let t=e.map(m).join(` `);f+=`${t}
619
- `}return t.exec?t.exec(Bc([e[0]]),{cwd:t.cwd,signal:t.signal,args:e.slice(1)}):{stdout:`${e.map(m).join(` `)}
619
+ `}return t.exec?t.exec(zc([e[0]]),{cwd:t.cwd,signal:t.signal,args:e.slice(1)}):{stdout:`${e.map(m).join(` `)}
620
620
  `,stderr:``,exitCode:0}},g=async e=>{if(a!==null&&a>1)for(let t=0;t<e.length;t+=a){let n=e.slice(t,t+a),r=await Promise.all(n.map(h));for(let e of r)d+=e.stdout,f+=e.stderr,e.exitCode!==0&&(p=e.exitCode)}else for(let t of e){let e=await h(t);d+=e.stdout,f+=e.stderr,e.exitCode!==0&&(p=e.exitCode)}};if(n!==null)await g(u.map(e=>l.map(t=>t.replaceAll(n,e))));else if(i!==null){let e=[];for(let t=0;t<u.length;t+=i){let n=u.slice(t,t+i);e.push([...l,...n])}await g(e)}else{let e=await h([...l,...u]);d+=e.stdout,f+=e.stderr,p=e.exitCode}return{stdout:d,stderr:f,exitCode:p}}},Cg={name:`xargs`,flags:[{flag:`-I`,type:`value`,valueHint:`string`},{flag:`-d`,type:`value`,valueHint:`delimiter`},{flag:`-n`,type:`value`,valueHint:`number`},{flag:`-0`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-r`,type:`boolean`}],stdinType:`text`}}),Tg={};C(Tg,{falseCommand:()=>Dg,falseFlagsForFuzzing:()=>kg,flagsForFuzzing:()=>Og,trueCommand:()=>Eg});var Eg,Dg,Og,kg,Ag=S(()=>{Eg={name:`true`,async execute(){return{stdout:``,stderr:``,exitCode:0}}},Dg={name:`false`,async execute(){return{stdout:``,stderr:``,exitCode:1}}},Og={name:`true`,flags:[]},kg={name:`false`,flags:[]}}),jg={};C(jg,{clearCommand:()=>Ng,flagsForFuzzing:()=>Pg});var Mg,Ng,Pg,Fg=S(()=>{O(),Mg={name:`clear`,summary:`clear the terminal screen`,usage:`clear [OPTIONS]`,options:[` --help display this help and exit`]},Ng={name:`clear`,async execute(e,t){return E(e)?T(Mg):{stdout:`\x1B[2J\x1B[H`,stderr:``,exitCode:0}}},Pg={name:`clear`,flags:[]}}),Ig={};C(Ig,{bashCommand:()=>zg,flagsForFuzzing:()=>Vg,shCommand:()=>Bg,shFlagsForFuzzing:()=>Hg});async function Lg(e,t,n,r){if(!r.exec)return{stdout:``,stderr:`bash: internal error: exec function not available
621
- `,exitCode:1};let i=Xl(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(` `),"*":n.join(` `)});n.forEach((e,t)=>{i[String(t+1)]=e});let a=e;if(a.startsWith(`#!`)){let e=a.indexOf(`
622
- `);e!==-1&&(a=a.slice(e+1))}return await r.exec(a,{env:i,cwd:r.cwd,stdin:r.stdin,signal:r.signal})}var Rg,zg,Bg,Vg,Hg,Ug=S(()=>{Zl(),O(),Rg={name:`bash`,summary:`execute shell commands or scripts`,usage:`bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]`,options:[`-c COMMAND execute COMMAND string`,` --help display this help and exit`],notes:[`Without -c, reads and executes commands from SCRIPT_FILE.`,`Arguments are passed as $1, $2, etc. to the script.`,`$0 is set to the script name (or "bash" with -c).`]},zg={name:`bash`,async execute(e,t){if(E(e))return T(Rg);if(e[0]===`-c`&&e.length>=2){let n=e[1];return Lg(n,e[2]||`bash`,e.slice(3),t)}if(e.length===0)return t.stdin?.trim()?Lg(t.stdin,`bash`,[],t):{stdout:``,stderr:``,exitCode:0};let n=e[0],r=e.slice(1);try{let e=t.fs.resolvePath(t.cwd,n);return Lg(await t.fs.readFile(e),n,r,t)}catch{return{stdout:``,stderr:`bash: ${n}: No such file or directory
621
+ `,exitCode:1};let i=Yl(r.exportedEnv||{},{0:t,"#":String(n.length),"@":n.join(` `),"*":n.join(` `)});n.forEach((e,t)=>{i[String(t+1)]=e});let a=e;if(a.startsWith(`#!`)){let e=a.indexOf(`
622
+ `);e!==-1&&(a=a.slice(e+1))}return await r.exec(a,{env:i,cwd:r.cwd,stdin:r.stdin,signal:r.signal})}var Rg,zg,Bg,Vg,Hg,Ug=S(()=>{Xl(),O(),Rg={name:`bash`,summary:`execute shell commands or scripts`,usage:`bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]`,options:[`-c COMMAND execute COMMAND string`,` --help display this help and exit`],notes:[`Without -c, reads and executes commands from SCRIPT_FILE.`,`Arguments are passed as $1, $2, etc. to the script.`,`$0 is set to the script name (or "bash" with -c).`]},zg={name:`bash`,async execute(e,t){if(E(e))return T(Rg);if(e[0]===`-c`&&e.length>=2){let n=e[1];return Lg(n,e[2]||`bash`,e.slice(3),t)}if(e.length===0)return t.stdin?.trim()?Lg(t.stdin,`bash`,[],t):{stdout:``,stderr:``,exitCode:0};let n=e[0],r=e.slice(1);try{let e=t.fs.resolvePath(t.cwd,n);return Lg(await t.fs.readFile(e),n,r,t)}catch{return{stdout:``,stderr:`bash: ${n}: No such file or directory
623
623
  `,exitCode:127}}}},Bg={name:`sh`,async execute(e,t){if(E(e))return T({...Rg,name:`sh`,summary:`execute shell commands or scripts (POSIX shell)`});if(e[0]===`-c`&&e.length>=2){let n=e[1];return Lg(n,e[2]||`sh`,e.slice(3),t)}if(e.length===0)return t.stdin?.trim()?Lg(t.stdin,`sh`,[],t):{stdout:``,stderr:``,exitCode:0};let n=e[0],r=e.slice(1);try{let e=t.fs.resolvePath(t.cwd,n);return Lg(await t.fs.readFile(e),n,r,t)}catch{return{stdout:``,stderr:`sh: ${n}: No such file or directory
624
- `,exitCode:127}}}},Vg={name:`bash`,flags:[{flag:`-c`,type:`value`,valueHint:`string`}],stdinType:`text`},Hg={name:`sh`,flags:[{flag:`-c`,type:`value`,valueHint:`string`}],stdinType:`text`}});function Wg(e,t,n,r,i,a,o,s,c,l){switch(t){case`sort`:return Array.isArray(e)?[[...e].sort(o)]:[null];case`sort_by`:return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)})];case`bsearch`:if(!Array.isArray(e))throw Error(`${e===null?`null`:typeof e==`object`?`object`:typeof e} (${JSON.stringify(e)}) cannot be searched from`);return n.length===0?[null]:i(e,n[0],r).map(t=>{let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;o(e[i],t)<0?n=i+1:r=i}return n<e.length&&o(e[n],t)===0?n:-n-1});case`unique_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let a of e){let e=i(a,n[0],r)[0],o=JSON.stringify(e);t.has(o)||t.set(o,{item:a,key:e})}let a=[...t.values()];return a.sort((e,t)=>o(e.key,t.key)),[a.map(e=>e.item)]}case`group_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let a of e){let e=JSON.stringify(i(a,n[0],r)[0]);t.has(e)||t.set(e,[]),t.get(e)?.push(a)}return[[...t.values()]]}case`max`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>o(e,t)>0?e:t)]:[null];case`max_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)>0?e:t})];case`min`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>o(e,t)<0?e:t)]:[null];case`min_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)<0?e:t})];case`add`:{let t=e=>{let t=e.filter(e=>e!==null);return t.length===0?null:t.every(e=>typeof e==`number`)?t.reduce((e,t)=>e+t,0):t.every(e=>typeof e==`string`)?t.join(``):t.every(e=>Array.isArray(e))?t.flat():t.every(e=>e&&typeof e==`object`&&!Array.isArray(e))?Xl(...t):null};return n.length>=1?[t(i(e,n[0],r))]:Array.isArray(e)?[t(e)]:[null]}case`any`:if(n.length>=2){try{let t=a(e,n[0],r);for(let e of t)if(i(e,n[1],r).some(s))return[!0]}catch(e){if(e instanceof l)throw e}return[!1]}return n.length===1?Array.isArray(e)?[e.some(e=>s(i(e,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(s)]:[!1];case`all`:if(n.length>=2){try{let t=a(e,n[0],r);for(let e of t)if(!i(e,n[1],r).some(s))return[!1]}catch(e){if(e instanceof l)throw e}return[!0]}return n.length===1?Array.isArray(e)?[e.every(e=>s(i(e,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(s)]:[!0];case`select`:return n.length===0||i(e,n[0],r).some(s)?[e]:[];case`map`:return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(e=>i(e,n[0],r))];case`map_values`:if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(e=>i(e,n[0],r))];if(e&&typeof e==`object`){let t=Object.create(null);for(let[a,o]of Object.entries(e)){if(!cc(a))continue;let e=i(o,n[0],r);e.length>0&&lc(t,a,e[0])}return[t]}return[null];case`has`:{if(n.length===0)return[!1];let t=i(e,n[0],r)[0];return Array.isArray(e)&&typeof t==`number`?[t>=0&&t<e.length]:e&&typeof e==`object`&&typeof t==`string`?[uc(e,t)]:[!1]}case`in`:{if(n.length===0)return[!1];let t=i(e,n[0],r)[0];return Array.isArray(t)&&typeof e==`number`?[e>=0&&e<t.length]:t&&typeof t==`object`&&typeof e==`string`?[uc(t,e)]:[!1]}case`contains`:return n.length===0?[!1]:[c(e,i(e,n[0],r)[0])];case`inside`:return n.length===0?[!1]:[c(i(e,n[0],r)[0],e)];default:return null}}var Gg=S(()=>{Zl(),_c()});function Kg(e,t,n,r,i,a,o,s){switch(t){case`first`:if(n.length>0)try{let t=a(e,n[0],r);return t.length>0?[t[0]]:[]}catch(e){if(e instanceof s)throw e;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case`last`:if(n.length>0){let t=i(e,n[0],r);return t.length>0?[t[t.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case`nth`:{if(n.length<1)return[null];let t=i(e,n[0],r);if(n.length>1){for(let e of t)if(e<0)throw Error(`nth doesn't support negative indices`);let i;try{i=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;i=[]}return t.flatMap(e=>{let t=e;return t<i.length?[i[t]]:[]})}return Array.isArray(e)?t.flatMap(t=>{let n=t;if(n<0)throw Error(`nth doesn't support negative indices`);return n<e.length?[e[n]]:[null]}):[null]}case`range`:{if(n.length===0)return[];let t=Math.max(r.limits.maxIterations*100,1e6),a=e=>e.length>=t,o=i(e,n[0],r);if(n.length===1){let e=[];for(let t of o){let n=t;for(let t=0;t<n;t++)if(e.push(t),a(e))return e}return e}let s=i(e,n[1],r);if(n.length===2){let e=[];for(let t of o)for(let n of s){let r=t,i=n;for(let t=r;t<i;t++)if(e.push(t),a(e))return e}return e}let c=i(e,n[2],r),l=[];for(let e of o)for(let t of s)for(let n of c){let r=e,i=t,o=n;if(o!==0){if(o>0){for(let e=r;e<i;e+=o)if(l.push(e),a(l))return l}else for(let e=r;e>i;e+=o)if(l.push(e),a(l))return l}}return l}case`limit`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let i=t;if(i<0)throw Error(`limit doesn't support negative count`);if(i===0)return[];let o;try{o=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;o=[]}return o.slice(0,i)});case`isempty`:if(n.length<1)return[!0];try{return[a(e,n[0],r).length===0]}catch(e){if(e instanceof s)throw e;return[!0]}case`isvalid`:if(n.length<1)return[!0];try{return[i(e,n[0],r).length>0]}catch(e){if(e instanceof s)throw e;return[!1]}case`skip`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let a=t;if(a<0)throw Error(`skip doesn't support negative count`);return i(e,n[1],r).slice(a)});case`until`:{if(n.length<2)return[e];let t=e,a=r.limits.maxIterations;for(let e=0;e<a;e++){if(i(t,n[0],r).some(o))return[t];let e=i(t,n[1],r);if(e.length===0)return[t];t=e[0]}throw new s(`jq until: too many iterations (${a}), increase executionLimits.maxJqIterations`,`iterations`)}case`while`:{if(n.length<2)return[e];let t=[],a=e,c=r.limits.maxIterations;for(let e=0;e<c&&i(a,n[0],r).some(o);e++){t.push(a);let e=i(a,n[1],r);if(e.length===0)break;a=e[0]}if(t.length>=c)throw new s(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,`iterations`);return t}case`repeat`:{if(n.length===0)return[e];let t=[],a=e,o=r.limits.maxIterations;for(let e=0;e<o;e++){t.push(a);let e=i(a,n[0],r);if(e.length===0)break;a=e[0]}if(t.length>=o)throw new s(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,`iterations`);return t}default:return null}}var qg=S(()=>{});function Jg(e,t,n,r,i){switch(t){case`now`:return[Date.now()/1e3];case`gmtime`:{if(typeof e!=`number`)return[null];let t=new Date(e*1e3),n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate(),a=t.getUTCHours(),o=t.getUTCMinutes(),s=t.getUTCSeconds(),c=t.getUTCDay(),l=Date.UTC(n,0,1);return[[n,r,i,a,o,s,c,Math.floor((t.getTime()-l)/(1440*60*1e3))]]}case`mktime`:{if(!Array.isArray(e))throw Error(`mktime requires parsed datetime inputs`);let[t,n,r,i=0,a=0,o=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`mktime requires parsed datetime inputs`);return[Math.floor(Date.UTC(t,n,r??1,i??0,a??0,o??0)/1e3)]}case`strftime`:{if(n.length===0)return[null];let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strftime/1 requires a string format`);let a;if(typeof e==`number`)a=new Date(e*1e3);else if(Array.isArray(e)){let[t,n,r,i=0,o=0,s=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`strftime/1 requires parsed datetime inputs`);a=new Date(Date.UTC(t,n,r??1,i??0,o??0,s??0))}else throw Error(`strftime/1 requires parsed datetime inputs`);let o=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=(e,t=2)=>String(e).padStart(t,`0`);return[t.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,c(a.getUTCMonth()+1)).replace(/%d/g,c(a.getUTCDate())).replace(/%H/g,c(a.getUTCHours())).replace(/%M/g,c(a.getUTCMinutes())).replace(/%S/g,c(a.getUTCSeconds())).replace(/%A/g,o[a.getUTCDay()]).replace(/%B/g,s[a.getUTCMonth()]).replace(/%Z/g,`UTC`).replace(/%%/g,`%`)]}case`strptime`:{if(n.length===0)return[null];if(typeof e!=`string`)throw Error(`strptime/1 requires a string input`);let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strptime/1 requires a string format`);if(t===`%Y-%m-%dT%H:%M:%SZ`){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(t){let[,e,n,r,i,a,o]=t.map(Number),s=new Date(Date.UTC(e,n-1,r,i,a,o)),c=s.getUTCDay(),l=Date.UTC(e,0,1),u=Math.floor((s.getTime()-l)/(1440*60*1e3));return[[e,n-1,r,i,a,o,c,u]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let e=a.getUTCFullYear(),t=a.getUTCMonth(),n=a.getUTCDate(),r=a.getUTCHours(),i=a.getUTCMinutes(),o=a.getUTCSeconds(),s=a.getUTCDay(),c=Date.UTC(e,0,1);return[[e,t,n,r,i,o,s,Math.floor((a.getTime()-c)/(1440*60*1e3))]]}throw Error(`Cannot parse date: ${e}`)}case`fromdate`:{if(typeof e!=`string`)throw Error(`fromdate requires a string input`);let t=new Date(e);if(Number.isNaN(t.getTime()))throw Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(t.getTime()/1e3)]}case`todate`:if(typeof e!=`number`)throw Error(`todate requires a number input`);return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,`Z`)];default:return null}}var Yg=S(()=>{});function Xg(e){return e!==!1&&e!==null}function Zg(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Qg(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`string`&&typeof t==`string`?e.localeCompare(t):0}function $g(e,t){let n=mc(e);for(let e of Object.keys(t)){if(!cc(e))continue;let r=uc(n,e)?fc(n[e]):null,i=fc(t[e]);r&&i?lc(n,e,$g(r,i)):lc(n,e,t[e])}return n}function e_(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(typeof r==`object`&&r){let e=Object.keys(r);if(e.length===0)return n+1;r=r[e[0]],n++}else return n;return n}function t_(e,t){let n=e=>e===null?0:typeof e==`boolean`?1:typeof e==`number`?2:typeof e==`string`?3:Array.isArray(e)?4:typeof e==`object`?5:6,r=n(e),i=n(t);if(r!==i)return r-i;if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`boolean`&&typeof t==`boolean`)return!!e-+!!t;if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<Math.min(e.length,t.length);n++){let r=t_(e[n],t[n]);if(r!==0)return r}return e.length-t.length}let a=fc(e),o=fc(t);if(a&&o){let e=Object.keys(a).sort(),t=Object.keys(o).sort();for(let n=0;n<Math.min(e.length,t.length);n++){let r=e[n].localeCompare(t[n]);if(r!==0)return r}if(e.length!==t.length)return e.length-t.length;for(let t of e){let e=t_(a[t],o[t]);if(e!==0)return e}}return 0}function n_(e,t){if(Zg(e,t))return!0;if(typeof e==`string`&&typeof t==`string`)return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(t=>e.some(e=>n_(e,t)));let n=fc(e),r=fc(t);return n&&r?Object.keys(r).every(e=>uc(n,e)&&n_(n[e],r[e])):!1}var r_=S(()=>{_c()});function i_(e,t,n){switch(t){case`@base64`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`utf-8`).toString(`base64`)]:[btoa(e)]:[null];case`@base64d`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`base64`).toString(`utf-8`)]:[atob(e)]:[null];case`@uri`:return typeof e==`string`?[encodeURIComponent(e).replace(/!/g,`%21`).replace(/'/g,`%27`).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/\*/g,`%2A`)]:[null];case`@urid`:return typeof e==`string`?[decodeURIComponent(e)]:[null];case`@csv`:return Array.isArray(e)?[e.map(e=>{if(e===null)return``;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);let t=String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
625
- `)||t.includes(`\r`)?`"${t.replace(/"/g,`""`)}"`:t}).join(`,`)]:[null];case`@tsv`:return Array.isArray(e)?[e.map(e=>String(e??``).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`)).join(` `)]:[null];case`@json`:{let t=n??a_;return e_(e,t+1)>t?[null]:[JSON.stringify(e)]}case`@html`:return typeof e==`string`?[e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/'/g,`&apos;`).replace(/"/g,`&quot;`)]:[null];case`@sh`:return typeof e==`string`?[`'${e.replace(/'/g,`'\\''`)}'`]:[null];case`@text`:return typeof e==`string`?[e]:e==null?[``]:[String(e)];default:return null}}var a_,o_=S(()=>{r_(),a_=2e3});function s_(e,t,n,r,i,a){switch(t){case`index`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){if(t===``&&e===``)return null;let n=e.indexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=0;n<=e.length-t.length;n++){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}let n=e.findIndex(e=>a(e,t));return n>=0?n:null}return null});case`rindex`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){let n=e.lastIndexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=e.length-t.length;n>=0;n--){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}for(let n=e.length-1;n>=0;n--)if(a(e[n],t))return n;return null}return null});case`indices`:return n.length===0?[[]]:i(e,n[0],r).map(t=>{let n=[];if(typeof e==`string`&&typeof t==`string`){let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1)}else if(Array.isArray(e))if(Array.isArray(t)){let r=t.length;if(r===0)for(let t=0;t<=e.length;t++)n.push(t);else for(let i=0;i<=e.length-r;i++){let o=!0;for(let n=0;n<r;n++)if(!a(e[i+n],t[n])){o=!1;break}o&&n.push(i)}}else for(let r=0;r<e.length;r++)a(e[r],t)&&n.push(r);return n});default:return null}}var c_=S(()=>{});function l_(e,t,n,r,i){switch(t){case`fabs`:case`abs`:return typeof e==`number`?[Math.abs(e)]:typeof e==`string`?[e]:[null];case`exp10`:return typeof e==`number`?[10**e]:[null];case`exp2`:return typeof e==`number`?[2**e]:[null];case`pow`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[o**s]}case`atan2`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[Math.atan2(o,s)]}case`hypot`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.hypot(e,t)]}case`fma`:{if(typeof e!=`number`||n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[e*t+a]}case`copysign`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.sign(t)*Math.abs(e)]}case`drem`:case`remainder`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[e-Math.round(e/t)*t]}case`fdim`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(0,e-t)]}case`fmax`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(e,t)]}case`fmin`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.min(e,t)]}case`ldexp`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`scalbn`:case`scalbln`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`nearbyint`:return typeof e==`number`?[Math.round(e)]:[null];case`logb`:return typeof e==`number`?[Math.floor(Math.log2(Math.abs(e)))]:[null];case`significand`:return typeof e==`number`?[e/2**Math.floor(Math.log2(Math.abs(e)))]:[null];case`frexp`:if(typeof e==`number`){if(e===0)return[[0,0]];let t=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**t,t]]}return[null];case`modf`:if(typeof e==`number`){let t=Math.trunc(e);return[[e-t,t]]}return[null];default:return null}}var u_=S(()=>{});function d_(e,t,n,r,i,a,o,s){switch(t){case`recurse`:{if(n.length===0){let t=[],n=e=>{if(t.push(e),Array.isArray(e))for(let t of e)n(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))n(e[t])};return n(e),t}let t=[],o=n.length>=2?n[1]:null,s=0,c=e=>{if(s++>1e4||o&&!i(e,o,r).some(a))return;t.push(e);let l=i(e,n[0],r);for(let e of l)e!=null&&c(e)};return c(e),t}case`recurse_down`:return s(e,`recurse`,n,r);case`walk`:{if(n.length===0)return[e];let t=new WeakSet,a=e=>{if(e&&typeof e==`object`){if(t.has(e))return e;t.add(e)}let o;if(Array.isArray(e))o=e.map(a);else if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,r]of Object.entries(e))cc(n)&&lc(t,n,a(r));o=t}else o=e;return i(o,n[0],r)[0]};return[a(e)]}case`transpose`:{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let t=Math.max(...e.map(e=>Array.isArray(e)?e.length:0)),n=[];for(let r=0;r<t;r++)n.push(e.map(e=>Array.isArray(e)?e[r]:null));return[n]}case`combinations`:{if(n.length>0){let t=i(e,n[0],r)[0];if(!Array.isArray(e)||t<0)return[];if(t===0)return[[]];let a=[],o=(n,r)=>{if(r===t){a.push([...n]);return}for(let t of e)n.push(t),o(n,r+1),n.pop()};return o([],0),a}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let t of e)if(!Array.isArray(t))return[];let t=[],a=(n,r)=>{if(n===e.length){t.push([...r]);return}let i=e[n];for(let e of i)r.push(e),a(n+1,r),r.pop()};return a(0,[]),t}case`parent`:{if(r.root===void 0||r.currentPath===void 0)return[];let t=r.currentPath;if(t.length===0)return[];let a=n.length>0?i(e,n[0],r)[0]:1;if(a>=0){if(a>t.length)return[];let e=t.slice(0,t.length-a);return[o(r.root,e)]}else{let n=-a-1;if(n>=t.length)return[e];let i=t.slice(0,n);return[o(r.root,i)]}}case`parents`:{if(r.root===void 0||r.currentPath===void 0)return[[]];let e=r.currentPath,t=[];for(let n=e.length-1;n>=0;n--)t.push(o(r.root,e.slice(0,n)));return[t]}case`root`:return r.root===void 0?[]:[r.root];default:return null}}var f_=S(()=>{_c()});function p_(e,t,n,r,i){switch(t){case`keys`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e).sort()]:[null];case`keys_unsorted`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e)]:[null];case`length`:return typeof e==`string`||Array.isArray(e)?[e.length]:e&&typeof e==`object`?[Object.keys(e).length]:e===null?[0]:typeof e==`number`?[Math.abs(e)]:[null];case`utf8bytelength`:{if(typeof e==`string`)return[new TextEncoder().encode(e).length];let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) only strings have UTF-8 byte length`)}case`to_entries`:{let t=fc(e);return t?[Object.entries(t).map(([e,t])=>({key:e,value:t}))]:[null]}case`from_entries`:if(Array.isArray(e)){let t=Object.create(null);for(let n of e){let e=fc(n);if(e){let n=e.key??e.Key??e.name??e.Name??e.k,r=e.value??e.Value??e.v;if(n!==void 0){let e=String(n);cc(e)&&lc(t,e,r)}}}return[t]}return[null];case`with_entries`:{if(n.length===0)return[e];let t=fc(e);if(t){let e=Object.entries(t).map(([e,t])=>({key:e,value:t})).flatMap(e=>i(e,n[0],r)),a=Object.create(null);for(let t of e){let e=fc(t);if(e){let t=e.key??e.name??e.k,n=e.value??e.v;if(t!==void 0){let e=String(t);cc(e)&&lc(a,e,n)}}}return[a]}return[null]}case`reverse`:return Array.isArray(e)?[[...e].reverse()]:typeof e==`string`?[e.split(``).reverse().join(``)]:[null];case`flatten`:return Array.isArray(e)?(n.length>0?i(e,n[0],r):[1/0]).map(t=>{let n=t;if(n<0)throw Error(`flatten depth must not be negative`);return e.flat(n)}):[null];case`unique`:if(Array.isArray(e)){let t=new Set,n=[];for(let r of e){let e=JSON.stringify(r);t.has(e)||(t.add(e),n.push(r))}return[n]}return[null];case`tojson`:case`tojsonstream`:{let t=r.limits.maxDepth??m_;return e_(e,t+1)>t?[null]:[JSON.stringify(e)]}case`fromjson`:if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===`nan`)return[NaN];if(t===`inf`||t===`infinity`)return[1/0];if(t===`-inf`||t===`-infinity`)return[-1/0];try{return[dc(JSON.parse(e))]}catch{throw Error(`Invalid JSON: ${e}`)}}return[e];case`tostring`:return typeof e==`string`?[e]:[JSON.stringify(e)];case`tonumber`:if(typeof e==`number`)return[e];if(typeof e==`string`){let t=Number(e);if(Number.isNaN(t))throw Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[t]}throw Error(`${typeof e} cannot be parsed as a number`);case`toboolean`:{if(typeof e==`boolean`)return[e];if(typeof e==`string`){if(e===`true`)return[!0];if(e===`false`)return[!1];throw Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) cannot be parsed as a boolean`)}case`tostream`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push([r,e]);else if(Array.isArray(e))if(e.length===0)t.push([r,[]]);else for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else{let i=Object.keys(e);if(i.length===0)t.push([r,Object.create(null)]);else for(let t of i)n(e[t],[...r,t])}};return n(e,[]),t.push([[]]),t}case`fromstream`:{if(n.length===0)return[e];let t=i(e,n[0],r),a=null;for(let e of t){if(!Array.isArray(e)||e.length===1&&Array.isArray(e[0])&&e[0].length===0||e.length!==2)continue;let[t,n]=e;if(!Array.isArray(t))continue;if(t.length===0){a=n;continue}a===null&&(a=typeof t[0]==`number`?[]:Object.create(null));let r=a;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1];if(Array.isArray(r)&&typeof n==`number`){for(;r.length<=n;)r.push(null);r[n]===null&&(r[n]=typeof i==`number`?[]:Object.create(null)),r=r[n]}else{let e=fc(r);if(e){let t=String(n);if(!cc(t))continue;(e[t]===null||e[t]===void 0)&&lc(e,t,typeof i==`number`?[]:Object.create(null)),r=e[t]}}}let i=t[t.length-1];if(Array.isArray(r)&&typeof i==`number`){for(;r.length<=i;)r.push(null);r[i]=n}else{let e=fc(r);if(e){let t=String(i);cc(t)&&lc(e,t,n)}}}return[a]}case`truncate_stream`:{let t=typeof e==`number`?Math.floor(e):0;if(n.length===0)return[];let a=[],o=i(e,n[0],r);for(let e of o)if(Array.isArray(e)){if(e.length===1&&Array.isArray(e[0])){let n=e[0];n.length>t&&a.push([n.slice(t)]);continue}if(e.length===2&&Array.isArray(e[0])){let n=e[0],r=e[1];n.length>t&&a.push([n.slice(t),r])}}return a}default:return null}}var m_,h_=S(()=>{_c(),r_(),m_=2e3});function g_(e,t,n,r,i,a,o,s,c,l){switch(t){case`getpath`:{if(n.length===0)return[null];let t=i(e,n[0],r),a=[];for(let n of t){let t=n,r=e;for(let e of t){if(r==null){r=null;break}if(Array.isArray(r)&&typeof e==`number`)r=r[e];else if(typeof e==`string`){let t=fc(r);if(!t||!Object.hasOwn(t,e)){r=null;break}r=t[e]}else{r=null;break}}a.push(r)}return a}case`setpath`:{if(n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[o(e,t,a)]}case`delpaths`:{if(n.length===0)return[e];let t=i(e,n[0],r)[0],a=e;for(let e of t.sort((e,t)=>t.length-e.length))a=s(a,e);return[a]}case`path`:{if(n.length===0)return[[]];let t=[];return l(e,n[0],r,[],t),t}case`del`:return n.length===0?[e]:[c(e,n[0],r)];case`pick`:{if(n.length===0)return[null];let t=[];for(let i of n)l(e,i,r,[],t);let i=null;for(let n of t){for(let e of n)if(typeof e==`number`&&e<0)throw Error(`Out of bounds negative array index`);let t=e;for(let e of n){if(t==null)break;if(Array.isArray(t)&&typeof e==`number`)t=t[e];else if(typeof e==`string`){let n=fc(t);if(!n||!Object.hasOwn(n,e)){t=null;break}t=n[e]}else{t=null;break}}i=o(i,n,t)}return[i]}case`paths`:{let t=[],o=(e,n)=>{if(e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push([...n,r]),o(e[r],[...n,r]);else for(let r of Object.keys(e))t.push([...n,r]),o(e[r],[...n,r])};return o(e,[]),n.length>0?t.filter(t=>{let o=e;for(let e of t)if(Array.isArray(o)&&typeof e==`number`)o=o[e];else if(typeof e==`string`){let t=fc(o);if(!t||!Object.hasOwn(t,e))return!1;o=t[e]}else return!1;return i(o,n[0],r).some(a)}):t}case`leaf_paths`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push(r);else if(Array.isArray(e))for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else for(let t of Object.keys(e))n(e[t],[...r,t])};return n(e,[]),t}default:return null}}var __=S(()=>{_c()});function v_(e,t,n,r,i,a){switch(t){case`IN`:{if(n.length===0)return[!1];if(n.length===1){let t=i(e,n[0],r);for(let n of t)if(a(e,n))return[!0];return[!1]}let t=i(e,n[0],r),o=i(e,n[1],r),s=new Set(o.map(e=>JSON.stringify(e)));for(let e of t)if(s.has(JSON.stringify(e)))return[!0];return[!1]}case`INDEX`:{if(n.length===0)return[Object.create(null)];if(n.length===1){let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=String(e);cc(t)&&lc(a,t,e)}return[a]}if(n.length===2){let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=i(e,n[1],r);if(t.length>0){let n=String(t[0]);cc(n)&&lc(a,n,e)}}return[a]}let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=i(e,n[1],r),o=i(e,n[2],r);if(t.length>0&&o.length>0){let e=String(t[0]);cc(e)&&lc(a,e,o[0])}}return[a]}case`JOIN`:{if(n.length<2)return[null];let t=fc(i(e,n[0],r)[0]);if(!t||!Array.isArray(e))return[null];let a=[];for(let o of e){let e=i(o,n[1],r),s=e.length>0?String(e[0]):``,c=uc(t,s)?t[s]:null;a.push([o,c])}return[a]}default:return null}}var y_=S(()=>{_c()});function b_(e,t,n,r,i){switch(t){case`join`:{if(!Array.isArray(e))return[null];let t=n.length>0?i(e,n[0],r):[``];for(let t of e)if(Array.isArray(t)||typeof t==`object`&&t)throw Error(`cannot join: contains arrays or objects`);return t.map(t=>e.map(e=>e===null?``:typeof e==`string`?e:String(e)).join(String(t)))}case`split`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);return[e.split(a)]}case`splits`:{if(typeof e!=`string`||n.length===0)return[];let t=i(e,n[0],r),a=String(t[0]);try{let t=n.length>1?String(i(e,n[1],r)[0]):`g`;return R(a,t.includes(`g`)?t:`${t}g`).split(e)}catch{return[]}}case`scan`:{if(typeof e!=`string`||n.length===0)return[];let t=i(e,n[0],r),a=String(t[0]);try{let t=n.length>1?String(i(e,n[1],r)[0]):``;return[...R(a,t.includes(`g`)?t:`${t}g`).matchAll(e)].map(e=>e.length>1?e.slice(1):e[0])}catch{return[]}}case`test`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r),a=String(t[0]);try{return[R(a,n.length>1?String(i(e,n[1],r)[0]):``).test(e)]}catch{return[!1]}}case`match`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);try{let t=R(a,`${n.length>1?String(i(e,n[1],r)[0]):``}d`).exec(e);if(!t)return[];let o=t.indices;return[{offset:t.index,length:t[0].length,string:t[0],captures:t.slice(1).map((e,t)=>({offset:o?.[t+1]?.[0]??null,length:e?.length??0,string:e??``,name:null}))}]}catch{return[null]}}case`capture`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);try{let t=R(a,n.length>1?String(i(e,n[1],r)[0]):``).match(e);return!t||!t.groups?[Object.create(null)]:[t.groups]}catch{return[null]}}case`sub`:{if(typeof e!=`string`||n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=String(t[0]),s=String(a[0]);try{return[R(o,n.length>2?String(i(e,n[2],r)[0]):``).replace(e,s)]}catch{return[e]}}case`gsub`:{if(typeof e!=`string`||n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=String(t[0]),s=String(a[0]);try{let t=n.length>2?String(i(e,n[2],r)[0]):`g`;return[R(o,t.includes(`g`)?t:`${t}g`).replace(e,s)]}catch{return[e]}}case`ascii_downcase`:return typeof e==`string`?[e.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))]:[null];case`ascii_upcase`:return typeof e==`string`?[e.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))]:[null];case`ltrimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);return[e.startsWith(a)?e.slice(a.length):e]}case`rtrimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);return a===``?[e]:[e.endsWith(a)?e.slice(0,-a.length):e]}case`trimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);if(a===``)return[e];let o=e;return o.startsWith(a)&&(o=o.slice(a.length)),o.endsWith(a)&&(o=o.slice(0,-a.length)),[o]}case`trim`:if(typeof e==`string`)return[e.trim()];throw Error(`trim input must be a string`);case`ltrim`:if(typeof e==`string`)return[e.trimStart()];throw Error(`trim input must be a string`);case`rtrim`:if(typeof e==`string`)return[e.trimEnd()];throw Error(`trim input must be a string`);case`startswith`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r);return[e.startsWith(String(t[0]))]}case`endswith`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r);return[e.endsWith(String(t[0]))]}case`ascii`:return typeof e==`string`&&e.length>0?[e.charCodeAt(0)]:[null];case`explode`:return typeof e==`string`?[Array.from(e).map(e=>e.codePointAt(0))]:[null];case`implode`:if(!Array.isArray(e))throw Error(`implode input must be an array`);return[e.map(e=>{if(typeof e==`string`)throw Error(`string (${JSON.stringify(e)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof e!=`number`||Number.isNaN(e))throw Error(`number (null) can't be imploded, unicode codepoint needs to be numeric`);let t=Math.trunc(e);return t<0||t>1114111||t>=55296&&t<=57343?String.fromCodePoint(65533):String.fromCodePoint(t)}).join(``)];default:return null}}var x_=S(()=>{Ss()});function S_(e,t){switch(t){case`type`:return e===null?[`null`]:Array.isArray(e)?[`array`]:typeof e==`boolean`?[`boolean`]:typeof e==`number`?[`number`]:typeof e==`string`?[`string`]:typeof e==`object`?[`object`]:[`null`];case`infinite`:return[1/0];case`nan`:return[NaN];case`isinfinite`:return[typeof e==`number`&&!Number.isFinite(e)];case`isnan`:return[typeof e==`number`&&Number.isNaN(e)];case`isnormal`:return[typeof e==`number`&&Number.isFinite(e)&&e!==0];case`isfinite`:return[typeof e==`number`&&Number.isFinite(e)];case`numbers`:return typeof e==`number`?[e]:[];case`strings`:return typeof e==`string`?[e]:[];case`booleans`:return typeof e==`boolean`?[e]:[];case`nulls`:return e===null?[e]:[];case`arrays`:return Array.isArray(e)?[e]:[];case`objects`:return e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`iterables`:return Array.isArray(e)||e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`scalars`:return!Array.isArray(e)&&!(e&&typeof e==`object`)?[e]:[];case`values`:return e===null?[]:[e];case`not`:return e===!1||e===null?[!0]:[!1];case`null`:return[null];case`true`:return[!0];case`false`:return[!1];case`empty`:return[];default:return null}}var C_=S(()=>{}),w_=S(()=>{Gg(),qg(),Yg(),o_(),c_(),u_(),f_(),h_(),__(),y_(),x_(),C_()});function T_(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(typeof r==`number`){if(e&&typeof e==`object`&&!Array.isArray(e))throw Error(`Cannot index object with number`);if(r>536870911)throw Error(`Array index too large`);if(r<0)throw Error(`Out of bounds negative array index`);let t=Array.isArray(e)?[...e]:[];for(;t.length<=r;)t.push(null);return t[r]=T_(t[r],i,n),t}if(Array.isArray(e))throw Error(`Cannot index array with string`);if(!cc(r))return e??Object.create(null);let a=fc(e),o=a?mc(a):Object.create(null);return lc(o,r,T_(Object.hasOwn(o,r)?o[r]:void 0,i,n)),o}function E_(e,t){if(t.length===0)return null;if(t.length===1){let n=t[0];if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t.splice(n,1),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!cc(t))return e;let r=mc(e);return delete r[t],r}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t[n]=E_(t[n],r),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!cc(t))return e;let i=mc(e);return Object.hasOwn(i,t)&&lc(i,t,E_(i[t],r)),i}return e}var D_=S(()=>{_c()});function O_(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??U_,maxDepth:e?.limits?.maxDepth??W_},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function k_(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function A_(e,t,n){switch(t.type){case`var`:return k_(e,t.name,n);case`array`:{if(!Array.isArray(n))return null;let r=e;for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=e<n.length?n[e]:null,o=A_(r,i,a);if(o===null)return null;r=o}return r}case`object`:{let r=fc(n);if(!r)return null;let i=e;for(let a of t.fields){let t;if(typeof a.key==`string`)t=a.key;else{let r=W(n,a.key,e);if(r.length===0)return null;t=String(r[0])}let o=uc(r,t)?r[t]:null;a.keyVar&&(i=k_(i,a.keyVar,o));let s=A_(i,a.pattern,o);if(s===null)return null;i=s}return i}}}function j_(e,t){let n=e;for(let e of t)if(n&&typeof n==`object`)if(Array.isArray(n))if(typeof e==`number`)n=n[e];else return;else{let t=fc(n);if(t&&typeof e==`string`&&Object.hasOwn(t,e))n=t[e];else return}else return;return n}function M_(e){if(e.type===`Identity`)return[];if(e.type===`Field`){let t=e.base?M_(e.base):[];return t===null?null:[...t,e.name]}if(e.type===`Index`&&e.index.type===`Literal`){let t=e.base?M_(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n==`number`||typeof n==`string`?[...t,n]:null}if(e.type===`Pipe`){let t=M_(e.left);return t===null?null:N_(t,e.right)}if(e.type===`Call`){if(e.name===`parent`||e.name===`root`)return null;if(e.name===`first`&&e.args.length===0)return[0];if(e.name===`last`&&e.args.length===0)return[-1]}return null}function N_(e,t){if(t.type===`Call`){if(t.name===`parent`){let n=1;if(t.args.length>0&&t.args[0].type===`Literal`){let e=t.args[0].value;typeof e==`number`&&(n=e)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let t=-n-1;return e.slice(0,Math.min(t,e.length))}}if(t.name===`root`)return[]}if(t.type===`Field`){let n=M_(t);if(n!==null)return[...e,...n]}if(t.type===`Index`&&t.index.type===`Literal`){let n=M_(t);if(n!==null)return[...e,...n]}if(t.type===`Pipe`){let n=N_(e,t.left);return n===null?null:N_(n,t.right)}return t.type===`Identity`?e:null}function P_(e,t,n){if(t.type===`Comma`){let r=[];try{r.push(...W(e,t.left,n))}catch(e){if(e instanceof k)throw e;if(r.length>0)return r;throw Error(`evaluation failed`)}try{r.push(...W(e,t.right,n))}catch(e){if(e instanceof k)throw e;return r}return r}return W(e,t,n)}function W(e,t,n){let r=n&&`vars`in n?n:O_(n);switch(r.defenseContextChecked||(dl(r.requireDefenseContext,`query-engine`,`evaluation`),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case`Identity`:return[e];case`Field`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>{let n=fc(e);if(n){if(!Object.hasOwn(n,t.name))return[null];let e=n[t.name];return[e===void 0?null:e]}if(e===null)return[null];throw Error(`Cannot index ${Array.isArray(e)?`array`:typeof e} with string "${t.name}"`)});case`Index`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>W(e,t.index,r).flatMap(t=>{if(typeof t==`number`&&Array.isArray(e)){if(Number.isNaN(t))return[null];let n=Math.trunc(t),r=n<0?e.length+n:n;return r>=0&&r<e.length?[e[r]]:[null]}if(typeof t==`string`){let n=fc(e);return!n||!Object.hasOwn(n,t)?[null]:[n[t]]}return[null]}));case`Slice`:return(t.base?W(e,t.base,r):[e]).flatMap(n=>{if(n===null)return[null];if(!Array.isArray(n)&&typeof n!=`string`)throw Error(`Cannot slice ${typeof n} (${JSON.stringify(n)})`);let i=n.length,a=t.start?W(e,t.start,r):[0],o=t.end?W(e,t.end,r):[i];return a.flatMap(e=>o.map(t=>{let r=e,a=t,o=Number.isNaN(r)?0:Number.isInteger(r)?r:Math.floor(r),s=Number.isNaN(a)?i:Number.isInteger(a)?a:Math.ceil(a),c=F_(o,i),l=F_(s,i);return n.slice(c,l)}))});case`Iterate`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>Array.isArray(e)?e:e&&typeof e==`object`?Object.values(e):[]);case`Pipe`:{let n=W(e,t.left,r),i=M_(t.left),a=[];for(let e of n)try{if(i!==null){let n={...r,currentPath:[...r.currentPath??[],...i]};a.push(...W(e,t.right,n))}else a.push(...W(e,t.right,r))}catch(e){throw e instanceof V_?e.withPrependedResults(a):e}return a}case`Comma`:{let n=W(e,t.left,r),i=W(e,t.right,r);return[...n,...i]}case`Literal`:return[t.value];case`Array`:return t.elements?[W(e,t.elements,r)]:[[]];case`Object`:{let n=[Object.create(null)];for(let i of t.entries){let t=typeof i.key==`string`?[i.key]:W(e,i.key,r),a=W(e,i.value,r),o=[];for(let e of n)for(let n of t){if(typeof n!=`string`)throw Error(`Cannot use ${n===null?`null`:Array.isArray(n)?`array`:typeof n} (${JSON.stringify(n)}) as object key`);if(!cc(n)){for(let t of a)o.push(mc(e));continue}for(let t of a){let r=mc(e);lc(r,n,t),o.push(r)}}n.length=0,n.push(...o)}return n}case`Paren`:return W(e,t.expr,r);case`BinaryOp`:return R_(e,t.op,t.left,t.right,r);case`UnaryOp`:return W(e,t.operand,r).map(e=>{if(t.op===`-`){if(typeof e==`number`)return-e;if(typeof e==`string`)throw Error(`string (${(e=>e.length>5?`"${e.slice(0,3)}...`:JSON.stringify(e))(e)}) cannot be negated`);return null}return t.op===`not`?!Xg(e):null});case`Cond`:return W(e,t.cond,r).flatMap(n=>{if(Xg(n))return W(e,t.then,r);for(let n of t.elifs)if(W(e,n.cond,r).some(Xg))return W(e,n.then,r);return t.else?W(e,t.else,r):[e]});case`Try`:try{return W(e,t.body,r)}catch(e){return t.catch?W(e instanceof H_?e.value:e instanceof Error?e.message:String(e),t.catch,r):[]}case`Call`:return z_(e,t.name,t.args,r);case`VarBind`:return W(e,t.value,r).flatMap(n=>{let i=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:`var`,name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let e of a)if(i=A_(r,e,n),i!==null)break;return i===null?[]:W(e,t.body,i)});case`VarRef`:{if(t.name===`$ENV`)return[r.env?Jl(r.env):Object.create(null)];let e=r.vars.get(t.name);return e===void 0?[null]:[e]}case`Recurse`:{let t=[],n=new WeakSet,r=e=>{if(e&&typeof e==`object`){if(n.has(e))return;n.add(e)}if(t.push(e),Array.isArray(e))for(let t of e)r(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))r(e[t])};return r(e),t}case`Optional`:try{return W(e,t.expr,r)}catch{return[]}case`StringInterp`:return[t.parts.map(t=>typeof t==`string`?t:W(e,t,r).map(e=>typeof e==`string`?e:JSON.stringify(e)).join(``)).join(``)];case`UpdateOp`:return[I_(e,t.path,t.op,t.value,r)];case`Reduce`:{let n=W(e,t.expr,r),i=W(e,t.init,r)[0],a=r.limits.maxDepth??W_;for(let e of n){let n;if(t.pattern){if(n=A_(r,t.pattern,e),n===null)continue}else n=k_(r,t.varName,e);if(i=W(i,t.update,n)[0],e_(i,a+1)>a)return[null]}return[i]}case`Foreach`:{let n=W(e,t.expr,r),i=W(e,t.init,r)[0],a=[];for(let e of n)try{let n;if(t.pattern){if(n=A_(r,t.pattern,e),n===null)continue}else n=k_(r,t.varName,e);if(i=W(i,t.update,n)[0],t.extract){let e=W(i,t.extract,n);a.push(...e)}else a.push(i)}catch(e){throw e instanceof V_?e.withPrependedResults(a):e}return a}case`Label`:try{return W(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(e){if(e instanceof V_&&e.label===t.name)return e.partialResults;throw e}case`Break`:throw new V_(t.name);case`Def`:{let n=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;n.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let a={...r,funcs:n};return W(e,t.body,a)}default:throw Error(`Unknown AST node type: ${t.type}`)}}function F_(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function I_(e,t,n,r,i){function a(e,t){switch(n){case`=`:return t;case`|=`:return W(e,r,i)[0]??null;case`+=`:return typeof e==`number`&&typeof t==`number`||typeof e==`string`&&typeof t==`string`?e+t:Array.isArray(e)&&Array.isArray(t)?[...e,...t]:e&&t&&typeof e==`object`&&typeof t==`object`?hc(e,t):t;case`-=`:return typeof e==`number`&&typeof t==`number`?e-t:e;case`*=`:return typeof e==`number`&&typeof t==`number`?e*t:e;case`/=`:return typeof e==`number`&&typeof t==`number`?e/t:e;case`%=`:return typeof e==`number`&&typeof t==`number`?e%t:e;case`//=`:return e===null||e===!1?t:e;default:return t}}function o(t,n,r){switch(n.type){case`Identity`:return r(t);case`Field`:if(!cc(n.name))return t;if(n.base)return o(t,n.base,e=>{if(e&&typeof e==`object`&&!Array.isArray(e)){let t=mc(e),i=Object.hasOwn(t,n.name)?t[n.name]:void 0;return lc(t,n.name,r(i)),t}return e});if(t&&typeof t==`object`&&!Array.isArray(t)){let e=mc(t),i=Object.hasOwn(e,n.name)?e[n.name]:void 0;return lc(e,n.name,r(i)),e}return t;case`Index`:{let a=W(e,n.index,i)[0];if(typeof a==`number`&&Number.isNaN(a))throw Error(`Cannot set array element at NaN index`);if(typeof a==`number`&&!Number.isInteger(a)&&(a=Math.trunc(a)),n.base)return o(t,n.base,e=>{if(typeof a==`number`&&Array.isArray(e)){let t=[...e],n=a<0?t.length+a:a;if(n>=0){for(;t.length<=n;)t.push(null);t[n]=r(t[n])}return t}if(typeof a==`string`&&e&&typeof e==`object`&&!Array.isArray(e)){if(!cc(a))return e;let t=mc(e),n=Object.hasOwn(t,a)?t[a]:void 0;return lc(t,a,r(n)),t}return e});if(typeof a==`number`){if(a>536870911)throw Error(`Array index too large`);if(a<0&&(!t||!Array.isArray(t)))throw Error(`Out of bounds negative array index`);if(Array.isArray(t)){let e=[...t],n=a<0?e.length+a:a;if(n>=0){for(;e.length<=n;)e.push(null);e[n]=r(e[n])}return e}if(t==null){let e=[];for(;e.length<=a;)e.push(null);return e[a]=r(null),e}return t}if(typeof a==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!cc(a))return t;let e=mc(t),n=Object.hasOwn(e,a)?e[a]:void 0;return lc(e,a,r(n)),e}return t}case`Iterate`:{let e=e=>{if(Array.isArray(e))return e.map(e=>r(e));if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,i]of Object.entries(e))cc(n)&&lc(t,n,r(i));return t}return e};return n.base?o(t,n.base,e):e(t)}case`Pipe`:return o(o(t,n.left,e=>e),n.right,r);default:return r(t)}}return o(e,t,t=>n===`|=`?a(t,t):a(t,W(e,r,i)[0]??null))}function L_(e,t,n){function r(t,i,a){switch(i.type){case`Identity`:return a;case`Field`:if(!cc(i.name))return t;if(i.base){let e=W(t,i.base,n)[0],o=r(e,{type:`Field`,name:i.name},a);return r(t,i.base,o)}if(t&&typeof t==`object`&&!Array.isArray(t)){let e=mc(t);return lc(e,i.name,a),e}return t;case`Index`:{if(i.base){let e=W(t,i.base,n)[0],o=r(e,{type:`Index`,index:i.index},a);return r(t,i.base,o)}let o=W(e,i.index,n)[0];if(typeof o==`number`&&Array.isArray(t)){let e=[...t],n=o<0?e.length+o:o;return n>=0&&n<e.length&&(e[n]=a),e}if(typeof o==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!cc(o))return t;let e=mc(t);return lc(e,o,a),e}return t}default:return t}}function i(t,a){switch(a.type){case`Identity`:return null;case`Field`:if(!cc(a.name))return t;if(a.base){let e=W(t,a.base,n)[0];if(e==null)return t;let o=i(e,{type:`Field`,name:a.name});return r(t,a.base,o)}if(t&&typeof t==`object`&&!Array.isArray(t)){if(!cc(a.name))return t;let e=mc(t);return delete e[a.name],e}return t;case`Index`:{if(a.base){let e=W(t,a.base,n)[0];if(e==null)return t;let o=i(e,{type:`Index`,index:a.index});return r(t,a.base,o)}let o=W(e,a.index,n)[0];if(typeof o==`number`&&Array.isArray(t)){let e=[...t],n=o<0?e.length+o:o;return n>=0&&n<e.length&&e.splice(n,1),e}if(typeof o==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!cc(o))return t;let e=mc(t);return delete e[o],e}return t}case`Iterate`:return Array.isArray(t)?[]:t&&typeof t==`object`?Object.create(null):t;case`Pipe`:{let r=function(t,i,a){switch(i.type){case`Identity`:return a;case`Field`:if(!cc(i.name))return t;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=mc(t);return lc(e,i.name,a),e}return t;case`Index`:{let r=W(e,i.index,n)[0];if(typeof r==`number`&&Array.isArray(t)){let e=[...t],n=r<0?e.length+r:r;return n>=0&&n<e.length&&(e[n]=a),e}if(typeof r==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!cc(r))return t;let e=mc(t);return lc(e,r,a),e}return t}case`Pipe`:{let e=W(t,i.left,n)[0],o=r(e,i.right,a);return r(t,i.left,o)}default:return t}},o=a.left,s=a.right,c=W(t,o,n)[0];return c==null?t:r(t,o,i(c,s))}default:return t}}return i(e,t)}function R_(e,t,n,r,i){if(t===`and`)return W(e,n,i).flatMap(t=>Xg(t)?W(e,r,i).map(e=>Xg(e)):[!1]);if(t===`or`)return W(e,n,i).flatMap(t=>Xg(t)?[!0]:W(e,r,i).map(e=>Xg(e)));if(t===`//`){let t=W(e,n,i).filter(e=>e!=null&&e!==!1);return t.length>0?t:W(e,r,i)}let a=W(e,n,i),o=W(e,r,i);return a.flatMap(e=>o.map(n=>{switch(t){case`+`:return e===null?n:n===null?e:typeof e==`number`&&typeof n==`number`||typeof e==`string`&&typeof n==`string`?e+n:Array.isArray(e)&&Array.isArray(n)?[...e,...n]:e&&n&&typeof e==`object`&&typeof n==`object`&&!Array.isArray(e)&&!Array.isArray(n)?hc(e,n):null;case`-`:if(typeof e==`number`&&typeof n==`number`)return e-n;if(Array.isArray(e)&&Array.isArray(n)){let t=new Set(n.map(e=>JSON.stringify(e)));return e.filter(e=>!t.has(JSON.stringify(e)))}if(typeof e==`string`&&typeof n==`string`){let t=e=>e.length>10?`"${e.slice(0,10)}...`:JSON.stringify(e);throw Error(`string (${t(e)}) and string (${t(n)}) cannot be subtracted`)}return null;case`*`:if(typeof e==`number`&&typeof n==`number`)return e*n;if(typeof e==`string`&&typeof n==`number`)return e.repeat(n);{let t=fc(e),r=fc(n);if(t&&r)return $g(t,r)}return null;case`/`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided because the divisor is zero`);return e/n}return typeof e==`string`&&typeof n==`string`?e.split(n):null;case`%`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(e)&&!Number.isNaN(e)?!Number.isFinite(n)&&!Number.isNaN(n)&&e<0&&n>0?-1:0:e%n}return null;case`==`:return Zg(e,n);case`!=`:return!Zg(e,n);case`<`:return Qg(e,n)<0;case`<=`:return Qg(e,n)<=0;case`>`:return Qg(e,n)>0;case`>=`:return Qg(e,n)>=0;default:return null}}))}function z_(e,t,n,r){let i=G_.get(t);if(i)return typeof e==`number`?[i(e)]:[null];let a=l_(e,t,n,r,W);if(a!==null)return a;let o=b_(e,t,n,r,W);if(o!==null)return o;let s=Jg(e,t,n,r,W);if(s!==null)return s;let c=i_(e,t,r.limits.maxDepth);if(c!==null)return c;let l=S_(e,t);if(l!==null)return l;let u=p_(e,t,n,r,W);if(u!==null)return u;let d=Wg(e,t,n,r,W,P_,t_,Xg,n_,k);if(d!==null)return d;let f=g_(e,t,n,r,W,Xg,T_,E_,L_,B_);if(f!==null)return f;let p=s_(e,t,n,r,W,Zg);if(p!==null)return p;let m=Kg(e,t,n,r,W,P_,Xg,k);if(m!==null)return m;let h=d_(e,t,n,r,W,Xg,j_,z_);if(h!==null)return h;let g=v_(e,t,n,r,W,Zg);if(g!==null)return g;switch(t){case`builtins`:return[`add/0.all/0.all/1.all/2.any/0.any/1.any/2.arrays/0.ascii/0.ascii_downcase/0.ascii_upcase/0.booleans/0.bsearch/1.builtins/0.combinations/0.combinations/1.contains/1.debug/0.del/1.delpaths/1.empty/0.env/0.error/0.error/1.explode/0.first/0.first/1.flatten/0.flatten/1.floor/0.from_entries/0.fromdate/0.fromjson/0.getpath/1.gmtime/0.group_by/1.gsub/2.gsub/3.has/1.implode/0.IN/1.IN/2.INDEX/1.INDEX/2.index/1.indices/1.infinite/0.inside/1.isempty/1.isnan/0.isnormal/0.isvalid/1.iterables/0.join/1.keys/0.keys_unsorted/0.last/0.last/1.length/0.limit/2.ltrimstr/1.map/1.map_values/1.match/1.match/2.max/0.max_by/1.min/0.min_by/1.mktime/0.modulemeta/1.nan/0.not/0.nth/1.nth/2.null/0.nulls/0.numbers/0.objects/0.path/1.paths/0.paths/1.pick/1.range/1.range/2.range/3.recurse/0.recurse/1.recurse_down/0.repeat/1.reverse/0.rindex/1.rtrimstr/1.scalars/0.scan/1.scan/2.select/1.setpath/2.skip/2.sort/0.sort_by/1.split/1.splits/1.splits/2.sqrt/0.startswith/1.strftime/1.strings/0.strptime/1.sub/2.sub/3.test/1.test/2.to_entries/0.toboolean/0.todate/0.tojson/0.tostream/0.fromstream/1.truncate_stream/1.tonumber/0.tostring/0.transpose/0.trim/0.ltrim/0.rtrim/0.type/0.unique/0.unique_by/1.until/2.utf8bytelength/0.values/0.walk/1.while/2.with_entries/1`.split(`.`)];case`error`:{let t=n.length>0?W(e,n[0],r)[0]:e;throw new H_(t)}case`env`:return[r.env?Jl(r.env):Object.create(null)];case`debug`:return[e];case`input_line_number`:return[1];default:{let i=`${t}/${n.length}`,a=r.funcs?.get(i);if(a){let t=a.closure??r.funcs??new Map,o=new Map(t);o.set(i,a);for(let t=0;t<a.params.length;t++){let i=a.params[t],s=n[t];if(s){let t=W(e,s,r),n;if(t.length===0)n={type:`Call`,name:`empty`,args:[]};else if(t.length===1)n={type:`Literal`,value:t[0]};else{n={type:`Literal`,value:t[t.length-1]};for(let e=t.length-2;e>=0;e--)n={type:`Comma`,left:{type:`Literal`,value:t[e]},right:n}}o.set(`${i}/0`,{params:[],body:n})}}let s={...r,funcs:o};return W(e,a.body,s)}throw Error(`Unknown function: ${t}`)}}}function B_(e,t,n,r,i){if(t.type===`Comma`){let a=t;B_(e,a.left,n,r,i),B_(e,a.right,n,r,i);return}let a=M_(t);if(a!==null){i.push([...r,...a]);return}if(t.type===`Iterate`){if(Array.isArray(e))for(let t=0;t<e.length;t++)i.push([...r,t]);else if(e&&typeof e==`object`)for(let t of Object.keys(e))i.push([...r,t]);return}if(t.type===`Recurse`){let t=(e,n)=>{if(i.push([...r,...n]),e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t(e[r],[...n,r]);else for(let r of Object.keys(e))t(e[r],[...n,r])};t(e,[]);return}if(t.type===`Pipe`){let a=M_(t.left);if(a!==null){let o=W(e,t.left,n);for(let e of o)B_(e,t.right,n,[...r,...a],i);return}}W(e,t,n).length>0&&i.push(r)}var V_,H_,U_,W_,G_,K_=S(()=>{Zl(),A(),pl(),w_(),D_(),_c(),r_(),V_=class e extends Error{label;partialResults;constructor(e,t=[]){super(`break ${e}`),this.label=e,this.partialResults=t,this.name=`BreakError`}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},H_=class extends Error{value;constructor(e){super(typeof e==`string`?e:JSON.stringify(e)),this.value=e,this.name=`JqError`}},U_=1e4,W_=2e3,G_=new Map([[`floor`,Math.floor],[`ceil`,Math.ceil],[`round`,Math.round],[`sqrt`,Math.sqrt],[`log`,Math.log],[`log10`,Math.log10],[`log2`,Math.log2],[`exp`,Math.exp],[`sin`,Math.sin],[`cos`,Math.cos],[`tan`,Math.tan],[`asin`,Math.asin],[`acos`,Math.acos],[`atan`,Math.atan],[`sinh`,Math.sinh],[`cosh`,Math.cosh],[`tanh`,Math.tanh],[`asinh`,Math.asinh],[`acosh`,Math.acosh],[`atanh`,Math.atanh],[`cbrt`,Math.cbrt],[`expm1`,Math.expm1],[`log1p`,Math.log1p],[`trunc`,Math.trunc]])});function q_(e){let t=[],n=0,r=(t=0)=>e[n+t],i=()=>e[n++],a=()=>n>=e.length,o=e=>e>=`0`&&e<=`9`,s=e=>e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`,c=e=>s(e)||o(e);for(;!a();){let l=n,u=i();if(!(u===` `||u===` `||u===`
624
+ `,exitCode:127}}}},Vg={name:`bash`,flags:[{flag:`-c`,type:`value`,valueHint:`string`}],stdinType:`text`},Hg={name:`sh`,flags:[{flag:`-c`,type:`value`,valueHint:`string`}],stdinType:`text`}});function Wg(e,t,n,r,i,a,o,s,c,l){switch(t){case`sort`:return Array.isArray(e)?[[...e].sort(o)]:[null];case`sort_by`:return!Array.isArray(e)||n.length===0?[null]:[[...e].sort((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)})];case`bsearch`:if(!Array.isArray(e))throw Error(`${e===null?`null`:typeof e==`object`?`object`:typeof e} (${JSON.stringify(e)}) cannot be searched from`);return n.length===0?[null]:i(e,n[0],r).map(t=>{let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;o(e[i],t)<0?n=i+1:r=i}return n<e.length&&o(e[n],t)===0?n:-n-1});case`unique_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let a of e){let e=i(a,n[0],r)[0],o=JSON.stringify(e);t.has(o)||t.set(o,{item:a,key:e})}let a=[...t.values()];return a.sort((e,t)=>o(e.key,t.key)),[a.map(e=>e.item)]}case`group_by`:{if(!Array.isArray(e)||n.length===0)return[null];let t=new Map;for(let a of e){let e=JSON.stringify(i(a,n[0],r)[0]);t.has(e)||t.set(e,[]),t.get(e)?.push(a)}return[[...t.values()]]}case`max`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>o(e,t)>0?e:t)]:[null];case`max_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)>0?e:t})];case`min`:return Array.isArray(e)&&e.length>0?[e.reduce((e,t)=>o(e,t)<0?e:t)]:[null];case`min_by`:return!Array.isArray(e)||e.length===0||n.length===0?[null]:[e.reduce((e,t)=>{let a=i(e,n[0],r)[0],s=i(t,n[0],r)[0];return o(a,s)<0?e:t})];case`add`:{let t=e=>{let t=e.filter(e=>e!==null);return t.length===0?null:t.every(e=>typeof e==`number`)?t.reduce((e,t)=>e+t,0):t.every(e=>typeof e==`string`)?t.join(``):t.every(e=>Array.isArray(e))?t.flat():t.every(e=>e&&typeof e==`object`&&!Array.isArray(e))?Yl(...t):null};return n.length>=1?[t(i(e,n[0],r))]:Array.isArray(e)?[t(e)]:[null]}case`any`:if(n.length>=2){try{let t=a(e,n[0],r);for(let e of t)if(i(e,n[1],r).some(s))return[!0]}catch(e){if(e instanceof l)throw e}return[!1]}return n.length===1?Array.isArray(e)?[e.some(e=>s(i(e,n[0],r)[0]))]:[!1]:Array.isArray(e)?[e.some(s)]:[!1];case`all`:if(n.length>=2){try{let t=a(e,n[0],r);for(let e of t)if(!i(e,n[1],r).some(s))return[!1]}catch(e){if(e instanceof l)throw e}return[!0]}return n.length===1?Array.isArray(e)?[e.every(e=>s(i(e,n[0],r)[0]))]:[!0]:Array.isArray(e)?[e.every(s)]:[!0];case`select`:return n.length===0||i(e,n[0],r).some(s)?[e]:[];case`map`:return n.length===0||!Array.isArray(e)?[null]:[e.flatMap(e=>i(e,n[0],r))];case`map_values`:if(n.length===0)return[null];if(Array.isArray(e))return[e.flatMap(e=>i(e,n[0],r))];if(e&&typeof e==`object`){let t=Object.create(null);for(let[a,o]of Object.entries(e)){if(!sc(a))continue;let e=i(o,n[0],r);e.length>0&&cc(t,a,e[0])}return[t]}return[null];case`has`:{if(n.length===0)return[!1];let t=i(e,n[0],r)[0];return Array.isArray(e)&&typeof t==`number`?[t>=0&&t<e.length]:e&&typeof e==`object`&&typeof t==`string`?[lc(e,t)]:[!1]}case`in`:{if(n.length===0)return[!1];let t=i(e,n[0],r)[0];return Array.isArray(t)&&typeof e==`number`?[e>=0&&e<t.length]:t&&typeof t==`object`&&typeof e==`string`?[lc(t,e)]:[!1]}case`contains`:return n.length===0?[!1]:[c(e,i(e,n[0],r)[0])];case`inside`:return n.length===0?[!1]:[c(i(e,n[0],r)[0],e)];default:return null}}var Gg=S(()=>{Xl(),gc()});function Kg(e,t,n,r,i,a,o,s){switch(t){case`first`:if(n.length>0)try{let t=a(e,n[0],r);return t.length>0?[t[0]]:[]}catch(e){if(e instanceof s)throw e;return[]}return Array.isArray(e)&&e.length>0?[e[0]]:[null];case`last`:if(n.length>0){let t=i(e,n[0],r);return t.length>0?[t[t.length-1]]:[]}return Array.isArray(e)&&e.length>0?[e[e.length-1]]:[null];case`nth`:{if(n.length<1)return[null];let t=i(e,n[0],r);if(n.length>1){for(let e of t)if(e<0)throw Error(`nth doesn't support negative indices`);let i;try{i=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;i=[]}return t.flatMap(e=>{let t=e;return t<i.length?[i[t]]:[]})}return Array.isArray(e)?t.flatMap(t=>{let n=t;if(n<0)throw Error(`nth doesn't support negative indices`);return n<e.length?[e[n]]:[null]}):[null]}case`range`:{if(n.length===0)return[];let t=Math.max(r.limits.maxIterations*100,1e6),a=e=>e.length>=t,o=i(e,n[0],r);if(n.length===1){let e=[];for(let t of o){let n=t;for(let t=0;t<n;t++)if(e.push(t),a(e))return e}return e}let s=i(e,n[1],r);if(n.length===2){let e=[];for(let t of o)for(let n of s){let r=t,i=n;for(let t=r;t<i;t++)if(e.push(t),a(e))return e}return e}let c=i(e,n[2],r),l=[];for(let e of o)for(let t of s)for(let n of c){let r=e,i=t,o=n;if(o!==0){if(o>0){for(let e=r;e<i;e+=o)if(l.push(e),a(l))return l}else for(let e=r;e>i;e+=o)if(l.push(e),a(l))return l}}return l}case`limit`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let i=t;if(i<0)throw Error(`limit doesn't support negative count`);if(i===0)return[];let o;try{o=a(e,n[1],r)}catch(e){if(e instanceof s)throw e;o=[]}return o.slice(0,i)});case`isempty`:if(n.length<1)return[!0];try{return[a(e,n[0],r).length===0]}catch(e){if(e instanceof s)throw e;return[!0]}case`isvalid`:if(n.length<1)return[!0];try{return[i(e,n[0],r).length>0]}catch(e){if(e instanceof s)throw e;return[!1]}case`skip`:return n.length<2?[]:i(e,n[0],r).flatMap(t=>{let a=t;if(a<0)throw Error(`skip doesn't support negative count`);return i(e,n[1],r).slice(a)});case`until`:{if(n.length<2)return[e];let t=e,a=r.limits.maxIterations;for(let e=0;e<a;e++){if(i(t,n[0],r).some(o))return[t];let e=i(t,n[1],r);if(e.length===0)return[t];t=e[0]}throw new s(`jq until: too many iterations (${a}), increase executionLimits.maxJqIterations`,`iterations`)}case`while`:{if(n.length<2)return[e];let t=[],a=e,c=r.limits.maxIterations;for(let e=0;e<c&&i(a,n[0],r).some(o);e++){t.push(a);let e=i(a,n[1],r);if(e.length===0)break;a=e[0]}if(t.length>=c)throw new s(`jq while: too many iterations (${c}), increase executionLimits.maxJqIterations`,`iterations`);return t}case`repeat`:{if(n.length===0)return[e];let t=[],a=e,o=r.limits.maxIterations;for(let e=0;e<o;e++){t.push(a);let e=i(a,n[0],r);if(e.length===0)break;a=e[0]}if(t.length>=o)throw new s(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,`iterations`);return t}default:return null}}var qg=S(()=>{});function Jg(e,t,n,r,i){switch(t){case`now`:return[Date.now()/1e3];case`gmtime`:{if(typeof e!=`number`)return[null];let t=new Date(e*1e3),n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate(),a=t.getUTCHours(),o=t.getUTCMinutes(),s=t.getUTCSeconds(),c=t.getUTCDay(),l=Date.UTC(n,0,1);return[[n,r,i,a,o,s,c,Math.floor((t.getTime()-l)/(1440*60*1e3))]]}case`mktime`:{if(!Array.isArray(e))throw Error(`mktime requires parsed datetime inputs`);let[t,n,r,i=0,a=0,o=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`mktime requires parsed datetime inputs`);return[Math.floor(Date.UTC(t,n,r??1,i??0,a??0,o??0)/1e3)]}case`strftime`:{if(n.length===0)return[null];let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strftime/1 requires a string format`);let a;if(typeof e==`number`)a=new Date(e*1e3);else if(Array.isArray(e)){let[t,n,r,i=0,o=0,s=0]=e;if(typeof t!=`number`||typeof n!=`number`)throw Error(`strftime/1 requires parsed datetime inputs`);a=new Date(Date.UTC(t,n,r??1,i??0,o??0,s??0))}else throw Error(`strftime/1 requires parsed datetime inputs`);let o=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],s=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],c=(e,t=2)=>String(e).padStart(t,`0`);return[t.replace(/%Y/g,String(a.getUTCFullYear())).replace(/%m/g,c(a.getUTCMonth()+1)).replace(/%d/g,c(a.getUTCDate())).replace(/%H/g,c(a.getUTCHours())).replace(/%M/g,c(a.getUTCMinutes())).replace(/%S/g,c(a.getUTCSeconds())).replace(/%A/g,o[a.getUTCDay()]).replace(/%B/g,s[a.getUTCMonth()]).replace(/%Z/g,`UTC`).replace(/%%/g,`%`)]}case`strptime`:{if(n.length===0)return[null];if(typeof e!=`string`)throw Error(`strptime/1 requires a string input`);let t=i(e,n[0],r)[0];if(typeof t!=`string`)throw Error(`strptime/1 requires a string format`);if(t===`%Y-%m-%dT%H:%M:%SZ`){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(t){let[,e,n,r,i,a,o]=t.map(Number),s=new Date(Date.UTC(e,n-1,r,i,a,o)),c=s.getUTCDay(),l=Date.UTC(e,0,1),u=Math.floor((s.getTime()-l)/(1440*60*1e3));return[[e,n-1,r,i,a,o,c,u]]}}let a=new Date(e);if(!Number.isNaN(a.getTime())){let e=a.getUTCFullYear(),t=a.getUTCMonth(),n=a.getUTCDate(),r=a.getUTCHours(),i=a.getUTCMinutes(),o=a.getUTCSeconds(),s=a.getUTCDay(),c=Date.UTC(e,0,1);return[[e,t,n,r,i,o,s,Math.floor((a.getTime()-c)/(1440*60*1e3))]]}throw Error(`Cannot parse date: ${e}`)}case`fromdate`:{if(typeof e!=`string`)throw Error(`fromdate requires a string input`);let t=new Date(e);if(Number.isNaN(t.getTime()))throw Error(`date "${e}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(t.getTime()/1e3)]}case`todate`:if(typeof e!=`number`)throw Error(`todate requires a number input`);return[new Date(e*1e3).toISOString().replace(/\.\d{3}Z$/,`Z`)];default:return null}}var Yg=S(()=>{});function Xg(e){return e!==!1&&e!==null}function Zg(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Qg(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`string`&&typeof t==`string`?e.localeCompare(t):0}function $g(e,t){let n=pc(e);for(let e of Object.keys(t)){if(!sc(e))continue;let r=lc(n,e)?dc(n[e]):null,i=dc(t[e]);r&&i?cc(n,e,$g(r,i)):cc(n,e,t[e])}return n}function e_(e,t=3e3){let n=0,r=e;for(;n<t;)if(Array.isArray(r)){if(r.length===0)return n+1;r=r[0],n++}else if(typeof r==`object`&&r){let e=Object.keys(r);if(e.length===0)return n+1;r=r[e[0]],n++}else return n;return n}function t_(e,t){let n=e=>e===null?0:typeof e==`boolean`?1:typeof e==`number`?2:typeof e==`string`?3:Array.isArray(e)?4:typeof e==`object`?5:6,r=n(e),i=n(t);if(r!==i)return r-i;if(typeof e==`number`&&typeof t==`number`)return e-t;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`boolean`&&typeof t==`boolean`)return!!e-+!!t;if(Array.isArray(e)&&Array.isArray(t)){for(let n=0;n<Math.min(e.length,t.length);n++){let r=t_(e[n],t[n]);if(r!==0)return r}return e.length-t.length}let a=dc(e),o=dc(t);if(a&&o){let e=Object.keys(a).sort(),t=Object.keys(o).sort();for(let n=0;n<Math.min(e.length,t.length);n++){let r=e[n].localeCompare(t[n]);if(r!==0)return r}if(e.length!==t.length)return e.length-t.length;for(let t of e){let e=t_(a[t],o[t]);if(e!==0)return e}}return 0}function n_(e,t){if(Zg(e,t))return!0;if(typeof e==`string`&&typeof t==`string`)return e.includes(t);if(Array.isArray(e)&&Array.isArray(t))return t.every(t=>e.some(e=>n_(e,t)));let n=dc(e),r=dc(t);return n&&r?Object.keys(r).every(e=>lc(n,e)&&n_(n[e],r[e])):!1}var r_=S(()=>{gc()});function i_(e,t,n){switch(t){case`@base64`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`utf-8`).toString(`base64`)]:[btoa(e)]:[null];case`@base64d`:return typeof e==`string`?typeof Buffer<`u`?[Buffer.from(e,`base64`).toString(`utf-8`)]:[atob(e)]:[null];case`@uri`:return typeof e==`string`?[encodeURIComponent(e).replace(/!/g,`%21`).replace(/'/g,`%27`).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/\*/g,`%2A`)]:[null];case`@urid`:return typeof e==`string`?[decodeURIComponent(e)]:[null];case`@csv`:return Array.isArray(e)?[e.map(e=>{if(e===null)return``;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return String(e);let t=String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
625
+ `)||t.includes(`\r`)?`"${t.replace(/"/g,`""`)}"`:t}).join(`,`)]:[null];case`@tsv`:return Array.isArray(e)?[e.map(e=>String(e??``).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`)).join(` `)]:[null];case`@json`:{let t=n??a_;return e_(e,t+1)>t?[null]:[JSON.stringify(e)]}case`@html`:return typeof e==`string`?[e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/'/g,`&apos;`).replace(/"/g,`&quot;`)]:[null];case`@sh`:return typeof e==`string`?[`'${e.replace(/'/g,`'\\''`)}'`]:[null];case`@text`:return typeof e==`string`?[e]:e==null?[``]:[String(e)];default:return null}}var a_,o_=S(()=>{r_(),a_=2e3});function s_(e,t,n,r,i,a){switch(t){case`index`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){if(t===``&&e===``)return null;let n=e.indexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=0;n<=e.length-t.length;n++){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}let n=e.findIndex(e=>a(e,t));return n>=0?n:null}return null});case`rindex`:return n.length===0?[null]:i(e,n[0],r).map(t=>{if(typeof e==`string`&&typeof t==`string`){let n=e.lastIndexOf(t);return n>=0?n:null}if(Array.isArray(e)){if(Array.isArray(t)){for(let n=e.length-t.length;n>=0;n--){let r=!0;for(let i=0;i<t.length;i++)if(!a(e[n+i],t[i])){r=!1;break}if(r)return n}return null}for(let n=e.length-1;n>=0;n--)if(a(e[n],t))return n;return null}return null});case`indices`:return n.length===0?[[]]:i(e,n[0],r).map(t=>{let n=[];if(typeof e==`string`&&typeof t==`string`){let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1)}else if(Array.isArray(e))if(Array.isArray(t)){let r=t.length;if(r===0)for(let t=0;t<=e.length;t++)n.push(t);else for(let i=0;i<=e.length-r;i++){let o=!0;for(let n=0;n<r;n++)if(!a(e[i+n],t[n])){o=!1;break}o&&n.push(i)}}else for(let r=0;r<e.length;r++)a(e[r],t)&&n.push(r);return n});default:return null}}var c_=S(()=>{});function l_(e,t,n,r,i){switch(t){case`fabs`:case`abs`:return typeof e==`number`?[Math.abs(e)]:typeof e==`string`?[e]:[null];case`exp10`:return typeof e==`number`?[10**e]:[null];case`exp2`:return typeof e==`number`?[2**e]:[null];case`pow`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[o**s]}case`atan2`:{if(n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=t[0],s=a[0];return typeof o!=`number`||typeof s!=`number`?[null]:[Math.atan2(o,s)]}case`hypot`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.hypot(e,t)]}case`fma`:{if(typeof e!=`number`||n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[e*t+a]}case`copysign`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.sign(t)*Math.abs(e)]}case`drem`:case`remainder`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[e-Math.round(e/t)*t]}case`fdim`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(0,e-t)]}case`fmax`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.max(e,t)]}case`fmin`:{if(typeof e!=`number`||n.length===0)return[null];let t=i(e,n[0],r)[0];return[Math.min(e,t)]}case`ldexp`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`scalbn`:case`scalbln`:return typeof e!=`number`||n.length===0?[null]:[e*2**i(e,n[0],r)[0]];case`nearbyint`:return typeof e==`number`?[Math.round(e)]:[null];case`logb`:return typeof e==`number`?[Math.floor(Math.log2(Math.abs(e)))]:[null];case`significand`:return typeof e==`number`?[e/2**Math.floor(Math.log2(Math.abs(e)))]:[null];case`frexp`:if(typeof e==`number`){if(e===0)return[[0,0]];let t=Math.floor(Math.log2(Math.abs(e)))+1;return[[e/2**t,t]]}return[null];case`modf`:if(typeof e==`number`){let t=Math.trunc(e);return[[e-t,t]]}return[null];default:return null}}var u_=S(()=>{});function d_(e,t,n,r,i,a,o,s){switch(t){case`recurse`:{if(n.length===0){let t=[],n=e=>{if(t.push(e),Array.isArray(e))for(let t of e)n(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))n(e[t])};return n(e),t}let t=[],o=n.length>=2?n[1]:null,s=0,c=e=>{if(s++>1e4||o&&!i(e,o,r).some(a))return;t.push(e);let l=i(e,n[0],r);for(let e of l)e!=null&&c(e)};return c(e),t}case`recurse_down`:return s(e,`recurse`,n,r);case`walk`:{if(n.length===0)return[e];let t=new WeakSet,a=e=>{if(e&&typeof e==`object`){if(t.has(e))return e;t.add(e)}let o;if(Array.isArray(e))o=e.map(a);else if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,r]of Object.entries(e))sc(n)&&cc(t,n,a(r));o=t}else o=e;return i(o,n[0],r)[0]};return[a(e)]}case`transpose`:{if(!Array.isArray(e))return[null];if(e.length===0)return[[]];let t=Math.max(...e.map(e=>Array.isArray(e)?e.length:0)),n=[];for(let r=0;r<t;r++)n.push(e.map(e=>Array.isArray(e)?e[r]:null));return[n]}case`combinations`:{if(n.length>0){let t=i(e,n[0],r)[0];if(!Array.isArray(e)||t<0)return[];if(t===0)return[[]];let a=[],o=(n,r)=>{if(r===t){a.push([...n]);return}for(let t of e)n.push(t),o(n,r+1),n.pop()};return o([],0),a}if(!Array.isArray(e))return[];if(e.length===0)return[[]];for(let t of e)if(!Array.isArray(t))return[];let t=[],a=(n,r)=>{if(n===e.length){t.push([...r]);return}let i=e[n];for(let e of i)r.push(e),a(n+1,r),r.pop()};return a(0,[]),t}case`parent`:{if(r.root===void 0||r.currentPath===void 0)return[];let t=r.currentPath;if(t.length===0)return[];let a=n.length>0?i(e,n[0],r)[0]:1;if(a>=0){if(a>t.length)return[];let e=t.slice(0,t.length-a);return[o(r.root,e)]}else{let n=-a-1;if(n>=t.length)return[e];let i=t.slice(0,n);return[o(r.root,i)]}}case`parents`:{if(r.root===void 0||r.currentPath===void 0)return[[]];let e=r.currentPath,t=[];for(let n=e.length-1;n>=0;n--)t.push(o(r.root,e.slice(0,n)));return[t]}case`root`:return r.root===void 0?[]:[r.root];default:return null}}var f_=S(()=>{gc()});function p_(e,t,n,r,i){switch(t){case`keys`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e).sort()]:[null];case`keys_unsorted`:return Array.isArray(e)?[e.map((e,t)=>t)]:e&&typeof e==`object`?[Object.keys(e)]:[null];case`length`:return typeof e==`string`||Array.isArray(e)?[e.length]:e&&typeof e==`object`?[Object.keys(e).length]:e===null?[0]:typeof e==`number`?[Math.abs(e)]:[null];case`utf8bytelength`:{if(typeof e==`string`)return[new TextEncoder().encode(e).length];let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) only strings have UTF-8 byte length`)}case`to_entries`:{let t=dc(e);return t?[Object.entries(t).map(([e,t])=>({key:e,value:t}))]:[null]}case`from_entries`:if(Array.isArray(e)){let t=Object.create(null);for(let n of e){let e=dc(n);if(e){let n=e.key??e.Key??e.name??e.Name??e.k,r=e.value??e.Value??e.v;if(n!==void 0){let e=String(n);sc(e)&&cc(t,e,r)}}}return[t]}return[null];case`with_entries`:{if(n.length===0)return[e];let t=dc(e);if(t){let e=Object.entries(t).map(([e,t])=>({key:e,value:t})).flatMap(e=>i(e,n[0],r)),a=Object.create(null);for(let t of e){let e=dc(t);if(e){let t=e.key??e.name??e.k,n=e.value??e.v;if(t!==void 0){let e=String(t);sc(e)&&cc(a,e,n)}}}return[a]}return[null]}case`reverse`:return Array.isArray(e)?[[...e].reverse()]:typeof e==`string`?[e.split(``).reverse().join(``)]:[null];case`flatten`:return Array.isArray(e)?(n.length>0?i(e,n[0],r):[1/0]).map(t=>{let n=t;if(n<0)throw Error(`flatten depth must not be negative`);return e.flat(n)}):[null];case`unique`:if(Array.isArray(e)){let t=new Set,n=[];for(let r of e){let e=JSON.stringify(r);t.has(e)||(t.add(e),n.push(r))}return[n]}return[null];case`tojson`:case`tojsonstream`:{let t=r.limits.maxDepth??m_;return e_(e,t+1)>t?[null]:[JSON.stringify(e)]}case`fromjson`:if(typeof e==`string`){let t=e.trim().toLowerCase();if(t===`nan`)return[NaN];if(t===`inf`||t===`infinity`)return[1/0];if(t===`-inf`||t===`-infinity`)return[-1/0];try{return[uc(JSON.parse(e))]}catch{throw Error(`Invalid JSON: ${e}`)}}return[e];case`tostring`:return typeof e==`string`?[e]:[JSON.stringify(e)];case`tonumber`:if(typeof e==`number`)return[e];if(typeof e==`string`){let t=Number(e);if(Number.isNaN(t))throw Error(`${JSON.stringify(e)} cannot be parsed as a number`);return[t]}throw Error(`${typeof e} cannot be parsed as a number`);case`toboolean`:{if(typeof e==`boolean`)return[e];if(typeof e==`string`){if(e===`true`)return[!0];if(e===`false`)return[!1];throw Error(`string (${JSON.stringify(e)}) cannot be parsed as a boolean`)}let t=e===null?`null`:Array.isArray(e)?`array`:typeof e,n=t===`array`||t===`object`?JSON.stringify(e):String(e);throw Error(`${t} (${n}) cannot be parsed as a boolean`)}case`tostream`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push([r,e]);else if(Array.isArray(e))if(e.length===0)t.push([r,[]]);else for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else{let i=Object.keys(e);if(i.length===0)t.push([r,Object.create(null)]);else for(let t of i)n(e[t],[...r,t])}};return n(e,[]),t.push([[]]),t}case`fromstream`:{if(n.length===0)return[e];let t=i(e,n[0],r),a=null;for(let e of t){if(!Array.isArray(e)||e.length===1&&Array.isArray(e[0])&&e[0].length===0||e.length!==2)continue;let[t,n]=e;if(!Array.isArray(t))continue;if(t.length===0){a=n;continue}a===null&&(a=typeof t[0]==`number`?[]:Object.create(null));let r=a;for(let e=0;e<t.length-1;e++){let n=t[e],i=t[e+1];if(Array.isArray(r)&&typeof n==`number`){for(;r.length<=n;)r.push(null);r[n]===null&&(r[n]=typeof i==`number`?[]:Object.create(null)),r=r[n]}else{let e=dc(r);if(e){let t=String(n);if(!sc(t))continue;(e[t]===null||e[t]===void 0)&&cc(e,t,typeof i==`number`?[]:Object.create(null)),r=e[t]}}}let i=t[t.length-1];if(Array.isArray(r)&&typeof i==`number`){for(;r.length<=i;)r.push(null);r[i]=n}else{let e=dc(r);if(e){let t=String(i);sc(t)&&cc(e,t,n)}}}return[a]}case`truncate_stream`:{let t=typeof e==`number`?Math.floor(e):0;if(n.length===0)return[];let a=[],o=i(e,n[0],r);for(let e of o)if(Array.isArray(e)){if(e.length===1&&Array.isArray(e[0])){let n=e[0];n.length>t&&a.push([n.slice(t)]);continue}if(e.length===2&&Array.isArray(e[0])){let n=e[0],r=e[1];n.length>t&&a.push([n.slice(t),r])}}return a}default:return null}}var m_,h_=S(()=>{gc(),r_(),m_=2e3});function g_(e,t,n,r,i,a,o,s,c,l){switch(t){case`getpath`:{if(n.length===0)return[null];let t=i(e,n[0],r),a=[];for(let n of t){let t=n,r=e;for(let e of t){if(r==null){r=null;break}if(Array.isArray(r)&&typeof e==`number`)r=r[e];else if(typeof e==`string`){let t=dc(r);if(!t||!Object.hasOwn(t,e)){r=null;break}r=t[e]}else{r=null;break}}a.push(r)}return a}case`setpath`:{if(n.length<2)return[null];let t=i(e,n[0],r)[0],a=i(e,n[1],r)[0];return[o(e,t,a)]}case`delpaths`:{if(n.length===0)return[e];let t=i(e,n[0],r)[0],a=e;for(let e of t.sort((e,t)=>t.length-e.length))a=s(a,e);return[a]}case`path`:{if(n.length===0)return[[]];let t=[];return l(e,n[0],r,[],t),t}case`del`:return n.length===0?[e]:[c(e,n[0],r)];case`pick`:{if(n.length===0)return[null];let t=[];for(let i of n)l(e,i,r,[],t);let i=null;for(let n of t){for(let e of n)if(typeof e==`number`&&e<0)throw Error(`Out of bounds negative array index`);let t=e;for(let e of n){if(t==null)break;if(Array.isArray(t)&&typeof e==`number`)t=t[e];else if(typeof e==`string`){let n=dc(t);if(!n||!Object.hasOwn(n,e)){t=null;break}t=n[e]}else{t=null;break}}i=o(i,n,t)}return[i]}case`paths`:{let t=[],o=(e,n)=>{if(e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t.push([...n,r]),o(e[r],[...n,r]);else for(let r of Object.keys(e))t.push([...n,r]),o(e[r],[...n,r])};return o(e,[]),n.length>0?t.filter(t=>{let o=e;for(let e of t)if(Array.isArray(o)&&typeof e==`number`)o=o[e];else if(typeof e==`string`){let t=dc(o);if(!t||!Object.hasOwn(t,e))return!1;o=t[e]}else return!1;return i(o,n[0],r).some(a)}):t}case`leaf_paths`:{let t=[],n=(e,r)=>{if(typeof e!=`object`||!e)t.push(r);else if(Array.isArray(e))for(let t=0;t<e.length;t++)n(e[t],[...r,t]);else for(let t of Object.keys(e))n(e[t],[...r,t])};return n(e,[]),t}default:return null}}var __=S(()=>{gc()});function v_(e,t,n,r,i,a){switch(t){case`IN`:{if(n.length===0)return[!1];if(n.length===1){let t=i(e,n[0],r);for(let n of t)if(a(e,n))return[!0];return[!1]}let t=i(e,n[0],r),o=i(e,n[1],r),s=new Set(o.map(e=>JSON.stringify(e)));for(let e of t)if(s.has(JSON.stringify(e)))return[!0];return[!1]}case`INDEX`:{if(n.length===0)return[Object.create(null)];if(n.length===1){let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=String(e);sc(t)&&cc(a,t,e)}return[a]}if(n.length===2){let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=i(e,n[1],r);if(t.length>0){let n=String(t[0]);sc(n)&&cc(a,n,e)}}return[a]}let t=i(e,n[0],r),a=Object.create(null);for(let e of t){let t=i(e,n[1],r),o=i(e,n[2],r);if(t.length>0&&o.length>0){let e=String(t[0]);sc(e)&&cc(a,e,o[0])}}return[a]}case`JOIN`:{if(n.length<2)return[null];let t=dc(i(e,n[0],r)[0]);if(!t||!Array.isArray(e))return[null];let a=[];for(let o of e){let e=i(o,n[1],r),s=e.length>0?String(e[0]):``,c=lc(t,s)?t[s]:null;a.push([o,c])}return[a]}default:return null}}var y_=S(()=>{gc()});function b_(e,t,n,r,i){switch(t){case`join`:{if(!Array.isArray(e))return[null];let t=n.length>0?i(e,n[0],r):[``];for(let t of e)if(Array.isArray(t)||typeof t==`object`&&t)throw Error(`cannot join: contains arrays or objects`);return t.map(t=>e.map(e=>e===null?``:typeof e==`string`?e:String(e)).join(String(t)))}case`split`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);return[e.split(a)]}case`splits`:{if(typeof e!=`string`||n.length===0)return[];let t=i(e,n[0],r),a=String(t[0]);try{let t=n.length>1?String(i(e,n[1],r)[0]):`g`;return z(a,t.includes(`g`)?t:`${t}g`).split(e)}catch{return[]}}case`scan`:{if(typeof e!=`string`||n.length===0)return[];let t=i(e,n[0],r),a=String(t[0]);try{let t=n.length>1?String(i(e,n[1],r)[0]):``;return[...z(a,t.includes(`g`)?t:`${t}g`).matchAll(e)].map(e=>e.length>1?e.slice(1):e[0])}catch{return[]}}case`test`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r),a=String(t[0]);try{return[z(a,n.length>1?String(i(e,n[1],r)[0]):``).test(e)]}catch{return[!1]}}case`match`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);try{let t=z(a,`${n.length>1?String(i(e,n[1],r)[0]):``}d`).exec(e);if(!t)return[];let o=t.indices;return[{offset:t.index,length:t[0].length,string:t[0],captures:t.slice(1).map((e,t)=>({offset:o?.[t+1]?.[0]??null,length:e?.length??0,string:e??``,name:null}))}]}catch{return[null]}}case`capture`:{if(typeof e!=`string`||n.length===0)return[null];let t=i(e,n[0],r),a=String(t[0]);try{let t=z(a,n.length>1?String(i(e,n[1],r)[0]):``).match(e);return!t||!t.groups?[Object.create(null)]:[t.groups]}catch{return[null]}}case`sub`:{if(typeof e!=`string`||n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=String(t[0]),s=String(a[0]);try{return[z(o,n.length>2?String(i(e,n[2],r)[0]):``).replace(e,s)]}catch{return[e]}}case`gsub`:{if(typeof e!=`string`||n.length<2)return[null];let t=i(e,n[0],r),a=i(e,n[1],r),o=String(t[0]),s=String(a[0]);try{let t=n.length>2?String(i(e,n[2],r)[0]):`g`;return[z(o,t.includes(`g`)?t:`${t}g`).replace(e,s)]}catch{return[e]}}case`ascii_downcase`:return typeof e==`string`?[e.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))]:[null];case`ascii_upcase`:return typeof e==`string`?[e.replace(/[a-z]/g,e=>String.fromCharCode(e.charCodeAt(0)-32))]:[null];case`ltrimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);return[e.startsWith(a)?e.slice(a.length):e]}case`rtrimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);return a===``?[e]:[e.endsWith(a)?e.slice(0,-a.length):e]}case`trimstr`:{if(typeof e!=`string`||n.length===0)return[e];let t=i(e,n[0],r),a=String(t[0]);if(a===``)return[e];let o=e;return o.startsWith(a)&&(o=o.slice(a.length)),o.endsWith(a)&&(o=o.slice(0,-a.length)),[o]}case`trim`:if(typeof e==`string`)return[e.trim()];throw Error(`trim input must be a string`);case`ltrim`:if(typeof e==`string`)return[e.trimStart()];throw Error(`trim input must be a string`);case`rtrim`:if(typeof e==`string`)return[e.trimEnd()];throw Error(`trim input must be a string`);case`startswith`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r);return[e.startsWith(String(t[0]))]}case`endswith`:{if(typeof e!=`string`||n.length===0)return[!1];let t=i(e,n[0],r);return[e.endsWith(String(t[0]))]}case`ascii`:return typeof e==`string`&&e.length>0?[e.charCodeAt(0)]:[null];case`explode`:return typeof e==`string`?[Array.from(e).map(e=>e.codePointAt(0))]:[null];case`implode`:if(!Array.isArray(e))throw Error(`implode input must be an array`);return[e.map(e=>{if(typeof e==`string`)throw Error(`string (${JSON.stringify(e)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof e!=`number`||Number.isNaN(e))throw Error(`number (null) can't be imploded, unicode codepoint needs to be numeric`);let t=Math.trunc(e);return t<0||t>1114111||t>=55296&&t<=57343?String.fromCodePoint(65533):String.fromCodePoint(t)}).join(``)];default:return null}}var x_=S(()=>{xs()});function S_(e,t){switch(t){case`type`:return e===null?[`null`]:Array.isArray(e)?[`array`]:typeof e==`boolean`?[`boolean`]:typeof e==`number`?[`number`]:typeof e==`string`?[`string`]:typeof e==`object`?[`object`]:[`null`];case`infinite`:return[1/0];case`nan`:return[NaN];case`isinfinite`:return[typeof e==`number`&&!Number.isFinite(e)];case`isnan`:return[typeof e==`number`&&Number.isNaN(e)];case`isnormal`:return[typeof e==`number`&&Number.isFinite(e)&&e!==0];case`isfinite`:return[typeof e==`number`&&Number.isFinite(e)];case`numbers`:return typeof e==`number`?[e]:[];case`strings`:return typeof e==`string`?[e]:[];case`booleans`:return typeof e==`boolean`?[e]:[];case`nulls`:return e===null?[e]:[];case`arrays`:return Array.isArray(e)?[e]:[];case`objects`:return e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`iterables`:return Array.isArray(e)||e&&typeof e==`object`&&!Array.isArray(e)?[e]:[];case`scalars`:return!Array.isArray(e)&&!(e&&typeof e==`object`)?[e]:[];case`values`:return e===null?[]:[e];case`not`:return e===!1||e===null?[!0]:[!1];case`null`:return[null];case`true`:return[!0];case`false`:return[!1];case`empty`:return[];default:return null}}var C_=S(()=>{}),w_=S(()=>{Gg(),qg(),Yg(),o_(),c_(),u_(),f_(),h_(),__(),y_(),x_(),C_()});function T_(e,t,n){if(t.length===0)return n;let[r,...i]=t;if(typeof r==`number`){if(e&&typeof e==`object`&&!Array.isArray(e))throw Error(`Cannot index object with number`);if(r>536870911)throw Error(`Array index too large`);if(r<0)throw Error(`Out of bounds negative array index`);let t=Array.isArray(e)?[...e]:[];for(;t.length<=r;)t.push(null);return t[r]=T_(t[r],i,n),t}if(Array.isArray(e))throw Error(`Cannot index array with string`);if(!sc(r))return e??Object.create(null);let a=dc(e),o=a?pc(a):Object.create(null);return cc(o,r,T_(Object.hasOwn(o,r)?o[r]:void 0,i,n)),o}function E_(e,t){if(t.length===0)return null;if(t.length===1){let n=t[0];if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t.splice(n,1),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!sc(t))return e;let r=pc(e);return delete r[t],r}return e}let[n,...r]=t;if(Array.isArray(e)&&typeof n==`number`){let t=[...e];return t[n]=E_(t[n],r),t}if(e&&typeof e==`object`&&!Array.isArray(e)){let t=String(n);if(!sc(t))return e;let i=pc(e);return Object.hasOwn(i,t)&&cc(i,t,E_(i[t],r)),i}return e}var D_=S(()=>{gc()});function O_(e){return{vars:new Map,limits:{maxIterations:e?.limits?.maxIterations??U_,maxDepth:e?.limits?.maxDepth??W_},env:e?.env,coverage:e?.coverage,requireDefenseContext:e?.requireDefenseContext,defenseContextChecked:!1}}function k_(e,t,n){let r=new Map(e.vars);return r.set(t,n),{vars:r,limits:e.limits,env:e.env,requireDefenseContext:e.requireDefenseContext,defenseContextChecked:e.defenseContextChecked,root:e.root,currentPath:e.currentPath,funcs:e.funcs,labels:e.labels,coverage:e.coverage}}function A_(e,t,n){switch(t.type){case`var`:return k_(e,t.name,n);case`array`:{if(!Array.isArray(n))return null;let r=e;for(let e=0;e<t.elements.length;e++){let i=t.elements[e],a=e<n.length?n[e]:null,o=A_(r,i,a);if(o===null)return null;r=o}return r}case`object`:{let r=dc(n);if(!r)return null;let i=e;for(let a of t.fields){let t;if(typeof a.key==`string`)t=a.key;else{let r=W(n,a.key,e);if(r.length===0)return null;t=String(r[0])}let o=lc(r,t)?r[t]:null;a.keyVar&&(i=k_(i,a.keyVar,o));let s=A_(i,a.pattern,o);if(s===null)return null;i=s}return i}}}function j_(e,t){let n=e;for(let e of t)if(n&&typeof n==`object`)if(Array.isArray(n))if(typeof e==`number`)n=n[e];else return;else{let t=dc(n);if(t&&typeof e==`string`&&Object.hasOwn(t,e))n=t[e];else return}else return;return n}function M_(e){if(e.type===`Identity`)return[];if(e.type===`Field`){let t=e.base?M_(e.base):[];return t===null?null:[...t,e.name]}if(e.type===`Index`&&e.index.type===`Literal`){let t=e.base?M_(e.base):[];if(t===null)return null;let n=e.index.value;return typeof n==`number`||typeof n==`string`?[...t,n]:null}if(e.type===`Pipe`){let t=M_(e.left);return t===null?null:N_(t,e.right)}if(e.type===`Call`){if(e.name===`parent`||e.name===`root`)return null;if(e.name===`first`&&e.args.length===0)return[0];if(e.name===`last`&&e.args.length===0)return[-1]}return null}function N_(e,t){if(t.type===`Call`){if(t.name===`parent`){let n=1;if(t.args.length>0&&t.args[0].type===`Literal`){let e=t.args[0].value;typeof e==`number`&&(n=e)}if(n>=0)return e.slice(0,Math.max(0,e.length-n));{let t=-n-1;return e.slice(0,Math.min(t,e.length))}}if(t.name===`root`)return[]}if(t.type===`Field`){let n=M_(t);if(n!==null)return[...e,...n]}if(t.type===`Index`&&t.index.type===`Literal`){let n=M_(t);if(n!==null)return[...e,...n]}if(t.type===`Pipe`){let n=N_(e,t.left);return n===null?null:N_(n,t.right)}return t.type===`Identity`?e:null}function P_(e,t,n){if(t.type===`Comma`){let r=[];try{r.push(...W(e,t.left,n))}catch(e){if(e instanceof k)throw e;if(r.length>0)return r;throw Error(`evaluation failed`)}try{r.push(...W(e,t.right,n))}catch(e){if(e instanceof k)throw e;return r}return r}return W(e,t,n)}function W(e,t,n){let r=n&&`vars`in n?n:O_(n);switch(r.defenseContextChecked||(ul(r.requireDefenseContext,`query-engine`,`evaluation`),r={...r,defenseContextChecked:!0}),r.root===void 0&&(r={...r,root:e,currentPath:[]}),r.coverage?.hit(`jq:node:${t.type}`),t.type){case`Identity`:return[e];case`Field`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>{let n=dc(e);if(n){if(!Object.hasOwn(n,t.name))return[null];let e=n[t.name];return[e===void 0?null:e]}if(e===null)return[null];throw Error(`Cannot index ${Array.isArray(e)?`array`:typeof e} with string "${t.name}"`)});case`Index`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>W(e,t.index,r).flatMap(t=>{if(typeof t==`number`&&Array.isArray(e)){if(Number.isNaN(t))return[null];let n=Math.trunc(t),r=n<0?e.length+n:n;return r>=0&&r<e.length?[e[r]]:[null]}if(typeof t==`string`){let n=dc(e);return!n||!Object.hasOwn(n,t)?[null]:[n[t]]}return[null]}));case`Slice`:return(t.base?W(e,t.base,r):[e]).flatMap(n=>{if(n===null)return[null];if(!Array.isArray(n)&&typeof n!=`string`)throw Error(`Cannot slice ${typeof n} (${JSON.stringify(n)})`);let i=n.length,a=t.start?W(e,t.start,r):[0],o=t.end?W(e,t.end,r):[i];return a.flatMap(e=>o.map(t=>{let r=e,a=t,o=Number.isNaN(r)?0:Number.isInteger(r)?r:Math.floor(r),s=Number.isNaN(a)?i:Number.isInteger(a)?a:Math.ceil(a),c=F_(o,i),l=F_(s,i);return n.slice(c,l)}))});case`Iterate`:return(t.base?W(e,t.base,r):[e]).flatMap(e=>Array.isArray(e)?e:e&&typeof e==`object`?Object.values(e):[]);case`Pipe`:{let n=W(e,t.left,r),i=M_(t.left),a=[];for(let e of n)try{if(i!==null){let n={...r,currentPath:[...r.currentPath??[],...i]};a.push(...W(e,t.right,n))}else a.push(...W(e,t.right,r))}catch(e){throw e instanceof V_?e.withPrependedResults(a):e}return a}case`Comma`:{let n=W(e,t.left,r),i=W(e,t.right,r);return[...n,...i]}case`Literal`:return[t.value];case`Array`:return t.elements?[W(e,t.elements,r)]:[[]];case`Object`:{let n=[Object.create(null)];for(let i of t.entries){let t=typeof i.key==`string`?[i.key]:W(e,i.key,r),a=W(e,i.value,r),o=[];for(let e of n)for(let n of t){if(typeof n!=`string`)throw Error(`Cannot use ${n===null?`null`:Array.isArray(n)?`array`:typeof n} (${JSON.stringify(n)}) as object key`);if(!sc(n)){for(let t of a)o.push(pc(e));continue}for(let t of a){let r=pc(e);cc(r,n,t),o.push(r)}}n.length=0,n.push(...o)}return n}case`Paren`:return W(e,t.expr,r);case`BinaryOp`:return R_(e,t.op,t.left,t.right,r);case`UnaryOp`:return W(e,t.operand,r).map(e=>{if(t.op===`-`){if(typeof e==`number`)return-e;if(typeof e==`string`)throw Error(`string (${(e=>e.length>5?`"${e.slice(0,3)}...`:JSON.stringify(e))(e)}) cannot be negated`);return null}return t.op===`not`?!Xg(e):null});case`Cond`:return W(e,t.cond,r).flatMap(n=>{if(Xg(n))return W(e,t.then,r);for(let n of t.elifs)if(W(e,n.cond,r).some(Xg))return W(e,n.then,r);return t.else?W(e,t.else,r):[e]});case`Try`:try{return W(e,t.body,r)}catch(e){return t.catch?W(e instanceof H_?e.value:e instanceof Error?e.message:String(e),t.catch,r):[]}case`Call`:return z_(e,t.name,t.args,r);case`VarBind`:return W(e,t.value,r).flatMap(n=>{let i=null,a=[];t.pattern?a.push(t.pattern):t.name&&a.push({type:`var`,name:t.name}),t.alternatives&&a.push(...t.alternatives);for(let e of a)if(i=A_(r,e,n),i!==null)break;return i===null?[]:W(e,t.body,i)});case`VarRef`:{if(t.name===`$ENV`)return[r.env?ql(r.env):Object.create(null)];let e=r.vars.get(t.name);return e===void 0?[null]:[e]}case`Recurse`:{let t=[],n=new WeakSet,r=e=>{if(e&&typeof e==`object`){if(n.has(e))return;n.add(e)}if(t.push(e),Array.isArray(e))for(let t of e)r(t);else if(e&&typeof e==`object`)for(let t of Object.keys(e))r(e[t])};return r(e),t}case`Optional`:try{return W(e,t.expr,r)}catch{return[]}case`StringInterp`:return[t.parts.map(t=>typeof t==`string`?t:W(e,t,r).map(e=>typeof e==`string`?e:JSON.stringify(e)).join(``)).join(``)];case`UpdateOp`:return[I_(e,t.path,t.op,t.value,r)];case`Reduce`:{let n=W(e,t.expr,r),i=W(e,t.init,r)[0],a=r.limits.maxDepth??W_;for(let e of n){let n;if(t.pattern){if(n=A_(r,t.pattern,e),n===null)continue}else n=k_(r,t.varName,e);if(i=W(i,t.update,n)[0],e_(i,a+1)>a)return[null]}return[i]}case`Foreach`:{let n=W(e,t.expr,r),i=W(e,t.init,r)[0],a=[];for(let e of n)try{let n;if(t.pattern){if(n=A_(r,t.pattern,e),n===null)continue}else n=k_(r,t.varName,e);if(i=W(i,t.update,n)[0],t.extract){let e=W(i,t.extract,n);a.push(...e)}else a.push(i)}catch(e){throw e instanceof V_?e.withPrependedResults(a):e}return a}case`Label`:try{return W(e,t.body,{...r,labels:new Set([...r.labels??[],t.name])})}catch(e){if(e instanceof V_&&e.label===t.name)return e.partialResults;throw e}case`Break`:throw new V_(t.name);case`Def`:{let n=new Map(r.funcs??[]),i=`${t.name}/${t.params.length}`;n.set(i,{params:t.params,body:t.funcBody,closure:new Map(r.funcs??[])});let a={...r,funcs:n};return W(e,t.body,a)}default:throw Error(`Unknown AST node type: ${t.type}`)}}function F_(e,t){return e<0?Math.max(0,t+e):Math.min(e,t)}function I_(e,t,n,r,i){function a(e,t){switch(n){case`=`:return t;case`|=`:return W(e,r,i)[0]??null;case`+=`:return typeof e==`number`&&typeof t==`number`||typeof e==`string`&&typeof t==`string`?e+t:Array.isArray(e)&&Array.isArray(t)?[...e,...t]:e&&t&&typeof e==`object`&&typeof t==`object`?mc(e,t):t;case`-=`:return typeof e==`number`&&typeof t==`number`?e-t:e;case`*=`:return typeof e==`number`&&typeof t==`number`?e*t:e;case`/=`:return typeof e==`number`&&typeof t==`number`?e/t:e;case`%=`:return typeof e==`number`&&typeof t==`number`?e%t:e;case`//=`:return e===null||e===!1?t:e;default:return t}}function o(t,n,r){switch(n.type){case`Identity`:return r(t);case`Field`:if(!sc(n.name))return t;if(n.base)return o(t,n.base,e=>{if(e&&typeof e==`object`&&!Array.isArray(e)){let t=pc(e),i=Object.hasOwn(t,n.name)?t[n.name]:void 0;return cc(t,n.name,r(i)),t}return e});if(t&&typeof t==`object`&&!Array.isArray(t)){let e=pc(t),i=Object.hasOwn(e,n.name)?e[n.name]:void 0;return cc(e,n.name,r(i)),e}return t;case`Index`:{let a=W(e,n.index,i)[0];if(typeof a==`number`&&Number.isNaN(a))throw Error(`Cannot set array element at NaN index`);if(typeof a==`number`&&!Number.isInteger(a)&&(a=Math.trunc(a)),n.base)return o(t,n.base,e=>{if(typeof a==`number`&&Array.isArray(e)){let t=[...e],n=a<0?t.length+a:a;if(n>=0){for(;t.length<=n;)t.push(null);t[n]=r(t[n])}return t}if(typeof a==`string`&&e&&typeof e==`object`&&!Array.isArray(e)){if(!sc(a))return e;let t=pc(e),n=Object.hasOwn(t,a)?t[a]:void 0;return cc(t,a,r(n)),t}return e});if(typeof a==`number`){if(a>536870911)throw Error(`Array index too large`);if(a<0&&(!t||!Array.isArray(t)))throw Error(`Out of bounds negative array index`);if(Array.isArray(t)){let e=[...t],n=a<0?e.length+a:a;if(n>=0){for(;e.length<=n;)e.push(null);e[n]=r(e[n])}return e}if(t==null){let e=[];for(;e.length<=a;)e.push(null);return e[a]=r(null),e}return t}if(typeof a==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!sc(a))return t;let e=pc(t),n=Object.hasOwn(e,a)?e[a]:void 0;return cc(e,a,r(n)),e}return t}case`Iterate`:{let e=e=>{if(Array.isArray(e))return e.map(e=>r(e));if(e&&typeof e==`object`){let t=Object.create(null);for(let[n,i]of Object.entries(e))sc(n)&&cc(t,n,r(i));return t}return e};return n.base?o(t,n.base,e):e(t)}case`Pipe`:return o(o(t,n.left,e=>e),n.right,r);default:return r(t)}}return o(e,t,t=>n===`|=`?a(t,t):a(t,W(e,r,i)[0]??null))}function L_(e,t,n){function r(t,i,a){switch(i.type){case`Identity`:return a;case`Field`:if(!sc(i.name))return t;if(i.base){let e=W(t,i.base,n)[0],o=r(e,{type:`Field`,name:i.name},a);return r(t,i.base,o)}if(t&&typeof t==`object`&&!Array.isArray(t)){let e=pc(t);return cc(e,i.name,a),e}return t;case`Index`:{if(i.base){let e=W(t,i.base,n)[0],o=r(e,{type:`Index`,index:i.index},a);return r(t,i.base,o)}let o=W(e,i.index,n)[0];if(typeof o==`number`&&Array.isArray(t)){let e=[...t],n=o<0?e.length+o:o;return n>=0&&n<e.length&&(e[n]=a),e}if(typeof o==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!sc(o))return t;let e=pc(t);return cc(e,o,a),e}return t}default:return t}}function i(t,a){switch(a.type){case`Identity`:return null;case`Field`:if(!sc(a.name))return t;if(a.base){let e=W(t,a.base,n)[0];if(e==null)return t;let o=i(e,{type:`Field`,name:a.name});return r(t,a.base,o)}if(t&&typeof t==`object`&&!Array.isArray(t)){if(!sc(a.name))return t;let e=pc(t);return delete e[a.name],e}return t;case`Index`:{if(a.base){let e=W(t,a.base,n)[0];if(e==null)return t;let o=i(e,{type:`Index`,index:a.index});return r(t,a.base,o)}let o=W(e,a.index,n)[0];if(typeof o==`number`&&Array.isArray(t)){let e=[...t],n=o<0?e.length+o:o;return n>=0&&n<e.length&&e.splice(n,1),e}if(typeof o==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!sc(o))return t;let e=pc(t);return delete e[o],e}return t}case`Iterate`:return Array.isArray(t)?[]:t&&typeof t==`object`?Object.create(null):t;case`Pipe`:{let r=function(t,i,a){switch(i.type){case`Identity`:return a;case`Field`:if(!sc(i.name))return t;if(t&&typeof t==`object`&&!Array.isArray(t)){let e=pc(t);return cc(e,i.name,a),e}return t;case`Index`:{let r=W(e,i.index,n)[0];if(typeof r==`number`&&Array.isArray(t)){let e=[...t],n=r<0?e.length+r:r;return n>=0&&n<e.length&&(e[n]=a),e}if(typeof r==`string`&&t&&typeof t==`object`&&!Array.isArray(t)){if(!sc(r))return t;let e=pc(t);return cc(e,r,a),e}return t}case`Pipe`:{let e=W(t,i.left,n)[0],o=r(e,i.right,a);return r(t,i.left,o)}default:return t}},o=a.left,s=a.right,c=W(t,o,n)[0];return c==null?t:r(t,o,i(c,s))}default:return t}}return i(e,t)}function R_(e,t,n,r,i){if(t===`and`)return W(e,n,i).flatMap(t=>Xg(t)?W(e,r,i).map(e=>Xg(e)):[!1]);if(t===`or`)return W(e,n,i).flatMap(t=>Xg(t)?[!0]:W(e,r,i).map(e=>Xg(e)));if(t===`//`){let t=W(e,n,i).filter(e=>e!=null&&e!==!1);return t.length>0?t:W(e,r,i)}let a=W(e,n,i),o=W(e,r,i);return a.flatMap(e=>o.map(n=>{switch(t){case`+`:return e===null?n:n===null?e:typeof e==`number`&&typeof n==`number`||typeof e==`string`&&typeof n==`string`?e+n:Array.isArray(e)&&Array.isArray(n)?[...e,...n]:e&&n&&typeof e==`object`&&typeof n==`object`&&!Array.isArray(e)&&!Array.isArray(n)?mc(e,n):null;case`-`:if(typeof e==`number`&&typeof n==`number`)return e-n;if(Array.isArray(e)&&Array.isArray(n)){let t=new Set(n.map(e=>JSON.stringify(e)));return e.filter(e=>!t.has(JSON.stringify(e)))}if(typeof e==`string`&&typeof n==`string`){let t=e=>e.length>10?`"${e.slice(0,10)}...`:JSON.stringify(e);throw Error(`string (${t(e)}) and string (${t(n)}) cannot be subtracted`)}return null;case`*`:if(typeof e==`number`&&typeof n==`number`)return e*n;if(typeof e==`string`&&typeof n==`number`)return e.repeat(n);{let t=dc(e),r=dc(n);if(t&&r)return $g(t,r)}return null;case`/`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided because the divisor is zero`);return e/n}return typeof e==`string`&&typeof n==`string`?e.split(n):null;case`%`:if(typeof e==`number`&&typeof n==`number`){if(n===0)throw Error(`number (${e}) and number (${n}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(e)&&!Number.isNaN(e)?!Number.isFinite(n)&&!Number.isNaN(n)&&e<0&&n>0?-1:0:e%n}return null;case`==`:return Zg(e,n);case`!=`:return!Zg(e,n);case`<`:return Qg(e,n)<0;case`<=`:return Qg(e,n)<=0;case`>`:return Qg(e,n)>0;case`>=`:return Qg(e,n)>=0;default:return null}}))}function z_(e,t,n,r){let i=G_.get(t);if(i)return typeof e==`number`?[i(e)]:[null];let a=l_(e,t,n,r,W);if(a!==null)return a;let o=b_(e,t,n,r,W);if(o!==null)return o;let s=Jg(e,t,n,r,W);if(s!==null)return s;let c=i_(e,t,r.limits.maxDepth);if(c!==null)return c;let l=S_(e,t);if(l!==null)return l;let u=p_(e,t,n,r,W);if(u!==null)return u;let d=Wg(e,t,n,r,W,P_,t_,Xg,n_,k);if(d!==null)return d;let f=g_(e,t,n,r,W,Xg,T_,E_,L_,B_);if(f!==null)return f;let p=s_(e,t,n,r,W,Zg);if(p!==null)return p;let m=Kg(e,t,n,r,W,P_,Xg,k);if(m!==null)return m;let h=d_(e,t,n,r,W,Xg,j_,z_);if(h!==null)return h;let g=v_(e,t,n,r,W,Zg);if(g!==null)return g;switch(t){case`builtins`:return[`add/0.all/0.all/1.all/2.any/0.any/1.any/2.arrays/0.ascii/0.ascii_downcase/0.ascii_upcase/0.booleans/0.bsearch/1.builtins/0.combinations/0.combinations/1.contains/1.debug/0.del/1.delpaths/1.empty/0.env/0.error/0.error/1.explode/0.first/0.first/1.flatten/0.flatten/1.floor/0.from_entries/0.fromdate/0.fromjson/0.getpath/1.gmtime/0.group_by/1.gsub/2.gsub/3.has/1.implode/0.IN/1.IN/2.INDEX/1.INDEX/2.index/1.indices/1.infinite/0.inside/1.isempty/1.isnan/0.isnormal/0.isvalid/1.iterables/0.join/1.keys/0.keys_unsorted/0.last/0.last/1.length/0.limit/2.ltrimstr/1.map/1.map_values/1.match/1.match/2.max/0.max_by/1.min/0.min_by/1.mktime/0.modulemeta/1.nan/0.not/0.nth/1.nth/2.null/0.nulls/0.numbers/0.objects/0.path/1.paths/0.paths/1.pick/1.range/1.range/2.range/3.recurse/0.recurse/1.recurse_down/0.repeat/1.reverse/0.rindex/1.rtrimstr/1.scalars/0.scan/1.scan/2.select/1.setpath/2.skip/2.sort/0.sort_by/1.split/1.splits/1.splits/2.sqrt/0.startswith/1.strftime/1.strings/0.strptime/1.sub/2.sub/3.test/1.test/2.to_entries/0.toboolean/0.todate/0.tojson/0.tostream/0.fromstream/1.truncate_stream/1.tonumber/0.tostring/0.transpose/0.trim/0.ltrim/0.rtrim/0.type/0.unique/0.unique_by/1.until/2.utf8bytelength/0.values/0.walk/1.while/2.with_entries/1`.split(`.`)];case`error`:{let t=n.length>0?W(e,n[0],r)[0]:e;throw new H_(t)}case`env`:return[r.env?ql(r.env):Object.create(null)];case`debug`:return[e];case`input_line_number`:return[1];default:{let i=`${t}/${n.length}`,a=r.funcs?.get(i);if(a){let t=a.closure??r.funcs??new Map,o=new Map(t);o.set(i,a);for(let t=0;t<a.params.length;t++){let i=a.params[t],s=n[t];if(s){let t=W(e,s,r),n;if(t.length===0)n={type:`Call`,name:`empty`,args:[]};else if(t.length===1)n={type:`Literal`,value:t[0]};else{n={type:`Literal`,value:t[t.length-1]};for(let e=t.length-2;e>=0;e--)n={type:`Comma`,left:{type:`Literal`,value:t[e]},right:n}}o.set(`${i}/0`,{params:[],body:n})}}let s={...r,funcs:o};return W(e,a.body,s)}throw Error(`Unknown function: ${t}`)}}}function B_(e,t,n,r,i){if(t.type===`Comma`){let a=t;B_(e,a.left,n,r,i),B_(e,a.right,n,r,i);return}let a=M_(t);if(a!==null){i.push([...r,...a]);return}if(t.type===`Iterate`){if(Array.isArray(e))for(let t=0;t<e.length;t++)i.push([...r,t]);else if(e&&typeof e==`object`)for(let t of Object.keys(e))i.push([...r,t]);return}if(t.type===`Recurse`){let t=(e,n)=>{if(i.push([...r,...n]),e&&typeof e==`object`)if(Array.isArray(e))for(let r=0;r<e.length;r++)t(e[r],[...n,r]);else for(let r of Object.keys(e))t(e[r],[...n,r])};t(e,[]);return}if(t.type===`Pipe`){let a=M_(t.left);if(a!==null){let o=W(e,t.left,n);for(let e of o)B_(e,t.right,n,[...r,...a],i);return}}W(e,t,n).length>0&&i.push(r)}var V_,H_,U_,W_,G_,K_=S(()=>{Xl(),A(),fl(),w_(),D_(),gc(),r_(),V_=class e extends Error{label;partialResults;constructor(e,t=[]){super(`break ${e}`),this.label=e,this.partialResults=t,this.name=`BreakError`}withPrependedResults(t){return new e(this.label,[...t,...this.partialResults])}},H_=class extends Error{value;constructor(e){super(typeof e==`string`?e:JSON.stringify(e)),this.value=e,this.name=`JqError`}},U_=1e4,W_=2e3,G_=new Map([[`floor`,Math.floor],[`ceil`,Math.ceil],[`round`,Math.round],[`sqrt`,Math.sqrt],[`log`,Math.log],[`log10`,Math.log10],[`log2`,Math.log2],[`exp`,Math.exp],[`sin`,Math.sin],[`cos`,Math.cos],[`tan`,Math.tan],[`asin`,Math.asin],[`acos`,Math.acos],[`atan`,Math.atan],[`sinh`,Math.sinh],[`cosh`,Math.cosh],[`tanh`,Math.tanh],[`asinh`,Math.asinh],[`acosh`,Math.acosh],[`atanh`,Math.atanh],[`cbrt`,Math.cbrt],[`expm1`,Math.expm1],[`log1p`,Math.log1p],[`trunc`,Math.trunc]])});function q_(e){let t=[],n=0,r=(t=0)=>e[n+t],i=()=>e[n++],a=()=>n>=e.length,o=e=>e>=`0`&&e<=`9`,s=e=>e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`_`,c=e=>s(e)||o(e);for(;!a();){let l=n,u=i();if(!(u===` `||u===` `||u===`
626
626
  `||u===`\r`)){if(u===`#`){for(;!a()&&r()!==`
627
627
  `;)i();continue}if(u===`.`&&r()===`.`){i(),t.push({type:`DOTDOT`,pos:l});continue}if(u===`=`&&r()===`=`){i(),t.push({type:`EQ`,pos:l});continue}if(u===`!`&&r()===`=`){i(),t.push({type:`NE`,pos:l});continue}if(u===`<`&&r()===`=`){i(),t.push({type:`LE`,pos:l});continue}if(u===`>`&&r()===`=`){i(),t.push({type:`GE`,pos:l});continue}if(u===`/`&&r()===`/`){i(),r()===`=`?(i(),t.push({type:`UPDATE_ALT`,pos:l})):t.push({type:`ALT`,pos:l});continue}if(u===`+`&&r()===`=`){i(),t.push({type:`UPDATE_ADD`,pos:l});continue}if(u===`-`&&r()===`=`){i(),t.push({type:`UPDATE_SUB`,pos:l});continue}if(u===`*`&&r()===`=`){i(),t.push({type:`UPDATE_MUL`,pos:l});continue}if(u===`/`&&r()===`=`){i(),t.push({type:`UPDATE_DIV`,pos:l});continue}if(u===`%`&&r()===`=`){i(),t.push({type:`UPDATE_MOD`,pos:l});continue}if(u===`=`&&r()!==`=`){t.push({type:`ASSIGN`,pos:l});continue}if(u===`.`){t.push({type:`DOT`,pos:l});continue}if(u===`|`){r()===`=`?(i(),t.push({type:`UPDATE_PIPE`,pos:l})):t.push({type:`PIPE`,pos:l});continue}if(u===`,`){t.push({type:`COMMA`,pos:l});continue}if(u===`:`){t.push({type:`COLON`,pos:l});continue}if(u===`;`){t.push({type:`SEMICOLON`,pos:l});continue}if(u===`(`){t.push({type:`LPAREN`,pos:l});continue}if(u===`)`){t.push({type:`RPAREN`,pos:l});continue}if(u===`[`){t.push({type:`LBRACKET`,pos:l});continue}if(u===`]`){t.push({type:`RBRACKET`,pos:l});continue}if(u===`{`){t.push({type:`LBRACE`,pos:l});continue}if(u===`}`){t.push({type:`RBRACE`,pos:l});continue}if(u===`?`){t.push({type:`QUESTION`,pos:l});continue}if(u===`+`){t.push({type:`PLUS`,pos:l});continue}if(u===`-`){t.push({type:`MINUS`,pos:l});continue}if(u===`*`){t.push({type:`STAR`,pos:l});continue}if(u===`/`){t.push({type:`SLASH`,pos:l});continue}if(u===`%`){t.push({type:`PERCENT`,pos:l});continue}if(u===`<`){t.push({type:`LT`,pos:l});continue}if(u===`>`){t.push({type:`GT`,pos:l});continue}if(o(u)){let s=u;for(;!a()&&(o(r())||r()===`.`||r()===`e`||r()===`E`);)(r()===`e`||r()===`E`)&&(e[n+1]===`+`||e[n+1]===`-`)&&(s+=i()),s+=i();t.push({type:`NUMBER`,value:Number(s),pos:l});continue}if(u===`"`){let e=``;for(;!a()&&r()!==`"`;)if(r()===`\\`){if(i(),a())break;let t=i();switch(t){case`n`:e+=`
628
- `;break;case`r`:e+=`\r`;break;case`t`:e+=` `;break;case`\\`:e+=`\\`;break;case`"`:e+=`"`;break;case`(`:e+=`\\(`;break;default:e+=t}}else e+=i();a()||i(),t.push({type:`STRING`,value:e,pos:l});continue}if(s(u)||u===`$`||u===`@`){let e=u;for(;!a()&&c(r());)e+=i();let n=Y_.get(e);n?t.push({type:n,value:e,pos:l}):t.push({type:`IDENT`,value:e,pos:l});continue}throw Error(`Unexpected character '${u}' at position ${l}`)}}return t.push({type:`EOF`,pos:n}),t}function J_(e){let t=q_(e);return new Z_(t).parse()}var Y_,X_,Z_,Q_=S(()=>{Y_=new Map([[`and`,`AND`],[`or`,`OR`],[`not`,`NOT`],[`if`,`IF`],[`then`,`THEN`],[`elif`,`ELIF`],[`else`,`ELSE`],[`end`,`END`],[`as`,`AS`],[`try`,`TRY`],[`catch`,`CATCH`],[`true`,`TRUE`],[`false`,`FALSE`],[`null`,`NULL`],[`reduce`,`REDUCE`],[`foreach`,`FOREACH`],[`label`,`LABEL`],[`break`,`BREAK`],[`def`,`DEF`]]),X_=new Set(Y_.values()),Z_=class e{tokens;pos=0;constructor(e){this.tokens=e}peek(e=0){return this.tokens[this.pos+e]??{type:`EOF`,pos:-1}}advance(){return this.tokens[this.pos++]}check(e){return this.peek().type===e}match(...e){for(let t of e)if(this.check(t))return this.advance();return null}expect(e,t){if(!this.check(e))throw Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(e=0){let t=this.peek(e),n=this.peek(e+1);return n.type===`STRING`?!0:n.type===`IDENT`||X_.has(n.type)?n.pos===t.pos+1:!1}isIdentLike(){let e=this.peek().type;return e===`IDENT`||X_.has(e)}consumeFieldNameAfterDot(e){let t=this.peek();return t.type===`STRING`||(t.type===`IDENT`||X_.has(t.type))&&t.pos===e.pos+1?this.advance().value:null}parse(){let e=this.parseExpr();if(!this.check(`EOF`))throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return e}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match(`LBRACKET`)){let e=[];if(!this.check(`RBRACKET`))for(e.push(this.parsePattern());this.match(`COMMA`)&&!this.check(`RBRACKET`);)e.push(this.parsePattern());return this.expect(`RBRACKET`,`Expected ']' after array pattern`),{type:`array`,elements:e}}if(this.match(`LBRACE`)){let e=[];if(!this.check(`RBRACE`))for(e.push(this.parsePatternField());this.match(`COMMA`)&&!this.check(`RBRACE`);)e.push(this.parsePatternField());return this.expect(`RBRACE`,`Expected '}' after object pattern`),{type:`object`,fields:e}}let e=this.expect(`IDENT`,`Expected variable name in pattern`),t=e.value;if(!t.startsWith(`$`))throw Error(`Variable name must start with $ at position ${e.pos}`);return{type:`var`,name:t}}parsePatternField(){if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after computed key`),this.expect(`COLON`,`Expected ':' after computed key`),{key:e,pattern:this.parsePattern()}}let e=this.peek();if(e.type===`IDENT`||X_.has(e.type)){let t=e.value;if(t.startsWith(`$`)){if(this.advance(),this.match(`COLON`)){let e=this.parsePattern();return{key:t.slice(1),pattern:e,keyVar:t}}return{key:t.slice(1),pattern:{type:`var`,name:t}}}return this.advance(),this.match(`COLON`)?{key:t,pattern:this.parsePattern()}:{key:t,pattern:{type:`var`,name:`$${t}`}}}throw Error(`Expected field name in object pattern at position ${e.pos}`)}parsePipe(){let e=this.parseComma();for(;this.match(`PIPE`);){let t=this.parseComma();e={type:`Pipe`,left:e,right:t}}return e}parseComma(){let e=this.parseVarBind();for(;this.match(`COMMA`);){let t=this.parseVarBind();e={type:`Comma`,left:e,right:t}}return e}parseVarBind(){let e=this.parseUpdate();if(this.match(`AS`)){let t=this.parsePattern(),n=[];for(;this.check(`QUESTION`)&&this.peekAhead(1)?.type===`ALT`;)this.advance(),this.advance(),n.push(this.parsePattern());this.expect(`PIPE`,`Expected '|' after variable binding`);let r=this.parseExpr();return t.type===`var`&&n.length===0?{type:`VarBind`,name:t.name,value:e,body:r}:{type:`VarBind`,name:t.type===`var`?t.name:``,value:e,body:r,pattern:t.type===`var`?void 0:t,alternatives:n.length>0?n:void 0}}return e}peekAhead(e){let t=this.pos+e;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let e=this.parseAlt(),t=new Map([[`ASSIGN`,`=`],[`UPDATE_ADD`,`+=`],[`UPDATE_SUB`,`-=`],[`UPDATE_MUL`,`*=`],[`UPDATE_DIV`,`/=`],[`UPDATE_MOD`,`%=`],[`UPDATE_ALT`,`//=`],[`UPDATE_PIPE`,`|=`]]),n=this.match(`ASSIGN`,`UPDATE_ADD`,`UPDATE_SUB`,`UPDATE_MUL`,`UPDATE_DIV`,`UPDATE_MOD`,`UPDATE_ALT`,`UPDATE_PIPE`);if(n){let r=this.parseVarBind(),i=t.get(n.type);if(i)return{type:`UpdateOp`,op:i,path:e,value:r}}return e}parseAlt(){let e=this.parseOr();for(;this.match(`ALT`);){let t=this.parseOr();e={type:`BinaryOp`,op:`//`,left:e,right:t}}return e}parseOr(){let e=this.parseAnd();for(;this.match(`OR`);){let t=this.parseAnd();e={type:`BinaryOp`,op:`or`,left:e,right:t}}return e}parseAnd(){let e=this.parseNot();for(;this.match(`AND`);){let t=this.parseNot();e={type:`BinaryOp`,op:`and`,left:e,right:t}}return e}parseNot(){return this.parseComparison()}parseComparison(){let e=this.parseAddSub(),t=new Map([[`EQ`,`==`],[`NE`,`!=`],[`LT`,`<`],[`LE`,`<=`],[`GT`,`>`],[`GE`,`>=`]]),n=this.match(`EQ`,`NE`,`LT`,`LE`,`GT`,`GE`);if(n){let r=t.get(n.type);if(r){let t=this.parseAddSub();e={type:`BinaryOp`,op:r,left:e,right:t}}}return e}parseAddSub(){let e=this.parseMulDiv();for(;;)if(this.match(`PLUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`+`,left:e,right:t}}else if(this.match(`MINUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`-`,left:e,right:t}}else break;return e}parseMulDiv(){let e=this.parseUnary();for(;;)if(this.match(`STAR`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`*`,left:e,right:t}}else if(this.match(`SLASH`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`/`,left:e,right:t}}else if(this.match(`PERCENT`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`%`,left:e,right:t}}else break;return e}parseUnary(){return this.match(`MINUS`)?{type:`UnaryOp`,op:`-`,operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match(`QUESTION`))e={type:`Optional`,expr:e};else if(this.check(`DOT`)&&this.isFieldNameAfterDot())this.advance(),e={type:`Field`,name:this.advance().value,base:e};else if(this.check(`LBRACKET`))if(this.advance(),this.match(`RBRACKET`))e={type:`Iterate`,base:e};else if(this.check(`COLON`)){this.advance();let t=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,end:t,base:e}}else{let t=this.parseExpr();if(this.match(`COLON`)){let n=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,start:t,end:n,base:e}}else this.expect(`RBRACKET`,`Expected ']'`),e={type:`Index`,index:t,base:e}}else break;return e}parsePrimary(){if(this.match(`DOTDOT`))return{type:`Recurse`};if(this.check(`DOT`)){let e=this.advance();if(this.check(`LBRACKET`)){if(this.advance(),this.match(`RBRACKET`))return{type:`Iterate`};if(this.check(`COLON`)){this.advance();let e=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,end:e}}let e=this.parseExpr();if(this.match(`COLON`)){let t=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,start:e,end:t}}return this.expect(`RBRACKET`,`Expected ']'`),{type:`Index`,index:e}}let t=this.consumeFieldNameAfterDot(e);return t===null?{type:`Identity`}:{type:`Field`,name:t}}if(this.match(`TRUE`))return{type:`Literal`,value:!0};if(this.match(`FALSE`))return{type:`Literal`,value:!1};if(this.match(`NULL`))return{type:`Literal`,value:null};if(this.check(`NUMBER`))return{type:`Literal`,value:this.advance().value};if(this.check(`STRING`)){let e=this.advance().value;return e.includes(`\\(`)?this.parseStringInterpolation(e):{type:`Literal`,value:e}}if(this.match(`LBRACKET`)){if(this.match(`RBRACKET`))return{type:`Array`};let e=this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Array`,elements:e}}if(this.match(`LBRACE`))return this.parseObjectConstruction();if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')'`),{type:`Paren`,expr:e}}if(this.match(`IF`))return this.parseIf();if(this.match(`TRY`)){let e=this.parsePostfix(),t;return this.match(`CATCH`)&&(t=this.parsePostfix()),{type:`Try`,body:e,catch:t}}if(this.match(`REDUCE`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after reduce expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after update expression`),{type:`Reduce`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,pattern:t.type===`var`?void 0:t}}if(this.match(`FOREACH`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after foreach expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr(),i;return this.match(`SEMICOLON`)&&(i=this.parseExpr()),this.expect(`RPAREN`,`Expected ')' after expressions`),{type:`Foreach`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,extract:i,pattern:t.type===`var`?void 0:t}}if(this.match(`LABEL`)){let e=this.expect(`IDENT`,`Expected label name (e.g., $out)`),t=e.value;if(!t.startsWith(`$`))throw Error(`Label name must start with $ at position ${e.pos}`);return this.expect(`PIPE`,`Expected '|' after label name`),{type:`Label`,name:t,body:this.parseExpr()}}if(this.match(`BREAK`)){let e=this.expect(`IDENT`,`Expected label name to break to`),t=e.value;if(!t.startsWith(`$`))throw Error(`Break label must start with $ at position ${e.pos}`);return{type:`Break`,name:t}}if(this.match(`DEF`)){let e=this.expect(`IDENT`,`Expected function name after def`).value,t=[];if(this.match(`LPAREN`)){if(!this.check(`RPAREN`)){let e=this.expect(`IDENT`,`Expected parameter name`);for(t.push(e.value);this.match(`SEMICOLON`);){let e=this.expect(`IDENT`,`Expected parameter name`);t.push(e.value)}}this.expect(`RPAREN`,`Expected ')' after parameters`)}this.expect(`COLON`,`Expected ':' after function name`);let n=this.parseExpr();return this.expect(`SEMICOLON`,`Expected ';' after function body`),{type:`Def`,name:e,params:t,funcBody:n,body:this.parseExpr()}}if(this.match(`NOT`))return{type:`Call`,name:`not`,args:[]};if(this.check(`IDENT`)){let e=this.advance().value;if(e.startsWith(`$`))return{type:`VarRef`,name:e};if(this.match(`LPAREN`)){let t=[];if(!this.check(`RPAREN`))for(t.push(this.parseExpr());this.match(`SEMICOLON`);)t.push(this.parseExpr());return this.expect(`RPAREN`,`Expected ')'`),{type:`Call`,name:e,args:t}}return{type:`Call`,name:e,args:[]}}throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let e=[];if(!this.check(`RBRACE`))do{let t,n;if(this.match(`LPAREN`))t=this.parseExpr(),this.expect(`RPAREN`,`Expected ')'`),this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else if(this.isIdentLike()){let e=this.advance().value;this.match(`COLON`)?(t=e,n=this.parseObjectValue()):(t=e,n={type:`Field`,name:e})}else if(this.check(`STRING`))t=this.advance().value,this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else throw Error(`Expected object key at position ${this.peek().pos}`);e.push({key:t,value:n})}while(this.match(`COMMA`));return this.expect(`RBRACE`,`Expected '}'`),{type:`Object`,entries:e}}parseObjectValue(){let e=this.parseVarBind();for(;this.match(`PIPE`);){let t=this.parseVarBind();e={type:`Pipe`,left:e,right:t}}return e}parseIf(){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then'`);let t=this.parseExpr(),n=[];for(;this.match(`ELIF`);){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then' after elif`);let t=this.parseExpr();n.push({cond:e,then:t})}let r;return this.match(`ELSE`)&&(r=this.parseExpr()),this.expect(`END`,`Expected 'end'`),{type:`Cond`,cond:e,then:t,elifs:n,else:r}}parseStringInterpolation(t){let n=[],r=``,i=0;for(;i<t.length;)if(t[i]===`\\`&&t[i+1]===`(`){r&&=(n.push(r),``),i+=2;let a=1,o=``;for(;i<t.length&&a>0;)t[i]===`(`?a++:t[i]===`)`&&a--,a>0&&(o+=t[i]),i++;let s=new e(q_(o));n.push(s.parse())}else r+=t[i],i++;return r&&n.push(r),{type:`StringInterp`,parts:n}}}}),$_=S(()=>{K_(),Q_()}),ev={};C(ev,{flagsForFuzzing:()=>av,jqCommand:()=>iv});function tv(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&/\s/.test(e[n]);)n++;if(n>=r)break;let i=n,a=e[n];if(a===`{`||a===`[`){let o=a,s=a===`{`?`}`:`]`,c=1,l=!1,u=!1;for(n++;n<r&&c>0;){let t=e[n];u?u=!1:t===`\\`?u=!0:t===`"`?l=!l:l||(t===o?c++:t===s&&c--),n++}if(c!==0)throw Error(`Unexpected end of JSON input at position ${n} (unclosed ${o})`);t.push(dc(JSON.parse(e.slice(i,n))))}else if(a===`"`){let a=!1;for(n++;n<r;){let t=e[n];if(a)a=!1;else if(t===`\\`)a=!0;else if(t===`"`){n++;break}n++}t.push(dc(JSON.parse(e.slice(i,n))))}else if(a===`-`||a>=`0`&&a<=`9`){for(;n<r&&/[\d.eE+-]/.test(e[n]);)n++;t.push(dc(JSON.parse(e.slice(i,n))))}else if(e.slice(n,n+4)===`true`)t.push(!0),n+=4;else if(e.slice(n,n+5)===`false`)t.push(!1),n+=5;else if(e.slice(n,n+4)===`null`)t.push(null),n+=4;else{let t=e.slice(n,n+10);throw Error(`Invalid JSON at position ${i}: unexpected '${t.split(/\s/)[0]}'`)}}return t}function nv(e,t,n,r,i,a=0){if(e==null)return`null`;if(typeof e==`boolean`)return String(e);if(typeof e==`number`)return Number.isFinite(e)?String(e):`null`;if(typeof e==`string`)return n?e:JSON.stringify(e);let o=i?` `:` `;if(Array.isArray(e))return e.length===0?`[]`:t?`[${e.map(e=>nv(e,!0,!1,r,i)).join(`,`)}]`:`[
628
+ `;break;case`r`:e+=`\r`;break;case`t`:e+=` `;break;case`\\`:e+=`\\`;break;case`"`:e+=`"`;break;case`(`:e+=`\\(`;break;default:e+=t}}else e+=i();a()||i(),t.push({type:`STRING`,value:e,pos:l});continue}if(s(u)||u===`$`||u===`@`){let e=u;for(;!a()&&c(r());)e+=i();let n=Y_.get(e);n?t.push({type:n,value:e,pos:l}):t.push({type:`IDENT`,value:e,pos:l});continue}throw Error(`Unexpected character '${u}' at position ${l}`)}}return t.push({type:`EOF`,pos:n}),t}function J_(e){let t=q_(e);return new Z_(t).parse()}var Y_,X_,Z_,Q_=S(()=>{Y_=new Map([[`and`,`AND`],[`or`,`OR`],[`not`,`NOT`],[`if`,`IF`],[`then`,`THEN`],[`elif`,`ELIF`],[`else`,`ELSE`],[`end`,`END`],[`as`,`AS`],[`try`,`TRY`],[`catch`,`CATCH`],[`true`,`TRUE`],[`false`,`FALSE`],[`null`,`NULL`],[`reduce`,`REDUCE`],[`foreach`,`FOREACH`],[`label`,`LABEL`],[`break`,`BREAK`],[`def`,`DEF`]]),X_=new Set(Y_.values()),Z_=class e{tokens;pos=0;constructor(e){this.tokens=e}peek(e=0){return this.tokens[this.pos+e]??{type:`EOF`,pos:-1}}advance(){return this.tokens[this.pos++]}check(e){return this.peek().type===e}match(...e){for(let t of e)if(this.check(t))return this.advance();return null}expect(e,t){if(!this.check(e))throw Error(`${t} at position ${this.peek().pos}, got ${this.peek().type}`);return this.advance()}isFieldNameAfterDot(e=0){let t=this.peek(e),n=this.peek(e+1);return n.type===`STRING`?!0:n.type===`IDENT`||X_.has(n.type)?n.pos===t.pos+1:!1}isIdentLike(){let e=this.peek().type;return e===`IDENT`||X_.has(e)}consumeFieldNameAfterDot(e){let t=this.peek();return t.type===`STRING`||(t.type===`IDENT`||X_.has(t.type))&&t.pos===e.pos+1?this.advance().value:null}parse(){let e=this.parseExpr();if(!this.check(`EOF`))throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`);return e}parseExpr(){return this.parsePipe()}parsePattern(){if(this.match(`LBRACKET`)){let e=[];if(!this.check(`RBRACKET`))for(e.push(this.parsePattern());this.match(`COMMA`)&&!this.check(`RBRACKET`);)e.push(this.parsePattern());return this.expect(`RBRACKET`,`Expected ']' after array pattern`),{type:`array`,elements:e}}if(this.match(`LBRACE`)){let e=[];if(!this.check(`RBRACE`))for(e.push(this.parsePatternField());this.match(`COMMA`)&&!this.check(`RBRACE`);)e.push(this.parsePatternField());return this.expect(`RBRACE`,`Expected '}' after object pattern`),{type:`object`,fields:e}}let e=this.expect(`IDENT`,`Expected variable name in pattern`),t=e.value;if(!t.startsWith(`$`))throw Error(`Variable name must start with $ at position ${e.pos}`);return{type:`var`,name:t}}parsePatternField(){if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after computed key`),this.expect(`COLON`,`Expected ':' after computed key`),{key:e,pattern:this.parsePattern()}}let e=this.peek();if(e.type===`IDENT`||X_.has(e.type)){let t=e.value;if(t.startsWith(`$`)){if(this.advance(),this.match(`COLON`)){let e=this.parsePattern();return{key:t.slice(1),pattern:e,keyVar:t}}return{key:t.slice(1),pattern:{type:`var`,name:t}}}return this.advance(),this.match(`COLON`)?{key:t,pattern:this.parsePattern()}:{key:t,pattern:{type:`var`,name:`$${t}`}}}throw Error(`Expected field name in object pattern at position ${e.pos}`)}parsePipe(){let e=this.parseComma();for(;this.match(`PIPE`);){let t=this.parseComma();e={type:`Pipe`,left:e,right:t}}return e}parseComma(){let e=this.parseVarBind();for(;this.match(`COMMA`);){let t=this.parseVarBind();e={type:`Comma`,left:e,right:t}}return e}parseVarBind(){let e=this.parseUpdate();if(this.match(`AS`)){let t=this.parsePattern(),n=[];for(;this.check(`QUESTION`)&&this.peekAhead(1)?.type===`ALT`;)this.advance(),this.advance(),n.push(this.parsePattern());this.expect(`PIPE`,`Expected '|' after variable binding`);let r=this.parseExpr();return t.type===`var`&&n.length===0?{type:`VarBind`,name:t.name,value:e,body:r}:{type:`VarBind`,name:t.type===`var`?t.name:``,value:e,body:r,pattern:t.type===`var`?void 0:t,alternatives:n.length>0?n:void 0}}return e}peekAhead(e){let t=this.pos+e;return t<this.tokens.length?this.tokens[t]:void 0}parseUpdate(){let e=this.parseAlt(),t=new Map([[`ASSIGN`,`=`],[`UPDATE_ADD`,`+=`],[`UPDATE_SUB`,`-=`],[`UPDATE_MUL`,`*=`],[`UPDATE_DIV`,`/=`],[`UPDATE_MOD`,`%=`],[`UPDATE_ALT`,`//=`],[`UPDATE_PIPE`,`|=`]]),n=this.match(`ASSIGN`,`UPDATE_ADD`,`UPDATE_SUB`,`UPDATE_MUL`,`UPDATE_DIV`,`UPDATE_MOD`,`UPDATE_ALT`,`UPDATE_PIPE`);if(n){let r=this.parseVarBind(),i=t.get(n.type);if(i)return{type:`UpdateOp`,op:i,path:e,value:r}}return e}parseAlt(){let e=this.parseOr();for(;this.match(`ALT`);){let t=this.parseOr();e={type:`BinaryOp`,op:`//`,left:e,right:t}}return e}parseOr(){let e=this.parseAnd();for(;this.match(`OR`);){let t=this.parseAnd();e={type:`BinaryOp`,op:`or`,left:e,right:t}}return e}parseAnd(){let e=this.parseNot();for(;this.match(`AND`);){let t=this.parseNot();e={type:`BinaryOp`,op:`and`,left:e,right:t}}return e}parseNot(){return this.parseComparison()}parseComparison(){let e=this.parseAddSub(),t=new Map([[`EQ`,`==`],[`NE`,`!=`],[`LT`,`<`],[`LE`,`<=`],[`GT`,`>`],[`GE`,`>=`]]),n=this.match(`EQ`,`NE`,`LT`,`LE`,`GT`,`GE`);if(n){let r=t.get(n.type);if(r){let t=this.parseAddSub();e={type:`BinaryOp`,op:r,left:e,right:t}}}return e}parseAddSub(){let e=this.parseMulDiv();for(;;)if(this.match(`PLUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`+`,left:e,right:t}}else if(this.match(`MINUS`)){let t=this.parseMulDiv();e={type:`BinaryOp`,op:`-`,left:e,right:t}}else break;return e}parseMulDiv(){let e=this.parseUnary();for(;;)if(this.match(`STAR`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`*`,left:e,right:t}}else if(this.match(`SLASH`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`/`,left:e,right:t}}else if(this.match(`PERCENT`)){let t=this.parseUnary();e={type:`BinaryOp`,op:`%`,left:e,right:t}}else break;return e}parseUnary(){return this.match(`MINUS`)?{type:`UnaryOp`,op:`-`,operand:this.parseUnary()}:this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match(`QUESTION`))e={type:`Optional`,expr:e};else if(this.check(`DOT`)&&this.isFieldNameAfterDot())this.advance(),e={type:`Field`,name:this.advance().value,base:e};else if(this.check(`LBRACKET`))if(this.advance(),this.match(`RBRACKET`))e={type:`Iterate`,base:e};else if(this.check(`COLON`)){this.advance();let t=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,end:t,base:e}}else{let t=this.parseExpr();if(this.match(`COLON`)){let n=this.check(`RBRACKET`)?void 0:this.parseExpr();this.expect(`RBRACKET`,`Expected ']'`),e={type:`Slice`,start:t,end:n,base:e}}else this.expect(`RBRACKET`,`Expected ']'`),e={type:`Index`,index:t,base:e}}else break;return e}parsePrimary(){if(this.match(`DOTDOT`))return{type:`Recurse`};if(this.check(`DOT`)){let e=this.advance();if(this.check(`LBRACKET`)){if(this.advance(),this.match(`RBRACKET`))return{type:`Iterate`};if(this.check(`COLON`)){this.advance();let e=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,end:e}}let e=this.parseExpr();if(this.match(`COLON`)){let t=this.check(`RBRACKET`)?void 0:this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Slice`,start:e,end:t}}return this.expect(`RBRACKET`,`Expected ']'`),{type:`Index`,index:e}}let t=this.consumeFieldNameAfterDot(e);return t===null?{type:`Identity`}:{type:`Field`,name:t}}if(this.match(`TRUE`))return{type:`Literal`,value:!0};if(this.match(`FALSE`))return{type:`Literal`,value:!1};if(this.match(`NULL`))return{type:`Literal`,value:null};if(this.check(`NUMBER`))return{type:`Literal`,value:this.advance().value};if(this.check(`STRING`)){let e=this.advance().value;return e.includes(`\\(`)?this.parseStringInterpolation(e):{type:`Literal`,value:e}}if(this.match(`LBRACKET`)){if(this.match(`RBRACKET`))return{type:`Array`};let e=this.parseExpr();return this.expect(`RBRACKET`,`Expected ']'`),{type:`Array`,elements:e}}if(this.match(`LBRACE`))return this.parseObjectConstruction();if(this.match(`LPAREN`)){let e=this.parseExpr();return this.expect(`RPAREN`,`Expected ')'`),{type:`Paren`,expr:e}}if(this.match(`IF`))return this.parseIf();if(this.match(`TRY`)){let e=this.parsePostfix(),t;return this.match(`CATCH`)&&(t=this.parsePostfix()),{type:`Try`,body:e,catch:t}}if(this.match(`REDUCE`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after reduce expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr();return this.expect(`RPAREN`,`Expected ')' after update expression`),{type:`Reduce`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,pattern:t.type===`var`?void 0:t}}if(this.match(`FOREACH`)){let e=this.parseAddSub();this.expect(`AS`,`Expected 'as' after foreach expression`);let t=this.parsePattern();this.expect(`LPAREN`,`Expected '(' after variable`);let n=this.parseExpr();this.expect(`SEMICOLON`,`Expected ';' after init expression`);let r=this.parseExpr(),i;return this.match(`SEMICOLON`)&&(i=this.parseExpr()),this.expect(`RPAREN`,`Expected ')' after expressions`),{type:`Foreach`,expr:e,varName:t.type===`var`?t.name:``,init:n,update:r,extract:i,pattern:t.type===`var`?void 0:t}}if(this.match(`LABEL`)){let e=this.expect(`IDENT`,`Expected label name (e.g., $out)`),t=e.value;if(!t.startsWith(`$`))throw Error(`Label name must start with $ at position ${e.pos}`);return this.expect(`PIPE`,`Expected '|' after label name`),{type:`Label`,name:t,body:this.parseExpr()}}if(this.match(`BREAK`)){let e=this.expect(`IDENT`,`Expected label name to break to`),t=e.value;if(!t.startsWith(`$`))throw Error(`Break label must start with $ at position ${e.pos}`);return{type:`Break`,name:t}}if(this.match(`DEF`)){let e=this.expect(`IDENT`,`Expected function name after def`).value,t=[];if(this.match(`LPAREN`)){if(!this.check(`RPAREN`)){let e=this.expect(`IDENT`,`Expected parameter name`);for(t.push(e.value);this.match(`SEMICOLON`);){let e=this.expect(`IDENT`,`Expected parameter name`);t.push(e.value)}}this.expect(`RPAREN`,`Expected ')' after parameters`)}this.expect(`COLON`,`Expected ':' after function name`);let n=this.parseExpr();return this.expect(`SEMICOLON`,`Expected ';' after function body`),{type:`Def`,name:e,params:t,funcBody:n,body:this.parseExpr()}}if(this.match(`NOT`))return{type:`Call`,name:`not`,args:[]};if(this.check(`IDENT`)){let e=this.advance().value;if(e.startsWith(`$`))return{type:`VarRef`,name:e};if(this.match(`LPAREN`)){let t=[];if(!this.check(`RPAREN`))for(t.push(this.parseExpr());this.match(`SEMICOLON`);)t.push(this.parseExpr());return this.expect(`RPAREN`,`Expected ')'`),{type:`Call`,name:e,args:t}}return{type:`Call`,name:e,args:[]}}throw Error(`Unexpected token ${this.peek().type} at position ${this.peek().pos}`)}parseObjectConstruction(){let e=[];if(!this.check(`RBRACE`))do{let t,n;if(this.match(`LPAREN`))t=this.parseExpr(),this.expect(`RPAREN`,`Expected ')'`),this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else if(this.isIdentLike()){let e=this.advance().value;this.match(`COLON`)?(t=e,n=this.parseObjectValue()):(t=e,n={type:`Field`,name:e})}else if(this.check(`STRING`))t=this.advance().value,this.expect(`COLON`,`Expected ':'`),n=this.parseObjectValue();else throw Error(`Expected object key at position ${this.peek().pos}`);e.push({key:t,value:n})}while(this.match(`COMMA`));return this.expect(`RBRACE`,`Expected '}'`),{type:`Object`,entries:e}}parseObjectValue(){let e=this.parseVarBind();for(;this.match(`PIPE`);){let t=this.parseVarBind();e={type:`Pipe`,left:e,right:t}}return e}parseIf(){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then'`);let t=this.parseExpr(),n=[];for(;this.match(`ELIF`);){let e=this.parseExpr();this.expect(`THEN`,`Expected 'then' after elif`);let t=this.parseExpr();n.push({cond:e,then:t})}let r;return this.match(`ELSE`)&&(r=this.parseExpr()),this.expect(`END`,`Expected 'end'`),{type:`Cond`,cond:e,then:t,elifs:n,else:r}}parseStringInterpolation(t){let n=[],r=``,i=0;for(;i<t.length;)if(t[i]===`\\`&&t[i+1]===`(`){r&&=(n.push(r),``),i+=2;let a=1,o=``;for(;i<t.length&&a>0;)t[i]===`(`?a++:t[i]===`)`&&a--,a>0&&(o+=t[i]),i++;let s=new e(q_(o));n.push(s.parse())}else r+=t[i],i++;return r&&n.push(r),{type:`StringInterp`,parts:n}}}}),$_=S(()=>{K_(),Q_()}),ev={};C(ev,{flagsForFuzzing:()=>av,jqCommand:()=>iv});function tv(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&/\s/.test(e[n]);)n++;if(n>=r)break;let i=n,a=e[n];if(a===`{`||a===`[`){let o=a,s=a===`{`?`}`:`]`,c=1,l=!1,u=!1;for(n++;n<r&&c>0;){let t=e[n];u?u=!1:t===`\\`?u=!0:t===`"`?l=!l:l||(t===o?c++:t===s&&c--),n++}if(c!==0)throw Error(`Unexpected end of JSON input at position ${n} (unclosed ${o})`);t.push(uc(JSON.parse(e.slice(i,n))))}else if(a===`"`){let a=!1;for(n++;n<r;){let t=e[n];if(a)a=!1;else if(t===`\\`)a=!0;else if(t===`"`){n++;break}n++}t.push(uc(JSON.parse(e.slice(i,n))))}else if(a===`-`||a>=`0`&&a<=`9`){for(;n<r&&/[\d.eE+-]/.test(e[n]);)n++;t.push(uc(JSON.parse(e.slice(i,n))))}else if(e.slice(n,n+4)===`true`)t.push(!0),n+=4;else if(e.slice(n,n+5)===`false`)t.push(!1),n+=5;else if(e.slice(n,n+4)===`null`)t.push(null),n+=4;else{let t=e.slice(n,n+10);throw Error(`Invalid JSON at position ${i}: unexpected '${t.split(/\s/)[0]}'`)}}return t}function nv(e,t,n,r,i,a=0){if(e==null)return`null`;if(typeof e==`boolean`)return String(e);if(typeof e==`number`)return Number.isFinite(e)?String(e):`null`;if(typeof e==`string`)return n?e:JSON.stringify(e);let o=i?` `:` `;if(Array.isArray(e))return e.length===0?`[]`:t?`[${e.map(e=>nv(e,!0,!1,r,i)).join(`,`)}]`:`[
629
629
  ${e.map(e=>o.repeat(a+1)+nv(e,!1,!1,r,i,a+1)).join(`,
630
630
  `)}
631
631
  ${o.repeat(a)}]`;if(typeof e==`object`){let n=Object.keys(e);return r&&(n=n.sort()),n.length===0?`{}`:t?`{${n.map(t=>`${JSON.stringify(t)}:${nv(e[t],!0,!1,r,i)}`).join(`,`)}}`:`{
632
632
  ${n.map(t=>{let n=nv(e[t],!1,!1,r,i,a+1);return`${o.repeat(a+1)}${JSON.stringify(t)}: ${n}`}).join(`,
633
633
  `)}
634
- ${o.repeat(a)}}`}return String(e)}var rv,iv,av,ov=S(()=>{Li(),A(),pl(),ir(),xr(),O(),$_(),_c(),rv={name:`jq`,summary:`command-line JSON processor`,usage:`jq [OPTIONS] FILTER [FILE]`,options:[`-r, --raw-output output strings without quotes`,`-c, --compact compact output (no pretty printing)`,`-e, --exit-status set exit status based on output`,`-s, --slurp read entire input into array`,`-n, --null-input don't read any input`,`-j, --join-output don't print newlines after each output`,`-a, --ascii force ASCII output`,`-S, --sort-keys sort object keys`,`-C, --color colorize output (ignored)`,`-M, --monochrome monochrome output (ignored)`,` --tab use tabs for indentation`,` --help display this help and exit`]},iv={name:`jq`,async execute(e,t){dl(t.requireDefenseContext,`jq`,`execution entry`);let n=(e,n)=>fl(t.requireDefenseContext,`jq`,e,n);if(E(e))return T(rv);let r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=`.`,f=!1,p=[];for(let t=0;t<e.length;t++){let n=e[t];if(n===`-r`||n===`--raw-output`)r=!0;else if(n===`-c`||n===`--compact-output`)i=!0;else if(n===`-e`||n===`--exit-status`)a=!0;else if(n===`-s`||n===`--slurp`)o=!0;else if(n===`-n`||n===`--null-input`)s=!0;else if(n===`-j`||n===`--join-output`)c=!0;else if(!(n===`-a`||n===`--ascii`)){if(n===`-S`||n===`--sort-keys`)l=!0;else if(!(n===`-C`||n===`--color`)&&!(n===`-M`||n===`--monochrome`))if(n===`--tab`)u=!0;else if(n===`-`)p.push(`-`);else{if(n.startsWith(`--`))return D(`jq`,n);if(n.startsWith(`-`)){for(let e of n.slice(1))if(e===`r`)r=!0;else if(e===`c`)i=!0;else if(e===`e`)a=!0;else if(e===`s`)o=!0;else if(e===`n`)s=!0;else if(e===`j`)c=!0;else if(e!==`a`){if(e===`S`)l=!0;else if(e!==`C`&&e!==`M`)return D(`jq`,`-${e}`)}}else f?p.push(n):(d=n,f=!0)}}}let m=[];if(!s)if(p.length===0||p.length===1&&p[0]===`-`)m.push({source:`stdin`,content:t.stdin});else{let e=await n(`file read`,()=>yr(t,p,{cmdName:`jq`,stopOnError:!0}));if(e.exitCode!==0)return{stdout:``,stderr:e.stderr,exitCode:2};m=e.files.map(e=>({source:e.filename||`stdin`,content:e.content}))}try{let e=J_(d),n=[],f={limits:t.limits?{maxIterations:t.limits.maxJqIterations}:void 0,env:t.env,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext};if(s)n=W(null,e,f);else if(o){let t=[];for(let{content:e}of m){let n=e.trim();n&&t.push(...tv(n))}n=W(t,e,f)}else for(let{content:t}of m){let r=t.trim();if(!r)continue;let i=tv(r);for(let t of i)n.push(...W(t,e,f))}let p=n.map(e=>nv(e,i,r,l,u)),h=c?``:`
634
+ ${o.repeat(a)}}`}return String(e)}var rv,iv,av,ov=S(()=>{Li(),A(),fl(),ir(),xr(),O(),$_(),gc(),rv={name:`jq`,summary:`command-line JSON processor`,usage:`jq [OPTIONS] FILTER [FILE]`,options:[`-r, --raw-output output strings without quotes`,`-c, --compact compact output (no pretty printing)`,`-e, --exit-status set exit status based on output`,`-s, --slurp read entire input into array`,`-n, --null-input don't read any input`,`-j, --join-output don't print newlines after each output`,`-a, --ascii force ASCII output`,`-S, --sort-keys sort object keys`,`-C, --color colorize output (ignored)`,`-M, --monochrome monochrome output (ignored)`,` --tab use tabs for indentation`,` --help display this help and exit`]},iv={name:`jq`,async execute(e,t){ul(t.requireDefenseContext,`jq`,`execution entry`);let n=(e,n)=>dl(t.requireDefenseContext,`jq`,e,n);if(E(e))return T(rv);let r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=`.`,f=!1,p=[];for(let t=0;t<e.length;t++){let n=e[t];if(n===`-r`||n===`--raw-output`)r=!0;else if(n===`-c`||n===`--compact-output`)i=!0;else if(n===`-e`||n===`--exit-status`)a=!0;else if(n===`-s`||n===`--slurp`)o=!0;else if(n===`-n`||n===`--null-input`)s=!0;else if(n===`-j`||n===`--join-output`)c=!0;else if(!(n===`-a`||n===`--ascii`)){if(n===`-S`||n===`--sort-keys`)l=!0;else if(!(n===`-C`||n===`--color`)&&!(n===`-M`||n===`--monochrome`))if(n===`--tab`)u=!0;else if(n===`-`)p.push(`-`);else{if(n.startsWith(`--`))return D(`jq`,n);if(n.startsWith(`-`)){for(let e of n.slice(1))if(e===`r`)r=!0;else if(e===`c`)i=!0;else if(e===`e`)a=!0;else if(e===`s`)o=!0;else if(e===`n`)s=!0;else if(e===`j`)c=!0;else if(e!==`a`){if(e===`S`)l=!0;else if(e!==`C`&&e!==`M`)return D(`jq`,`-${e}`)}}else f?p.push(n):(d=n,f=!0)}}}let m=[];if(!s)if(p.length===0||p.length===1&&p[0]===`-`)m.push({source:`stdin`,content:t.stdin});else{let e=await n(`file read`,()=>yr(t,p,{cmdName:`jq`,stopOnError:!0}));if(e.exitCode!==0)return{stdout:``,stderr:e.stderr,exitCode:2};m=e.files.map(e=>({source:e.filename||`stdin`,content:e.content}))}try{let e=J_(d),n=[],f={limits:t.limits?{maxIterations:t.limits.maxJqIterations}:void 0,env:t.env,coverage:t.coverage,requireDefenseContext:t.requireDefenseContext};if(s)n=W(null,e,f);else if(o){let t=[];for(let{content:e}of m){let n=e.trim();n&&t.push(...tv(n))}n=W(t,e,f)}else for(let{content:t}of m){let r=t.trim();if(!r)continue;let i=tv(r);for(let t of i)n.push(...W(t,e,f))}let p=n.map(e=>nv(e,i,r,l,u)),h=c?``:`
635
635
  `,g=p.join(h),_=t.limits?.maxStringLength;if(_!==void 0&&_>0&&g.length>_)throw new k(`jq: output size limit exceeded (${_} bytes)`,`string_length`);let v=a&&(n.length===0||n.every(e=>e==null||e===!1))?1:0;return{stdout:g?c?g:`${g}
636
636
  `:``,stderr:``,exitCode:v}}catch(e){if(e instanceof w)throw e;if(e instanceof k)return{stdout:``,stderr:`jq: ${Ii(e.message)}
637
637
  `,exitCode:k.EXIT_CODE};let t=Ii(e.message);return t.includes(`Unknown function`)?{stdout:``,stderr:`jq: error: ${t}
@@ -656,7 +656,7 @@ ${o.repeat(a)}}`}return String(e)}var rv,iv,av,ov=S(()=>{Li(),A(),pl(),ir(),xr()
656
656
 
657
657
  NUMBER may be a decimal number.`,options:[` --help display this help and exit`]},Pv=36e5,Fv={name:`sleep`,async execute(e,t){if(E(e))return T(Nv);if(e.length===0)return{stdout:``,stderr:`sleep: missing operand
658
658
  `,exitCode:1};let n=0;for(let t of e){let e=Av(t);if(e===null)return{stdout:``,stderr:`sleep: invalid time interval '${t}'
659
- `,exitCode:1};n+=e}return n>Pv&&(n=Pv),t.signal?.aborted||(t.sleep?await t.sleep(n):t.signal?await new Promise(e=>{let r=()=>{lr(i),e()},i=cr(()=>{t.signal?.removeEventListener(`abort`,r),e()},n);t.signal?.addEventListener(`abort`,r,{once:!0})}):await new Promise(e=>cr(e,n))),{stdout:``,stderr:``,exitCode:0}}},Iv={name:`sleep`,flags:[],needsArgs:!0}}),Rv={};C(Rv,{flagsForFuzzing:()=>Vv,timeoutCommand:()=>Bv});var zv,Bv,Vv,Hv=S(()=>{Vc(),ur(),jv(),O(),zv={name:`timeout`,summary:`run a command with a time limit`,usage:`timeout [OPTION] DURATION COMMAND [ARG]...`,description:`Start COMMAND, and kill it if still running after DURATION.
659
+ `,exitCode:1};n+=e}return n>Pv&&(n=Pv),t.signal?.aborted||(t.sleep?await t.sleep(n):t.signal?await new Promise(e=>{let r=()=>{lr(i),e()},i=cr(()=>{t.signal?.removeEventListener(`abort`,r),e()},n);t.signal?.addEventListener(`abort`,r,{once:!0})}):await new Promise(e=>cr(e,n))),{stdout:``,stderr:``,exitCode:0}}},Iv={name:`sleep`,flags:[],needsArgs:!0}}),Rv={};C(Rv,{flagsForFuzzing:()=>Vv,timeoutCommand:()=>Bv});var zv,Bv,Vv,Hv=S(()=>{Bc(),ur(),jv(),O(),zv={name:`timeout`,summary:`run a command with a time limit`,usage:`timeout [OPTION] DURATION COMMAND [ARG]...`,description:`Start COMMAND, and kill it if still running after DURATION.
660
660
 
661
661
  DURATION is a number with optional suffix:
662
662
  s - seconds (default)
@@ -666,12 +666,12 @@ DURATION is a number with optional suffix:
666
666
  `,exitCode:1};let i=r[0],a=Av(i);if(a===null)return{stdout:``,stderr:`timeout: invalid time interval '${i}'
667
667
  `,exitCode:1};let o=r.slice(1);if(o.length===0)return{stdout:``,stderr:`timeout: missing operand
668
668
  `,exitCode:1};if(!t.exec)return{stdout:``,stderr:`timeout: exec not available
669
- `,exitCode:1};let s=new AbortController,c;try{let e=new Promise(e=>{c=cr(()=>{s.abort(),e({timedOut:!0})},a)}),n=t.exec(Bc([o[0]]),{cwd:t.cwd,signal:s.signal,stdin:t.stdin,args:o.slice(1)}).then(e=>({timedOut:!1,result:e})),r=await Promise.race([e,n]);return r.timedOut?{stdout:``,stderr:``,exitCode:124}:r.result}finally{c!==void 0&&lr(c)}}},Vv={name:`timeout`,flags:[{flag:`-k`,type:`value`,valueHint:`string`},{flag:`-s`,type:`value`,valueHint:`string`},{flag:`--preserve-status`,type:`boolean`},{flag:`--foreground`,type:`boolean`}],needsArgs:!0,minArgs:2}}),Uv,Wv,Gv=S(()=>{globalThis.SharedArrayBuffer,globalThis.Atomics,Uv=performance.now.bind(performance),Wv=globalThis.Headers}),Kv={};C(Kv,{flagsForFuzzing:()=>Yv,timeCommand:()=>Jv});function qv(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${n.toString().padStart(2,`0`)}:${r.toFixed(2).padStart(5,`0`)}`:`${n}:${r.toFixed(2).padStart(5,`0`)}`}var Jv,Yv,Xv=S(()=>{Li(),Zl(),Vc(),Gv(),Jv={name:`time`,async execute(e,t){let n=`%e %M`,r=null,i=!1,a=!1,o=0;for(;o<e.length;){let t=e[o];if(t===`-f`||t===`--format`){if(o++,o>=e.length)return{stdout:``,stderr:`time: missing argument to '-f'
669
+ `,exitCode:1};let s=new AbortController,c;try{let e=new Promise(e=>{c=cr(()=>{s.abort(),e({timedOut:!0})},a)}),n=t.exec(zc([o[0]]),{cwd:t.cwd,signal:s.signal,stdin:t.stdin,args:o.slice(1)}).then(e=>({timedOut:!1,result:e})),r=await Promise.race([e,n]);return r.timedOut?{stdout:``,stderr:``,exitCode:124}:r.result}finally{c!==void 0&&lr(c)}}},Vv={name:`timeout`,flags:[{flag:`-k`,type:`value`,valueHint:`string`},{flag:`-s`,type:`value`,valueHint:`string`},{flag:`--preserve-status`,type:`boolean`},{flag:`--foreground`,type:`boolean`}],needsArgs:!0,minArgs:2}}),Uv,Wv,Gv=S(()=>{globalThis.SharedArrayBuffer,globalThis.Atomics,Uv=performance.now.bind(performance),Wv=globalThis.Headers}),Kv={};C(Kv,{flagsForFuzzing:()=>Yv,timeCommand:()=>Jv});function qv(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${n.toString().padStart(2,`0`)}:${r.toFixed(2).padStart(5,`0`)}`:`${n}:${r.toFixed(2).padStart(5,`0`)}`}var Jv,Yv,Xv=S(()=>{Li(),Xl(),Bc(),Gv(),Jv={name:`time`,async execute(e,t){let n=`%e %M`,r=null,i=!1,a=!1,o=0;for(;o<e.length;){let t=e[o];if(t===`-f`||t===`--format`){if(o++,o>=e.length)return{stdout:``,stderr:`time: missing argument to '-f'
670
670
  `,exitCode:1};n=e[o],o++}else if(t===`-o`||t===`--output`){if(o++,o>=e.length)return{stdout:``,stderr:`time: missing argument to '-o'
671
671
  `,exitCode:1};r=e[o],o++}else if(t===`-a`||t===`--append`)i=!0,o++;else if(t===`-v`||t===`--verbose`)n=`Command being timed: %C
672
672
  Elapsed (wall clock) time: %e seconds
673
673
  Maximum resident set size (kbytes): %M`,o++;else if(t===`-p`||t===`--portability`)a=!0,o++;else if(t===`--`){o++;break}else if(t.startsWith(`-`))o++;else break}let s=e.slice(o);if(s.length===0)return{stdout:``,stderr:``,exitCode:0};let c=Uv(),l=s.join(` `),u;try{if(!t.exec)return{stdout:``,stderr:`time: exec not available
674
- `,exitCode:1};u=await t.exec(Bc([s[0]]),{env:Jl(t.env),cwd:t.cwd,stdin:t.stdin,signal:t.signal,args:s.slice(1)})}catch(e){u={stdout:``,stderr:`time: ${Ii(e.message)}
674
+ `,exitCode:1};u=await t.exec(zc([s[0]]),{env:ql(t.env),cwd:t.cwd,stdin:t.stdin,signal:t.signal,args:s.slice(1)})}catch(e){u={stdout:``,stderr:`time: ${Ii(e.message)}
675
675
  `,exitCode:127}}let d=(Uv()-c)/1e3,f;if(a?f=`real ${d.toFixed(2)}
676
676
  user 0.00
677
677
  sys 0.00
@@ -683,7 +683,7 @@ sys 0.00
683
683
  `,exitCode:1};let a=1,o=1,s;if(r.length===1?s=parseFloat(r[0]):r.length===2?(a=parseFloat(r[0]),s=parseFloat(r[1])):(a=parseFloat(r[0]),o=parseFloat(r[1]),s=parseFloat(r[2])),Number.isNaN(a)||Number.isNaN(o)||Number.isNaN(s))return{stdout:``,stderr:`seq: invalid floating point argument: '${r.find(e=>Number.isNaN(parseFloat(e)))}'
684
684
  `,exitCode:1};if(o===0)return{stdout:``,stderr:`seq: invalid Zero increment value: '0'
685
685
  `,exitCode:1};let c=[],l=e=>{let t=String(e),n=t.indexOf(`.`);return n===-1?0:t.length-n-1},u=Math.max(l(a),l(o),l(s)),d=1e5,f=0;if(o>0)for(let e=a;e<=s+1e-10&&!(f++>d);e+=o)c.push(u>0?e.toFixed(u):String(Math.round(e)));else for(let e=a;e>=s-1e-10&&!(f++>d);e+=o)c.push(u>0?e.toFixed(u):String(Math.round(e)));if(n&&c.length>0){let e=Math.max(...c.map(e=>e.replace(`-`,``).length));for(let t=0;t<c.length;t++){let n=c[t].startsWith(`-`),r=(n?c[t].slice(1):c[t]).padStart(e,`0`);c[t]=n?`-${r}`:r}}let p=c.join(t);return{stdout:p?`${p}
686
- `:``,stderr:``,exitCode:0}}},$v={name:`seq`,flags:[{flag:`-s`,type:`value`,valueHint:`string`},{flag:`-w`,type:`boolean`}],needsArgs:!0}}),ty={};C(ty,{exprCommand:()=>ry,flagsForFuzzing:()=>iy});function ny(e){if(e.length===1)return e[0];let t=0;function n(){let n=r();for(;t<e.length&&e[t]===`|`;){t++;let e=r();if(n!==`0`&&n!==``)return n;n=e}return n}function r(){let n=i();for(;t<e.length&&e[t]===`&`;){t++;let e=i();(n===`0`||n===``||e===`0`||e===``)&&(n=`0`)}return n}function i(){let n=a();for(;t<e.length;){let r=e[t];if([`=`,`!=`,`<`,`>`,`<=`,`>=`].includes(r)){t++;let e=a(),i=parseInt(n,10),o=parseInt(e,10),s=!Number.isNaN(i)&&!Number.isNaN(o),c;c=r===`=`?s?i===o:n===e:r===`!=`?s?i!==o:n!==e:r===`<`?s?i<o:n<e:r===`>`?s?i>o:n>e:r===`<=`?s?i<=o:n<=e:s?i>=o:n>=e,n=c?`1`:`0`}else break}return n}function a(){let n=o();for(;t<e.length;){let r=e[t];if(r===`+`||r===`-`){t++;let e=o(),i=parseInt(n,10),a=parseInt(e,10);if(Number.isNaN(i)||Number.isNaN(a))throw Error(`non-integer argument`);n=String(r===`+`?i+a:i-a)}else break}return n}function o(){let n=s();for(;t<e.length;){let r=e[t];if(r===`*`||r===`/`||r===`%`){t++;let e=s(),i=parseInt(n,10),a=parseInt(e,10);if(Number.isNaN(i)||Number.isNaN(a))throw Error(`non-integer argument`);if((r===`/`||r===`%`)&&a===0)throw Error(`division by zero`);n=String(r===`*`?i*a:r===`/`?Math.trunc(i/a):i%a)}else break}return n}function s(){let n=c();for(;t<e.length&&e[t]===`:`;){t++;let e=R(`^${c()}`).match(n);n=e?e[1]===void 0?String(e[0].length):e[1]:`0`}return n}function c(){if(t>=e.length)throw Error(`syntax error`);let r=e[t];if(r===`match`){t++;let e=c(),n=R(c()).match(e);return n?n[1]===void 0?String(n[0].length):n[1]:`0`}if(r===`substr`){t++;let e=c(),n=parseInt(c(),10),r=parseInt(c(),10);if(Number.isNaN(n)||Number.isNaN(r))throw Error(`non-integer argument`);return e.substring(n-1,n-1+r)}if(r===`index`){t++;let e=c(),n=c();for(let t=0;t<e.length;t++)if(n.includes(e[t]))return String(t+1);return`0`}if(r===`length`){t++;let e=c();return String(e.length)}if(r===`(`){t++;let r=n();if(t>=e.length||e[t]!==`)`)throw Error(`syntax error`);return t++,r}return t++,r}return n()}var ry,iy,ay=S(()=>{Li(),Ss(),ry={name:`expr`,async execute(e,t){if(e.length===0)return{stdout:``,stderr:`expr: missing operand
686
+ `:``,stderr:``,exitCode:0}}},$v={name:`seq`,flags:[{flag:`-s`,type:`value`,valueHint:`string`},{flag:`-w`,type:`boolean`}],needsArgs:!0}}),ty={};C(ty,{exprCommand:()=>ry,flagsForFuzzing:()=>iy});function ny(e){if(e.length===1)return e[0];let t=0;function n(){let n=r();for(;t<e.length&&e[t]===`|`;){t++;let e=r();if(n!==`0`&&n!==``)return n;n=e}return n}function r(){let n=i();for(;t<e.length&&e[t]===`&`;){t++;let e=i();(n===`0`||n===``||e===`0`||e===``)&&(n=`0`)}return n}function i(){let n=a();for(;t<e.length;){let r=e[t];if([`=`,`!=`,`<`,`>`,`<=`,`>=`].includes(r)){t++;let e=a(),i=parseInt(n,10),o=parseInt(e,10),s=!Number.isNaN(i)&&!Number.isNaN(o),c;c=r===`=`?s?i===o:n===e:r===`!=`?s?i!==o:n!==e:r===`<`?s?i<o:n<e:r===`>`?s?i>o:n>e:r===`<=`?s?i<=o:n<=e:s?i>=o:n>=e,n=c?`1`:`0`}else break}return n}function a(){let n=o();for(;t<e.length;){let r=e[t];if(r===`+`||r===`-`){t++;let e=o(),i=parseInt(n,10),a=parseInt(e,10);if(Number.isNaN(i)||Number.isNaN(a))throw Error(`non-integer argument`);n=String(r===`+`?i+a:i-a)}else break}return n}function o(){let n=s();for(;t<e.length;){let r=e[t];if(r===`*`||r===`/`||r===`%`){t++;let e=s(),i=parseInt(n,10),a=parseInt(e,10);if(Number.isNaN(i)||Number.isNaN(a))throw Error(`non-integer argument`);if((r===`/`||r===`%`)&&a===0)throw Error(`division by zero`);n=String(r===`*`?i*a:r===`/`?Math.trunc(i/a):i%a)}else break}return n}function s(){let n=c();for(;t<e.length&&e[t]===`:`;){t++;let e=z(`^${c()}`).match(n);n=e?e[1]===void 0?String(e[0].length):e[1]:`0`}return n}function c(){if(t>=e.length)throw Error(`syntax error`);let r=e[t];if(r===`match`){t++;let e=c(),n=z(c()).match(e);return n?n[1]===void 0?String(n[0].length):n[1]:`0`}if(r===`substr`){t++;let e=c(),n=parseInt(c(),10),r=parseInt(c(),10);if(Number.isNaN(n)||Number.isNaN(r))throw Error(`non-integer argument`);return e.substring(n-1,n-1+r)}if(r===`index`){t++;let e=c(),n=c();for(let t=0;t<e.length;t++)if(n.includes(e[t]))return String(t+1);return`0`}if(r===`length`){t++;let e=c();return String(e.length)}if(r===`(`){t++;let r=n();if(t>=e.length||e[t]!==`)`)throw Error(`syntax error`);return t++,r}return t++,r}return n()}var ry,iy,ay=S(()=>{Li(),xs(),ry={name:`expr`,async execute(e,t){if(e.length===0)return{stdout:``,stderr:`expr: missing operand
687
687
  `,exitCode:2};try{let t=ny(e),n=+(t===`0`||t===``);return{stdout:`${t}
688
688
  `,stderr:``,exitCode:n}}catch(e){return{stdout:``,stderr:`expr: ${Ii(e.message)}
689
689
  `,exitCode:2}}}},iy={name:`expr`,flags:[],needsArgs:!0}});function oy(e){function t(e,t){return e<<t|e>>>32-t}let n=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),r=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],i=e.length*8,a=(e.length%64<56?56:120)-e.length%64,o=new Uint8Array(e.length+a+8);o.set(e),o[e.length]=128;let s=new DataView(o.buffer);s.setUint32(o.length-8,i>>>0,!0),s.setUint32(o.length-4,Math.floor(i/4294967296),!0);let c=1732584193,l=4023233417,u=2562383102,d=271733878;for(let e=0;e<o.length;e+=64){let i=new Uint32Array(16);for(let t=0;t<16;t++)i[t]=s.getUint32(e+t*4,!0);let a=c,o=l,f=u,p=d;for(let e=0;e<64;e++){let s,c;e<16?(s=o&f|~o&p,c=e):e<32?(s=p&o|~p&f,c=(5*e+1)%16):e<48?(s=o^f^p,c=(3*e+5)%16):(s=f^(o|~p),c=7*e%16),s=s+a+n[e]+i[c]>>>0,a=p,p=f,f=o,o=o+t(s,r[e])>>>0}c=c+a>>>0,l=l+o>>>0,u=u+f>>>0,d=d+p>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,c,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,u,!0),new DataView(f.buffer).setUint32(12,d,!0),Array.from(f).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function sy(e,t){if(e===`md5`)return oy(t);let n=ly.get(e);if(!n)throw Error(`Unknown algorithm: ${e}`);let r=await globalThis.crypto.subtle.digest(n,new Uint8Array(t).buffer);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}function cy(e,t,n){let r={name:e,summary:n,usage:`${e} [OPTION]... [FILE]...`,options:[`-c, --check read checksums from FILEs and check them`,` --help display this help and exit`]};return{name:e,async execute(n,i){if(E(n))return T(r);let a=!1,o=[];for(let t of n)if(t===`-c`||t===`--check`)a=!0;else if(!(t===`-b`||t===`-t`||t===`--binary`||t===`--text`)){if(t.startsWith(`-`)&&t!==`-`)return D(e,t);o.push(t)}o.length===0&&o.push(`-`);let s=async e=>{if(e===`-`)return Uint8Array.from(i.stdin,e=>e.charCodeAt(0));try{return await i.fs.readFileBuffer(i.fs.resolvePath(i.cwd,e))}catch{return null}};if(a){let n=0,r=``;for(let a of o){let o=a===`-`?i.stdin:await i.fs.readFile(i.fs.resolvePath(i.cwd,a)).catch(()=>null);if(o===null)return{stdout:``,stderr:`${e}: ${a}: No such file or directory
@@ -713,7 +713,7 @@ sys 0.00
713
713
  `);for(let e of i)n.delete(e)}}for(let e of n)r.push(e);return r.length>0&&(t.push(` Other:`),t.push(` ${r.sort().join(`, `)}
714
714
  `)),t.push(`Use '<command> --help' for details on a specific command.`),`${t.join(`
715
715
  `)}
716
- `}var bx,xx,Sx,Cx=S(()=>{Vc(),bx=new Map([[`File operations`,[`ls`,`cat`,`head`,`tail`,`wc`,`touch`,`mkdir`,`rm`,`cp`,`mv`,`ln`,`chmod`,`stat`,`readlink`]],[`Text processing`,[`grep`,`sed`,`awk`,`sort`,`uniq`,`cut`,`tr`,`tee`,`diff`]],[`Search`,[`find`]],[`Navigation & paths`,[`pwd`,`basename`,`dirname`,`tree`,`du`]],[`Environment & shell`,[`echo`,`printf`,`env`,`printenv`,`export`,`alias`,`unalias`,`history`,`clear`,`true`,`false`,`bash`,`sh`]],[`Data processing`,[`xargs`,`jq`,`base64`,`date`]],[`Network`,[`curl`,`html-to-markdown`]]]),xx={name:`help`,async execute(e,t){if(e.includes(`--help`)||e.includes(`-h`))return{stdout:`help - display available commands
716
+ `}var bx,xx,Sx,Cx=S(()=>{Bc(),bx=new Map([[`File operations`,[`ls`,`cat`,`head`,`tail`,`wc`,`touch`,`mkdir`,`rm`,`cp`,`mv`,`ln`,`chmod`,`stat`,`readlink`]],[`Text processing`,[`grep`,`sed`,`awk`,`sort`,`uniq`,`cut`,`tr`,`tee`,`diff`]],[`Search`,[`find`]],[`Navigation & paths`,[`pwd`,`basename`,`dirname`,`tree`,`du`]],[`Environment & shell`,[`echo`,`printf`,`env`,`printenv`,`export`,`alias`,`unalias`,`history`,`clear`,`true`,`false`,`bash`,`sh`]],[`Data processing`,[`xargs`,`jq`,`base64`,`date`]],[`Network`,[`curl`,`html-to-markdown`]]]),xx={name:`help`,async execute(e,t){if(e.includes(`--help`)||e.includes(`-h`))return{stdout:`help - display available commands
717
717
 
718
718
  Usage: help [command]
719
719
 
@@ -722,7 +722,7 @@ Options:
722
722
 
723
723
  If a command name is provided, shows help for that command.
724
724
  Otherwise, lists all available commands.
725
- `,stderr:``,exitCode:0};if(e.length>0&&t.exec){let n=e[0];return t.exec(Bc([n]),{cwd:t.cwd,signal:t.signal,args:[`--help`]})}return{stdout:yx(t.getRegisteredCommands?.()??[]),stderr:``,exitCode:0}}},Sx={name:`help`,flags:[]}}),wx={};C(wx,{flagsForFuzzing:()=>Ox,whichCommand:()=>Dx});var Tx,Ex,Dx,Ox,kx=S(()=>{_r(),O(),Tx={name:`which`,summary:`locate a command`,usage:`which [-as] program ...`,options:[`-a List all instances of executables found`,`-s No output, just return 0 if found, 1 if not`,`--help display this help and exit`]},Ex={showAll:{short:`a`,type:`boolean`},silent:{short:`s`,type:`boolean`}},Dx={name:`which`,async execute(e,t){if(E(e))return T(Tx);let n=gr(`which`,e,Ex);if(!n.ok)return n.error;let r=n.result.flags.showAll,i=n.result.flags.silent,a=n.result.positional;if(a.length===0)return{stdout:``,stderr:``,exitCode:1};let o=(t.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`),s=``,c=!0;for(let e of a){let n=!1;for(let a of o){if(!a)continue;let o=t.fs.resolvePath(a,e);if(await t.fs.exists(o)&&(n=!0,i||(s+=`${o}
725
+ `,stderr:``,exitCode:0};if(e.length>0&&t.exec){let n=e[0];return t.exec(zc([n]),{cwd:t.cwd,signal:t.signal,args:[`--help`]})}return{stdout:yx(t.getRegisteredCommands?.()??[]),stderr:``,exitCode:0}}},Sx={name:`help`,flags:[]}}),wx={};C(wx,{flagsForFuzzing:()=>Ox,whichCommand:()=>Dx});var Tx,Ex,Dx,Ox,kx=S(()=>{_r(),O(),Tx={name:`which`,summary:`locate a command`,usage:`which [-as] program ...`,options:[`-a List all instances of executables found`,`-s No output, just return 0 if found, 1 if not`,`--help display this help and exit`]},Ex={showAll:{short:`a`,type:`boolean`},silent:{short:`s`,type:`boolean`}},Dx={name:`which`,async execute(e,t){if(E(e))return T(Tx);let n=gr(`which`,e,Ex);if(!n.ok)return n.error;let r=n.result.flags.showAll,i=n.result.flags.silent,a=n.result.positional;if(a.length===0)return{stdout:``,stderr:``,exitCode:1};let o=(t.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`),s=``,c=!0;for(let e of a){let n=!1;for(let a of o){if(!a)continue;let o=t.fs.resolvePath(a,e);if(await t.fs.exists(o)&&(n=!0,i||(s+=`${o}
726
726
  `),!r))break}n||(c=!1)}return{stdout:s,stderr:``,exitCode:+!c}}},Ox={name:`which`,flags:[{flag:`-a`,type:`boolean`},{flag:`-s`,type:`boolean`}],needsArgs:!0}}),Ax={};C(Ax,{flagsForFuzzing:()=>Nx,tac:()=>Mx});async function jx(e,t){if(e.length>0&&e[0]!==`-`){let n=t.fs.resolvePath(t.cwd,e[0]);try{let e=(await t.fs.readFile(n)).split(`
727
727
  `);e[e.length-1]===``&&e.pop();let r=e.reverse();return{stdout:r.length>0?`${r.join(`
728
728
  `)}
@@ -765,50 +765,50 @@ With -d, decompress instead.`,options:[`-c, --stdout write to standard outp
765
765
 
766
766
  When no FILE is given, or when FILE is -, read from standard input.`,options:[`-c, --stdout write to standard output, keep original files`,`-f, --force force overwrite of output file`,`-k, --keep keep (don't delete) input files`,`-l, --list list compressed file contents`,`-n, --no-name do not restore the original name and timestamp`,`-N, --name restore the original file name and timestamp`,`-q, --quiet suppress all warnings`,`-r, --recursive operate recursively on directories`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},dS={name:`zcat`,summary:`decompress files to stdout`,usage:`zcat [OPTION]... [FILE]...`,description:`Decompress FILEs to standard output.
767
767
 
768
- When no FILE is given, or when FILE is -, read from standard input.`,options:[`-f, --force force; read compressed data even from a terminal`,`-l, --list list compressed file contents`,`-q, --quiet suppress all warnings`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},fS={stdout:{short:`c`,long:`stdout`,type:`boolean`},toStdout:{long:`to-stdout`,type:`boolean`},decompress:{short:`d`,long:`decompress`,type:`boolean`},uncompress:{long:`uncompress`,type:`boolean`},force:{short:`f`,long:`force`,type:`boolean`},keep:{short:`k`,long:`keep`,type:`boolean`},list:{short:`l`,long:`list`,type:`boolean`},noName:{short:`n`,long:`no-name`,type:`boolean`},name:{short:`N`,long:`name`,type:`boolean`},quiet:{short:`q`,long:`quiet`,type:`boolean`},recursive:{short:`r`,long:`recursive`,type:`boolean`},suffix:{short:`S`,long:`suffix`,type:`string`,default:`.gz`},test:{short:`t`,long:`test`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`},fast:{short:`1`,long:`fast`,type:`boolean`},level2:{short:`2`,type:`boolean`},level3:{short:`3`,type:`boolean`},level4:{short:`4`,type:`boolean`},level5:{short:`5`,type:`boolean`},level6:{short:`6`,type:`boolean`},level7:{short:`7`,type:`boolean`},level8:{short:`8`,type:`boolean`},best:{short:`9`,long:`best`,type:`boolean`}},pS={name:`gzip`,async execute(e,t){return{...await cS(e,t,`gzip`),stdoutEncoding:`binary`}}},mS={name:`gunzip`,async execute(e,t){return{...await cS(e,t,`gunzip`),stdoutEncoding:`binary`}}},hS={name:`zcat`,async execute(e,t){return{...await cS(e,t,`zcat`),stdoutEncoding:`binary`}}},gS={name:`gzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-d`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-1`,type:`boolean`},{flag:`-9`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},_S={name:`gunzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},vS={name:`zcat`,flags:[{flag:`-f`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0}});function bS(e){let t=e.indexOf(`=`);if(t>=0){let n=e.slice(0,t),r=e.slice(t+1);return n?`${encodeURIComponent(n)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(e)}function xS(e){let t=e.indexOf(`=`);if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1),i,a,o=r.match(/;type=([^;]+)$/);o&&(a=o[1],r=r.slice(0,-o[0].length));let s=r.match(/;filename=([^;]+)/);return s&&(i=s[1],r=r.replace(s[0],``)),(r.startsWith(`@`)||r.startsWith(`<`))&&(i??=r.slice(1).split(`/`).pop()),{name:n,value:r,filename:i,contentType:a}}function SS(e,t){let n=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let i of e){let e=i.value;if(e.startsWith(`@`)||e.startsWith(`<`)){let n=e.slice(1);e=t.get(n)??``}let a=`--${n}\r
768
+ When no FILE is given, or when FILE is -, read from standard input.`,options:[`-f, --force force; read compressed data even from a terminal`,`-l, --list list compressed file contents`,`-q, --quiet suppress all warnings`,`-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)`,`-t, --test test compressed file integrity`,`-v, --verbose verbose mode`,` --help display this help and exit`]},fS={stdout:{short:`c`,long:`stdout`,type:`boolean`},toStdout:{long:`to-stdout`,type:`boolean`},decompress:{short:`d`,long:`decompress`,type:`boolean`},uncompress:{long:`uncompress`,type:`boolean`},force:{short:`f`,long:`force`,type:`boolean`},keep:{short:`k`,long:`keep`,type:`boolean`},list:{short:`l`,long:`list`,type:`boolean`},noName:{short:`n`,long:`no-name`,type:`boolean`},name:{short:`N`,long:`name`,type:`boolean`},quiet:{short:`q`,long:`quiet`,type:`boolean`},recursive:{short:`r`,long:`recursive`,type:`boolean`},suffix:{short:`S`,long:`suffix`,type:`string`,default:`.gz`},test:{short:`t`,long:`test`,type:`boolean`},verbose:{short:`v`,long:`verbose`,type:`boolean`},fast:{short:`1`,long:`fast`,type:`boolean`},level2:{short:`2`,type:`boolean`},level3:{short:`3`,type:`boolean`},level4:{short:`4`,type:`boolean`},level5:{short:`5`,type:`boolean`},level6:{short:`6`,type:`boolean`},level7:{short:`7`,type:`boolean`},level8:{short:`8`,type:`boolean`},best:{short:`9`,long:`best`,type:`boolean`}},pS={name:`gzip`,async execute(e,t){return{...await cS(e,t,`gzip`),stdoutEncoding:`binary`}}},mS={name:`gunzip`,async execute(e,t){return{...await cS(e,t,`gunzip`),stdoutEncoding:`binary`}}},hS={name:`zcat`,async execute(e,t){return{...await cS(e,t,`zcat`),stdoutEncoding:`binary`}}},gS={name:`gzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-d`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-l`,type:`boolean`},{flag:`-n`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-r`,type:`boolean`},{flag:`-t`,type:`boolean`},{flag:`-v`,type:`boolean`},{flag:`-1`,type:`boolean`},{flag:`-9`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},_S={name:`gunzip`,flags:[{flag:`-c`,type:`boolean`},{flag:`-f`,type:`boolean`},{flag:`-k`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0},vS={name:`zcat`,flags:[{flag:`-f`,type:`boolean`},{flag:`-q`,type:`boolean`},{flag:`-v`,type:`boolean`}],stdinType:`binary`,needsFiles:!0}});function bS(e,t){if(e instanceof Uint8Array)return e;if(t===`base64`)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));if(t===`hex`){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t}if(t===`binary`||t===`latin1`){if(e.length<=65536)return Uint8Array.from(e,e=>e.charCodeAt(0));let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}return CS.encode(e)}function xS(e,t){if(t===`base64`){if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=65536,n=``;for(let r=0;r<e.length;r+=t){let i=e.subarray(r,r+t);n+=String.fromCharCode(...i)}return btoa(n)}if(t===`hex`)return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);if(t===`binary`||t===`latin1`){if(typeof Buffer<`u`)return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r=``;for(let t=0;t<e.length;t+=n){let i=e.subarray(t,t+n);r+=String.fromCharCode(...i)}return r}return wS.decode(e)}function SS(e){if(e!=null)return typeof e==`string`?e:e.encoding??void 0}var CS,wS,TS=S(()=>{CS=new TextEncoder,wS=new TextDecoder});function ES(e){let t=e.indexOf(`=`);if(t>=0){let n=e.slice(0,t),r=e.slice(t+1);return n?`${encodeURIComponent(n)}=${encodeURIComponent(r)}`:encodeURIComponent(r)}return encodeURIComponent(e)}function DS(e){let t=e.indexOf(`=`);if(t<0)return null;let n=e.slice(0,t),r=e.slice(t+1),i,a,o=r.match(/;type=([^;]+)$/);o&&(a=o[1],r=r.slice(0,-o[0].length));let s=r.match(/;filename=([^;]+)/);return s&&(i=s[1],r=r.replace(s[0],``)),(r.startsWith(`@`)||r.startsWith(`<`))&&(i??=r.slice(1).split(`/`).pop()),{name:n,value:r,filename:i,contentType:a}}function OS(e,t){let n=`----CurlFormBoundary${Date.now().toString(36)}`,r=[];for(let i of e){let e=i.value;if(e.startsWith(`@`)||e.startsWith(`<`)){let n=e.slice(1);e=t.get(n)??``}let a=`--${n}\r
769
769
  `;i.filename?(a+=`Content-Disposition: form-data; name="${i.name}"; filename="${i.filename}"\r
770
770
  `,i.contentType&&(a+=`Content-Type: ${i.contentType}\r
771
771
  `)):a+=`Content-Disposition: form-data; name="${i.name}"\r
772
772
  `,a+=`\r
773
773
  ${e}\r
774
774
  `,r.push(a)}return r.push(`--${n}--\r
775
- `),{body:r.join(``),boundary:n}}var CS=S(()=>{}),wS,TS=S(()=>{wS={name:`curl`,summary:`transfer a URL`,usage:`curl [OPTIONS] URL`,options:[`-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)`,`-H, --header HEADER Add header (can be used multiple times)`,`-d, --data DATA HTTP POST data`,` --data-raw DATA HTTP POST data (no @ interpretation)`,` --data-binary DATA HTTP POST binary data`,` --data-urlencode DATA URL-encode and POST data`,`-F, --form NAME=VALUE Multipart form data`,`-u, --user USER:PASS HTTP authentication`,`-A, --user-agent STR Set User-Agent header`,`-e, --referer URL Set Referer header`,`-b, --cookie DATA Send cookies (name=value or @file)`,`-c, --cookie-jar FILE Save cookies to file`,`-T, --upload-file FILE Upload file (PUT)`,`-o, --output FILE Write output to file`,`-O, --remote-name Write to file named from URL`,`-I, --head Show headers only (HEAD request)`,`-i, --include Include response headers in output`,`-s, --silent Silent mode (no progress)`,`-S, --show-error Show errors even when silent`,`-f, --fail Fail silently on HTTP errors (no output)`,`-L, --location Follow redirects (default)`,` --max-redirs NUM Maximum redirects (default: 20)`,`-m, --max-time SECS Maximum time for request`,` --connect-timeout SECS Connection timeout`,`-w, --write-out FMT Output format after completion`,`-v, --verbose Verbose output`,` --help Display this help and exit`,``,`Note: Network access must be configured via BashEnv network option.`,` curl is not available by default for security reasons.`]}});function ES(e){let t={method:`GET`,headers:new Wv,dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`-X`||i===`--request`)t.method=e[++r]??`GET`;else if(i.startsWith(`-X`))t.method=i.slice(2);else if(i.startsWith(`--request=`))t.method=i.slice(10);else if(i===`-H`||i===`--header`){let n=e[++r];if(n){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();t.headers.append(r,i)}}}else if(i.startsWith(`--header=`)){let e=i.slice(9),n=e.indexOf(`:`);if(n>0){let r=e.slice(0,n).trim(),i=e.slice(n+1).trim();t.headers.append(r,i)}}else if(i===`-d`||i===`--data`||i===`--data-raw`)t.data=e[++r]??``,n=!0;else if(i.startsWith(`-d`))t.data=i.slice(2),n=!0;else if(i.startsWith(`--data=`))t.data=i.slice(7),n=!0;else if(i.startsWith(`--data-raw=`))t.data=i.slice(11),n=!0;else if(i===`--data-binary`)t.data=e[++r]??``,t.dataBinary=!0,n=!0;else if(i.startsWith(`--data-binary=`))t.data=i.slice(14),t.dataBinary=!0,n=!0;else if(i===`--data-urlencode`){let i=e[++r]??``;t.data=(t.data?`${t.data}&`:``)+bS(i),n=!0}else if(i.startsWith(`--data-urlencode=`)){let e=i.slice(17);t.data=(t.data?`${t.data}&`:``)+bS(e),n=!0}else if(i===`-F`||i===`--form`){let i=xS(e[++r]??``);i&&t.formFields.push(i),n=!0}else if(i.startsWith(`--form=`)){let e=xS(i.slice(7));e&&t.formFields.push(e),n=!0}else if(i===`-u`||i===`--user`)t.user=e[++r];else if(i.startsWith(`-u`))t.user=i.slice(2);else if(i.startsWith(`--user=`))t.user=i.slice(7);else if(i===`-A`||i===`--user-agent`)t.headers.set(`User-Agent`,e[++r]??``);else if(i.startsWith(`-A`))t.headers.set(`User-Agent`,i.slice(2));else if(i.startsWith(`--user-agent=`))t.headers.set(`User-Agent`,i.slice(13));else if(i===`-e`||i===`--referer`)t.headers.set(`Referer`,e[++r]??``);else if(i.startsWith(`-e`))t.headers.set(`Referer`,i.slice(2));else if(i.startsWith(`--referer=`))t.headers.set(`Referer`,i.slice(10));else if(i===`-b`||i===`--cookie`)t.headers.set(`Cookie`,e[++r]??``);else if(i.startsWith(`-b`))t.headers.set(`Cookie`,i.slice(2));else if(i.startsWith(`--cookie=`))t.headers.set(`Cookie`,i.slice(9));else if(i===`-c`||i===`--cookie-jar`)t.cookieJar=e[++r];else if(i.startsWith(`--cookie-jar=`))t.cookieJar=i.slice(13);else if(i===`-T`||i===`--upload-file`)t.uploadFile=e[++r],t.method===`GET`&&(t.method=`PUT`);else if(i.startsWith(`--upload-file=`))t.uploadFile=i.slice(14),t.method===`GET`&&(t.method=`PUT`);else if(i===`-m`||i===`--max-time`){let n=parseFloat(e[++r]??`0`);!Number.isNaN(n)&&n>0&&(t.timeoutMs=n*1e3)}else if(i.startsWith(`--max-time=`)){let e=parseFloat(i.slice(11));!Number.isNaN(e)&&e>0&&(t.timeoutMs=e*1e3)}else if(i===`--connect-timeout`){let n=parseFloat(e[++r]??`0`);!Number.isNaN(n)&&n>0&&t.timeoutMs===void 0&&(t.timeoutMs=n*1e3)}else if(i.startsWith(`--connect-timeout=`)){let e=parseFloat(i.slice(18));!Number.isNaN(e)&&e>0&&t.timeoutMs===void 0&&(t.timeoutMs=e*1e3)}else if(i===`-o`||i===`--output`)t.outputFile=e[++r];else if(i.startsWith(`--output=`))t.outputFile=i.slice(9);else if(i===`-O`||i===`--remote-name`)t.useRemoteName=!0;else if(i===`-I`||i===`--head`)t.headOnly=!0,t.method=`HEAD`;else if(i===`-i`||i===`--include`)t.includeHeaders=!0;else if(i===`-s`||i===`--silent`)t.silent=!0;else if(i===`-S`||i===`--show-error`)t.showError=!0;else if(i===`-f`||i===`--fail`)t.failSilently=!0;else if(i===`-L`||i===`--location`)t.followRedirects=!0;else if(i===`--max-redirs`)r++;else if(!i.startsWith(`--max-redirs=`))if(i===`-w`||i===`--write-out`)t.writeOut=e[++r];else if(i.startsWith(`--write-out=`))t.writeOut=i.slice(12);else if(i===`-v`||i===`--verbose`)t.verbose=!0;else{if(i.startsWith(`--`)&&i!==`--`)return D(`curl`,i);if(i.startsWith(`-`)&&i!==`-`)for(let e of i.slice(1))switch(e){case`s`:t.silent=!0;break;case`S`:t.showError=!0;break;case`f`:t.failSilently=!0;break;case`L`:t.followRedirects=!0;break;case`I`:t.headOnly=!0,t.method=`HEAD`;break;case`i`:t.includeHeaders=!0;break;case`O`:t.useRemoteName=!0;break;case`v`:t.verbose=!0;break;default:return D(`curl`,`-${e}`)}else i.startsWith(`-`)||(t.url=i)}}return n&&t.method===`GET`&&(t.method=`POST`),t}var DS=S(()=>{Gv(),O(),CS()});function OS(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`\r
776
- `)}function kS(e){try{return new URL(e).pathname.split(`/`).pop()||`index.html`}catch{return`index.html`}}function AS(e,t){let n=e;return n=n.replace(/%\{http_code\}/g,String(t.status)),n=n.replace(/%\{content_type\}/g,t.headers[`content-type`]||``),n=n.replace(/%\{url_effective\}/g,t.url),n=n.replace(/%\{size_download\}/g,String(t.bodyLength)),n=n.replace(/\\n/g,`
777
- `),n}var jS=S(()=>{}),MS={};C(MS,{curlCommand:()=>LS});async function NS(e,t){if(e.uploadFile){let n=t.fs.resolvePath(t.cwd,e.uploadFile);return{body:await t.fs.readFile(n)}}if(e.formFields.length>0){let n=new Map;for(let r of e.formFields)if(r.value.startsWith(`@`)||r.value.startsWith(`<`)){let e=t.fs.resolvePath(t.cwd,r.value.slice(1));try{let i=await t.fs.readFile(e);n.set(r.value.slice(1),i)}catch{n.set(r.value.slice(1),``)}}let{body:r,boundary:i}=SS(e.formFields,n);return{body:r,contentType:`multipart/form-data; boundary=${i}`}}return e.data===void 0?{}:{body:e.data}}function PS(e,t){let n=new Wv(e.headers);if(e.user){let t=Buffer.from(e.user).toString(`base64`);n.set(`Authorization`,`Basic ${t}`)}return t&&!n.has(`Content-Type`)&&n.set(`Content-Type`,t),n}async function FS(e,t,n){if(!e.cookieJar)return;let r=t[`set-cookie`];if(!r)return;let i=n.fs.resolvePath(n.cwd,e.cookieJar);await n.fs.writeFile(i,r)}function IS(e,t,n){let r=``;if(e.verbose){r+=`> ${e.method} ${n}
775
+ `),{body:r.join(``),boundary:n}}var kS=S(()=>{}),AS,jS=S(()=>{AS={name:`curl`,summary:`transfer a URL`,usage:`curl [OPTIONS] URL`,options:[`-X, --request METHOD HTTP method (GET, POST, PUT, DELETE, etc.)`,`-H, --header HEADER Add header (can be used multiple times)`,`-d, --data DATA HTTP POST data`,` --data-raw DATA HTTP POST data (no @ interpretation)`,` --data-binary DATA HTTP POST binary data`,` --data-urlencode DATA URL-encode and POST data`,`-F, --form NAME=VALUE Multipart form data`,`-u, --user USER:PASS HTTP authentication`,`-A, --user-agent STR Set User-Agent header`,`-e, --referer URL Set Referer header`,`-b, --cookie DATA Send cookies (name=value or @file)`,`-c, --cookie-jar FILE Save cookies to file`,`-T, --upload-file FILE Upload file (PUT)`,`-o, --output FILE Write output to file`,`-O, --remote-name Write to file named from URL`,`-I, --head Show headers only (HEAD request)`,`-i, --include Include response headers in output`,`-s, --silent Silent mode (no progress)`,`-S, --show-error Show errors even when silent`,`-f, --fail Fail silently on HTTP errors (no output)`,`-L, --location Follow redirects (default)`,` --max-redirs NUM Maximum redirects (default: 20)`,`-m, --max-time SECS Maximum time for request`,` --connect-timeout SECS Connection timeout`,`-w, --write-out FMT Output format after completion`,`-v, --verbose Verbose output`,` --help Display this help and exit`,``,`Note: Network access must be configured via BashEnv network option.`,` curl is not available by default for security reasons.`]}});function MS(e){let t={method:`GET`,headers:new Wv,dataBinary:!1,formFields:[],useRemoteName:!1,headOnly:!1,includeHeaders:!1,silent:!1,showError:!1,failSilently:!1,followRedirects:!0,verbose:!1},n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(i===`-X`||i===`--request`)t.method=e[++r]??`GET`;else if(i.startsWith(`-X`))t.method=i.slice(2);else if(i.startsWith(`--request=`))t.method=i.slice(10);else if(i===`-H`||i===`--header`){let n=e[++r];if(n){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();t.headers.append(r,i)}}}else if(i.startsWith(`--header=`)){let e=i.slice(9),n=e.indexOf(`:`);if(n>0){let r=e.slice(0,n).trim(),i=e.slice(n+1).trim();t.headers.append(r,i)}}else if(i===`-d`||i===`--data`||i===`--data-raw`)t.data=e[++r]??``,n=!0;else if(i.startsWith(`-d`))t.data=i.slice(2),n=!0;else if(i.startsWith(`--data=`))t.data=i.slice(7),n=!0;else if(i.startsWith(`--data-raw=`))t.data=i.slice(11),n=!0;else if(i===`--data-binary`)t.data=e[++r]??``,t.dataBinary=!0,n=!0;else if(i.startsWith(`--data-binary=`))t.data=i.slice(14),t.dataBinary=!0,n=!0;else if(i===`--data-urlencode`){let i=e[++r]??``;t.data=(t.data?`${t.data}&`:``)+ES(i),n=!0}else if(i.startsWith(`--data-urlencode=`)){let e=i.slice(17);t.data=(t.data?`${t.data}&`:``)+ES(e),n=!0}else if(i===`-F`||i===`--form`){let i=DS(e[++r]??``);i&&t.formFields.push(i),n=!0}else if(i.startsWith(`--form=`)){let e=DS(i.slice(7));e&&t.formFields.push(e),n=!0}else if(i===`-u`||i===`--user`)t.user=e[++r];else if(i.startsWith(`-u`))t.user=i.slice(2);else if(i.startsWith(`--user=`))t.user=i.slice(7);else if(i===`-A`||i===`--user-agent`)t.headers.set(`User-Agent`,e[++r]??``);else if(i.startsWith(`-A`))t.headers.set(`User-Agent`,i.slice(2));else if(i.startsWith(`--user-agent=`))t.headers.set(`User-Agent`,i.slice(13));else if(i===`-e`||i===`--referer`)t.headers.set(`Referer`,e[++r]??``);else if(i.startsWith(`-e`))t.headers.set(`Referer`,i.slice(2));else if(i.startsWith(`--referer=`))t.headers.set(`Referer`,i.slice(10));else if(i===`-b`||i===`--cookie`)t.headers.set(`Cookie`,e[++r]??``);else if(i.startsWith(`-b`))t.headers.set(`Cookie`,i.slice(2));else if(i.startsWith(`--cookie=`))t.headers.set(`Cookie`,i.slice(9));else if(i===`-c`||i===`--cookie-jar`)t.cookieJar=e[++r];else if(i.startsWith(`--cookie-jar=`))t.cookieJar=i.slice(13);else if(i===`-T`||i===`--upload-file`)t.uploadFile=e[++r],t.method===`GET`&&(t.method=`PUT`);else if(i.startsWith(`--upload-file=`))t.uploadFile=i.slice(14),t.method===`GET`&&(t.method=`PUT`);else if(i===`-m`||i===`--max-time`){let n=parseFloat(e[++r]??`0`);!Number.isNaN(n)&&n>0&&(t.timeoutMs=n*1e3)}else if(i.startsWith(`--max-time=`)){let e=parseFloat(i.slice(11));!Number.isNaN(e)&&e>0&&(t.timeoutMs=e*1e3)}else if(i===`--connect-timeout`){let n=parseFloat(e[++r]??`0`);!Number.isNaN(n)&&n>0&&t.timeoutMs===void 0&&(t.timeoutMs=n*1e3)}else if(i.startsWith(`--connect-timeout=`)){let e=parseFloat(i.slice(18));!Number.isNaN(e)&&e>0&&t.timeoutMs===void 0&&(t.timeoutMs=e*1e3)}else if(i===`-o`||i===`--output`)t.outputFile=e[++r];else if(i.startsWith(`--output=`))t.outputFile=i.slice(9);else if(i===`-O`||i===`--remote-name`)t.useRemoteName=!0;else if(i===`-I`||i===`--head`)t.headOnly=!0,t.method=`HEAD`;else if(i===`-i`||i===`--include`)t.includeHeaders=!0;else if(i===`-s`||i===`--silent`)t.silent=!0;else if(i===`-S`||i===`--show-error`)t.showError=!0;else if(i===`-f`||i===`--fail`)t.failSilently=!0;else if(i===`-L`||i===`--location`)t.followRedirects=!0;else if(i===`--max-redirs`)r++;else if(!i.startsWith(`--max-redirs=`))if(i===`-w`||i===`--write-out`)t.writeOut=e[++r];else if(i.startsWith(`--write-out=`))t.writeOut=i.slice(12);else if(i===`-v`||i===`--verbose`)t.verbose=!0;else{if(i.startsWith(`--`)&&i!==`--`)return D(`curl`,i);if(i.startsWith(`-`)&&i!==`-`)for(let e of i.slice(1))switch(e){case`s`:t.silent=!0;break;case`S`:t.showError=!0;break;case`f`:t.failSilently=!0;break;case`L`:t.followRedirects=!0;break;case`I`:t.headOnly=!0,t.method=`HEAD`;break;case`i`:t.includeHeaders=!0;break;case`O`:t.useRemoteName=!0;break;case`v`:t.verbose=!0;break;default:return D(`curl`,`-${e}`)}else i.startsWith(`-`)||(t.url=i)}}return n&&t.method===`GET`&&(t.method=`POST`),t}var NS=S(()=>{Gv(),O(),kS()});function PS(e){return Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`\r
776
+ `)}function FS(e){try{return new URL(e).pathname.split(`/`).pop()||`index.html`}catch{return`index.html`}}function IS(e,t){let n=e;return n=n.replace(/%\{http_code\}/g,String(t.status)),n=n.replace(/%\{content_type\}/g,t.headers[`content-type`]||``),n=n.replace(/%\{url_effective\}/g,t.url),n=n.replace(/%\{size_download\}/g,String(t.bodyLength)),n=n.replace(/\\n/g,`
777
+ `),n}var LS=S(()=>{}),RS={};C(RS,{curlCommand:()=>WS});async function zS(e,t){if(e.uploadFile){let n=t.fs.resolvePath(t.cwd,e.uploadFile);return{body:await t.fs.readFile(n)}}if(e.formFields.length>0){let n=new Map;for(let r of e.formFields)if(r.value.startsWith(`@`)||r.value.startsWith(`<`)){let e=t.fs.resolvePath(t.cwd,r.value.slice(1));try{let i=await t.fs.readFile(e);n.set(r.value.slice(1),i)}catch{n.set(r.value.slice(1),``)}}let{body:r,boundary:i}=OS(e.formFields,n);return{body:r,contentType:`multipart/form-data; boundary=${i}`}}return e.data===void 0?{}:{body:e.data}}function BS(e,t){let n=new Wv(e.headers);if(e.user){let t=Buffer.from(e.user).toString(`base64`);n.set(`Authorization`,`Basic ${t}`)}return t&&!n.has(`Content-Type`)&&n.set(`Content-Type`,t),n}async function VS(e,t,n){if(!e.cookieJar)return;let r=t[`set-cookie`];if(!r)return;let i=n.fs.resolvePath(n.cwd,e.cookieJar);await n.fs.writeFile(i,r)}function HS(e){return xS(e,`binary`)}function US(e,t,n){let r=``;if(e.verbose){r+=`> ${e.method} ${n}
778
778
  `;for(let[t,n]of e.headers)r+=`> ${t}: ${n}
779
779
  `;r+=`>
780
780
  `,r+=`< HTTP/1.1 ${t.status} ${t.statusText}
781
781
  `;for(let[e,n]of Object.entries(t.headers))r+=`< ${e}: ${n}
782
782
  `;r+=`<
783
783
  `}return e.includeHeaders&&!e.verbose&&(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
784
- `,r+=OS(t.headers),r+=`\r
784
+ `,r+=PS(t.headers),r+=`\r
785
785
  \r
786
786
  `),e.headOnly?e.includeHeaders||e.verbose||(r+=`HTTP/1.1 ${t.status} ${t.statusText}\r
787
- `,r+=OS(t.headers),r+=`\r
788
- `):r+=t.body,e.writeOut&&(r+=AS(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.length})),r}var LS,RS=S(()=>{Gr(),Gv(),O(),CS(),TS(),DS(),jS(),LS={name:`curl`,async execute(e,t){if(E(e))return T(wS);let n=ES(e);if(`exitCode`in n)return n;let r=n;if(!r.url)return{stdout:``,stderr:`curl: no URL specified
787
+ `,r+=PS(t.headers),r+=`\r
788
+ `):r+=HS(t.body),e.writeOut&&(r+=IS(e.writeOut,{status:t.status,headers:t.headers,url:t.url,bodyLength:t.body.byteLength})),r}var WS,GS=S(()=>{TS(),Gr(),Gv(),O(),kS(),jS(),NS(),LS(),WS={name:`curl`,async execute(e,t){if(E(e))return T(AS);let n=MS(e);if(`exitCode`in n)return n;let r=n;if(!r.url)return{stdout:``,stderr:`curl: no URL specified
789
789
  `,exitCode:2};if(!t.fetch)return{stdout:``,stderr:`curl: internal error: fetch not available
790
- `,exitCode:1};let i=r.url;i.match(/^https?:\/\//)||(i=`https://${i}`);try{let{body:e,contentType:n}=await NS(r,t),a=PS(r,n),o=await t.fetch(i,{method:r.method,headers:a,body:e,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await FS(r,o.headers,t),r.failSilently&&o.status>=400)return{stdout:``,stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${o.status}
791
- `:``,exitCode:22};let s=IS(r,o,i);if(r.outputFile||r.useRemoteName){let e=r.outputFile||kS(i),n=t.fs.resolvePath(t.cwd,e);await t.fs.writeFile(n,r.headOnly?``:o.body),r.verbose||(s=``),r.writeOut&&(s=AS(r.writeOut,{status:o.status,headers:o.headers,url:o.url,bodyLength:o.body.length}))}return{stdout:s,stderr:``,exitCode:0}}catch(e){let t=Wr(e),n=1;return t.includes(`Network access denied`)?n=7:t.includes(`HTTP method`)&&t.includes(`not allowed`)?n=3:t.includes(`Redirect target not in allow-list`)||t.includes(`Too many redirects`)?n=47:t.includes(`aborted`)&&(n=28),{stdout:``,stderr:!r.silent||r.showError?`curl: (${n}) ${t}
792
- `:``,exitCode:n}}}}});function zS(e){let{pid:t,ppid:n,uid:r,gid:i}=e;return`Name: bash
790
+ `,exitCode:1};let i=r.url;i.match(/^https?:\/\//)||(i=`https://${i}`);try{let{body:e,contentType:n}=await zS(r,t),a=BS(r,n),o=await t.fetch(i,{method:r.method,headers:a,body:e,followRedirects:r.followRedirects,timeoutMs:r.timeoutMs});if(await VS(r,o.headers,t),r.failSilently&&o.status>=400)return{stdout:``,stderr:r.showError||!r.silent?`curl: (22) The requested URL returned error: ${o.status}
791
+ `:``,exitCode:22};let s=US(r,o,i);if(r.outputFile||r.useRemoteName){let e=r.outputFile||FS(i),n=t.fs.resolvePath(t.cwd,e);await t.fs.writeFile(n,r.headOnly?``:o.body),r.verbose||(s=``),r.writeOut&&(s=IS(r.writeOut,{status:o.status,headers:o.headers,url:o.url,bodyLength:o.body.byteLength}))}return{stdout:s,stderr:``,exitCode:0}}catch(e){let t=Wr(e),n=1;return t.includes(`Network access denied`)?n=7:t.includes(`HTTP method`)&&t.includes(`not allowed`)?n=3:t.includes(`Redirect target not in allow-list`)||t.includes(`Too many redirects`)?n=47:t.includes(`aborted`)&&(n=28),{stdout:``,stderr:!r.silent||r.showError?`curl: (${n}) ${t}
792
+ `:``,exitCode:n}}}}});function KS(e){let{pid:t,ppid:n,uid:r,gid:i}=e;return`Name: bash
793
793
  State: R (running)
794
794
  Pid: ${t}
795
795
  PPid: ${n}
796
796
  Uid: ${r} ${r} ${r} ${r}
797
797
  Gid: ${i} ${i} ${i} ${i}
798
- `}var BS,VS,HS=S(()=>{BS=`5.1.0(1)-release`,VS=`Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT`});function US(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let n=e.slice(t[0].length);if(n===``||n===`+`)return!0;if(n[0]===`[`){let e=0,t=0;for(;t<n.length;t++)if(n[t]===`[`)e++;else if(n[t]===`]`&&(e--,e===0))break;if(e!==0||t>=n.length)return!1;let r=n.slice(t+1);return r===``||r===`+`}return!1}function WS(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`[`)t++;else if(r===`]`)t--;else{if(t===0&&r===`=`)return n;if(t===0&&r===`+`&&e[n+1]===`=`)return n+1}}return-1}function GS(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function KS(e){return e===` `||e===` `||e===`
799
- `||e===`;`||e===`&`||e===`|`||e===`(`||e===`)`||e===`<`||e===`>`}var G,qS,JS,YS,XS,ZS,QS,$S=S(()=>{(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(G||={}),qS=class extends Error{line;column;constructor(e,t,n){super(`line ${t}: ${e}`),this.line=t,this.column=n,this.name=`LexerError`}},JS=new Map([[`if`,G.IF],[`then`,G.THEN],[`else`,G.ELSE],[`elif`,G.ELIF],[`fi`,G.FI],[`for`,G.FOR],[`while`,G.WHILE],[`until`,G.UNTIL],[`do`,G.DO],[`done`,G.DONE],[`case`,G.CASE],[`esac`,G.ESAC],[`in`,G.IN],[`function`,G.FUNCTION],[`select`,G.SELECT],[`time`,G.TIME],[`coproc`,G.COPROC]]),YS=[[`;`,`;`,`&`,G.SEMI_SEMI_AND],[`<`,`<`,`<`,G.TLESS],[`&`,`>`,`>`,G.AND_DGREAT]],XS=[[`[`,`[`,G.DBRACK_START],[`]`,`]`,G.DBRACK_END],[`(`,`(`,G.DPAREN_START],[`)`,`)`,G.DPAREN_END],[`&`,`&`,G.AND_AND],[`|`,`|`,G.OR_OR],[`;`,`;`,G.DSEMI],[`;`,`&`,G.SEMI_AND],[`|`,`&`,G.PIPE_AMP],[`>`,`>`,G.DGREAT],[`<`,`&`,G.LESSAND],[`>`,`&`,G.GREATAND],[`<`,`>`,G.LESSGREAT],[`>`,`|`,G.CLOBBER],[`&`,`>`,G.AND_GREAT]],ZS=new Map([[`|`,G.PIPE],[`&`,G.AMP],[`;`,G.SEMICOLON],[`(`,G.LPAREN],[`)`,G.RPAREN],[`<`,G.LESS],[`>`,G.GREAT]]),QS=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];dparenDepth=0;maxHeredocSize;constructor(e,t){this.input=e,this.maxHeredocSize=t?.maxHeredocSize??10485760}tokenize(){let e=this.input.length,t=this.tokens,n=this.pendingHeredocs;for(;this.pos<e;){if(n.length>0&&t.length>0&&t[t.length-1].type===G.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=e)break;let r=this.nextToken();r&&t.push(r)}return t.push({type:G.EOF,value:``,start:this.pos,end:this.pos,line:this.line,column:this.column}),t}skipWhitespace(){let e=this.input,t=e.length,n=this.pos,r=this.column,i=this.line;for(;n<t;){let t=e[n];if(t===` `||t===` `)n++,r++;else if(t===`\\`&&e[n+1]===`
798
+ `}var qS,JS,YS=S(()=>{qS=`5.1.0(1)-release`,JS=`Linux version 5.15.0-generic (just-bash) #1 SMP PREEMPT`});function XS(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return!1;let n=e.slice(t[0].length);if(n===``||n===`+`)return!0;if(n[0]===`[`){let e=0,t=0;for(;t<n.length;t++)if(n[t]===`[`)e++;else if(n[t]===`]`&&(e--,e===0))break;if(e!==0||t>=n.length)return!1;let r=n.slice(t+1);return r===``||r===`+`}return!1}function ZS(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];if(r===`[`)t++;else if(r===`]`)t--;else{if(t===0&&r===`=`)return n;if(t===0&&r===`+`&&e[n+1]===`=`)return n+1}}return-1}function QS(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function $S(e){return e===` `||e===` `||e===`
799
+ `||e===`;`||e===`&`||e===`|`||e===`(`||e===`)`||e===`<`||e===`>`}var G,eC,tC,nC,rC,iC,aC,oC=S(()=>{(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(G||={}),eC=class extends Error{line;column;constructor(e,t,n){super(`line ${t}: ${e}`),this.line=t,this.column=n,this.name=`LexerError`}},tC=new Map([[`if`,G.IF],[`then`,G.THEN],[`else`,G.ELSE],[`elif`,G.ELIF],[`fi`,G.FI],[`for`,G.FOR],[`while`,G.WHILE],[`until`,G.UNTIL],[`do`,G.DO],[`done`,G.DONE],[`case`,G.CASE],[`esac`,G.ESAC],[`in`,G.IN],[`function`,G.FUNCTION],[`select`,G.SELECT],[`time`,G.TIME],[`coproc`,G.COPROC]]),nC=[[`;`,`;`,`&`,G.SEMI_SEMI_AND],[`<`,`<`,`<`,G.TLESS],[`&`,`>`,`>`,G.AND_DGREAT]],rC=[[`[`,`[`,G.DBRACK_START],[`]`,`]`,G.DBRACK_END],[`(`,`(`,G.DPAREN_START],[`)`,`)`,G.DPAREN_END],[`&`,`&`,G.AND_AND],[`|`,`|`,G.OR_OR],[`;`,`;`,G.DSEMI],[`;`,`&`,G.SEMI_AND],[`|`,`&`,G.PIPE_AMP],[`>`,`>`,G.DGREAT],[`<`,`&`,G.LESSAND],[`>`,`&`,G.GREATAND],[`<`,`>`,G.LESSGREAT],[`>`,`|`,G.CLOBBER],[`&`,`>`,G.AND_GREAT]],iC=new Map([[`|`,G.PIPE],[`&`,G.AMP],[`;`,G.SEMICOLON],[`(`,G.LPAREN],[`)`,G.RPAREN],[`<`,G.LESS],[`>`,G.GREAT]]),aC=class{input;pos=0;line=1;column=1;tokens=[];pendingHeredocs=[];dparenDepth=0;maxHeredocSize;constructor(e,t){this.input=e,this.maxHeredocSize=t?.maxHeredocSize??10485760}tokenize(){let e=this.input.length,t=this.tokens,n=this.pendingHeredocs;for(;this.pos<e;){if(n.length>0&&t.length>0&&t[t.length-1].type===G.NEWLINE){this.readHeredocContent();continue}if(this.skipWhitespace(),this.pos>=e)break;let r=this.nextToken();r&&t.push(r)}return t.push({type:G.EOF,value:``,start:this.pos,end:this.pos,line:this.line,column:this.column}),t}skipWhitespace(){let e=this.input,t=e.length,n=this.pos,r=this.column,i=this.line;for(;n<t;){let t=e[n];if(t===` `||t===` `)n++,r++;else if(t===`\\`&&e[n+1]===`
800
800
  `)n+=2,i++,r=1;else break}this.pos=n,this.column=r,this.line=i}nextToken(){let e=this.input,t=this.pos,n=this.line,r=this.column,i=e[t],a=e[t+1],o=e[t+2];if(i===`#`&&this.dparenDepth===0)return this.readComment(t,n,r);if(i===`
801
801
  `)return this.pos=t+1,this.line++,this.column=1,{type:G.NEWLINE,value:`
802
- `,start:t,end:t+1,line:n,column:r};if(i===`<`&&a===`<`&&o===`-`)return this.pos=t+3,this.column=r+3,this.registerHeredocFromLookahead(!0),this.makeToken(G.DLESSDASH,`<<-`,t,n,r);for(let[e,s,c,l]of YS)if(i===e&&a===s&&o===c)return this.pos=t+3,this.column=r+3,this.makeToken(l,e+s+c,t,n,r);if(i===`<`&&a===`<`)return this.pos=t+2,this.column=r+2,this.registerHeredocFromLookahead(!1),this.makeToken(G.DLESS,`<<`,t,n,r);if(i===`(`&&a===`(`)return this.dparenDepth>0?(this.pos=t+1,this.column=r+1,this.dparenDepth++,this.makeToken(G.LPAREN,`(`,t,n,r)):this.looksLikeNestedSubshells(t+2)||this.dparenClosesWithSpacedParens(t+2)?(this.pos=t+1,this.column=r+1,this.makeToken(G.LPAREN,`(`,t,n,r)):(this.pos=t+2,this.column=r+2,this.dparenDepth=1,this.makeToken(G.DPAREN_START,`((`,t,n,r));if(i===`)`&&a===`)`)return this.dparenDepth===1?(this.pos=t+2,this.column=r+2,this.dparenDepth=0,this.makeToken(G.DPAREN_END,`))`,t,n,r)):this.dparenDepth>1?(this.pos=t+1,this.column=r+1,this.dparenDepth--,this.makeToken(G.RPAREN,`)`,t,n,r)):(this.pos=t+1,this.column=r+1,this.makeToken(G.RPAREN,`)`,t,n,r));for(let[o,s,c]of XS)if(!(o===`(`&&s===`(`||o===`)`&&s===`)`)&&!(this.dparenDepth>0&&o===`;`&&(c===G.DSEMI||c===G.SEMI_AND||c===G.SEMI_SEMI_AND))&&i===o&&a===s){if(c===G.DBRACK_START||c===G.DBRACK_END){let n=e[t+2];if(n!==void 0&&n!==` `&&n!==` `&&n!==`
803
- `&&n!==`;`&&n!==`&`&&n!==`|`&&n!==`(`&&n!==`)`&&n!==`<`&&n!==`>`)break}return this.pos=t+2,this.column=r+2,this.makeToken(c,o+s,t,n,r)}if(i===`(`&&this.dparenDepth>0)return this.pos=t+1,this.column=r+1,this.dparenDepth++,this.makeToken(G.LPAREN,`(`,t,n,r);if(i===`)`&&this.dparenDepth>1)return this.pos=t+1,this.column=r+1,this.dparenDepth--,this.makeToken(G.RPAREN,`)`,t,n,r);let s=ZS.get(i);if(s!==void 0)return this.pos=t+1,this.column=r+1,this.makeToken(s,i,t,n,r);if(i===`{`){let e=this.scanFdVariable(t);return e===null?a===`}`?(this.pos=t+2,this.column=r+2,{type:G.WORD,value:`{}`,start:t,end:t+2,line:n,column:r,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(t)===null&&this.scanLiteralBraceWord(t)===null?a!==void 0&&a!==` `&&a!==` `&&a!==`
802
+ `,start:t,end:t+1,line:n,column:r};if(i===`<`&&a===`<`&&o===`-`)return this.pos=t+3,this.column=r+3,this.registerHeredocFromLookahead(!0),this.makeToken(G.DLESSDASH,`<<-`,t,n,r);for(let[e,s,c,l]of nC)if(i===e&&a===s&&o===c)return this.pos=t+3,this.column=r+3,this.makeToken(l,e+s+c,t,n,r);if(i===`<`&&a===`<`)return this.pos=t+2,this.column=r+2,this.registerHeredocFromLookahead(!1),this.makeToken(G.DLESS,`<<`,t,n,r);if(i===`(`&&a===`(`)return this.dparenDepth>0?(this.pos=t+1,this.column=r+1,this.dparenDepth++,this.makeToken(G.LPAREN,`(`,t,n,r)):this.looksLikeNestedSubshells(t+2)||this.dparenClosesWithSpacedParens(t+2)?(this.pos=t+1,this.column=r+1,this.makeToken(G.LPAREN,`(`,t,n,r)):(this.pos=t+2,this.column=r+2,this.dparenDepth=1,this.makeToken(G.DPAREN_START,`((`,t,n,r));if(i===`)`&&a===`)`)return this.dparenDepth===1?(this.pos=t+2,this.column=r+2,this.dparenDepth=0,this.makeToken(G.DPAREN_END,`))`,t,n,r)):this.dparenDepth>1?(this.pos=t+1,this.column=r+1,this.dparenDepth--,this.makeToken(G.RPAREN,`)`,t,n,r)):(this.pos=t+1,this.column=r+1,this.makeToken(G.RPAREN,`)`,t,n,r));for(let[o,s,c]of rC)if(!(o===`(`&&s===`(`||o===`)`&&s===`)`)&&!(this.dparenDepth>0&&o===`;`&&(c===G.DSEMI||c===G.SEMI_AND||c===G.SEMI_SEMI_AND))&&i===o&&a===s){if(c===G.DBRACK_START||c===G.DBRACK_END){let n=e[t+2];if(n!==void 0&&n!==` `&&n!==` `&&n!==`
803
+ `&&n!==`;`&&n!==`&`&&n!==`|`&&n!==`(`&&n!==`)`&&n!==`<`&&n!==`>`)break}return this.pos=t+2,this.column=r+2,this.makeToken(c,o+s,t,n,r)}if(i===`(`&&this.dparenDepth>0)return this.pos=t+1,this.column=r+1,this.dparenDepth++,this.makeToken(G.LPAREN,`(`,t,n,r);if(i===`)`&&this.dparenDepth>1)return this.pos=t+1,this.column=r+1,this.dparenDepth--,this.makeToken(G.RPAREN,`)`,t,n,r);let s=iC.get(i);if(s!==void 0)return this.pos=t+1,this.column=r+1,this.makeToken(s,i,t,n,r);if(i===`{`){let e=this.scanFdVariable(t);return e===null?a===`}`?(this.pos=t+2,this.column=r+2,{type:G.WORD,value:`{}`,start:t,end:t+2,line:n,column:r,quoted:!1,singleQuoted:!1}):this.scanBraceExpansion(t)===null&&this.scanLiteralBraceWord(t)===null?a!==void 0&&a!==` `&&a!==` `&&a!==`
804
804
  `?this.readWord(t,n,r):(this.pos=t+1,this.column=r+1,this.makeToken(G.LBRACE,`{`,t,n,r)):this.readWordWithBraceExpansion(t,n,r):(this.pos=e.end,this.column=r+(e.end-t),{type:G.FD_VARIABLE,value:e.varname,start:t,end:e.end,line:n,column:r})}return i===`}`?this.isWordCharFollowing(t+1)?this.readWord(t,n,r):(this.pos=t+1,this.column=r+1,this.makeToken(G.RBRACE,`}`,t,n,r)):i===`!`?a===`=`?(this.pos=t+2,this.column=r+2,this.makeToken(G.WORD,`!=`,t,n,r)):(this.pos=t+1,this.column=r+1,this.makeToken(G.BANG,`!`,t,n,r)):this.readWord(t,n,r)}looksLikeNestedSubshells(e){let t=this.input,n=t.length,r=e;for(;r<n&&(t[r]===` `||t[r]===` `);)r++;if(r>=n)return!1;let i=t[r];if(i===`(`)return this.looksLikeNestedSubshells(r+1);let a=/[a-zA-Z_]/.test(i),o=i===`!`||i===`[`;if(!a&&!o)return!1;let s=r;for(;s<n&&/[a-zA-Z0-9_\-.]/.test(t[s]);)s++;if(s===r)return o;let c=s;for(;c<n&&(t[c]===` `||t[c]===` `);)c++;if(c>=n)return!1;let l=t[c];if(l===`=`&&t[c+1]!==`=`||l===`
805
805
  `||s===c&&/[+\-*/%<>&|^!~?:]/.test(l)&&l!==`-`||l===`)`&&t[c+1]===`)`)return!1;if(c>s&&(l===`-`||l===`"`||l===`'`||l===`$`||/[a-zA-Z_/.]/.test(l))){let e=c;for(;e<n&&t[e]!==`
806
806
  `;){if(t[e]===`)`)return!0;e++}return!1}if(l===`)`){let e=c+1;for(;e<n&&(t[e]===` `||t[e]===` `);)e++;if(t[e]===`|`&&t[e+1]===`|`||t[e]===`&`&&t[e+1]===`&`||t[e]===`;`||t[e]===`|`&&t[e+1]!==`|`)return!0}return!1}makeToken(e,t,n,r,i){return{type:e,value:t,start:n,end:this.pos,line:r,column:i}}readComment(e,t,n){let r=this.input,i=r.length,a=this.pos;for(;a<i&&r[a]!==`
807
807
  `;)a++;let o=r.slice(e,a);return this.pos=a,this.column=n+(a-e),{type:G.COMMENT,value:o,start:e,end:a,line:t,column:n}}readWord(e,t,n){let r=this.input,i=r.length,a=this.pos,o=a;for(;a<i;){let e=r[a];if(e===` `||e===` `||e===`
808
808
  `||e===`;`||e===`&`||e===`|`||e===`(`||e===`)`||e===`<`||e===`>`||e===`'`||e===`"`||e===`\\`||e===`$`||e==="`"||e===`{`||e===`}`||e===`~`||e===`*`||e===`?`||e===`[`)break;a++}if(a>o){let s=r[a];if(!(s===`(`&&a>o&&`@*+?!`.includes(r[a-1]))&&(a>=i||s===` `||s===` `||s===`
809
- `||s===`;`||s===`&`||s===`|`||s===`(`||s===`)`||s===`<`||s===`>`)){let i=r.slice(o,a);this.pos=a,this.column=n+(a-o);let s=JS.get(i);if(s!==void 0)return{type:s,value:i,start:e,end:a,line:t,column:n};let c=WS(i);return c>0&&US(i.slice(0,c))?{type:G.ASSIGNMENT_WORD,value:i,start:e,end:a,line:t,column:n}:/^[0-9]+$/.test(i)?{type:G.NUMBER,value:i,start:e,end:a,line:t,column:n}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?{type:G.NAME,value:i,start:e,end:a,line:t,column:n,quoted:!1,singleQuoted:!1}:{type:G.WORD,value:i,start:e,end:a,line:t,column:n,quoted:!1,singleQuoted:!1}}}a=this.pos;let s=this.column,c=this.line,l=``,u=!1,d=!1,f=!1,p=!1,m=r[a]===`"`||r[a]===`'`,h=!1,g=0;for(;a<i;){let e=r[a];if(!f&&!p){if(e===`(`&&l.length>0&&`@*+?!`.includes(l[l.length-1])){let e=this.scanExtglobPattern(a);if(e!==null){l+=e.content,a=e.end,s+=e.content.length;continue}}if(e===`[`&&g===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(l)){let t=a+1<i?r[a+1]:``;if(t===`^`||t===`!`){l+=e,a++,s++;continue}g=1,l+=e,a++,s++;continue}}else if(e===`[`&&g>0){l.length>0&&l[l.length-1]!==`\\`&&g++,l+=e,a++,s++;continue}else if(e===`]`&&g>0){l.length>0&&l[l.length-1]!==`\\`&&g--,l+=e,a++,s++;continue}if(g>0){if(e===`
809
+ `||s===`;`||s===`&`||s===`|`||s===`(`||s===`)`||s===`<`||s===`>`)){let i=r.slice(o,a);this.pos=a,this.column=n+(a-o);let s=tC.get(i);if(s!==void 0)return{type:s,value:i,start:e,end:a,line:t,column:n};let c=ZS(i);return c>0&&XS(i.slice(0,c))?{type:G.ASSIGNMENT_WORD,value:i,start:e,end:a,line:t,column:n}:/^[0-9]+$/.test(i)?{type:G.NUMBER,value:i,start:e,end:a,line:t,column:n}:/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(i)?{type:G.NAME,value:i,start:e,end:a,line:t,column:n,quoted:!1,singleQuoted:!1}:{type:G.WORD,value:i,start:e,end:a,line:t,column:n,quoted:!1,singleQuoted:!1}}}a=this.pos;let s=this.column,c=this.line,l=``,u=!1,d=!1,f=!1,p=!1,m=r[a]===`"`||r[a]===`'`,h=!1,g=0;for(;a<i;){let e=r[a];if(!f&&!p){if(e===`(`&&l.length>0&&`@*+?!`.includes(l[l.length-1])){let e=this.scanExtglobPattern(a);if(e!==null){l+=e.content,a=e.end,s+=e.content.length;continue}}if(e===`[`&&g===0){if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(l)){let t=a+1<i?r[a+1]:``;if(t===`^`||t===`!`){l+=e,a++,s++;continue}g=1,l+=e,a++,s++;continue}}else if(e===`[`&&g>0){l.length>0&&l[l.length-1]!==`\\`&&g++,l+=e,a++,s++;continue}else if(e===`]`&&g>0){l.length>0&&l[l.length-1]!==`\\`&&g--,l+=e,a++,s++;continue}if(g>0){if(e===`
810
810
  `)break;l+=e,a++,s++;continue}if(e===` `||e===` `||e===`
811
- `||e===`;`||e===`&`||e===`|`||e===`(`||e===`)`||e===`<`||e===`>`)break}if(e===`$`&&a+1<i&&r[a+1]===`'`&&!f&&!p){for(l+=`$'`,a+=2,s+=2;a<i&&r[a]!==`'`;)r[a]===`\\`&&a+1<i?(l+=r[a]+r[a+1],a+=2,s+=2):(l+=r[a],a++,s++);a<i&&(l+=`'`,a++,s++);continue}if(e===`$`&&a+1<i&&r[a+1]===`"`&&!f&&!p){a++,s++,p=!0,u=!0,l===``&&(m=!0),a++,s++;continue}if(e===`'`&&!p){if(f)if(f=!1,!m||h)l+=e;else{let t=a+1<i?r[a+1]:``;t&&!KS(t)&&t!==`'`&&(t===`"`?(h=!0,l+=e,d=!1,u=!1):(h=!0,l+=e))}else f=!0,m&&!h?(d=!0,u=!0):l+=e;a++,s++;continue}if(e===`"`&&!f){if(p)if(p=!1,!m||h)l+=e;else{let t=a+1<i?r[a+1]:``;t&&!KS(t)&&t!==`"`&&(t===`'`?(h=!0,l+=e,d=!1,u=!1):(h=!0,l+=e))}else p=!0,m&&!h?u=!0:l+=e;a++,s++;continue}if(e===`\\`&&!f&&a+1<i){let t=r[a+1];if(t===`
811
+ `||e===`;`||e===`&`||e===`|`||e===`(`||e===`)`||e===`<`||e===`>`)break}if(e===`$`&&a+1<i&&r[a+1]===`'`&&!f&&!p){for(l+=`$'`,a+=2,s+=2;a<i&&r[a]!==`'`;)r[a]===`\\`&&a+1<i?(l+=r[a]+r[a+1],a+=2,s+=2):(l+=r[a],a++,s++);a<i&&(l+=`'`,a++,s++);continue}if(e===`$`&&a+1<i&&r[a+1]===`"`&&!f&&!p){a++,s++,p=!0,u=!0,l===``&&(m=!0),a++,s++;continue}if(e===`'`&&!p){if(f)if(f=!1,!m||h)l+=e;else{let t=a+1<i?r[a+1]:``;t&&!$S(t)&&t!==`'`&&(t===`"`?(h=!0,l+=e,d=!1,u=!1):(h=!0,l+=e))}else f=!0,m&&!h?(d=!0,u=!0):l+=e;a++,s++;continue}if(e===`"`&&!f){if(p)if(p=!1,!m||h)l+=e;else{let t=a+1<i?r[a+1]:``;t&&!$S(t)&&t!==`"`&&(t===`'`?(h=!0,l+=e,d=!1,u=!1):(h=!0,l+=e))}else p=!0,m&&!h?u=!0:l+=e;a++,s++;continue}if(e===`\\`&&!f&&a+1<i){let t=r[a+1];if(t===`
812
812
  `){a+=2,c++,s=1;continue}if(p){if(t===`"`||t===`\\`||t===`$`||t==="`"||t===`
813
813
  `){if(t===`
814
814
  `){a+=2,s=1,c++;continue}l+=e+t,a+=2,s+=2;continue}}else{t===`\\`||t===`"`||t===`'`||t==="`"||t===`*`||t===`?`||t===`[`||t===`]`||t===`(`||t===`)`||t===`$`||t===`-`||t===`.`||t===`^`||t===`+`||t===`{`||t===`}`?l+=e+t:l+=t,a+=2,s+=2;continue}}if(e===`$`&&a+1<i&&r[a+1]===`(`&&!f){l+=e,a++,s++,l+=r[a],a++,s++;let t=1,n=!1,o=!1,u=0,d=!1,f=``,p=r[a]===`(`&&!this.dollarDparenIsSubshell(a);for(;t>0&&a<i;){let e=r[a];if(l+=e,n)e===`'`&&(n=!1);else if(o)e===`\\`&&a+1<i?(l+=r[a+1],a++,s++):e===`"`&&(o=!1);else if(e===`'`)n=!0,f=``;else if(e===`"`)o=!0,f=``;else if(e===`\\`&&a+1<i)l+=r[a+1],a++,s++,f=``;else if(e===`$`&&a+1<i&&r[a+1]===`{`){a++,s++,l+=r[a],a++,s++;let e=1,t=!1,n=!1;for(;e>0&&a<i;){let o=r[a];if(o===`\\`&&a+1<i&&!t){l+=o,a++,s++,l+=r[a],a++,s++;continue}l+=o,t?o===`'`&&(t=!1):n?o===`"`&&(n=!1):o===`'`?t=!0:o===`"`?n=!0:o===`{`?e++:o===`}`&&e--,o===`
@@ -817,11 +817,11 @@ Gid: ${i} ${i} ${i} ${i}
817
817
  `&&(c++,s=0,f=``),a++,s++}continue}if(e===`$`&&a+1<i&&r[a+1]===`[`&&!f){l+=e,a++,s++,l+=r[a],a++,s++;let t=1;for(;t>0&&a<i;){let e=r[a];l+=e,e===`[`?t++:e===`]`?t--:e===`
818
818
  `&&(c++,s=0),a++,s++}continue}if(e===`$`&&a+1<i&&r[a+1]===`{`&&!f){l+=e,a++,s++,l+=r[a],a++,s++;let t=1,n=!1,o=!1,u=c,d=s,f=c,p=s;for(;t>0&&a<i;){let e=r[a];if(e===`\\`&&a+1<i&&r[a+1]===`
819
819
  `){a+=2,c++,s=1;continue}if(e===`\\`&&a+1<i&&!n){l+=e,a++,s++,l+=r[a],a++,s++;continue}l+=e,n?e===`'`&&(n=!1):o?e===`"`&&(o=!1):e===`'`?(n=!0,u=c,d=s):e===`"`?(o=!0,f=c,p=s):e===`{`?t++:e===`}`&&t--,e===`
820
- `&&(c++,s=0),a++,s++}if(n)throw new qS("unexpected EOF while looking for matching `''",u,d);if(o)throw new qS(`unexpected EOF while looking for matching \`"'`,f,p);continue}if(e===`$`&&a+1<i&&!f){let t=r[a+1];if(t===`#`||t===`?`||t===`$`||t===`!`||t===`@`||t===`*`||t===`-`||t>=`0`&&t<=`9`){l+=e+t,a+=2,s+=2;continue}}if(e==="`"&&!f){for(l+=e,a++,s++;a<i&&r[a]!=="`";){let e=r[a];l+=e,e===`\\`&&a+1<i&&(l+=r[a+1],a++,s++),e===`
820
+ `&&(c++,s=0),a++,s++}if(n)throw new eC("unexpected EOF while looking for matching `''",u,d);if(o)throw new eC(`unexpected EOF while looking for matching \`"'`,f,p);continue}if(e===`$`&&a+1<i&&!f){let t=r[a+1];if(t===`#`||t===`?`||t===`$`||t===`!`||t===`@`||t===`*`||t===`-`||t>=`0`&&t<=`9`){l+=e+t,a+=2,s+=2;continue}}if(e==="`"&&!f){for(l+=e,a++,s++;a<i&&r[a]!=="`";){let e=r[a];l+=e,e===`\\`&&a+1<i&&(l+=r[a+1],a++,s++),e===`
821
821
  `&&(c++,s=0),a++,s++}a<i&&(l+=r[a],a++,s++);continue}l+=e,a++,e===`
822
- `?(c++,s=1):s++}if(this.pos=a,this.column=s,this.line=c,h&&m&&(l=r[e]+l,u=!1,d=!1),f||p)throw new qS(`unexpected EOF while looking for matching \`${f?`'`:`"`}'`,t,n);if(!m&&l.length>=2){if(l[0]===`'`&&l[l.length-1]===`'`){let e=l.slice(1,-1);!e.includes(`'`)&&!e.includes(`"`)&&(l=e,u=!0,d=!0)}else if(l[0]===`"`&&l[l.length-1]===`"`){let e=l.slice(1,-1),t=!1;for(let n=0;n<e.length;n++){if(e[n]===`"`){t=!0;break}e[n]===`\\`&&n+1<e.length&&n++}t||(l=e,u=!0,d=!1)}}if(l===``)return{type:G.WORD,value:``,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d};let _=JS.get(l);if(!u&&_!==void 0)return{type:_,value:l,start:e,end:a,line:t,column:n};if(!m){let r=WS(l);if(r>0&&US(l.slice(0,r)))return{type:G.ASSIGNMENT_WORD,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}}return/^[0-9]+$/.test(l)?{type:G.NUMBER,value:l,start:e,end:a,line:t,column:n}:GS(l)?{type:G.NAME,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}:{type:G.WORD,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let e=this.pendingHeredocs.shift();if(!e)break;let t=this.pos,n=this.line,r=this.column,i=``;for(;this.pos<this.input.length;){let t=``;for(;this.pos<this.input.length&&this.input[this.pos]!==`
822
+ `?(c++,s=1):s++}if(this.pos=a,this.column=s,this.line=c,h&&m&&(l=r[e]+l,u=!1,d=!1),f||p)throw new eC(`unexpected EOF while looking for matching \`${f?`'`:`"`}'`,t,n);if(!m&&l.length>=2){if(l[0]===`'`&&l[l.length-1]===`'`){let e=l.slice(1,-1);!e.includes(`'`)&&!e.includes(`"`)&&(l=e,u=!0,d=!0)}else if(l[0]===`"`&&l[l.length-1]===`"`){let e=l.slice(1,-1),t=!1;for(let n=0;n<e.length;n++){if(e[n]===`"`){t=!0;break}e[n]===`\\`&&n+1<e.length&&n++}t||(l=e,u=!0,d=!1)}}if(l===``)return{type:G.WORD,value:``,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d};let _=tC.get(l);if(!u&&_!==void 0)return{type:_,value:l,start:e,end:a,line:t,column:n};if(!m){let r=ZS(l);if(r>0&&XS(l.slice(0,r)))return{type:G.ASSIGNMENT_WORD,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}}return/^[0-9]+$/.test(l)?{type:G.NUMBER,value:l,start:e,end:a,line:t,column:n}:QS(l)?{type:G.NAME,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}:{type:G.WORD,value:l,start:e,end:a,line:t,column:n,quoted:u,singleQuoted:d}}readHeredocContent(){for(;this.pendingHeredocs.length>0;){let e=this.pendingHeredocs.shift();if(!e)break;let t=this.pos,n=this.line,r=this.column,i=``;for(;this.pos<this.input.length;){let t=``;for(;this.pos<this.input.length&&this.input[this.pos]!==`
823
823
  `;)t+=this.input[this.pos],this.pos++,this.column++;if((e.stripTabs?t.replace(/^\t+/,``):t)===e.delimiter){this.pos<this.input.length&&this.input[this.pos]===`
824
- `&&(this.pos++,this.line++,this.column=1);break}if(i+=t,i.length>this.maxHeredocSize)throw new qS(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,n,r);this.pos<this.input.length&&this.input[this.pos]===`
824
+ `&&(this.pos++,this.line++,this.column=1);break}if(i+=t,i.length>this.maxHeredocSize)throw new eC(`Heredoc size limit exceeded (${this.maxHeredocSize} bytes)`,n,r);this.pos<this.input.length&&this.input[this.pos]===`
825
825
  `&&(i+=`
826
826
  `,this.pos++,this.line++,this.column=1)}this.tokens.push({type:G.HEREDOC_CONTENT,value:i,start:t,end:this.pos,line:n,column:r})}}addPendingHeredoc(e,t,n){this.pendingHeredocs.push({delimiter:e,stripTabs:t,quoted:n})}registerHeredocFromLookahead(e){let t=this.pos,n=this.column;for(;this.pos<this.input.length&&(this.input[this.pos]===` `||this.input[this.pos]===` `);)this.pos++,this.column++;let r=``,i=!1;for(;this.pos<this.input.length;){let e=this.input[this.pos];if(/[\s;<>&|()]/.test(e))break;if(e===`'`||e===`"`){i=!0;let t=e;for(this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]!==t;)r+=this.input[this.pos],this.pos++,this.column++;this.pos<this.input.length&&this.input[this.pos]===t&&(this.pos++,this.column++)}else e===`\\`?(i=!0,this.pos++,this.column++,this.pos<this.input.length&&(r+=this.input[this.pos],this.pos++,this.column++)):(r+=e,this.pos++,this.column++)}this.pos=t,this.column=n,r&&this.pendingHeredocs.push({delimiter:r,stripTabs:e,quoted:i})}isWordCharFollowing(e){if(e>=this.input.length)return!1;let t=this.input[e];return!(t===` `||t===` `||t===`
827
827
  `||t===`;`||t===`&`||t===`|`||t===`(`||t===`)`||t===`<`||t===`>`)}readWordWithBraceExpansion(e,t,n){let r=this.input,i=r.length,a=e,o=n;for(;a<i;){let e=r[a];if(e===` `||e===` `||e===`
@@ -833,71 +833,71 @@ Gid: ${i} ${i} ${i} ${i}
833
833
  `&&(s=!0),r++;continue}if(e===`'`){a=!0,r++;continue}if(e===`"`){o=!0,r++;continue}if(e===`\\`){r+=2;continue}if(e===`
834
834
  `&&(s=!0),e===`(`){i++,r++;continue}if(e===`)`){if(i--,i===1){let e=r+1;if(e<n&&t[e]===`)`)return!1;let i=e,a=!1;for(;i<n&&(t[i]===` `||t[i]===` `||t[i]===`
835
835
  `);)a=!0,i++;if(a&&i<n&&t[i]===`)`||s)return!0}if(i===0)return!1;r++;continue}r++}return!1}dparenClosesWithSpacedParens(e){let t=this.input,n=t.length,r=e,i=2,a=!1,o=!1;for(;r<n&&i>0;){let e=t[r];if(a){e===`'`&&(a=!1),r++;continue}if(o){if(e===`\\`){r+=2;continue}e===`"`&&(o=!1),r++;continue}if(e===`'`){a=!0,r++;continue}if(e===`"`){o=!0,r++;continue}if(e===`\\`){r+=2;continue}if(e===`(`){i++,r++;continue}if(e===`)`){if(i--,i===1){let e=r+1;if(e<n&&t[e]===`)`)return!1;let i=e,a=!1;for(;i<n&&(t[i]===` `||t[i]===` `||t[i]===`
836
- `);)a=!0,i++;if(a&&i<n&&t[i]===`)`)return!0}if(i===0)return!1;r++;continue}if(i===1&&(e===`|`&&r+1<n&&t[r+1]===`|`||e===`&`&&r+1<n&&t[r+1]===`&`||e===`|`&&r+1<n&&t[r+1]!==`|`))return!0;r++}return!1}}}),eC,tC,nC,rC,iC,aC,oC,sC,cC=S(()=>{$S(),eC=1e6,tC=1e5,nC=1e6,rC=200,iC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS,G.AND_GREAT,G.AND_DGREAT]),aC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS]),oC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS,G.AND_GREAT,G.AND_DGREAT]),sC=class extends Error{line;column;token;constructor(e,t,n,r=void 0){super(`Parse error at ${t}:${n}: ${e}`),this.line=t,this.column=n,this.token=r,this.name=`ParseException`}}}),K,lC=S(()=>{K={script(e){return{type:`Script`,statements:e}},statement(e,t=[],n=!1,r,i){let a={type:`Statement`,pipelines:e,operators:t,background:n};return r&&(a.deferredError=r),i!==void 0&&(a.sourceText=i),a},pipeline(e,t=!1,n=!1,r=!1,i){return{type:`Pipeline`,commands:e,negated:t,timed:n,timePosix:r,pipeStderr:i}},simpleCommand(e,t=[],n=[],r=[]){return{type:`SimpleCommand`,name:e,args:t,assignments:n,redirections:r}},word(e){return{type:`Word`,parts:e}},literal(e){return{type:`Literal`,value:e}},singleQuoted(e){return{type:`SingleQuoted`,value:e}},doubleQuoted(e){return{type:`DoubleQuoted`,parts:e}},escaped(e){return{type:`Escaped`,value:e}},parameterExpansion(e,t=null){return{type:`ParameterExpansion`,parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:`CommandSubstitution`,body:e,legacy:t}},arithmeticExpansion(e){return{type:`ArithmeticExpansion`,expression:e}},assignment(e,t,n=!1,r=null){return{type:`Assignment`,name:e,value:t,append:n,array:r}},redirection(e,t,n=null,r){let i={type:`Redirection`,fd:n,operator:e,target:t};return r&&(i.fdVariable=r),i},hereDoc(e,t,n=!1,r=!1){return{type:`HereDoc`,delimiter:e,content:t,stripTabs:n,quoted:r}},ifNode(e,t=null,n=[]){return{type:`If`,clauses:e,elseBody:t,redirections:n}},forNode(e,t,n,r=[]){return{type:`For`,variable:e,words:t,body:n,redirections:r}},whileNode(e,t,n=[]){return{type:`While`,condition:e,body:t,redirections:n}},untilNode(e,t,n=[]){return{type:`Until`,condition:e,body:t,redirections:n}},caseNode(e,t,n=[]){return{type:`Case`,word:e,items:t,redirections:n}},caseItem(e,t,n=`;;`){return{type:`CaseItem`,patterns:e,body:t,terminator:n}},subshell(e,t=[]){return{type:`Subshell`,body:e,redirections:t}},group(e,t=[]){return{type:`Group`,body:e,redirections:t}},functionDef(e,t,n=[],r){return{type:`FunctionDef`,name:e,body:t,redirections:n,sourceFile:r}},conditionalCommand(e,t=[],n){return{type:`ConditionalCommand`,expression:e,redirections:t,line:n}},arithmeticCommand(e,t=[],n){return{type:`ArithmeticCommand`,expression:e,redirections:t,line:n}}}});function uC(e,t){for(;t<e.length;){if(e[t]===`\\`&&e[t+1]===`
837
- `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function dC(e){if(e.includes(`#`)){let[t,n]=e.split(`#`),r=Number.parseInt(t,10);if(r<2||r>64)return NaN;if(r<=36){let e=Number.parseInt(n,r);return e>2**53-1?2**53-1:e}let i=0;for(let e of n){let t;if(/[0-9]/.test(e))t=e.charCodeAt(0)-48;else if(/[a-z]/.test(e))t=e.charCodeAt(0)-97+10;else if(/[A-Z]/.test(e))t=e.charCodeAt(0)-65+36;else if(e===`@`)t=62;else if(e===`_`)t=63;else return NaN;if(t>=r)return NaN;if(i=i*r+t,i>2**53-1)return 2**53-1}return i}if(e.startsWith(`0x`)||e.startsWith(`0X`)){let t=Number.parseInt(e.slice(2),16);return t>2**53-1?2**53-1:t}if(e.startsWith(`0`)&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return NaN;let t=Number.parseInt(e,8);return t>2**53-1?2**53-1:t}let t=Number.parseInt(e,10);return t>2**53-1?2**53-1:t}function fC(e,t,n,r){if(n.slice(r,r+3)!==`$((`)return null;let i=r+3,a=1,o=i;for(;i<n.length-1&&a>0;)n[i]===`(`&&n[i+1]===`(`?(a++,i+=2):n[i]===`)`&&n[i+1]===`)`?(a--,a>0&&(i+=2)):i++;let{expr:s}=e(t,n.slice(o,i),0);return i+=2,{expr:{type:`ArithNested`,expression:s},pos:i}}function pC(e,t){if(e.slice(t,t+2)!==`$'`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`'`;)if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];switch(t){case`n`:r+=`
838
- `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;case`'`:r+=`'`;break;default:r+=t}n+=2}else r+=e[n],n++;e[n]===`'`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}function mC(e,t){if(e.slice(t,t+2)!==`$"`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]===`"`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}var hC,gC=S(()=>{hC=[`=`,`+=`,`-=`,`*=`,`/=`,`%=`,`<<=`,`>>=`,`&=`,`|=`,`^=`]});function _C(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function vC(e,t){let n=_C(t),{expr:r,pos:i}=xC(e,n,0),a=uC(n,i);if(a<n.length){let e=t.slice(a).trim();if(e)return{type:`ArithmeticExpression`,originalText:t,expression:{type:`ArithSyntaxError`,errorToken:e,message:`${e}: syntax error: invalid arithmetic operator (error token is "${e}")`}}}return{type:`ArithmeticExpression`,expression:r,originalText:t}}function yC(e,t){return{expr:{type:`ArithSyntaxError`,errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function bC(e,t){return uC(e,t)>=e.length}function xC(e,t,n){return SC(e,t,n)}function SC(e,t,n){let{expr:r,pos:i}=CC(e,t,n);for(i=uC(t,i);t[i]===`,`;){if(i++,bC(t,i))return yC(`,`,i);let{expr:n,pos:a}=CC(e,t,i);r={type:`ArithBinary`,operator:`,`,left:r,right:n},i=uC(t,a)}return{expr:r,pos:i}}function CC(e,t,n){let{expr:r,pos:i}=wC(e,t,n);if(i=uC(t,i),t[i]===`?`){i++;let{expr:n,pos:a}=xC(e,t,i);if(i=uC(t,a),t[i]===`:`){i++;let{expr:a,pos:o}=xC(e,t,i);return{expr:{type:`ArithTernary`,condition:r,consequent:n,alternate:a},pos:o}}}return{expr:r,pos:i}}function wC(e,t,n){let{expr:r,pos:i}=TC(e,t,n);for(;i=uC(t,i),t.slice(i,i+2)===`||`;){if(i+=2,bC(t,i))return yC(`||`,i);let{expr:n,pos:a}=TC(e,t,i);r={type:`ArithBinary`,operator:`||`,left:r,right:n},i=a}return{expr:r,pos:i}}function TC(e,t,n){let{expr:r,pos:i}=EC(e,t,n);for(;i=uC(t,i),t.slice(i,i+2)===`&&`;){if(i+=2,bC(t,i))return yC(`&&`,i);let{expr:n,pos:a}=EC(e,t,i);r={type:`ArithBinary`,operator:`&&`,left:r,right:n},i=a}return{expr:r,pos:i}}function EC(e,t,n){let{expr:r,pos:i}=DC(e,t,n);for(;i=uC(t,i),t[i]===`|`&&t[i+1]!==`|`;){if(i++,bC(t,i))return yC(`|`,i);let{expr:n,pos:a}=DC(e,t,i);r={type:`ArithBinary`,operator:`|`,left:r,right:n},i=a}return{expr:r,pos:i}}function DC(e,t,n){let{expr:r,pos:i}=OC(e,t,n);for(;i=uC(t,i),t[i]===`^`;){if(i++,bC(t,i))return yC(`^`,i);let{expr:n,pos:a}=OC(e,t,i);r={type:`ArithBinary`,operator:`^`,left:r,right:n},i=a}return{expr:r,pos:i}}function OC(e,t,n){let{expr:r,pos:i}=kC(e,t,n);for(;i=uC(t,i),t[i]===`&`&&t[i+1]!==`&`;){if(i++,bC(t,i))return yC(`&`,i);let{expr:n,pos:a}=kC(e,t,i);r={type:`ArithBinary`,operator:`&`,left:r,right:n},i=a}return{expr:r,pos:i}}function kC(e,t,n){let{expr:r,pos:i}=AC(e,t,n);for(;i=uC(t,i),t.slice(i,i+2)===`==`||t.slice(i,i+2)===`!=`;){let n=t.slice(i,i+2);if(i+=2,bC(t,i))return yC(n,i);let{expr:a,pos:o}=AC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function AC(e,t,n){let{expr:r,pos:i}=jC(e,t,n);for(;;)if(i=uC(t,i),t.slice(i,i+2)===`<=`||t.slice(i,i+2)===`>=`){let n=t.slice(i,i+2);if(i+=2,bC(t,i))return yC(n,i);let{expr:a,pos:o}=jC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else if(t[i]===`<`||t[i]===`>`){let n=t[i];if(i++,bC(t,i))return yC(n,i);let{expr:a,pos:o}=jC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function jC(e,t,n){let{expr:r,pos:i}=MC(e,t,n);for(;i=uC(t,i),t.slice(i,i+2)===`<<`||t.slice(i,i+2)===`>>`;){let n=t.slice(i,i+2);if(i+=2,bC(t,i))return yC(n,i);let{expr:a,pos:o}=MC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function MC(e,t,n){let{expr:r,pos:i}=NC(e,t,n);for(;i=uC(t,i),(t[i]===`+`||t[i]===`-`)&&t[i+1]!==t[i];){let n=t[i];if(i++,bC(t,i))return yC(n,i);let{expr:a,pos:o}=NC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function NC(e,t,n){let{expr:r,pos:i}=PC(e,t,n);for(;;)if(i=uC(t,i),t[i]===`*`&&t[i+1]!==`*`){if(i++,bC(t,i))return yC(`*`,i);let{expr:n,pos:a}=PC(e,t,i);r={type:`ArithBinary`,operator:`*`,left:r,right:n},i=a}else if(t[i]===`/`||t[i]===`%`){let n=t[i];if(i++,bC(t,i))return yC(n,i);let{expr:a,pos:o}=PC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function PC(e,t,n){let{expr:r,pos:i}=FC(e,t,n),a=uC(t,i);if(t.slice(a,a+2)===`**`){if(a+=2,bC(t,a))return yC(`**`,a);let{expr:n,pos:i}=PC(e,t,a);return{expr:{type:`ArithBinary`,operator:`**`,left:r,right:n},pos:i}}return{expr:r,pos:i}}function FC(e,t,n){let r=uC(t,n);if(t.slice(r,r+2)===`++`||t.slice(r,r+2)===`--`){let n=t.slice(r,r+2);r+=2;let{expr:i,pos:a}=FC(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}if(t[r]===`+`||t[r]===`-`||t[r]===`!`||t[r]===`~`){let n=t[r];r++;let{expr:i,pos:a}=FC(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}return LC(e,t,r)}function IC(e,t){let n=e[t];return n===`$`||n==="`"}function LC(e,t,n){let{expr:r,pos:i}=RC(e,t,n,!1),a=[r];for(;IC(t,i);){let{expr:n,pos:r}=RC(e,t,i,!0);a.push(n),i=r}a.length>1&&(r={type:`ArithConcat`,parts:a});let o;if(t[i]===`[`&&r.type===`ArithConcat`){i++;let{expr:n,pos:r}=xC(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(o&&r.type===`ArithConcat`&&(r={type:`ArithDynamicElement`,nameExpr:r,subscript:o},o=void 0),i=uC(t,i),r.type===`ArithConcat`||r.type===`ArithVariable`||r.type===`ArithDynamicElement`){for(let n of hC)if(t.slice(i,i+n.length)===n&&t.slice(i,i+n.length+1)!==`==`){i+=n.length;let{expr:a,pos:o}=CC(e,t,i);return r.type===`ArithDynamicElement`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r.nameExpr,subscript:r.subscript,value:a},pos:o}:r.type===`ArithConcat`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r,value:a},pos:o}:{expr:{type:`ArithAssignment`,operator:n,variable:r.name,value:a},pos:o}}}if(t.slice(i,i+2)===`++`||t.slice(i,i+2)===`--`){let e=t.slice(i,i+2);return i+=2,{expr:{type:`ArithUnary`,operator:e,operand:r,prefix:!1},pos:i}}return{expr:r,pos:i}}function RC(e,t,n,r=!1){let i=uC(t,n),a=fC(xC,e,t,i);if(a)return a;let o=pC(t,i);if(o)return o;let s=mC(t,i);if(s)return s;if(t.slice(i,i+2)===`$(`&&t[i+2]!==`(`){i+=2;let e=1,n=i;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,e>0&&i++;let r=t.slice(n,i);return i++,{expr:{type:`ArithCommandSubst`,command:r},pos:i}}if(t[i]==="`"){i++;let e=i;for(;i<t.length&&t[i]!=="`";)i++;let n=t.slice(e,i);return t[i]==="`"&&i++,{expr:{type:`ArithCommandSubst`,command:n},pos:i}}if(t[i]===`(`){i++;let{expr:n,pos:r}=xC(e,t,i);return i=uC(t,r),t[i]===`)`&&i++,{expr:{type:`ArithGroup`,expression:n},pos:i}}if(t[i]===`'`){i++;let e=``;for(;i<t.length&&t[i]!==`'`;)e+=t[i],i++;t[i]===`'`&&i++;let n=Number.parseInt(e,10);return{expr:{type:`ArithSingleQuote`,content:e,value:Number.isNaN(n)?0:n},pos:i}}if(t[i]===`"`){i++;let n=``;for(;i<t.length&&t[i]!==`"`;)t[i]===`\\`&&i+1<t.length?(n+=t[i+1],i+=2):(n+=t[i],i++);t[i]===`"`&&i++;let r=n.trim();if(!r)return{expr:{type:`ArithNumber`,value:0},pos:i};let{expr:a}=xC(e,r,0);return{expr:a,pos:i}}if(/[0-9]/.test(t[i])){let e=``,n=!1,r=!1;for(;i<t.length;){let a=t[i];if(n)if(/[0-9a-zA-Z@_]/.test(a))e+=a,i++;else break;else if(a===`#`)n=!0,e+=a,i++;else if(e===`0`&&(a===`x`||a===`X`)&&i+1<t.length&&/[0-9a-fA-F]/.test(t[i+1]))r=!0,e+=a,i++;else if(r&&/[0-9a-fA-F]/.test(a))e+=a,i++;else if(!r&&/[0-9]/.test(a))e+=a,i++;else break}if(i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=e;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: value too great for base (error token is "${n}")`},pos:i}}if(t[i]===`.`&&/[0-9]/.test(t[i+1]))throw new Lr(`${e}.${t[i+1]}...: syntax error: invalid arithmetic operator`);if(t[i]===`[`){let n=t.slice(i).trim();return{expr:{type:`ArithNumberSubscript`,number:e,errorToken:n},pos:t.length}}return{expr:{type:`ArithNumber`,value:dC(e)},pos:i}}if(t[i]===`$`&&t[i+1]===`{`){let e=i+2,n=1,r=e;for(;r<t.length&&n>0;)t[r]===`{`?n++:t[r]===`}`&&n--,n>0&&r++;let a=t.slice(e,r),o=r+1;if(t[o]===`#`){let e=o+1;for(;e<t.length&&/[0-9a-zA-Z@_]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicBase`,baseExpr:a,value:t.slice(o+1,e)},pos:e}}if(/[0-9]/.test(t[o])||t[o]===`x`||t[o]===`X`){let e=o;if(t[o]===`x`||t[o]===`X`)for(e++;e<t.length&&/[0-9a-fA-F]/.test(t[e]);)e++;else for(;e<t.length&&/[0-9]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicNumber`,prefix:a,suffix:t.slice(o,e)},pos:e}}return i=o,{expr:{type:`ArithBracedExpansion`,content:a},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[0-9]/.test(t[i+1])){i++;let e=``;for(;i<t.length&&/[0-9]/.test(t[i]);)e+=t[i],i++;return{expr:{type:`ArithVariable`,name:e,hasDollarPrefix:!0},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[*@#?\-!$]/.test(t[i+1])){let e=t[i+1];return i+=2,{expr:{type:`ArithSpecialVar`,name:e},pos:i}}let c=!1;if(t[i]===`$`&&i+1<t.length&&/[a-zA-Z_]/.test(t[i+1])&&(c=!0,i++),i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=``;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;if(t[i]===`[`&&!r){i++;let a;if(t[i]===`'`||t[i]===`"`){let e=t[i];for(i++,a=``;i<t.length&&t[i]!==e;)a+=t[i],i++;t[i]===e&&i++,i=uC(t,i),t[i]===`]`&&i++}let o;if(a===void 0){let{expr:n,pos:r}=xC(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(i=uC(t,i),t[i]===`[`&&o)return{expr:{type:`ArithDoubleSubscript`,array:n,index:o},pos:i};if(!r){for(let r of hC)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:s,pos:c}=CC(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,subscript:o,stringKey:a,value:s},pos:c}}}return{expr:{type:`ArithArrayElement`,array:n,index:o,stringKey:a},pos:i}}if(i=uC(t,i),!r){for(let r of hC)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:a,pos:o}=CC(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,value:a},pos:o}}}return{expr:{type:`ArithVariable`,name:n,hasDollarPrefix:c},pos:i}}if(t[i]===`#`){let e=i+1;for(;e<t.length&&t[e]!==`
839
- `;)e++;let n=t.slice(i,e).trim()||`#`;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: syntax error: invalid arithmetic operator (error token is "${n}")`},pos:t.length}}return{expr:{type:`ArithNumber`,value:0},pos:i}}var zC=S(()=>{A(),gC()});function BC(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)==192){if(n+1<e.length&&(e[n+1]&192)==128&&r>=194){let i=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(i),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)==224){if(n+2<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let i=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(i>=55296&&i<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(i),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)==240&&r<=244){if(n+3<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128&&(e[n+3]&192)==128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let i=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(i>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(i),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function VC(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function HC(e,t,n,r,i){let a=1,o=n+1;for(;o<t.length&&a>0;)t[o]===r?a++:t[o]===i&&a--,a>0&&o++;return a===0?o:-1}function UC(e,t,n){let r=n,i=1;for(;r<t.length&&i>0;){let e=t[r];if(e===`\\`&&r+1<t.length){r+=2;continue}if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}e===`{`?i++:e===`}`&&i--,i>0&&r++}return r}function WC(e,t,n){let r=n,i=!1;for(;r<t.length;){let e=t[r];if(e===`/`&&i||e===`}`)break;if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1,i=!0;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++,i=!0;continue}e===`\\`?(r+=2,i=!0):(r++,i=!0)}return r}function GC(e,t,n){let r=n,i=``;for(;r<t.length;){let e=t[r];if(e===`*`||e===`?`)i+=e,r++;else if(e===`[`){let n=KC(t,r);n===-1?(i+=e,r++):(i+=t.slice(r,n+1),r=n+1)}else break}return{pattern:i,endIndex:r}}function KC(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){let t=e[n];if(t===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`'`)return-1;n+=2;continue}if(t===`]`)return n;if(t===`"`||t===`$`||t==="`")return-1;if(t===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(t===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}if(t===`[`&&n+1<e.length&&(e[n+1]===`.`||e[n+1]===`=`)){let t=`${e[n+1]}]`,r=e.indexOf(t,n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function qC(e,t,n){let r=``,i=n;for(;i<t.length&&t[i]!==`'`;){let e=t[i];if(e===`\\`&&i+1<t.length)switch(t[i+1]){case`n`:r+=`
840
- `,i+=2;break;case`t`:r+=` `,i+=2;break;case`r`:r+=`\r`,i+=2;break;case`\\`:r+=`\\`,i+=2;break;case`'`:r+=`'`,i+=2;break;case`"`:r+=`"`,i+=2;break;case`a`:r+=`\x07`,i+=2;break;case`b`:r+=`\b`,i+=2;break;case`e`:case`E`:r+=`\x1B`,i+=2;break;case`f`:r+=`\f`,i+=2;break;case`v`:r+=`\v`,i+=2;break;case`x`:{let e=[],n=i;for(;n+1<t.length&&t[n]===`\\`&&t[n+1]===`x`;){let r=t.slice(n+2,n+4),i=parseInt(r,16);if(!Number.isNaN(i)&&r.length>0)e.push(i),n+=2+r.length;else break}e.length>0?(r+=BC(e),i=n):(r+=`\\x`,i+=2);break}case`u`:{let e=t.slice(i+2,i+6),n=parseInt(e,16);Number.isNaN(n)?(r+=`\\u`,i+=2):(r+=String.fromCharCode(n),i+=6);break}case`c`:if(i+2<t.length){let e=t[i+2].charCodeAt(0)&31;r+=String.fromCharCode(e),i+=3}else r+=`\\c`,i+=2;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=``,n=i+1;for(;n<t.length&&n<i+4&&/[0-7]/.test(t[n]);)e+=t[n],n++;let a=parseInt(e,8);r+=String.fromCharCode(a),i=n;break}default:r+=e,i++}else r+=e,i++}return i<t.length&&t[i]===`'`&&i++,{part:K.literal(r),endIndex:i}}function JC(e,t){let n=t.trim();return n===``?{type:`ArithmeticExpression`,expression:{type:`ArithNumber`,value:0}}:vC(e,n)}function YC(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`{`?(r++,n+=a):a===`}`?(r--,n+=a):a===`,`&&r===0?(t.push(n),n=``):n+=a}return t.push(n),t}function XC(e,t,n,r){let i=HC(e,t,n,`{`,`}`);if(i===-1)return null;let a=t.slice(n+1,i),o=a.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:`BraceExpansion`,items:[{type:`Range`,start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:i+1};let s=a.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return s?{part:{type:`BraceExpansion`,items:[{type:`Range`,start:s[1],end:s[2],step:s[3]?Number.parseInt(s[3],10):void 0}]},endIndex:i+1}:a.includes(`,`)&&r?{part:{type:`BraceExpansion`,items:YC(a).map(t=>({type:`Word`,word:K.word(r(e,t,!1,!1,!1))}))},endIndex:i+1}:a.includes(`,`)?{part:{type:`BraceExpansion`,items:YC(a).map(e=>({type:`Word`,word:K.word([K.literal(e)])}))},endIndex:i+1}:null}function ZC(e,t){let n=``;for(let r of t.parts)switch(r.type){case`Literal`:n+=r.value;break;case`SingleQuoted`:n+=`'${r.value}'`;break;case`Escaped`:n+=r.value;break;case`DoubleQuoted`:n+=`"`;for(let e of r.parts)e.type===`Literal`||e.type===`Escaped`?n+=e.value:e.type===`ParameterExpansion`&&(n+=`\${${e.parameter}}`);n+=`"`;break;case`ParameterExpansion`:n+=`\${${r.parameter}}`;break;case`Glob`:n+=r.pattern;break;case`TildeExpansion`:n+=`~`,r.user&&(n+=r.user);break;case`BraceExpansion`:{n+=`{`;let t=[];for(let n of r.items)if(n.type===`Range`){let e=n.startStr??String(n.start),r=n.endStr??String(n.end);n.step===void 0?t.push(`${e}..${r}`):t.push(`${e}..${r}..${n.step}`)}else t.push(ZC(e,n.word));t.length===1&&r.items[0].type===`Range`?n+=t[0]:n+=t.join(`,`),n+=`}`;break}default:n+=r.type}return n}function QC(e,t){return{[G.LESS]:`<`,[G.GREAT]:`>`,[G.DGREAT]:`>>`,[G.LESSAND]:`<&`,[G.GREATAND]:`>&`,[G.LESSGREAT]:`<>`,[G.CLOBBER]:`>|`,[G.TLESS]:`<<<`,[G.AND_GREAT]:`&>`,[G.AND_DGREAT]:`&>>`,[G.DLESS]:`<`,[G.DLESSDASH]:`<`}[t]||`>`}var $C=S(()=>{lC(),zC(),$S()});function ew(e){let t=e.current(),n=t.type;if(n===G.NUMBER){let n=e.peek(1);return t.end===n.start?aC.has(n.type):!1}if(n===G.FD_VARIABLE){let t=e.peek(1);return oC.has(t.type)}return iC.has(n)}function tw(e){let t=null,n;e.check(G.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(G.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),i=QC(e,r.type);if(r.type===G.DLESS||r.type===G.DLESSDASH)return nw(e,i,t,r.type===G.DLESSDASH);e.isWord()||e.error(`Expected redirection target`);let a=e.parseWord();return K.redirection(i,a,t,n)}function nw(e,t,n,r){e.isWord()||e.error(`Expected here-document delimiter`);let i=e.advance(),a=i.value,o=i.quoted||!1;(a.startsWith(`'`)&&a.endsWith(`'`)||a.startsWith(`"`)&&a.endsWith(`"`))&&(a=a.slice(1,-1));let s=K.redirection(r?`<<-`:`<<`,K.hereDoc(a,K.word([]),r,o),n);return e.addPendingHeredoc(s,a,r,o),s}function rw(e){let t=e.current().line,n=[],r=null,i=[],a=[];for(;e.check(G.ASSIGNMENT_WORD)||ew(e);)e.checkIterationLimit(),e.check(G.ASSIGNMENT_WORD)?n.push(iw(e)):a.push(tw(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(G.DBRACK_START)||e.check(G.DPAREN_START))){let t=e.advance();r=K.word([K.literal(t.value)])}for(;(!e.isStatementEnd()||e.check(G.RBRACE))&&!e.check(G.PIPE,G.PIPE_AMP);)if(e.checkIterationLimit(),ew(e))a.push(tw(e));else if(e.check(G.RBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(G.LBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(G.DBRACK_END)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.isWord())i.push(e.parseWord());else if(e.check(G.ASSIGNMENT_WORD)){let t=e.advance(),n=t.value,r=n.endsWith(`=`),a=n.endsWith(`=(`);if((r||a)&&(a||e.check(G.LPAREN))){let t=a?n.slice(0,-2):n.slice(0,-1);a||e.expect(G.LPAREN);let r=aw(e);e.expect(G.RPAREN);let o=`${t}=(${r.map(t=>ZC(e,t)).join(` `)})`;i.push(e.parseWordFromString(o,!1,!1))}else i.push(e.parseWordFromString(n,t.quoted,t.singleQuoted))}else if(e.check(G.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=K.simpleCommand(r,i,n,a);return o.line=t,o}function iw(e){let t=e.expect(G.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let i=r[0],a,o=i.length;if(n[o]===`[`){let t=0,r=o+1;for(;o<n.length;o++)if(n[o]===`[`)t++;else if(n[o]===`]`&&(t--,t===0))break;t!==0&&e.error(`Invalid assignment: ${n}`),a=n.slice(r,o),o++}let s=n[o]===`+`;s&&o++,n[o]!==`=`&&e.error(`Invalid assignment: ${n}`),o++;let c=n.slice(o);if(c===`(`){let t=aw(e);e.expect(G.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return K.assignment(n,null,s,t)}if(c===``&&e.check(G.LPAREN)){let n=e.current();if(t.end===n.start){e.advance();let t=aw(e);e.expect(G.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return K.assignment(n,null,s,t)}}let l=c?e.parseWordFromString(c,t.quoted,t.singleQuoted,!0):null,u=a===void 0?i:`${i}[${a}]`;return K.assignment(u,l,s,null)}function aw(e){let t=[];for(e.skipNewlines();!e.check(G.RPAREN,G.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):ow.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var ow,sw=S(()=>{lC(),$S(),cC(),$C(),ow=new Set([G.AMP,G.PIPE,G.PIPE_AMP,G.SEMICOLON,G.AND_AND,G.OR_OR,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND])});function cw(e,t){e.expect(G.IF);let n=[],r=e.parseCompoundList();e.expect(G.THEN);let i=e.parseCompoundList();if(i.length===0){let t=e.check(G.FI)?`fi`:e.check(G.ELSE)?`else`:e.check(G.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}for(n.push({condition:r,body:i});e.check(G.ELIF);){e.advance();let t=e.parseCompoundList();e.expect(G.THEN);let r=e.parseCompoundList();if(r.length===0){let t=e.check(G.FI)?`fi`:e.check(G.ELSE)?`else`:e.check(G.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}n.push({condition:t,body:r})}let a=null;e.check(G.ELSE)&&(e.advance(),a=e.parseCompoundList(),a.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(G.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.ifNode(n,a,o)}function lw(e,t){let n=e.expect(G.FOR);if(e.check(G.DPAREN_START))return uw(e,t,n.line);e.isWord()||e.error(`Expected variable name in for loop`);let r=e.advance().value,i=null;if(e.skipNewlines(),e.check(G.IN))for(e.advance(),i=[];!e.check(G.SEMICOLON,G.NEWLINE,G.DO,G.EOF)&&e.isWord();)i.push(e.parseWord());e.check(G.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(G.DO);let a=e.parseCompoundList();e.expect(G.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.forNode(r,i,a,o)}function uw(e,t,n){e.expect(G.DPAREN_START);let r=null,i=null,a=null,o=[``,``,``],s=0,c=0;for(;!e.check(G.DPAREN_END,G.EOF);){let t=e.advance();if(t.type===G.SEMICOLON&&c===0){if(s++,s>2)break}else t.value===`(`&&c++,t.value===`)`&&c--,o[s]+=t.value}e.expect(G.DPAREN_END),o[0].trim()&&(r=vC(e,o[0].trim())),o[1].trim()&&(i=vC(e,o[1].trim())),o[2].trim()&&(a=vC(e,o[2].trim())),e.skipNewlines(),e.check(G.SEMICOLON)&&e.advance(),e.skipNewlines();let l;e.check(G.LBRACE)?(e.advance(),l=e.parseCompoundList(),e.expect(G.RBRACE)):(e.expect(G.DO),l=e.parseCompoundList(),e.expect(G.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:`CStyleFor`,init:r,condition:i,update:a,body:l,redirections:u,line:n}}function dw(e,t){e.expect(G.WHILE);let n=e.parseCompoundList();e.expect(G.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(G.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.whileNode(n,r,i)}function fw(e,t){e.expect(G.UNTIL);let n=e.parseCompoundList();e.expect(G.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(G.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.untilNode(n,r,i)}function pw(e,t){e.expect(G.CASE),e.isWord()||e.error(`Expected word after 'case'`);let n=e.parseWord();e.skipNewlines(),e.expect(G.IN),e.skipNewlines();let r=[];for(;!e.check(G.ESAC,G.EOF);){e.checkIterationLimit();let t=e.getPos(),n=mw(e);if(n&&r.push(n),e.skipNewlines(),e.getPos()===t&&!n)break}e.expect(G.ESAC);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.caseNode(n,r,i)}function mw(e){e.check(G.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(G.PIPE));)e.advance();if(t.length===0)return null;e.expect(G.RPAREN),e.skipNewlines();let n=[];for(;!e.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND,G.ESAC,G.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===G.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(G.LPAREN)&&e.peek(1).type===G.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let t=e.getPos(),r=e.parseStatement();if(r&&n.push(r),e.skipSeparators(!1),e.getPos()===t&&!r)break}let r=`;;`;return e.check(G.DSEMI)?(e.advance(),r=`;;`):e.check(G.SEMI_AND)?(e.advance(),r=`;&`):e.check(G.SEMI_SEMI_AND)&&(e.advance(),r=`;;&`),K.caseItem(t,n,r)}function hw(e,t){e.expect(G.LPAREN);let n=e.parseCompoundList();e.expect(G.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.subshell(n,r)}function gw(e,t){e.expect(G.LBRACE);let n=e.parseCompoundList();e.expect(G.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.group(n,r)}var _w=S(()=>{lC(),zC(),$S()});function vw(e){return e.isWord()||e.check(G.LBRACE)||e.check(G.RBRACE)||e.check(G.ASSIGNMENT_WORD)}function yw(e){if(e.check(G.BANG)&&e.peek(1).type===G.LPAREN){e.advance(),e.advance();let t=1,n=`!(`;for(;t>0&&!e.check(G.EOF);)if(e.check(G.LPAREN))t++,n+=`(`,e.advance();else if(e.check(G.RPAREN))t--,t>0&&(n+=`)`),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(G.PIPE))n+=`|`,e.advance();else break;return n+=`)`,e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function bw(e){return e.skipNewlines(),xw(e)}function xw(e){let t=Sw(e);for(e.skipNewlines();e.check(G.OR_OR);){e.advance(),e.skipNewlines();let n=Sw(e);t={type:`CondOr`,left:t,right:n},e.skipNewlines()}return t}function Sw(e){let t=Cw(e);for(e.skipNewlines();e.check(G.AND_AND);){e.advance(),e.skipNewlines();let n=Cw(e);t={type:`CondAnd`,left:t,right:n},e.skipNewlines()}return t}function Cw(e){return e.skipNewlines(),e.check(G.BANG)?(e.advance(),e.skipNewlines(),{type:`CondNot`,operand:Cw(e)}):ww(e)}function ww(e){if(e.check(G.LPAREN)){e.advance();let t=bw(e);return e.expect(G.RPAREN),{type:`CondGroup`,expression:t}}if(vw(e)){let t=e.current(),n=t.value;if(Ew.includes(n)&&!t.quoted){if(e.advance(),e.check(G.DBRACK_END)&&e.error(`Expected operand after ${n}`),vw(e))return{type:`CondUnary`,operator:n,operand:e.parseWordNoBraceExpansion()};let t=e.current();e.error(`unexpected argument \`${t.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&Dw.includes(e.current().value)){let t=e.advance().value,n;return n=t===`=~`?Tw(e):t===`==`||t===`!=`?yw(e):e.parseWordNoBraceExpansion(),{type:`CondBinary`,operator:t,left:r,right:n}}return e.check(G.LESS)?(e.advance(),{type:`CondBinary`,operator:`<`,left:r,right:e.parseWordNoBraceExpansion()}):e.check(G.GREAT)?(e.advance(),{type:`CondBinary`,operator:`>`,left:r,right:e.parseWordNoBraceExpansion()}):e.isWord()&&e.current().value===`=`?(e.advance(),{type:`CondBinary`,operator:`==`,left:r,right:yw(e)}):{type:`CondWord`,word:r}}e.error(`Expected conditional expression`)}function Tw(e){let t=[],n=0,r=-1,i=e.getInput(),a=()=>e.check(G.DBRACK_END)||e.check(G.AND_AND)||e.check(G.OR_OR)||e.check(G.NEWLINE)||e.check(G.EOF);for(;!a();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let e=i.slice(r,a.start);t.push({type:`Literal`,value:e})}if(e.isWord()||e.check(G.ASSIGNMENT_WORD)){let n=e.parseWordForRegex();t.push(...n.parts),r=e.peek(-1).end}else if(e.check(G.LPAREN)){let i=e.advance();t.push({type:`Literal`,value:`(`}),n++,r=i.end}else if(e.check(G.DPAREN_START)){let i=e.advance();t.push({type:`Literal`,value:`((`}),n+=2,r=i.end}else if(e.check(G.DPAREN_END))if(n>=2){let i=e.advance();t.push({type:`Literal`,value:`))`}),n-=2,r=i.end}else{if(n===1)break;break}else if(e.check(G.RPAREN))if(n>0){let i=e.advance();t.push({type:`Literal`,value:`)`}),n--,r=i.end}else break;else if(e.check(G.PIPE)){let n=e.advance();t.push({type:`Literal`,value:`|`}),r=n.end}else if(e.check(G.SEMICOLON))if(n>0){let n=e.advance();t.push({type:`Literal`,value:`;`}),r=n.end}else break;else if(n>0&&e.check(G.LESS)){let n=e.advance();t.push({type:`Literal`,value:`<`}),r=n.end}else if(n>0&&e.check(G.GREAT)){let n=e.advance();t.push({type:`Literal`,value:`>`}),r=n.end}else if(n>0&&e.check(G.DGREAT)){let n=e.advance();t.push({type:`Literal`,value:`>>`}),r=n.end}else if(n>0&&e.check(G.DLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<`}),r=n.end}else if(n>0&&e.check(G.LESSAND)){let n=e.advance();t.push({type:`Literal`,value:`<&`}),r=n.end}else if(n>0&&e.check(G.GREATAND)){let n=e.advance();t.push({type:`Literal`,value:`>&`}),r=n.end}else if(n>0&&e.check(G.LESSGREAT)){let n=e.advance();t.push({type:`Literal`,value:`<>`}),r=n.end}else if(n>0&&e.check(G.CLOBBER)){let n=e.advance();t.push({type:`Literal`,value:`>|`}),r=n.end}else if(n>0&&e.check(G.TLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<<`}),r=n.end}else if(n>0&&e.check(G.AMP)){let n=e.advance();t.push({type:`Literal`,value:`&`}),r=n.end}else if(n>0&&e.check(G.LBRACE)){let n=e.advance();t.push({type:`Literal`,value:`{`}),r=n.end}else if(n>0&&e.check(G.RBRACE)){let n=e.advance();t.push({type:`Literal`,value:`}`}),r=n.end}else break}return t.length===0&&e.error(`Expected regex pattern after =~`),{type:`Word`,parts:t}}var Ew,Dw,Ow=S(()=>{$S(),Ew=`-a.-b.-c.-d.-e.-f.-g.-h.-k.-p.-r.-s.-t.-u.-w.-x.-G.-L.-N.-O.-S.-z.-n.-o.-v.-R`.split(`.`),Dw=[`==`,`!=`,`=~`,`<`,`>`,`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`,`-nt`,`-ot`,`-ef`]});function kw(e){return e.length>0?e:[K.literal(``)]}function Aw(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(`@*+?!`.includes(t)&&r+1<e.length&&e[r+1]===`(`){r++,n++,r++;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function jw(e,t,n){let r=n+1,i=t[r];if(`@*#?$!-0123456789`.includes(i))return{part:K.parameterExpansion(i),endIndex:r+1};let a=``;for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)a+=t[r],r++;return{part:K.parameterExpansion(a),endIndex:r}}function Mw(e,t,n,r=!1){let i=n+2,a=!1;t[i]===`!`&&(a=!0,i++);let o=!1;t[i]===`#`&&!/[}:#%/^,]/.test(t[i+1]||`}`)&&(o=!0,i++);let s=``,c=t[i];if(/[@*#?$!-]/.test(c)&&!/[a-zA-Z0-9_]/.test(t[i+1]||``))s=c,i++;else for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)s+=t[i],i++;if(t[i]===`[`){let r=HC(e,t,i,`[`,`]`);if(s+=t.slice(i,r+1),i=r+1,t[i]===`[`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;let a=t.slice(n+2,r);return{part:K.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}}if(s===``&&!a&&!o&&t[i]!==`}`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;if(e>0)throw new sC(`unexpected EOF while looking for matching '}'`,0,0);let a=t.slice(n+2,r);return{part:K.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}let l=null;if(a){let n=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n)if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let a=Nw(e,t,i,s,r);a.operation?(l={type:`Indirection`,innerOp:a.operation},i=a.endIndex):(l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``)}else l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``;else if(t[i]===`*`||t[i]===`@`&&!/[QPaAEKkuUL]/.test(t[i+1]||``)){let e=t[i];i++,l={type:`VarNamePrefix`,prefix:s,star:e===`*`},s=``}else if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let n=Nw(e,t,i,s,r);n.operation?(l={type:`Indirection`,innerOp:n.operation},i=n.endIndex):l={type:`Indirection`}}else l={type:`Indirection`}}else if(o)if(t[i]===`:`)for(l={type:`LengthSliceError`};i<t.length&&t[i]!==`}`;)i++;else t[i]!==`}`&&/[-+=?]/.test(t[i])||t[i]===`/`?e.error(`\${#${s}${t.slice(i,t.indexOf(`}`,i))}}: bad substitution`):l={type:`Length`};if(!l&&i<t.length&&t[i]!==`}`){let n=Nw(e,t,i,s,r);l=n.operation,i=n.endIndex}if(i<t.length&&t[i]!==`}`){let r=t[i];if(!/[:\-+=?#%/^,@[]/.test(r)){let r=i;for(;r<t.length&&t[r]!==`}`;)r++;let a=t.slice(n,r+1);e.error(`\${${a.slice(2,-1)}}: bad substitution`)}}for(;i<t.length&&t[i]!==`}`;)i++;if(i>=t.length)throw new sC(`unexpected EOF while looking for matching '}'`,0,0);return{part:K.parameterExpansion(s,l),endIndex:i+1}}function Nw(e,t,n,r,i=!1){let a=n,o=t[a],s=t[a+1]||``;if(o===`:`){let n=s;if(`-=?+`.includes(n)){a+=2;let r=UC(e,t,a),o=Lw(e,t.slice(a,r),!1,!1,!0,!1,i,!1,!1,!0),s=K.word(kw(o));if(n===`-`)return{operation:{type:`DefaultValue`,word:s,checkEmpty:!0},endIndex:r};if(n===`=`)return{operation:{type:`AssignDefault`,word:s,checkEmpty:!0},endIndex:r};if(n===`?`)return{operation:{type:`ErrorIfUnset`,word:s,checkEmpty:!0},endIndex:r};if(n===`+`)return{operation:{type:`UseAlternative`,word:s,checkEmpty:!0},endIndex:r}}a++;let r=UC(e,t,a),o=t.slice(a,r),c=-1,l=0,u=0;for(let e=0;e<o.length;e++){let t=o[e];if(t===`(`||t===`[`)l++;else if(t===`)`||t===`]`)l--;else if(t===`?`&&l===0)u++;else if(t===`:`&&l===0)if(u>0)u--;else{c=e;break}}let d=c>=0?o.slice(0,c):o,f=c>=0?o.slice(c+1):null;return{operation:{type:`Substring`,offset:JC(e,d),length:f===null?null:JC(e,f)},endIndex:r}}if(`-=?+`.includes(o)){a++;let n=UC(e,t,a),r=t.slice(a,n),s=Lw(e,r,!1,!1,!0,!1,i,!1,!1,!0),c=K.word(kw(s));if(o===`-`)return{operation:{type:`DefaultValue`,word:c,checkEmpty:!1},endIndex:n};if(o===`=`)return{operation:{type:`AssignDefault`,word:c,checkEmpty:!1},endIndex:n};if(o===`?`)return{operation:{type:`ErrorIfUnset`,word:r?c:null,checkEmpty:!1},endIndex:n};if(o===`+`)return{operation:{type:`UseAlternative`,word:c,checkEmpty:!1},endIndex:n}}if(o===`#`||o===`%`){let n=s===o,r=o===`#`?`prefix`:`suffix`;a+=n?2:1;let i=UC(e,t,a),c=Lw(e,t.slice(a,i),!1,!1,!1);return{operation:{type:`PatternRemoval`,pattern:K.word(kw(c)),side:r,greedy:n},endIndex:i}}if(o===`/`){let n=s===`/`;a+=n?2:1;let r=null;t[a]===`#`?(r=`start`,a++):t[a]===`%`&&(r=`end`,a++);let i;i=r!==null&&(t[a]===`/`||t[a]===`}`)?a:WC(e,t,a);let o=Lw(e,t.slice(a,i),!1,!1,!1),c=K.word(kw(o)),l=null,u=i;if(t[i]===`/`){let n=i+1,r=UC(e,t,n),a=Lw(e,t.slice(n,r),!1,!1,!1);l=K.word(kw(a)),u=r}return{operation:{type:`PatternReplacement`,pattern:c,replacement:l,all:n,anchor:r},endIndex:u}}if(o===`^`||o===`,`){let n=s===o,r=o===`^`?`upper`:`lower`;a+=n?2:1;let i=UC(e,t,a),c=t.slice(a,i);return{operation:{type:`CaseModification`,direction:r,all:n,pattern:c?K.word([K.literal(c)]):null},endIndex:i}}return o===`@`&&/[QPaAEKkuUL]/.test(s)?{operation:{type:`Transform`,operator:s},endIndex:a+2}:{operation:null,endIndex:a}}function Pw(e,t,n,r=!1){let i=n+1;if(i>=t.length)return{part:K.literal(`$`),endIndex:i};let a=t[i];if(a===`(`&&t[i+1]===`(`)return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(a===`[`){let n=1,r=i+1;for(;r<t.length&&n>0;)t[r]===`[`?n++:t[r]===`]`&&n--,n>0&&r++;if(n===0){let n=vC(e,t.slice(i+1,r));return{part:K.arithmeticExpansion(n),endIndex:r+1}}}return a===`(`?e.parseCommandSubstitution(t,n):a===`{`?Mw(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(a)?jw(e,t,n):{part:K.literal(`$`),endIndex:i}}function Fw(e,t){let n=[],r=0,i=``,a=()=>{i&&=(n.push(K.literal(i)),``)};for(;r<t.length;){let o=t[r];if(o===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`"`||e===`\\`){i+=e,r+=2;continue}i+=o,r++;continue}if(o===`$`){a();let{part:i,endIndex:o}=Pw(e,t,r,!0);i&&n.push(i),r=o;continue}if(o==="`"){a();let{part:i,endIndex:o}=e.parseBacktickSubstitution(t,r,!0);n.push(i),r=o;continue}i+=o,r++}return a(),n}function Iw(e,t,n){let r=[],i=n,a=``,o=()=>{a&&=(r.push(K.literal(a)),``)};for(;i<t.length&&t[i]!==`"`;){let n=t[i];if(n===`\\`&&i+1<t.length){let e=t[i+1];if(`"\\$\`
841
- `.includes(e)){a+=e,i+=2;continue}a+=n,i++;continue}if(n===`$`){o();let{part:n,endIndex:a}=Pw(e,t,i,!0);n&&r.push(n),i=a;continue}if(n==="`"){o();let{part:n,endIndex:a}=e.parseBacktickSubstitution(t,i,!0);r.push(n),i=a;continue}a+=n,i++}return o(),{part:K.doubleQuoted(r),endIndex:i}}function Lw(e,t,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1){if(r)return[K.singleQuoted(t)];if(n){let n=Fw(e,t);return[K.doubleQuoted(n)]}if(t.length>=2&&t[0]===`"`&&t[t.length-1]===`"`){let n=t.slice(1,-1),r=!1;for(let e=0;e<n.length;e++){if(n[e]===`"`){r=!0;break}n[e]===`\\`&&e+1<n.length&&e++}if(!r){let t=Fw(e,n);return[K.doubleQuoted(t)]}}let u=[],d=0,f=``,p=()=>{f&&=(u.push(K.literal(f)),``)};for(;d<t.length;){let n=t[d];if(n===`\\`&&d+1<t.length){let e=t[d+1];if(c){p(),u.push(K.escaped(e)),d+=2;continue}let n=a?e===`$`||e==="`"||e===`
836
+ `);)a=!0,i++;if(a&&i<n&&t[i]===`)`)return!0}if(i===0)return!1;r++;continue}if(i===1&&(e===`|`&&r+1<n&&t[r+1]===`|`||e===`&`&&r+1<n&&t[r+1]===`&`||e===`|`&&r+1<n&&t[r+1]!==`|`))return!0;r++}return!1}}}),sC,cC,lC,uC,dC,fC,pC,mC,hC=S(()=>{oC(),sC=1e6,cC=1e5,lC=1e6,uC=200,dC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS,G.AND_GREAT,G.AND_DGREAT]),fC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS]),pC=new Set([G.LESS,G.GREAT,G.DLESS,G.DGREAT,G.LESSAND,G.GREATAND,G.LESSGREAT,G.DLESSDASH,G.CLOBBER,G.TLESS,G.AND_GREAT,G.AND_DGREAT]),mC=class extends Error{line;column;token;constructor(e,t,n,r=void 0){super(`Parse error at ${t}:${n}: ${e}`),this.line=t,this.column=n,this.token=r,this.name=`ParseException`}}}),K,gC=S(()=>{K={script(e){return{type:`Script`,statements:e}},statement(e,t=[],n=!1,r,i){let a={type:`Statement`,pipelines:e,operators:t,background:n};return r&&(a.deferredError=r),i!==void 0&&(a.sourceText=i),a},pipeline(e,t=!1,n=!1,r=!1,i){return{type:`Pipeline`,commands:e,negated:t,timed:n,timePosix:r,pipeStderr:i}},simpleCommand(e,t=[],n=[],r=[]){return{type:`SimpleCommand`,name:e,args:t,assignments:n,redirections:r}},word(e){return{type:`Word`,parts:e}},literal(e){return{type:`Literal`,value:e}},singleQuoted(e){return{type:`SingleQuoted`,value:e}},doubleQuoted(e){return{type:`DoubleQuoted`,parts:e}},escaped(e){return{type:`Escaped`,value:e}},parameterExpansion(e,t=null){return{type:`ParameterExpansion`,parameter:e,operation:t}},commandSubstitution(e,t=!1){return{type:`CommandSubstitution`,body:e,legacy:t}},arithmeticExpansion(e){return{type:`ArithmeticExpansion`,expression:e}},assignment(e,t,n=!1,r=null){return{type:`Assignment`,name:e,value:t,append:n,array:r}},redirection(e,t,n=null,r){let i={type:`Redirection`,fd:n,operator:e,target:t};return r&&(i.fdVariable=r),i},hereDoc(e,t,n=!1,r=!1){return{type:`HereDoc`,delimiter:e,content:t,stripTabs:n,quoted:r}},ifNode(e,t=null,n=[]){return{type:`If`,clauses:e,elseBody:t,redirections:n}},forNode(e,t,n,r=[]){return{type:`For`,variable:e,words:t,body:n,redirections:r}},whileNode(e,t,n=[]){return{type:`While`,condition:e,body:t,redirections:n}},untilNode(e,t,n=[]){return{type:`Until`,condition:e,body:t,redirections:n}},caseNode(e,t,n=[]){return{type:`Case`,word:e,items:t,redirections:n}},caseItem(e,t,n=`;;`){return{type:`CaseItem`,patterns:e,body:t,terminator:n}},subshell(e,t=[]){return{type:`Subshell`,body:e,redirections:t}},group(e,t=[]){return{type:`Group`,body:e,redirections:t}},functionDef(e,t,n=[],r){return{type:`FunctionDef`,name:e,body:t,redirections:n,sourceFile:r}},conditionalCommand(e,t=[],n){return{type:`ConditionalCommand`,expression:e,redirections:t,line:n}},arithmeticCommand(e,t=[],n){return{type:`ArithmeticCommand`,expression:e,redirections:t,line:n}}}});function _C(e,t){for(;t<e.length;){if(e[t]===`\\`&&e[t+1]===`
837
+ `){t+=2;continue}if(/\s/.test(e[t])){t++;continue}break}return t}function vC(e){if(e.includes(`#`)){let[t,n]=e.split(`#`),r=Number.parseInt(t,10);if(r<2||r>64)return NaN;if(r<=36){let e=Number.parseInt(n,r);return e>2**53-1?2**53-1:e}let i=0;for(let e of n){let t;if(/[0-9]/.test(e))t=e.charCodeAt(0)-48;else if(/[a-z]/.test(e))t=e.charCodeAt(0)-97+10;else if(/[A-Z]/.test(e))t=e.charCodeAt(0)-65+36;else if(e===`@`)t=62;else if(e===`_`)t=63;else return NaN;if(t>=r)return NaN;if(i=i*r+t,i>2**53-1)return 2**53-1}return i}if(e.startsWith(`0x`)||e.startsWith(`0X`)){let t=Number.parseInt(e.slice(2),16);return t>2**53-1?2**53-1:t}if(e.startsWith(`0`)&&e.length>1&&/^[0-9]+$/.test(e)){if(/[89]/.test(e))return NaN;let t=Number.parseInt(e,8);return t>2**53-1?2**53-1:t}let t=Number.parseInt(e,10);return t>2**53-1?2**53-1:t}function yC(e,t,n,r){if(n.slice(r,r+3)!==`$((`)return null;let i=r+3,a=1,o=i;for(;i<n.length-1&&a>0;)n[i]===`(`&&n[i+1]===`(`?(a++,i+=2):n[i]===`)`&&n[i+1]===`)`?(a--,a>0&&(i+=2)):i++;let{expr:s}=e(t,n.slice(o,i),0);return i+=2,{expr:{type:`ArithNested`,expression:s},pos:i}}function bC(e,t){if(e.slice(t,t+2)!==`$'`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`'`;)if(e[n]===`\\`&&n+1<e.length){let t=e[n+1];switch(t){case`n`:r+=`
838
+ `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;case`'`:r+=`'`;break;default:r+=t}n+=2}else r+=e[n],n++;e[n]===`'`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}function xC(e,t){if(e.slice(t,t+2)!==`$"`)return null;let n=t+2,r=``;for(;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(r+=e[n+1],n+=2):(r+=e[n],n++);e[n]===`"`&&n++;let i=Number.parseInt(r,10);return{expr:{type:`ArithNumber`,value:Number.isNaN(i)?0:i},pos:n}}var SC,CC=S(()=>{SC=[`=`,`+=`,`-=`,`*=`,`/=`,`%=`,`<<=`,`>>=`,`&=`,`|=`,`^=`]});function wC(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);n<e.length&&n++}else t+=e[n],n++;return t}function TC(e,t){let n=wC(t),{expr:r,pos:i}=OC(e,n,0),a=_C(n,i);if(a<n.length){let e=t.slice(a).trim();if(e)return{type:`ArithmeticExpression`,originalText:t,expression:{type:`ArithSyntaxError`,errorToken:e,message:`${e}: syntax error: invalid arithmetic operator (error token is "${e}")`}}}return{type:`ArithmeticExpression`,expression:r,originalText:t}}function EC(e,t){return{expr:{type:`ArithSyntaxError`,errorToken:e,message:`syntax error: operand expected (error token is "${e}")`},pos:t}}function DC(e,t){return _C(e,t)>=e.length}function OC(e,t,n){return kC(e,t,n)}function kC(e,t,n){let{expr:r,pos:i}=AC(e,t,n);for(i=_C(t,i);t[i]===`,`;){if(i++,DC(t,i))return EC(`,`,i);let{expr:n,pos:a}=AC(e,t,i);r={type:`ArithBinary`,operator:`,`,left:r,right:n},i=_C(t,a)}return{expr:r,pos:i}}function AC(e,t,n){let{expr:r,pos:i}=jC(e,t,n);if(i=_C(t,i),t[i]===`?`){i++;let{expr:n,pos:a}=OC(e,t,i);if(i=_C(t,a),t[i]===`:`){i++;let{expr:a,pos:o}=OC(e,t,i);return{expr:{type:`ArithTernary`,condition:r,consequent:n,alternate:a},pos:o}}}return{expr:r,pos:i}}function jC(e,t,n){let{expr:r,pos:i}=MC(e,t,n);for(;i=_C(t,i),t.slice(i,i+2)===`||`;){if(i+=2,DC(t,i))return EC(`||`,i);let{expr:n,pos:a}=MC(e,t,i);r={type:`ArithBinary`,operator:`||`,left:r,right:n},i=a}return{expr:r,pos:i}}function MC(e,t,n){let{expr:r,pos:i}=NC(e,t,n);for(;i=_C(t,i),t.slice(i,i+2)===`&&`;){if(i+=2,DC(t,i))return EC(`&&`,i);let{expr:n,pos:a}=NC(e,t,i);r={type:`ArithBinary`,operator:`&&`,left:r,right:n},i=a}return{expr:r,pos:i}}function NC(e,t,n){let{expr:r,pos:i}=PC(e,t,n);for(;i=_C(t,i),t[i]===`|`&&t[i+1]!==`|`;){if(i++,DC(t,i))return EC(`|`,i);let{expr:n,pos:a}=PC(e,t,i);r={type:`ArithBinary`,operator:`|`,left:r,right:n},i=a}return{expr:r,pos:i}}function PC(e,t,n){let{expr:r,pos:i}=FC(e,t,n);for(;i=_C(t,i),t[i]===`^`;){if(i++,DC(t,i))return EC(`^`,i);let{expr:n,pos:a}=FC(e,t,i);r={type:`ArithBinary`,operator:`^`,left:r,right:n},i=a}return{expr:r,pos:i}}function FC(e,t,n){let{expr:r,pos:i}=IC(e,t,n);for(;i=_C(t,i),t[i]===`&`&&t[i+1]!==`&`;){if(i++,DC(t,i))return EC(`&`,i);let{expr:n,pos:a}=IC(e,t,i);r={type:`ArithBinary`,operator:`&`,left:r,right:n},i=a}return{expr:r,pos:i}}function IC(e,t,n){let{expr:r,pos:i}=LC(e,t,n);for(;i=_C(t,i),t.slice(i,i+2)===`==`||t.slice(i,i+2)===`!=`;){let n=t.slice(i,i+2);if(i+=2,DC(t,i))return EC(n,i);let{expr:a,pos:o}=LC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function LC(e,t,n){let{expr:r,pos:i}=RC(e,t,n);for(;;)if(i=_C(t,i),t.slice(i,i+2)===`<=`||t.slice(i,i+2)===`>=`){let n=t.slice(i,i+2);if(i+=2,DC(t,i))return EC(n,i);let{expr:a,pos:o}=RC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else if(t[i]===`<`||t[i]===`>`){let n=t[i];if(i++,DC(t,i))return EC(n,i);let{expr:a,pos:o}=RC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function RC(e,t,n){let{expr:r,pos:i}=zC(e,t,n);for(;i=_C(t,i),t.slice(i,i+2)===`<<`||t.slice(i,i+2)===`>>`;){let n=t.slice(i,i+2);if(i+=2,DC(t,i))return EC(n,i);let{expr:a,pos:o}=zC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function zC(e,t,n){let{expr:r,pos:i}=BC(e,t,n);for(;i=_C(t,i),(t[i]===`+`||t[i]===`-`)&&t[i+1]!==t[i];){let n=t[i];if(i++,DC(t,i))return EC(n,i);let{expr:a,pos:o}=BC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}return{expr:r,pos:i}}function BC(e,t,n){let{expr:r,pos:i}=VC(e,t,n);for(;;)if(i=_C(t,i),t[i]===`*`&&t[i+1]!==`*`){if(i++,DC(t,i))return EC(`*`,i);let{expr:n,pos:a}=VC(e,t,i);r={type:`ArithBinary`,operator:`*`,left:r,right:n},i=a}else if(t[i]===`/`||t[i]===`%`){let n=t[i];if(i++,DC(t,i))return EC(n,i);let{expr:a,pos:o}=VC(e,t,i);r={type:`ArithBinary`,operator:n,left:r,right:a},i=o}else break;return{expr:r,pos:i}}function VC(e,t,n){let{expr:r,pos:i}=HC(e,t,n),a=_C(t,i);if(t.slice(a,a+2)===`**`){if(a+=2,DC(t,a))return EC(`**`,a);let{expr:n,pos:i}=VC(e,t,a);return{expr:{type:`ArithBinary`,operator:`**`,left:r,right:n},pos:i}}return{expr:r,pos:i}}function HC(e,t,n){let r=_C(t,n);if(t.slice(r,r+2)===`++`||t.slice(r,r+2)===`--`){let n=t.slice(r,r+2);r+=2;let{expr:i,pos:a}=HC(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}if(t[r]===`+`||t[r]===`-`||t[r]===`!`||t[r]===`~`){let n=t[r];r++;let{expr:i,pos:a}=HC(e,t,r);return{expr:{type:`ArithUnary`,operator:n,operand:i,prefix:!0},pos:a}}return WC(e,t,r)}function UC(e,t){let n=e[t];return n===`$`||n==="`"}function WC(e,t,n){let{expr:r,pos:i}=GC(e,t,n,!1),a=[r];for(;UC(t,i);){let{expr:n,pos:r}=GC(e,t,i,!0);a.push(n),i=r}a.length>1&&(r={type:`ArithConcat`,parts:a});let o;if(t[i]===`[`&&r.type===`ArithConcat`){i++;let{expr:n,pos:r}=OC(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(o&&r.type===`ArithConcat`&&(r={type:`ArithDynamicElement`,nameExpr:r,subscript:o},o=void 0),i=_C(t,i),r.type===`ArithConcat`||r.type===`ArithVariable`||r.type===`ArithDynamicElement`){for(let n of SC)if(t.slice(i,i+n.length)===n&&t.slice(i,i+n.length+1)!==`==`){i+=n.length;let{expr:a,pos:o}=AC(e,t,i);return r.type===`ArithDynamicElement`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r.nameExpr,subscript:r.subscript,value:a},pos:o}:r.type===`ArithConcat`?{expr:{type:`ArithDynamicAssignment`,operator:n,target:r,value:a},pos:o}:{expr:{type:`ArithAssignment`,operator:n,variable:r.name,value:a},pos:o}}}if(t.slice(i,i+2)===`++`||t.slice(i,i+2)===`--`){let e=t.slice(i,i+2);return i+=2,{expr:{type:`ArithUnary`,operator:e,operand:r,prefix:!1},pos:i}}return{expr:r,pos:i}}function GC(e,t,n,r=!1){let i=_C(t,n),a=yC(OC,e,t,i);if(a)return a;let o=bC(t,i);if(o)return o;let s=xC(t,i);if(s)return s;if(t.slice(i,i+2)===`$(`&&t[i+2]!==`(`){i+=2;let e=1,n=i;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,e>0&&i++;let r=t.slice(n,i);return i++,{expr:{type:`ArithCommandSubst`,command:r},pos:i}}if(t[i]==="`"){i++;let e=i;for(;i<t.length&&t[i]!=="`";)i++;let n=t.slice(e,i);return t[i]==="`"&&i++,{expr:{type:`ArithCommandSubst`,command:n},pos:i}}if(t[i]===`(`){i++;let{expr:n,pos:r}=OC(e,t,i);return i=_C(t,r),t[i]===`)`&&i++,{expr:{type:`ArithGroup`,expression:n},pos:i}}if(t[i]===`'`){i++;let e=``;for(;i<t.length&&t[i]!==`'`;)e+=t[i],i++;t[i]===`'`&&i++;let n=Number.parseInt(e,10);return{expr:{type:`ArithSingleQuote`,content:e,value:Number.isNaN(n)?0:n},pos:i}}if(t[i]===`"`){i++;let n=``;for(;i<t.length&&t[i]!==`"`;)t[i]===`\\`&&i+1<t.length?(n+=t[i+1],i+=2):(n+=t[i],i++);t[i]===`"`&&i++;let r=n.trim();if(!r)return{expr:{type:`ArithNumber`,value:0},pos:i};let{expr:a}=OC(e,r,0);return{expr:a,pos:i}}if(/[0-9]/.test(t[i])){let e=``,n=!1,r=!1;for(;i<t.length;){let a=t[i];if(n)if(/[0-9a-zA-Z@_]/.test(a))e+=a,i++;else break;else if(a===`#`)n=!0,e+=a,i++;else if(e===`0`&&(a===`x`||a===`X`)&&i+1<t.length&&/[0-9a-fA-F]/.test(t[i+1]))r=!0,e+=a,i++;else if(r&&/[0-9a-fA-F]/.test(a))e+=a,i++;else if(!r&&/[0-9]/.test(a))e+=a,i++;else break}if(i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=e;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: value too great for base (error token is "${n}")`},pos:i}}if(t[i]===`.`&&/[0-9]/.test(t[i+1]))throw new Lr(`${e}.${t[i+1]}...: syntax error: invalid arithmetic operator`);if(t[i]===`[`){let n=t.slice(i).trim();return{expr:{type:`ArithNumberSubscript`,number:e,errorToken:n},pos:t.length}}return{expr:{type:`ArithNumber`,value:vC(e)},pos:i}}if(t[i]===`$`&&t[i+1]===`{`){let e=i+2,n=1,r=e;for(;r<t.length&&n>0;)t[r]===`{`?n++:t[r]===`}`&&n--,n>0&&r++;let a=t.slice(e,r),o=r+1;if(t[o]===`#`){let e=o+1;for(;e<t.length&&/[0-9a-zA-Z@_]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicBase`,baseExpr:a,value:t.slice(o+1,e)},pos:e}}if(/[0-9]/.test(t[o])||t[o]===`x`||t[o]===`X`){let e=o;if(t[o]===`x`||t[o]===`X`)for(e++;e<t.length&&/[0-9a-fA-F]/.test(t[e]);)e++;else for(;e<t.length&&/[0-9]/.test(t[e]);)e++;return{expr:{type:`ArithDynamicNumber`,prefix:a,suffix:t.slice(o,e)},pos:e}}return i=o,{expr:{type:`ArithBracedExpansion`,content:a},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[0-9]/.test(t[i+1])){i++;let e=``;for(;i<t.length&&/[0-9]/.test(t[i]);)e+=t[i],i++;return{expr:{type:`ArithVariable`,name:e,hasDollarPrefix:!0},pos:i}}if(t[i]===`$`&&i+1<t.length&&/[*@#?\-!$]/.test(t[i+1])){let e=t[i+1];return i+=2,{expr:{type:`ArithSpecialVar`,name:e},pos:i}}let c=!1;if(t[i]===`$`&&i+1<t.length&&/[a-zA-Z_]/.test(t[i+1])&&(c=!0,i++),i<t.length&&/[a-zA-Z_]/.test(t[i])){let n=``;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)n+=t[i],i++;if(t[i]===`[`&&!r){i++;let a;if(t[i]===`'`||t[i]===`"`){let e=t[i];for(i++,a=``;i<t.length&&t[i]!==e;)a+=t[i],i++;t[i]===e&&i++,i=_C(t,i),t[i]===`]`&&i++}let o;if(a===void 0){let{expr:n,pos:r}=OC(e,t,i);o=n,i=r,t[i]===`]`&&i++}if(i=_C(t,i),t[i]===`[`&&o)return{expr:{type:`ArithDoubleSubscript`,array:n,index:o},pos:i};if(!r){for(let r of SC)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:s,pos:c}=AC(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,subscript:o,stringKey:a,value:s},pos:c}}}return{expr:{type:`ArithArrayElement`,array:n,index:o,stringKey:a},pos:i}}if(i=_C(t,i),!r){for(let r of SC)if(t.slice(i,i+r.length)===r&&t.slice(i,i+r.length+1)!==`==`){i+=r.length;let{expr:a,pos:o}=AC(e,t,i);return{expr:{type:`ArithAssignment`,operator:r,variable:n,value:a},pos:o}}}return{expr:{type:`ArithVariable`,name:n,hasDollarPrefix:c},pos:i}}if(t[i]===`#`){let e=i+1;for(;e<t.length&&t[e]!==`
839
+ `;)e++;let n=t.slice(i,e).trim()||`#`;return{expr:{type:`ArithSyntaxError`,errorToken:n,message:`${n}: syntax error: invalid arithmetic operator (error token is "${n}")`},pos:t.length}}return{expr:{type:`ArithNumber`,value:0},pos:i}}var KC=S(()=>{A(),CC()});function qC(e){let t=``,n=0;for(;n<e.length;){let r=e[n];if(r<128){t+=String.fromCharCode(r),n++;continue}if((r&224)==192){if(n+1<e.length&&(e[n+1]&192)==128&&r>=194){let i=(r&31)<<6|e[n+1]&63;t+=String.fromCharCode(i),n+=2;continue}t+=String.fromCharCode(r),n++;continue}if((r&240)==224){if(n+2<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128){if(r===224&&e[n+1]<160){t+=String.fromCharCode(r),n++;continue}let i=(r&15)<<12|(e[n+1]&63)<<6|e[n+2]&63;if(i>=55296&&i<=57343){t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(i),n+=3;continue}t+=String.fromCharCode(r),n++;continue}if((r&248)==240&&r<=244){if(n+3<e.length&&(e[n+1]&192)==128&&(e[n+2]&192)==128&&(e[n+3]&192)==128){if(r===240&&e[n+1]<144){t+=String.fromCharCode(r),n++;continue}let i=(r&7)<<18|(e[n+1]&63)<<12|(e[n+2]&63)<<6|e[n+3]&63;if(i>1114111){t+=String.fromCharCode(r),n++;continue}t+=String.fromCodePoint(i),n+=4;continue}t+=String.fromCharCode(r),n++;continue}t+=String.fromCharCode(r),n++}return t}function JC(e,t,n){let r=n+1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;return r}function YC(e,t,n,r,i){let a=1,o=n+1;for(;o<t.length&&a>0;)t[o]===r?a++:t[o]===i&&a--,a>0&&o++;return a===0?o:-1}function XC(e,t,n){let r=n,i=1;for(;r<t.length&&i>0;){let e=t[r];if(e===`\\`&&r+1<t.length){r+=2;continue}if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++;continue}e===`{`?i++:e===`}`&&i--,i>0&&r++}return r}function ZC(e,t,n){let r=n,i=!1;for(;r<t.length;){let e=t[r];if(e===`/`&&i||e===`}`)break;if(e===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){r=e+1,i=!0;continue}}if(e===`"`){for(r++;r<t.length&&t[r]!==`"`;)t[r]===`\\`&&r+1<t.length?r+=2:r++;r<t.length&&r++,i=!0;continue}e===`\\`?(r+=2,i=!0):(r++,i=!0)}return r}function QC(e,t,n){let r=n,i=``;for(;r<t.length;){let e=t[r];if(e===`*`||e===`?`)i+=e,r++;else if(e===`[`){let n=$C(t,r);n===-1?(i+=e,r++):(i+=t.slice(r,n+1),r=n+1)}else break}return{pattern:i,endIndex:r}}function $C(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){let t=e[n];if(t===`\\`&&n+1<e.length){let t=e[n+1];if(t===`"`||t===`'`)return-1;n+=2;continue}if(t===`]`)return n;if(t===`"`||t===`$`||t==="`")return-1;if(t===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(t===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}if(t===`[`&&n+1<e.length&&(e[n+1]===`.`||e[n+1]===`=`)){let t=`${e[n+1]}]`,r=e.indexOf(t,n+2);if(r!==-1){n=r+2;continue}}n++}return-1}function ew(e,t,n){let r=``,i=n;for(;i<t.length&&t[i]!==`'`;){let e=t[i];if(e===`\\`&&i+1<t.length)switch(t[i+1]){case`n`:r+=`
840
+ `,i+=2;break;case`t`:r+=` `,i+=2;break;case`r`:r+=`\r`,i+=2;break;case`\\`:r+=`\\`,i+=2;break;case`'`:r+=`'`,i+=2;break;case`"`:r+=`"`,i+=2;break;case`a`:r+=`\x07`,i+=2;break;case`b`:r+=`\b`,i+=2;break;case`e`:case`E`:r+=`\x1B`,i+=2;break;case`f`:r+=`\f`,i+=2;break;case`v`:r+=`\v`,i+=2;break;case`x`:{let e=[],n=i;for(;n+1<t.length&&t[n]===`\\`&&t[n+1]===`x`;){let r=t.slice(n+2,n+4),i=parseInt(r,16);if(!Number.isNaN(i)&&r.length>0)e.push(i),n+=2+r.length;else break}e.length>0?(r+=qC(e),i=n):(r+=`\\x`,i+=2);break}case`u`:{let e=t.slice(i+2,i+6),n=parseInt(e,16);Number.isNaN(n)?(r+=`\\u`,i+=2):(r+=String.fromCharCode(n),i+=6);break}case`c`:if(i+2<t.length){let e=t[i+2].charCodeAt(0)&31;r+=String.fromCharCode(e),i+=3}else r+=`\\c`,i+=2;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let e=``,n=i+1;for(;n<t.length&&n<i+4&&/[0-7]/.test(t[n]);)e+=t[n],n++;let a=parseInt(e,8);r+=String.fromCharCode(a),i=n;break}default:r+=e,i++}else r+=e,i++}return i<t.length&&t[i]===`'`&&i++,{part:K.literal(r),endIndex:i}}function tw(e,t){let n=t.trim();return n===``?{type:`ArithmeticExpression`,expression:{type:`ArithNumber`,value:0}}:TC(e,n)}function nw(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`{`?(r++,n+=a):a===`}`?(r--,n+=a):a===`,`&&r===0?(t.push(n),n=``):n+=a}return t.push(n),t}function rw(e,t,n,r){let i=YC(e,t,n,`{`,`}`);if(i===-1)return null;let a=t.slice(n+1,i),o=a.match(/^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/);if(o)return{part:{type:`BraceExpansion`,items:[{type:`Range`,start:Number.parseInt(o[1],10),end:Number.parseInt(o[2],10),step:o[3]?Number.parseInt(o[3],10):void 0,startStr:o[1],endStr:o[2]}]},endIndex:i+1};let s=a.match(/^([a-zA-Z])\.\.([a-zA-Z])(?:\.\.(-?\d+))?$/);return s?{part:{type:`BraceExpansion`,items:[{type:`Range`,start:s[1],end:s[2],step:s[3]?Number.parseInt(s[3],10):void 0}]},endIndex:i+1}:a.includes(`,`)&&r?{part:{type:`BraceExpansion`,items:nw(a).map(t=>({type:`Word`,word:K.word(r(e,t,!1,!1,!1))}))},endIndex:i+1}:a.includes(`,`)?{part:{type:`BraceExpansion`,items:nw(a).map(e=>({type:`Word`,word:K.word([K.literal(e)])}))},endIndex:i+1}:null}function iw(e,t){let n=``;for(let r of t.parts)switch(r.type){case`Literal`:n+=r.value;break;case`SingleQuoted`:n+=`'${r.value}'`;break;case`Escaped`:n+=r.value;break;case`DoubleQuoted`:n+=`"`;for(let e of r.parts)e.type===`Literal`||e.type===`Escaped`?n+=e.value:e.type===`ParameterExpansion`&&(n+=`\${${e.parameter}}`);n+=`"`;break;case`ParameterExpansion`:n+=`\${${r.parameter}}`;break;case`Glob`:n+=r.pattern;break;case`TildeExpansion`:n+=`~`,r.user&&(n+=r.user);break;case`BraceExpansion`:{n+=`{`;let t=[];for(let n of r.items)if(n.type===`Range`){let e=n.startStr??String(n.start),r=n.endStr??String(n.end);n.step===void 0?t.push(`${e}..${r}`):t.push(`${e}..${r}..${n.step}`)}else t.push(iw(e,n.word));t.length===1&&r.items[0].type===`Range`?n+=t[0]:n+=t.join(`,`),n+=`}`;break}default:n+=r.type}return n}function aw(e,t){return{[G.LESS]:`<`,[G.GREAT]:`>`,[G.DGREAT]:`>>`,[G.LESSAND]:`<&`,[G.GREATAND]:`>&`,[G.LESSGREAT]:`<>`,[G.CLOBBER]:`>|`,[G.TLESS]:`<<<`,[G.AND_GREAT]:`&>`,[G.AND_DGREAT]:`&>>`,[G.DLESS]:`<`,[G.DLESSDASH]:`<`}[t]||`>`}var ow=S(()=>{gC(),KC(),oC()});function sw(e){let t=e.current(),n=t.type;if(n===G.NUMBER){let n=e.peek(1);return t.end===n.start?fC.has(n.type):!1}if(n===G.FD_VARIABLE){let t=e.peek(1);return pC.has(t.type)}return dC.has(n)}function cw(e){let t=null,n;e.check(G.NUMBER)?t=Number.parseInt(e.advance().value,10):e.check(G.FD_VARIABLE)&&(n=e.advance().value);let r=e.advance(),i=aw(e,r.type);if(r.type===G.DLESS||r.type===G.DLESSDASH)return lw(e,i,t,r.type===G.DLESSDASH);e.isWord()||e.error(`Expected redirection target`);let a=e.parseWord();return K.redirection(i,a,t,n)}function lw(e,t,n,r){e.isWord()||e.error(`Expected here-document delimiter`);let i=e.advance(),a=i.value,o=i.quoted||!1;(a.startsWith(`'`)&&a.endsWith(`'`)||a.startsWith(`"`)&&a.endsWith(`"`))&&(a=a.slice(1,-1));let s=K.redirection(r?`<<-`:`<<`,K.hereDoc(a,K.word([]),r,o),n);return e.addPendingHeredoc(s,a,r,o),s}function uw(e){let t=e.current().line,n=[],r=null,i=[],a=[];for(;e.check(G.ASSIGNMENT_WORD)||sw(e);)e.checkIterationLimit(),e.check(G.ASSIGNMENT_WORD)?n.push(dw(e)):a.push(cw(e));if(e.isWord())r=e.parseWord();else if(n.length>0&&(e.check(G.DBRACK_START)||e.check(G.DPAREN_START))){let t=e.advance();r=K.word([K.literal(t.value)])}for(;(!e.isStatementEnd()||e.check(G.RBRACE))&&!e.check(G.PIPE,G.PIPE_AMP);)if(e.checkIterationLimit(),sw(e))a.push(cw(e));else if(e.check(G.RBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(G.LBRACE)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.check(G.DBRACK_END)){let t=e.advance();i.push(e.parseWordFromString(t.value,!1,!1))}else if(e.isWord())i.push(e.parseWord());else if(e.check(G.ASSIGNMENT_WORD)){let t=e.advance(),n=t.value,r=n.endsWith(`=`),a=n.endsWith(`=(`);if((r||a)&&(a||e.check(G.LPAREN))){let t=a?n.slice(0,-2):n.slice(0,-1);a||e.expect(G.LPAREN);let r=fw(e);e.expect(G.RPAREN);let o=`${t}=(${r.map(t=>iw(e,t)).join(` `)})`;i.push(e.parseWordFromString(o,!1,!1))}else i.push(e.parseWordFromString(n,t.quoted,t.singleQuoted))}else if(e.check(G.LPAREN))e.error("syntax error near unexpected token `('");else break;let o=K.simpleCommand(r,i,n,a);return o.line=t,o}function dw(e){let t=e.expect(G.ASSIGNMENT_WORD),n=t.value,r=n.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);r||e.error(`Invalid assignment: ${n}`);let i=r[0],a,o=i.length;if(n[o]===`[`){let t=0,r=o+1;for(;o<n.length;o++)if(n[o]===`[`)t++;else if(n[o]===`]`&&(t--,t===0))break;t!==0&&e.error(`Invalid assignment: ${n}`),a=n.slice(r,o),o++}let s=n[o]===`+`;s&&o++,n[o]!==`=`&&e.error(`Invalid assignment: ${n}`),o++;let c=n.slice(o);if(c===`(`){let t=fw(e);e.expect(G.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return K.assignment(n,null,s,t)}if(c===``&&e.check(G.LPAREN)){let n=e.current();if(t.end===n.start){e.advance();let t=fw(e);e.expect(G.RPAREN);let n=a===void 0?i:`${i}[${a}]`;return K.assignment(n,null,s,t)}}let l=c?e.parseWordFromString(c,t.quoted,t.singleQuoted,!0):null,u=a===void 0?i:`${i}[${a}]`;return K.assignment(u,l,s,null)}function fw(e){let t=[];for(e.skipNewlines();!e.check(G.RPAREN,G.EOF);)e.checkIterationLimit(),e.isWord()?t.push(e.parseWord()):pw.has(e.current().type)?e.error(`syntax error near unexpected token \`${e.current().value}'`):e.advance(),e.skipNewlines();return t}var pw,mw=S(()=>{gC(),oC(),hC(),ow(),pw=new Set([G.AMP,G.PIPE,G.PIPE_AMP,G.SEMICOLON,G.AND_AND,G.OR_OR,G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND])});function hw(e,t){e.expect(G.IF);let n=[],r=e.parseCompoundList();e.expect(G.THEN);let i=e.parseCompoundList();if(i.length===0){let t=e.check(G.FI)?`fi`:e.check(G.ELSE)?`else`:e.check(G.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}for(n.push({condition:r,body:i});e.check(G.ELIF);){e.advance();let t=e.parseCompoundList();e.expect(G.THEN);let r=e.parseCompoundList();if(r.length===0){let t=e.check(G.FI)?`fi`:e.check(G.ELSE)?`else`:e.check(G.ELIF)?`elif`:`fi`;e.error(`syntax error near unexpected token \`${t}'`)}n.push({condition:t,body:r})}let a=null;e.check(G.ELSE)&&(e.advance(),a=e.parseCompoundList(),a.length===0&&e.error("syntax error near unexpected token `fi'")),e.expect(G.FI);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.ifNode(n,a,o)}function gw(e,t){let n=e.expect(G.FOR);if(e.check(G.DPAREN_START))return _w(e,t,n.line);e.isWord()||e.error(`Expected variable name in for loop`);let r=e.advance().value,i=null;if(e.skipNewlines(),e.check(G.IN))for(e.advance(),i=[];!e.check(G.SEMICOLON,G.NEWLINE,G.DO,G.EOF)&&e.isWord();)i.push(e.parseWord());e.check(G.SEMICOLON)&&e.advance(),e.skipNewlines(),e.expect(G.DO);let a=e.parseCompoundList();e.expect(G.DONE);let o=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.forNode(r,i,a,o)}function _w(e,t,n){e.expect(G.DPAREN_START);let r=null,i=null,a=null,o=[``,``,``],s=0,c=0;for(;!e.check(G.DPAREN_END,G.EOF);){let t=e.advance();if(t.type===G.SEMICOLON&&c===0){if(s++,s>2)break}else t.value===`(`&&c++,t.value===`)`&&c--,o[s]+=t.value}e.expect(G.DPAREN_END),o[0].trim()&&(r=TC(e,o[0].trim())),o[1].trim()&&(i=TC(e,o[1].trim())),o[2].trim()&&(a=TC(e,o[2].trim())),e.skipNewlines(),e.check(G.SEMICOLON)&&e.advance(),e.skipNewlines();let l;e.check(G.LBRACE)?(e.advance(),l=e.parseCompoundList(),e.expect(G.RBRACE)):(e.expect(G.DO),l=e.parseCompoundList(),e.expect(G.DONE));let u=t?.skipRedirections?[]:e.parseOptionalRedirections();return{type:`CStyleFor`,init:r,condition:i,update:a,body:l,redirections:u,line:n}}function vw(e,t){e.expect(G.WHILE);let n=e.parseCompoundList();e.expect(G.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(G.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.whileNode(n,r,i)}function yw(e,t){e.expect(G.UNTIL);let n=e.parseCompoundList();e.expect(G.DO);let r=e.parseCompoundList();r.length===0&&e.error("syntax error near unexpected token `done'"),e.expect(G.DONE);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.untilNode(n,r,i)}function bw(e,t){e.expect(G.CASE),e.isWord()||e.error(`Expected word after 'case'`);let n=e.parseWord();e.skipNewlines(),e.expect(G.IN),e.skipNewlines();let r=[];for(;!e.check(G.ESAC,G.EOF);){e.checkIterationLimit();let t=e.getPos(),n=xw(e);if(n&&r.push(n),e.skipNewlines(),e.getPos()===t&&!n)break}e.expect(G.ESAC);let i=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.caseNode(n,r,i)}function xw(e){e.check(G.LPAREN)&&e.advance();let t=[];for(;e.isWord()&&(t.push(e.parseWord()),e.check(G.PIPE));)e.advance();if(t.length===0)return null;e.expect(G.RPAREN),e.skipNewlines();let n=[];for(;!e.check(G.DSEMI,G.SEMI_AND,G.SEMI_SEMI_AND,G.ESAC,G.EOF);){e.checkIterationLimit(),e.isWord()&&e.peek(1).type===G.RPAREN&&e.error("syntax error near unexpected token `)'"),e.check(G.LPAREN)&&e.peek(1).type===G.WORD&&e.error(`syntax error near unexpected token \`${e.peek(1).value}'`);let t=e.getPos(),r=e.parseStatement();if(r&&n.push(r),e.skipSeparators(!1),e.getPos()===t&&!r)break}let r=`;;`;return e.check(G.DSEMI)?(e.advance(),r=`;;`):e.check(G.SEMI_AND)?(e.advance(),r=`;&`):e.check(G.SEMI_SEMI_AND)&&(e.advance(),r=`;;&`),K.caseItem(t,n,r)}function Sw(e,t){e.expect(G.LPAREN);let n=e.parseCompoundList();e.expect(G.RPAREN);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.subshell(n,r)}function Cw(e,t){e.expect(G.LBRACE);let n=e.parseCompoundList();e.expect(G.RBRACE);let r=t?.skipRedirections?[]:e.parseOptionalRedirections();return K.group(n,r)}var ww=S(()=>{gC(),KC(),oC()});function Tw(e){return e.isWord()||e.check(G.LBRACE)||e.check(G.RBRACE)||e.check(G.ASSIGNMENT_WORD)}function Ew(e){if(e.check(G.BANG)&&e.peek(1).type===G.LPAREN){e.advance(),e.advance();let t=1,n=`!(`;for(;t>0&&!e.check(G.EOF);)if(e.check(G.LPAREN))t++,n+=`(`,e.advance();else if(e.check(G.RPAREN))t--,t>0&&(n+=`)`),e.advance();else if(e.isWord())n+=e.advance().value;else if(e.check(G.PIPE))n+=`|`,e.advance();else break;return n+=`)`,e.parseWordFromString(n,!1,!1,!1,!1,!0)}return e.parseWordNoBraceExpansion()}function Dw(e){return e.skipNewlines(),Ow(e)}function Ow(e){let t=kw(e);for(e.skipNewlines();e.check(G.OR_OR);){e.advance(),e.skipNewlines();let n=kw(e);t={type:`CondOr`,left:t,right:n},e.skipNewlines()}return t}function kw(e){let t=Aw(e);for(e.skipNewlines();e.check(G.AND_AND);){e.advance(),e.skipNewlines();let n=Aw(e);t={type:`CondAnd`,left:t,right:n},e.skipNewlines()}return t}function Aw(e){return e.skipNewlines(),e.check(G.BANG)?(e.advance(),e.skipNewlines(),{type:`CondNot`,operand:Aw(e)}):jw(e)}function jw(e){if(e.check(G.LPAREN)){e.advance();let t=Dw(e);return e.expect(G.RPAREN),{type:`CondGroup`,expression:t}}if(Tw(e)){let t=e.current(),n=t.value;if(Nw.includes(n)&&!t.quoted){if(e.advance(),e.check(G.DBRACK_END)&&e.error(`Expected operand after ${n}`),Tw(e))return{type:`CondUnary`,operator:n,operand:e.parseWordNoBraceExpansion()};let t=e.current();e.error(`unexpected argument \`${t.value}' to conditional unary operator`)}let r=e.parseWordNoBraceExpansion();if(e.isWord()&&Pw.includes(e.current().value)){let t=e.advance().value,n;return n=t===`=~`?Mw(e):t===`==`||t===`!=`?Ew(e):e.parseWordNoBraceExpansion(),{type:`CondBinary`,operator:t,left:r,right:n}}return e.check(G.LESS)?(e.advance(),{type:`CondBinary`,operator:`<`,left:r,right:e.parseWordNoBraceExpansion()}):e.check(G.GREAT)?(e.advance(),{type:`CondBinary`,operator:`>`,left:r,right:e.parseWordNoBraceExpansion()}):e.isWord()&&e.current().value===`=`?(e.advance(),{type:`CondBinary`,operator:`==`,left:r,right:Ew(e)}):{type:`CondWord`,word:r}}e.error(`Expected conditional expression`)}function Mw(e){let t=[],n=0,r=-1,i=e.getInput(),a=()=>e.check(G.DBRACK_END)||e.check(G.AND_AND)||e.check(G.OR_OR)||e.check(G.NEWLINE)||e.check(G.EOF);for(;!a();){let a=e.current(),o=r>=0&&a.start>r;if(n===0&&o)break;if(n>0&&o){let e=i.slice(r,a.start);t.push({type:`Literal`,value:e})}if(e.isWord()||e.check(G.ASSIGNMENT_WORD)){let n=e.parseWordForRegex();t.push(...n.parts),r=e.peek(-1).end}else if(e.check(G.LPAREN)){let i=e.advance();t.push({type:`Literal`,value:`(`}),n++,r=i.end}else if(e.check(G.DPAREN_START)){let i=e.advance();t.push({type:`Literal`,value:`((`}),n+=2,r=i.end}else if(e.check(G.DPAREN_END))if(n>=2){let i=e.advance();t.push({type:`Literal`,value:`))`}),n-=2,r=i.end}else{if(n===1)break;break}else if(e.check(G.RPAREN))if(n>0){let i=e.advance();t.push({type:`Literal`,value:`)`}),n--,r=i.end}else break;else if(e.check(G.PIPE)){let n=e.advance();t.push({type:`Literal`,value:`|`}),r=n.end}else if(e.check(G.SEMICOLON))if(n>0){let n=e.advance();t.push({type:`Literal`,value:`;`}),r=n.end}else break;else if(n>0&&e.check(G.LESS)){let n=e.advance();t.push({type:`Literal`,value:`<`}),r=n.end}else if(n>0&&e.check(G.GREAT)){let n=e.advance();t.push({type:`Literal`,value:`>`}),r=n.end}else if(n>0&&e.check(G.DGREAT)){let n=e.advance();t.push({type:`Literal`,value:`>>`}),r=n.end}else if(n>0&&e.check(G.DLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<`}),r=n.end}else if(n>0&&e.check(G.LESSAND)){let n=e.advance();t.push({type:`Literal`,value:`<&`}),r=n.end}else if(n>0&&e.check(G.GREATAND)){let n=e.advance();t.push({type:`Literal`,value:`>&`}),r=n.end}else if(n>0&&e.check(G.LESSGREAT)){let n=e.advance();t.push({type:`Literal`,value:`<>`}),r=n.end}else if(n>0&&e.check(G.CLOBBER)){let n=e.advance();t.push({type:`Literal`,value:`>|`}),r=n.end}else if(n>0&&e.check(G.TLESS)){let n=e.advance();t.push({type:`Literal`,value:`<<<`}),r=n.end}else if(n>0&&e.check(G.AMP)){let n=e.advance();t.push({type:`Literal`,value:`&`}),r=n.end}else if(n>0&&e.check(G.LBRACE)){let n=e.advance();t.push({type:`Literal`,value:`{`}),r=n.end}else if(n>0&&e.check(G.RBRACE)){let n=e.advance();t.push({type:`Literal`,value:`}`}),r=n.end}else break}return t.length===0&&e.error(`Expected regex pattern after =~`),{type:`Word`,parts:t}}var Nw,Pw,Fw=S(()=>{oC(),Nw=`-a.-b.-c.-d.-e.-f.-g.-h.-k.-p.-r.-s.-t.-u.-w.-x.-G.-L.-N.-O.-S.-z.-n.-o.-v.-R`.split(`.`),Pw=[`==`,`!=`,`=~`,`<`,`>`,`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`,`-nt`,`-ot`,`-ef`]});function Iw(e){return e.length>0?e:[K.literal(``)]}function Lw(e,t){let n=1,r=t+1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`){r+=2;continue}if(`@*+?!`.includes(t)&&r+1<e.length&&e[r+1]===`(`){r++,n++,r++;continue}if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r;r++}return-1}function Rw(e,t,n){let r=n+1,i=t[r];if(`@*#?$!-0123456789`.includes(i))return{part:K.parameterExpansion(i),endIndex:r+1};let a=``;for(;r<t.length&&/[a-zA-Z0-9_]/.test(t[r]);)a+=t[r],r++;return{part:K.parameterExpansion(a),endIndex:r}}function zw(e,t,n,r=!1){let i=n+2,a=!1;t[i]===`!`&&(a=!0,i++);let o=!1;t[i]===`#`&&!/[}:#%/^,]/.test(t[i+1]||`}`)&&(o=!0,i++);let s=``,c=t[i];if(/[@*#?$!-]/.test(c)&&!/[a-zA-Z0-9_]/.test(t[i+1]||``))s=c,i++;else for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)s+=t[i],i++;if(t[i]===`[`){let r=YC(e,t,i,`[`,`]`);if(s+=t.slice(i,r+1),i=r+1,t[i]===`[`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;let a=t.slice(n+2,r);return{part:K.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}}if(s===``&&!a&&!o&&t[i]!==`}`){let e=1,r=i;for(;r<t.length&&e>0;)t[r]===`{`?e++:t[r]===`}`&&e--,e>0&&r++;if(e>0)throw new mC(`unexpected EOF while looking for matching '}'`,0,0);let a=t.slice(n+2,r);return{part:K.parameterExpansion(``,{type:`BadSubstitution`,text:a}),endIndex:r+1}}let l=null;if(a){let n=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n)if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let a=Bw(e,t,i,s,r);a.operation?(l={type:`Indirection`,innerOp:a.operation},i=a.endIndex):(l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``)}else l={type:`ArrayKeys`,array:n[1],star:n[2]===`*`},s=``;else if(t[i]===`*`||t[i]===`@`&&!/[QPaAEKkuUL]/.test(t[i+1]||``)){let e=t[i];i++,l={type:`VarNamePrefix`,prefix:s,star:e===`*`},s=``}else if(i<t.length&&t[i]!==`}`&&/[:=\-+?#%/^,@]/.test(t[i])){let n=Bw(e,t,i,s,r);n.operation?(l={type:`Indirection`,innerOp:n.operation},i=n.endIndex):l={type:`Indirection`}}else l={type:`Indirection`}}else if(o)if(t[i]===`:`)for(l={type:`LengthSliceError`};i<t.length&&t[i]!==`}`;)i++;else t[i]!==`}`&&/[-+=?]/.test(t[i])||t[i]===`/`?e.error(`\${#${s}${t.slice(i,t.indexOf(`}`,i))}}: bad substitution`):l={type:`Length`};if(!l&&i<t.length&&t[i]!==`}`){let n=Bw(e,t,i,s,r);l=n.operation,i=n.endIndex}if(i<t.length&&t[i]!==`}`){let r=t[i];if(!/[:\-+=?#%/^,@[]/.test(r)){let r=i;for(;r<t.length&&t[r]!==`}`;)r++;let a=t.slice(n,r+1);e.error(`\${${a.slice(2,-1)}}: bad substitution`)}}for(;i<t.length&&t[i]!==`}`;)i++;if(i>=t.length)throw new mC(`unexpected EOF while looking for matching '}'`,0,0);return{part:K.parameterExpansion(s,l),endIndex:i+1}}function Bw(e,t,n,r,i=!1){let a=n,o=t[a],s=t[a+1]||``;if(o===`:`){let n=s;if(`-=?+`.includes(n)){a+=2;let r=XC(e,t,a),o=Ww(e,t.slice(a,r),!1,!1,!0,!1,i,!1,!1,!0),s=K.word(Iw(o));if(n===`-`)return{operation:{type:`DefaultValue`,word:s,checkEmpty:!0},endIndex:r};if(n===`=`)return{operation:{type:`AssignDefault`,word:s,checkEmpty:!0},endIndex:r};if(n===`?`)return{operation:{type:`ErrorIfUnset`,word:s,checkEmpty:!0},endIndex:r};if(n===`+`)return{operation:{type:`UseAlternative`,word:s,checkEmpty:!0},endIndex:r}}a++;let r=XC(e,t,a),o=t.slice(a,r),c=-1,l=0,u=0;for(let e=0;e<o.length;e++){let t=o[e];if(t===`(`||t===`[`)l++;else if(t===`)`||t===`]`)l--;else if(t===`?`&&l===0)u++;else if(t===`:`&&l===0)if(u>0)u--;else{c=e;break}}let d=c>=0?o.slice(0,c):o,f=c>=0?o.slice(c+1):null;return{operation:{type:`Substring`,offset:tw(e,d),length:f===null?null:tw(e,f)},endIndex:r}}if(`-=?+`.includes(o)){a++;let n=XC(e,t,a),r=t.slice(a,n),s=Ww(e,r,!1,!1,!0,!1,i,!1,!1,!0),c=K.word(Iw(s));if(o===`-`)return{operation:{type:`DefaultValue`,word:c,checkEmpty:!1},endIndex:n};if(o===`=`)return{operation:{type:`AssignDefault`,word:c,checkEmpty:!1},endIndex:n};if(o===`?`)return{operation:{type:`ErrorIfUnset`,word:r?c:null,checkEmpty:!1},endIndex:n};if(o===`+`)return{operation:{type:`UseAlternative`,word:c,checkEmpty:!1},endIndex:n}}if(o===`#`||o===`%`){let n=s===o,r=o===`#`?`prefix`:`suffix`;a+=n?2:1;let i=XC(e,t,a),c=Ww(e,t.slice(a,i),!1,!1,!1);return{operation:{type:`PatternRemoval`,pattern:K.word(Iw(c)),side:r,greedy:n},endIndex:i}}if(o===`/`){let n=s===`/`;a+=n?2:1;let r=null;t[a]===`#`?(r=`start`,a++):t[a]===`%`&&(r=`end`,a++);let i;i=r!==null&&(t[a]===`/`||t[a]===`}`)?a:ZC(e,t,a);let o=Ww(e,t.slice(a,i),!1,!1,!1),c=K.word(Iw(o)),l=null,u=i;if(t[i]===`/`){let n=i+1,r=XC(e,t,n),a=Ww(e,t.slice(n,r),!1,!1,!1);l=K.word(Iw(a)),u=r}return{operation:{type:`PatternReplacement`,pattern:c,replacement:l,all:n,anchor:r},endIndex:u}}if(o===`^`||o===`,`){let n=s===o,r=o===`^`?`upper`:`lower`;a+=n?2:1;let i=XC(e,t,a),c=t.slice(a,i);return{operation:{type:`CaseModification`,direction:r,all:n,pattern:c?K.word([K.literal(c)]):null},endIndex:i}}return o===`@`&&/[QPaAEKkuUL]/.test(s)?{operation:{type:`Transform`,operator:s},endIndex:a+2}:{operation:null,endIndex:a}}function Vw(e,t,n,r=!1){let i=n+1;if(i>=t.length)return{part:K.literal(`$`),endIndex:i};let a=t[i];if(a===`(`&&t[i+1]===`(`)return e.isDollarDparenSubshell(t,n)?e.parseCommandSubstitution(t,n):e.parseArithmeticExpansion(t,n);if(a===`[`){let n=1,r=i+1;for(;r<t.length&&n>0;)t[r]===`[`?n++:t[r]===`]`&&n--,n>0&&r++;if(n===0){let n=TC(e,t.slice(i+1,r));return{part:K.arithmeticExpansion(n),endIndex:r+1}}}return a===`(`?e.parseCommandSubstitution(t,n):a===`{`?zw(e,t,n,r):/[a-zA-Z_0-9@*#?$!-]/.test(a)?Rw(e,t,n):{part:K.literal(`$`),endIndex:i}}function Hw(e,t){let n=[],r=0,i=``,a=()=>{i&&=(n.push(K.literal(i)),``)};for(;r<t.length;){let o=t[r];if(o===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`"`||e===`\\`){i+=e,r+=2;continue}i+=o,r++;continue}if(o===`$`){a();let{part:i,endIndex:o}=Vw(e,t,r,!0);i&&n.push(i),r=o;continue}if(o==="`"){a();let{part:i,endIndex:o}=e.parseBacktickSubstitution(t,r,!0);n.push(i),r=o;continue}i+=o,r++}return a(),n}function Uw(e,t,n){let r=[],i=n,a=``,o=()=>{a&&=(r.push(K.literal(a)),``)};for(;i<t.length&&t[i]!==`"`;){let n=t[i];if(n===`\\`&&i+1<t.length){let e=t[i+1];if(`"\\$\`
841
+ `.includes(e)){a+=e,i+=2;continue}a+=n,i++;continue}if(n===`$`){o();let{part:n,endIndex:a}=Vw(e,t,i,!0);n&&r.push(n),i=a;continue}if(n==="`"){o();let{part:n,endIndex:a}=e.parseBacktickSubstitution(t,i,!0);r.push(n),i=a;continue}a+=n,i++}return o(),{part:K.doubleQuoted(r),endIndex:i}}function Ww(e,t,n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1){if(r)return[K.singleQuoted(t)];if(n){let n=Hw(e,t);return[K.doubleQuoted(n)]}if(t.length>=2&&t[0]===`"`&&t[t.length-1]===`"`){let n=t.slice(1,-1),r=!1;for(let e=0;e<n.length;e++){if(n[e]===`"`){r=!0;break}n[e]===`\\`&&e+1<n.length&&e++}if(!r){let t=Hw(e,n);return[K.doubleQuoted(t)]}}let u=[],d=0,f=``,p=()=>{f&&=(u.push(K.literal(f)),``)};for(;d<t.length;){let n=t[d];if(n===`\\`&&d+1<t.length){let e=t[d+1];if(c){p(),u.push(K.escaped(e)),d+=2;continue}let n=a?e===`$`||e==="`"||e===`
842
842
  `:e===`$`||e==="`"||e===`"`||e===`'`||e===`
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}=Iw(e,t,d+1);u.push(n),d=r+1;continue}if(n===`$`&&t[d+1]===`'`){p();let{part:n,endIndex:r}=qC(e,t,d+2);u.push(n),d=r;continue}if(n===`$`){p();let{part:n,endIndex:r}=Pw(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=VC(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=Aw(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}=GC(e,t,d);u.push({type:`Glob`,pattern:n}),d=r;continue}if(n===`{`&&!i&&!s&&!a){let n=XC(e,t,d,Lw);if(n){p(),u.push(n.part),d=n.endIndex;continue}}f+=n,d++}return p(),u}var Rw=S(()=>{lC(),zC(),cC(),$C()});function zw(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 Bw(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 Vw(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===`
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 Hw=S(()=>{lC()});function Uw(e,t){return new Ww().parse(e,t)}var Ww,Gw=S(()=>{lC(),zC(),sw(),_w(),Ow(),Rw(),$S(),Hw(),cC(),cC(),Ww=class e{tokens=[];pos=0;pendingHeredocs=[];parseIterations=0;parseDepth=0;_input=``;getInput(){return this._input}checkIterationLimit(){if(this.parseIterations++,this.parseIterations>nC)throw new sC(`Maximum parse iterations exceeded (possible infinite loop)`,this.current().line,this.current().column)}enterDepth(){if(this.parseDepth++,this.parseDepth>rC)throw new sC(`Maximum parser nesting depth exceeded (${rC})`,this.current().line,this.current().column);return()=>{this.parseDepth--}}parse(e,t){if(e.length>eC)throw new sC(`Input too large: ${e.length} bytes exceeds limit of ${eC}`,1,1);if(this._input=e,this.tokens=new QS(e,t).tokenize(),this.tokens.length>tC)throw new sC(`Too many tokens: ${this.tokens.length} exceeds limit of ${tC}`,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 sC(t||`Expected ${e}, got ${n.type}`,n.line,n.column,n)}error(e){let t=this.current();throw new sC(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)?cw(this):this.check(G.FOR)?lw(this):this.check(G.WHILE)?dw(this):this.check(G.UNTIL)?fw(this):this.check(G.CASE)?pw(this):this.check(G.LPAREN)?hw(this):this.check(G.LBRACE)?gw(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():rw(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=Lw(this,e,t,n,r,i,!1,a,o);return K.word(s)}parseCommandSubstitution(t,n){return Bw(t,n,()=>new e,e=>this.error(e))}parseBacktickSubstitution(t,n,r=!1){return Vw(t,n,r,()=>new e,e=>this.error(e))}isDollarDparenSubshell(e,t){return zw(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=bw(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 sC(`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 gw(this,{skipRedirections:t});if(this.check(G.LPAREN))return hw(this,{skipRedirections:t});if(this.check(G.IF))return cw(this,{skipRedirections:t});if(this.check(G.FOR))return lw(this,{skipRedirections:t});if(this.check(G.WHILE))return dw(this,{skipRedirections:t});if(this.check(G.UNTIL))return fw(this,{skipRedirections:t});if(this.check(G.CASE))return pw(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(;ew(this);){this.checkIterationLimit();let t=this.pos;if(e.push(tw(this)),this.pos===t)break}return e}parseArithmeticExpression(e){return vC(this,e)}}});function Kw(e){return Zw.get(e)??``}function qw(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 Jw(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=Kw(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+=`$`,R(t)}function Yw(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 Xw(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 Zw,Qw=S(()=>{Ss(),Zw=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`]])}),$w,eT,tT=S(()=>{A(),Ss(),vr(),Qw(),$w=5,eT=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=qw(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 Jw(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>$w))throw new k(`Glob pattern has too many ** segments (max ${$w})`,`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 R(`^${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=Yw(e,r+1);if(n!==-1){let a=Xw(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=Kw(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=Yw(e,n+1);if(r!==-1){if(i===`@`){let i=Xw(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 nT(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 rT(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 iT(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 aT(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),rT(c)&&(t=!0),(c.operation?.type===`VarNamePrefix`||c.operation?.type===`ArrayKeys`)&&(o=!0),c.operation?.type===`Indirection`&&(s=!0)),c.type===`Glob`&&nT(c.pattern)&&(a=!0)}return{hasQuoted:t,hasCommandSub:n,hasArrayVar:r,hasArrayAtExpansion:i,hasParamExpansion:a,hasVarNamePrefixExpansion:o,hasIndirection:s}}var oT=S(()=>{});function sT(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 cT(e,t){let n=`${t}_`;for(let t of e.state.env.keys())t.startsWith(n)&&e.state.env.delete(t)}function lT(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 uT(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)?e.slice(1,-1):e}function dT(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=uT(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:fT(n)}):c.push(n)}return{key:r,valueParts:c,append:s}}function fT(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 pT(e.word)}).join(`,`)}}`}function pT(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}`:``}`:pT(e.word)).join(`,`),t+=`}`;break;case`TildeExpansion`:t+=`~`,n.user&&(t+=n.user);break}return t}var mT=S(()=>{});function hT(e){return e.get(`IFS`)??`
846
- `}function gT(e){return e.get(`IFS`)===``}function _T(e){let t=hT(e);if(t===``)return!0;for(let e of t)if(e!==` `&&e!==` `&&e!==`
847
- `)return!1;return!0}function vT(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
- `?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 yT(e){return ET.includes(e)}function bT(e){let t=new Set,n=new Set;for(let r of e)yT(r)?t.add(r):n.add(r);return{whitespace:t,nonWhitespace:n}}function xT(e,t,n,r){if(t===``)return e===``?{words:[],wordStarts:[]}:{words:[e],wordStarts:[0]};let{whitespace:i,nonWhitespace:a}=bT(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 ST(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}=bT(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 CT(e,t){return ST(e,t).words}function wT(e,t){for(let n of e)if(t.has(n))return!0;return!1}function TT(e,t,n){if(t===``)return e;let{whitespace:r,nonWhitespace:i}=bT(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(!wT(e,i))return e}return o}var ET,DT=S(()=>{ET=`
849
- `});function OT(e,t){return e.state.namerefs?.has(t)??!1}function kT(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function AT(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function jT(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function MT(e,t){return e.state.invalidNamerefs?.has(t)??!1}function NT(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function PT(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&!e.includes(`__`)),i=e.state.associativeArrays?.has(t)??!1;return r||i}return Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&!e.includes(`__`))?!0:e.state.env.has(t)}function FT(e,t,n=100){if(!OT(e,t)||MT(e,t))return t;let r=new Set,i=t;for(;n-- >0;){if(r.has(i))return;if(r.add(i),!OT(e,i))return i;let t=e.state.env.get(i);if(t===void 0||t===``||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t))return i;i=t}}function IT(e,t){if(OT(e,t))return e.state.env.get(t)}function LT(e,t,n,r=100){if(!OT(e,t)||MT(e,t))return t;let i=new Set,a=t;for(;r-- >0;){if(i.has(a))return;if(i.add(a),!OT(e,a))return a;let t=e.state.env.get(a);if(t===void 0||t===``)return n===void 0||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&PT(e,n)?a:null;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t))return a;a=t}}var RT=S(()=>{});function zT(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(t,n)=>e.state.env.get(n)??``);return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,n)=>e.state.env.get(n)??``),n}function J(e,t){return t===`FUNCNAME`?(e.state.funcNameStack??[]).map((e,t)=>[t,e]):t===`BASH_LINENO`?(e.state.callLineStack??[]).map((e,t)=>[t,String(e)]):t===`BASH_SOURCE`?(e.state.sourceStack??[]).map((e,t)=>[t,e]):e.state.associativeArrays?.has(t)?lT(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``]):sT(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``])}function BT(e,t){return t===`FUNCNAME`?(e.state.funcNameStack?.length??0)>0:t===`BASH_LINENO`?(e.state.callLineStack?.length??0)>0:t===`BASH_SOURCE`?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?lT(e,t).length>0:sT(e,t).length>0}async function VT(e,t,n=!0,r=!1){switch(t){case`?`:return String(e.state.lastExitCode);case`$`:return String(e.state.virtualPid);case`#`:return e.state.env.get(`#`)||`0`;case`@`:return e.state.env.get(`@`)||``;case`_`:return e.state.lastArg;case`-`:{let t=``;return t+=`h`,e.state.options.errexit&&(t+=`e`),e.state.options.noglob&&(t+=`f`),e.state.options.nounset&&(t+=`u`),e.state.options.verbose&&(t+=`v`),e.state.options.xtrace&&(t+=`x`),t+=`B`,e.state.options.noclobber&&(t+=`C`),t+=`s`,t}case`*`:{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(t===0)return``;let n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n.join(q(e.state.env))}case`0`:return e.state.env.get(`0`)||`bash`;case`PWD`:return e.state.env.get(`PWD`)??``;case`OLDPWD`:return e.state.env.get(`OLDPWD`)??``;case`PPID`:return String(e.state.virtualPpid);case`UID`:return String(e.state.virtualUid);case`EUID`:return String(e.state.virtualUid);case`RANDOM`:return String(Math.floor(Math.random()*32768));case`SECONDS`:return String(Math.floor((Date.now()-e.state.startTime)/1e3));case`BASH_VERSION`:return BS;case`!`:return String(e.state.lastBackgroundPid);case`BASHPID`:return String(e.state.bashPid);case`LINENO`:return String(e.state.currentLine);case`FUNCNAME`:{let t=e.state.funcNameStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new Fr(`FUNCNAME`);return``}case`BASH_LINENO`:{let t=e.state.callLineStack?.[0];if(t!==void 0)return String(t);if(n&&e.state.options.nounset)throw new Fr(`BASH_LINENO`);return``}case`BASH_SOURCE`:{let t=e.state.sourceStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new Fr(`BASH_SOURCE`);return``}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Rr(`\${${t}}`);let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let t=i[1],r=i[2];if(OT(e,t)){let n=FT(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return``;t=n}}if(r===`@`||r===`*`){let n=J(e,t);if(n.length>0)return n.map(([,e])=>e).join(` `);let r=e.state.env.get(t);return r===void 0?``:r}if(t===`FUNCNAME`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.funcNameStack?.[t]??``:``}if(t===`BASH_LINENO`){let t=Number.parseInt(r,10);if(!Number.isNaN(t)&&t>=0){let n=e.state.callLineStack?.[t];return n===void 0?``:String(n)}return``}if(t===`BASH_SOURCE`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.sourceStack?.[t]??``:``}if(e.state.associativeArrays?.has(t)){let i=uT(r);i=zT(e,i);let a=e.state.env.get(`${t}_${i}`);if(a===void 0&&n&&e.state.options.nounset)throw new Fr(`${t}[${r}]`);return a||``}let a;if(/^-?\d+$/.test(r))a=Number.parseInt(r,10);else try{a=await Z(e,vC(new Ww,r).expression)}catch{let t=e.state.env.get(r);a=t?Number.parseInt(t,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let n=J(e,t),r=e.state.currentLine;if(n.length===0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
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`)??`
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
+ `)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
+ `?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=`
849
+ `});function FT(e,t){return e.state.namerefs?.has(t)??!1}function IT(e,t){e.state.namerefs??=new Set,e.state.namerefs.add(t)}function LT(e,t){e.state.namerefs?.delete(t),e.state.boundNamerefs?.delete(t),e.state.invalidNamerefs?.delete(t)}function RT(e,t){e.state.invalidNamerefs??=new Set,e.state.invalidNamerefs.add(t)}function zT(e,t){return e.state.invalidNamerefs?.has(t)??!1}function BT(e,t){e.state.boundNamerefs??=new Set,e.state.boundNamerefs.add(t)}function VT(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&!e.includes(`__`)),i=e.state.associativeArrays?.has(t)??!1;return r||i}return Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&!e.includes(`__`))?!0:e.state.env.has(t)}function HT(e,t,n=100){if(!FT(e,t)||zT(e,t))return t;let r=new Set,i=t;for(;n-- >0;){if(r.has(i))return;if(r.add(i),!FT(e,i))return i;let t=e.state.env.get(i);if(t===void 0||t===``||!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t))return i;i=t}}function UT(e,t){if(FT(e,t))return e.state.env.get(t)}function WT(e,t,n,r=100){if(!FT(e,t)||zT(e,t))return t;let i=new Set,a=t;for(;r-- >0;){if(i.has(a))return;if(i.add(a),!FT(e,a))return a;let t=e.state.env.get(a);if(t===void 0||t===``)return n===void 0||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)&&VT(e,n)?a:null;if(!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t))return a;a=t}}var GT=S(()=>{});function KT(e,t){let n=t.replace(/\$\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g,(t,n)=>e.state.env.get(n)??``);return n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,n)=>e.state.env.get(n)??``),n}function J(e,t){return t===`FUNCNAME`?(e.state.funcNameStack??[]).map((e,t)=>[t,e]):t===`BASH_LINENO`?(e.state.callLineStack??[]).map((e,t)=>[t,String(e)]):t===`BASH_SOURCE`?(e.state.sourceStack??[]).map((e,t)=>[t,e]):e.state.associativeArrays?.has(t)?gT(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``]):mT(e,t).map(n=>[n,e.state.env.get(`${t}_${n}`)??``])}function qT(e,t){return t===`FUNCNAME`?(e.state.funcNameStack?.length??0)>0:t===`BASH_LINENO`?(e.state.callLineStack?.length??0)>0:t===`BASH_SOURCE`?(e.state.sourceStack?.length??0)>0:e.state.associativeArrays?.has(t)?gT(e,t).length>0:mT(e,t).length>0}async function JT(e,t,n=!0,r=!1){switch(t){case`?`:return String(e.state.lastExitCode);case`$`:return String(e.state.virtualPid);case`#`:return e.state.env.get(`#`)||`0`;case`@`:return e.state.env.get(`@`)||``;case`_`:return e.state.lastArg;case`-`:{let t=``;return t+=`h`,e.state.options.errexit&&(t+=`e`),e.state.options.noglob&&(t+=`f`),e.state.options.nounset&&(t+=`u`),e.state.options.verbose&&(t+=`v`),e.state.options.xtrace&&(t+=`x`),t+=`B`,e.state.options.noclobber&&(t+=`C`),t+=`s`,t}case`*`:{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(t===0)return``;let n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n.join(q(e.state.env))}case`0`:return e.state.env.get(`0`)||`bash`;case`PWD`:return e.state.env.get(`PWD`)??``;case`OLDPWD`:return e.state.env.get(`OLDPWD`)??``;case`PPID`:return String(e.state.virtualPpid);case`UID`:return String(e.state.virtualUid);case`EUID`:return String(e.state.virtualUid);case`RANDOM`:return String(Math.floor(Math.random()*32768));case`SECONDS`:return String(Math.floor((Date.now()-e.state.startTime)/1e3));case`BASH_VERSION`:return qS;case`!`:return String(e.state.lastBackgroundPid);case`BASHPID`:return String(e.state.bashPid);case`LINENO`:return String(e.state.currentLine);case`FUNCNAME`:{let t=e.state.funcNameStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new Fr(`FUNCNAME`);return``}case`BASH_LINENO`:{let t=e.state.callLineStack?.[0];if(t!==void 0)return String(t);if(n&&e.state.options.nounset)throw new Fr(`BASH_LINENO`);return``}case`BASH_SOURCE`:{let t=e.state.sourceStack?.[0];if(t!==void 0)return t;if(n&&e.state.options.nounset)throw new Fr(`BASH_SOURCE`);return``}}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[\]$/.test(t))throw new Rr(`\${${t}}`);let i=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(i){let t=i[1],r=i[2];if(FT(e,t)){let n=HT(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return``;t=n}}if(r===`@`||r===`*`){let n=J(e,t);if(n.length>0)return n.map(([,e])=>e).join(` `);let r=e.state.env.get(t);return r===void 0?``:r}if(t===`FUNCNAME`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.funcNameStack?.[t]??``:``}if(t===`BASH_LINENO`){let t=Number.parseInt(r,10);if(!Number.isNaN(t)&&t>=0){let n=e.state.callLineStack?.[t];return n===void 0?``:String(n)}return``}if(t===`BASH_SOURCE`){let t=Number.parseInt(r,10);return!Number.isNaN(t)&&t>=0?e.state.sourceStack?.[t]??``:``}if(e.state.associativeArrays?.has(t)){let i=_T(r);i=KT(e,i);let a=e.state.env.get(`${t}_${i}`);if(a===void 0&&n&&e.state.options.nounset)throw new Fr(`${t}[${r}]`);return a||``}let a;if(/^-?\d+$/.test(r))a=Number.parseInt(r,10);else try{a=await Z(e,TC(new Zw,r).expression)}catch{let t=e.state.env.get(r);a=t?Number.parseInt(t,10):0,Number.isNaN(a)&&(a=0)}if(a<0){let n=J(e,t),r=e.state.currentLine;if(n.length===0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
850
850
  `,``;let i=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+a;return i<0?(e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
851
- `,``):e.state.env.get(`${t}_${i}`)||``}let o=e.state.env.get(`${t}_${a}`);if(o!==void 0)return o;if(a===0){let n=e.state.env.get(t);if(n!==void 0)return n}if(n&&e.state.options.nounset)throw new Fr(`${t}[${a}]`);return``}if(/^[1-9][0-9]*$/.test(t)){let r=e.state.env.get(t);if(r===void 0&&n&&e.state.options.nounset)throw new Fr(t);return r||``}if(OT(e,t)){let i=FT(e,t);if(i===void 0)return``;if(i!==t)return await VT(e,i,n,r);let a=e.state.env.get(t);if((a===void 0||a===``)&&n&&e.state.options.nounset)throw new Fr(t);return a||``}let a=e.state.env.get(t);if(a!==void 0)return e.state.tempEnvBindings?.some(e=>e.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),a;if(BT(e,t)){let n=e.state.env.get(`${t}_0`);return n===void 0?``:n}if(n&&e.state.options.nounset)throw new Fr(t);return``}async function HT(e,t){if(new Set([`?`,`$`,`#`,`_`,`-`,`0`,`PPID`,`UID`,`EUID`,`RANDOM`,`SECONDS`,`BASH_VERSION`,`!`,`BASHPID`,`LINENO`]).has(t))return!0;if(t===`@`||t===`*`)return Number.parseInt(e.state.env.get(`#`)||`0`,10)>0;if(t===`PWD`||t===`OLDPWD`)return e.state.env.has(t);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(OT(e,t)){let n=FT(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;t=n}}if(r===`@`||r===`*`)return J(e,t).length>0?!0:e.state.env.has(t);if(e.state.associativeArrays?.has(t)){let n=uT(r);return e.state.env.has(`${t}_${n}`)}let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else try{i=await Z(e,vC(new Ww,r).expression)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0,Number.isNaN(i)&&(i=0)}if(i<0){let n=J(e,t);if(n.length===0)return!1;let r=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+i;return r<0?!1:e.state.env.has(`${t}_${r}`)}return e.state.env.has(`${t}_${i}`)}if(OT(e,t)){let n=FT(e,t);return n===void 0||n===t?e.state.env.has(t):HT(e,n)}return!!(e.state.env.has(t)||BT(e,t))}var UT=S(()=>{zC(),Gw(),HS(),BO(),A(),mT(),DT(),RT()});async function WT(e,t){let n=``,r=0;for(;r<t.length;){if(t[r]===`$`){if(t[r+1]===`{`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`{`?e++:t[i]===`}`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]===`(`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await VT(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[0-9]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[0-9]/.test(t[i]);)i++;let a=await VT(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[*@#?\-!$]/.test(t[r+1]||``)){let i=t[r+1],a=await VT(e,i);n+=a,r+=2;continue}}if(t[r]===`"`){for(n+=`"`,r++;r<t.length&&t[r]!==`"`;)if(t[r]===`$`&&/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await VT(e,t.slice(r+1,i));n+=a,r=i}else t[r]===`\\`?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+=`"`,r++);continue}n+=t[r],r++}return n}async function GT(e,t){let n=t,r=t.startsWith(`"`)&&t.endsWith(`"`),i=t.startsWith(`'`)&&t.endsWith(`'`);if((r||i)&&(n=t.slice(1,-1)),i)return n;let a=``,o=0;for(;o<n.length;)if(n[o]===`$`)if(n[o+1]===`(`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`(`&&n[r-1]===`$`||n[r]===`(`?t++:n[r]===`)`&&t--,r++;let i=n.slice(o+2,r-1);if(e.execFn){let t=await e.execFn(i,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=r}else if(n[o+1]===`{`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`{`?t++:n[r]===`}`&&t--,r++;let i=await VT(e,n.slice(o+2,r-1));a+=i,o=r}else if(/[a-zA-Z_]/.test(n[o+1]||``)){let t=o+1;for(;t<n.length&&/[a-zA-Z0-9_]/.test(n[t]);)t++;let r=await VT(e,n.slice(o+1,t));a+=r,o=t}else a+=n[o],o++;else if(n[o]==="`"){let t=o+1;for(;t<n.length&&n[t]!=="`";)t++;let r=n.slice(o+1,t);if(e.execFn){let t=await e.execFn(r,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=t+1}else a+=n[o],o++;return a}var KT=S(()=>{UT()});function qT(e,t,n,r,i){let a=n??1;a===0&&(a=1);let o=Math.abs(a),s=[],c=0;r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,``).length)),i?.match(/^-?0\d/)&&(c=Math.max(c,i.replace(/^-/,``).length));let l=e=>{if(c>0){let t=e<0,n=String(Math.abs(e)).padStart(c,`0`);return t?`-${n}`:n}return String(e)};if(e<=t)for(let n=e,r=0;n<=t&&r<XT;n+=o,r++)s.push(l(n));else for(let n=e,r=0;n>=t&&r<XT;n-=o,r++)s.push(l(n));return s}function JT(e,t,n){let r=n??1;r===0&&(r=1);let i=e.charCodeAt(0),a=t.charCodeAt(0),o=Math.abs(r);if(e>=`A`&&e<=`Z`&&t>=`a`&&t<=`z`||e>=`a`&&e<=`z`&&t>=`A`&&t<=`Z`){let r=n===void 0?``:`..${n}`;throw new Br(`{${e}..${t}${r}}: invalid sequence`)}let s=[];if(i<=a)for(let e=i,t=0;e<=a&&t<XT;e+=o,t++)s.push(String.fromCharCode(e));else for(let e=i,t=0;e>=a&&t<XT;e-=o,t++)s.push(String.fromCharCode(e));return s}function YT(e,t,n,r,i){let a=n===void 0?``:`..${n}`;return typeof e==`number`&&typeof t==`number`?{expanded:qT(e,t,n,r,i),literal:`{${e}..${t}${a}}`}:typeof e==`string`&&typeof t==`string`?{expanded:JT(e,t,n),literal:`{${e}..${t}${a}}`}:{expanded:null,literal:`{${e}..${t}${a}}`}}var XT,ZT=S(()=>{A(),XT=1e4});function QT(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!==`SimpleCommand`)return null;let i=r;if(i.name!==null||i.args.length!==0||i.assignments.length!==0||i.redirections.length!==1)return null;let a=i.redirections[0];return a.operator!==`<`||a.target.type!==`Word`?null:{target:a.target}}var $T=S(()=>{});function eE(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function tE(e){let t=``,n=0;for(;n<e.length;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function nE(e){return e.replace(/([*?[\]\\()|])/g,`\\$1`)}function rE(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}var iE=S(()=>{});function aE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var oE=S(()=>{});function Y(e,t,n=!1){let r=``,i=0;for(;i<e.length;){let a=e[i];if(n&&(a===`@`||a===`*`||a===`+`||a===`?`||a===`!`)&&i+1<e.length&&e[i+1]===`(`){let o=sE(e,i+1);if(o!==-1){let s=cE(e.slice(i+2,o)).map(e=>Y(e,t,n)),c=s.length>0?s.join(`|`):`(?:)`;a===`@`?r+=`(?:${c})`:a===`*`?r+=`(?:${c})*`:a===`+`?r+=`(?:${c})+`:a===`?`?r+=`(?:${c})?`:a===`!`&&(r+=`(?!(?:${c})$).*`),i=o+1;continue}}if(a===`\\`)if(i+1<e.length){let t=e[i+1];/[\\^$.|+(){}[\]*?]/.test(t)?r+=`\\${t}`:r+=t,i+=2}else r+=`\\\\`,i++;else if(a===`*`)r+=t?`.*`:`.*?`,i++;else if(a===`?`)r+=`.`,i++;else if(a===`[`){let t=lE(e,i);if(t===-1)r+=`\\[`,i++;else{let n=e.slice(i+1,t);r+=uE(n),i=t+1}}else /[\^$.|+(){}]/.test(a)?(r+=`\\${a}`,i++):(r+=a,i++)}return r}function sE(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 cE(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function lE(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===`]`)return n;if(e[n]===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}n++}return-1}function uE(e){let t=`[`,n=0;for((e[0]===`^`||e[0]===`!`)&&(t+=`^`,n++);n<e.length;){if(e[n]===`'`){let r=e.indexOf(`'`,n+1);if(r!==-1){let i=e.slice(n+1,r);for(let e of i)e===`\\`?t+=`\\\\`:e===`]`?t+=`\\]`:e===`^`&&t===`[`?t+=`\\^`:t+=e;n=r+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r);t+=dE(i),n=r+2;continue}}let r=e[n];r===`\\`?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+=`\\\\`,n++):r===`-`&&n>0&&n<e.length-1?(t+=`-`,n++):r===`^`&&n===0?(t+=`^`,n++):(r===`]`&&n===0?t+=`\\]`:t+=r,n++)}return t+=`]`,t}function dE(e){return fE.get(e)??``}var fE,pE=S(()=>{fE=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`]])});function mE(e,t,n,r){if(n===`prefix`)return R(`^${t}`,`s`).replace(e,``);let i=R(`${t}$`,`s`);if(r)return i.replace(e,``);for(let t=e.length;t>=0;t--){let n=e.slice(t);if(i.test(n))return e.slice(0,t)}return e}function hE(e,t){let n=Array.from(e.state.env.keys()),r=new Set,i=e.state.associativeArrays??new Set,a=new Set;for(let e of n){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);t&&a.add(t[1]);let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n&&a.add(n[1])}let o=e=>{for(let t of i){let n=`${t}_`;if(e.startsWith(n)&&e!==t)return!0}return!1};for(let e of n)if(e.startsWith(t))if(e.includes(`__`)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n?.[1].startsWith(t)&&r.add(n[1])}else if(/_\d+$/.test(e)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);n?.[1].startsWith(t)&&r.add(n[1])}else o(e)||r.add(e);return[...r].sort()}var gE=S(()=>{Ss()});function _E(e,t){let n=(e,t=2)=>String(e).padStart(t,`0`);if(e===``)return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;let r=``,i=0;for(;i<e.length;)if(e[i]===`%`){if(i+1>=e.length){r+=`%`,i++;continue}let a=e[i+1];switch(a){case`H`:r+=n(t.getHours());break;case`M`:r+=n(t.getMinutes());break;case`S`:r+=n(t.getSeconds());break;case`d`:r+=n(t.getDate());break;case`m`:r+=n(t.getMonth()+1);break;case`Y`:r+=t.getFullYear();break;case`y`:r+=n(t.getFullYear()%100);break;case`I`:{let e=t.getHours()%12;e===0&&(e=12),r+=n(e);break}case`p`:r+=t.getHours()<12?`AM`:`PM`;break;case`P`:r+=t.getHours()<12?`am`:`pm`;break;case`%`:r+=`%`;break;case`a`:r+=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][t.getDay()];break;case`b`:r+=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getMonth()];break;default:r+=`%${a}`}i+=2}else r+=e[i],i++;return r}function vE(e,t){let n=``,r=0,i=e.state.env.get(`USER`)||e.state.env.get(`LOGNAME`)||`user`,a=e.state.env.get(`HOSTNAME`)||`localhost`,o=a.split(`.`)[0],s=e.state.env.get(`PWD`)||`/`,c=e.state.env.get(`HOME`)||`/`,l=s.startsWith(c)?`~${s.slice(c.length)}`:s,u=s.split(`/`).pop()||s,d=new Date,f=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],p=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],m=e.state.env.get(`__COMMAND_NUMBER`)||`1`;for(;r<t.length;){let e=t[r];if(e===`\\`){if(r+1>=t.length){n+=`\\`,r++;continue}let e=t[r+1];if(e>=`0`&&e<=`7`){let e=``,i=r+1;for(;i<t.length&&i<r+4&&t[i]>=`0`&&t[i]<=`7`;)e+=t[i],i++;let a=Number.parseInt(e,8)%256;n+=String.fromCharCode(a),r=i;continue}switch(e){case`\\`:n+=`\\`,r+=2;break;case`a`:n+=`\x07`,r+=2;break;case`e`:n+=`\x1B`,r+=2;break;case`n`:n+=`
852
- `,r+=2;break;case`r`:n+=`\r`,r+=2;break;case`$`:n+=`$`,r+=2;break;case`[`:case`]`:r+=2;break;case`u`:n+=i,r+=2;break;case`h`:n+=o,r+=2;break;case`H`:n+=a,r+=2;break;case`w`:n+=l,r+=2;break;case`W`:n+=u,r+=2;break;case`d`:{let e=String(d.getDate()).padStart(2,` `);n+=`${f[d.getDay()]} ${p[d.getMonth()]} ${e}`,r+=2;break}case`t`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`),i=String(d.getSeconds()).padStart(2,`0`);n+=`${e}:${t}:${i}`,r+=2;break}case`T`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=String(d.getSeconds()).padStart(2,`0`);n+=`${t}:${i}:${a}`,r+=2;break}case`@`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=d.getHours()<12?`AM`:`PM`;n+=`${t}:${i} ${a}`,r+=2;break}case`A`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`);n+=`${e}:${t}`,r+=2;break}case`D`:if(r+2<t.length&&t[r+2]===`{`){let e=t.indexOf(`}`,r+3);if(e!==-1){let i=t.slice(r+3,e);n+=_E(i,d),r=e+1}else n+=`\\D`,r+=2}else n+=`\\D`,r+=2;break;case`s`:n+=`bash`,r+=2;break;case`v`:n+=`5.0`,r+=2;break;case`V`:n+=`5.0.0`,r+=2;break;case`j`:n+=`0`,r+=2;break;case`l`:n+=`tty`,r+=2;break;case`#`:n+=m,r+=2;break;case`!`:n+=m,r+=2;break;case`x`:n+=`\\x`,r+=2;break;default:n+=`\\${e}`,r+=2}}else n+=e,r++}return n}var yE=S(()=>{});function bE(e){if(e===``)return`''`;if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let t=`$'`;for(let n of e)switch(n){case`'`:t+=`\\'`;break;case`\\`:t+=`\\\\`;break;case`
853
- `:t+=`\\n`;break;case`\r`:t+=`\\r`;break;case` `:t+=`\\t`;break;default:{let e=n.charCodeAt(0);e<32||e===127?t+=`\\${e.toString(8).padStart(3,`0`)}`:t+=n}}return`${t}'`}return`'${e}'`}var xE=S(()=>{});function SE(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function CE(e,t){return e.state.readonlyVars?.has(t)??!1}function wE(e,t,n=`bash`){if(CE(e,t)){let e=`${n}: ${t}: readonly variable
854
- `;throw new Ir(1,``,e)}return null}function TE(e,t){let n=e.state.exportedVars?.has(t)??!1;if(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t),e.state.localScopes.length>0&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!n){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length<e.state.localScopes.length;)e.state.localExportedVars.push(new Set);e.state.localExportedVars[e.state.localExportedVars.length-1].add(t)}}function EE(e,t){e.state.exportedVars?.delete(t)}var DE=S(()=>{A()});function OE(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return``;let n=``,r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&/^[0-9]+$/.test(e.slice(t.length+1))),i=e.state.associativeArrays?.has(t)??!1;return r&&!i&&(n+=`a`),i&&(n+=`A`),e.state.integerVars?.has(t)&&(n+=`i`),OT(e,t)&&(n+=`n`),CE(e,t)&&(n+=`r`),e.state.exportedVars?.has(t)&&(n+=`x`),n}var kE=S(()=>{RT(),DE()});async function AE(e,t,n,r){return e.coverage?.hit(`bash:expansion:default_value`),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function jE(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:assign_default`),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let a=await i(e,n.word.parts,r.inDoubleQuotes),o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let[,t,n]=o,r;if(/^\d+$/.test(n))r=Number.parseInt(n,10);else{try{r=await Z(e,vC(new Ww,n).expression)}catch{let t=e.state.env.get(n);r=t?Number.parseInt(t,10):0}Number.isNaN(r)&&(r=0)}e.state.env.set(`${t}_${r}`,a);let i=Number.parseInt(e.state.env.get(`${t}__length`)||`0`,10);r>=i&&e.state.env.set(`${t}__length`,String(r+1))}else e.state.env.set(t,a);return a}return r.effectiveValue}async function ME(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:error_if_unset`),r.isUnset||n.checkEmpty&&r.isEmpty){let a=n.word?await i(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new Ir(1,``,`bash: ${a}
855
- `)}return r.effectiveValue}async function NE(e,t,n,r){return e.coverage?.hit(`bash:expansion:use_alternative`),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):``}async function PE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_removal`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Y(t.pattern,n.greedy,o);else if(t.type===`Literal`)a+=Y(t.value,n.greedy,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=aE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=aE(n)}else if(t.type===`ParameterExpansion`){let r=await i(e,t);a+=Y(r,n.greedy,o)}else{let n=await i(e,t);a+=aE(n)}if(n.side===`prefix`)return R(`^${a}`,`s`).replace(t,``);let s=R(`${a}$`,`s`);if(n.greedy)return s.replace(t,``);for(let e=t.length;e>=0;e--){let n=t.slice(e);if(s.test(n))return t.slice(0,e)}return t}async function FE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_replacement`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Y(t.pattern,!0,o);else if(t.type===`Literal`)a+=Y(t.value,!0,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=aE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=aE(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);a+=Y(n,!0,o)}else{let n=await i(e,t);a+=aE(n)}let s=n.replacement?await r(e,n.replacement.parts):``;if(n.anchor===`start`?a=`^${a}`:n.anchor===`end`&&(a=`${a}$`),a===``)return t;let c=n.all?`gs`:`s`;try{let r=R(a,c);if(n.all){let n=``,i=0,a=0,o=e.limits.maxStringLength,c=r.exec(t);for(;c!==null&&!(c[0].length===0&&c.index===t.length);){if(n+=t.slice(i,c.index)+s,i=c.index+c[0].length,c[0].length===0&&i++,a++,a%100==0&&n.length>o)throw new k(`pattern replacement: string length limit exceeded (${o} bytes)`,`string_length`);c=r.exec(t)}return n+=t.slice(i),n}return r.replace(t,s)}catch(e){if(e instanceof k)throw e;return t}}function IE(e,t,n){e.coverage?.hit(`bash:expansion:length`);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let t=r[1],n=J(e,t);return n.length>0?String(n.length):e.state.env.get(t)===void 0?`0`:`1`}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&BT(e,t)){if(t===`FUNCNAME`){let t=e.state.funcNameStack?.[0]||``;return String([...t].length)}if(t===`BASH_LINENO`){let t=e.state.callLineStack?.[0];return String(t===void 0?0:[...String(t)].length)}let n=e.state.env.get(`${t}_0`)||``;return String([...n].length)}return String([...n].length)}async function LE(e,t,n,r){e.coverage?.hit(`bash:expansion:substring`);let i=await Z(e,r.offset.expression),a=r.length?await Z(e,r.length.expression):void 0;if(t===`@`||t===`*`){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);let r=e.state.env.get(`0`)||`bash`,o,s;if(i<=0)if(o=[r,...n],i<0){if(s=o.length+i,s<0)return``}else s=0;else o=n,s=i-1;if(s<0||s>=o.length)return``;if(a!==void 0){let e=a<0?o.length+a:s+a;return o.slice(s,Math.max(s,e)).join(` `)}return o.slice(s).join(` `)}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let t=o[1];if(e.state.associativeArrays?.has(t))throw new Ir(1,``,`bash: \${${t}[@]: 0: 3}: bad substitution
856
- `);let n=J(e,t),r=0;if(i<0){if(n.length>0){let e=n[n.length-1][0],t=(typeof e==`number`?e:0)+1+i;if(t<0||(r=n.findIndex(([e])=>typeof e==`number`&&e>=t),r<0))return``}}else if(r=n.findIndex(([e])=>typeof e==`number`&&e>=i),r<0)return``;if(a!==void 0){if(a<0)throw new Lr(`${o[1]}[@]: substring expression < 0`);return n.slice(r,r+a).map(([,e])=>e).join(` `)}return n.slice(r).map(([,e])=>e).join(` `)}let s=[...n],c=i;if(c<0&&(c=Math.max(0,s.length+c)),a!==void 0){if(a<0){let e=s.length+a;return s.slice(c,Math.max(c,e)).join(``)}return s.slice(c,c+a).join(``)}return s.slice(c).join(``)}async function RE(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:case_modification`),n.pattern){let a=e.state.shoptOptions.extglob,o=``;for(let t of n.pattern.parts)if(t.type===`Glob`)o+=Y(t.pattern,!0,a);else if(t.type===`Literal`)o+=Y(t.value,!0,a);else if(t.type===`SingleQuoted`||t.type===`Escaped`)o+=aE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);o+=aE(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);o+=Y(n,!0,a)}let s=R(`^(?:${o})$`),c=n.direction===`upper`?e=>e.toUpperCase():e=>e.toLowerCase(),l=``,u=!1;for(let e of t)!n.all&&u?l+=e:s.test(e)?(l+=c(e),u=!0):l+=e;return l}return n.direction===`upper`?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function zE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:transform`);let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a&&i.operator===`Q`)return J(e,a[1]).map(([,e])=>bE(e)).join(` `);if(a&&i.operator===`a`)return OE(e,a[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&i.operator===`a`)return OE(e,o[1]);switch(i.operator){case`Q`:return r?``:bE(n);case`P`:return vE(e,n);case`a`:return OE(e,t);case`A`:return r?``:`${t}=${bE(n)}`;case`E`:return n.replace(/\\([\\abefnrtv'"?])/g,(e,t)=>{switch(t){case`\\`:return`\\`;case`a`:return`\x07`;case`b`:return`\b`;case`e`:return`\x1B`;case`f`:return`\f`;case`n`:return`
857
- `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`'`:return`'`;case`"`:return`"`;case`?`:return`?`;default:return t}});case`K`:case`k`:return r?``:bE(n);case`u`:return n.charAt(0).toUpperCase()+n.slice(1);case`U`:return n.toUpperCase();case`L`:return n.toLowerCase();default:return n}}async function BE(e,t,n,r,i,a,o=!1){if(e.coverage?.hit(`bash:expansion:indirection`),OT(e,t))return IT(e,t)||``;let s=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(i.innerOp?.type===`UseAlternative`)return``;throw new Rr(`\${!${t}}`)}let c=n;if(s&&(c===``||c.includes(` `)))throw new Rr(`\${!${t}}`);let l=c.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(l&&l[1].includes(`~`))throw new Rr(`\${!${t}}`);return i.innerOp?a(e,{type:`ParameterExpansion`,parameter:c,operation:i.innerOp},o):await VT(e,c)}function VE(e,t){e.coverage?.hit(`bash:expansion:array_keys`);let n=J(e,t.array).map(([e])=>String(e));return t.star?n.join(q(e.state.env)):n.join(` `)}function HE(e,t){e.coverage?.hit(`bash:expansion:var_name_prefix`);let n=hE(e,t.prefix);return t.star?n.join(q(e.state.env)):n.join(` `)}function UE(e,t,n,r){let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t===`*`)return{isEmpty:i===0,effectiveValue:n};if(t===`@`)return{isEmpty:i===0||i===1&&e.state.env.get(`1`)===``,effectiveValue:n};if(a){let[,t,n]=a,i=J(e,t);if(i.length===0)return{isEmpty:!0,effectiveValue:``};if(n===`*`){let t=q(e.state.env),n=i.map(([,e])=>e).join(t);return{isEmpty:r?n===``:!1,effectiveValue:n}}return{isEmpty:i.length===1&&i.every(([,e])=>e===``),effectiveValue:i.map(([,e])=>e).join(` `)}}return{isEmpty:n===``,effectiveValue:n}}var WE=S(()=>{zC(),Gw(),Ss(),BO(),A(),DT(),RT(),oE(),pE(),gE(),yE(),xE(),UT(),kE()});function GE(e){let t=0;for(;t<e.length;){let n=e[t];if(n===`\\`&&t+1<e.length){t+=2;continue}if(n===`'`){let n=e.indexOf(`'`,t+1);if(n!==-1){t=n+1;continue}}if(n===`$`&&t+1<e.length&&e[t+1]===`(`||n==="`")return!0;t++}return!1}function KE(e,t){let n=1,r=t,i=!1,a=!1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`&&!i&&r+1<e.length){r+=2;continue}if(t===`'`&&!a){i=!i,r++;continue}if(t===`"`&&!i){a=!a,r++;continue}if(!i&&!a){if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}r++}return-1}async function qE(e,t){let n=new Ww,r;try{r=n.parse(t)}catch{return``}let i=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let a=new Map(e.state.env),o=e.state.cwd,s=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let t=await e.executeScript(r),n=t.exitCode;return e.state.env=a,e.state.cwd=o,e.state.suppressVerbose=s,e.state.lastExitCode=n,e.state.env.set(`?`,String(n)),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr),e.state.bashPid=i,t.stdout.replace(/\n+$/,``)}catch(t){if(e.state.env=a,e.state.cwd=o,e.state.bashPid=i,e.state.suppressVerbose=s,t instanceof k)throw t;return t instanceof Ir?(e.state.lastExitCode=t.exitCode,e.state.env.set(`?`,String(t.exitCode)),t.stdout?.replace(/\n+$/,``)??``):``}}function JE(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=nE(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=YE(e,t.slice(r+1,i));n+=nE(a),r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}function YE(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}async function XE(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=nE(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=await ZE(e,t.slice(r+1,i));n+=nE(a),r=i+1;continue}}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=KE(t,r+2);if(i!==-1){let a=await qE(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await qE(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}async function ZE(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=KE(t,r+2);if(i!==-1){let a=await qE(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await qE(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}var QE=S(()=>{Gw(),A(),iE()});function $E(e,t){if(!t.startsWith(`~`))return t;e.coverage?.hit(`bash:expansion:tilde`);let n=e.state.env.get(`HOME`)===void 0?`/home/user`:e.state.env.get(`HOME`);if(t===`~`||t.startsWith(`~/`))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let i=t.slice(1,r),a=t.slice(r);return a!==``&&!a.startsWith(`/`)?t:i===`root`?`/root${a}`:t}var eD=S(()=>{});async function tD(e,t,n,r){let i=``;for(let a of t.parts)if(a.type===`Glob`)i+=Y(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)i+=Y(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)i+=aE(a.value);else if(a.type===`DoubleQuoted`){let t=await n(e,a.parts);i+=aE(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);i+=Y(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);i+=aE(t)}return i}async function nD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternReplacement`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=J(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``;l.pattern&&(f=await tD(e,l.pattern,n,r));let p=l.replacement?await n(e,l.replacement.parts):``,m=f;l.anchor===`start`?m=`^${f}`:l.anchor===`end`&&(m=`${f}$`);let h=[];try{let e=R(m,l.all?`g`:``);for(let t of d)h.push(e.replace(t,p))}catch{h.push(...d)}if(c){let t=q(e.state.env);return{values:[h.join(t)],quoted:!0}}return{values:h,quoted:!0}}async function rD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternRemoval`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=J(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``,p=e.state.shoptOptions.extglob;if(l.pattern)for(let t of l.pattern.parts)if(t.type===`Glob`)f+=Y(t.pattern,l.greedy,p);else if(t.type===`Literal`)f+=Y(t.value,l.greedy,p);else if(t.type===`SingleQuoted`||t.type===`Escaped`)f+=aE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);f+=aE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);f+=Y(n,l.greedy,p)}else{let n=await r(e,t);f+=aE(n)}let m=[];for(let e of d)m.push(mE(e,f,l.side,l.greedy));if(c){let t=q(e.state.env);return{values:[m.join(t)],quoted:!0}}return{values:m,quoted:!0}}var iD=S(()=>{Ss(),DT(),oE(),pE(),gE(),UT()});async function aD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`DefaultValue`&&n.parts[0].operation?.type!==`UseAlternative`&&n.parts[0].operation?.type!==`AssignDefault`)return null;let r=n.parts[0],i=r.operation,a=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),o,s=!1;if(a){let t=a[1];s=a[2]===`*`;let n=J(e,t),r=n.length>0||e.state.env.has(t),c=n.length===0||n.length===1&&n.every(([,e])=>e===``),l=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?r&&!(l&&c):!r||l&&c,!o){if(n.length>0){let t=n.map(([,e])=>e);if(s){let n=q(e.state.env);return{values:[t.join(n)],quoted:!0}}return{values:t,quoted:!0}}let r=e.state.env.get(t);return r===void 0?{values:[],quoted:!0}:{values:[r],quoted:!0}}}else{let t=r.parameter,n=await HT(e,t),a=await VT(e,t),s=a===``,c=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?n&&!(c&&s):!n||c&&s,!o)return{values:[a],quoted:!0}}if(o&&i.word){let t=i.word.parts,n=null,r=!1;for(let e of t)if(e.type===`ParameterExpansion`&&!e.operation){let t=e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){n=t[1],r=t[2]===`*`;break}}if(n){let t=J(e,n);if(t.length>0){let n=t.map(([,e])=>e);if(r||s){let t=q(e.state.env);return{values:[n.join(t)],quoted:!0}}return{values:n,quoted:!0}}let i=e.state.env.get(n);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}}return null}async function oD(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0],o=-1,s=``,c=!1,l=null;for(let e=0;e<a.parts.length;e++){let t=a.parts[e];if(t.type===`ParameterExpansion`&&(t.operation?.type===`PatternRemoval`||t.operation?.type===`PatternReplacement`)){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){o=e,s=n[1],c=n[2]===`*`,l=t.operation;break}}}if(o===-1||o===0&&o===a.parts.length-1)return null;let u=``;for(let t=0;t<o;t++)u+=await r(e,a.parts[t]);let d=``;for(let t=o+1;t<a.parts.length;t++)d+=await r(e,a.parts[t]);let f=J(e,s),p=f.map(([,e])=>e);if(f.length===0){let t=e.state.env.get(s);if(t!==void 0)p=[t];else{if(c)return{values:[u+d],quoted:!0};let e=u+d;return{values:e?[e]:[],quoted:!0}}}if(l?.type===`PatternRemoval`){let t=l,n=``,a=e.state.shoptOptions.extglob;if(t.pattern)for(let o of t.pattern.parts)if(o.type===`Glob`)n+=Y(o.pattern,t.greedy,a);else if(o.type===`Literal`)n+=Y(o.value,t.greedy,a);else if(o.type===`SingleQuoted`||o.type===`Escaped`)n+=aE(o.value);else if(o.type===`DoubleQuoted`){let t=await i(e,o.parts);n+=aE(t)}else if(o.type===`ParameterExpansion`){let i=await r(e,o);n+=Y(i,t.greedy,a)}else{let t=await r(e,o);n+=aE(t)}p=p.map(e=>mE(e,n,t.side,t.greedy))}else if(l?.type===`PatternReplacement`){let t=l,n=``;if(t.pattern)for(let a of t.pattern.parts)if(a.type===`Glob`)n+=Y(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)n+=Y(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)n+=aE(a.value);else if(a.type===`DoubleQuoted`){let t=await i(e,a.parts);n+=aE(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);n+=Y(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);n+=aE(t)}let a=t.replacement?await i(e,t.replacement.parts):``,o=n;t.anchor===`start`?o=`^${n}`:t.anchor===`end`&&(o=`${n}$`);try{let e=R(o,t.all?`g`:``);p=p.map(t=>e.replace(t,a))}catch{}}if(c){let t=q(e.state.env);return{values:[u+p.join(t)+d],quoted:!0}}return p.length===1?{values:[u+p[0]+d],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+d],quoted:!0}}async function sD(e,t,n,r){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=``,s=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&!t.operation){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){a=e,o=n[1],s=n[2]===`*`;break}}}if(a===-1)return null;let c=``;for(let t=0;t<a;t++)c+=await r(e,i.parts[t]);let l=``;for(let t=a+1;t<i.parts.length;t++)l+=await r(e,i.parts[t]);let u=J(e,o),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(o);if(t!==void 0)return{values:[c+t+l],quoted:!0};if(s)return{values:[c+l],quoted:!0};let n=c+l;return{values:n?[n]:[],quoted:!0}}if(s){let t=q(e.state.env);return{values:[c+d.join(t)+l],quoted:!0}}return d.length===1?{values:[c+d[0]+l],quoted:!0}:{values:[c+d[0],...d.slice(1,-1),d[d.length-1]+l],quoted:!0}}var cD=S(()=>{Ss(),DT(),oE(),pE(),gE(),UT()});async function lD(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!==`ParameterExpansion`||r.parts[0].operation?.type!==`Substring`)return null;let i=r.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],s=a[2]===`*`,c=i.operation;if(e.state.associativeArrays?.has(o))throw new Ir(1,``,`bash: \${${o}[@]: 0: 3}: bad substitution
858
- `);let l=c.offset?await n(e,c.offset.expression):0,u=c.length?await n(e,c.length.expression):void 0,d=J(e,o),f=0;if(l<0){if(d.length>0){let e=d[d.length-1][0],t=(typeof e==`number`?e:0)+1+l;if(t<0)return{values:[],quoted:!0};f=d.findIndex(([e])=>typeof e==`number`&&e>=t),f<0&&(f=d.length)}}else f=d.findIndex(([e])=>typeof e==`number`&&e>=l),f<0&&(f=d.length);let p;if(u!==void 0){if(u<0)throw new Lr(`${o}[@]: substring expression < 0`);p=d.slice(f,f+u).map(([,e])=>e)}else p=d.slice(f).map(([,e])=>e);if(p.length===0)return{values:[],quoted:!0};if(s){let t=q(e.state.env);return{values:[p.join(t)],quoted:!0}}return{values:p,quoted:!0}}function uD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`Transform`)return null;let r=n.parts[0],i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]===`*`,s=r.operation,c=J(e,a);if(c.length===0){let t=e.state.env.get(a);if(t!==void 0){let n;switch(s.operator){case`a`:n=``;break;case`P`:n=vE(e,t);break;case`Q`:n=bE(t);break;default:n=t}return{values:[n],quoted:!0}}return o?{values:[``],quoted:!0}:{values:[],quoted:!0}}let l=OE(e,a),u;switch(s.operator){case`a`:u=c.map(()=>l);break;case`P`:u=c.map(([,t])=>vE(e,t));break;case`Q`:u=c.map(([,e])=>bE(e));break;case`u`:u=c.map(([,e])=>e.charAt(0).toUpperCase()+e.slice(1));break;case`U`:u=c.map(([,e])=>e.toUpperCase());break;case`L`:u=c.map(([,e])=>e.toLowerCase());break;default:u=c.map(([,e])=>e)}if(o){let t=q(e.state.env);return{values:[u.join(t)],quoted:!0}}return{values:u,quoted:!0}}var dD=S(()=>{A(),DT(),yE(),xE(),UT(),kE()});function fD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`)return null;let r=n.parts[0];if(r.operation)return null;let i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let a=i[1];if(OT(e,a)){let t=IT(e,a);if(t?.endsWith(`[@]`)||t?.endsWith(`[*]`))return{values:[],quoted:!0}}let o=J(e,a);if(o.length>0)return{values:o.map(([,e])=>e),quoted:!0};let s=e.state.env.get(a);return s===void 0?{values:[],quoted:!0}:{values:[s],quoted:!0}}function pD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation)return null;let r=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)||!OT(e,r))return null;let i=IT(e,r);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],s=J(e,o);if(s.length>0)return{values:s.map(([,e])=>e),quoted:!0};let c=e.state.env.get(o);return c===void 0?{values:[],quoted:!0}:{values:[c],quoted:!0}}var mD=S(()=>{RT(),UT()});async function hD(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=o.operation,c=await VT(e,o.parameter),l=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l){if(!s.innerOp&&(c===`@`||c===`*`)){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return c===`*`?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}return null}let u=l[1],d=l[2]===`*`,f=J(e,u);if(s.innerOp){if(s.innerOp.type===`Substring`)return gD(e,f,u,d,s.innerOp);if(s.innerOp.type===`DefaultValue`||s.innerOp.type===`UseAlternative`||s.innerOp.type===`AssignDefault`||s.innerOp.type===`ErrorIfUnset`)return _D(e,f,u,d,s.innerOp,i);if(s.innerOp.type===`Transform`&&s.innerOp.operator===`a`){let t=OE(e,u),n=f.map(()=>t);return d?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}let t=[];for(let[,n]of f){let i={type:`ParameterExpansion`,parameter:`_indirect_elem_`,operation:s.innerOp},a=e.state.env.get(`_indirect_elem_`);e.state.env.set(`_indirect_elem_`,n);try{let n=await r(e,i,!0);t.push(n)}finally{a===void 0?e.state.env.delete(`_indirect_elem_`):e.state.env.set(`_indirect_elem_`,a)}}return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}if(f.length>0){let t=f.map(([,e])=>e);return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let p=e.state.env.get(u);return p===void 0?{values:[],quoted:!0}:{values:[p],quoted:!0}}async function gD(e,t,n,r,i){let a=i.offset?await Z(e,i.offset.expression):0,o=i.length?await Z(e,i.length.expression):void 0,s=0;if(a<0){if(t.length>0){let e=t[t.length-1][0],n=(typeof e==`number`?e:0)+1+a;if(n<0||(s=t.findIndex(([e])=>typeof e==`number`&&e>=n),s<0))return{values:[],quoted:!0}}}else if(s=t.findIndex(([e])=>typeof e==`number`&&e>=a),s<0)return{values:[],quoted:!0};let c;if(o!==void 0){if(o<0)throw new Lr(`${n}[@]: substring expression < 0`);c=t.slice(s,s+o)}else c=t.slice(s);let l=c.map(([,e])=>e);return r?{values:[l.join(q(e.state.env))],quoted:!0}:{values:l,quoted:!0}}async function _D(e,t,n,r,i,a){let o=i.checkEmpty??!1,s=t.map(([,e])=>e),c=t.length===0,l=t.length===0;if(i.type===`UseAlternative`)return!l&&!(o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(i.type===`DefaultValue`)return(l||o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0};if(i.type===`AssignDefault`){if((l||o&&c)&&i.word){let t=await a(e,i.word.parts,!0);return e.state.env.set(`${n}_0`,t),e.state.env.set(`${n}__length`,`1`),{values:[t],quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}async function vD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`UseAlternative`&&t[0].operation?.type!==`DefaultValue`)return null;let n=t[0],r=n.operation,i=r?.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await VT(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await HT(e,n.parameter),l=await VT(e,n.parameter)===``,u=r.checkEmpty??!1,d;if(d=r.type===`UseAlternative`?c&&!(u&&l):!c||u&&l,d){let t=s[1],n=s[2]===`*`,r=J(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}async function yD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`Indirection`)return null;let n=t[0],r=n.operation.innerOp;if(!r||r.type!==`UseAlternative`&&r.type!==`DefaultValue`)return null;let i=r.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await VT(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await VT(e,n.parameter),l=await HT(e,n.parameter),u=c===``,d=r.checkEmpty??!1,f;if(f=r.type===`UseAlternative`?l&&!(d&&u):!l||d&&u,f){let t=s[1],n=s[2]===`*`,r=J(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}var bD=S(()=>{BO(),A(),DT(),UT(),kE()});function xD(e){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n}async function SD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`Substring`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=s.offset?await n(e,s.offset.expression):0,l=s.length?await n(e,s.length.expression):void 0,u=Number.parseInt(e.state.env.get(`#`)||`0`,10),d=[];for(let t=1;t<=u;t++)d.push(e.state.env.get(String(t))||``);let f=e.state.env.get(`0`)||`bash`,p;if(c<=0){let e=[f,...d],t=e.length+c;if(t<0)p=[];else{let n=c<0?t:0;if(l!==void 0){let t=l<0?e.length+l:n+l;p=e.slice(n,Math.max(n,t))}else p=e.slice(n)}}else{let e=c-1;if(e>=d.length)p=[];else if(l!==void 0){let t=l<0?d.length+l:e+l;p=d.slice(e,Math.max(e,t))}else p=d.slice(e)}let m=``;for(let t=0;t<a;t++)m+=await r(e,i.parts[t]);let h=``;for(let t=a+1;t<i.parts.length;t++)h+=await r(e,i.parts[t]);if(p.length===0){let e=m+h;return{values:e?[e]:[],quoted:!0}}if(o){let t=q(e.state.env);return{values:[m+p.join(t)+h],quoted:!0}}return p.length===1?{values:[m+p[0]+h],quoted:!0}:{values:[m+p[0],...p.slice(1,-1),p[p.length-1]+h],quoted:!0}}async function CD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternReplacement`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=xD(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Y(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)d+=Y(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=aE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=aE(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Y(r,!0,e.state.shoptOptions.extglob)}else{let r=await n(e,t);d+=aE(r)}let f=s.replacement?await r(e,s.replacement.parts):``,p=d;s.anchor===`start`?p=`^${d}`:s.anchor===`end`&&(p=`${d}$`);let m=[];try{let e=R(p,s.all?`g`:``);for(let t of c)m.push(e.replace(t,f))}catch{m.push(...c)}if(o){let t=q(e.state.env);return{values:[l+m.join(t)+u],quoted:!0}}return m.length===1?{values:[l+m[0]+u],quoted:!0}:{values:[l+m[0],...m.slice(1,-1),m[m.length-1]+u],quoted:!0}}async function wD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternRemoval`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=xD(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``,f=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Y(t.pattern,s.greedy,f);else if(t.type===`Literal`)d+=Y(t.value,s.greedy,f);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=aE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=aE(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Y(r,s.greedy,f)}else{let r=await n(e,t);d+=aE(r)}let p=[];for(let e of c)p.push(mE(e,d,s.side,s.greedy));if(o){let t=q(e.state.env);return{values:[l+p.join(t)+u],quoted:!0}}return p.length===1?{values:[l+p[0]+u],quoted:!0}:{values:[l+p[0],...p.slice(1,-1),p[p.length-1]+u],quoted:!0}}async function TD(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0],i=-1,a=!1;for(let e=0;e<r.parts.length;e++){let t=r.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)){i=e,a=t.parameter===`*`;break}}if(i===-1)return null;let o=r.parts[i];if(o.type===`ParameterExpansion`&&o.operation)return null;let s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=``;for(let t=0;t<i;t++)c+=await n(e,r.parts[t]);let l=``;for(let t=i+1;t<r.parts.length;t++)l+=await n(e,r.parts[t]);if(s===0){if(a)return{values:[c+l],quoted:!0};let e=c+l;return{values:e?[e]:[],quoted:!0}}let u=[];for(let t=1;t<=s;t++)u.push(e.state.env.get(String(t))||``);if(a){let t=q(e.state.env);return{values:[c+u.join(t)+l],quoted:!0}}return u.length===1?{values:[c+u[0]+l],quoted:!0}:{values:[c+u[0],...u.slice(1,-1),u[u.length-1]+l],quoted:!0}}var ED=S(()=>{Ss(),DT(),oE(),pE(),gE()});function DD(e){return new eT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function OD(e,t){if(e.state.options.noglob)return t;let n=DD(e),r=[];for(let i of t)if(eE(i,e.state.shoptOptions.extglob)){let e=await n.expand(i);if(e.length>0)r.push(...e);else{if(n.hasFailglob())throw new zr(i);n.hasNullglob()||r.push(i)}}else r.push(i);return r}async function kD(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternReplacement`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=J(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Y(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)u+=Y(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=aE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=aE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Y(n,!0,e.state.shoptOptions.extglob)}else{let n=await r(e,t);u+=aE(n)}let d=s.replacement?await n(e,s.replacement.parts):``,f=u;s.anchor===`start`?f=`^${u}`:s.anchor===`end`&&(f=`${u}$`);let p=[];try{let e=R(f,s.all?`g`:``);for(let t of l)p.push(e.replace(t,d))}catch{p.push(...l)}let m=hT(e.state.env),h=gT(e.state.env);if(o){let t=q(e.state.env),n=p.join(t);return h?{values:n?[n]:[],quoted:!1}:{values:CT(n,m),quoted:!1}}if(h)return{values:p,quoted:!1};let g=[];for(let e of p)e===``?g.push(``):g.push(...CT(e,m));return{values:g,quoted:!1}}async function AD(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternRemoval`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=J(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``,d=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Y(t.pattern,s.greedy,d);else if(t.type===`Literal`)u+=Y(t.value,s.greedy,d);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=aE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=aE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Y(n,s.greedy,d)}else{let n=await r(e,t);u+=aE(n)}let f=[];for(let e of l)f.push(mE(e,u,s.side,s.greedy));let p=hT(e.state.env),m=gT(e.state.env);if(o){let t=q(e.state.env),n=f.join(t);return m?{values:n?[n]:[],quoted:!1}:{values:CT(n,p),quoted:!1}}if(m)return{values:f,quoted:!1};let h=[];for(let e of f)e===``?h.push(``):h.push(...CT(e,p));return{values:h,quoted:!1}}async function jD(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`PatternRemoval`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=[];for(let t=1;t<=s;t++)c.push(e.state.env.get(String(t))||``);if(c.length===0)return{values:[],quoted:!1};let l=``,u=e.state.shoptOptions.extglob;if(o.pattern)for(let t of o.pattern.parts)if(t.type===`Glob`)l+=Y(t.pattern,o.greedy,u);else if(t.type===`Literal`)l+=Y(t.value,o.greedy,u);else if(t.type===`SingleQuoted`||t.type===`Escaped`)l+=aE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);l+=aE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);l+=Y(n,o.greedy,u)}else{let n=await r(e,t);l+=aE(n)}let d=[];for(let e of c)d.push(mE(e,l,o.side,o.greedy));let f=hT(e.state.env),p=gT(e.state.env);if(a){let t=q(e.state.env),n=d.join(t);return p?{values:n?[n]:[],quoted:!1}:{values:CT(n,f),quoted:!1}}if(p)return{values:d,quoted:!1};let m=[];for(let e of d)e===``?m.push(``):m.push(...CT(e,f));return{values:m,quoted:!1}}async function MD(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`Substring`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,l=Number.parseInt(e.state.env.get(`#`)||`0`,10),u=[];for(let t=1;t<=l;t++)u.push(e.state.env.get(String(t))||``);let d=e.state.env.get(`0`)||`bash`,f;if(s<=0){let e=[d,...u],t=e.length+s;if(t<0)f=[];else{let n=s<0?t:0;if(c!==void 0){let t=c<0?e.length+c:n+c;f=e.slice(n,Math.max(n,t))}else f=e.slice(n)}}else{let e=s-1;if(e>=u.length)f=[];else if(c!==void 0){let t=c<0?u.length+c:e+c;f=u.slice(e,Math.max(e,t))}else f=u.slice(e)}let p=``;for(let n=0;n<i;n++)p+=await r(e,t[n]);let m=``;for(let n=i+1;n<t.length;n++)m+=await r(e,t[n]);let h=hT(e.state.env),g=gT(e.state.env);if(f.length===0){let e=p+m;return e?g?{values:[e],quoted:!1}:{values:CT(e,h),quoted:!1}:{values:[],quoted:!1}}let _;if(a){let t=q(e.state.env),n=p+f.join(t)+m;_=g?n?[n]:[]:CT(n,h)}else if(g)_=f.length===1?[p+f[0]+m]:[p+f[0],...f.slice(1,-1),f[f.length-1]+m];else{_=[];for(let e=0;e<f.length;e++){let t=f[e];if(e===0&&(t=p+t),e===f.length-1&&(t+=m),t===``)_.push(``);else{let e=CT(t,h);_.push(...e)}}}return{values:await OD(e,_),quoted:!1}}async function ND(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].parameter!==`@`&&t[0].parameter!==`*`||t[0].operation)return null;let n=t[0].parameter===`*`,r=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(r===0)return{values:[],quoted:!1};let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=hT(e.state.env),o=gT(e.state.env),s=_T(e.state.env),c;if(n)if(o)c=i.filter(e=>e!==``);else{let t=q(e.state.env);c=CT(i.join(t),a)}else if(o)c=i.filter(e=>e!==``);else if(s){c=[];for(let e of i){if(e===``)continue;let t=CT(e,a);c.push(...t)}}else{c=[];for(let e of i)if(e===``)c.push(``);else{let t=CT(e,a);c.push(...t)}for(;c.length>0&&c[c.length-1]===``;)c.pop()}return{values:await OD(e,c),quoted:!1}}async function PD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],i=n[2]===`*`,a=J(e,r),o;if(a.length===0){let t=e.state.env.get(r);if(t!==void 0)o=[t];else return{values:[],quoted:!1}}else o=a.map(([,e])=>e);let s=hT(e.state.env),c=gT(e.state.env),l=_T(e.state.env),u;if(i)if(c)u=o.filter(e=>e!==``);else{let t=q(e.state.env);u=CT(o.join(t),s)}else if(c)u=o.filter(e=>e!==``);else if(l){u=[];for(let e of o){if(e===``)continue;let t=CT(e,s);u.push(...t)}}else{u=[];for(let e of o)if(e===``)u.push(``);else{let t=CT(e,s);u.push(...t)}for(;u.length>0&&u[u.length-1]===``;)u.pop()}return{values:await OD(e,u),quoted:!1}}function FD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`VarNamePrefix`)return null;let n=t[0].operation,r=hE(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let i=hT(e.state.env),a=gT(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=CT(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=CT(e,i);o.push(...t)}}return{values:o,quoted:!1}}function ID(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`ArrayKeys`)return null;let n=t[0].operation,r=J(e,n.array).map(([e])=>String(e));if(r.length===0)return{values:[],quoted:!1};let i=hT(e.state.env),a=gT(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=CT(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=CT(e,i);o.push(...t)}}return{values:o,quoted:!1}}async function LD(e,t,n){let r=-1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&!n.operation){r=e;break}}if(r===-1||t.length<=1)return null;let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=[];for(let t=1;t<=i;t++)a.push(e.state.env.get(String(t))||``);let o=``;for(let i=0;i<r;i++)o+=await n(e,t[i]);let s=``;for(let i=r+1;i<t.length;i++)s+=await n(e,t[i]);let c=hT(e.state.env),l=gT(e.state.env),u=_T(e.state.env);if(i===0){let e=o+s;return{values:e?[e]:[],quoted:!1}}let d;{let e=[];for(let t=0;t<a.length;t++){let n=a[t];t===0&&(n=o+n),t===a.length-1&&(n+=s),e.push(n)}if(l)d=e.filter(e=>e!==``);else if(u){d=[];for(let t of e){if(t===``)continue;let e=CT(t,c);d.push(...e)}}else{d=[];for(let t of e)if(t===``)d.push(``);else{let e=CT(t,c);d.push(...e)}for(;d.length>0&&d[d.length-1]===``;)d.pop()}}return d.length===0?{values:[],quoted:!1}:{values:await OD(e,d),quoted:!1}}var RD=S(()=>{Ss(),tT(),A(),DT(),oE(),iE(),pE(),gE(),UT()});async function zD(e,t,n){e.coverage?.hit(`bash:expansion:word_glob`);let r=t.parts,{hasQuoted:i,hasCommandSub:a,hasArrayVar:o,hasArrayAtExpansion:s,hasParamExpansion:c,hasVarNamePrefixExpansion:l,hasIndirection:u}=aT(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return BD(e,d,i);let f=await VD(e,r,s,l,u,n);if(f!==null)return f;let p=await UD(e,r,n);if(p!==null)return p;let m=await WD(e,r,n);if(m!==null)return m;let h=await qD(e,r,n.expandPart);if(h!==null)return JD(e,h);if((a||o||c)&&!gT(e.state.env)){let t=hT(e.state.env),i=n.buildIfsCharClassPattern(t);return JD(e,await n.smartWordSplit(e,r,t,i,n.expandPart))}return XD(e,t,r,await n.expandWordAsync(e,t),i,n.expandWordForGlobbing)}async function BD(e,t,n){let r=[];for(let i of t)if(!(!n&&i===``))if(!n&&!e.state.options.noglob&&eE(i,e.state.shoptOptions.extglob)){let t=await YD(e,i);r.push(...t)}else r.push(i);return{values:r,quoted:!1}}async function VD(e,t,n,r,i,a){if(n){let n=fD(e,t);if(n!==null)return n}{let n=pD(e,t);if(n!==null)return n}{let n=await aD(e,t);if(n!==null)return n}{let r=await oD(e,t,n,a.expandPart,a.expandWordPartsAsync);if(r!==null)return r}{let r=await sD(e,t,n,a.expandPart);if(r!==null)return r}{let n=await lD(e,t,a.evaluateArithmetic);if(n!==null)return n}{let n=uD(e,t);if(n!==null)return n}{let n=await nD(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}{let n=await rD(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}if(r&&t.length===1&&t[0].type===`DoubleQuoted`){let n=HD(e,t);if(n!==null)return n}{let n=await hD(e,t,i,a.expandParameterAsync,a.expandWordPartsAsync);if(n!==null)return n}{let n=await vD(e,t);if(n!==null)return n}{let n=await yD(e,t);if(n!==null)return n}return null}function HD(e,t){let n=t[0];if(n.type!==`DoubleQuoted`)return null;if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`VarNamePrefix`){let t=n.parts[0].operation,r=hE(e,t.prefix);return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`ArrayKeys`){let t=n.parts[0].operation,r=J(e,t.array).map(([e])=>String(e));return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}return null}async function UD(e,t,n){{let r=await SD(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await CD(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await wD(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await TD(e,t,n.expandPart);if(r!==null)return r}return null}async function WD(e,t,n){{let r=await kD(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await AD(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await jD(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await MD(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let n=await ND(e,t);if(n!==null)return n}{let n=await PD(e,t);if(n!==null)return n}{let n=FD(e,t);if(n!==null)return n}{let n=ID(e,t);if(n!==null)return n}{let r=await LD(e,t,n.expandPart);if(r!==null)return r}return null}function GD(e){if(e.type!==`DoubleQuoted`)return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!==`ParameterExpansion`||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:`array`,name:r[1],atIndex:t,isStar:r[2]===`*`};if(n.parameter===`@`||n.parameter===`*`)return{type:`positional`,atIndex:t,isStar:n.parameter===`*`}}return null}async function KD(e,t,n,r){let i=``;for(let a=0;a<n.atIndex;a++)i+=await r(e,t.parts[a]);let a=``;for(let i=n.atIndex+1;i<t.parts.length;i++)a+=await r(e,t.parts[i]);let o;if(n.type===`array`){if(o=J(e,n.name).map(([,e])=>e),o.length===0){let t=e.state.env.get(n.name);t!==void 0&&(o=[t])}}else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);o=[];for(let n=1;n<=t;n++)o.push(e.state.env.get(String(n))||``)}if(n.isStar){let t=q(e.state.env),n=o.join(t);return[i+n+a]}if(o.length===0){let e=i+a;return e?[e]:[]}return o.length===1?[i+o[0]+a]:[i+o[0],...o.slice(1,-1),o[o.length-1]+a]}async function qD(e,t,n){if(t.length<2)return null;let r=!1;for(let e of t)if(GD(e)){r=!0;break}if(!r)return null;let i=hT(e.state.env),a=gT(e.state.env),o=[];for(let r of t){let t=GD(r);if(t&&r.type===`DoubleQuoted`){let i=await KD(e,r,t,n);o.push(i)}else if(r.type===`DoubleQuoted`||r.type===`SingleQuoted`){let t=await n(e,r);o.push([t])}else if(r.type===`Literal`)o.push([r.value]);else if(r.type===`ParameterExpansion`){let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=CT(t,i);o.push(e)}}else{let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=CT(t,i);o.push(e)}}}let s=[];for(let e of o)if(e.length!==0)if(s.length===0)s.push(...e);else{let t=s.length-1;s[t]=s[t]+e[0];for(let t=1;t<e.length;t++)s.push(e[t])}return s}async function JD(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(eE(r,e.state.shoptOptions.extglob)){let t=await YD(e,r);n.push(...t)}else n.push(r);return{values:n,quoted:!1}}async function YD(e,t){let n=new eT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new zr(t);return n.hasNullglob()?[]:[t]}async function XD(e,t,n,r,i,a){let o=n.some(e=>e.type===`Glob`);if(!e.state.options.noglob&&o){let n=await a(e,t);if(eE(n,e.state.shoptOptions.extglob)){let t=await YD(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1};if(t.length===0)return{values:[],quoted:!1}}let i=tE(r);return gT(e.state.env)?{values:[i],quoted:!1}:{values:CT(i,hT(e.state.env)),quoted:!1}}if(!i&&!e.state.options.noglob&&eE(r,e.state.shoptOptions.extglob)){let n=await a(e,t);if(eE(n,e.state.shoptOptions.extglob)){let t=await YD(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1}}}if(r===``&&!i)return{values:[],quoted:!1};if(o&&!i){let t=tE(r);return gT(e.state.env)?{values:[t],quoted:!1}:{values:CT(t,hT(e.state.env)),quoted:!1}}return{values:[r],quoted:i}}var ZD=S(()=>{tT(),A(),DT(),oT(),iD(),cD(),dD(),mD(),iE(),bD(),gE(),ED(),RD(),UT()});async function QD(e,t){let n=t.operation;if(!n||n.type!==`DefaultValue`&&n.type!==`AssignDefault`&&n.type!==`UseAlternative`)return null;let r=n.word;if(!r||r.parts.length===0)return null;let i=await HT(e,t.parameter),a=await VT(e,t.parameter,!1)===``,o=n.checkEmpty??!1,s;return s=n.type===`UseAlternative`?i&&!(o&&a):!i||o&&a,s?r.parts:null}function $D(e){return e.type===`SingleQuoted`?!0:e.type===`DoubleQuoted`?e.parts.every(e=>e.type===`Literal`):!1}async function eO(e,t){if(t.type!==`ParameterExpansion`)return null;let n=await QD(e,t);if(!n||n.length<=1)return null;let r=n.some(e=>$D(e)),i=n.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`);return r&&i?n:null}function tO(e){return e.type===`DoubleQuoted`||e.type===`SingleQuoted`||e.type===`Literal`?!1:e.type===`Glob`?nT(e.pattern):!(!(e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`)||e.type===`ParameterExpansion`&&iT(e))}async function nO(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:word_split`),t.length===1&&t[0].type===`ParameterExpansion`){let a=t[0],o=await QD(e,a);if(o&&o.length>0&&o.length>1&&o.some(e=>e.type===`DoubleQuoted`||e.type===`SingleQuoted`)&&o.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`))return iO(e,o,n,r,i)}let a=[],o=!1;for(let n of t){let t=tO(n),r=n.type===`DoubleQuoted`||n.type===`SingleQuoted`,s=t?await eO(e,n):null,c=await i(e,n);a.push({value:c,isSplittable:t,isQuoted:r,mixedDefaultParts:s??void 0}),t&&(o=!0)}if(!o){let e=a.map(e=>e.value).join(``);return e?[e]:[]}let s=[],c=``,l=!1,u=!1,d=!1;for(let t of a)if(!t.isSplittable)u?t.isQuoted&&t.value===``?(c!==``&&s.push(c),s.push(``),l=!0,c=``,u=!1,d=!0):t.value===``?(c+=t.value,d=!1):(c!==``&&s.push(c),c=t.value,u=!1,d=!1):(c+=t.value,d=t.isQuoted&&t.value===``);else if(t.mixedDefaultParts){let a=await iO(e,t.mixedDefaultParts,n,r,i);if(a.length!==0)if(a.length===1)c+=a[0],l=!0;else{c+=a[0],s.push(c),l=!0;for(let e=1;e<a.length-1;e++)s.push(a[e]);c=a[a.length-1]}u=!1,d=!1}else{let{words:e,hadLeadingDelimiter:r,hadTrailingDelimiter:i}=ST(t.value,n);if(d&&r&&c===``&&(s.push(``),l=!0),e.length===0)i&&(u=!0);else if(e.length===1)c+=e[0],l=!0,u=i;else{c+=e[0],s.push(c),l=!0;for(let t=1;t<e.length-1;t++)s.push(e[t]);c=e[e.length-1],u=i}d=!1}return c===``?s.length===0&&l&&s.push(``):s.push(c),s}function rO(e,t){return e.length>0&&t.includes(e[0])}async function iO(e,t,n,r,i){let a=[];for(let n of t){let t=!(n.type===`DoubleQuoted`||n.type===`SingleQuoted`),r=await i(e,n);a.push({value:r,isSplittable:t})}let o=[],s=``,c=!1,l=!1;for(let e of a)if(!e.isSplittable)l&&e.value!==``?(s!==``&&o.push(s),s=e.value,l=!1):s+=e.value;else{rO(e.value,n)&&s!==``&&(o.push(s),s=``,c=!0);let{words:t,hadTrailingDelimiter:r}=ST(e.value,n);if(t.length===0)r&&(l=!0);else if(t.length===1)s+=t[0],c=!0,l=r;else{s+=t[0],o.push(s),c=!0;for(let e=1;e<t.length-1;e++)o.push(t[e]);s=t[t.length-1],l=r}}return s===``?o.length===0&&c&&o.push(``):o.push(s),o}var aO=S(()=>{UT(),DT(),oT()});function oO(e){switch(e.type){case`Literal`:return e.value;case`SingleQuoted`:return e.value;case`Escaped`:return e.value;default:return null}}function sO(e){switch(e.type){case`SingleQuoted`:case`Escaped`:case`DoubleQuoted`:return!0;case`Literal`:return e.value===``;default:return!1}}var cO=S(()=>{}),lO={};C(lO,{escapeGlobChars:()=>nE,escapeRegexChars:()=>rE,expandRedirectTarget:()=>TO,expandWord:()=>X,expandWordForPattern:()=>gO,expandWordForRegex:()=>hO,expandWordWithGlob:()=>SO,getArrayElements:()=>J,getVariable:()=>VT,hasQuotedMultiValueAt:()=>wO,isArray:()=>BT,isWordFullyQuoted:()=>pO});function uO(e,t,n){if(e.length>t)throw new k(`${n}: string length limit exceeded (${t} bytes)`,`string_length`)}async function dO(e,t,n=!1){let r=[];for(let i of t)r.push(await DO(e,i,n));return r.join(``)}function fO(e){return sO(e)}function pO(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!fO(t))return!1;return!0}function mO(e,t,n=!1){let r=oO(t);if(r!==null)return r;switch(t.type){case`TildeExpansion`:return n?t.user===null?`~`:`~${t.user}`:(e.coverage?.hit(`bash:expansion:tilde`),t.user===null?e.state.env.get(`HOME`)??`/home/user`:t.user===`root`?`/root`:`~${t.user}`);case`Glob`:return JE(e,t.pattern);default:return null}}async function X(e,t){return EO(e,t)}async function hO(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`)n.push(`\\${r.value}`);else if(r.type===`SingleQuoted`)n.push(r.value);else if(r.type===`DoubleQuoted`){let t=await dO(e,r.parts);n.push(t)}else if(r.type===`TildeExpansion`){let t=await DO(e,r);n.push(rE(t))}else n.push(await DO(e,r));return n.join(``)}async function gO(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`){let e=r.value;`()|*?[]`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`SingleQuoted`)n.push(nE(r.value));else if(r.type===`DoubleQuoted`){let t=await dO(e,r.parts);n.push(nE(t))}else n.push(await DO(e,r));return n.join(``)}async function _O(e,t){let n=[];for(let r of t.parts)if(r.type===`SingleQuoted`)n.push(nE(r.value));else if(r.type===`Escaped`){let e=r.value;`*?[]\\()|`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`DoubleQuoted`){let t=await dO(e,r.parts);n.push(nE(t))}else r.type===`Glob`?GE(r.pattern)?n.push(await XE(e,r.pattern)):n.push(JE(e,r.pattern)):r.type===`Literal`?n.push(r.value):n.push(await DO(e,r));return n.join(``)}function vO(e){for(let t of e)if(t.type===`BraceExpansion`||t.type===`DoubleQuoted`&&vO(t.parts))return!0;return!1}async function yO(e,t,n={count:0}){if(n.count>kO)return[[]];let r=[[]];for(let i of t)if(i.type===`BraceExpansion`){let t=[],a=!1,o=``;for(let r of i.items)if(r.type===`Range`){let e=YT(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)for(let r of e.expanded)n.count++,t.push(r);else{a=!0,o=e.literal;break}}else{let i=await yO(e,r.word.parts,n);for(let r of i){n.count++;let i=[];for(let t of r)typeof t==`string`?i.push(t):i.push(await DO(e,t));t.push(i.join(``))}}if(a){for(let e of r)n.count++,e.push(o);continue}if(r.length*t.length>e.limits.maxBraceExpansionResults||n.count>kO)return r;let s=[];for(let e of r)for(let i of t){if(n.count++,n.count>kO)return s.length>0?s:r;s.push([...e,i])}r=s}else for(let e of r)n.count++,e.push(i);return r}async function bO(e,t){let n=t.parts;if(!vO(n))return[await X(e,t)];let r=await yO(e,n),i=[];for(let t of r){let n=[];for(let r of t)typeof r==`string`?n.push(r):n.push(await DO(e,r));i.push($E(e,n.join(``)))}return i}function xO(){return{expandWordAsync:EO,expandWordForGlobbing:_O,expandWordWithBracesAsync:bO,expandWordPartsAsync:dO,expandPart:DO,expandParameterAsync:OO,hasBraceExpansion:vO,evaluateArithmetic:Z,buildIfsCharClassPattern:vT,smartWordSplit:nO}}async function SO(e,t){return zD(e,t,xO())}function CO(e){for(let t of e){if(t.type===`ParameterExpansion`)return t.parameter;if(t.type===`Literal`)return t.value}return``}function wO(e,t){if(Number.parseInt(e.state.env.get(`#`)||`0`,10)<2)return!1;function n(e){for(let t of e)if(t.type===`DoubleQuoted`){for(let e of t.parts)if(e.type===`ParameterExpansion`&&e.parameter===`@`&&!e.operation)return!0}return!1}return n(t.parts)}async function TO(e,t){if(wO(e,t))return{error:`bash: $@: ambiguous redirect
859
- `};let n=t.parts,{hasQuoted:r}=aT(n);if(vO(n)&&(await bO(e,t)).length>1)return{error:`bash: ${n.map(e=>e.type===`Literal`?e.value:e.type===`BraceExpansion`?`{${e.items.map(e=>{if(e.type===`Range`){let t=e.step?`..${e.step}`:``;return`${e.startStr??e.start}..${e.endStr??e.end}${t}`}return e.word.parts.map(e=>e.type===`Literal`?e.value:``).join(``)}).join(`,`)}}`:``).join(``)}: ambiguous redirect
860
- `};let i=await EO(e,t),{hasParamExpansion:a,hasCommandSub:o}=aT(n);if((a||o)&&!r&&!gT(e.state.env)&&CT(i,hT(e.state.env)).length>1)return{error:`bash: $${CO(n)}: ambiguous redirect
861
- `};if(r||e.state.options.noglob)return{target:i};let s=await _O(e,t);if(!eE(s,e.state.shoptOptions.extglob))return{target:i};let c=new eT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),l=await c.expand(s);return l.length===0?c.hasFailglob()?{error:`bash: no match: ${i}
851
+ `,``):e.state.env.get(`${t}_${i}`)||``}let o=e.state.env.get(`${t}_${a}`);if(o!==void 0)return o;if(a===0){let n=e.state.env.get(t);if(n!==void 0)return n}if(n&&e.state.options.nounset)throw new Fr(`${t}[${a}]`);return``}if(/^[1-9][0-9]*$/.test(t)){let r=e.state.env.get(t);if(r===void 0&&n&&e.state.options.nounset)throw new Fr(t);return r||``}if(FT(e,t)){let i=HT(e,t);if(i===void 0)return``;if(i!==t)return await JT(e,i,n,r);let a=e.state.env.get(t);if((a===void 0||a===``)&&n&&e.state.options.nounset)throw new Fr(t);return a||``}let a=e.state.env.get(t);if(a!==void 0)return e.state.tempEnvBindings?.some(e=>e.has(t))&&(e.state.accessedTempEnvVars=e.state.accessedTempEnvVars||new Set,e.state.accessedTempEnvVars.add(t)),a;if(qT(e,t)){let n=e.state.env.get(`${t}_0`);return n===void 0?``:n}if(n&&e.state.options.nounset)throw new Fr(t);return``}async function YT(e,t){if(new Set([`?`,`$`,`#`,`_`,`-`,`0`,`PPID`,`UID`,`EUID`,`RANDOM`,`SECONDS`,`BASH_VERSION`,`!`,`BASHPID`,`LINENO`]).has(t))return!0;if(t===`@`||t===`*`)return Number.parseInt(e.state.env.get(`#`)||`0`,10)>0;if(t===`PWD`||t===`OLDPWD`)return e.state.env.has(t);let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(FT(e,t)){let n=HT(e,t);if(n&&n!==t){if(n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/))return!1;t=n}}if(r===`@`||r===`*`)return J(e,t).length>0?!0:e.state.env.has(t);if(e.state.associativeArrays?.has(t)){let n=_T(r);return e.state.env.has(`${t}_${n}`)}let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else try{i=await Z(e,TC(new Zw,r).expression)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0,Number.isNaN(i)&&(i=0)}if(i<0){let n=J(e,t);if(n.length===0)return!1;let r=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+i;return r<0?!1:e.state.env.has(`${t}_${r}`)}return e.state.env.has(`${t}_${i}`)}if(FT(e,t)){let n=HT(e,t);return n===void 0||n===t?e.state.env.has(t):YT(e,n)}return!!(e.state.env.has(t)||qT(e,t))}var XT=S(()=>{KC(),Qw(),YS(),qO(),A(),xT(),PT(),GT()});async function ZT(e,t){let n=``,r=0;for(;r<t.length;){if(t[r]===`$`){if(t[r+1]===`{`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`{`?e++:t[i]===`}`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(t[r+1]===`(`){let e=1,i=r+2;for(;i<t.length&&e>0;)t[i]===`(`?e++:t[i]===`)`&&e--,i++;n+=t.slice(r,i),r=i;continue}if(/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await JT(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[0-9]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[0-9]/.test(t[i]);)i++;let a=await JT(e,t.slice(r+1,i));n+=a,r=i;continue}if(/[*@#?\-!$]/.test(t[r+1]||``)){let i=t[r+1],a=await JT(e,i);n+=a,r+=2;continue}}if(t[r]===`"`){for(n+=`"`,r++;r<t.length&&t[r]!==`"`;)if(t[r]===`$`&&/[a-zA-Z_]/.test(t[r+1]||``)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=await JT(e,t.slice(r+1,i));n+=a,r=i}else t[r]===`\\`?(n+=t[r],r++,r<t.length&&(n+=t[r],r++)):(n+=t[r],r++);r<t.length&&(n+=`"`,r++);continue}n+=t[r],r++}return n}async function QT(e,t){let n=t,r=t.startsWith(`"`)&&t.endsWith(`"`),i=t.startsWith(`'`)&&t.endsWith(`'`);if((r||i)&&(n=t.slice(1,-1)),i)return n;let a=``,o=0;for(;o<n.length;)if(n[o]===`$`)if(n[o+1]===`(`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`(`&&n[r-1]===`$`||n[r]===`(`?t++:n[r]===`)`&&t--,r++;let i=n.slice(o+2,r-1);if(e.execFn){let t=await e.execFn(i,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=r}else if(n[o+1]===`{`){let t=1,r=o+2;for(;r<n.length&&t>0;)n[r]===`{`?t++:n[r]===`}`&&t--,r++;let i=await JT(e,n.slice(o+2,r-1));a+=i,o=r}else if(/[a-zA-Z_]/.test(n[o+1]||``)){let t=o+1;for(;t<n.length&&/[a-zA-Z0-9_]/.test(n[t]);)t++;let r=await JT(e,n.slice(o+1,t));a+=r,o=t}else a+=n[o],o++;else if(n[o]==="`"){let t=o+1;for(;t<n.length&&n[t]!=="`";)t++;let r=n.slice(o+1,t);if(e.execFn){let t=await e.execFn(r,{signal:e.state.signal});a+=t.stdout.replace(/\n+$/,``),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr)}o=t+1}else a+=n[o],o++;return a}var $T=S(()=>{XT()});function eE(e,t,n,r,i){let a=n??1;a===0&&(a=1);let o=Math.abs(a),s=[],c=0;r?.match(/^-?0\d/)&&(c=Math.max(c,r.replace(/^-/,``).length)),i?.match(/^-?0\d/)&&(c=Math.max(c,i.replace(/^-/,``).length));let l=e=>{if(c>0){let t=e<0,n=String(Math.abs(e)).padStart(c,`0`);return t?`-${n}`:n}return String(e)};if(e<=t)for(let n=e,r=0;n<=t&&r<rE;n+=o,r++)s.push(l(n));else for(let n=e,r=0;n>=t&&r<rE;n-=o,r++)s.push(l(n));return s}function tE(e,t,n){let r=n??1;r===0&&(r=1);let i=e.charCodeAt(0),a=t.charCodeAt(0),o=Math.abs(r);if(e>=`A`&&e<=`Z`&&t>=`a`&&t<=`z`||e>=`a`&&e<=`z`&&t>=`A`&&t<=`Z`){let r=n===void 0?``:`..${n}`;throw new Br(`{${e}..${t}${r}}: invalid sequence`)}let s=[];if(i<=a)for(let e=i,t=0;e<=a&&t<rE;e+=o,t++)s.push(String.fromCharCode(e));else for(let e=i,t=0;e>=a&&t<rE;e-=o,t++)s.push(String.fromCharCode(e));return s}function nE(e,t,n,r,i){let a=n===void 0?``:`..${n}`;return typeof e==`number`&&typeof t==`number`?{expanded:eE(e,t,n,r,i),literal:`{${e}..${t}${a}}`}:typeof e==`string`&&typeof t==`string`?{expanded:tE(e,t,n),literal:`{${e}..${t}${a}}`}:{expanded:null,literal:`{${e}..${t}${a}}`}}var rE,iE=S(()=>{A(),rE=1e4});function aE(e){if(e.statements.length!==1)return null;let t=e.statements[0];if(t.operators.length!==0||t.pipelines.length!==1)return null;let n=t.pipelines[0];if(n.negated||n.commands.length!==1)return null;let r=n.commands[0];if(r.type!==`SimpleCommand`)return null;let i=r;if(i.name!==null||i.args.length!==0||i.assignments.length!==0||i.redirections.length!==1)return null;let a=i.redirections[0];return a.operator!==`<`||a.target.type!==`Word`?null:{target:a.target}}var oE=S(()=>{});function sE(e,t){return!!(/[*?[]/.test(e)||t&&/[@*+?!]\(/.test(e))}function cE(e){let t=``,n=0;for(;n<e.length;)e[n]===`\\`&&n+1<e.length?(t+=e[n+1],n+=2):(t+=e[n],n++);return t}function lE(e){return e.replace(/([*?[\]\\()|])/g,`\\$1`)}function uE(e){return e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`)}var dE=S(()=>{});function fE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var pE=S(()=>{});function Y(e,t,n=!1){let r=``,i=0;for(;i<e.length;){let a=e[i];if(n&&(a===`@`||a===`*`||a===`+`||a===`?`||a===`!`)&&i+1<e.length&&e[i+1]===`(`){let o=mE(e,i+1);if(o!==-1){let s=hE(e.slice(i+2,o)).map(e=>Y(e,t,n)),c=s.length>0?s.join(`|`):`(?:)`;a===`@`?r+=`(?:${c})`:a===`*`?r+=`(?:${c})*`:a===`+`?r+=`(?:${c})+`:a===`?`?r+=`(?:${c})?`:a===`!`&&(r+=`(?!(?:${c})$).*`),i=o+1;continue}}if(a===`\\`)if(i+1<e.length){let t=e[i+1];/[\\^$.|+(){}[\]*?]/.test(t)?r+=`\\${t}`:r+=t,i+=2}else r+=`\\\\`,i++;else if(a===`*`)r+=t?`.*`:`.*?`,i++;else if(a===`?`)r+=`.`,i++;else if(a===`[`){let t=gE(e,i);if(t===-1)r+=`\\[`,i++;else{let n=e.slice(i+1,t);r+=_E(n),i=t+1}}else /[\^$.|+(){}]/.test(a)?(r+=`\\${a}`,i++):(r+=a,i++)}return r}function mE(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 hE(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function gE(e,t){let n=t+1;for(n<e.length&&e[n]===`^`&&n++,n<e.length&&e[n]===`]`&&n++;n<e.length;){if(e[n]===`\\`&&n+1<e.length){n+=2;continue}if(e[n]===`]`)return n;if(e[n]===`'`){let t=e.indexOf(`'`,n+1);if(t!==-1){n=t+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){n=t+2;continue}}n++}return-1}function _E(e){let t=`[`,n=0;for((e[0]===`^`||e[0]===`!`)&&(t+=`^`,n++);n<e.length;){if(e[n]===`'`){let r=e.indexOf(`'`,n+1);if(r!==-1){let i=e.slice(n+1,r);for(let e of i)e===`\\`?t+=`\\\\`:e===`]`?t+=`\\]`:e===`^`&&t===`[`?t+=`\\^`:t+=e;n=r+1;continue}}if(e[n]===`[`&&n+1<e.length&&e[n+1]===`:`){let r=e.indexOf(`:]`,n+2);if(r!==-1){let i=e.slice(n+2,r);t+=vE(i),n=r+2;continue}}let r=e[n];r===`\\`?n+1<e.length?(t+=`\\${e[n+1]}`,n+=2):(t+=`\\\\`,n++):r===`-`&&n>0&&n<e.length-1?(t+=`-`,n++):r===`^`&&n===0?(t+=`^`,n++):(r===`]`&&n===0?t+=`\\]`:t+=r,n++)}return t+=`]`,t}function vE(e){return yE.get(e)??``}var yE,bE=S(()=>{yE=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`]])});function xE(e,t,n,r){if(n===`prefix`)return z(`^${t}`,`s`).replace(e,``);let i=z(`${t}$`,`s`);if(r)return i.replace(e,``);for(let t=e.length;t>=0;t--){let n=e.slice(t);if(i.test(n))return e.slice(0,t)}return e}function SE(e,t){let n=Array.from(e.state.env.keys()),r=new Set,i=e.state.associativeArrays??new Set,a=new Set;for(let e of n){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);t&&a.add(t[1]);let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n&&a.add(n[1])}let o=e=>{for(let t of i){let n=`${t}_`;if(e.startsWith(n)&&e!==t)return!0}return!1};for(let e of n)if(e.startsWith(t))if(e.includes(`__`)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);n?.[1].startsWith(t)&&r.add(n[1])}else if(/_\d+$/.test(e)){let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_\d+$/);n?.[1].startsWith(t)&&r.add(n[1])}else o(e)||r.add(e);return[...r].sort()}var CE=S(()=>{xs()});function wE(e,t){let n=(e,t=2)=>String(e).padStart(t,`0`);if(e===``)return`${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`;let r=``,i=0;for(;i<e.length;)if(e[i]===`%`){if(i+1>=e.length){r+=`%`,i++;continue}let a=e[i+1];switch(a){case`H`:r+=n(t.getHours());break;case`M`:r+=n(t.getMinutes());break;case`S`:r+=n(t.getSeconds());break;case`d`:r+=n(t.getDate());break;case`m`:r+=n(t.getMonth()+1);break;case`Y`:r+=t.getFullYear();break;case`y`:r+=n(t.getFullYear()%100);break;case`I`:{let e=t.getHours()%12;e===0&&(e=12),r+=n(e);break}case`p`:r+=t.getHours()<12?`AM`:`PM`;break;case`P`:r+=t.getHours()<12?`am`:`pm`;break;case`%`:r+=`%`;break;case`a`:r+=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][t.getDay()];break;case`b`:r+=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][t.getMonth()];break;default:r+=`%${a}`}i+=2}else r+=e[i],i++;return r}function TE(e,t){let n=``,r=0,i=e.state.env.get(`USER`)||e.state.env.get(`LOGNAME`)||`user`,a=e.state.env.get(`HOSTNAME`)||`localhost`,o=a.split(`.`)[0],s=e.state.env.get(`PWD`)||`/`,c=e.state.env.get(`HOME`)||`/`,l=s.startsWith(c)?`~${s.slice(c.length)}`:s,u=s.split(`/`).pop()||s,d=new Date,f=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],p=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],m=e.state.env.get(`__COMMAND_NUMBER`)||`1`;for(;r<t.length;){let e=t[r];if(e===`\\`){if(r+1>=t.length){n+=`\\`,r++;continue}let e=t[r+1];if(e>=`0`&&e<=`7`){let e=``,i=r+1;for(;i<t.length&&i<r+4&&t[i]>=`0`&&t[i]<=`7`;)e+=t[i],i++;let a=Number.parseInt(e,8)%256;n+=String.fromCharCode(a),r=i;continue}switch(e){case`\\`:n+=`\\`,r+=2;break;case`a`:n+=`\x07`,r+=2;break;case`e`:n+=`\x1B`,r+=2;break;case`n`:n+=`
852
+ `,r+=2;break;case`r`:n+=`\r`,r+=2;break;case`$`:n+=`$`,r+=2;break;case`[`:case`]`:r+=2;break;case`u`:n+=i,r+=2;break;case`h`:n+=o,r+=2;break;case`H`:n+=a,r+=2;break;case`w`:n+=l,r+=2;break;case`W`:n+=u,r+=2;break;case`d`:{let e=String(d.getDate()).padStart(2,` `);n+=`${f[d.getDay()]} ${p[d.getMonth()]} ${e}`,r+=2;break}case`t`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`),i=String(d.getSeconds()).padStart(2,`0`);n+=`${e}:${t}:${i}`,r+=2;break}case`T`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=String(d.getSeconds()).padStart(2,`0`);n+=`${t}:${i}:${a}`,r+=2;break}case`@`:{let e=d.getHours()%12;e===0&&(e=12);let t=String(e).padStart(2,`0`),i=String(d.getMinutes()).padStart(2,`0`),a=d.getHours()<12?`AM`:`PM`;n+=`${t}:${i} ${a}`,r+=2;break}case`A`:{let e=String(d.getHours()).padStart(2,`0`),t=String(d.getMinutes()).padStart(2,`0`);n+=`${e}:${t}`,r+=2;break}case`D`:if(r+2<t.length&&t[r+2]===`{`){let e=t.indexOf(`}`,r+3);if(e!==-1){let i=t.slice(r+3,e);n+=wE(i,d),r=e+1}else n+=`\\D`,r+=2}else n+=`\\D`,r+=2;break;case`s`:n+=`bash`,r+=2;break;case`v`:n+=`5.0`,r+=2;break;case`V`:n+=`5.0.0`,r+=2;break;case`j`:n+=`0`,r+=2;break;case`l`:n+=`tty`,r+=2;break;case`#`:n+=m,r+=2;break;case`!`:n+=m,r+=2;break;case`x`:n+=`\\x`,r+=2;break;default:n+=`\\${e}`,r+=2}}else n+=e,r++}return n}var EE=S(()=>{});function DE(e){if(e===``)return`''`;if(/[\n\r\t\x00-\x1f\x7f']/.test(e)){let t=`$'`;for(let n of e)switch(n){case`'`:t+=`\\'`;break;case`\\`:t+=`\\\\`;break;case`
853
+ `:t+=`\\n`;break;case`\r`:t+=`\\r`;break;case` `:t+=`\\t`;break;default:{let e=n.charCodeAt(0);e<32||e===127?t+=`\\${e.toString(8).padStart(3,`0`)}`:t+=n}}return`${t}'`}return`'${e}'`}var OE=S(()=>{});function kE(e,t){e.state.readonlyVars=e.state.readonlyVars||new Set,e.state.readonlyVars.add(t)}function AE(e,t){return e.state.readonlyVars?.has(t)??!1}function jE(e,t,n=`bash`){if(AE(e,t)){let e=`${n}: ${t}: readonly variable
854
+ `;throw new Ir(1,``,e)}return null}function ME(e,t){let n=e.state.exportedVars?.has(t)??!1;if(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t),e.state.localScopes.length>0&&e.state.localScopes[e.state.localScopes.length-1].has(t)&&!n){for(e.state.localExportedVars||(e.state.localExportedVars=[]);e.state.localExportedVars.length<e.state.localScopes.length;)e.state.localExportedVars.push(new Set);e.state.localExportedVars[e.state.localExportedVars.length-1].add(t)}}function NE(e,t){e.state.exportedVars?.delete(t)}var PE=S(()=>{A()});function FE(e,t){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t))return``;let n=``,r=e.state.env.has(`${t}__length`)||Array.from(e.state.env.keys()).some(e=>e.startsWith(`${t}_`)&&/^[0-9]+$/.test(e.slice(t.length+1))),i=e.state.associativeArrays?.has(t)??!1;return r&&!i&&(n+=`a`),i&&(n+=`A`),e.state.integerVars?.has(t)&&(n+=`i`),FT(e,t)&&(n+=`n`),AE(e,t)&&(n+=`r`),e.state.exportedVars?.has(t)&&(n+=`x`),n}var IE=S(()=>{GT(),PE()});async function LE(e,t,n,r){return e.coverage?.hit(`bash:expansion:default_value`),(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):n.effectiveValue}async function RE(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:assign_default`),(r.isUnset||n.checkEmpty&&r.isEmpty)&&n.word){let a=await i(e,n.word.parts,r.inDoubleQuotes),o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(o){let[,t,n]=o,r;if(/^\d+$/.test(n))r=Number.parseInt(n,10);else{try{r=await Z(e,TC(new Zw,n).expression)}catch{let t=e.state.env.get(n);r=t?Number.parseInt(t,10):0}Number.isNaN(r)&&(r=0)}e.state.env.set(`${t}_${r}`,a);let i=Number.parseInt(e.state.env.get(`${t}__length`)||`0`,10);r>=i&&e.state.env.set(`${t}__length`,String(r+1))}else e.state.env.set(t,a);return a}return r.effectiveValue}async function zE(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:error_if_unset`),r.isUnset||n.checkEmpty&&r.isEmpty){let a=n.word?await i(e,n.word.parts,r.inDoubleQuotes):`${t}: parameter null or not set`;throw new Ir(1,``,`bash: ${a}
855
+ `)}return r.effectiveValue}async function BE(e,t,n,r){return e.coverage?.hit(`bash:expansion:use_alternative`),!(n.isUnset||t.checkEmpty&&n.isEmpty)&&t.word?r(e,t.word.parts,n.inDoubleQuotes):``}async function VE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_removal`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Y(t.pattern,n.greedy,o);else if(t.type===`Literal`)a+=Y(t.value,n.greedy,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=fE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=fE(n)}else if(t.type===`ParameterExpansion`){let r=await i(e,t);a+=Y(r,n.greedy,o)}else{let n=await i(e,t);a+=fE(n)}if(n.side===`prefix`)return z(`^${a}`,`s`).replace(t,``);let s=z(`${a}$`,`s`);if(n.greedy)return s.replace(t,``);for(let e=t.length;e>=0;e--){let n=t.slice(e);if(s.test(n))return t.slice(0,e)}return t}async function HE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:pattern_replacement`);let a=``,o=e.state.shoptOptions.extglob;if(n.pattern)for(let t of n.pattern.parts)if(t.type===`Glob`)a+=Y(t.pattern,!0,o);else if(t.type===`Literal`)a+=Y(t.value,!0,o);else if(t.type===`SingleQuoted`||t.type===`Escaped`)a+=fE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);a+=fE(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);a+=Y(n,!0,o)}else{let n=await i(e,t);a+=fE(n)}let s=n.replacement?await r(e,n.replacement.parts):``;if(n.anchor===`start`?a=`^${a}`:n.anchor===`end`&&(a=`${a}$`),a===``)return t;let c=n.all?`gs`:`s`;try{let r=z(a,c);if(n.all){let n=``,i=0,a=0,o=e.limits.maxStringLength,c=r.exec(t);for(;c!==null&&!(c[0].length===0&&c.index===t.length);){if(n+=t.slice(i,c.index)+s,i=c.index+c[0].length,c[0].length===0&&i++,a++,a%100==0&&n.length>o)throw new k(`pattern replacement: string length limit exceeded (${o} bytes)`,`string_length`);c=r.exec(t)}return n+=t.slice(i),n}return r.replace(t,s)}catch(e){if(e instanceof k)throw e;return t}}function UE(e,t,n){e.coverage?.hit(`bash:expansion:length`);let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let t=r[1],n=J(e,t);return n.length>0?String(n.length):e.state.env.get(t)===void 0?`0`:`1`}if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)&&qT(e,t)){if(t===`FUNCNAME`){let t=e.state.funcNameStack?.[0]||``;return String([...t].length)}if(t===`BASH_LINENO`){let t=e.state.callLineStack?.[0];return String(t===void 0?0:[...String(t)].length)}let n=e.state.env.get(`${t}_0`)||``;return String([...n].length)}return String([...n].length)}async function WE(e,t,n,r){e.coverage?.hit(`bash:expansion:substring`);let i=await Z(e,r.offset.expression),a=r.length?await Z(e,r.length.expression):void 0;if(t===`@`||t===`*`){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);let r=e.state.env.get(`0`)||`bash`,o,s;if(i<=0)if(o=[r,...n],i<0){if(s=o.length+i,s<0)return``}else s=0;else o=n,s=i-1;if(s<0||s>=o.length)return``;if(a!==void 0){let e=a<0?o.length+a:s+a;return o.slice(s,Math.max(s,e)).join(` `)}return o.slice(s).join(` `)}let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(o){let t=o[1];if(e.state.associativeArrays?.has(t))throw new Ir(1,``,`bash: \${${t}[@]: 0: 3}: bad substitution
856
+ `);let n=J(e,t),r=0;if(i<0){if(n.length>0){let e=n[n.length-1][0],t=(typeof e==`number`?e:0)+1+i;if(t<0||(r=n.findIndex(([e])=>typeof e==`number`&&e>=t),r<0))return``}}else if(r=n.findIndex(([e])=>typeof e==`number`&&e>=i),r<0)return``;if(a!==void 0){if(a<0)throw new Lr(`${o[1]}[@]: substring expression < 0`);return n.slice(r,r+a).map(([,e])=>e).join(` `)}return n.slice(r).map(([,e])=>e).join(` `)}let s=[...n],c=i;if(c<0&&(c=Math.max(0,s.length+c)),a!==void 0){if(a<0){let e=s.length+a;return s.slice(c,Math.max(c,e)).join(``)}return s.slice(c,c+a).join(``)}return s.slice(c).join(``)}async function GE(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:case_modification`),n.pattern){let a=e.state.shoptOptions.extglob,o=``;for(let t of n.pattern.parts)if(t.type===`Glob`)o+=Y(t.pattern,!0,a);else if(t.type===`Literal`)o+=Y(t.value,!0,a);else if(t.type===`SingleQuoted`||t.type===`Escaped`)o+=fE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);o+=fE(n)}else if(t.type===`ParameterExpansion`){let n=await i(e,t);o+=Y(n,!0,a)}let s=z(`^(?:${o})$`),c=n.direction===`upper`?e=>e.toUpperCase():e=>e.toLowerCase(),l=``,u=!1;for(let e of t)!n.all&&u?l+=e:s.test(e)?(l+=c(e),u=!0):l+=e;return l}return n.direction===`upper`?n.all?t.toUpperCase():t.charAt(0).toUpperCase()+t.slice(1):n.all?t.toLowerCase():t.charAt(0).toLowerCase()+t.slice(1)}function KE(e,t,n,r,i){e.coverage?.hit(`bash:expansion:transform`);let a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(a&&i.operator===`Q`)return J(e,a[1]).map(([,e])=>DE(e)).join(` `);if(a&&i.operator===`a`)return FE(e,a[1]);let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[.+\]$/);if(o&&i.operator===`a`)return FE(e,o[1]);switch(i.operator){case`Q`:return r?``:DE(n);case`P`:return TE(e,n);case`a`:return FE(e,t);case`A`:return r?``:`${t}=${DE(n)}`;case`E`:return n.replace(/\\([\\abefnrtv'"?])/g,(e,t)=>{switch(t){case`\\`:return`\\`;case`a`:return`\x07`;case`b`:return`\b`;case`e`:return`\x1B`;case`f`:return`\f`;case`n`:return`
857
+ `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`'`:return`'`;case`"`:return`"`;case`?`:return`?`;default:return t}});case`K`:case`k`:return r?``:DE(n);case`u`:return n.charAt(0).toUpperCase()+n.slice(1);case`U`:return n.toUpperCase();case`L`:return n.toLowerCase();default:return n}}async function qE(e,t,n,r,i,a,o=!1){if(e.coverage?.hit(`bash:expansion:indirection`),FT(e,t))return UT(e,t)||``;let s=/^[a-zA-Z_][a-zA-Z0-9_]*\[([@*])\]$/.test(t);if(r){if(i.innerOp?.type===`UseAlternative`)return``;throw new Rr(`\${!${t}}`)}let c=n;if(s&&(c===``||c.includes(` `)))throw new Rr(`\${!${t}}`);let l=c.match(/^[a-zA-Z_][a-zA-Z0-9_]*\[(.+)\]$/);if(l&&l[1].includes(`~`))throw new Rr(`\${!${t}}`);return i.innerOp?a(e,{type:`ParameterExpansion`,parameter:c,operation:i.innerOp},o):await JT(e,c)}function JE(e,t){e.coverage?.hit(`bash:expansion:array_keys`);let n=J(e,t.array).map(([e])=>String(e));return t.star?n.join(q(e.state.env)):n.join(` `)}function YE(e,t){e.coverage?.hit(`bash:expansion:var_name_prefix`);let n=SE(e,t.prefix);return t.star?n.join(q(e.state.env)):n.join(` `)}function XE(e,t,n,r){let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t===`*`)return{isEmpty:i===0,effectiveValue:n};if(t===`@`)return{isEmpty:i===0||i===1&&e.state.env.get(`1`)===``,effectiveValue:n};if(a){let[,t,n]=a,i=J(e,t);if(i.length===0)return{isEmpty:!0,effectiveValue:``};if(n===`*`){let t=q(e.state.env),n=i.map(([,e])=>e).join(t);return{isEmpty:r?n===``:!1,effectiveValue:n}}return{isEmpty:i.length===1&&i.every(([,e])=>e===``),effectiveValue:i.map(([,e])=>e).join(` `)}}return{isEmpty:n===``,effectiveValue:n}}var ZE=S(()=>{KC(),Qw(),xs(),qO(),A(),PT(),GT(),pE(),bE(),CE(),EE(),OE(),XT(),IE()});function QE(e){let t=0;for(;t<e.length;){let n=e[t];if(n===`\\`&&t+1<e.length){t+=2;continue}if(n===`'`){let n=e.indexOf(`'`,t+1);if(n!==-1){t=n+1;continue}}if(n===`$`&&t+1<e.length&&e[t+1]===`(`||n==="`")return!0;t++}return!1}function $E(e,t){let n=1,r=t,i=!1,a=!1;for(;r<e.length&&n>0;){let t=e[r];if(t===`\\`&&!i&&r+1<e.length){r+=2;continue}if(t===`'`&&!a){i=!i,r++;continue}if(t===`"`&&!i){a=!a,r++;continue}if(!i&&!a){if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}r++}return-1}async function eD(e,t){let n=new Zw,r;try{r=n.parse(t)}catch{return``}let i=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let a=new Map(e.state.env),o=e.state.cwd,s=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let t=await e.executeScript(r),n=t.exitCode;return e.state.env=a,e.state.cwd=o,e.state.suppressVerbose=s,e.state.lastExitCode=n,e.state.env.set(`?`,String(n)),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr),e.state.bashPid=i,t.stdout.replace(/\n+$/,``)}catch(t){if(e.state.env=a,e.state.cwd=o,e.state.bashPid=i,e.state.suppressVerbose=s,t instanceof k)throw t;return t instanceof Ir?(e.state.lastExitCode=t.exitCode,e.state.env.set(`?`,String(t.exitCode)),t.stdout?.replace(/\n+$/,``)??``):``}}function tD(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=lE(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=nD(e,t.slice(r+1,i));n+=lE(a),r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}function nD(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}async function rD(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`'`){let e=t.indexOf(`'`,r+1);if(e!==-1){let i=t.slice(r+1,e);n+=lE(i),r=e+1;continue}}if(i===`"`){let i=-1,a=r+1;for(;a<t.length;){if(t[a]===`\\`){a+=2;continue}if(t[a]===`"`){i=a;break}a++}if(i!==-1){let a=await iD(e,t.slice(r+1,i));n+=lE(a),r=i+1;continue}}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=$E(t,r+2);if(i!==-1){let a=await eD(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await eD(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}if(i===`\\`&&r+1<t.length){n+=i+t[r+1],r+=2;continue}n+=i,r++}return n}async function iD(e,t){let n=``,r=0;for(;r<t.length;){let i=t[r];if(i===`\\`&&r+1<t.length){let e=t[r+1];if(e===`$`||e==="`"||e===`\\`||e===`"`){n+=e,r+=2;continue}n+=i,r++;continue}if(i===`$`&&r+1<t.length&&t[r+1]===`(`){let i=$E(t,r+2);if(i!==-1){let a=await eD(e,t.slice(r+2,i));n+=a,r=i+1;continue}}if(i==="`"){let i=t.indexOf("`",r+1);if(i!==-1){let a=await eD(e,t.slice(r+1,i));n+=a,r=i+1;continue}}if(i===`$`&&r+1<t.length){let i=t[r+1];if(i===`{`){let i=t.indexOf(`}`,r+2);if(i!==-1){let a=t.slice(r+2,i);n+=e.state.env.get(a)??``,r=i+1;continue}}else if(/[a-zA-Z_]/.test(i)){let i=r+1;for(;i<t.length&&/[a-zA-Z0-9_]/.test(t[i]);)i++;let a=t.slice(r+1,i);n+=e.state.env.get(a)??``,r=i;continue}}n+=i,r++}return n}var aD=S(()=>{Qw(),A(),dE()});function oD(e,t){if(!t.startsWith(`~`))return t;e.coverage?.hit(`bash:expansion:tilde`);let n=e.state.env.get(`HOME`)===void 0?`/home/user`:e.state.env.get(`HOME`);if(t===`~`||t.startsWith(`~/`))return n+t.slice(1);let r=1;for(;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)r++;let i=t.slice(1,r),a=t.slice(r);return a!==``&&!a.startsWith(`/`)?t:i===`root`?`/root${a}`:t}var sD=S(()=>{});async function cD(e,t,n,r){let i=``;for(let a of t.parts)if(a.type===`Glob`)i+=Y(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)i+=Y(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)i+=fE(a.value);else if(a.type===`DoubleQuoted`){let t=await n(e,a.parts);i+=fE(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);i+=Y(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);i+=fE(t)}return i}async function lD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternReplacement`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=J(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``;l.pattern&&(f=await cD(e,l.pattern,n,r));let p=l.replacement?await n(e,l.replacement.parts):``,m=f;l.anchor===`start`?m=`^${f}`:l.anchor===`end`&&(m=`${f}$`);let h=[];try{let e=z(m,l.all?`g`:``);for(let t of d)h.push(e.replace(t,p))}catch{h.push(...d)}if(c){let t=q(e.state.env);return{values:[h.join(t)],quoted:!0}}return{values:h,quoted:!0}}async function uD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0];if(i.parts.length!==1||i.parts[0].type!==`ParameterExpansion`||i.parts[0].operation?.type!==`PatternRemoval`)return null;let a=i.parts[0],o=a.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!o)return null;let s=o[1],c=o[2]===`*`,l=a.operation,u=J(e,s),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(s);t!==void 0&&d.push(t)}if(d.length===0)return{values:[],quoted:!0};let f=``,p=e.state.shoptOptions.extglob;if(l.pattern)for(let t of l.pattern.parts)if(t.type===`Glob`)f+=Y(t.pattern,l.greedy,p);else if(t.type===`Literal`)f+=Y(t.value,l.greedy,p);else if(t.type===`SingleQuoted`||t.type===`Escaped`)f+=fE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);f+=fE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);f+=Y(n,l.greedy,p)}else{let n=await r(e,t);f+=fE(n)}let m=[];for(let e of d)m.push(xE(e,f,l.side,l.greedy));if(c){let t=q(e.state.env);return{values:[m.join(t)],quoted:!0}}return{values:m,quoted:!0}}var dD=S(()=>{xs(),PT(),pE(),bE(),CE(),XT()});async function fD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`DefaultValue`&&n.parts[0].operation?.type!==`UseAlternative`&&n.parts[0].operation?.type!==`AssignDefault`)return null;let r=n.parts[0],i=r.operation,a=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/),o,s=!1;if(a){let t=a[1];s=a[2]===`*`;let n=J(e,t),r=n.length>0||e.state.env.has(t),c=n.length===0||n.length===1&&n.every(([,e])=>e===``),l=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?r&&!(l&&c):!r||l&&c,!o){if(n.length>0){let t=n.map(([,e])=>e);if(s){let n=q(e.state.env);return{values:[t.join(n)],quoted:!0}}return{values:t,quoted:!0}}let r=e.state.env.get(t);return r===void 0?{values:[],quoted:!0}:{values:[r],quoted:!0}}}else{let t=r.parameter,n=await YT(e,t),a=await JT(e,t),s=a===``,c=i.checkEmpty??!1;if(o=i.type===`UseAlternative`?n&&!(c&&s):!n||c&&s,!o)return{values:[a],quoted:!0}}if(o&&i.word){let t=i.word.parts,n=null,r=!1;for(let e of t)if(e.type===`ParameterExpansion`&&!e.operation){let t=e.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){n=t[1],r=t[2]===`*`;break}}if(n){let t=J(e,n);if(t.length>0){let n=t.map(([,e])=>e);if(r||s){let t=q(e.state.env);return{values:[n.join(t)],quoted:!0}}return{values:n,quoted:!0}}let i=e.state.env.get(n);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}}return null}async function pD(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0],o=-1,s=``,c=!1,l=null;for(let e=0;e<a.parts.length;e++){let t=a.parts[e];if(t.type===`ParameterExpansion`&&(t.operation?.type===`PatternRemoval`||t.operation?.type===`PatternReplacement`)){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){o=e,s=n[1],c=n[2]===`*`,l=t.operation;break}}}if(o===-1||o===0&&o===a.parts.length-1)return null;let u=``;for(let t=0;t<o;t++)u+=await r(e,a.parts[t]);let d=``;for(let t=o+1;t<a.parts.length;t++)d+=await r(e,a.parts[t]);let f=J(e,s),p=f.map(([,e])=>e);if(f.length===0){let t=e.state.env.get(s);if(t!==void 0)p=[t];else{if(c)return{values:[u+d],quoted:!0};let e=u+d;return{values:e?[e]:[],quoted:!0}}}if(l?.type===`PatternRemoval`){let t=l,n=``,a=e.state.shoptOptions.extglob;if(t.pattern)for(let o of t.pattern.parts)if(o.type===`Glob`)n+=Y(o.pattern,t.greedy,a);else if(o.type===`Literal`)n+=Y(o.value,t.greedy,a);else if(o.type===`SingleQuoted`||o.type===`Escaped`)n+=fE(o.value);else if(o.type===`DoubleQuoted`){let t=await i(e,o.parts);n+=fE(t)}else if(o.type===`ParameterExpansion`){let i=await r(e,o);n+=Y(i,t.greedy,a)}else{let t=await r(e,o);n+=fE(t)}p=p.map(e=>xE(e,n,t.side,t.greedy))}else if(l?.type===`PatternReplacement`){let t=l,n=``;if(t.pattern)for(let a of t.pattern.parts)if(a.type===`Glob`)n+=Y(a.pattern,!0,e.state.shoptOptions.extglob);else if(a.type===`Literal`)n+=Y(a.value,!0,e.state.shoptOptions.extglob);else if(a.type===`SingleQuoted`||a.type===`Escaped`)n+=fE(a.value);else if(a.type===`DoubleQuoted`){let t=await i(e,a.parts);n+=fE(t)}else if(a.type===`ParameterExpansion`){let t=await r(e,a);n+=Y(t,!0,e.state.shoptOptions.extglob)}else{let t=await r(e,a);n+=fE(t)}let a=t.replacement?await i(e,t.replacement.parts):``,o=n;t.anchor===`start`?o=`^${n}`:t.anchor===`end`&&(o=`${n}$`);try{let e=z(o,t.all?`g`:``);p=p.map(t=>e.replace(t,a))}catch{}}if(c){let t=q(e.state.env);return{values:[u+p.join(t)+d],quoted:!0}}return p.length===1?{values:[u+p[0]+d],quoted:!0}:{values:[u+p[0],...p.slice(1,-1),p[p.length-1]+d],quoted:!0}}async function mD(e,t,n,r){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=``,s=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&!t.operation){let n=t.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(n){a=e,o=n[1],s=n[2]===`*`;break}}}if(a===-1)return null;let c=``;for(let t=0;t<a;t++)c+=await r(e,i.parts[t]);let l=``;for(let t=a+1;t<i.parts.length;t++)l+=await r(e,i.parts[t]);let u=J(e,o),d=u.map(([,e])=>e);if(u.length===0){let t=e.state.env.get(o);if(t!==void 0)return{values:[c+t+l],quoted:!0};if(s)return{values:[c+l],quoted:!0};let n=c+l;return{values:n?[n]:[],quoted:!0}}if(s){let t=q(e.state.env);return{values:[c+d.join(t)+l],quoted:!0}}return d.length===1?{values:[c+d[0]+l],quoted:!0}:{values:[c+d[0],...d.slice(1,-1),d[d.length-1]+l],quoted:!0}}var hD=S(()=>{xs(),PT(),pE(),bE(),CE(),XT()});async function gD(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0];if(r.parts.length!==1||r.parts[0].type!==`ParameterExpansion`||r.parts[0].operation?.type!==`Substring`)return null;let i=r.parts[0],a=i.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!a)return null;let o=a[1],s=a[2]===`*`,c=i.operation;if(e.state.associativeArrays?.has(o))throw new Ir(1,``,`bash: \${${o}[@]: 0: 3}: bad substitution
858
+ `);let l=c.offset?await n(e,c.offset.expression):0,u=c.length?await n(e,c.length.expression):void 0,d=J(e,o),f=0;if(l<0){if(d.length>0){let e=d[d.length-1][0],t=(typeof e==`number`?e:0)+1+l;if(t<0)return{values:[],quoted:!0};f=d.findIndex(([e])=>typeof e==`number`&&e>=t),f<0&&(f=d.length)}}else f=d.findIndex(([e])=>typeof e==`number`&&e>=l),f<0&&(f=d.length);let p;if(u!==void 0){if(u<0)throw new Lr(`${o}[@]: substring expression < 0`);p=d.slice(f,f+u).map(([,e])=>e)}else p=d.slice(f).map(([,e])=>e);if(p.length===0)return{values:[],quoted:!0};if(s){let t=q(e.state.env);return{values:[p.join(t)],quoted:!0}}return{values:p,quoted:!0}}function _D(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation?.type!==`Transform`)return null;let r=n.parts[0],i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!i)return null;let a=i[1],o=i[2]===`*`,s=r.operation,c=J(e,a);if(c.length===0){let t=e.state.env.get(a);if(t!==void 0){let n;switch(s.operator){case`a`:n=``;break;case`P`:n=TE(e,t);break;case`Q`:n=DE(t);break;default:n=t}return{values:[n],quoted:!0}}return o?{values:[``],quoted:!0}:{values:[],quoted:!0}}let l=FE(e,a),u;switch(s.operator){case`a`:u=c.map(()=>l);break;case`P`:u=c.map(([,t])=>TE(e,t));break;case`Q`:u=c.map(([,e])=>DE(e));break;case`u`:u=c.map(([,e])=>e.charAt(0).toUpperCase()+e.slice(1));break;case`U`:u=c.map(([,e])=>e.toUpperCase());break;case`L`:u=c.map(([,e])=>e.toLowerCase());break;default:u=c.map(([,e])=>e)}if(o){let t=q(e.state.env);return{values:[u.join(t)],quoted:!0}}return{values:u,quoted:!0}}var vD=S(()=>{A(),PT(),EE(),OE(),XT(),IE()});function yD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`)return null;let r=n.parts[0];if(r.operation)return null;let i=r.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!i)return null;let a=i[1];if(FT(e,a)){let t=UT(e,a);if(t?.endsWith(`[@]`)||t?.endsWith(`[*]`))return{values:[],quoted:!0}}let o=J(e,a);if(o.length>0)return{values:o.map(([,e])=>e),quoted:!0};let s=e.state.env.get(a);return s===void 0?{values:[],quoted:!0}:{values:[s],quoted:!0}}function bD(e,t){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let n=t[0];if(n.parts.length!==1||n.parts[0].type!==`ParameterExpansion`||n.parts[0].operation)return null;let r=n.parts[0].parameter;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)||!FT(e,r))return null;let i=UT(e,r);if(!i)return null;let a=i.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(@)\]$/);if(!a)return null;let o=a[1],s=J(e,o);if(s.length>0)return{values:s.map(([,e])=>e),quoted:!0};let c=e.state.env.get(o);return c===void 0?{values:[],quoted:!0}:{values:[c],quoted:!0}}var xD=S(()=>{GT(),XT()});async function SD(e,t,n,r,i){if(!n||t.length!==1||t[0].type!==`DoubleQuoted`)return null;let a=t[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=o.operation,c=await JT(e,o.parameter),l=c.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!l){if(!s.innerOp&&(c===`@`||c===`*`)){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return c===`*`?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}return null}let u=l[1],d=l[2]===`*`,f=J(e,u);if(s.innerOp){if(s.innerOp.type===`Substring`)return CD(e,f,u,d,s.innerOp);if(s.innerOp.type===`DefaultValue`||s.innerOp.type===`UseAlternative`||s.innerOp.type===`AssignDefault`||s.innerOp.type===`ErrorIfUnset`)return wD(e,f,u,d,s.innerOp,i);if(s.innerOp.type===`Transform`&&s.innerOp.operator===`a`){let t=FE(e,u),n=f.map(()=>t);return d?{values:[n.join(q(e.state.env))],quoted:!0}:{values:n,quoted:!0}}let t=[];for(let[,n]of f){let i={type:`ParameterExpansion`,parameter:`_indirect_elem_`,operation:s.innerOp},a=e.state.env.get(`_indirect_elem_`);e.state.env.set(`_indirect_elem_`,n);try{let n=await r(e,i,!0);t.push(n)}finally{a===void 0?e.state.env.delete(`_indirect_elem_`):e.state.env.set(`_indirect_elem_`,a)}}return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}if(f.length>0){let t=f.map(([,e])=>e);return d?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let p=e.state.env.get(u);return p===void 0?{values:[],quoted:!0}:{values:[p],quoted:!0}}async function CD(e,t,n,r,i){let a=i.offset?await Z(e,i.offset.expression):0,o=i.length?await Z(e,i.length.expression):void 0,s=0;if(a<0){if(t.length>0){let e=t[t.length-1][0],n=(typeof e==`number`?e:0)+1+a;if(n<0||(s=t.findIndex(([e])=>typeof e==`number`&&e>=n),s<0))return{values:[],quoted:!0}}}else if(s=t.findIndex(([e])=>typeof e==`number`&&e>=a),s<0)return{values:[],quoted:!0};let c;if(o!==void 0){if(o<0)throw new Lr(`${n}[@]: substring expression < 0`);c=t.slice(s,s+o)}else c=t.slice(s);let l=c.map(([,e])=>e);return r?{values:[l.join(q(e.state.env))],quoted:!0}:{values:l,quoted:!0}}async function wD(e,t,n,r,i,a){let o=i.checkEmpty??!1,s=t.map(([,e])=>e),c=t.length===0,l=t.length===0;if(i.type===`UseAlternative`)return!l&&!(o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:{values:[],quoted:!0};if(i.type===`DefaultValue`)return(l||o&&c)&&i.word?{values:[await a(e,i.word.parts,!0)],quoted:!0}:r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0};if(i.type===`AssignDefault`){if((l||o&&c)&&i.word){let t=await a(e,i.word.parts,!0);return e.state.env.set(`${n}_0`,t),e.state.env.set(`${n}__length`,`1`),{values:[t],quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}return r?{values:[s.join(q(e.state.env))],quoted:!0}:{values:s,quoted:!0}}async function TD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`UseAlternative`&&t[0].operation?.type!==`DefaultValue`)return null;let n=t[0],r=n.operation,i=r?.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await JT(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await YT(e,n.parameter),l=await JT(e,n.parameter)===``,u=r.checkEmpty??!1,d;if(d=r.type===`UseAlternative`?c&&!(u&&l):!c||u&&l,d){let t=s[1],n=s[2]===`*`,r=J(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}async function ED(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`Indirection`)return null;let n=t[0],r=n.operation.innerOp;if(!r||r.type!==`UseAlternative`&&r.type!==`DefaultValue`)return null;let i=r.word;if(!i||i.parts.length!==1||i.parts[0].type!==`DoubleQuoted`)return null;let a=i.parts[0];if(a.parts.length!==1||a.parts[0].type!==`ParameterExpansion`||a.parts[0].operation?.type!==`Indirection`)return null;let o=a.parts[0],s=(await JT(e,o.parameter)).match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!s)return null;let c=await JT(e,n.parameter),l=await YT(e,n.parameter),u=c===``,d=r.checkEmpty??!1,f;if(f=r.type===`UseAlternative`?l&&!(d&&u):!l||d&&u,f){let t=s[1],n=s[2]===`*`,r=J(e,t);if(r.length>0){let t=r.map(([,e])=>e);return n?{values:[t.join(q(e.state.env))],quoted:!0}:{values:t,quoted:!0}}let i=e.state.env.get(t);return i===void 0?{values:[],quoted:!0}:{values:[i],quoted:!0}}return{values:[],quoted:!1}}var DD=S(()=>{qO(),A(),PT(),XT(),IE()});function OD(e){let t=Number.parseInt(e.state.env.get(`#`)||`0`,10),n=[];for(let r=1;r<=t;r++)n.push(e.state.env.get(String(r))||``);return n}async function kD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`Substring`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=s.offset?await n(e,s.offset.expression):0,l=s.length?await n(e,s.length.expression):void 0,u=Number.parseInt(e.state.env.get(`#`)||`0`,10),d=[];for(let t=1;t<=u;t++)d.push(e.state.env.get(String(t))||``);let f=e.state.env.get(`0`)||`bash`,p;if(c<=0){let e=[f,...d],t=e.length+c;if(t<0)p=[];else{let n=c<0?t:0;if(l!==void 0){let t=l<0?e.length+l:n+l;p=e.slice(n,Math.max(n,t))}else p=e.slice(n)}}else{let e=c-1;if(e>=d.length)p=[];else if(l!==void 0){let t=l<0?d.length+l:e+l;p=d.slice(e,Math.max(e,t))}else p=d.slice(e)}let m=``;for(let t=0;t<a;t++)m+=await r(e,i.parts[t]);let h=``;for(let t=a+1;t<i.parts.length;t++)h+=await r(e,i.parts[t]);if(p.length===0){let e=m+h;return{values:e?[e]:[],quoted:!0}}if(o){let t=q(e.state.env);return{values:[m+p.join(t)+h],quoted:!0}}return p.length===1?{values:[m+p[0]+h],quoted:!0}:{values:[m+p[0],...p.slice(1,-1),p[p.length-1]+h],quoted:!0}}async function AD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternReplacement`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=OD(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Y(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)d+=Y(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=fE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=fE(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Y(r,!0,e.state.shoptOptions.extglob)}else{let r=await n(e,t);d+=fE(r)}let f=s.replacement?await r(e,s.replacement.parts):``,p=d;s.anchor===`start`?p=`^${d}`:s.anchor===`end`&&(p=`${d}$`);let m=[];try{let e=z(p,s.all?`g`:``);for(let t of c)m.push(e.replace(t,f))}catch{m.push(...c)}if(o){let t=q(e.state.env);return{values:[l+m.join(t)+u],quoted:!0}}return m.length===1?{values:[l+m[0]+u],quoted:!0}:{values:[l+m[0],...m.slice(1,-1),m[m.length-1]+u],quoted:!0}}async function jD(e,t,n,r){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let i=t[0],a=-1,o=!1;for(let e=0;e<i.parts.length;e++){let t=i.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)&&t.operation?.type===`PatternRemoval`){a=e,o=t.parameter===`*`;break}}if(a===-1)return null;let s=i.parts[a].operation,c=OD(e),l=``;for(let t=0;t<a;t++)l+=await n(e,i.parts[t]);let u=``;for(let t=a+1;t<i.parts.length;t++)u+=await n(e,i.parts[t]);if(c.length===0){let e=l+u;return{values:e?[e]:[],quoted:!0}}let d=``,f=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)d+=Y(t.pattern,s.greedy,f);else if(t.type===`Literal`)d+=Y(t.value,s.greedy,f);else if(t.type===`SingleQuoted`||t.type===`Escaped`)d+=fE(t.value);else if(t.type===`DoubleQuoted`){let n=await r(e,t.parts);d+=fE(n)}else if(t.type===`ParameterExpansion`){let r=await n(e,t);d+=Y(r,s.greedy,f)}else{let r=await n(e,t);d+=fE(r)}let p=[];for(let e of c)p.push(xE(e,d,s.side,s.greedy));if(o){let t=q(e.state.env);return{values:[l+p.join(t)+u],quoted:!0}}return p.length===1?{values:[l+p[0]+u],quoted:!0}:{values:[l+p[0],...p.slice(1,-1),p[p.length-1]+u],quoted:!0}}async function MD(e,t,n){if(t.length!==1||t[0].type!==`DoubleQuoted`)return null;let r=t[0],i=-1,a=!1;for(let e=0;e<r.parts.length;e++){let t=r.parts[e];if(t.type===`ParameterExpansion`&&(t.parameter===`@`||t.parameter===`*`)){i=e,a=t.parameter===`*`;break}}if(i===-1)return null;let o=r.parts[i];if(o.type===`ParameterExpansion`&&o.operation)return null;let s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=``;for(let t=0;t<i;t++)c+=await n(e,r.parts[t]);let l=``;for(let t=i+1;t<r.parts.length;t++)l+=await n(e,r.parts[t]);if(s===0){if(a)return{values:[c+l],quoted:!0};let e=c+l;return{values:e?[e]:[],quoted:!0}}let u=[];for(let t=1;t<=s;t++)u.push(e.state.env.get(String(t))||``);if(a){let t=q(e.state.env);return{values:[c+u.join(t)+l],quoted:!0}}return u.length===1?{values:[c+u[0]+l],quoted:!0}:{values:[c+u[0],...u.slice(1,-1),u[u.length-1]+l],quoted:!0}}var ND=S(()=>{xs(),PT(),pE(),bE(),CE()});function PD(e){return new sT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations})}async function FD(e,t){if(e.state.options.noglob)return t;let n=PD(e),r=[];for(let i of t)if(sE(i,e.state.shoptOptions.extglob)){let e=await n.expand(i);if(e.length>0)r.push(...e);else{if(n.hasFailglob())throw new zr(i);n.hasNullglob()||r.push(i)}}else r.push(i);return r}async function ID(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternReplacement`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=J(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Y(t.pattern,!0,e.state.shoptOptions.extglob);else if(t.type===`Literal`)u+=Y(t.value,!0,e.state.shoptOptions.extglob);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=fE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=fE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Y(n,!0,e.state.shoptOptions.extglob)}else{let n=await r(e,t);u+=fE(n)}let d=s.replacement?await n(e,s.replacement.parts):``,f=u;s.anchor===`start`?f=`^${u}`:s.anchor===`end`&&(f=`${u}$`);let p=[];try{let e=z(f,s.all?`g`:``);for(let t of l)p.push(e.replace(t,d))}catch{p.push(...l)}let m=ST(e.state.env),h=CT(e.state.env);if(o){let t=q(e.state.env),n=p.join(t);return h?{values:n?[n]:[],quoted:!1}:{values:AT(n,m),quoted:!1}}if(h)return{values:p,quoted:!1};let g=[];for(let e of p)e===``?g.push(``):g.push(...AT(e,m));return{values:g,quoted:!1}}async function LD(e,t,n,r){let i=-1,a=``,o=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&n.operation?.type===`PatternRemoval`){let t=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(t){i=e,a=t[1],o=t[2]===`*`;break}}}if(i===-1)return null;let s=t[i].operation,c=J(e,a),l=c.map(([,e])=>e);if(c.length===0){let t=e.state.env.get(a);t!==void 0&&(l=[t])}if(l.length===0)return{values:[],quoted:!1};let u=``,d=e.state.shoptOptions.extglob;if(s.pattern)for(let t of s.pattern.parts)if(t.type===`Glob`)u+=Y(t.pattern,s.greedy,d);else if(t.type===`Literal`)u+=Y(t.value,s.greedy,d);else if(t.type===`SingleQuoted`||t.type===`Escaped`)u+=fE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);u+=fE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);u+=Y(n,s.greedy,d)}else{let n=await r(e,t);u+=fE(n)}let f=[];for(let e of l)f.push(xE(e,u,s.side,s.greedy));let p=ST(e.state.env),m=CT(e.state.env);if(o){let t=q(e.state.env),n=f.join(t);return m?{values:n?[n]:[],quoted:!1}:{values:AT(n,p),quoted:!1}}if(m)return{values:f,quoted:!1};let h=[];for(let e of f)e===``?h.push(``):h.push(...AT(e,p));return{values:h,quoted:!1}}async function RD(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`PatternRemoval`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=Number.parseInt(e.state.env.get(`#`)||`0`,10),c=[];for(let t=1;t<=s;t++)c.push(e.state.env.get(String(t))||``);if(c.length===0)return{values:[],quoted:!1};let l=``,u=e.state.shoptOptions.extglob;if(o.pattern)for(let t of o.pattern.parts)if(t.type===`Glob`)l+=Y(t.pattern,o.greedy,u);else if(t.type===`Literal`)l+=Y(t.value,o.greedy,u);else if(t.type===`SingleQuoted`||t.type===`Escaped`)l+=fE(t.value);else if(t.type===`DoubleQuoted`){let r=await n(e,t.parts);l+=fE(r)}else if(t.type===`ParameterExpansion`){let n=await r(e,t);l+=Y(n,o.greedy,u)}else{let n=await r(e,t);l+=fE(n)}let d=[];for(let e of c)d.push(xE(e,l,o.side,o.greedy));let f=ST(e.state.env),p=CT(e.state.env);if(a){let t=q(e.state.env),n=d.join(t);return p?{values:n?[n]:[],quoted:!1}:{values:AT(n,f),quoted:!1}}if(p)return{values:d,quoted:!1};let m=[];for(let e of d)e===``?m.push(``):m.push(...AT(e,f));return{values:m,quoted:!1}}async function zD(e,t,n,r){let i=-1,a=!1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&n.operation?.type===`Substring`){i=e,a=n.parameter===`*`;break}}if(i===-1)return null;let o=t[i].operation,s=o.offset?await n(e,o.offset.expression):0,c=o.length?await n(e,o.length.expression):void 0,l=Number.parseInt(e.state.env.get(`#`)||`0`,10),u=[];for(let t=1;t<=l;t++)u.push(e.state.env.get(String(t))||``);let d=e.state.env.get(`0`)||`bash`,f;if(s<=0){let e=[d,...u],t=e.length+s;if(t<0)f=[];else{let n=s<0?t:0;if(c!==void 0){let t=c<0?e.length+c:n+c;f=e.slice(n,Math.max(n,t))}else f=e.slice(n)}}else{let e=s-1;if(e>=u.length)f=[];else if(c!==void 0){let t=c<0?u.length+c:e+c;f=u.slice(e,Math.max(e,t))}else f=u.slice(e)}let p=``;for(let n=0;n<i;n++)p+=await r(e,t[n]);let m=``;for(let n=i+1;n<t.length;n++)m+=await r(e,t[n]);let h=ST(e.state.env),g=CT(e.state.env);if(f.length===0){let e=p+m;return e?g?{values:[e],quoted:!1}:{values:AT(e,h),quoted:!1}:{values:[],quoted:!1}}let _;if(a){let t=q(e.state.env),n=p+f.join(t)+m;_=g?n?[n]:[]:AT(n,h)}else if(g)_=f.length===1?[p+f[0]+m]:[p+f[0],...f.slice(1,-1),f[f.length-1]+m];else{_=[];for(let e=0;e<f.length;e++){let t=f[e];if(e===0&&(t=p+t),e===f.length-1&&(t+=m),t===``)_.push(``);else{let e=AT(t,h);_.push(...e)}}}return{values:await FD(e,_),quoted:!1}}async function BD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].parameter!==`@`&&t[0].parameter!==`*`||t[0].operation)return null;let n=t[0].parameter===`*`,r=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(r===0)return{values:[],quoted:!1};let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=ST(e.state.env),o=CT(e.state.env),s=wT(e.state.env),c;if(n)if(o)c=i.filter(e=>e!==``);else{let t=q(e.state.env);c=AT(i.join(t),a)}else if(o)c=i.filter(e=>e!==``);else if(s){c=[];for(let e of i){if(e===``)continue;let t=AT(e,a);c.push(...t)}}else{c=[];for(let e of i)if(e===``)c.push(``);else{let t=AT(e,a);c.push(...t)}for(;c.length>0&&c[c.length-1]===``;)c.pop()}return{values:await FD(e,c),quoted:!1}}async function VD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation)return null;let n=t[0].parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(!n)return null;let r=n[1],i=n[2]===`*`,a=J(e,r),o;if(a.length===0){let t=e.state.env.get(r);if(t!==void 0)o=[t];else return{values:[],quoted:!1}}else o=a.map(([,e])=>e);let s=ST(e.state.env),c=CT(e.state.env),l=wT(e.state.env),u;if(i)if(c)u=o.filter(e=>e!==``);else{let t=q(e.state.env);u=AT(o.join(t),s)}else if(c)u=o.filter(e=>e!==``);else if(l){u=[];for(let e of o){if(e===``)continue;let t=AT(e,s);u.push(...t)}}else{u=[];for(let e of o)if(e===``)u.push(``);else{let t=AT(e,s);u.push(...t)}for(;u.length>0&&u[u.length-1]===``;)u.pop()}return{values:await FD(e,u),quoted:!1}}function HD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`VarNamePrefix`)return null;let n=t[0].operation,r=SE(e,n.prefix);if(r.length===0)return{values:[],quoted:!1};let i=ST(e.state.env),a=CT(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=AT(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=AT(e,i);o.push(...t)}}return{values:o,quoted:!1}}function UD(e,t){if(t.length!==1||t[0].type!==`ParameterExpansion`||t[0].operation?.type!==`ArrayKeys`)return null;let n=t[0].operation,r=J(e,n.array).map(([e])=>String(e));if(r.length===0)return{values:[],quoted:!1};let i=ST(e.state.env),a=CT(e.state.env),o;if(n.star)if(a)o=r;else{let t=q(e.state.env);o=AT(r.join(t),i)}else if(a)o=r;else{o=[];for(let e of r){let t=AT(e,i);o.push(...t)}}return{values:o,quoted:!1}}async function WD(e,t,n){let r=-1;for(let e=0;e<t.length;e++){let n=t[e];if(n.type===`ParameterExpansion`&&(n.parameter===`@`||n.parameter===`*`)&&!n.operation){r=e;break}}if(r===-1||t.length<=1)return null;let i=Number.parseInt(e.state.env.get(`#`)||`0`,10),a=[];for(let t=1;t<=i;t++)a.push(e.state.env.get(String(t))||``);let o=``;for(let i=0;i<r;i++)o+=await n(e,t[i]);let s=``;for(let i=r+1;i<t.length;i++)s+=await n(e,t[i]);let c=ST(e.state.env),l=CT(e.state.env),u=wT(e.state.env);if(i===0){let e=o+s;return{values:e?[e]:[],quoted:!1}}let d;{let e=[];for(let t=0;t<a.length;t++){let n=a[t];t===0&&(n=o+n),t===a.length-1&&(n+=s),e.push(n)}if(l)d=e.filter(e=>e!==``);else if(u){d=[];for(let t of e){if(t===``)continue;let e=AT(t,c);d.push(...e)}}else{d=[];for(let t of e)if(t===``)d.push(``);else{let e=AT(t,c);d.push(...e)}for(;d.length>0&&d[d.length-1]===``;)d.pop()}}return d.length===0?{values:[],quoted:!1}:{values:await FD(e,d),quoted:!1}}var GD=S(()=>{xs(),cT(),A(),PT(),pE(),dE(),bE(),CE(),XT()});async function KD(e,t,n){e.coverage?.hit(`bash:expansion:word_glob`);let r=t.parts,{hasQuoted:i,hasCommandSub:a,hasArrayVar:o,hasArrayAtExpansion:s,hasParamExpansion:c,hasVarNamePrefixExpansion:l,hasIndirection:u}=fT(r),d=n.hasBraceExpansion(r)?await n.expandWordWithBracesAsync(e,t):null;if(d&&d.length>1)return qD(e,d,i);let f=await JD(e,r,s,l,u,n);if(f!==null)return f;let p=await XD(e,r,n);if(p!==null)return p;let m=await ZD(e,r,n);if(m!==null)return m;let h=await eO(e,r,n.expandPart);if(h!==null)return tO(e,h);if((a||o||c)&&!CT(e.state.env)){let t=ST(e.state.env),i=n.buildIfsCharClassPattern(t);return tO(e,await n.smartWordSplit(e,r,t,i,n.expandPart))}return rO(e,t,r,await n.expandWordAsync(e,t),i,n.expandWordForGlobbing)}async function qD(e,t,n){let r=[];for(let i of t)if(!(!n&&i===``))if(!n&&!e.state.options.noglob&&sE(i,e.state.shoptOptions.extglob)){let t=await nO(e,i);r.push(...t)}else r.push(i);return{values:r,quoted:!1}}async function JD(e,t,n,r,i,a){if(n){let n=yD(e,t);if(n!==null)return n}{let n=bD(e,t);if(n!==null)return n}{let n=await fD(e,t);if(n!==null)return n}{let r=await pD(e,t,n,a.expandPart,a.expandWordPartsAsync);if(r!==null)return r}{let r=await mD(e,t,n,a.expandPart);if(r!==null)return r}{let n=await gD(e,t,a.evaluateArithmetic);if(n!==null)return n}{let n=_D(e,t);if(n!==null)return n}{let n=await lD(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}{let n=await uD(e,t,a.expandWordPartsAsync,a.expandPart);if(n!==null)return n}if(r&&t.length===1&&t[0].type===`DoubleQuoted`){let n=YD(e,t);if(n!==null)return n}{let n=await SD(e,t,i,a.expandParameterAsync,a.expandWordPartsAsync);if(n!==null)return n}{let n=await TD(e,t);if(n!==null)return n}{let n=await ED(e,t);if(n!==null)return n}return null}function YD(e,t){let n=t[0];if(n.type!==`DoubleQuoted`)return null;if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`VarNamePrefix`){let t=n.parts[0].operation,r=SE(e,t.prefix);return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}if(n.parts.length===1&&n.parts[0].type===`ParameterExpansion`&&n.parts[0].operation?.type===`ArrayKeys`){let t=n.parts[0].operation,r=J(e,t.array).map(([e])=>String(e));return t.star?{values:[r.join(q(e.state.env))],quoted:!0}:{values:r,quoted:!0}}return null}async function XD(e,t,n){{let r=await kD(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let r=await AD(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await jD(e,t,n.expandPart,n.expandWordPartsAsync);if(r!==null)return r}{let r=await MD(e,t,n.expandPart);if(r!==null)return r}return null}async function ZD(e,t,n){{let r=await ID(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await LD(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await RD(e,t,n.expandWordPartsAsync,n.expandPart);if(r!==null)return r}{let r=await zD(e,t,n.evaluateArithmetic,n.expandPart);if(r!==null)return r}{let n=await BD(e,t);if(n!==null)return n}{let n=await VD(e,t);if(n!==null)return n}{let n=HD(e,t);if(n!==null)return n}{let n=UD(e,t);if(n!==null)return n}{let r=await WD(e,t,n.expandPart);if(r!==null)return r}return null}function QD(e){if(e.type!==`DoubleQuoted`)return null;for(let t=0;t<e.parts.length;t++){let n=e.parts[t];if(n.type!==`ParameterExpansion`||n.operation)continue;let r=n.parameter.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([@*])\]$/);if(r)return{type:`array`,name:r[1],atIndex:t,isStar:r[2]===`*`};if(n.parameter===`@`||n.parameter===`*`)return{type:`positional`,atIndex:t,isStar:n.parameter===`*`}}return null}async function $D(e,t,n,r){let i=``;for(let a=0;a<n.atIndex;a++)i+=await r(e,t.parts[a]);let a=``;for(let i=n.atIndex+1;i<t.parts.length;i++)a+=await r(e,t.parts[i]);let o;if(n.type===`array`){if(o=J(e,n.name).map(([,e])=>e),o.length===0){let t=e.state.env.get(n.name);t!==void 0&&(o=[t])}}else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);o=[];for(let n=1;n<=t;n++)o.push(e.state.env.get(String(n))||``)}if(n.isStar){let t=q(e.state.env),n=o.join(t);return[i+n+a]}if(o.length===0){let e=i+a;return e?[e]:[]}return o.length===1?[i+o[0]+a]:[i+o[0],...o.slice(1,-1),o[o.length-1]+a]}async function eO(e,t,n){if(t.length<2)return null;let r=!1;for(let e of t)if(QD(e)){r=!0;break}if(!r)return null;let i=ST(e.state.env),a=CT(e.state.env),o=[];for(let r of t){let t=QD(r);if(t&&r.type===`DoubleQuoted`){let i=await $D(e,r,t,n);o.push(i)}else if(r.type===`DoubleQuoted`||r.type===`SingleQuoted`){let t=await n(e,r);o.push([t])}else if(r.type===`Literal`)o.push([r.value]);else if(r.type===`ParameterExpansion`){let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=AT(t,i);o.push(e)}}else{let t=await n(e,r);if(a)o.push(t?[t]:[]);else{let e=AT(t,i);o.push(e)}}}let s=[];for(let e of o)if(e.length!==0)if(s.length===0)s.push(...e);else{let t=s.length-1;s[t]=s[t]+e[0];for(let t=1;t<e.length;t++)s.push(e[t])}return s}async function tO(e,t){if(e.state.options.noglob)return{values:t,quoted:!1};let n=[];for(let r of t)if(sE(r,e.state.shoptOptions.extglob)){let t=await nO(e,r);n.push(...t)}else n.push(r);return{values:n,quoted:!1}}async function nO(e,t){let n=new sT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),r=await n.expand(t);if(r.length>0)return r;if(n.hasFailglob())throw new zr(t);return n.hasNullglob()?[]:[t]}async function rO(e,t,n,r,i,a){let o=n.some(e=>e.type===`Glob`);if(!e.state.options.noglob&&o){let n=await a(e,t);if(sE(n,e.state.shoptOptions.extglob)){let t=await nO(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1};if(t.length===0)return{values:[],quoted:!1}}let i=cE(r);return CT(e.state.env)?{values:[i],quoted:!1}:{values:AT(i,ST(e.state.env)),quoted:!1}}if(!i&&!e.state.options.noglob&&sE(r,e.state.shoptOptions.extglob)){let n=await a(e,t);if(sE(n,e.state.shoptOptions.extglob)){let t=await nO(e,n);if(t.length>0&&t[0]!==n)return{values:t,quoted:!1}}}if(r===``&&!i)return{values:[],quoted:!1};if(o&&!i){let t=cE(r);return CT(e.state.env)?{values:[t],quoted:!1}:{values:AT(t,ST(e.state.env)),quoted:!1}}return{values:[r],quoted:i}}var iO=S(()=>{cT(),A(),PT(),pT(),dD(),hD(),vD(),xD(),dE(),DD(),CE(),ND(),GD(),XT()});async function aO(e,t){let n=t.operation;if(!n||n.type!==`DefaultValue`&&n.type!==`AssignDefault`&&n.type!==`UseAlternative`)return null;let r=n.word;if(!r||r.parts.length===0)return null;let i=await YT(e,t.parameter),a=await JT(e,t.parameter,!1)===``,o=n.checkEmpty??!1,s;return s=n.type===`UseAlternative`?i&&!(o&&a):!i||o&&a,s?r.parts:null}function oO(e){return e.type===`SingleQuoted`?!0:e.type===`DoubleQuoted`?e.parts.every(e=>e.type===`Literal`):!1}async function sO(e,t){if(t.type!==`ParameterExpansion`)return null;let n=await aO(e,t);if(!n||n.length<=1)return null;let r=n.some(e=>oO(e)),i=n.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`);return r&&i?n:null}function cO(e){return e.type===`DoubleQuoted`||e.type===`SingleQuoted`||e.type===`Literal`?!1:e.type===`Glob`?lT(e.pattern):!(!(e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`)||e.type===`ParameterExpansion`&&dT(e))}async function lO(e,t,n,r,i){if(e.coverage?.hit(`bash:expansion:word_split`),t.length===1&&t[0].type===`ParameterExpansion`){let a=t[0],o=await aO(e,a);if(o&&o.length>0&&o.length>1&&o.some(e=>e.type===`DoubleQuoted`||e.type===`SingleQuoted`)&&o.some(e=>e.type===`Literal`||e.type===`ParameterExpansion`||e.type===`CommandSubstitution`||e.type===`ArithmeticExpansion`))return dO(e,o,n,r,i)}let a=[],o=!1;for(let n of t){let t=cO(n),r=n.type===`DoubleQuoted`||n.type===`SingleQuoted`,s=t?await sO(e,n):null,c=await i(e,n);a.push({value:c,isSplittable:t,isQuoted:r,mixedDefaultParts:s??void 0}),t&&(o=!0)}if(!o){let e=a.map(e=>e.value).join(``);return e?[e]:[]}let s=[],c=``,l=!1,u=!1,d=!1;for(let t of a)if(!t.isSplittable)u?t.isQuoted&&t.value===``?(c!==``&&s.push(c),s.push(``),l=!0,c=``,u=!1,d=!0):t.value===``?(c+=t.value,d=!1):(c!==``&&s.push(c),c=t.value,u=!1,d=!1):(c+=t.value,d=t.isQuoted&&t.value===``);else if(t.mixedDefaultParts){let a=await dO(e,t.mixedDefaultParts,n,r,i);if(a.length!==0)if(a.length===1)c+=a[0],l=!0;else{c+=a[0],s.push(c),l=!0;for(let e=1;e<a.length-1;e++)s.push(a[e]);c=a[a.length-1]}u=!1,d=!1}else{let{words:e,hadLeadingDelimiter:r,hadTrailingDelimiter:i}=kT(t.value,n);if(d&&r&&c===``&&(s.push(``),l=!0),e.length===0)i&&(u=!0);else if(e.length===1)c+=e[0],l=!0,u=i;else{c+=e[0],s.push(c),l=!0;for(let t=1;t<e.length-1;t++)s.push(e[t]);c=e[e.length-1],u=i}d=!1}return c===``?s.length===0&&l&&s.push(``):s.push(c),s}function uO(e,t){return e.length>0&&t.includes(e[0])}async function dO(e,t,n,r,i){let a=[];for(let n of t){let t=!(n.type===`DoubleQuoted`||n.type===`SingleQuoted`),r=await i(e,n);a.push({value:r,isSplittable:t})}let o=[],s=``,c=!1,l=!1;for(let e of a)if(!e.isSplittable)l&&e.value!==``?(s!==``&&o.push(s),s=e.value,l=!1):s+=e.value;else{uO(e.value,n)&&s!==``&&(o.push(s),s=``,c=!0);let{words:t,hadTrailingDelimiter:r}=kT(e.value,n);if(t.length===0)r&&(l=!0);else if(t.length===1)s+=t[0],c=!0,l=r;else{s+=t[0],o.push(s),c=!0;for(let e=1;e<t.length-1;e++)o.push(t[e]);s=t[t.length-1],l=r}}return s===``?o.length===0&&c&&o.push(``):o.push(s),o}var fO=S(()=>{XT(),PT(),pT()});function pO(e){switch(e.type){case`Literal`:return e.value;case`SingleQuoted`:return e.value;case`Escaped`:return e.value;default:return null}}function mO(e){switch(e.type){case`SingleQuoted`:case`Escaped`:case`DoubleQuoted`:return!0;case`Literal`:return e.value===``;default:return!1}}var hO=S(()=>{}),gO={};C(gO,{escapeGlobChars:()=>lE,escapeRegexChars:()=>uE,expandRedirectTarget:()=>MO,expandWord:()=>X,expandWordForPattern:()=>CO,expandWordForRegex:()=>SO,expandWordWithGlob:()=>kO,getArrayElements:()=>J,getVariable:()=>JT,hasQuotedMultiValueAt:()=>jO,isArray:()=>qT,isWordFullyQuoted:()=>bO});function _O(e,t,n){if(e.length>t)throw new k(`${n}: string length limit exceeded (${t} bytes)`,`string_length`)}async function vO(e,t,n=!1){let r=[];for(let i of t)r.push(await PO(e,i,n));return r.join(``)}function yO(e){return mO(e)}function bO(e){if(e.parts.length===0)return!0;for(let t of e.parts)if(!yO(t))return!1;return!0}function xO(e,t,n=!1){let r=pO(t);if(r!==null)return r;switch(t.type){case`TildeExpansion`:return n?t.user===null?`~`:`~${t.user}`:(e.coverage?.hit(`bash:expansion:tilde`),t.user===null?e.state.env.get(`HOME`)??`/home/user`:t.user===`root`?`/root`:`~${t.user}`);case`Glob`:return tD(e,t.pattern);default:return null}}async function X(e,t){return NO(e,t)}async function SO(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`)n.push(`\\${r.value}`);else if(r.type===`SingleQuoted`)n.push(r.value);else if(r.type===`DoubleQuoted`){let t=await vO(e,r.parts);n.push(t)}else if(r.type===`TildeExpansion`){let t=await PO(e,r);n.push(uE(t))}else n.push(await PO(e,r));return n.join(``)}async function CO(e,t){let n=[];for(let r of t.parts)if(r.type===`Escaped`){let e=r.value;`()|*?[]`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`SingleQuoted`)n.push(lE(r.value));else if(r.type===`DoubleQuoted`){let t=await vO(e,r.parts);n.push(lE(t))}else n.push(await PO(e,r));return n.join(``)}async function wO(e,t){let n=[];for(let r of t.parts)if(r.type===`SingleQuoted`)n.push(lE(r.value));else if(r.type===`Escaped`){let e=r.value;`*?[]\\()|`.includes(e)?n.push(`\\${e}`):n.push(e)}else if(r.type===`DoubleQuoted`){let t=await vO(e,r.parts);n.push(lE(t))}else r.type===`Glob`?QE(r.pattern)?n.push(await rD(e,r.pattern)):n.push(tD(e,r.pattern)):r.type===`Literal`?n.push(r.value):n.push(await PO(e,r));return n.join(``)}function TO(e){for(let t of e)if(t.type===`BraceExpansion`||t.type===`DoubleQuoted`&&TO(t.parts))return!0;return!1}async function EO(e,t,n={count:0}){if(n.count>IO)return[[]];let r=[[]];for(let i of t)if(i.type===`BraceExpansion`){let t=[],a=!1,o=``;for(let r of i.items)if(r.type===`Range`){let e=nE(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)for(let r of e.expanded)n.count++,t.push(r);else{a=!0,o=e.literal;break}}else{let i=await EO(e,r.word.parts,n);for(let r of i){n.count++;let i=[];for(let t of r)typeof t==`string`?i.push(t):i.push(await PO(e,t));t.push(i.join(``))}}if(a){for(let e of r)n.count++,e.push(o);continue}if(r.length*t.length>e.limits.maxBraceExpansionResults||n.count>IO)return r;let s=[];for(let e of r)for(let i of t){if(n.count++,n.count>IO)return s.length>0?s:r;s.push([...e,i])}r=s}else for(let e of r)n.count++,e.push(i);return r}async function DO(e,t){let n=t.parts;if(!TO(n))return[await X(e,t)];let r=await EO(e,n),i=[];for(let t of r){let n=[];for(let r of t)typeof r==`string`?n.push(r):n.push(await PO(e,r));i.push(oD(e,n.join(``)))}return i}function OO(){return{expandWordAsync:NO,expandWordForGlobbing:wO,expandWordWithBracesAsync:DO,expandWordPartsAsync:vO,expandPart:PO,expandParameterAsync:FO,hasBraceExpansion:TO,evaluateArithmetic:Z,buildIfsCharClassPattern:TT,smartWordSplit:lO}}async function kO(e,t){return KD(e,t,OO())}function AO(e){for(let t of e){if(t.type===`ParameterExpansion`)return t.parameter;if(t.type===`Literal`)return t.value}return``}function jO(e,t){if(Number.parseInt(e.state.env.get(`#`)||`0`,10)<2)return!1;function n(e){for(let t of e)if(t.type===`DoubleQuoted`){for(let e of t.parts)if(e.type===`ParameterExpansion`&&e.parameter===`@`&&!e.operation)return!0}return!1}return n(t.parts)}async function MO(e,t){if(jO(e,t))return{error:`bash: $@: ambiguous redirect
859
+ `};let n=t.parts,{hasQuoted:r}=fT(n);if(TO(n)&&(await DO(e,t)).length>1)return{error:`bash: ${n.map(e=>e.type===`Literal`?e.value:e.type===`BraceExpansion`?`{${e.items.map(e=>{if(e.type===`Range`){let t=e.step?`..${e.step}`:``;return`${e.startStr??e.start}..${e.endStr??e.end}${t}`}return e.word.parts.map(e=>e.type===`Literal`?e.value:``).join(``)}).join(`,`)}}`:``).join(``)}: ambiguous redirect
860
+ `};let i=await NO(e,t),{hasParamExpansion:a,hasCommandSub:o}=fT(n);if((a||o)&&!r&&!CT(e.state.env)&&AT(i,ST(e.state.env)).length>1)return{error:`bash: $${AO(n)}: ambiguous redirect
861
+ `};if(r||e.state.options.noglob)return{target:i};let s=await wO(e,t);if(!sE(s,e.state.shoptOptions.extglob))return{target:i};let c=new sT(e.fs,e.state.cwd,e.state.env,{globstar:e.state.shoptOptions.globstar,nullglob:e.state.shoptOptions.nullglob,failglob:e.state.shoptOptions.failglob,dotglob:e.state.shoptOptions.dotglob,extglob:e.state.shoptOptions.extglob,globskipdots:e.state.shoptOptions.globskipdots,maxGlobOperations:e.limits.maxGlobOperations}),l=await c.expand(s);return l.length===0?c.hasFailglob()?{error:`bash: no match: ${i}
862
862
  `}:{target:i}:l.length===1?{target:l[0]}:{error:`bash: ${i}: ambiguous redirect
863
- `}}async function EO(e,t){let n=t.parts,r=n.length;if(r===1){let t=await DO(e,n[0]);return uO(t,e.limits.maxStringLength,`word expansion`),t}let i=[];for(let t=0;t<r;t++)i.push(await DO(e,n[t]));let a=i.join(``);return uO(a,e.limits.maxStringLength,`word expansion`),a}async function DO(e,t,n=!1){if(t.type===`ParameterExpansion`)return OO(e,t,n);let r=mO(e,t,n);if(r!==null)return r;switch(t.type){case`DoubleQuoted`:{let n=[];for(let r of t.parts)n.push(await DO(e,r,!0));return n.join(``)}case`CommandSubstitution`:{let n=QT(t.body);if(n)try{let t=await X(e,n.target),r=t.startsWith(`/`)?t:`${e.state.cwd}/${t}`,i=await e.fs.readFile(r);e.state.lastExitCode=0,e.state.env.set(`?`,`0`);let a=i.replace(/\n+$/,``);return uO(a,e.limits.maxStringLength,`command substitution`),a}catch(t){if(t instanceof k)throw t;return e.state.lastExitCode=1,e.state.env.set(`?`,`1`),``}let r=e.substitutionDepth??0,i=e.limits.maxSubstitutionDepth;if(r>=i)throw new k(`Command substitution nesting limit exceeded (${i})`,`substitution_depth`);let a=e.substitutionDepth;e.substitutionDepth=r+1;let o=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let s=new Map(e.state.env),c=e.state.cwd,l=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let n=await e.executeScript(t.body),r=n.exitCode;e.state.env=s,e.state.cwd=c,e.state.suppressVerbose=l,e.state.lastExitCode=r,e.state.env.set(`?`,String(r)),n.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+n.stderr),e.state.bashPid=o,e.substitutionDepth=a;let i=n.stdout.replace(/\n+$/,``);return uO(i,e.limits.maxStringLength,`command substitution`),i}catch(t){if(e.state.env=s,e.state.cwd=c,e.state.bashPid=o,e.substitutionDepth=a,e.state.suppressVerbose=l,t instanceof k)throw t;if(t instanceof Ir){e.state.lastExitCode=t.exitCode,e.state.env.set(`?`,String(t.exitCode)),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr);let n=t.stdout.replace(/\n+$/,``);return uO(n,e.limits.maxStringLength,`command substitution`),n}throw t}}case`ArithmeticExpansion`:{let n=t.expression.originalText;if(n&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(n)){let t=await WT(e,n),r=vC(new Ww,t);return String(await Z(e,r.expression,!0))}return String(await Z(e,t.expression.expression,!0))}case`BraceExpansion`:{let n=[];for(let r of t.items)if(r.type===`Range`){let e=YT(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)n.push(...e.expanded);else return e.literal}else n.push(await X(e,r.word));return n.join(` `)}default:return``}}async function OO(e,t,n=!1){let{parameter:r}=t,{operation:i}=t,a=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,t,n]=a;(e.state.associativeArrays?.has(t)||n.includes(`$(`)||n.includes("`")||n.includes("${"))&&(r=`${t}[${await GT(e,n)}]`)}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&OT(e,r)){let t=FT(e,r);if(t&&t!==r){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let[,t,i]=n;(e.state.associativeArrays?.has(t)||i.includes(`$(`)||i.includes("`")||i.includes("${"))&&(r=`${t}[${await GT(e,i)}]`)}}}let o=i&&(i.type===`DefaultValue`||i.type===`AssignDefault`||i.type===`UseAlternative`||i.type===`ErrorIfUnset`),s=await VT(e,r,!o);if(!i)return s;let c=!await HT(e,r),{isEmpty:l,effectiveValue:u}=UE(e,r,s,n),d={value:s,isUnset:c,isEmpty:l,effectiveValue:u,inDoubleQuotes:n};switch(i.type){case`DefaultValue`:return AE(e,i,d,dO);case`AssignDefault`:return jE(e,r,i,d,dO);case`ErrorIfUnset`:return ME(e,r,i,d,dO);case`UseAlternative`:return NE(e,i,d,dO);case`PatternRemoval`:{let t=await PE(e,s,i,dO,DO);return uO(t,e.limits.maxStringLength,`pattern removal`),t}case`PatternReplacement`:{let t=await FE(e,s,i,dO,DO);return uO(t,e.limits.maxStringLength,`pattern replacement`),t}case`Length`:return IE(e,r,s);case`LengthSliceError`:throw new Rr(r);case`BadSubstitution`:throw new Rr(i.text);case`Substring`:return LE(e,r,s,i);case`CaseModification`:{let t=await RE(e,s,i,dO,OO);return uO(t,e.limits.maxStringLength,`case modification`),t}case`Transform`:return zE(e,r,s,c,i);case`Indirection`:return BE(e,r,s,c,i,OO,n);case`ArrayKeys`:return VE(e,i);case`VarNamePrefix`:return HE(e,i);default:return s}}var kO,AO=S(()=>{zC(),Gw(),tT(),BO(),A(),oT(),KT(),ZT(),$T(),iE(),WE(),QE(),eD(),UT(),ZD(),aO(),DT(),RT(),cO(),iE(),UT(),kO=1e5});function jO(e,t,n){switch(n){case`+`:return e+t;case`-`:return e-t;case`*`:return e*t;case`/`:if(t===0)throw new Lr(`division by 0`);return Math.trunc(e/t);case`%`:if(t===0)throw new Lr(`division by 0`);return e%t;case`**`:if(t<0)throw new Lr(`exponent less than 0`);return e**t;case`<<`:return e<<t;case`>>`:return e>>t;case`<`:return+(e<t);case`<=`:return+(e<=t);case`>`:return+(e>t);case`>=`:return+(e>=t);case`==`:return+(e===t);case`!=`:return e===t?0:1;case`&`:return e&t;case`|`:return e|t;case`^`:return e^t;case`,`:return t;default:return 0}}function MO(e,t,n){switch(n){case`=`:return t;case`+=`:return e+t;case`-=`:return e-t;case`*=`:return e*t;case`/=`:return t===0?0:Math.trunc(e/t);case`%=`:return t===0?0:e%t;case`<<=`:return e<<t;case`>>=`:return e>>t;case`&=`:return e&t;case`|=`:return e|t;case`^=`:return e^t;default:return t}}function NO(e,t){switch(t){case`-`:return-e;case`+`:return+e;case`!`:return+(e===0);case`~`:return~e;default:return e}}async function PO(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=e.state.env.get(`${t}_0`);return r===void 0?await VT(e,t):r}function FO(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let n=e.trim();if(!n)return 0;try{let{expr:e,pos:r}=xC(new Ww,n,0);if(r<n.length){let e=n.slice(r).trim().split(/\s+/)[0];throw new Lr(`${n}: syntax error in expression (error token is "${e}")`)}return e.type===`ArithNumber`?e.value:t||0}catch(e){if(e instanceof Lr)throw e;let t=n.split(/\s+/).slice(1)[0]||n;throw new Lr(`${n}: syntax error in expression (error token is "${t}")`)}}async function IO(e,t){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let r=t.trim();if(!r)return 0;let{expr:i,pos:a}=xC(new Ww,r,0);if(a<r.length){let e=r.slice(a).trim(),t=e.split(/\s+/)[0]||e;throw new Lr(`syntax error in expression (error token is "${t}")`,``,``)}return await Z(e,i)}async function LO(e,t,n=new Set,r=0){if(r>100)throw new Lr(`maximum variable indirection depth exceeded`);if(n.has(t))return 0;n.add(t);let i=await PO(e,t);if(!i)return 0;let a=Number.parseInt(i,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(i.trim()))return a;let o=i.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await LO(e,o,n,r+1);let{expr:s,pos:c}=xC(new Ww,o,0);if(c<o.length){let e=o.slice(c).trim(),t=e.split(/\s+/)[0]||e;throw new Lr(`${o}: syntax error in expression (error token is "${t}")`)}return await Z(e,s)}async function RO(e,t){if(t.startsWith(`#`)){let n=t.slice(1),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let t=r[1],n=J(e,t);return String(n.length)}let i=e.state.env.get(n)||``;return String(i.length)}if(t.startsWith(`!`)){let n=t.slice(1),r=e.state.env.get(n)||``;return e.state.env.get(r)||``}let n=[`:-`,`:=`,`:?`,`:+`,`-`,`=`,`?`,`+`],r=-1,i=``;for(let e of n){let n=t.indexOf(e);n>0&&(r===-1||n<r)&&(r=n,i=e)}if(r===-1)return await VT(e,t);let a=t.slice(0,r),o=t.slice(r+i.length),s=e.state.env.get(a),c=s===void 0,l=s===``,u=i.startsWith(`:`);switch(i){case`:-`:case`-`:return c||u&&l?o:s||``;case`:=`:case`=`:return c||u&&l?(e.state.env.set(a,o),o):s||``;case`:+`:case`+`:return c||u&&l?``:o;case`:?`:case`?`:if(c||u&&l)throw Error(o||`${a}: parameter null or not set`);return s||``;default:return s||``}}async function Z(e,t,n=!1){switch(t.type){case`ArithNumber`:if(Number.isNaN(t.value))throw new Lr(`value too great for base`);return t.value;case`ArithVariable`:return await LO(e,t.name);case`ArithSpecialVar`:{let n=(await VT(e,t.name)).trim();if(!n)return 0;let r=Number.parseInt(n,10);if(!Number.isNaN(r)&&/^-?\d+$/.test(n))return r;let{expr:i}=xC(new Ww,n,0);return await Z(e,i)}case`ArithNested`:return await Z(e,t.expression);case`ArithCommandSubst`:if(e.execFn){let n=await e.execFn(t.command,{signal:e.state.signal});n.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+n.stderr);let r=n.stdout.trim();return Number.parseInt(r,10)||0}return 0;case`ArithBracedExpansion`:{let n=await RO(e,t.content);return Number.parseInt(n,10)||0}case`ArithDynamicBase`:{let n=await RO(e,t.baseExpr),r=Number.parseInt(n,10);return r<2||r>64?0:dC(`${r}#${t.value}`)}case`ArithDynamicNumber`:return dC(await RO(e,t.prefix)+t.suffix);case`ArithArrayElement`:{let r=e.state.associativeArrays?.has(t.array),i=async t=>{let n=e.state.env.get(t);return n===void 0?0:await IO(e,n)};if(t.stringKey!==void 0)return await i(`${t.array}_${t.stringKey}`);if(r&&t.index?.type===`ArithVariable`&&!t.index.hasDollarPrefix)return await i(`${t.array}_${t.index.name}`);if(r&&t.index?.type===`ArithVariable`&&t.index.hasDollarPrefix){let n=await VT(e,t.index.name);return await i(`${t.array}_${n}`)}if(t.index){let r=await Z(e,t.index,n);if(r<0){let n=J(e,t.array),i=e.state.currentLine;if(n.length===0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${i}: ${t.array}: bad array subscript
863
+ `}}async function NO(e,t){let n=t.parts,r=n.length;if(r===1){let t=await PO(e,n[0]);return _O(t,e.limits.maxStringLength,`word expansion`),t}let i=[];for(let t=0;t<r;t++)i.push(await PO(e,n[t]));let a=i.join(``);return _O(a,e.limits.maxStringLength,`word expansion`),a}async function PO(e,t,n=!1){if(t.type===`ParameterExpansion`)return FO(e,t,n);let r=xO(e,t,n);if(r!==null)return r;switch(t.type){case`DoubleQuoted`:{let n=[];for(let r of t.parts)n.push(await PO(e,r,!0));return n.join(``)}case`CommandSubstitution`:{let n=aE(t.body);if(n)try{let t=await X(e,n.target),r=t.startsWith(`/`)?t:`${e.state.cwd}/${t}`,i=await e.fs.readFile(r);e.state.lastExitCode=0,e.state.env.set(`?`,`0`);let a=i.replace(/\n+$/,``);return _O(a,e.limits.maxStringLength,`command substitution`),a}catch(t){if(t instanceof k)throw t;return e.state.lastExitCode=1,e.state.env.set(`?`,`1`),``}let r=e.substitutionDepth??0,i=e.limits.maxSubstitutionDepth;if(r>=i)throw new k(`Command substitution nesting limit exceeded (${i})`,`substitution_depth`);let a=e.substitutionDepth;e.substitutionDepth=r+1;let o=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let s=new Map(e.state.env),c=e.state.cwd,l=e.state.suppressVerbose;e.state.suppressVerbose=!0;try{let n=await e.executeScript(t.body),r=n.exitCode;e.state.env=s,e.state.cwd=c,e.state.suppressVerbose=l,e.state.lastExitCode=r,e.state.env.set(`?`,String(r)),n.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+n.stderr),e.state.bashPid=o,e.substitutionDepth=a;let i=n.stdout.replace(/\n+$/,``);return _O(i,e.limits.maxStringLength,`command substitution`),i}catch(t){if(e.state.env=s,e.state.cwd=c,e.state.bashPid=o,e.substitutionDepth=a,e.state.suppressVerbose=l,t instanceof k)throw t;if(t instanceof Ir){e.state.lastExitCode=t.exitCode,e.state.env.set(`?`,String(t.exitCode)),t.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+t.stderr);let n=t.stdout.replace(/\n+$/,``);return _O(n,e.limits.maxStringLength,`command substitution`),n}throw t}}case`ArithmeticExpansion`:{let n=t.expression.originalText;if(n&&/\$[a-zA-Z_][a-zA-Z0-9_]*(?![{[(])/.test(n)){let t=await ZT(e,n),r=TC(new Zw,t);return String(await Z(e,r.expression,!0))}return String(await Z(e,t.expression.expression,!0))}case`BraceExpansion`:{let n=[];for(let r of t.items)if(r.type===`Range`){let e=nE(r.start,r.end,r.step,r.startStr,r.endStr);if(e.expanded)n.push(...e.expanded);else return e.literal}else n.push(await X(e,r.word));return n.join(` `)}default:return``}}async function FO(e,t,n=!1){let{parameter:r}=t,{operation:i}=t,a=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(a){let[,t,n]=a;(e.state.associativeArrays?.has(t)||n.includes(`$(`)||n.includes("`")||n.includes("${"))&&(r=`${t}[${await QT(e,n)}]`)}else if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&FT(e,r)){let t=HT(e,r);if(t&&t!==r){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let[,t,i]=n;(e.state.associativeArrays?.has(t)||i.includes(`$(`)||i.includes("`")||i.includes("${"))&&(r=`${t}[${await QT(e,i)}]`)}}}let o=i&&(i.type===`DefaultValue`||i.type===`AssignDefault`||i.type===`UseAlternative`||i.type===`ErrorIfUnset`),s=await JT(e,r,!o);if(!i)return s;let c=!await YT(e,r),{isEmpty:l,effectiveValue:u}=XE(e,r,s,n),d={value:s,isUnset:c,isEmpty:l,effectiveValue:u,inDoubleQuotes:n};switch(i.type){case`DefaultValue`:return LE(e,i,d,vO);case`AssignDefault`:return RE(e,r,i,d,vO);case`ErrorIfUnset`:return zE(e,r,i,d,vO);case`UseAlternative`:return BE(e,i,d,vO);case`PatternRemoval`:{let t=await VE(e,s,i,vO,PO);return _O(t,e.limits.maxStringLength,`pattern removal`),t}case`PatternReplacement`:{let t=await HE(e,s,i,vO,PO);return _O(t,e.limits.maxStringLength,`pattern replacement`),t}case`Length`:return UE(e,r,s);case`LengthSliceError`:throw new Rr(r);case`BadSubstitution`:throw new Rr(i.text);case`Substring`:return WE(e,r,s,i);case`CaseModification`:{let t=await GE(e,s,i,vO,FO);return _O(t,e.limits.maxStringLength,`case modification`),t}case`Transform`:return KE(e,r,s,c,i);case`Indirection`:return qE(e,r,s,c,i,FO,n);case`ArrayKeys`:return JE(e,i);case`VarNamePrefix`:return YE(e,i);default:return s}}var IO,LO=S(()=>{KC(),Qw(),cT(),qO(),A(),pT(),$T(),iE(),oE(),dE(),ZE(),aD(),sD(),XT(),iO(),fO(),PT(),GT(),hO(),dE(),XT(),IO=1e5});function RO(e,t,n){switch(n){case`+`:return e+t;case`-`:return e-t;case`*`:return e*t;case`/`:if(t===0)throw new Lr(`division by 0`);return Math.trunc(e/t);case`%`:if(t===0)throw new Lr(`division by 0`);return e%t;case`**`:if(t<0)throw new Lr(`exponent less than 0`);return e**t;case`<<`:return e<<t;case`>>`:return e>>t;case`<`:return+(e<t);case`<=`:return+(e<=t);case`>`:return+(e>t);case`>=`:return+(e>=t);case`==`:return+(e===t);case`!=`:return e===t?0:1;case`&`:return e&t;case`|`:return e|t;case`^`:return e^t;case`,`:return t;default:return 0}}function zO(e,t,n){switch(n){case`=`:return t;case`+=`:return e+t;case`-=`:return e-t;case`*=`:return e*t;case`/=`:return t===0?0:Math.trunc(e/t);case`%=`:return t===0?0:e%t;case`<<=`:return e<<t;case`>>=`:return e>>t;case`&=`:return e&t;case`|=`:return e|t;case`^=`:return e^t;default:return t}}function BO(e,t){switch(t){case`-`:return-e;case`+`:return+e;case`!`:return+(e===0);case`~`:return~e;default:return e}}async function VO(e,t){let n=e.state.env.get(t);if(n!==void 0)return n;let r=e.state.env.get(`${t}_0`);return r===void 0?await JT(e,t):r}function HO(e){if(!e)return 0;let t=Number.parseInt(e,10);if(!Number.isNaN(t)&&/^-?\d+$/.test(e.trim()))return t;let n=e.trim();if(!n)return 0;try{let{expr:e,pos:r}=OC(new Zw,n,0);if(r<n.length){let e=n.slice(r).trim().split(/\s+/)[0];throw new Lr(`${n}: syntax error in expression (error token is "${e}")`)}return e.type===`ArithNumber`?e.value:t||0}catch(e){if(e instanceof Lr)throw e;let t=n.split(/\s+/).slice(1)[0]||n;throw new Lr(`${n}: syntax error in expression (error token is "${t}")`)}}async function UO(e,t){if(!t)return 0;let n=Number.parseInt(t,10);if(!Number.isNaN(n)&&/^-?\d+$/.test(t.trim()))return n;let r=t.trim();if(!r)return 0;let{expr:i,pos:a}=OC(new Zw,r,0);if(a<r.length){let e=r.slice(a).trim(),t=e.split(/\s+/)[0]||e;throw new Lr(`syntax error in expression (error token is "${t}")`,``,``)}return await Z(e,i)}async function WO(e,t,n=new Set,r=0){if(r>100)throw new Lr(`maximum variable indirection depth exceeded`);if(n.has(t))return 0;n.add(t);let i=await VO(e,t);if(!i)return 0;let a=Number.parseInt(i,10);if(!Number.isNaN(a)&&/^-?\d+$/.test(i.trim()))return a;let o=i.trim();if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o))return await WO(e,o,n,r+1);let{expr:s,pos:c}=OC(new Zw,o,0);if(c<o.length){let e=o.slice(c).trim(),t=e.split(/\s+/)[0]||e;throw new Lr(`${o}: syntax error in expression (error token is "${t}")`)}return await Z(e,s)}async function GO(e,t){if(t.startsWith(`#`)){let n=t.slice(1),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[[@*]\]$/);if(r){let t=r[1],n=J(e,t);return String(n.length)}let i=e.state.env.get(n)||``;return String(i.length)}if(t.startsWith(`!`)){let n=t.slice(1),r=e.state.env.get(n)||``;return e.state.env.get(r)||``}let n=[`:-`,`:=`,`:?`,`:+`,`-`,`=`,`?`,`+`],r=-1,i=``;for(let e of n){let n=t.indexOf(e);n>0&&(r===-1||n<r)&&(r=n,i=e)}if(r===-1)return await JT(e,t);let a=t.slice(0,r),o=t.slice(r+i.length),s=e.state.env.get(a),c=s===void 0,l=s===``,u=i.startsWith(`:`);switch(i){case`:-`:case`-`:return c||u&&l?o:s||``;case`:=`:case`=`:return c||u&&l?(e.state.env.set(a,o),o):s||``;case`:+`:case`+`:return c||u&&l?``:o;case`:?`:case`?`:if(c||u&&l)throw Error(o||`${a}: parameter null or not set`);return s||``;default:return s||``}}async function Z(e,t,n=!1){switch(t.type){case`ArithNumber`:if(Number.isNaN(t.value))throw new Lr(`value too great for base`);return t.value;case`ArithVariable`:return await WO(e,t.name);case`ArithSpecialVar`:{let n=(await JT(e,t.name)).trim();if(!n)return 0;let r=Number.parseInt(n,10);if(!Number.isNaN(r)&&/^-?\d+$/.test(n))return r;let{expr:i}=OC(new Zw,n,0);return await Z(e,i)}case`ArithNested`:return await Z(e,t.expression);case`ArithCommandSubst`:if(e.execFn){let n=await e.execFn(t.command,{signal:e.state.signal});n.stderr&&(e.state.expansionStderr=(e.state.expansionStderr||``)+n.stderr);let r=n.stdout.trim();return Number.parseInt(r,10)||0}return 0;case`ArithBracedExpansion`:{let n=await GO(e,t.content);return Number.parseInt(n,10)||0}case`ArithDynamicBase`:{let n=await GO(e,t.baseExpr),r=Number.parseInt(n,10);return r<2||r>64?0:vC(`${r}#${t.value}`)}case`ArithDynamicNumber`:return vC(await GO(e,t.prefix)+t.suffix);case`ArithArrayElement`:{let r=e.state.associativeArrays?.has(t.array),i=async t=>{let n=e.state.env.get(t);return n===void 0?0:await UO(e,n)};if(t.stringKey!==void 0)return await i(`${t.array}_${t.stringKey}`);if(r&&t.index?.type===`ArithVariable`&&!t.index.hasDollarPrefix)return await i(`${t.array}_${t.index.name}`);if(r&&t.index?.type===`ArithVariable`&&t.index.hasDollarPrefix){let n=await JT(e,t.index.name);return await i(`${t.array}_${n}`)}if(t.index){let r=await Z(e,t.index,n);if(r<0){let n=J(e,t.array),i=e.state.currentLine;if(n.length===0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${i}: ${t.array}: bad array subscript
864
864
  `,0;let a=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1+r;if(a<0)return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${i}: ${t.array}: bad array subscript
865
- `,0;r=a}let i=`${t.array}_${r}`,a=e.state.env.get(i);if(a!==void 0)return IO(e,a);if(r===0){let n=e.state.env.get(t.array);if(n!==void 0)return IO(e,n)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(e=>e===t.array||e.startsWith(`${t.array}_`)))throw new Fr(`${t.array}[${r}]`);return 0}return 0}case`ArithDoubleSubscript`:throw new Lr(`double subscript`,``,``);case`ArithNumberSubscript`:throw new Lr(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case`ArithSyntaxError`:throw new Lr(t.message,``,``,!0);case`ArithSingleQuote`:if(n)throw new Lr(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value;case`ArithBinary`:return t.operator===`||`?await Z(e,t.left,n)||await Z(e,t.right,n)?1:0:t.operator===`&&`?await Z(e,t.left,n)&&await Z(e,t.right,n)?1:0:jO(await Z(e,t.left,n),await Z(e,t.right,n),t.operator);case`ArithUnary`:{let r=await Z(e,t.operand,n);if(t.operator===`++`||t.operator===`--`){if(t.operand.type===`ArithVariable`){let n=t.operand.name,r=Number.parseInt(await VT(e,n),10)||0,i=t.operator===`++`?r+1:r-1;return e.state.env.set(n,String(i)),t.prefix?i:r}if(t.operand.type===`ArithArrayElement`){let i=t.operand.array,a=e.state.associativeArrays?.has(i),o;if(t.operand.stringKey!==void 0)o=`${i}_${t.operand.stringKey}`;else if(a&&t.operand.index?.type===`ArithVariable`&&!t.operand.index.hasDollarPrefix)o=`${i}_${t.operand.index.name}`;else if(a&&t.operand.index?.type===`ArithVariable`&&t.operand.index.hasDollarPrefix)o=`${i}_${await VT(e,t.operand.index.name)}`;else if(t.operand.index)o=`${i}_${await Z(e,t.operand.index,n)}`;else return r;let s=Number.parseInt(e.state.env.get(o)||`0`,10)||0,c=t.operator===`++`?s+1:s-1;return e.state.env.set(o,String(c)),t.prefix?c:s}if(t.operand.type===`ArithConcat`){let r=``;for(let i of t.operand.parts)r+=await zO(e,i,n);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let n=Number.parseInt(e.state.env.get(r)||`0`,10)||0,i=t.operator===`++`?n+1:n-1;return e.state.env.set(r,String(i)),t.prefix?i:n}}if(t.operand.type===`ArithDynamicElement`){let r=``;if(t.operand.nameExpr.type===`ArithConcat`)for(let i of t.operand.nameExpr.parts)r+=await zO(e,i,n);else t.operand.nameExpr.type===`ArithVariable`&&(r=t.operand.nameExpr.hasDollarPrefix?await VT(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let i=await Z(e,t.operand.subscript,n),a=`${r}_${i}`,o=Number.parseInt(e.state.env.get(a)||`0`,10)||0,s=t.operator===`++`?o+1:o-1;return e.state.env.set(a,String(s)),t.prefix?s:o}}return r}return NO(r,t.operator)}case`ArithTernary`:return await Z(e,t.condition,n)?await Z(e,t.consequent,n):await Z(e,t.alternate,n);case`ArithAssignment`:{let r=t.variable,i=r;if(t.stringKey!==void 0)i=`${r}_${t.stringKey}`;else if(t.subscript){let a=e.state.associativeArrays?.has(r);if(a&&t.subscript.type===`ArithVariable`&&!t.subscript.hasDollarPrefix)i=`${r}_${t.subscript.name}`;else if(a&&t.subscript.type===`ArithVariable`&&t.subscript.hasDollarPrefix)i=`${r}_${await VT(e,t.subscript.name)||`\\`}`;else if(a)i=`${r}_${await Z(e,t.subscript,n)}`;else{let a=await Z(e,t.subscript,n);if(a<0){let t=J(e,r);t.length>0&&(a=Math.max(...t.map(([e])=>typeof e==`number`?e:0))+1+a)}i=`${r}_${a}`}}let a=MO(Number.parseInt(e.state.env.get(i)||`0`,10)||0,await Z(e,t.value,n),t.operator);return e.state.env.set(i,String(a)),a}case`ArithGroup`:return await Z(e,t.expression,n);case`ArithConcat`:{let r=``;for(let i of t.parts)r+=await zO(e,i,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await LO(e,r):Number.parseInt(r,10)||0}case`ArithDynamicAssignment`:{let r=``;if(t.target.type===`ArithConcat`)for(let i of t.target.parts)r+=await zO(e,i,n);else t.target.type===`ArithVariable`&&(r=t.target.hasDollarPrefix?await VT(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let i=r;if(t.subscript){let a=await Z(e,t.subscript,n);i=`${r}_${a}`}let a=MO(Number.parseInt(e.state.env.get(i)||`0`,10)||0,await Z(e,t.value,n),t.operator);return e.state.env.set(i,String(a)),a}case`ArithDynamicElement`:{let r=``;if(t.nameExpr.type===`ArithConcat`)for(let i of t.nameExpr.parts)r+=await zO(e,i,n);else t.nameExpr.type===`ArithVariable`&&(r=t.nameExpr.hasDollarPrefix?await VT(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let i=await Z(e,t.subscript,n),a=`${r}_${i}`,o=e.state.env.get(a);return o===void 0?0:FO(o)}default:return 0}}async function zO(e,t,n=!1){switch(t.type){case`ArithNumber`:return String(t.value);case`ArithSingleQuote`:return String(await Z(e,t,n));case`ArithVariable`:return t.hasDollarPrefix?await VT(e,t.name):t.name;case`ArithSpecialVar`:return await VT(e,t.name);case`ArithBracedExpansion`:return await RO(e,t.content);case`ArithCommandSubst`:return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():`0`;case`ArithConcat`:{let r=``;for(let i of t.parts)r+=await zO(e,i,n);return r}default:return String(await Z(e,t,n))}}var BO=S(()=>{zC(),Gw(),A(),AO()});ur(),ir();var VO=[{name:`echo`,load:async()=>(await Promise.resolve().then(()=>(hr(),dr))).echoCommand},{name:`cat`,load:async()=>(await Promise.resolve().then(()=>(Or(),Sr))).catCommand},{name:`printf`,load:async()=>(await Promise.resolve().then(()=>(Ci(),oi))).printfCommand},{name:`ls`,load:async()=>(await Promise.resolve().then(()=>(Pi(),wi))).lsCommand},{name:`mkdir`,load:async()=>(await Promise.resolve().then(()=>(Hi(),Ri))).mkdirCommand},{name:`rmdir`,load:async()=>(await Promise.resolve().then(()=>(Zi(),Ui))).rmdirCommand},{name:`touch`,load:async()=>(await Promise.resolve().then(()=>(na(),Qi))).touchCommand},{name:`rm`,load:async()=>(await Promise.resolve().then(()=>(sa(),ra))).rmCommand},{name:`cp`,load:async()=>(await Promise.resolve().then(()=>(pa(),ca))).cpCommand},{name:`mv`,load:async()=>(await Promise.resolve().then(()=>(ya(),ma))).mvCommand},{name:`ln`,load:async()=>(await Promise.resolve().then(()=>(wa(),ba))).lnCommand},{name:`chmod`,load:async()=>(await Promise.resolve().then(()=>(ja(),Ta))).chmodCommand},{name:`pwd`,load:async()=>(await Promise.resolve().then(()=>(Fa(),Ma))).pwdCommand},{name:`readlink`,load:async()=>(await Promise.resolve().then(()=>(Ba(),Ia))).readlinkCommand},{name:`head`,load:async()=>(await Promise.resolve().then(()=>(Xa(),Ka))).headCommand},{name:`tail`,load:async()=>(await Promise.resolve().then(()=>(to(),Za))).tailCommand},{name:`wc`,load:async()=>(await Promise.resolve().then(()=>(lo(),no))).wcCommand},{name:`stat`,load:async()=>(await Promise.resolve().then(()=>(vo(),po))).statCommand},{name:`grep`,load:async()=>(await Promise.resolve().then(()=>(oc(),Js))).grepCommand},{name:`fgrep`,load:async()=>(await Promise.resolve().then(()=>(oc(),Js))).fgrepCommand},{name:`egrep`,load:async()=>(await Promise.resolve().then(()=>(oc(),Js))).egrepCommand},{name:`rg`,load:async()=>(await Promise.resolve().then(()=>(ul(),ol))).rgCommand},{name:`sed`,load:async()=>(await Promise.resolve().then(()=>(ql(),Hl))).sedCommand},{name:`awk`,load:async()=>(await Promise.resolve().then(()=>(Sf(),hf))).awkCommand2},{name:`sort`,load:async()=>(await Promise.resolve().then(()=>(Bf(),If))).sortCommand},{name:`uniq`,load:async()=>(await Promise.resolve().then(()=>(Kf(),Vf))).uniqCommand},{name:`comm`,load:async()=>(await Promise.resolve().then(()=>(Zf(),qf))).commCommand},{name:`cut`,load:async()=>(await Promise.resolve().then(()=>(ip(),Qf))).cutCommand},{name:`paste`,load:async()=>(await Promise.resolve().then(()=>(dp(),ap))).pasteCommand},{name:`tr`,load:async()=>(await Promise.resolve().then(()=>(yp(),fp))).trCommand},{name:`rev`,load:async()=>(await Promise.resolve().then(()=>(Tp(),bp))).rev},{name:`nl`,load:async()=>(await Promise.resolve().then(()=>(Np(),Ep))).nl},{name:`fold`,load:async()=>(await Promise.resolve().then(()=>(Vp(),Pp))).fold},{name:`expand`,load:async()=>(await Promise.resolve().then(()=>(Xp(),Hp))).expand},{name:`unexpand`,load:async()=>(await Promise.resolve().then(()=>(am(),Zp))).unexpand},{name:`strings`,load:async()=>(await Promise.resolve().then(()=>(pm(),om))).strings},{name:`split`,load:async()=>(await Promise.resolve().then(()=>(wm(),mm))).split},{name:`column`,load:async()=>(await Promise.resolve().then(()=>(Pm(),Tm))).column},{name:`join`,load:async()=>(await Promise.resolve().then(()=>(Um(),Fm))).join},{name:`tee`,load:async()=>(await Promise.resolve().then(()=>(Ym(),Wm))).teeCommand},{name:`find`,load:async()=>(await Promise.resolve().then(()=>(wh(),ph))).findCommand},{name:`basename`,load:async()=>(await Promise.resolve().then(()=>(kh(),Th))).basenameCommand},{name:`dirname`,load:async()=>(await Promise.resolve().then(()=>(Ph(),Ah))).dirnameCommand},{name:`tree`,load:async()=>(await Promise.resolve().then(()=>(Hh(),Fh))).treeCommand},{name:`du`,load:async()=>(await Promise.resolve().then(()=>(Zh(),Uh))).duCommand},{name:`env`,load:async()=>(await Promise.resolve().then(()=>(ag(),Qh))).envCommand},{name:`printenv`,load:async()=>(await Promise.resolve().then(()=>(ag(),Qh))).printenvCommand},{name:`alias`,load:async()=>(await Promise.resolve().then(()=>(pg(),og))).aliasCommand},{name:`unalias`,load:async()=>(await Promise.resolve().then(()=>(pg(),og))).unaliasCommand},{name:`history`,load:async()=>(await Promise.resolve().then(()=>(yg(),mg))).historyCommand},{name:`xargs`,load:async()=>(await Promise.resolve().then(()=>(wg(),bg))).xargsCommand},{name:`true`,load:async()=>(await Promise.resolve().then(()=>(Ag(),Tg))).trueCommand},{name:`false`,load:async()=>(await Promise.resolve().then(()=>(Ag(),Tg))).falseCommand},{name:`clear`,load:async()=>(await Promise.resolve().then(()=>(Fg(),jg))).clearCommand},{name:`bash`,load:async()=>(await Promise.resolve().then(()=>(Ug(),Ig))).bashCommand},{name:`sh`,load:async()=>(await Promise.resolve().then(()=>(Ug(),Ig))).shCommand},{name:`jq`,load:async()=>(await Promise.resolve().then(()=>(ov(),ev))).jqCommand},{name:`base64`,load:async()=>(await Promise.resolve().then(()=>(pv(),sv))).base64Command},{name:`diff`,load:async()=>(await Promise.resolve().then(()=>(yv(),mv))).diffCommand},{name:`date`,load:async()=>(await Promise.resolve().then(()=>(kv(),bv))).dateCommand},{name:`sleep`,load:async()=>(await Promise.resolve().then(()=>(Lv(),Mv))).sleepCommand},{name:`timeout`,load:async()=>(await Promise.resolve().then(()=>(Hv(),Rv))).timeoutCommand},{name:`time`,load:async()=>(await Promise.resolve().then(()=>(Xv(),Kv))).timeCommand},{name:`seq`,load:async()=>(await Promise.resolve().then(()=>(ey(),Zv))).seqCommand},{name:`expr`,load:async()=>(await Promise.resolve().then(()=>(ay(),ty))).exprCommand},{name:`md5sum`,load:async()=>(await Promise.resolve().then(()=>(my(),dy))).md5sumCommand},{name:`sha1sum`,load:async()=>(await Promise.resolve().then(()=>(vy(),hy))).sha1sumCommand},{name:`sha256sum`,load:async()=>(await Promise.resolve().then(()=>(Sy(),yy))).sha256sumCommand},{name:`file`,load:async()=>(await Promise.resolve().then(()=>(fx(),nx))).fileCommand},{name:`html-to-markdown`,load:async()=>(await Promise.resolve().then(()=>(_x(),px))).htmlToMarkdownCommand},{name:`help`,load:async()=>(await Promise.resolve().then(()=>(Cx(),vx))).helpCommand},{name:`which`,load:async()=>(await Promise.resolve().then(()=>(kx(),wx))).whichCommand},{name:`tac`,load:async()=>(await Promise.resolve().then(()=>(Px(),Ax))).tac},{name:`hostname`,load:async()=>(await Promise.resolve().then(()=>(zx(),Fx))).hostname},{name:`whoami`,load:async()=>(await Promise.resolve().then(()=>(Wx(),Bx))).whoami},{name:`od`,load:async()=>(await Promise.resolve().then(()=>(Yx(),Gx))).od},{name:`gzip`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).gzipCommand},{name:`gunzip`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).gunzipCommand},{name:`zcat`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).zcatCommand}],HO=[],UO=[],WO=[{name:`curl`,load:async()=>(await Promise.resolve().then(()=>(RS(),MS))).curlCommand}],GO=new Map;function KO(e){return{name:e.name,async execute(t,n){let r=GO.get(e.name);return r||(r=await rr.runTrustedAsync(()=>e.load()),GO.set(e.name,r)),n.coverage,r.execute(t,n)}}}function qO(){return VO.map(e=>e.name)}function JO(){return WO.map(e=>e.name)}function YO(e){return(e?VO.filter(t=>e.includes(t.name)):VO).map(KO)}function XO(){return WO.map(KO)}function ZO(){return HO.map(KO)}function QO(){return UO.map(KO)}function $O(e){return`load`in e&&typeof e.load==`function`}function ek(e,t){return{name:e,trusted:!0,execute:t}}function tk(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||=await e.load(),t.execute(n,r)}}}var nk=new TextEncoder,rk=new TextDecoder;function ik(e,t){if(e instanceof Uint8Array)return e;if(t===`base64`)return Uint8Array.from(atob(e),e=>e.charCodeAt(0));if(t===`hex`){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t}if(t===`binary`||t===`latin1`){if(e.length<=65536)return Uint8Array.from(e,e=>e.charCodeAt(0));let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}return nk.encode(e)}function ak(e,t){if(t===`base64`){if(typeof Buffer<`u`)return Buffer.from(e).toString(`base64`);let t=65536,n=``;for(let r=0;r<e.length;r+=t){let i=e.subarray(r,r+t);n+=String.fromCharCode(...i)}return btoa(n)}if(t===`hex`)return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);if(t===`binary`||t===`latin1`){if(typeof Buffer<`u`)return Buffer.from(e).toString(t);let n=65536;if(e.length<=n)return String.fromCharCode(...e);let r=``;for(let t=0;t<e.length;t+=n){let i=e.subarray(t,t+n);r+=String.fromCharCode(...i)}return r}return rk.decode(e)}function ok(e){if(e!=null)return typeof e==`string`?e:e.encoding??void 0}function sk(e){if(!e||e===`/`)return`/`;let t=e.endsWith(`/`)&&e!==`/`?e.slice(0,-1):e;t.startsWith(`/`)||(t=`/${t}`);let n=t.split(`/`).filter(e=>e&&e!==`.`),r=[];for(let e of n)e===`..`?r.pop():r.push(e);return`/${r.join(`/`)}`||`/`}function ck(e,t){if(e.includes(`\0`))throw Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function lk(e){let t=sk(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function uk(e,t){return t.startsWith(`/`)?sk(t):sk(e===`/`?`/${t}`:`${e}/${t}`)}function dk(e,t){return e===`/`?`/${t}`:`${e}/${t}`}function fk(e,t){return t.startsWith(`/`)?sk(t):sk(dk(lk(e),t))}var pk=new TextEncoder;function mk(e){return typeof e==`object`&&!!e&&!(e instanceof Uint8Array)&&`content`in e}var hk=class{data=new Map;constructor(e){if(this.data.set(`/`,{type:`directory`,mode:493,mtime:new Date}),e)for(let[t,n]of Object.entries(e))typeof n==`function`?this.writeFileLazy(t,n):mk(n)?this.writeFileSync(t,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(t,n)}ensureParentDirs(e){let t=lk(e);t!==`/`&&(this.data.has(t)||(this.ensureParentDirs(t),this.data.set(t,{type:`directory`,mode:493,mtime:new Date})))}writeFileSync(e,t,n,r){ck(e,`write`);let i=sk(e);this.ensureParentDirs(i);let a=ik(t,ok(n));this.data.set(i,{type:`file`,content:a,mode:r?.mode??420,mtime:r?.mtime??new Date})}writeFileLazy(e,t,n){ck(e,`write`);let r=sk(e);this.ensureParentDirs(r),this.data.set(r,{type:`file`,lazy:t,mode:n?.mode??420,mtime:n?.mtime??new Date})}async materializeLazy(e,t){let n=await t.lazy(),r={type:`file`,content:typeof n==`string`?pk.encode(n):n,mode:t.mode,mtime:t.mtime};return this.data.set(e,r),r}async readFile(e,t){return ak(await this.readFileBuffer(e),ok(t))}async readFileBuffer(e){ck(e,`open`);let t=this.resolvePathWithSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, open '${e}'`);if(n.type!==`file`)throw Error(`EISDIR: illegal operation on a directory, read '${e}'`);if(`lazy`in n){let e=await this.materializeLazy(t,n);return e.content instanceof Uint8Array?e.content:pk.encode(e.content)}return n.content instanceof Uint8Array?n.content:pk.encode(n.content)}async writeFile(e,t,n){this.writeFileSync(e,t,n)}async appendFile(e,t,n){ck(e,`append`);let r=sk(e),i=this.data.get(r);if(i&&i.type===`directory`)throw Error(`EISDIR: illegal operation on a directory, write '${e}'`);let a=ik(t,ok(n));if(i?.type===`file`){let e=i;`lazy`in e&&(e=await this.materializeLazy(r,e));let t=`content`in e&&e.content instanceof Uint8Array?e.content:pk.encode(`content`in e?e.content:``),n=new Uint8Array(t.length+a.length);n.set(t),n.set(a,t.length),this.data.set(r,{type:`file`,content:n,mode:e.mode,mtime:new Date})}else this.writeFileSync(e,t,n)}async exists(e){if(e.includes(`\0`))return!1;try{let t=this.resolvePathWithSymlinks(e);return this.data.has(t)}catch{return!1}}async stat(e){ck(e,`stat`);let t=this.resolvePathWithSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, stat '${e}'`);n.type===`file`&&`lazy`in n&&(n=await this.materializeLazy(t,n));let r=0;return n.type===`file`&&`content`in n&&n.content&&(r=n.content instanceof Uint8Array?n.content.length:pk.encode(n.content).length),{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}async lstat(e){ck(e,`lstat`);let t=this.resolveIntermediateSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, lstat '${e}'`);if(n.type===`symlink`)return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:n.mode,size:n.target.length,mtime:n.mtime||new Date};n.type===`file`&&`lazy`in n&&(n=await this.materializeLazy(t,n));let r=0;return n.type===`file`&&`content`in n&&n.content&&(r=n.content instanceof Uint8Array?n.content.length:pk.encode(n.content).length),{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveIntermediateSymlinks(e){let t=sk(e);if(t===`/`)return`/`;let n=t.slice(1).split(`/`);if(n.length<=1)return t;let r=``,i=new Set;for(let t=0;t<n.length-1;t++){let a=n[t];r=`${r}/${a}`;let o=this.data.get(r),s=0;for(;o&&o.type===`symlink`&&s<40;){if(i.has(r))throw Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`);i.add(r),r=fk(r,o.target),o=this.data.get(r),s++}if(s>=40)throw Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(e){let t=sk(e);if(t===`/`)return`/`;let n=t.slice(1).split(`/`),r=``,i=new Set;for(let t of n){r=`${r}/${t}`;let n=this.data.get(r),a=0;for(;n&&n.type===`symlink`&&a<40;){if(i.has(r))throw Error(`ELOOP: too many levels of symbolic links, open '${e}'`);i.add(r),r=fk(r,n.target),n=this.data.get(r),a++}if(a>=40)throw Error(`ELOOP: too many levels of symbolic links, open '${e}'`)}return r}async mkdir(e,t){this.mkdirSync(e,t)}mkdirSync(e,t){ck(e,`mkdir`);let n=sk(e);if(this.data.has(n)){if(this.data.get(n)?.type===`file`)throw Error(`EEXIST: file already exists, mkdir '${e}'`);if(!t?.recursive)throw Error(`EEXIST: directory already exists, mkdir '${e}'`);return}let r=lk(n);if(r!==`/`&&!this.data.has(r))if(t?.recursive)this.mkdirSync(r,{recursive:!0});else throw Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.data.set(n,{type:`directory`,mode:493,mtime:new Date})}async readdir(e){return(await this.readdirWithFileTypes(e)).map(e=>e.name)}async readdirWithFileTypes(e){ck(e,`scandir`);let t=sk(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, scandir '${e}'`);let r=new Set;for(;n&&n.type===`symlink`;){if(r.has(t))throw Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);r.add(t),t=fk(t,n.target),n=this.data.get(t)}if(!n)throw Error(`ENOENT: no such file or directory, scandir '${e}'`);if(n.type!==`directory`)throw Error(`ENOTDIR: not a directory, scandir '${e}'`);let i=t===`/`?`/`:`${t}/`,a=new Map;for(let[e,n]of this.data.entries())if(e!==t&&e.startsWith(i)){let t=e.slice(i.length),r=t.split(`/`)[0];r&&!t.includes(`/`,r.length)&&!a.has(r)&&a.set(r,{name:r,isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:n.type===`symlink`})}return Array.from(a.values()).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}async rm(e,t){ck(e,`rm`);let n=sk(e),r=this.data.get(n);if(!r){if(t?.force)return;throw Error(`ENOENT: no such file or directory, rm '${e}'`)}if(r.type===`directory`){let r=await this.readdir(n);if(r.length>0){if(!t?.recursive)throw Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let e of r){let r=dk(n,e);await this.rm(r,t)}}}this.data.delete(n)}async cp(e,t,n){ck(e,`cp`),ck(t,`cp`);let r=sk(e),i=sk(t),a=this.data.get(r);if(!a)throw Error(`ENOENT: no such file or directory, cp '${e}'`);if(a.type===`file`)if(this.ensureParentDirs(i),`content`in a){let e=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:e})}else this.data.set(i,{...a});else if(a.type===`symlink`)this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type===`directory`){if(!n?.recursive)throw Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(i,{recursive:!0});let t=await this.readdir(r);for(let e of t){let t=dk(r,e),a=dk(i,e);await this.cp(t,a,n)}}}async mv(e,t){await this.cp(e,t,{recursive:!0}),await this.rm(e,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(e,t){return uk(e,t)}async chmod(e,t){ck(e,`chmod`);let n=sk(e),r=this.data.get(n);if(!r)throw Error(`ENOENT: no such file or directory, chmod '${e}'`);r.mode=t}async symlink(e,t){ck(t,`symlink`);let n=sk(t);if(this.data.has(n))throw Error(`EEXIST: file already exists, symlink '${t}'`);this.ensureParentDirs(n),this.data.set(n,{type:`symlink`,target:e,mode:511,mtime:new Date})}async link(e,t){ck(e,`link`),ck(t,`link`);let n=sk(e),r=sk(t),i=this.data.get(n);if(!i)throw Error(`ENOENT: no such file or directory, link '${e}'`);if(i.type!==`file`)throw Error(`EPERM: operation not permitted, link '${e}'`);if(this.data.has(r))throw Error(`EEXIST: file already exists, link '${t}'`);let a=i;`lazy`in a&&(a=await this.materializeLazy(n,a)),this.ensureParentDirs(r),this.data.set(r,{type:`file`,content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(e){ck(e,`readlink`);let t=sk(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, readlink '${e}'`);if(n.type!==`symlink`)throw Error(`EINVAL: invalid argument, readlink '${e}'`);return n.target}async realpath(e){ck(e,`realpath`);let t=this.resolvePathWithSymlinks(e);if(!this.data.has(t))throw Error(`ENOENT: no such file or directory, realpath '${e}'`);return t}async utimes(e,t,n){ck(e,`utimes`);let r=sk(e),i=this.resolvePathWithSymlinks(r),a=this.data.get(i);if(!a)throw Error(`ENOENT: no such file or directory, utimes '${e}'`);a.mtime=n}};HS();function gk(e){let t=e;return typeof t.mkdirSync==`function`&&typeof t.writeFileSync==`function`}function _k(e,t){e.mkdirSync(`/bin`,{recursive:!0}),e.mkdirSync(`/usr/bin`,{recursive:!0}),t&&(e.mkdirSync(`/home/user`,{recursive:!0}),e.mkdirSync(`/tmp`,{recursive:!0}))}function vk(e){e.mkdirSync(`/dev`,{recursive:!0}),e.writeFileSync(`/dev/null`,``),e.writeFileSync(`/dev/zero`,new Uint8Array),e.writeFileSync(`/dev/stdin`,``),e.writeFileSync(`/dev/stdout`,``),e.writeFileSync(`/dev/stderr`,``)}function yk(e,t){e.mkdirSync(`/proc/self/fd`,{recursive:!0}),e.writeFileSync(`/proc/version`,`${VS}
865
+ `,0;r=a}let i=`${t.array}_${r}`,a=e.state.env.get(i);if(a!==void 0)return UO(e,a);if(r===0){let n=e.state.env.get(t.array);if(n!==void 0)return UO(e,n)}if(e.state.options.nounset&&!Array.from(e.state.env.keys()).some(e=>e===t.array||e.startsWith(`${t.array}_`)))throw new Fr(`${t.array}[${r}]`);return 0}return 0}case`ArithDoubleSubscript`:throw new Lr(`double subscript`,``,``);case`ArithNumberSubscript`:throw new Lr(`${t.number}${t.errorToken}: syntax error: invalid arithmetic operator (error token is "${t.errorToken}")`);case`ArithSyntaxError`:throw new Lr(t.message,``,``,!0);case`ArithSingleQuote`:if(n)throw new Lr(`syntax error: operand expected (error token is "'${t.content}'")`);return t.value;case`ArithBinary`:return t.operator===`||`?await Z(e,t.left,n)||await Z(e,t.right,n)?1:0:t.operator===`&&`?await Z(e,t.left,n)&&await Z(e,t.right,n)?1:0:RO(await Z(e,t.left,n),await Z(e,t.right,n),t.operator);case`ArithUnary`:{let r=await Z(e,t.operand,n);if(t.operator===`++`||t.operator===`--`){if(t.operand.type===`ArithVariable`){let n=t.operand.name,r=Number.parseInt(await JT(e,n),10)||0,i=t.operator===`++`?r+1:r-1;return e.state.env.set(n,String(i)),t.prefix?i:r}if(t.operand.type===`ArithArrayElement`){let i=t.operand.array,a=e.state.associativeArrays?.has(i),o;if(t.operand.stringKey!==void 0)o=`${i}_${t.operand.stringKey}`;else if(a&&t.operand.index?.type===`ArithVariable`&&!t.operand.index.hasDollarPrefix)o=`${i}_${t.operand.index.name}`;else if(a&&t.operand.index?.type===`ArithVariable`&&t.operand.index.hasDollarPrefix)o=`${i}_${await JT(e,t.operand.index.name)}`;else if(t.operand.index)o=`${i}_${await Z(e,t.operand.index,n)}`;else return r;let s=Number.parseInt(e.state.env.get(o)||`0`,10)||0,c=t.operator===`++`?s+1:s-1;return e.state.env.set(o,String(c)),t.prefix?c:s}if(t.operand.type===`ArithConcat`){let r=``;for(let i of t.operand.parts)r+=await KO(e,i,n);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let n=Number.parseInt(e.state.env.get(r)||`0`,10)||0,i=t.operator===`++`?n+1:n-1;return e.state.env.set(r,String(i)),t.prefix?i:n}}if(t.operand.type===`ArithDynamicElement`){let r=``;if(t.operand.nameExpr.type===`ArithConcat`)for(let i of t.operand.nameExpr.parts)r+=await KO(e,i,n);else t.operand.nameExpr.type===`ArithVariable`&&(r=t.operand.nameExpr.hasDollarPrefix?await JT(e,t.operand.nameExpr.name):t.operand.nameExpr.name);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){let i=await Z(e,t.operand.subscript,n),a=`${r}_${i}`,o=Number.parseInt(e.state.env.get(a)||`0`,10)||0,s=t.operator===`++`?o+1:o-1;return e.state.env.set(a,String(s)),t.prefix?s:o}}return r}return BO(r,t.operator)}case`ArithTernary`:return await Z(e,t.condition,n)?await Z(e,t.consequent,n):await Z(e,t.alternate,n);case`ArithAssignment`:{let r=t.variable,i=r;if(t.stringKey!==void 0)i=`${r}_${t.stringKey}`;else if(t.subscript){let a=e.state.associativeArrays?.has(r);if(a&&t.subscript.type===`ArithVariable`&&!t.subscript.hasDollarPrefix)i=`${r}_${t.subscript.name}`;else if(a&&t.subscript.type===`ArithVariable`&&t.subscript.hasDollarPrefix)i=`${r}_${await JT(e,t.subscript.name)||`\\`}`;else if(a)i=`${r}_${await Z(e,t.subscript,n)}`;else{let a=await Z(e,t.subscript,n);if(a<0){let t=J(e,r);t.length>0&&(a=Math.max(...t.map(([e])=>typeof e==`number`?e:0))+1+a)}i=`${r}_${a}`}}let a=zO(Number.parseInt(e.state.env.get(i)||`0`,10)||0,await Z(e,t.value,n),t.operator);return e.state.env.set(i,String(a)),a}case`ArithGroup`:return await Z(e,t.expression,n);case`ArithConcat`:{let r=``;for(let i of t.parts)r+=await KO(e,i,n);return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?await WO(e,r):Number.parseInt(r,10)||0}case`ArithDynamicAssignment`:{let r=``;if(t.target.type===`ArithConcat`)for(let i of t.target.parts)r+=await KO(e,i,n);else t.target.type===`ArithVariable`&&(r=t.target.hasDollarPrefix?await JT(e,t.target.name):t.target.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let i=r;if(t.subscript){let a=await Z(e,t.subscript,n);i=`${r}_${a}`}let a=zO(Number.parseInt(e.state.env.get(i)||`0`,10)||0,await Z(e,t.value,n),t.operator);return e.state.env.set(i,String(a)),a}case`ArithDynamicElement`:{let r=``;if(t.nameExpr.type===`ArithConcat`)for(let i of t.nameExpr.parts)r+=await KO(e,i,n);else t.nameExpr.type===`ArithVariable`&&(r=t.nameExpr.hasDollarPrefix?await JT(e,t.nameExpr.name):t.nameExpr.name);if(!r||!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r))return 0;let i=await Z(e,t.subscript,n),a=`${r}_${i}`,o=e.state.env.get(a);return o===void 0?0:HO(o)}default:return 0}}async function KO(e,t,n=!1){switch(t.type){case`ArithNumber`:return String(t.value);case`ArithSingleQuote`:return String(await Z(e,t,n));case`ArithVariable`:return t.hasDollarPrefix?await JT(e,t.name):t.name;case`ArithSpecialVar`:return await JT(e,t.name);case`ArithBracedExpansion`:return await GO(e,t.content);case`ArithCommandSubst`:return e.execFn?(await e.execFn(t.command,{signal:e.state.signal})).stdout.trim():`0`;case`ArithConcat`:{let r=``;for(let i of t.parts)r+=await KO(e,i,n);return r}default:return String(await Z(e,t,n))}}var qO=S(()=>{KC(),Qw(),A(),LO()});ur(),ir();var JO=[{name:`echo`,load:async()=>(await Promise.resolve().then(()=>(hr(),dr))).echoCommand},{name:`cat`,load:async()=>(await Promise.resolve().then(()=>(Or(),Sr))).catCommand},{name:`printf`,load:async()=>(await Promise.resolve().then(()=>(Ci(),oi))).printfCommand},{name:`ls`,load:async()=>(await Promise.resolve().then(()=>(Pi(),wi))).lsCommand},{name:`mkdir`,load:async()=>(await Promise.resolve().then(()=>(Hi(),Ri))).mkdirCommand},{name:`rmdir`,load:async()=>(await Promise.resolve().then(()=>(Zi(),Ui))).rmdirCommand},{name:`touch`,load:async()=>(await Promise.resolve().then(()=>(na(),Qi))).touchCommand},{name:`rm`,load:async()=>(await Promise.resolve().then(()=>(sa(),ra))).rmCommand},{name:`cp`,load:async()=>(await Promise.resolve().then(()=>(pa(),ca))).cpCommand},{name:`mv`,load:async()=>(await Promise.resolve().then(()=>(ya(),ma))).mvCommand},{name:`ln`,load:async()=>(await Promise.resolve().then(()=>(wa(),ba))).lnCommand},{name:`chmod`,load:async()=>(await Promise.resolve().then(()=>(ja(),Ta))).chmodCommand},{name:`pwd`,load:async()=>(await Promise.resolve().then(()=>(Fa(),Ma))).pwdCommand},{name:`readlink`,load:async()=>(await Promise.resolve().then(()=>(Ba(),Ia))).readlinkCommand},{name:`head`,load:async()=>(await Promise.resolve().then(()=>(Xa(),Ka))).headCommand},{name:`tail`,load:async()=>(await Promise.resolve().then(()=>(to(),Za))).tailCommand},{name:`wc`,load:async()=>(await Promise.resolve().then(()=>(lo(),no))).wcCommand},{name:`stat`,load:async()=>(await Promise.resolve().then(()=>(vo(),po))).statCommand},{name:`grep`,load:async()=>(await Promise.resolve().then(()=>(ac(),qs))).grepCommand},{name:`fgrep`,load:async()=>(await Promise.resolve().then(()=>(ac(),qs))).fgrepCommand},{name:`egrep`,load:async()=>(await Promise.resolve().then(()=>(ac(),qs))).egrepCommand},{name:`rg`,load:async()=>(await Promise.resolve().then(()=>(ll(),al))).rgCommand},{name:`sed`,load:async()=>(await Promise.resolve().then(()=>(Kl(),Vl))).sedCommand},{name:`awk`,load:async()=>(await Promise.resolve().then(()=>(Sf(),hf))).awkCommand2},{name:`sort`,load:async()=>(await Promise.resolve().then(()=>(Bf(),If))).sortCommand},{name:`uniq`,load:async()=>(await Promise.resolve().then(()=>(Kf(),Vf))).uniqCommand},{name:`comm`,load:async()=>(await Promise.resolve().then(()=>(Zf(),qf))).commCommand},{name:`cut`,load:async()=>(await Promise.resolve().then(()=>(ip(),Qf))).cutCommand},{name:`paste`,load:async()=>(await Promise.resolve().then(()=>(dp(),ap))).pasteCommand},{name:`tr`,load:async()=>(await Promise.resolve().then(()=>(yp(),fp))).trCommand},{name:`rev`,load:async()=>(await Promise.resolve().then(()=>(Tp(),bp))).rev},{name:`nl`,load:async()=>(await Promise.resolve().then(()=>(Np(),Ep))).nl},{name:`fold`,load:async()=>(await Promise.resolve().then(()=>(Vp(),Pp))).fold},{name:`expand`,load:async()=>(await Promise.resolve().then(()=>(Xp(),Hp))).expand},{name:`unexpand`,load:async()=>(await Promise.resolve().then(()=>(am(),Zp))).unexpand},{name:`strings`,load:async()=>(await Promise.resolve().then(()=>(pm(),om))).strings},{name:`split`,load:async()=>(await Promise.resolve().then(()=>(wm(),mm))).split},{name:`column`,load:async()=>(await Promise.resolve().then(()=>(Pm(),Tm))).column},{name:`join`,load:async()=>(await Promise.resolve().then(()=>(Um(),Fm))).join},{name:`tee`,load:async()=>(await Promise.resolve().then(()=>(Ym(),Wm))).teeCommand},{name:`find`,load:async()=>(await Promise.resolve().then(()=>(wh(),ph))).findCommand},{name:`basename`,load:async()=>(await Promise.resolve().then(()=>(kh(),Th))).basenameCommand},{name:`dirname`,load:async()=>(await Promise.resolve().then(()=>(Ph(),Ah))).dirnameCommand},{name:`tree`,load:async()=>(await Promise.resolve().then(()=>(Hh(),Fh))).treeCommand},{name:`du`,load:async()=>(await Promise.resolve().then(()=>(Zh(),Uh))).duCommand},{name:`env`,load:async()=>(await Promise.resolve().then(()=>(ag(),Qh))).envCommand},{name:`printenv`,load:async()=>(await Promise.resolve().then(()=>(ag(),Qh))).printenvCommand},{name:`alias`,load:async()=>(await Promise.resolve().then(()=>(pg(),og))).aliasCommand},{name:`unalias`,load:async()=>(await Promise.resolve().then(()=>(pg(),og))).unaliasCommand},{name:`history`,load:async()=>(await Promise.resolve().then(()=>(yg(),mg))).historyCommand},{name:`xargs`,load:async()=>(await Promise.resolve().then(()=>(wg(),bg))).xargsCommand},{name:`true`,load:async()=>(await Promise.resolve().then(()=>(Ag(),Tg))).trueCommand},{name:`false`,load:async()=>(await Promise.resolve().then(()=>(Ag(),Tg))).falseCommand},{name:`clear`,load:async()=>(await Promise.resolve().then(()=>(Fg(),jg))).clearCommand},{name:`bash`,load:async()=>(await Promise.resolve().then(()=>(Ug(),Ig))).bashCommand},{name:`sh`,load:async()=>(await Promise.resolve().then(()=>(Ug(),Ig))).shCommand},{name:`jq`,load:async()=>(await Promise.resolve().then(()=>(ov(),ev))).jqCommand},{name:`base64`,load:async()=>(await Promise.resolve().then(()=>(pv(),sv))).base64Command},{name:`diff`,load:async()=>(await Promise.resolve().then(()=>(yv(),mv))).diffCommand},{name:`date`,load:async()=>(await Promise.resolve().then(()=>(kv(),bv))).dateCommand},{name:`sleep`,load:async()=>(await Promise.resolve().then(()=>(Lv(),Mv))).sleepCommand},{name:`timeout`,load:async()=>(await Promise.resolve().then(()=>(Hv(),Rv))).timeoutCommand},{name:`time`,load:async()=>(await Promise.resolve().then(()=>(Xv(),Kv))).timeCommand},{name:`seq`,load:async()=>(await Promise.resolve().then(()=>(ey(),Zv))).seqCommand},{name:`expr`,load:async()=>(await Promise.resolve().then(()=>(ay(),ty))).exprCommand},{name:`md5sum`,load:async()=>(await Promise.resolve().then(()=>(my(),dy))).md5sumCommand},{name:`sha1sum`,load:async()=>(await Promise.resolve().then(()=>(vy(),hy))).sha1sumCommand},{name:`sha256sum`,load:async()=>(await Promise.resolve().then(()=>(Sy(),yy))).sha256sumCommand},{name:`file`,load:async()=>(await Promise.resolve().then(()=>(fx(),nx))).fileCommand},{name:`html-to-markdown`,load:async()=>(await Promise.resolve().then(()=>(_x(),px))).htmlToMarkdownCommand},{name:`help`,load:async()=>(await Promise.resolve().then(()=>(Cx(),vx))).helpCommand},{name:`which`,load:async()=>(await Promise.resolve().then(()=>(kx(),wx))).whichCommand},{name:`tac`,load:async()=>(await Promise.resolve().then(()=>(Px(),Ax))).tac},{name:`hostname`,load:async()=>(await Promise.resolve().then(()=>(zx(),Fx))).hostname},{name:`whoami`,load:async()=>(await Promise.resolve().then(()=>(Wx(),Bx))).whoami},{name:`od`,load:async()=>(await Promise.resolve().then(()=>(Yx(),Gx))).od},{name:`gzip`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).gzipCommand},{name:`gunzip`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).gunzipCommand},{name:`zcat`,load:async()=>(await Promise.resolve().then(()=>(yS(),Xx))).zcatCommand}],YO=[],XO=[],ZO=[{name:`curl`,load:async()=>(await Promise.resolve().then(()=>(GS(),RS))).curlCommand}],QO=new Map;function $O(e){return{name:e.name,async execute(t,n){let r=QO.get(e.name);return r||(r=await rr.runTrustedAsync(()=>e.load()),QO.set(e.name,r)),n.coverage,r.execute(t,n)}}}function ek(){return JO.map(e=>e.name)}function tk(){return ZO.map(e=>e.name)}function nk(e){return(e?JO.filter(t=>e.includes(t.name)):JO).map($O)}function rk(){return ZO.map($O)}function ik(){return YO.map($O)}function ak(){return XO.map($O)}function ok(e){return`load`in e&&typeof e.load==`function`}function sk(e,t){return{name:e,trusted:!0,execute:t}}function ck(e){let t=null;return{name:e.name,trusted:!0,async execute(n,r){return t||=await e.load(),t.execute(n,r)}}}TS();function lk(e){if(!e||e===`/`)return`/`;let t=e.endsWith(`/`)&&e!==`/`?e.slice(0,-1):e;t.startsWith(`/`)||(t=`/${t}`);let n=t.split(`/`).filter(e=>e&&e!==`.`),r=[];for(let e of n)e===`..`?r.pop():r.push(e);return`/${r.join(`/`)}`||`/`}function uk(e,t){if(e.includes(`\0`))throw Error(`ENOENT: path contains null byte, ${t} '${e}'`)}function dk(e){let t=lk(e);if(t===`/`)return`/`;let n=t.lastIndexOf(`/`);return n===0?`/`:t.slice(0,n)}function fk(e,t){return t.startsWith(`/`)?lk(t):lk(e===`/`?`/${t}`:`${e}/${t}`)}function pk(e,t){return e===`/`?`/${t}`:`${e}/${t}`}function mk(e,t){return t.startsWith(`/`)?lk(t):lk(pk(dk(e),t))}var hk=new TextEncoder;function gk(e){return typeof e==`object`&&!!e&&!(e instanceof Uint8Array)&&`content`in e}var _k=class{data=new Map;constructor(e){if(this.data.set(`/`,{type:`directory`,mode:493,mtime:new Date}),e)for(let[t,n]of Object.entries(e))typeof n==`function`?this.writeFileLazy(t,n):gk(n)?this.writeFileSync(t,n.content,void 0,{mode:n.mode,mtime:n.mtime}):this.writeFileSync(t,n)}ensureParentDirs(e){let t=dk(e);t!==`/`&&(this.data.has(t)||(this.ensureParentDirs(t),this.data.set(t,{type:`directory`,mode:493,mtime:new Date})))}writeFileSync(e,t,n,r){uk(e,`write`);let i=lk(e);this.ensureParentDirs(i);let a=bS(t,SS(n));this.data.set(i,{type:`file`,content:a,mode:r?.mode??420,mtime:r?.mtime??new Date})}writeFileLazy(e,t,n){uk(e,`write`);let r=lk(e);this.ensureParentDirs(r),this.data.set(r,{type:`file`,lazy:t,mode:n?.mode??420,mtime:n?.mtime??new Date})}async materializeLazy(e,t){let n=await t.lazy(),r={type:`file`,content:typeof n==`string`?hk.encode(n):n,mode:t.mode,mtime:t.mtime};return this.data.set(e,r),r}async readFile(e,t){return xS(await this.readFileBuffer(e),SS(t))}async readFileBuffer(e){uk(e,`open`);let t=this.resolvePathWithSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, open '${e}'`);if(n.type!==`file`)throw Error(`EISDIR: illegal operation on a directory, read '${e}'`);if(`lazy`in n){let e=await this.materializeLazy(t,n);return e.content instanceof Uint8Array?e.content:hk.encode(e.content)}return n.content instanceof Uint8Array?n.content:hk.encode(n.content)}async writeFile(e,t,n){this.writeFileSync(e,t,n)}async appendFile(e,t,n){uk(e,`append`);let r=lk(e),i=this.data.get(r);if(i&&i.type===`directory`)throw Error(`EISDIR: illegal operation on a directory, write '${e}'`);let a=bS(t,SS(n));if(i?.type===`file`){let e=i;`lazy`in e&&(e=await this.materializeLazy(r,e));let t=`content`in e&&e.content instanceof Uint8Array?e.content:hk.encode(`content`in e?e.content:``),n=new Uint8Array(t.length+a.length);n.set(t),n.set(a,t.length),this.data.set(r,{type:`file`,content:n,mode:e.mode,mtime:new Date})}else this.writeFileSync(e,t,n)}async exists(e){if(e.includes(`\0`))return!1;try{let t=this.resolvePathWithSymlinks(e);return this.data.has(t)}catch{return!1}}async stat(e){uk(e,`stat`);let t=this.resolvePathWithSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, stat '${e}'`);n.type===`file`&&`lazy`in n&&(n=await this.materializeLazy(t,n));let r=0;return n.type===`file`&&`content`in n&&n.content&&(r=n.content instanceof Uint8Array?n.content.length:hk.encode(n.content).length),{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}async lstat(e){uk(e,`lstat`);let t=this.resolveIntermediateSymlinks(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, lstat '${e}'`);if(n.type===`symlink`)return{isFile:!1,isDirectory:!1,isSymbolicLink:!0,mode:n.mode,size:n.target.length,mtime:n.mtime||new Date};n.type===`file`&&`lazy`in n&&(n=await this.materializeLazy(t,n));let r=0;return n.type===`file`&&`content`in n&&n.content&&(r=n.content instanceof Uint8Array?n.content.length:hk.encode(n.content).length),{isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:!1,mode:n.mode,size:r,mtime:n.mtime||new Date}}resolveIntermediateSymlinks(e){let t=lk(e);if(t===`/`)return`/`;let n=t.slice(1).split(`/`);if(n.length<=1)return t;let r=``,i=new Set;for(let t=0;t<n.length-1;t++){let a=n[t];r=`${r}/${a}`;let o=this.data.get(r),s=0;for(;o&&o.type===`symlink`&&s<40;){if(i.has(r))throw Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`);i.add(r),r=mk(r,o.target),o=this.data.get(r),s++}if(s>=40)throw Error(`ELOOP: too many levels of symbolic links, lstat '${e}'`)}return`${r}/${n[n.length-1]}`}resolvePathWithSymlinks(e){let t=lk(e);if(t===`/`)return`/`;let n=t.slice(1).split(`/`),r=``,i=new Set;for(let t of n){r=`${r}/${t}`;let n=this.data.get(r),a=0;for(;n&&n.type===`symlink`&&a<40;){if(i.has(r))throw Error(`ELOOP: too many levels of symbolic links, open '${e}'`);i.add(r),r=mk(r,n.target),n=this.data.get(r),a++}if(a>=40)throw Error(`ELOOP: too many levels of symbolic links, open '${e}'`)}return r}async mkdir(e,t){this.mkdirSync(e,t)}mkdirSync(e,t){uk(e,`mkdir`);let n=lk(e);if(this.data.has(n)){if(this.data.get(n)?.type===`file`)throw Error(`EEXIST: file already exists, mkdir '${e}'`);if(!t?.recursive)throw Error(`EEXIST: directory already exists, mkdir '${e}'`);return}let r=dk(n);if(r!==`/`&&!this.data.has(r))if(t?.recursive)this.mkdirSync(r,{recursive:!0});else throw Error(`ENOENT: no such file or directory, mkdir '${e}'`);this.data.set(n,{type:`directory`,mode:493,mtime:new Date})}async readdir(e){return(await this.readdirWithFileTypes(e)).map(e=>e.name)}async readdirWithFileTypes(e){uk(e,`scandir`);let t=lk(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, scandir '${e}'`);let r=new Set;for(;n&&n.type===`symlink`;){if(r.has(t))throw Error(`ELOOP: too many levels of symbolic links, scandir '${e}'`);r.add(t),t=mk(t,n.target),n=this.data.get(t)}if(!n)throw Error(`ENOENT: no such file or directory, scandir '${e}'`);if(n.type!==`directory`)throw Error(`ENOTDIR: not a directory, scandir '${e}'`);let i=t===`/`?`/`:`${t}/`,a=new Map;for(let[e,n]of this.data.entries())if(e!==t&&e.startsWith(i)){let t=e.slice(i.length),r=t.split(`/`)[0];r&&!t.includes(`/`,r.length)&&!a.has(r)&&a.set(r,{name:r,isFile:n.type===`file`,isDirectory:n.type===`directory`,isSymbolicLink:n.type===`symlink`})}return Array.from(a.values()).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name))}async rm(e,t){uk(e,`rm`);let n=lk(e),r=this.data.get(n);if(!r){if(t?.force)return;throw Error(`ENOENT: no such file or directory, rm '${e}'`)}if(r.type===`directory`){let r=await this.readdir(n);if(r.length>0){if(!t?.recursive)throw Error(`ENOTEMPTY: directory not empty, rm '${e}'`);for(let e of r){let r=pk(n,e);await this.rm(r,t)}}}this.data.delete(n)}async cp(e,t,n){uk(e,`cp`),uk(t,`cp`);let r=lk(e),i=lk(t),a=this.data.get(r);if(!a)throw Error(`ENOENT: no such file or directory, cp '${e}'`);if(a.type===`file`)if(this.ensureParentDirs(i),`content`in a){let e=a.content instanceof Uint8Array?new Uint8Array(a.content):a.content;this.data.set(i,{...a,content:e})}else this.data.set(i,{...a});else if(a.type===`symlink`)this.ensureParentDirs(i),this.data.set(i,{...a});else if(a.type===`directory`){if(!n?.recursive)throw Error(`EISDIR: is a directory, cp '${e}'`);await this.mkdir(i,{recursive:!0});let t=await this.readdir(r);for(let e of t){let t=pk(r,e),a=pk(i,e);await this.cp(t,a,n)}}}async mv(e,t){await this.cp(e,t,{recursive:!0}),await this.rm(e,{recursive:!0})}getAllPaths(){return Array.from(this.data.keys())}resolvePath(e,t){return fk(e,t)}async chmod(e,t){uk(e,`chmod`);let n=lk(e),r=this.data.get(n);if(!r)throw Error(`ENOENT: no such file or directory, chmod '${e}'`);r.mode=t}async symlink(e,t){uk(t,`symlink`);let n=lk(t);if(this.data.has(n))throw Error(`EEXIST: file already exists, symlink '${t}'`);this.ensureParentDirs(n),this.data.set(n,{type:`symlink`,target:e,mode:511,mtime:new Date})}async link(e,t){uk(e,`link`),uk(t,`link`);let n=lk(e),r=lk(t),i=this.data.get(n);if(!i)throw Error(`ENOENT: no such file or directory, link '${e}'`);if(i.type!==`file`)throw Error(`EPERM: operation not permitted, link '${e}'`);if(this.data.has(r))throw Error(`EEXIST: file already exists, link '${t}'`);let a=i;`lazy`in a&&(a=await this.materializeLazy(n,a)),this.ensureParentDirs(r),this.data.set(r,{type:`file`,content:a.content,mode:a.mode,mtime:a.mtime})}async readlink(e){uk(e,`readlink`);let t=lk(e),n=this.data.get(t);if(!n)throw Error(`ENOENT: no such file or directory, readlink '${e}'`);if(n.type!==`symlink`)throw Error(`EINVAL: invalid argument, readlink '${e}'`);return n.target}async realpath(e){uk(e,`realpath`);let t=this.resolvePathWithSymlinks(e);if(!this.data.has(t))throw Error(`ENOENT: no such file or directory, realpath '${e}'`);return t}async utimes(e,t,n){uk(e,`utimes`);let r=lk(e),i=this.resolvePathWithSymlinks(r),a=this.data.get(i);if(!a)throw Error(`ENOENT: no such file or directory, utimes '${e}'`);a.mtime=n}};YS();function vk(e){let t=e;return typeof t.mkdirSync==`function`&&typeof t.writeFileSync==`function`}function yk(e,t){e.mkdirSync(`/bin`,{recursive:!0}),e.mkdirSync(`/usr/bin`,{recursive:!0}),t&&(e.mkdirSync(`/home/user`,{recursive:!0}),e.mkdirSync(`/tmp`,{recursive:!0}))}function bk(e){e.mkdirSync(`/dev`,{recursive:!0}),e.writeFileSync(`/dev/null`,``),e.writeFileSync(`/dev/zero`,new Uint8Array),e.writeFileSync(`/dev/stdin`,``),e.writeFileSync(`/dev/stdout`,``),e.writeFileSync(`/dev/stderr`,``)}function xk(e,t){e.mkdirSync(`/proc/self/fd`,{recursive:!0}),e.writeFileSync(`/proc/version`,`${JS}
866
866
  `),e.writeFileSync(`/proc/self/exe`,`/bin/bash`),e.writeFileSync(`/proc/self/cmdline`,`bash\0`),e.writeFileSync(`/proc/self/comm`,`bash
867
- `),e.writeFileLazy?e.writeFileLazy(`/proc/self/status`,()=>zS(t)):e.writeFileSync(`/proc/self/status`,zS(t)),e.writeFileSync(`/proc/self/fd/0`,`/dev/stdin`),e.writeFileSync(`/proc/self/fd/1`,`/dev/stdout`),e.writeFileSync(`/proc/self/fd/2`,`/dev/stderr`)}function bk(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){gk(e)&&(_k(e,t),vk(e),yk(e,n))}Li(),Zl(),A();var xk=[`allexport`,`errexit`,`noglob`,`noclobber`,`noexec`,`nounset`,`pipefail`,`posix`,`verbose`,`xtrace`],Sk=[`braceexpand`,`hashall`,`interactive-comments`];function Ck(e){let t=[],n=[...Sk.map(e=>({name:e,enabled:!0})),...xk.map(t=>({name:t,enabled:e[t]}))].sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)e.enabled&&t.push(e.name);return t.join(`:`)}function wk(e){e.state.env.set(`SHELLOPTS`,Ck(e.state.options))}var Tk=[`dotglob`,`expand_aliases`,`extglob`,`failglob`,`globskipdots`,`globstar`,`lastpipe`,`nocaseglob`,`nocasematch`,`nullglob`,`xpg_echo`];function Ek(e){let t=[];for(let n of Tk)e[n]&&t.push(n);return t.join(`:`)}function Dk(e){e.state.env.set(`BASHOPTS`,Ek(e.state.shoptOptions))}Zl(),cC(),ir(),Gw(),cC();var Ok=`BASH_ALIAS_`;function kk(e){return e.parts.length===1?e.parts[0].type===`Literal`:!1}function Ak(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type===`Literal`?t.value:null}function jk(e,t){return e.env.get(`${Ok}${t}`)}function Mk(e,t,n){if(!t.name||!kk(t.name))return t;let r=Ak(t.name);if(!r)return t;let i=jk(e,r);if(!i||n.has(r))return t;try{n.add(r);let a=new Ww,o=i,s=i.endsWith(` `);if(!s)for(let e of t.args){let t=Pk(e);o+=` ${t}`}let c;try{c=a.parse(o)}catch(e){if(e instanceof sC)throw e;return t}if(c.statements.length!==1||c.statements[0].pipelines.length!==1||c.statements[0].pipelines[0].commands.length!==1)return Nk(t,i);let l=c.statements[0].pipelines[0].commands[0];if(l.type!==`SimpleCommand`)return Nk(t,i);let u={...l,assignments:[...t.assignments,...l.assignments],redirections:[...l.redirections,...t.redirections],line:t.line};if(s&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let t=u.args[0];if(kk(t)){let r=Ak(t);if(r&&jk(e,r)){let r={type:`SimpleCommand`,name:t,args:u.args.slice(1),assignments:[],redirections:[]},i=Mk(e,r,n);i!==r&&(u={...u,name:i.name,args:[...i.args]})}}}return u}catch(e){throw n.delete(r),e}}function Nk(e,t){let n=t;for(let t of e.args){let e=Pk(t);n+=` ${e}`}let r=new Ww;return{type:`SimpleCommand`,name:r.parseWordFromString(`eval`,!1,!1),args:[r.parseWordFromString(`'${n.replace(/'/g,`'\\''`)}'`,!1,!1)],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Pk(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,`\\$1`);break;case`SingleQuoted`:t+=`'${n.value}'`;break;case`DoubleQuoted`:t+=`"${n.parts.map(e=>e.type===`Literal`?e.value:`$${e.type}`).join(``)}"`;break;case`ParameterExpansion`:t+=`\${${n.parameter}}`;break;case`CommandSubstitution`:t+=`$(...)`;break;case`ArithmeticExpansion`:t+=`$((${n.expression}))`;break;case`Glob`:t+=n.pattern;break;default:break}return t}BO(),AO(),mT();async function Fk(e,t){let n=t.parts.map(e=>e.type===`Literal`?e.value:`\0`).join(``),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(`)`))return null;let i=r[1],a=[],o=!1,s=``,c=!1;for(let n of t.parts)if(n.type===`Literal`){let e=n.value;if(!o){let t=e.indexOf(`=(`);t!==-1&&(o=!0,e=e.slice(t+2))}if(o){e.endsWith(`)`)&&(e=e.slice(0,-1));let t=e.split(/(\s+)/);for(let e of t)/^\s+$/.test(e)?(s||c)&&(a.push(s),s=``,c=!1):e&&(s+=e)}}else if(o)if(n.type===`BraceExpansion`)if(/^\[.+\]=/.test(s))s+=pT({type:`Word`,parts:[n]});else{(s||c)&&(a.push(s),s=``,c=!1);let t=await SO(e,{type:`Word`,parts:[n]});a.push(...t.values)}else{(n.type===`SingleQuoted`||n.type===`DoubleQuoted`||n.type===`Escaped`)&&(c=!0);let t=await X(e,{type:`Word`,parts:[n]});s+=t}return(s||c)&&a.push(s),`${i}=(${a.map(e=>/^\[.+\]=/.test(e)?e:e===``?`''`:/[\s"'\\$`!*?[\]{}|&;<>()]/.test(e)&&!e.startsWith(`'`)&&!e.startsWith(`"`)?`'${e.replace(/'/g,`'\\''`)}'`:e).join(` `)})`}async function Ik(e,t){let n=-1,r=-1,i=!1;for(let e=0;e<t.parts.length;e++){let a=t.parts[e];if(a.type===`Literal`){let t=a.value.indexOf(`+=`);if(t!==-1){let o=a.value.slice(0,t);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){n=e,r=t,i=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(o)){n=e,r=t,i=!0;break}}let o=a.value.indexOf(`=`);if(o!==-1&&(o===0||a.value[o-1]!==`+`)){let t=a.value.slice(0,o);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(t)){n=e,r=o;break}}}}if(n===-1)return null;let a=t.parts.slice(0,n),o=t.parts[n];if(o.type!==`Literal`)return null;let s=i?2:1,c=o.value.slice(0,r),l=o.value.slice(r+s),u=t.parts.slice(n+1),d=``;for(let t of a)d+=await X(e,{type:`Word`,parts:[t]});d+=c;let f={type:`Word`,parts:l===``?u:[{type:`Literal`,value:l},...u]},p=f.parts.length>0?await X(e,f):``;return`${d}${i?`+=`:`=`}${p}`}var Lk=[`tar`,`yq`,`xan`,`sqlite3`,`python3`,`python`];function Rk(e){return Lk.includes(e)}Li(),pl(),ir(),A(),A();var zk=Object.freeze({stdout:``,stderr:``,exitCode:0});function Bk(e=``){return{stdout:e,stderr:``,exitCode:0}}function Q(e,t=1){return{stdout:``,stderr:e,exitCode:t}}function $(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function Vk(e){return{stdout:``,stderr:``,exitCode:+!e}}function Hk(e,t,n=``,r=``){throw new k(e,t,n,r)}function Uk(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new k(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,`file_descriptors`)}function Wk(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Hr;return zk}if(t.length>1)throw new Ir(1,``,`bash: break: too many arguments
867
+ `),e.writeFileLazy?e.writeFileLazy(`/proc/self/status`,()=>KS(t)):e.writeFileSync(`/proc/self/status`,KS(t)),e.writeFileSync(`/proc/self/fd/0`,`/dev/stdin`),e.writeFileSync(`/proc/self/fd/1`,`/dev/stdout`),e.writeFileSync(`/proc/self/fd/2`,`/dev/stderr`)}function Sk(e,t,n={pid:1,ppid:0,uid:1e3,gid:1e3}){vk(e)&&(yk(e,t),bk(e),xk(e,n))}Li(),Xl(),A();var Ck=[`allexport`,`errexit`,`noglob`,`noclobber`,`noexec`,`nounset`,`pipefail`,`posix`,`verbose`,`xtrace`],wk=[`braceexpand`,`hashall`,`interactive-comments`];function Tk(e){let t=[],n=[...wk.map(e=>({name:e,enabled:!0})),...Ck.map(t=>({name:t,enabled:e[t]}))].sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)e.enabled&&t.push(e.name);return t.join(`:`)}function Ek(e){e.state.env.set(`SHELLOPTS`,Tk(e.state.options))}var Dk=[`dotglob`,`expand_aliases`,`extglob`,`failglob`,`globskipdots`,`globstar`,`lastpipe`,`nocaseglob`,`nocasematch`,`nullglob`,`xpg_echo`];function Ok(e){let t=[];for(let n of Dk)e[n]&&t.push(n);return t.join(`:`)}function kk(e){e.state.env.set(`BASHOPTS`,Ok(e.state.shoptOptions))}Xl(),hC(),ir(),Qw(),hC();var Ak=`BASH_ALIAS_`;function jk(e){return e.parts.length===1?e.parts[0].type===`Literal`:!1}function Mk(e){if(e.parts.length!==1)return null;let t=e.parts[0];return t.type===`Literal`?t.value:null}function Nk(e,t){return e.env.get(`${Ak}${t}`)}function Pk(e,t,n){if(!t.name||!jk(t.name))return t;let r=Mk(t.name);if(!r)return t;let i=Nk(e,r);if(!i||n.has(r))return t;try{n.add(r);let a=new Zw,o=i,s=i.endsWith(` `);if(!s)for(let e of t.args){let t=Ik(e);o+=` ${t}`}let c;try{c=a.parse(o)}catch(e){if(e instanceof mC)throw e;return t}if(c.statements.length!==1||c.statements[0].pipelines.length!==1||c.statements[0].pipelines[0].commands.length!==1)return Fk(t,i);let l=c.statements[0].pipelines[0].commands[0];if(l.type!==`SimpleCommand`)return Fk(t,i);let u={...l,assignments:[...t.assignments,...l.assignments],redirections:[...l.redirections,...t.redirections],line:t.line};if(s&&t.args.length>0&&(u={...u,args:[...u.args,...t.args]},u.args.length>0)){let t=u.args[0];if(jk(t)){let r=Mk(t);if(r&&Nk(e,r)){let r={type:`SimpleCommand`,name:t,args:u.args.slice(1),assignments:[],redirections:[]},i=Pk(e,r,n);i!==r&&(u={...u,name:i.name,args:[...i.args]})}}}return u}catch(e){throw n.delete(r),e}}function Fk(e,t){let n=t;for(let t of e.args){let e=Ik(t);n+=` ${e}`}let r=new Zw;return{type:`SimpleCommand`,name:r.parseWordFromString(`eval`,!1,!1),args:[r.parseWordFromString(`'${n.replace(/'/g,`'\\''`)}'`,!1,!1)],assignments:e.assignments,redirections:e.redirections,line:e.line}}function Ik(e){let t=``;for(let n of e.parts)switch(n.type){case`Literal`:t+=n.value.replace(/([\s"'$`\\*?[\]{}()<>|&;#!])/g,`\\$1`);break;case`SingleQuoted`:t+=`'${n.value}'`;break;case`DoubleQuoted`:t+=`"${n.parts.map(e=>e.type===`Literal`?e.value:`$${e.type}`).join(``)}"`;break;case`ParameterExpansion`:t+=`\${${n.parameter}}`;break;case`CommandSubstitution`:t+=`$(...)`;break;case`ArithmeticExpansion`:t+=`$((${n.expression}))`;break;case`Glob`:t+=n.pattern;break;default:break}return t}qO(),LO(),xT();async function Lk(e,t){let n=t.parts.map(e=>e.type===`Literal`?e.value:`\0`).join(``),r=n.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);if(!r||!n.endsWith(`)`))return null;let i=r[1],a=[],o=!1,s=``,c=!1;for(let n of t.parts)if(n.type===`Literal`){let e=n.value;if(!o){let t=e.indexOf(`=(`);t!==-1&&(o=!0,e=e.slice(t+2))}if(o){e.endsWith(`)`)&&(e=e.slice(0,-1));let t=e.split(/(\s+)/);for(let e of t)/^\s+$/.test(e)?(s||c)&&(a.push(s),s=``,c=!1):e&&(s+=e)}}else if(o)if(n.type===`BraceExpansion`)if(/^\[.+\]=/.test(s))s+=bT({type:`Word`,parts:[n]});else{(s||c)&&(a.push(s),s=``,c=!1);let t=await kO(e,{type:`Word`,parts:[n]});a.push(...t.values)}else{(n.type===`SingleQuoted`||n.type===`DoubleQuoted`||n.type===`Escaped`)&&(c=!0);let t=await X(e,{type:`Word`,parts:[n]});s+=t}return(s||c)&&a.push(s),`${i}=(${a.map(e=>/^\[.+\]=/.test(e)?e:e===``?`''`:/[\s"'\\$`!*?[\]{}|&;<>()]/.test(e)&&!e.startsWith(`'`)&&!e.startsWith(`"`)?`'${e.replace(/'/g,`'\\''`)}'`:e).join(` `)})`}async function Rk(e,t){let n=-1,r=-1,i=!1;for(let e=0;e<t.parts.length;e++){let a=t.parts[e];if(a.type===`Literal`){let t=a.value.indexOf(`+=`);if(t!==-1){let o=a.value.slice(0,t);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){n=e,r=t,i=!0;break}if(/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(o)){n=e,r=t,i=!0;break}}let o=a.value.indexOf(`=`);if(o!==-1&&(o===0||a.value[o-1]!==`+`)){let t=a.value.slice(0,o);if(/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)||/^[a-zA-Z_][a-zA-Z0-9_]*\[[^\]]+\]$/.test(t)){n=e,r=o;break}}}}if(n===-1)return null;let a=t.parts.slice(0,n),o=t.parts[n];if(o.type!==`Literal`)return null;let s=i?2:1,c=o.value.slice(0,r),l=o.value.slice(r+s),u=t.parts.slice(n+1),d=``;for(let t of a)d+=await X(e,{type:`Word`,parts:[t]});d+=c;let f={type:`Word`,parts:l===``?u:[{type:`Literal`,value:l},...u]},p=f.parts.length>0?await X(e,f):``;return`${d}${i?`+=`:`=`}${p}`}var zk=[`tar`,`yq`,`xan`,`sqlite3`,`python3`,`python`];function Bk(e){return zk.includes(e)}Li(),fl(),ir(),A(),A();var Vk=Object.freeze({stdout:``,stderr:``,exitCode:0});function Hk(e=``){return{stdout:e,stderr:``,exitCode:0}}function Q(e,t=1){return{stdout:``,stderr:e,exitCode:t}}function $(e,t,n){return{stdout:e,stderr:t,exitCode:n}}function Uk(e){return{stdout:``,stderr:``,exitCode:+!e}}function Wk(e,t,n=``,r=``){throw new k(e,t,n,r)}function Gk(e){let t=e.state.fileDescriptors;if(t&&t.size>=e.limits.maxFileDescriptors)throw new k(`too many open file descriptors (max ${e.limits.maxFileDescriptors})`,`file_descriptors`)}function Kk(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Hr;return Vk}if(t.length>1)throw new Ir(1,``,`bash: break: too many arguments
868
868
  `);let n=1;if(t.length>0){let e=Number.parseInt(t[0],10);if(Number.isNaN(e)||e<1)throw new Ir(128,``,`bash: break: ${t[0]}: numeric argument required
869
- `);n=e}throw new jr(n)}async function Gk(e,t){let n,r=!1,i=!1,a=0;for(;a<t.length;)if(t[a]===`--`){a++;break}else if(t[a]===`-L`)i=!1,a++;else if(t[a]===`-P`)i=!0,a++;else if(t[a].startsWith(`-`)&&t[a]!==`-`)a++;else break;let o=t.slice(a);if(o.length===0||o[0]===`~`?n=e.state.env.get(`HOME`)||`/`:o[0]===`-`?(n=e.state.previousDir,r=!0):n=o[0],!n.startsWith(`/`)&&!n.startsWith(`./`)&&!n.startsWith(`../`)&&n!==`.`&&n!==`..`){let t=e.state.env.get(`CDPATH`);if(t){let i=t.split(`:`).filter(e=>e);for(let t of i){let i=t.startsWith(`/`)?`${t}/${n}`:`${e.state.cwd}/${t}/${n}`;try{if((await e.fs.stat(i)).isDirectory){n=i,r=!0;break}}catch{}}}}let s=(n.startsWith(`/`)?n:`${e.state.cwd}/${n}`).split(`/`).filter(e=>e&&e!==`.`),c=``;for(let t of s)if(t===`..`)c=c.split(`/`).slice(0,-1).join(`/`)||`/`;else{c=c?`${c}/${t}`:`/${t}`;try{if(!(await e.fs.stat(c)).isDirectory)return Q(`bash: cd: ${n}: Not a directory
869
+ `);n=e}throw new jr(n)}async function qk(e,t){let n,r=!1,i=!1,a=0;for(;a<t.length;)if(t[a]===`--`){a++;break}else if(t[a]===`-L`)i=!1,a++;else if(t[a]===`-P`)i=!0,a++;else if(t[a].startsWith(`-`)&&t[a]!==`-`)a++;else break;let o=t.slice(a);if(o.length===0||o[0]===`~`?n=e.state.env.get(`HOME`)||`/`:o[0]===`-`?(n=e.state.previousDir,r=!0):n=o[0],!n.startsWith(`/`)&&!n.startsWith(`./`)&&!n.startsWith(`../`)&&n!==`.`&&n!==`..`){let t=e.state.env.get(`CDPATH`);if(t){let i=t.split(`:`).filter(e=>e);for(let t of i){let i=t.startsWith(`/`)?`${t}/${n}`:`${e.state.cwd}/${t}/${n}`;try{if((await e.fs.stat(i)).isDirectory){n=i,r=!0;break}}catch{}}}}let s=(n.startsWith(`/`)?n:`${e.state.cwd}/${n}`).split(`/`).filter(e=>e&&e!==`.`),c=``;for(let t of s)if(t===`..`)c=c.split(`/`).slice(0,-1).join(`/`)||`/`;else{c=c?`${c}/${t}`:`/${t}`;try{if(!(await e.fs.stat(c)).isDirectory)return Q(`bash: cd: ${n}: Not a directory
870
870
  `)}catch{return Q(`bash: cd: ${n}: No such file or directory
871
- `)}}let l=c||`/`;if(i)try{l=await e.fs.realpath(l)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=l,e.state.env.set(`PWD`,e.state.cwd),e.state.env.set(`OLDPWD`,e.state.previousDir),Bk(r?`${l}
872
- `:``)}Gw(),zC(),Gw(),Ss(),BO(),AO(),mT();function Kk(e,t){return e.fs.resolvePath(e.state.cwd,t)}var qk=[`-e`,`-a`,`-f`,`-d`,`-r`,`-w`,`-x`,`-s`,`-L`,`-h`,`-k`,`-g`,`-u`,`-G`,`-O`,`-b`,`-c`,`-p`,`-S`,`-t`,`-N`];function Jk(e){return qk.includes(e)}async function Yk(e,t,n){let r=Kk(e,n);switch(t){case`-e`:case`-a`:return e.fs.exists(r);case`-f`:return await e.fs.exists(r)?(await e.fs.stat(r)).isFile:!1;case`-d`:return await e.fs.exists(r)?(await e.fs.stat(r)).isDirectory:!1;case`-r`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&256)!=0:!1;case`-w`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&128)!=0:!1;case`-x`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&64)!=0:!1;case`-s`:return await e.fs.exists(r)?(await e.fs.stat(r)).size>0:!1;case`-L`:case`-h`:try{return(await e.fs.lstat(r)).isSymbolicLink}catch{return!1}case`-k`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&512)!=0:!1;case`-g`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&1024)!=0:!1;case`-u`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&2048)!=0:!1;case`-G`:case`-O`:return e.fs.exists(r);case`-b`:return!1;case`-c`:return[`/dev/null`,`/dev/zero`,`/dev/random`,`/dev/urandom`,`/dev/tty`,`/dev/stdin`,`/dev/stdout`,`/dev/stderr`].includes(r);case`-p`:return!1;case`-S`:return!1;case`-t`:return!1;case`-N`:return e.fs.exists(r);default:return!1}}var Xk=[`-nt`,`-ot`,`-ef`];function Zk(e){return Xk.includes(e)}async function Qk(e,t,n,r){let i=Kk(e,n),a=Kk(e,r);switch(t){case`-nt`:try{let t=await e.fs.stat(i),n=await e.fs.stat(a);return t.mtime>n.mtime}catch{return!1}case`-ot`:try{let t=await e.fs.stat(i),n=await e.fs.stat(a);return t.mtime<n.mtime}catch{return!1}case`-ef`:try{return!await e.fs.exists(i)||!await e.fs.exists(a)?!1:e.fs.resolvePath(e.state.cwd,i)===e.fs.resolvePath(e.state.cwd,a)}catch{return!1}default:return!1}}var $k=new Set([`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`]);function eA(e){return $k.has(e)}function tA(e,t,n){switch(e){case`-eq`:return t===n;case`-ne`:return t!==n;case`-lt`:return t<n;case`-le`:return t<=n;case`-gt`:return t>n;case`-ge`:return t>=n}}function nA(e){return e===`=`||e===`==`||e===`!=`}function rA(e,t,n,r=!1,i=!1,a=!1){if(r){let r=hA(t,n,i,a);return e===`!=`?!r:r}if(i){let r=t.toLowerCase()===n.toLowerCase();return e===`!=`?!r:r}let o=t===n;return e===`!=`?!o:o}var iA=new Set([`-z`,`-n`]);function aA(e){return iA.has(e)}function oA(e,t){switch(e){case`-z`:return t===``;case`-n`:return t!==``}}zC(),Gw(),BO(),mT();async function sA(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(e.state.associativeArrays?.has(t)){let n=r;return(n.startsWith(`'`)&&n.endsWith(`'`)||n.startsWith(`"`)&&n.endsWith(`"`))&&(n=n.slice(1,-1)),n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,n)=>e.state.env.get(n)||``),e.state.env.has(`${t}_${n}`)}let i;try{i=await Z(e,vC(new Ww,r).expression)}catch{if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0}}if(i<0){let n=sT(e,t),r=e.state.currentLine;if(n.length===0||(i=Math.max(...n)+1+i,i<0))return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
873
- `,!1}return e.state.env.has(`${t}_${i}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?lT(e,t).length>0:sT(e,t).length>0}async function cA(e,t){switch(t.type){case`CondBinary`:{let n=await X(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(e=>e.type===`SingleQuoted`||e.type===`DoubleQuoted`||e.type===`Escaped`&&t.operator!==`=~`),i;if(i=t.operator===`=~`?r?rE(await X(e,t.right)):await hO(e,t.right):nA(t.operator)&&!r?await gO(e,t.right):await X(e,t.right),nA(t.operator)){let a=e.state.shoptOptions.nocasematch;return rA(t.operator,n,i,!r,a,!0)}if(eA(t.operator))return tA(t.operator,await xA(e,n),await xA(e,i));if(Zk(t.operator))return Qk(e,t.operator,n,i);switch(t.operator){case`=~`:try{let t=e.state.shoptOptions.nocasematch,r=R(TA(i),t?`i`:``).match(n);if(cT(e,`BASH_REMATCH`),r)for(let t=0;t<r.length;t++)e.state.env.set(`BASH_REMATCH_${t}`,r[t]||``);return r!==null}catch{throw Error(`syntax error in regular expression`)}case`<`:return n<i;case`>`:return n>i;default:return!1}}case`CondUnary`:{let n=await X(e,t.operand);return Jk(t.operator)?Yk(e,t.operator,n):aA(t.operator)?oA(t.operator,n):t.operator===`-v`?await sA(e,n):t.operator===`-o`?bA(e,n):!1}case`CondNot`:return e.state.shoptOptions.extglob&&t.operand.type===`CondGroup`&&t.operand.expression.type===`CondWord`?`!(${await X(e,t.operand.expression.word)})`!=``:!await cA(e,t.operand);case`CondAnd`:return await cA(e,t.left)?await cA(e,t.right):!1;case`CondOr`:return await cA(e,t.left)?!0:await cA(e,t.right);case`CondGroup`:return await cA(e,t.expression);case`CondWord`:return await X(e,t.word)!==``;default:return!1}}async function lA(e,t){if(t.length===0)return $(``,``,1);if(t.length===1)return Vk(!!t[0]);if(t.length===2){let n=t[0],r=t[1];return n===`(`?Q(`test: '(' without matching ')'
874
- `,2):Jk(n)?Vk(await Yk(e,n,r)):aA(n)?Vk(oA(n,r)):n===`!`?Vk(!r):n===`-v`?Vk(await sA(e,r)):n===`-o`?Vk(bA(e,r)):n===`=`||n===`==`||n===`!=`||n===`<`||n===`>`||n===`-eq`||n===`-ne`||n===`-lt`||n===`-le`||n===`-gt`||n===`-ge`||n===`-nt`||n===`-ot`||n===`-ef`?Q(`test: ${n}: unary operator expected
875
- `,2):$(``,``,1)}if(t.length===3){let n=t[0],r=t[1],i=t[2];if(nA(r))return Vk(rA(r,n,i));if(eA(r)){let e=wA(n),t=wA(i);return!e.valid||!t.valid?$(``,``,2):Vk(tA(r,e.value,t.value))}if(Zk(r))return Vk(await Qk(e,r,n,i));switch(r){case`-a`:return Vk(n!==``&&i!==``);case`-o`:return Vk(n!==``||i!==``);case`>`:return Vk(n>i);case`<`:return Vk(n<i)}if(n===`!`){let t=await lA(e,[r,i]);return $(``,t.stderr,t.exitCode===0?1:t.exitCode===1?0:t.exitCode)}if(n===`(`&&i===`)`)return Vk(r!==``)}if(t.length===4){if(t[0]===`!`){let n=await lA(e,t.slice(1));return $(``,n.stderr,n.exitCode===0?1:n.exitCode===1?0:n.exitCode)}if(t[0]===`(`&&t[3]===`)`)return lA(e,[t[1],t[2]])}let n=await uA(e,t,0);return n.pos<t.length?Q(`test: too many arguments
876
- `,2):Vk(n.value)}async function uA(e,t,n){return dA(e,t,n)}async function dA(e,t,n){let{value:r,pos:i}=await fA(e,t,n);for(;t[i]===`-o`;){let n=await fA(e,t,i+1);r||=n.value,i=n.pos}return{value:r,pos:i}}async function fA(e,t,n){let{value:r,pos:i}=await pA(e,t,n);for(;t[i]===`-a`;){let n=await pA(e,t,i+1);r&&=n.value,i=n.pos}return{value:r,pos:i}}async function pA(e,t,n){if(t[n]===`!`){let{value:r,pos:i}=await pA(e,t,n+1);return{value:!r,pos:i}}return mA(e,t,n)}async function mA(e,t,n){let r=t[n];if(r===`(`){let{value:r,pos:i}=await uA(e,t,n+1);return{value:r,pos:t[i]===`)`?i+1:i}}let i=t[n+1];if(nA(i))return{value:rA(i,r,t[n+2]??``),pos:n+3};if(eA(i)){let e=wA(r),a=wA(t[n+2]??`0`);return!e.valid||!a.valid?{value:!1,pos:n+3}:{value:tA(i,e.value,a.value),pos:n+3}}return Zk(i)?{value:await Qk(e,i,r,t[n+2]??``),pos:n+3}:Jk(r)?{value:await Yk(e,r,t[n+1]??``),pos:n+2}:aA(r)?{value:oA(r,t[n+1]??``),pos:n+2}:r===`-v`?{value:await sA(e,t[n+1]??``),pos:n+2}:r===`-o`?{value:bA(e,t[n+1]??``),pos:n+2}:{value:r!==void 0&&r!==``,pos:n+1}}function hA(e,t,n=!1,r=!1){return R(`^${gA(t,r)}$`,n?`is`:`s`).test(e)}function gA(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(t&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let a=_A(e,r+1);if(a!==-1){let o=vA(e.slice(r+2,a)),s=o.map(e=>gA(e,t)),c=s.length>0?s.join(`|`):`(?:)`;if(i===`@`)n+=`(?:${c})`;else if(i===`*`)n+=`(?:${c})*`;else if(i===`+`)n+=`(?:${c})+`;else if(i===`?`)n+=`(?:${c})?`;else if(i===`!`)if(a<e.length-1){let e=o.map(e=>yA(e,t));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let t=e[0];if(t===0)n+=`(?:.+)`;else{let e=[];t>0&&e.push(`.{0,${t-1}}`),e.push(`.{${t+1},}`),e.push(`(?!(?:${c})).{${t}}`),n+=`(?:${e.join(`|`)})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=a;continue}}if(i===`\\`)if(r+1<e.length){let t=e[r+1];/[\\^$.|+(){}[\]*?]/.test(t)?n+=`\\${t}`:n+=t,r++}else n+=`\\\\`;else if(i===`*`)n+=`.*`;else if(i===`?`)n+=`.`;else if(i===`[`){let t=e.indexOf(`]`,r+1);t===-1?n+=`\\[`:(n+=e.slice(r,t+1),r=t)}else /[\\^$.|+(){}]/.test(i)?n+=`\\${i}`:n+=i}return n}function _A(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 vA(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function yA(e,t){let n=0,r=0;for(;r<e.length;){let i=e[r];if(t&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let a=_A(e,r+1);if(a!==-1){if(i===`@`){let i=vA(e.slice(r+2,a)).map(e=>yA(e,t));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){n+=i[0],r=a+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){n+=1,r++;continue}if(i===`[`){let t=e.indexOf(`]`,r+1);if(t!==-1){n+=1,r=t+1;continue}n+=1,r++;continue}if(i===`\\`){n+=1,r+=2;continue}n+=1,r++}return n}function bA(e,t){let n=new Map([[`errexit`,()=>e.state.options.errexit===!0],[`nounset`,()=>e.state.options.nounset===!0],[`pipefail`,()=>e.state.options.pipefail===!0],[`xtrace`,()=>e.state.options.xtrace===!0],[`e`,()=>e.state.options.errexit===!0],[`u`,()=>e.state.options.nounset===!0],[`x`,()=>e.state.options.xtrace===!0]]).get(t);return n?n():!1}async function xA(e,t){if(t=t.trim(),t===``)return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return CA(t);try{return await Z(e,vC(new Ww,t).expression)}catch{return CA(t)}}function SA(e,t){let n=0;for(let r of e){let e;if(r>=`0`&&r<=`9`)e=r.charCodeAt(0)-48;else if(r>=`a`&&r<=`z`)e=r.charCodeAt(0)-97+10;else if(r>=`A`&&r<=`Z`)e=r.charCodeAt(0)-65+36;else if(r===`@`)e=62;else if(r===`_`)e=63;else return NaN;if(e>=t)return NaN;n=n*t+e}return n}function CA(e){if(e=e.trim(),e===``)return 0;let t=!1;e.startsWith(`-`)?(t=!0,e=e.slice(1)):e.startsWith(`+`)&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let e=Number.parseInt(r[1],10);n=e>=2&&e<=64?SA(r[2],e):0}else n=/^0[xX][0-9a-fA-F]+$/.test(e)?Number.parseInt(e,16):/^0[0-7]+$/.test(e)?Number.parseInt(e,8):Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function wA(e){if(e=e.trim(),e===``)return{value:0,valid:!0};let t=!1;if(e.startsWith(`-`)?(t=!0,e=e.slice(1)):e.startsWith(`+`)&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function TA(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`\\`&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]===`[`){let r=EA(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function EA(e,t){let n=t+1,r=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(r+=`^`,n++);let i=!1;n<e.length&&e[n]===`]`&&(i=!0,n++);let a=!1;n<e.length&&e[n]===`[`&&n+1<e.length&&e[n+1]!==`:`&&(a=!0,n++);let o=``,s=!1;for(;n<e.length;){let t=e[n];if(t===`]`){s=!0,n++;break}if(t===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=e.slice(n+2,t);o+=DA(r),n=t+2;continue}}if(t===`[`&&n+1<e.length){let t=e[n+1];if(t===`.`||t===`=`){let r=`${t}]`,i=e.indexOf(r,n+2);if(i!==-1){let t=e.slice(n+2,i);o+=t,n=i+2;continue}}}if(t===`\\`&&n+1<e.length){o+=t+e[n+1],n+=2;continue}o+=t,n++}return s?(i&&(r+=`\\]`),a&&(r+=`\\[`),r+=o,r+=`]`,{converted:r,endIndex:n}):{converted:`\\[`,endIndex:t+1}}function DA(e){return 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`]]).get(e)??``}AO(),zC(),Gw(),BO(),DE();function OA(e){let t=[],n=``,r=!1,i=!1,a=!1,o=!1;for(let s of e){if(a){n+=s,a=!1,o=!0;continue}if(s===`\\`){a=!0;continue}if(s===`'`&&!i){r||(o=!0),r=!r;continue}if(s===`"`&&!r){i||(o=!0),i=!i;continue}if((s===` `||s===` `||s===`
877
- `)&&!r&&!i){o&&=(t.push(n),n=``,!1);continue}n+=s,o=!0}return o&&t.push(n),t}function kA(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!==`[`){n++;continue}n++;let r=``;if(e[n]===`'`||e[n]===`"`){let t=e[n];for(n++;n<e.length&&e[n]!==t;)r+=e[n],n++;e[n]===t&&n++}else for(;n<e.length&&e[n]!==`]`&&e[n]!==`=`;)r+=e[n],n++;for(;n<e.length&&e[n]!==`]`;)n++;if(e[n]===`]`&&n++,e[n]!==`=`)continue;n++;let i=``;if(e[n]===`'`||e[n]===`"`){let t=e[n];for(n++;n<e.length&&e[n]!==t;)e[n]===`\\`&&n+1<e.length&&n++,i+=e[n],n++;e[n]===t&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)i+=e[n],n++;t.push([r,i])}return t}function AA(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:OA(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes(`=`)){let t=e.indexOf(`=`);return{name:e.slice(0,t),isArray:!1,value:e.slice(t+1)}}return{name:e,isArray:!1}}async function jA(e,t){try{return await Z(e,vC(new Ww,t).expression)}catch{let e=parseInt(t,10);return Number.isNaN(e)?0:e}}async function MA(e,t,n={}){let{name:r,isArray:i,arrayElements:a,value:o,arrayIndex:s}=t,{makeReadonly:c=!1,checkReadonly:l=!0}=n;if(l){let t=wE(e,r);if(t)return t}if(i&&a){for(let t=0;t<a.length;t++)e.state.env.set(`${r}_${t}`,a[t]);e.state.env.set(`${r}__length`,String(a.length))}else if(s!==void 0&&o!==void 0){let t=await jA(e,s);e.state.env.set(`${r}_${t}`,o),t>=parseInt(e.state.env.get(`${r}__length`)??`0`,10)&&e.state.env.set(`${r}__length`,String(t+1))}else o!==void 0&&e.state.env.set(r,o);return c&&SE(e,r),null}function NA(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function PA(e,t){return e.state.localVarDepth?.get(t)}function FA(e,t){e.state.localVarDepth?.delete(t)}function IA(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function LA(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function RA(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}A(),AO();var zA=new Set([`:`,`.`,`break`,`continue`,`eval`,`exec`,`exit`,`export`,`readonly`,`return`,`set`,`shift`,`trap`,`unset`]);function BA(e){return zA.has(e)}var VA=new Set([`if`,`then`,`else`,`elif`,`fi`,`case`,`esac`,`for`,`select`,`while`,`until`,`do`,`done`,`in`,`function`,`{`,`}`,`time`,`[[`,`]]`,`!`]),HA=new Set(`:,true,false,cd,export,unset,exit,local,set,break,continue,return,eval,shift,getopts,compgen,complete,compopt,pushd,popd,dirs,source,.,read,mapfile,readarray,declare,typeset,readonly,let,command,shopt,exec,test,[,echo,printf,pwd,alias,unalias,type,hash,ulimit,umask,trap,times,wait,kill,jobs,fg,bg,disown,suspend,fc,history,help,enable,builtin,caller`.split(`,`));AO();async function UA(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
871
+ `)}}let l=c||`/`;if(i)try{l=await e.fs.realpath(l)}catch{}return e.state.previousDir=e.state.cwd,e.state.cwd=l,e.state.env.set(`PWD`,e.state.cwd),e.state.env.set(`OLDPWD`,e.state.previousDir),Hk(r?`${l}
872
+ `:``)}Qw(),KC(),Qw(),xs(),qO(),LO(),xT();function Jk(e,t){return e.fs.resolvePath(e.state.cwd,t)}var Yk=[`-e`,`-a`,`-f`,`-d`,`-r`,`-w`,`-x`,`-s`,`-L`,`-h`,`-k`,`-g`,`-u`,`-G`,`-O`,`-b`,`-c`,`-p`,`-S`,`-t`,`-N`];function Xk(e){return Yk.includes(e)}async function Zk(e,t,n){let r=Jk(e,n);switch(t){case`-e`:case`-a`:return e.fs.exists(r);case`-f`:return await e.fs.exists(r)?(await e.fs.stat(r)).isFile:!1;case`-d`:return await e.fs.exists(r)?(await e.fs.stat(r)).isDirectory:!1;case`-r`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&256)!=0:!1;case`-w`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&128)!=0:!1;case`-x`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&64)!=0:!1;case`-s`:return await e.fs.exists(r)?(await e.fs.stat(r)).size>0:!1;case`-L`:case`-h`:try{return(await e.fs.lstat(r)).isSymbolicLink}catch{return!1}case`-k`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&512)!=0:!1;case`-g`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&1024)!=0:!1;case`-u`:return await e.fs.exists(r)?((await e.fs.stat(r)).mode&2048)!=0:!1;case`-G`:case`-O`:return e.fs.exists(r);case`-b`:return!1;case`-c`:return[`/dev/null`,`/dev/zero`,`/dev/random`,`/dev/urandom`,`/dev/tty`,`/dev/stdin`,`/dev/stdout`,`/dev/stderr`].includes(r);case`-p`:return!1;case`-S`:return!1;case`-t`:return!1;case`-N`:return e.fs.exists(r);default:return!1}}var Qk=[`-nt`,`-ot`,`-ef`];function $k(e){return Qk.includes(e)}async function eA(e,t,n,r){let i=Jk(e,n),a=Jk(e,r);switch(t){case`-nt`:try{let t=await e.fs.stat(i),n=await e.fs.stat(a);return t.mtime>n.mtime}catch{return!1}case`-ot`:try{let t=await e.fs.stat(i),n=await e.fs.stat(a);return t.mtime<n.mtime}catch{return!1}case`-ef`:try{return!await e.fs.exists(i)||!await e.fs.exists(a)?!1:e.fs.resolvePath(e.state.cwd,i)===e.fs.resolvePath(e.state.cwd,a)}catch{return!1}default:return!1}}var tA=new Set([`-eq`,`-ne`,`-lt`,`-le`,`-gt`,`-ge`]);function nA(e){return tA.has(e)}function rA(e,t,n){switch(e){case`-eq`:return t===n;case`-ne`:return t!==n;case`-lt`:return t<n;case`-le`:return t<=n;case`-gt`:return t>n;case`-ge`:return t>=n}}function iA(e){return e===`=`||e===`==`||e===`!=`}function aA(e,t,n,r=!1,i=!1,a=!1){if(r){let r=_A(t,n,i,a);return e===`!=`?!r:r}if(i){let r=t.toLowerCase()===n.toLowerCase();return e===`!=`?!r:r}let o=t===n;return e===`!=`?!o:o}var oA=new Set([`-z`,`-n`]);function sA(e){return oA.has(e)}function cA(e,t){switch(e){case`-z`:return t===``;case`-n`:return t!==``}}KC(),Qw(),qO(),xT();async function lA(e,t){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(n){let t=n[1],r=n[2];if(e.state.associativeArrays?.has(t)){let n=r;return(n.startsWith(`'`)&&n.endsWith(`'`)||n.startsWith(`"`)&&n.endsWith(`"`))&&(n=n.slice(1,-1)),n=n.replace(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g,(t,n)=>e.state.env.get(n)||``),e.state.env.has(`${t}_${n}`)}let i;try{i=await Z(e,TC(new Zw,r).expression)}catch{if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0}}if(i<0){let n=mT(e,t),r=e.state.currentLine;if(n.length===0||(i=Math.max(...n)+1+i,i<0))return e.state.expansionStderr=(e.state.expansionStderr||``)+`bash: line ${r}: ${t}: bad array subscript
873
+ `,!1}return e.state.env.has(`${t}_${i}`)}return e.state.env.has(t)?!0:e.state.associativeArrays?.has(t)?gT(e,t).length>0:mT(e,t).length>0}async function uA(e,t){switch(t.type){case`CondBinary`:{let n=await X(e,t.left),r=t.right.parts.length>0&&t.right.parts.every(e=>e.type===`SingleQuoted`||e.type===`DoubleQuoted`||e.type===`Escaped`&&t.operator!==`=~`),i;if(i=t.operator===`=~`?r?uE(await X(e,t.right)):await SO(e,t.right):iA(t.operator)&&!r?await CO(e,t.right):await X(e,t.right),iA(t.operator)){let a=e.state.shoptOptions.nocasematch;return aA(t.operator,n,i,!r,a,!0)}if(nA(t.operator))return rA(t.operator,await CA(e,n),await CA(e,i));if($k(t.operator))return eA(e,t.operator,n,i);switch(t.operator){case`=~`:try{let t=e.state.shoptOptions.nocasematch,r=z(DA(i),t?`i`:``).match(n);if(hT(e,`BASH_REMATCH`),r)for(let t=0;t<r.length;t++)e.state.env.set(`BASH_REMATCH_${t}`,r[t]||``);return r!==null}catch{throw Error(`syntax error in regular expression`)}case`<`:return n<i;case`>`:return n>i;default:return!1}}case`CondUnary`:{let n=await X(e,t.operand);return Xk(t.operator)?Zk(e,t.operator,n):sA(t.operator)?cA(t.operator,n):t.operator===`-v`?await lA(e,n):t.operator===`-o`?SA(e,n):!1}case`CondNot`:return e.state.shoptOptions.extglob&&t.operand.type===`CondGroup`&&t.operand.expression.type===`CondWord`?`!(${await X(e,t.operand.expression.word)})`!=``:!await uA(e,t.operand);case`CondAnd`:return await uA(e,t.left)?await uA(e,t.right):!1;case`CondOr`:return await uA(e,t.left)?!0:await uA(e,t.right);case`CondGroup`:return await uA(e,t.expression);case`CondWord`:return await X(e,t.word)!==``;default:return!1}}async function dA(e,t){if(t.length===0)return $(``,``,1);if(t.length===1)return Uk(!!t[0]);if(t.length===2){let n=t[0],r=t[1];return n===`(`?Q(`test: '(' without matching ')'
874
+ `,2):Xk(n)?Uk(await Zk(e,n,r)):sA(n)?Uk(cA(n,r)):n===`!`?Uk(!r):n===`-v`?Uk(await lA(e,r)):n===`-o`?Uk(SA(e,r)):n===`=`||n===`==`||n===`!=`||n===`<`||n===`>`||n===`-eq`||n===`-ne`||n===`-lt`||n===`-le`||n===`-gt`||n===`-ge`||n===`-nt`||n===`-ot`||n===`-ef`?Q(`test: ${n}: unary operator expected
875
+ `,2):$(``,``,1)}if(t.length===3){let n=t[0],r=t[1],i=t[2];if(iA(r))return Uk(aA(r,n,i));if(nA(r)){let e=EA(n),t=EA(i);return!e.valid||!t.valid?$(``,``,2):Uk(rA(r,e.value,t.value))}if($k(r))return Uk(await eA(e,r,n,i));switch(r){case`-a`:return Uk(n!==``&&i!==``);case`-o`:return Uk(n!==``||i!==``);case`>`:return Uk(n>i);case`<`:return Uk(n<i)}if(n===`!`){let t=await dA(e,[r,i]);return $(``,t.stderr,t.exitCode===0?1:t.exitCode===1?0:t.exitCode)}if(n===`(`&&i===`)`)return Uk(r!==``)}if(t.length===4){if(t[0]===`!`){let n=await dA(e,t.slice(1));return $(``,n.stderr,n.exitCode===0?1:n.exitCode===1?0:n.exitCode)}if(t[0]===`(`&&t[3]===`)`)return dA(e,[t[1],t[2]])}let n=await fA(e,t,0);return n.pos<t.length?Q(`test: too many arguments
876
+ `,2):Uk(n.value)}async function fA(e,t,n){return pA(e,t,n)}async function pA(e,t,n){let{value:r,pos:i}=await mA(e,t,n);for(;t[i]===`-o`;){let n=await mA(e,t,i+1);r||=n.value,i=n.pos}return{value:r,pos:i}}async function mA(e,t,n){let{value:r,pos:i}=await hA(e,t,n);for(;t[i]===`-a`;){let n=await hA(e,t,i+1);r&&=n.value,i=n.pos}return{value:r,pos:i}}async function hA(e,t,n){if(t[n]===`!`){let{value:r,pos:i}=await hA(e,t,n+1);return{value:!r,pos:i}}return gA(e,t,n)}async function gA(e,t,n){let r=t[n];if(r===`(`){let{value:r,pos:i}=await fA(e,t,n+1);return{value:r,pos:t[i]===`)`?i+1:i}}let i=t[n+1];if(iA(i))return{value:aA(i,r,t[n+2]??``),pos:n+3};if(nA(i)){let e=EA(r),a=EA(t[n+2]??`0`);return!e.valid||!a.valid?{value:!1,pos:n+3}:{value:rA(i,e.value,a.value),pos:n+3}}return $k(i)?{value:await eA(e,i,r,t[n+2]??``),pos:n+3}:Xk(r)?{value:await Zk(e,r,t[n+1]??``),pos:n+2}:sA(r)?{value:cA(r,t[n+1]??``),pos:n+2}:r===`-v`?{value:await lA(e,t[n+1]??``),pos:n+2}:r===`-o`?{value:SA(e,t[n+1]??``),pos:n+2}:{value:r!==void 0&&r!==``,pos:n+1}}function _A(e,t,n=!1,r=!1){return z(`^${vA(t,r)}$`,n?`is`:`s`).test(e)}function vA(e,t){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(t&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let a=yA(e,r+1);if(a!==-1){let o=bA(e.slice(r+2,a)),s=o.map(e=>vA(e,t)),c=s.length>0?s.join(`|`):`(?:)`;if(i===`@`)n+=`(?:${c})`;else if(i===`*`)n+=`(?:${c})*`;else if(i===`+`)n+=`(?:${c})+`;else if(i===`?`)n+=`(?:${c})?`;else if(i===`!`)if(a<e.length-1){let e=o.map(e=>xA(e,t));if(e.every(e=>e!==null)&&e.every(t=>t===e[0])&&e[0]!==null){let t=e[0];if(t===0)n+=`(?:.+)`;else{let e=[];t>0&&e.push(`.{0,${t-1}}`),e.push(`.{${t+1},}`),e.push(`(?!(?:${c})).{${t}}`),n+=`(?:${e.join(`|`)})`}}else n+=`(?:(?!(?:${c})).)*?`}else n+=`(?!(?:${c})$).*`;r=a;continue}}if(i===`\\`)if(r+1<e.length){let t=e[r+1];/[\\^$.|+(){}[\]*?]/.test(t)?n+=`\\${t}`:n+=t,r++}else n+=`\\\\`;else if(i===`*`)n+=`.*`;else if(i===`?`)n+=`.`;else if(i===`[`){let t=e.indexOf(`]`,r+1);t===-1?n+=`\\[`:(n+=e.slice(r,t+1),r=t)}else /[\\^$.|+(){}]/.test(i)?n+=`\\${i}`:n+=i}return n}function yA(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 bA(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`\\`){n+=a,i+1<e.length?(n+=e[i+1],i+=2):i++;continue}a===`(`?(r++,n+=a):a===`)`?(r--,n+=a):a===`|`&&r===0?(t.push(n),n=``):n+=a,i++}return t.push(n),t}function xA(e,t){let n=0,r=0;for(;r<e.length;){let i=e[r];if(t&&(i===`@`||i===`*`||i===`+`||i===`?`||i===`!`)&&r+1<e.length&&e[r+1]===`(`){let a=yA(e,r+1);if(a!==-1){if(i===`@`){let i=bA(e.slice(r+2,a)).map(e=>xA(e,t));if(i.every(e=>e!==null)&&i.every(e=>e===i[0])){n+=i[0],r=a+1;continue}return null}return null}}if(i===`*`)return null;if(i===`?`){n+=1,r++;continue}if(i===`[`){let t=e.indexOf(`]`,r+1);if(t!==-1){n+=1,r=t+1;continue}n+=1,r++;continue}if(i===`\\`){n+=1,r+=2;continue}n+=1,r++}return n}function SA(e,t){let n=new Map([[`errexit`,()=>e.state.options.errexit===!0],[`nounset`,()=>e.state.options.nounset===!0],[`pipefail`,()=>e.state.options.pipefail===!0],[`xtrace`,()=>e.state.options.xtrace===!0],[`e`,()=>e.state.options.errexit===!0],[`u`,()=>e.state.options.nounset===!0],[`x`,()=>e.state.options.xtrace===!0]]).get(t);return n?n():!1}async function CA(e,t){if(t=t.trim(),t===``)return 0;if(/^[+-]?(\d+#[a-zA-Z0-9@_]+|0[xX][0-9a-fA-F]+|0[0-7]+|\d+)$/.test(t))return TA(t);try{return await Z(e,TC(new Zw,t).expression)}catch{return TA(t)}}function wA(e,t){let n=0;for(let r of e){let e;if(r>=`0`&&r<=`9`)e=r.charCodeAt(0)-48;else if(r>=`a`&&r<=`z`)e=r.charCodeAt(0)-97+10;else if(r>=`A`&&r<=`Z`)e=r.charCodeAt(0)-65+36;else if(r===`@`)e=62;else if(r===`_`)e=63;else return NaN;if(e>=t)return NaN;n=n*t+e}return n}function TA(e){if(e=e.trim(),e===``)return 0;let t=!1;e.startsWith(`-`)?(t=!0,e=e.slice(1)):e.startsWith(`+`)&&(e=e.slice(1));let n,r=e.match(/^(\d+)#([a-zA-Z0-9@_]+)$/);if(r){let e=Number.parseInt(r[1],10);n=e>=2&&e<=64?wA(r[2],e):0}else n=/^0[xX][0-9a-fA-F]+$/.test(e)?Number.parseInt(e,16):/^0[0-7]+$/.test(e)?Number.parseInt(e,8):Number.parseInt(e,10);return Number.isNaN(n)&&(n=0),t?-n:n}function EA(e){if(e=e.trim(),e===``)return{value:0,valid:!0};let t=!1;if(e.startsWith(`-`)?(t=!0,e=e.slice(1)):e.startsWith(`+`)&&(e=e.slice(1)),!/^\d+$/.test(e))return{value:0,valid:!1};let n=Number.parseInt(e,10);return Number.isNaN(n)?{value:0,valid:!1}:{value:t?-n:n,valid:!0}}function DA(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`\\`&&n+1<e.length)t+=e[n]+e[n+1],n+=2;else if(e[n]===`[`){let r=OA(e,n);t+=r.converted,n=r.endIndex}else t+=e[n],n++;return t}function OA(e,t){let n=t+1,r=`[`;n<e.length&&(e[n]===`^`||e[n]===`!`)&&(r+=`^`,n++);let i=!1;n<e.length&&e[n]===`]`&&(i=!0,n++);let a=!1;n<e.length&&e[n]===`[`&&n+1<e.length&&e[n+1]!==`:`&&(a=!0,n++);let o=``,s=!1;for(;n<e.length;){let t=e[n];if(t===`]`){s=!0,n++;break}if(t===`[`&&n+1<e.length&&e[n+1]===`:`){let t=e.indexOf(`:]`,n+2);if(t!==-1){let r=e.slice(n+2,t);o+=kA(r),n=t+2;continue}}if(t===`[`&&n+1<e.length){let t=e[n+1];if(t===`.`||t===`=`){let r=`${t}]`,i=e.indexOf(r,n+2);if(i!==-1){let t=e.slice(n+2,i);o+=t,n=i+2;continue}}}if(t===`\\`&&n+1<e.length){o+=t+e[n+1],n+=2;continue}o+=t,n++}return s?(i&&(r+=`\\]`),a&&(r+=`\\[`),r+=o,r+=`]`,{converted:r,endIndex:n}):{converted:`\\[`,endIndex:t+1}}function kA(e){return 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`]]).get(e)??``}LO(),KC(),Qw(),qO(),PE();function AA(e){let t=[],n=``,r=!1,i=!1,a=!1,o=!1;for(let s of e){if(a){n+=s,a=!1,o=!0;continue}if(s===`\\`){a=!0;continue}if(s===`'`&&!i){r||(o=!0),r=!r;continue}if(s===`"`&&!r){i||(o=!0),i=!i;continue}if((s===` `||s===` `||s===`
877
+ `)&&!r&&!i){o&&=(t.push(n),n=``,!1);continue}n+=s,o=!0}return o&&t.push(n),t}function jA(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&/\s/.test(e[n]);)n++;if(n>=e.length)break;if(e[n]!==`[`){n++;continue}n++;let r=``;if(e[n]===`'`||e[n]===`"`){let t=e[n];for(n++;n<e.length&&e[n]!==t;)r+=e[n],n++;e[n]===t&&n++}else for(;n<e.length&&e[n]!==`]`&&e[n]!==`=`;)r+=e[n],n++;for(;n<e.length&&e[n]!==`]`;)n++;if(e[n]===`]`&&n++,e[n]!==`=`)continue;n++;let i=``;if(e[n]===`'`||e[n]===`"`){let t=e[n];for(n++;n<e.length&&e[n]!==t;)e[n]===`\\`&&n+1<e.length&&n++,i+=e[n],n++;e[n]===t&&n++}else for(;n<e.length&&!/\s/.test(e[n]);)i+=e[n],n++;t.push([r,i])}return t}function MA(e){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(t)return{name:t[1],isArray:!0,arrayElements:AA(t[2])};let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(n)return{name:n[1],isArray:!1,arrayIndex:n[2],value:n[3]};if(e.includes(`=`)){let t=e.indexOf(`=`);return{name:e.slice(0,t),isArray:!1,value:e.slice(t+1)}}return{name:e,isArray:!1}}async function NA(e,t){try{return await Z(e,TC(new Zw,t).expression)}catch{let e=parseInt(t,10);return Number.isNaN(e)?0:e}}async function PA(e,t,n={}){let{name:r,isArray:i,arrayElements:a,value:o,arrayIndex:s}=t,{makeReadonly:c=!1,checkReadonly:l=!0}=n;if(l){let t=jE(e,r);if(t)return t}if(i&&a){for(let t=0;t<a.length;t++)e.state.env.set(`${r}_${t}`,a[t]);e.state.env.set(`${r}__length`,String(a.length))}else if(s!==void 0&&o!==void 0){let t=await NA(e,s);e.state.env.set(`${r}_${t}`,o),t>=parseInt(e.state.env.get(`${r}__length`)??`0`,10)&&e.state.env.set(`${r}__length`,String(t+1))}else o!==void 0&&e.state.env.set(r,o);return c&&kE(e,r),null}function FA(e,t){e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,e.state.callDepth)}function IA(e,t){return e.state.localVarDepth?.get(t)}function LA(e,t){e.state.localVarDepth?.delete(t)}function RA(e,t,n){e.state.localVarStack=e.state.localVarStack||new Map;let r=e.state.localVarStack.get(t)||[];r.push({value:n,scopeIndex:e.state.localScopes.length-1}),e.state.localVarStack.set(t,r)}function zA(e,t){let n=e.state.localVarStack?.get(t);if(!(!n||n.length===0))return n.pop()}function BA(e,t){if(e.state.localVarStack)for(let[n,r]of e.state.localVarStack.entries()){for(;r.length>0&&r[r.length-1].scopeIndex===t;)r.pop();r.length===0&&e.state.localVarStack.delete(n)}}A(),LO();var VA=new Set([`:`,`.`,`break`,`continue`,`eval`,`exec`,`exit`,`export`,`readonly`,`return`,`set`,`shift`,`trap`,`unset`]);function HA(e){return VA.has(e)}var UA=new Set([`if`,`then`,`else`,`elif`,`fi`,`case`,`esac`,`for`,`select`,`while`,`until`,`do`,`done`,`in`,`function`,`{`,`}`,`time`,`[[`,`]]`,`!`]),WA=new Set(`:,true,false,cd,export,unset,exit,local,set,break,continue,return,eval,shift,getopts,compgen,complete,compopt,pushd,popd,dirs,source,.,read,mapfile,readarray,declare,typeset,readonly,let,command,shopt,exec,test,[,echo,printf,pwd,alias,unalias,type,hash,ulimit,umask,trap,times,wait,kill,jobs,fg,bg,disown,suspend,fc,history,help,enable,builtin,caller`.split(`,`));LO();async function GA(e,t,n,r){try{if((await e.fs.stat(t)).isDirectory)return`bash: ${n}: Is a directory
878
878
  `;if(r.checkNoclobber&&e.state.options.noclobber&&!r.isClobber&&n!==`/dev/null`)return`bash: ${n}: cannot overwrite existing file
879
- `}catch{}return null}function WA(e){let t=Math.min(e.length,8192);for(let n=0;n<t;n++)if(e.charCodeAt(n)>127)return`utf8`;return`binary`}function GA(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}async function KA(e,t){let n=new Map;for(let r=0;r<t.length;r++){let i=t[r];if(i.target.type!==`HereDoc`)if(i.operator===`>&`||i.operator===`<&`){if(wO(e,i.target))return{targets:n,error:`bash: $@: ambiguous redirect
880
- `};n.set(r,await X(e,i.target))}else{let t=await TO(e,i.target);if(`error`in t)return{targets:n,error:t.error};n.set(r,t.target)}}return{targets:n}}function qA(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd,n=e.limits.maxFileDescriptors;if(t>=n)throw Error(`bash: cannot allocate file descriptor: too many open files (max ${n})`);return e.state.nextFd++,t}async function JA(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===`>&`||n.operator===`<&`)&&n.target.type===`Word`&&await X(e,n.target)===`-`){let t=e.state.env.get(n.fdVariable);if(t!==void 0){let n=Number.parseInt(t,10);Number.isNaN(n)||e.state.fileDescriptors.delete(n)}continue}let t=qA(e);if(e.state.env.set(n.fdVariable,String(t)),n.target.type===`Word`){let r=await X(e,n.target);if(n.operator===`>&`||n.operator===`<&`){let n=Number.parseInt(r,10);if(!Number.isNaN(n)){let r=e.state.fileDescriptors.get(n);r!==void 0&&(Uk(e),e.state.fileDescriptors.set(t,r));continue}}if(n.operator===`>`||n.operator===`>>`||n.operator===`>|`||n.operator===`&>`||n.operator===`&>>`){let i=e.fs.resolvePath(e.state.cwd,r);(n.operator===`>`||n.operator===`>|`||n.operator===`&>`)&&await e.fs.writeFile(i,``,`binary`),Uk(e),e.state.fileDescriptors.set(t,`__file__:${i}`)}else if(n.operator===`<<<`)Uk(e),e.state.fileDescriptors.set(t,`${r}
881
- `);else if(n.operator===`<`||n.operator===`<>`)try{let n=e.fs.resolvePath(e.state.cwd,r),i=await e.fs.readFile(n);Uk(e),e.state.fileDescriptors.set(t,i)}catch{return $(``,`bash: ${r}: No such file or directory
882
- `,1)}}}return null}async function YA(e,t){for(let n of t){if(n.target.type===`HereDoc`)continue;let t=n.operator===`>&`;if(n.operator!==`>`&&n.operator!==`>|`&&n.operator!==`&>`&&!t)continue;let r;if(t){if(r=await X(e,n.target),r===`-`||!Number.isNaN(Number.parseInt(r,10))||n.fd!=null)continue}else{let t=await TO(e,n.target);if(`error`in t)return $(``,t.error,1);r=t.target}let i=e.fs.resolvePath(e.state.cwd,r),a=n.operator===`>|`;if(i.includes(`\0`))return $(``,`bash: ${r}: No such file or directory
879
+ `}catch{}return null}function KA(e){let t=Math.min(e.length,8192);for(let n=0;n<t;n++)if(e.charCodeAt(n)>127)return`utf8`;return`binary`}function qA(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}async function JA(e,t){let n=new Map;for(let r=0;r<t.length;r++){let i=t[r];if(i.target.type!==`HereDoc`)if(i.operator===`>&`||i.operator===`<&`){if(jO(e,i.target))return{targets:n,error:`bash: $@: ambiguous redirect
880
+ `};n.set(r,await X(e,i.target))}else{let t=await MO(e,i.target);if(`error`in t)return{targets:n,error:t.error};n.set(r,t.target)}}return{targets:n}}function YA(e){e.state.nextFd===void 0&&(e.state.nextFd=10);let t=e.state.nextFd,n=e.limits.maxFileDescriptors;if(t>=n)throw Error(`bash: cannot allocate file descriptor: too many open files (max ${n})`);return e.state.nextFd++,t}async function XA(e,t){for(let n of t){if(!n.fdVariable)continue;if(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),(n.operator===`>&`||n.operator===`<&`)&&n.target.type===`Word`&&await X(e,n.target)===`-`){let t=e.state.env.get(n.fdVariable);if(t!==void 0){let n=Number.parseInt(t,10);Number.isNaN(n)||e.state.fileDescriptors.delete(n)}continue}let t=YA(e);if(e.state.env.set(n.fdVariable,String(t)),n.target.type===`Word`){let r=await X(e,n.target);if(n.operator===`>&`||n.operator===`<&`){let n=Number.parseInt(r,10);if(!Number.isNaN(n)){let r=e.state.fileDescriptors.get(n);r!==void 0&&(Gk(e),e.state.fileDescriptors.set(t,r));continue}}if(n.operator===`>`||n.operator===`>>`||n.operator===`>|`||n.operator===`&>`||n.operator===`&>>`){let i=e.fs.resolvePath(e.state.cwd,r);(n.operator===`>`||n.operator===`>|`||n.operator===`&>`)&&await e.fs.writeFile(i,``,`binary`),Gk(e),e.state.fileDescriptors.set(t,`__file__:${i}`)}else if(n.operator===`<<<`)Gk(e),e.state.fileDescriptors.set(t,`${r}
881
+ `);else if(n.operator===`<`||n.operator===`<>`)try{let n=e.fs.resolvePath(e.state.cwd,r),i=await e.fs.readFile(n);Gk(e),e.state.fileDescriptors.set(t,i)}catch{return $(``,`bash: ${r}: No such file or directory
882
+ `,1)}}}return null}async function ZA(e,t){for(let n of t){if(n.target.type===`HereDoc`)continue;let t=n.operator===`>&`;if(n.operator!==`>`&&n.operator!==`>|`&&n.operator!==`&>`&&!t)continue;let r;if(t){if(r=await X(e,n.target),r===`-`||!Number.isNaN(Number.parseInt(r,10))||n.fd!=null)continue}else{let t=await MO(e,n.target);if(`error`in t)return $(``,t.error,1);r=t.target}let i=e.fs.resolvePath(e.state.cwd,r),a=n.operator===`>|`;if(i.includes(`\0`))return $(``,`bash: ${r}: No such file or directory
883
883
  `,1);try{let t=await e.fs.stat(i);if(t.isDirectory)return $(``,`bash: ${r}: Is a directory
884
884
  `,1);if(e.state.options.noclobber&&!a&&!t.isDirectory&&r!==`/dev/null`)return $(``,`bash: ${r}: cannot overwrite existing file
885
885
  `,1)}catch{}if(r!==`/dev/null`&&r!==`/dev/stdout`&&r!==`/dev/stderr`&&r!==`/dev/full`&&await e.fs.writeFile(i,``,`binary`),r===`/dev/full`)return $(``,`bash: /dev/full: No space left on device
886
- `,1)}return null}async function XA(e,t,n,r){let{stdout:i,stderr:a,exitCode:o}=t,s=t.stdoutEncoding===`binary`?()=>`binary`:e=>WA(e);for(let t=0;t<n.length;t++){let c=n[t];if(c.target.type===`HereDoc`)continue;let l,u=r?.get(t);if(u!==void 0)l=u;else if(c.operator===`>&`||c.operator===`<&`){if(wO(e,c.target)){a+=`bash: $@: ambiguous redirect
887
- `,o=1,i=``;continue}l=await X(e,c.target)}else{let t=await TO(e,c.target);if(`error`in t){a+=t.error,o=1,i=``;continue}l=t.target}if(!c.fdVariable){if(l.includes(`\0`)){a+=`bash: ${l.replace(/\0/g,``)}: No such file or directory
886
+ `,1)}return null}async function QA(e,t,n,r){let{stdout:i,stderr:a,exitCode:o}=t,s=t.stdoutEncoding===`binary`?()=>`binary`:e=>KA(e);for(let t=0;t<n.length;t++){let c=n[t];if(c.target.type===`HereDoc`)continue;let l,u=r?.get(t);if(u!==void 0)l=u;else if(c.operator===`>&`||c.operator===`<&`){if(jO(e,c.target)){a+=`bash: $@: ambiguous redirect
887
+ `,o=1,i=``;continue}l=await X(e,c.target)}else{let t=await MO(e,c.target);if(`error`in t){a+=t.error,o=1,i=``;continue}l=t.target}if(!c.fdVariable){if(l.includes(`\0`)){a+=`bash: ${l.replace(/\0/g,``)}: No such file or directory
888
888
  `,o=1,i=``;continue}switch(c.operator){case`>`:case`>|`:{let t=c.fd??1,n=c.operator===`>|`;if(t===1){if(l===`/dev/stdout`)break;if(l===`/dev/stderr`){a+=i,i=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
889
- `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),r=await UA(e,t,l,{checkNoclobber:!0,isClobber:n});if(r){a+=r,o=1,i=``;break}await e.fs.writeFile(t,i,s(i)),i=``}else if(t===2){if(l===`/dev/stderr`)break;if(l===`/dev/stdout`){i+=a,a=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
890
- `,o=1;break}if(l===`/dev/null`)a=``;else{let t=e.fs.resolvePath(e.state.cwd,l),r=await UA(e,t,l,{checkNoclobber:!0,isClobber:n});if(r){a+=r,o=1;break}await e.fs.writeFile(t,a,WA(a)),a=``}}break}case`>>`:{let t=c.fd??1;if(t===1){if(l===`/dev/stdout`)break;if(l===`/dev/stderr`){a+=i,i=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
891
- `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await UA(e,t,l,{});if(n){a+=n,o=1,i=``;break}await e.fs.appendFile(t,i,s(i)),i=``}else if(t===2){if(l===`/dev/stderr`)break;if(l===`/dev/stdout`){i+=a,a=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
892
- `,o=1;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await UA(e,t,l,{});if(n){a+=n,o=1;break}await e.fs.appendFile(t,a,WA(a)),a=``}break}case`>&`:case`<&`:{let t=c.fd??1;if(l===`-`)break;if(l.endsWith(`-`)){let n=l.slice(0,-1),r=Number.parseInt(n,10);if(!Number.isNaN(r)){let n=e.state.fileDescriptors?.get(r);n===void 0?r===1||r===2?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,`__dupout__:${r}`)):r===0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,`__dupin__:${r}`)):r>=3&&(a+=`bash: ${r}: Bad file descriptor
893
- `,o=1):(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,n),r>=3&&e.state.fileDescriptors?.delete(r))}break}if(l===`2`||l===`&2`)t===1&&(a+=i,i=``);else if(l===`1`||l===`&1`)i+=a,a=``;else{let n=Number.parseInt(l,10);if(Number.isNaN(n)){if(c.operator===`>&`){let n=e.fs.resolvePath(e.state.cwd,l),r=await UA(e,n,l,{checkNoclobber:!0});if(r){a=r,o=1,i=``;break}if(c.fd==null){let t=i+a;await e.fs.writeFile(n,t,s(t)),i=``,a=``}else t===1?(await e.fs.writeFile(n,i,s(i)),i=``):t===2&&(await e.fs.writeFile(n,a,WA(a)),a=``)}}else{let r=e.state.fileDescriptors?.get(n);if(r?.startsWith(`__file__:`)){let n=r.slice(9);t===1?(await e.fs.appendFile(n,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n,a,WA(a)),a=``)}else if(r?.startsWith(`__rw__:`)){let n=GA(r);n&&(t===1?(await e.fs.appendFile(n.path,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n.path,a,WA(a)),a=``))}else if(r?.startsWith(`__dupout__:`)){let n=Number.parseInt(r.slice(11),10);if(n!==1)if(n===2)t===1&&(a+=i,i=``);else{let r=e.state.fileDescriptors?.get(n);if(r?.startsWith(`__file__:`)){let n=r.slice(9);t===1?(await e.fs.appendFile(n,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n,a,WA(a)),a=``)}}}else (r?.startsWith(`__dupin__:`)||n>=3)&&(a+=`bash: ${n}: Bad file descriptor
889
+ `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),r=await GA(e,t,l,{checkNoclobber:!0,isClobber:n});if(r){a+=r,o=1,i=``;break}await e.fs.writeFile(t,i,s(i)),i=``}else if(t===2){if(l===`/dev/stderr`)break;if(l===`/dev/stdout`){i+=a,a=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
890
+ `,o=1;break}if(l===`/dev/null`)a=``;else{let t=e.fs.resolvePath(e.state.cwd,l),r=await GA(e,t,l,{checkNoclobber:!0,isClobber:n});if(r){a+=r,o=1;break}await e.fs.writeFile(t,a,KA(a)),a=``}}break}case`>>`:{let t=c.fd??1;if(t===1){if(l===`/dev/stdout`)break;if(l===`/dev/stderr`){a+=i,i=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
891
+ `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await GA(e,t,l,{});if(n){a+=n,o=1,i=``;break}await e.fs.appendFile(t,i,s(i)),i=``}else if(t===2){if(l===`/dev/stderr`)break;if(l===`/dev/stdout`){i+=a,a=``;break}if(l===`/dev/full`){a+=`bash: echo: write error: No space left on device
892
+ `,o=1;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await GA(e,t,l,{});if(n){a+=n,o=1;break}await e.fs.appendFile(t,a,KA(a)),a=``}break}case`>&`:case`<&`:{let t=c.fd??1;if(l===`-`)break;if(l.endsWith(`-`)){let n=l.slice(0,-1),r=Number.parseInt(n,10);if(!Number.isNaN(r)){let n=e.state.fileDescriptors?.get(r);n===void 0?r===1||r===2?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,`__dupout__:${r}`)):r===0?(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,`__dupin__:${r}`)):r>=3&&(a+=`bash: ${r}: Bad file descriptor
893
+ `,o=1):(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),e.state.fileDescriptors.set(t,n),r>=3&&e.state.fileDescriptors?.delete(r))}break}if(l===`2`||l===`&2`)t===1&&(a+=i,i=``);else if(l===`1`||l===`&1`)i+=a,a=``;else{let n=Number.parseInt(l,10);if(Number.isNaN(n)){if(c.operator===`>&`){let n=e.fs.resolvePath(e.state.cwd,l),r=await GA(e,n,l,{checkNoclobber:!0});if(r){a=r,o=1,i=``;break}if(c.fd==null){let t=i+a;await e.fs.writeFile(n,t,s(t)),i=``,a=``}else t===1?(await e.fs.writeFile(n,i,s(i)),i=``):t===2&&(await e.fs.writeFile(n,a,KA(a)),a=``)}}else{let r=e.state.fileDescriptors?.get(n);if(r?.startsWith(`__file__:`)){let n=r.slice(9);t===1?(await e.fs.appendFile(n,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n,a,KA(a)),a=``)}else if(r?.startsWith(`__rw__:`)){let n=qA(r);n&&(t===1?(await e.fs.appendFile(n.path,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n.path,a,KA(a)),a=``))}else if(r?.startsWith(`__dupout__:`)){let n=Number.parseInt(r.slice(11),10);if(n!==1)if(n===2)t===1&&(a+=i,i=``);else{let r=e.state.fileDescriptors?.get(n);if(r?.startsWith(`__file__:`)){let n=r.slice(9);t===1?(await e.fs.appendFile(n,i,s(i)),i=``):t===2&&(await e.fs.appendFile(n,a,KA(a)),a=``)}}}else (r?.startsWith(`__dupin__:`)||n>=3)&&(a+=`bash: ${n}: Bad file descriptor
894
894
  `,o=1,i=``)}}break}case`&>`:{if(l===`/dev/full`){a=`bash: echo: write error: No space left on device
895
- `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await UA(e,t,l,{checkNoclobber:!0});if(n){a=n,o=1,i=``;break}let r=i+a;await e.fs.writeFile(t,r,s(r)),i=``,a=``;break}case`&>>`:{if(l===`/dev/full`){a=`bash: echo: write error: No space left on device
896
- `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await UA(e,t,l,{});if(n){a=n,o=1,i=``;break}let r=i+a;await e.fs.appendFile(t,r,s(r)),i=``,a=``;break}}}}let c=e.state.fileDescriptors?.get(1);if(c){if(c===`__dupout__:2`)a+=i,i=``;else if(c.startsWith(`__file__:`)){let t=c.slice(9);await e.fs.appendFile(t,i,s(i)),i=``}else if(c.startsWith(`__file_append__:`)){let t=c.slice(16);await e.fs.appendFile(t,i,s(i)),i=``}}let l=e.state.fileDescriptors?.get(2);if(l){if(l===`__dupout__:1`)i+=a,a=``;else if(l.startsWith(`__file__:`)){let t=l.slice(9);await e.fs.appendFile(t,a,WA(a)),a=``}else if(l.startsWith(`__file_append__:`)){let t=l.slice(16);await e.fs.appendFile(t,a,WA(a)),a=``}}return $(i,a,o)}function ZA(e,t){if(e.state.options.posix&&zA.has(t.name)){let n=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
897
- `;throw new Ir(2,``,n)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??`main`};return e.state.functions.set(t.name,n),zk}async function QA(e,t){let n=``;for(let r of t)if((r.operator===`<<`||r.operator===`<<-`)&&r.target.type===`HereDoc`){let t=r.target,i=await X(e,t.content);t.stripTabs&&(i=i.split(`
895
+ `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await GA(e,t,l,{checkNoclobber:!0});if(n){a=n,o=1,i=``;break}let r=i+a;await e.fs.writeFile(t,r,s(r)),i=``,a=``;break}case`&>>`:{if(l===`/dev/full`){a=`bash: echo: write error: No space left on device
896
+ `,o=1,i=``;break}let t=e.fs.resolvePath(e.state.cwd,l),n=await GA(e,t,l,{});if(n){a=n,o=1,i=``;break}let r=i+a;await e.fs.appendFile(t,r,s(r)),i=``,a=``;break}}}}let c=e.state.fileDescriptors?.get(1);if(c){if(c===`__dupout__:2`)a+=i,i=``;else if(c.startsWith(`__file__:`)){let t=c.slice(9);await e.fs.appendFile(t,i,s(i)),i=``}else if(c.startsWith(`__file_append__:`)){let t=c.slice(16);await e.fs.appendFile(t,i,s(i)),i=``}}let l=e.state.fileDescriptors?.get(2);if(l){if(l===`__dupout__:1`)i+=a,a=``;else if(l.startsWith(`__file__:`)){let t=l.slice(9);await e.fs.appendFile(t,a,KA(a)),a=``}else if(l.startsWith(`__file_append__:`)){let t=l.slice(16);await e.fs.appendFile(t,a,KA(a)),a=``}}return $(i,a,o)}function $A(e,t){if(e.state.options.posix&&VA.has(t.name)){let n=`bash: line ${e.state.currentLine}: \`${t.name}': is a special builtin
897
+ `;throw new Ir(2,``,n)}let n={...t,sourceFile:t.sourceFile??e.state.currentSource??`main`};return e.state.functions.set(t.name,n),Vk}async function ej(e,t){let n=``;for(let r of t)if((r.operator===`<<`||r.operator===`<<-`)&&r.target.type===`HereDoc`){let t=r.target,i=await X(e,t.content);t.stripTabs&&(i=i.split(`
898
898
  `).map(e=>e.replace(/^\t+/,``)).join(`
899
899
  `)),(r.fd??0)===0&&(n=i)}else if(r.operator===`<<<`&&r.target.type===`Word`)n=`${await X(e,r.target)}
900
- `;else if(r.operator===`<`&&r.target.type===`Word`){let t=await X(e,r.target),i=e.fs.resolvePath(e.state.cwd,t);try{n=await e.fs.readFile(i)}catch{}}return n}async function $A(e,t,n,r=``,i){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,Hk(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,`recursion`)),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(i??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??`main`),e.state.localScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let a=new Map;for(let t=0;t<n.length;t++)a.set(String(t+1),e.state.env.get(String(t+1))),e.state.env.set(String(t+1),n[t]);a.set(`@`,e.state.env.get(`@`)),a.set(`#`,e.state.env.get(`#`)),e.state.env.set(`@`,n.join(` `)),e.state.env.set(`#`,String(n.length));let o=()=>{let t=e.state.localScopes.length-1,n=e.state.localScopes.pop();if(n)for(let[t,r]of n)r===void 0?e.state.env.delete(t):e.state.env.set(t,r);if(RA(e,t),e.state.fullyUnsetLocals)for(let[n,r]of e.state.fullyUnsetLocals.entries())r===t&&e.state.fullyUnsetLocals.delete(n);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let t=e.state.localExportedVars.pop();if(t)for(let n of t)e.state.exportedVars?.delete(n)}for(let[t,n]of a)n===void 0?e.state.env.delete(t):e.state.env.set(t,n);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:s,error:c}=await KA(e,t.redirections);if(c)return o(),$(``,c,1);try{let n=await QA(e,t.redirections),i=r||n,a=await e.executeCommand(t.body,i);return o(),XA(e,a,t.redirections,s)}catch(n){if(o(),n instanceof Nr)return XA(e,$(n.stdout,n.stderr,n.exitCode),t.redirections,s);throw n}}var ej=[`!`,`[[`,`]]`,`case`,`do`,`done`,`elif`,`else`,`esac`,`fi`,`for`,`function`,`if`,`in`,`then`,`time`,`until`,`while`,`{`,`}`],tj=`.,:,[,alias,bg,bind,break,builtin,caller,cd,command,compgen,complete,compopt,continue,declare,dirs,disown,echo,enable,eval,exec,exit,export,false,fc,fg,getopts,hash,help,history,jobs,kill,let,local,logout,mapfile,popd,printf,pushd,pwd,read,readarray,readonly,return,set,shift,shopt,source,suspend,test,times,trap,true,type,typeset,ulimit,umask,unalias,unset,wait`.split(`,`),nj=`autocd.assoc_expand_once.cdable_vars.cdspell.checkhash.checkjobs.checkwinsize.cmdhist.compat31.compat32.compat40.compat41.compat42.compat43.compat44.complete_fullquote.direxpand.dirspell.dotglob.execfail.expand_aliases.extdebug.extglob.extquote.failglob.force_fignore.globasciiranges.globstar.gnu_errfmt.histappend.histreedit.histverify.hostcomplete.huponexit.inherit_errexit.interactive_comments.lastpipe.lithist.localvar_inherit.localvar_unset.login_shell.mailwarn.no_empty_cmd_completion.nocaseglob.nocasematch.nullglob.progcomp.progcomp_alias.promptvars.restricted_shell.shift_verbose.sourcepath.xpg_echo`.split(`.`),rj=tj;async function ij(e,t){let n=[],r=null,i=``,a=``,o=null,s=!1,c=!1,l=!1,u=null,d=null,f=null,p=[],m=[`alias`,`arrayvar`,`binding`,`builtin`,`command`,`directory`,`disabled`,`enabled`,`export`,`file`,`function`,`group`,`helptopic`,`hostname`,`job`,`keyword`,`running`,`service`,`setopt`,`shopt`,`signal`,`stopped`,`user`,`variable`];for(let e=0;e<t.length;e++){let o=t[e];if(o===`-v`)n.push(`variable`);else if(o===`-e`)n.push(`export`);else if(o===`-f`)n.push(`file`);else if(o===`-d`)n.push(`directory`);else if(o===`-k`)n.push(`keyword`);else if(o===`-A`){if(e++,e>=t.length)return Q(`compgen: -A: option requires an argument
900
+ `;else if(r.operator===`<`&&r.target.type===`Word`){let t=await X(e,r.target),i=e.fs.resolvePath(e.state.cwd,t);try{n=await e.fs.readFile(i)}catch{}}return n}async function tj(e,t,n,r=``,i){e.state.callDepth++,e.state.callDepth>e.limits.maxCallDepth&&(e.state.callDepth--,Wk(`${t.name}: maximum recursion depth (${e.limits.maxCallDepth}) exceeded, increase executionLimits.maxCallDepth`,`recursion`)),e.state.funcNameStack||(e.state.funcNameStack=[]),e.state.callLineStack||(e.state.callLineStack=[]),e.state.sourceStack||(e.state.sourceStack=[]),e.state.funcNameStack.unshift(t.name),e.state.callLineStack.unshift(i??e.state.currentLine),e.state.sourceStack.unshift(t.sourceFile??`main`),e.state.localScopes.push(new Map),e.state.localExportedVars||(e.state.localExportedVars=[]),e.state.localExportedVars.push(new Set);let a=new Map;for(let t=0;t<n.length;t++)a.set(String(t+1),e.state.env.get(String(t+1))),e.state.env.set(String(t+1),n[t]);a.set(`@`,e.state.env.get(`@`)),a.set(`#`,e.state.env.get(`#`)),e.state.env.set(`@`,n.join(` `)),e.state.env.set(`#`,String(n.length));let o=()=>{let t=e.state.localScopes.length-1,n=e.state.localScopes.pop();if(n)for(let[t,r]of n)r===void 0?e.state.env.delete(t):e.state.env.set(t,r);if(BA(e,t),e.state.fullyUnsetLocals)for(let[n,r]of e.state.fullyUnsetLocals.entries())r===t&&e.state.fullyUnsetLocals.delete(n);if(e.state.localExportedVars&&e.state.localExportedVars.length>0){let t=e.state.localExportedVars.pop();if(t)for(let n of t)e.state.exportedVars?.delete(n)}for(let[t,n]of a)n===void 0?e.state.env.delete(t):e.state.env.set(t,n);e.state.funcNameStack?.shift(),e.state.callLineStack?.shift(),e.state.sourceStack?.shift(),e.state.callDepth--},{targets:s,error:c}=await JA(e,t.redirections);if(c)return o(),$(``,c,1);try{let n=await ej(e,t.redirections),i=r||n,a=await e.executeCommand(t.body,i);return o(),QA(e,a,t.redirections,s)}catch(n){if(o(),n instanceof Nr)return QA(e,$(n.stdout,n.stderr,n.exitCode),t.redirections,s);throw n}}var nj=[`!`,`[[`,`]]`,`case`,`do`,`done`,`elif`,`else`,`esac`,`fi`,`for`,`function`,`if`,`in`,`then`,`time`,`until`,`while`,`{`,`}`],rj=`.,:,[,alias,bg,bind,break,builtin,caller,cd,command,compgen,complete,compopt,continue,declare,dirs,disown,echo,enable,eval,exec,exit,export,false,fc,fg,getopts,hash,help,history,jobs,kill,let,local,logout,mapfile,popd,printf,pushd,pwd,read,readarray,readonly,return,set,shift,shopt,source,suspend,test,times,trap,true,type,typeset,ulimit,umask,unalias,unset,wait`.split(`,`),ij=`autocd.assoc_expand_once.cdable_vars.cdspell.checkhash.checkjobs.checkwinsize.cmdhist.compat31.compat32.compat40.compat41.compat42.compat43.compat44.complete_fullquote.direxpand.dirspell.dotglob.execfail.expand_aliases.extdebug.extglob.extquote.failglob.force_fignore.globasciiranges.globstar.gnu_errfmt.histappend.histreedit.histverify.hostcomplete.huponexit.inherit_errexit.interactive_comments.lastpipe.lithist.localvar_inherit.localvar_unset.login_shell.mailwarn.no_empty_cmd_completion.nocaseglob.nocasematch.nullglob.progcomp.progcomp_alias.promptvars.restricted_shell.shift_verbose.sourcepath.xpg_echo`.split(`.`),aj=rj;async function oj(e,t){let n=[],r=null,i=``,a=``,o=null,s=!1,c=!1,l=!1,u=null,d=null,f=null,p=[],m=[`alias`,`arrayvar`,`binding`,`builtin`,`command`,`directory`,`disabled`,`enabled`,`export`,`file`,`function`,`group`,`helptopic`,`hostname`,`job`,`keyword`,`running`,`service`,`setopt`,`shopt`,`signal`,`stopped`,`user`,`variable`];for(let e=0;e<t.length;e++){let o=t[e];if(o===`-v`)n.push(`variable`);else if(o===`-e`)n.push(`export`);else if(o===`-f`)n.push(`file`);else if(o===`-d`)n.push(`directory`);else if(o===`-k`)n.push(`keyword`);else if(o===`-A`){if(e++,e>=t.length)return Q(`compgen: -A: option requires an argument
901
901
  `,2);let r=t[e];if(!m.includes(r))return Q(`compgen: ${r}: invalid action name
902
902
  `,2);n.push(r)}else if(o===`-W`){if(e++,e>=t.length)return Q(`compgen: -W: option requires an argument
903
903
  `,2);r=t[e]}else if(o===`-P`){if(e++,e>=t.length)return Q(`compgen: -P: option requires an argument
@@ -908,112 +908,112 @@ Gid: ${i} ${i} ${i} ${i}
908
908
  `,2);d=t[e]}else if(o===`-C`){if(e++,e>=t.length)return Q(`compgen: -C: option requires an argument
909
909
  `,2);f=t[e]}else if(o===`-X`){if(e++,e>=t.length)return Q(`compgen: -X: option requires an argument
910
910
  `,2);u=t[e]}else if(o===`-G`){if(e++,e>=t.length)return Q(`compgen: -G: option requires an argument
911
- `,2)}else if(o===`--`){p.push(...t.slice(e+1));break}else o.startsWith(`-`)||p.push(o)}o=p[0]??null;let h=[];if(c){let t=await pj(e,o);h.push(...t)}if(l){let t=await mj(e,o);h.push(...t)}for(let t of n)if(t===`variable`){let t=aj(e,o);h.push(...t)}else if(t===`export`){let t=oj(e,o);h.push(...t)}else if(t===`function`){let t=sj(e,o);h.push(...t)}else if(t===`builtin`){let e=cj(o);h.push(...e)}else if(t===`keyword`){let e=lj(o);h.push(...e)}else if(t===`alias`){let t=uj(e,o);h.push(...t)}else if(t===`shopt`){let e=dj(o);h.push(...e)}else if(t===`helptopic`){let e=fj(o);h.push(...e)}else if(t===`directory`){let t=await pj(e,o);h.push(...t)}else if(t===`file`){let t=await mj(e,o);h.push(...t)}else if(t===`user`){let e=hj(o);h.push(...e)}else if(t===`command`){let t=await gj(e,o);h.push(...t)}if(r!==null)try{let t=vj(e,await _j(e,r));for(let e of t)(o===null||e.startsWith(o))&&h.push(e)}catch{return $(``,``,1)}if(s){let t=await pj(e,o);for(let e of t)h.includes(e)||h.push(e)}let g=``;if(d!==null){let t=e.state.functions.get(d);if(t){let n=new Map;n.set(`COMP_WORDS__length`,e.state.env.get(`COMP_WORDS__length`)),e.state.env.set(`COMP_WORDS__length`,`0`),n.set(`COMP_CWORD`,e.state.env.get(`COMP_CWORD`)),e.state.env.set(`COMP_CWORD`,`-1`),n.set(`COMP_LINE`,e.state.env.get(`COMP_LINE`)),e.state.env.set(`COMP_LINE`,``),n.set(`COMP_POINT`,e.state.env.get(`COMP_POINT`)),e.state.env.set(`COMP_POINT`,`0`);let r=new Map;for(let t of e.state.env.keys())(t===`COMPREPLY`||t.startsWith(`COMPREPLY_`)||t===`COMPREPLY__length`)&&(r.set(t,e.state.env.get(t)),e.state.env.delete(t));let i=[`compgen`,p[0]??``,``];try{let a=await $A(e,t,i,``);if(a.exitCode!==0)return yj(e,n),yj(e,r),$(``,a.stderr,1);g=a.stdout;let o=bj(e);h.push(...o)}catch{return yj(e,n),yj(e,r),$(``,``,1)}yj(e,n),yj(e,r)}}if(f!==null)try{let t=Uw(f),n=await e.executeScript(t);if(n.exitCode!==0)return $(``,n.stderr,n.exitCode);if(n.stdout){let e=n.stdout.split(`
911
+ `,2)}else if(o===`--`){p.push(...t.slice(e+1));break}else o.startsWith(`-`)||p.push(o)}o=p[0]??null;let h=[];if(c){let t=await hj(e,o);h.push(...t)}if(l){let t=await gj(e,o);h.push(...t)}for(let t of n)if(t===`variable`){let t=sj(e,o);h.push(...t)}else if(t===`export`){let t=cj(e,o);h.push(...t)}else if(t===`function`){let t=lj(e,o);h.push(...t)}else if(t===`builtin`){let e=uj(o);h.push(...e)}else if(t===`keyword`){let e=dj(o);h.push(...e)}else if(t===`alias`){let t=fj(e,o);h.push(...t)}else if(t===`shopt`){let e=pj(o);h.push(...e)}else if(t===`helptopic`){let e=mj(o);h.push(...e)}else if(t===`directory`){let t=await hj(e,o);h.push(...t)}else if(t===`file`){let t=await gj(e,o);h.push(...t)}else if(t===`user`){let e=_j(o);h.push(...e)}else if(t===`command`){let t=await vj(e,o);h.push(...t)}if(r!==null)try{let t=bj(e,await yj(e,r));for(let e of t)(o===null||e.startsWith(o))&&h.push(e)}catch{return $(``,``,1)}if(s){let t=await hj(e,o);for(let e of t)h.includes(e)||h.push(e)}let g=``;if(d!==null){let t=e.state.functions.get(d);if(t){let n=new Map;n.set(`COMP_WORDS__length`,e.state.env.get(`COMP_WORDS__length`)),e.state.env.set(`COMP_WORDS__length`,`0`),n.set(`COMP_CWORD`,e.state.env.get(`COMP_CWORD`)),e.state.env.set(`COMP_CWORD`,`-1`),n.set(`COMP_LINE`,e.state.env.get(`COMP_LINE`)),e.state.env.set(`COMP_LINE`,``),n.set(`COMP_POINT`,e.state.env.get(`COMP_POINT`)),e.state.env.set(`COMP_POINT`,`0`);let r=new Map;for(let t of e.state.env.keys())(t===`COMPREPLY`||t.startsWith(`COMPREPLY_`)||t===`COMPREPLY__length`)&&(r.set(t,e.state.env.get(t)),e.state.env.delete(t));let i=[`compgen`,p[0]??``,``];try{let a=await tj(e,t,i,``);if(a.exitCode!==0)return xj(e,n),xj(e,r),$(``,a.stderr,1);g=a.stdout;let o=Sj(e);h.push(...o)}catch{return xj(e,n),xj(e,r),$(``,``,1)}xj(e,n),xj(e,r)}}if(f!==null)try{let t=Xw(f),n=await e.executeScript(t);if(n.exitCode!==0)return $(``,n.stderr,n.exitCode);if(n.stdout){let e=n.stdout.split(`
912
912
  `);for(let t of e)t.length>0&&h.push(t)}}catch(e){if(e.name===`ParseException`)return Q(`compgen: -C: ${e.message}
913
- `,2);throw e}let _=h;if(u!==null){let e=u.startsWith(`!`),t=e?u.slice(1):u;_=h.filter(n=>{let r=hA(n,t,!1,!0);return e?r:!r})}if(_.length===0&&o!==null)return $(g,``,1);let v=_.map(e=>`${i}${e}${a}`).join(`
914
- `);return Bk(g+(v?`${v}
915
- `:``))}function aj(e,t){let n=new Set;for(let t of e.state.env.keys()){if(t.includes(`_`)&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(t)||t.endsWith(`__length`))continue;let r=t.split(`_`)[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)?n.add(t):r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&e.state.env.has(`${r}__length`)&&n.add(r)}let r=Array.from(n);return t!==null&&(r=r.filter(e=>e.startsWith(t))),r.sort()}function oj(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(e=>e.startsWith(t))),r=r.filter(t=>t.includes(`_`)&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(t)||t.endsWith(`__length`)?!1:e.state.env.has(t)),r.sort()}function sj(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(e=>e.startsWith(t))),n.sort()}function cj(e){let t=[...tj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function lj(e){let t=[...ej];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function uj(e,t){let n=[];for(let t of e.state.env.keys())if(t.startsWith(`BASH_ALIAS_`)){let e=t.slice(11);n.push(e)}let r=n;return t!==null&&(r=r.filter(e=>e.startsWith(t))),r.sort()}function dj(e){let t=[...nj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function fj(e){let t=[...rj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}async function pj(e,t){let n=[];try{let r=e.state.cwd,i=t??``;if(t){let n=t.lastIndexOf(`/`);if(n!==-1){let a=t.slice(0,n)||`/`;i=t.slice(n+1),r=a.startsWith(`/`)?a:`${e.state.cwd}/${a}`}}let a=await e.fs.readdir(r);for(let o of a){let a=`${r}/${o}`;try{if((await e.fs.stat(a)).isDirectory&&(!i||o.startsWith(i)))if(t?.includes(`/`)){let e=t.lastIndexOf(`/`),r=t.slice(0,e+1);n.push(r+o)}else n.push(o)}catch{}}}catch{}return n.sort()}async function mj(e,t){let n=[];try{let r=e.state.cwd,i=t??``;if(t){let n=t.lastIndexOf(`/`);if(n!==-1){let a=t.slice(0,n)||`/`;i=t.slice(n+1),r=a.startsWith(`/`)?a:`${e.state.cwd}/${a}`}}let a=await e.fs.readdir(r);for(let e of a)if(!i||e.startsWith(i))if(t?.includes(`/`)){let r=t.lastIndexOf(`/`),i=t.slice(0,r+1);n.push(i+e)}else n.push(e)}catch{}return n.sort()}function hj(e){return[`root`,`nobody`]}async function gj(e,t){let n=new Set;for(let e of tj)n.add(e);for(let t of e.state.functions.keys())n.add(t);for(let t of e.state.env.keys())t.startsWith(`BASH_ALIAS_`)&&n.add(t.slice(11));for(let e of ej)n.add(e);let r=e.state.env.get(`PATH`)??`/usr/bin:/bin`;for(let t of r.split(`:`))if(t)try{let r=await e.fs.readdir(t);for(let e of r)n.add(e)}catch{}let i=Array.from(n);return t!==null&&(i=i.filter(e=>e.startsWith(t))),i.sort()}async function _j(e,t){return await X(e,new Ww().parseWordFromString(t,!1,!1))}function vj(e,t){let n=e.state.env.get(`IFS`)??`
916
- `;if(n.length===0)return[t];let r=new Set(n.split(``)),i=[],a=``,o=0;for(;o<t.length;){let e=t[o];if(e===`\\`&&o+1<t.length){let e=t[o+1];a+=e,o+=2}else r.has(e)?(a.length>0&&(i.push(a),a=``),o++):(a+=e,o++)}return a.length>0&&i.push(a),i}function yj(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function bj(e){let t=[];if(e.state.env.get(`COMPREPLY__length`)!==void 0){let n=J(e,`COMPREPLY`);for(let[,e]of n)t.push(e)}else{let n=e.state.env.get(`COMPREPLY`);n!==void 0&&t.push(n)}return t}var xj=[`bashdefault`,`default`,`dirnames`,`filenames`,`noquote`,`nosort`,`nospace`,`plusdirs`];function Sj(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,i=!1,a,o,s,c=[],l=[],u=[];for(let e=0;e<t.length;e++){let d=t[e];if(d===`-p`)n=!0;else if(d===`-r`)r=!0;else if(d===`-D`)i=!0;else if(d===`-W`){if(e++,e>=t.length)return Q(`complete: -W: option requires an argument
913
+ `,2);throw e}let _=h;if(u!==null){let e=u.startsWith(`!`),t=e?u.slice(1):u;_=h.filter(n=>{let r=_A(n,t,!1,!0);return e?r:!r})}if(_.length===0&&o!==null)return $(g,``,1);let v=_.map(e=>`${i}${e}${a}`).join(`
914
+ `);return Hk(g+(v?`${v}
915
+ `:``))}function sj(e,t){let n=new Set;for(let t of e.state.env.keys()){if(t.includes(`_`)&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(t)||t.endsWith(`__length`))continue;let r=t.split(`_`)[0];/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t)?n.add(t):r&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)&&e.state.env.has(`${r}__length`)&&n.add(r)}let r=Array.from(n);return t!==null&&(r=r.filter(e=>e.startsWith(t))),r.sort()}function cj(e,t){let n=e.state.exportedVars??new Set,r=Array.from(n);return t!==null&&(r=r.filter(e=>e.startsWith(t))),r=r.filter(t=>t.includes(`_`)&&/^[a-zA-Z_][a-zA-Z0-9_]*_\d+$/.test(t)||t.endsWith(`__length`)?!1:e.state.env.has(t)),r.sort()}function lj(e,t){let n=Array.from(e.state.functions.keys());return t!==null&&(n=n.filter(e=>e.startsWith(t))),n.sort()}function uj(e){let t=[...rj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function dj(e){let t=[...nj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function fj(e,t){let n=[];for(let t of e.state.env.keys())if(t.startsWith(`BASH_ALIAS_`)){let e=t.slice(11);n.push(e)}let r=n;return t!==null&&(r=r.filter(e=>e.startsWith(t))),r.sort()}function pj(e){let t=[...ij];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}function mj(e){let t=[...aj];return e!==null&&(t=t.filter(t=>t.startsWith(e))),t.sort()}async function hj(e,t){let n=[];try{let r=e.state.cwd,i=t??``;if(t){let n=t.lastIndexOf(`/`);if(n!==-1){let a=t.slice(0,n)||`/`;i=t.slice(n+1),r=a.startsWith(`/`)?a:`${e.state.cwd}/${a}`}}let a=await e.fs.readdir(r);for(let o of a){let a=`${r}/${o}`;try{if((await e.fs.stat(a)).isDirectory&&(!i||o.startsWith(i)))if(t?.includes(`/`)){let e=t.lastIndexOf(`/`),r=t.slice(0,e+1);n.push(r+o)}else n.push(o)}catch{}}}catch{}return n.sort()}async function gj(e,t){let n=[];try{let r=e.state.cwd,i=t??``;if(t){let n=t.lastIndexOf(`/`);if(n!==-1){let a=t.slice(0,n)||`/`;i=t.slice(n+1),r=a.startsWith(`/`)?a:`${e.state.cwd}/${a}`}}let a=await e.fs.readdir(r);for(let e of a)if(!i||e.startsWith(i))if(t?.includes(`/`)){let r=t.lastIndexOf(`/`),i=t.slice(0,r+1);n.push(i+e)}else n.push(e)}catch{}return n.sort()}function _j(e){return[`root`,`nobody`]}async function vj(e,t){let n=new Set;for(let e of rj)n.add(e);for(let t of e.state.functions.keys())n.add(t);for(let t of e.state.env.keys())t.startsWith(`BASH_ALIAS_`)&&n.add(t.slice(11));for(let e of nj)n.add(e);let r=e.state.env.get(`PATH`)??`/usr/bin:/bin`;for(let t of r.split(`:`))if(t)try{let r=await e.fs.readdir(t);for(let e of r)n.add(e)}catch{}let i=Array.from(n);return t!==null&&(i=i.filter(e=>e.startsWith(t))),i.sort()}async function yj(e,t){return await X(e,new Zw().parseWordFromString(t,!1,!1))}function bj(e,t){let n=e.state.env.get(`IFS`)??`
916
+ `;if(n.length===0)return[t];let r=new Set(n.split(``)),i=[],a=``,o=0;for(;o<t.length;){let e=t[o];if(e===`\\`&&o+1<t.length){let e=t[o+1];a+=e,o+=2}else r.has(e)?(a.length>0&&(i.push(a),a=``),o++):(a+=e,o++)}return a.length>0&&i.push(a),i}function xj(e,t){for(let[n,r]of t)r===void 0?e.state.env.delete(n):e.state.env.set(n,r)}function Sj(e){let t=[];if(e.state.env.get(`COMPREPLY__length`)!==void 0){let n=J(e,`COMPREPLY`);for(let[,e]of n)t.push(e)}else{let n=e.state.env.get(`COMPREPLY`);n!==void 0&&t.push(n)}return t}var Cj=[`bashdefault`,`default`,`dirnames`,`filenames`,`noquote`,`nosort`,`nospace`,`plusdirs`];function wj(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,i=!1,a,o,s,c=[],l=[],u=[];for(let e=0;e<t.length;e++){let d=t[e];if(d===`-p`)n=!0;else if(d===`-r`)r=!0;else if(d===`-D`)i=!0;else if(d===`-W`){if(e++,e>=t.length)return Q(`complete: -W: option requires an argument
917
917
  `,2);a=t[e]}else if(d===`-F`){if(e++,e>=t.length)return Q(`complete: -F: option requires an argument
918
918
  `,2);o=t[e]}else if(d===`-o`){if(e++,e>=t.length)return Q(`complete: -o: option requires an argument
919
- `,2);let n=t[e];if(!xj.includes(n))return Q(`complete: ${n}: invalid option name
919
+ `,2);let n=t[e];if(!Cj.includes(n))return Q(`complete: ${n}: invalid option name
920
920
  `,2);c.push(n)}else if(d===`-A`){if(e++,e>=t.length)return Q(`complete: -A: option requires an argument
921
921
  `,2);l.push(t[e])}else if(d===`-C`){if(e++,e>=t.length)return Q(`complete: -C: option requires an argument
922
922
  `,2);s=t[e]}else if(d===`-G`){if(e++,e>=t.length)return Q(`complete: -G: option requires an argument
923
923
  `,2)}else if(d===`-P`){if(e++,e>=t.length)return Q(`complete: -P: option requires an argument
924
924
  `,2)}else if(d===`-S`){if(e++,e>=t.length)return Q(`complete: -S: option requires an argument
925
925
  `,2)}else if(d===`-X`){if(e++,e>=t.length)return Q(`complete: -X: option requires an argument
926
- `,2)}else if(d===`--`){u.push(...t.slice(e+1));break}else d.startsWith(`-`)||u.push(d)}if(r){if(u.length===0)return e.state.completionSpecs.clear(),Bk(``);for(let t of u)e.state.completionSpecs.delete(t);return Bk(``)}if(n)return u.length===0?Cj(e):Cj(e,u);if(t.length===0||u.length===0&&!a&&!o&&!s&&c.length===0&&l.length===0&&!i)return Cj(e);if(o&&u.length===0&&!i)return Q(`complete: -F: option requires a command name
927
- `,2);if(i){let t={isDefault:!0};return a!==void 0&&(t.wordlist=a),o!==void 0&&(t.function=o),s!==void 0&&(t.command=s),c.length>0&&(t.options=c),l.length>0&&(t.actions=l),e.state.completionSpecs.set(`__default__`,t),Bk(``)}for(let t of u){let n=Object.create(null);a!==void 0&&(n.wordlist=a),o!==void 0&&(n.function=o),s!==void 0&&(n.command=s),c.length>0&&(n.options=c),l.length>0&&(n.actions=l),e.state.completionSpecs.set(t,n)}return Bk(``)}function Cj(e,t){let n=e.state.completionSpecs;if(!n||n.size===0){if(t&&t.length>0){let e=``;for(let n of t)e+=`complete: ${n}: no completion specification
928
- `;return $(``,e,1)}return Bk(``)}let r=[],i=t||Array.from(n.keys());for(let e of i){if(e===`__default__`)continue;let i=n.get(e);if(!i){if(t)return $(r.join(`
926
+ `,2)}else if(d===`--`){u.push(...t.slice(e+1));break}else d.startsWith(`-`)||u.push(d)}if(r){if(u.length===0)return e.state.completionSpecs.clear(),Hk(``);for(let t of u)e.state.completionSpecs.delete(t);return Hk(``)}if(n)return u.length===0?Tj(e):Tj(e,u);if(t.length===0||u.length===0&&!a&&!o&&!s&&c.length===0&&l.length===0&&!i)return Tj(e);if(o&&u.length===0&&!i)return Q(`complete: -F: option requires a command name
927
+ `,2);if(i){let t={isDefault:!0};return a!==void 0&&(t.wordlist=a),o!==void 0&&(t.function=o),s!==void 0&&(t.command=s),c.length>0&&(t.options=c),l.length>0&&(t.actions=l),e.state.completionSpecs.set(`__default__`,t),Hk(``)}for(let t of u){let n=Object.create(null);a!==void 0&&(n.wordlist=a),o!==void 0&&(n.function=o),s!==void 0&&(n.command=s),c.length>0&&(n.options=c),l.length>0&&(n.actions=l),e.state.completionSpecs.set(t,n)}return Hk(``)}function Tj(e,t){let n=e.state.completionSpecs;if(!n||n.size===0){if(t&&t.length>0){let e=``;for(let n of t)e+=`complete: ${n}: no completion specification
928
+ `;return $(``,e,1)}return Hk(``)}let r=[],i=t||Array.from(n.keys());for(let e of i){if(e===`__default__`)continue;let i=n.get(e);if(!i){if(t)return $(r.join(`
929
929
  `)+(r.length>0?`
930
930
  `:``),`complete: ${e}: no completion specification
931
- `,1);continue}let a=`complete`;if(i.options)for(let e of i.options)a+=` -o ${e}`;if(i.actions)for(let e of i.actions)a+=` -A ${e}`;i.wordlist!==void 0&&(i.wordlist.includes(` `)||i.wordlist.includes(`'`)?a+=` -W '${i.wordlist}'`:a+=` -W ${i.wordlist}`),i.function!==void 0&&(a+=` -F ${i.function}`),i.isDefault&&(a+=` -D`),a+=` ${e}`,r.push(a)}return r.length===0?Bk(``):Bk(`${r.join(`
931
+ `,1);continue}let a=`complete`;if(i.options)for(let e of i.options)a+=` -o ${e}`;if(i.actions)for(let e of i.actions)a+=` -A ${e}`;i.wordlist!==void 0&&(i.wordlist.includes(` `)||i.wordlist.includes(`'`)?a+=` -W '${i.wordlist}'`:a+=` -W ${i.wordlist}`),i.function!==void 0&&(a+=` -F ${i.function}`),i.isDefault&&(a+=` -D`),a+=` ${e}`,r.push(a)}return r.length===0?Hk(``):Hk(`${r.join(`
932
932
  `)}
933
- `)}var wj=[`bashdefault`,`default`,`dirnames`,`filenames`,`noquote`,`nosort`,`nospace`,`plusdirs`];function Tj(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,i=[],a=[],o=[];for(let e=0;e<t.length;e++){let s=t[e];if(s===`-D`)n=!0;else if(s===`-E`)r=!0;else if(s===`-o`){if(e++,e>=t.length)return Q(`compopt: -o: option requires an argument
934
- `,2);let n=t[e];if(!wj.includes(n))return Q(`compopt: ${n}: invalid option name
933
+ `)}var Ej=[`bashdefault`,`default`,`dirnames`,`filenames`,`noquote`,`nosort`,`nospace`,`plusdirs`];function Dj(e,t){e.state.completionSpecs||(e.state.completionSpecs=new Map);let n=!1,r=!1,i=[],a=[],o=[];for(let e=0;e<t.length;e++){let s=t[e];if(s===`-D`)n=!0;else if(s===`-E`)r=!0;else if(s===`-o`){if(e++,e>=t.length)return Q(`compopt: -o: option requires an argument
934
+ `,2);let n=t[e];if(!Ej.includes(n))return Q(`compopt: ${n}: invalid option name
935
935
  `,2);i.push(n)}else if(s===`+o`){if(e++,e>=t.length)return Q(`compopt: +o: option requires an argument
936
- `,2);let n=t[e];if(!wj.includes(n))return Q(`compopt: ${n}: invalid option name
937
- `,2);a.push(n)}else if(s===`--`){o.push(...t.slice(e+1));break}else !s.startsWith(`-`)&&!s.startsWith(`+`)&&o.push(s)}if(n){let t=e.state.completionSpecs.get(`__default__`)??{isDefault:!0},n=new Set(t.options??[]);for(let e of i)n.add(e);for(let e of a)n.delete(e);return t.options=n.size>0?Array.from(n):void 0,e.state.completionSpecs.set(`__default__`,t),Bk(``)}if(r){let t=e.state.completionSpecs.get(`__empty__`)??{},n=new Set(t.options??[]);for(let e of i)n.add(e);for(let e of a)n.delete(e);return t.options=n.size>0?Array.from(n):void 0,e.state.completionSpecs.set(`__empty__`,t),Bk(``)}if(o.length>0){for(let t of o){let n=e.state.completionSpecs.get(t)??{},r=new Set(n.options??[]);for(let e of i)r.add(e);for(let e of a)r.delete(e);n.options=r.size>0?Array.from(r):void 0,e.state.completionSpecs.set(t,n)}return Bk(``)}return Q(`compopt: not currently executing completion function
938
- `,1)}A();function Ej(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Hr;return zk}if(t.length>1)throw new Ir(1,``,`bash: continue: too many arguments
936
+ `,2);let n=t[e];if(!Ej.includes(n))return Q(`compopt: ${n}: invalid option name
937
+ `,2);a.push(n)}else if(s===`--`){o.push(...t.slice(e+1));break}else !s.startsWith(`-`)&&!s.startsWith(`+`)&&o.push(s)}if(n){let t=e.state.completionSpecs.get(`__default__`)??{isDefault:!0},n=new Set(t.options??[]);for(let e of i)n.add(e);for(let e of a)n.delete(e);return t.options=n.size>0?Array.from(n):void 0,e.state.completionSpecs.set(`__default__`,t),Hk(``)}if(r){let t=e.state.completionSpecs.get(`__empty__`)??{},n=new Set(t.options??[]);for(let e of i)n.add(e);for(let e of a)n.delete(e);return t.options=n.size>0?Array.from(n):void 0,e.state.completionSpecs.set(`__empty__`,t),Hk(``)}if(o.length>0){for(let t of o){let n=e.state.completionSpecs.get(t)??{},r=new Set(n.options??[]);for(let e of i)r.add(e);for(let e of a)r.delete(e);n.options=r.size>0?Array.from(r):void 0,e.state.completionSpecs.set(t,n)}return Hk(``)}return Q(`compopt: not currently executing completion function
938
+ `,1)}A();function Oj(e,t){if(e.state.loopDepth===0){if(e.state.parentHasLoopContext)throw new Hr;return Vk}if(t.length>1)throw new Ir(1,``,`bash: continue: too many arguments
939
939
  `);let n=1;if(t.length>0){let e=Number.parseInt(t[0],10);if(Number.isNaN(e)||e<1)throw new Ir(1,``,`bash: continue: ${t[0]}: numeric argument required
940
- `);n=e}throw new Mr(n)}zC(),Gw(),BO(),mT(),RT(),DE();function Dj(e,t){let n=e.state.env.get(`HOME`)||`/home/user`;return t.split(`:`).map(e=>e===`~`?n:e===`~root`?`/root`:e.startsWith(`~/`)?n+e.slice(1):e.startsWith(`~root/`)?`/root${e.slice(5)}`:e).join(`:`)}mT(),RT();function Oj(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function kj(e){let t=`$'`;for(let n=0;n<e.length;n++){let r=e[n],i=e.charCodeAt(n);i===7?t+=`\\a`:i===8?t+=`\\b`:i===9?t+=`\\t`:i===10?t+=`\\n`:i===11?t+=`\\v`:i===12?t+=`\\f`:i===13?t+=`\\r`:i===27?t+=`\\e`:i===39?t+=`\\'`:i===92?t+=`\\\\`:i<32||i===127?t+=`\\${i.toString(8).padStart(3,`0`)}`:t+=r}return t+=`'`,t}function Aj(e){return Oj(e)?kj(e):/^[a-zA-Z0-9_/.:\-@%+,=]*$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}function jj(e){return Oj(e)?kj(e):`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Mj(e){return Oj(e)?kj(e):`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Nj(e,t){let n=``;return e.state.integerVars?.has(t)&&(n+=`i`),e.state.lowercaseVars?.has(t)&&(n+=`l`),OT(e,t)&&(n+=`n`),e.state.readonlyVars?.has(t)&&(n+=`r`),e.state.uppercaseVars?.has(t)&&(n+=`u`),e.state.exportedVars?.has(t)&&(n+=`x`),n===``?`--`:`-${n}`}function Pj(e){return e===``?`''`:/[\s'\\]/.test(e)?`'${e.replace(/'/g,`'\\''`)}'`:e}function Fj(e,t){let n=``,r=``,i=!1;for(let a of t){let t=Nj(e,a);if(e.state.associativeArrays?.has(a)){let t=lT(e,a);if(t.length===0)n+=`declare -A ${a}=()
941
- `;else{let r=t.map(t=>`['${t}']=${Pj(e.state.env.get(`${a}_${t}`)??``)}`);n+=`declare -A ${a}=(${r.join(` `)})
942
- `}continue}let o=sT(e,a);if(o.length>0){let t=o.map(t=>`[${t}]=${jj(e.state.env.get(`${a}_${t}`)??``)}`);n+=`declare -a ${a}=(${t.join(` `)})
940
+ `);n=e}throw new Mr(n)}KC(),Qw(),qO(),xT(),GT(),PE();function kj(e,t){let n=e.state.env.get(`HOME`)||`/home/user`;return t.split(`:`).map(e=>e===`~`?n:e===`~root`?`/root`:e.startsWith(`~/`)?n+e.slice(1):e.startsWith(`~root/`)?`/root${e.slice(5)}`:e).join(`:`)}xT(),GT();function Aj(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!0}return!1}function jj(e){let t=`$'`;for(let n=0;n<e.length;n++){let r=e[n],i=e.charCodeAt(n);i===7?t+=`\\a`:i===8?t+=`\\b`:i===9?t+=`\\t`:i===10?t+=`\\n`:i===11?t+=`\\v`:i===12?t+=`\\f`:i===13?t+=`\\r`:i===27?t+=`\\e`:i===39?t+=`\\'`:i===92?t+=`\\\\`:i<32||i===127?t+=`\\${i.toString(8).padStart(3,`0`)}`:t+=r}return t+=`'`,t}function Mj(e){return Aj(e)?jj(e):/^[a-zA-Z0-9_/.:\-@%+,=]*$/.test(e)?e:`'${e.replace(/'/g,`'\\''`)}'`}function Nj(e){return Aj(e)?jj(e):`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Pj(e){return Aj(e)?jj(e):`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function Fj(e,t){let n=``;return e.state.integerVars?.has(t)&&(n+=`i`),e.state.lowercaseVars?.has(t)&&(n+=`l`),FT(e,t)&&(n+=`n`),e.state.readonlyVars?.has(t)&&(n+=`r`),e.state.uppercaseVars?.has(t)&&(n+=`u`),e.state.exportedVars?.has(t)&&(n+=`x`),n===``?`--`:`-${n}`}function Ij(e){return e===``?`''`:/[\s'\\]/.test(e)?`'${e.replace(/'/g,`'\\''`)}'`:e}function Lj(e,t){let n=``,r=``,i=!1;for(let a of t){let t=Fj(e,a);if(e.state.associativeArrays?.has(a)){let t=gT(e,a);if(t.length===0)n+=`declare -A ${a}=()
941
+ `;else{let r=t.map(t=>`['${t}']=${Ij(e.state.env.get(`${a}_${t}`)??``)}`);n+=`declare -A ${a}=(${r.join(` `)})
942
+ `}continue}let o=mT(e,a);if(o.length>0){let t=o.map(t=>`[${t}]=${Nj(e.state.env.get(`${a}_${t}`)??``)}`);n+=`declare -a ${a}=(${t.join(` `)})
943
943
  `;continue}if(e.state.env.has(`${a}__length`)){n+=`declare -a ${a}=()
944
- `;continue}let s=e.state.env.get(a);if(s!==void 0)n+=`declare ${t} ${a}=${Mj(s)}
944
+ `;continue}let s=e.state.env.get(a);if(s!==void 0)n+=`declare ${t} ${a}=${Pj(s)}
945
945
  `;else{let o=e.state.declaredVars?.has(a),s=e.state.localVarDepth?.has(a);o||s?n+=`declare ${t} ${a}
946
946
  `:(r+=`bash: declare: ${a}: not found
947
- `,i=!0)}}return $(n,r,+!!i)}function Ij(e,t){let{filterExport:n,filterReadonly:r,filterNameref:i,filterIndexedArray:a,filterAssocArray:o}=t,s=n||r||i||a||o,c=``,l=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let e=t.slice(0,-8);l.add(e);continue}let n=t.lastIndexOf(`_`);if(n>0){let r=t.slice(0,n),i=t.slice(n+1);if(/^\d+$/.test(i)||e.state.associativeArrays?.has(r)){l.add(r);continue}}l.add(t)}if(e.state.localVarDepth)for(let t of e.state.localVarDepth.keys())l.add(t);if(e.state.associativeArrays)for(let t of e.state.associativeArrays)l.add(t);let u=Array.from(l).sort();for(let t of u){let l=Nj(e,t),u=e.state.associativeArrays?.has(t),d=sT(e,t),f=!u&&(d.length>0||e.state.env.has(`${t}__length`));if(s&&(o&&!u||a&&!f||n&&!e.state.exportedVars?.has(t)||r&&!e.state.readonlyVars?.has(t)||i&&!OT(e,t)))continue;if(u){let n=lT(e,t);if(n.length===0)c+=`declare -A ${t}=()
948
- `;else{let r=n.map(n=>`['${n}']=${Pj(e.state.env.get(`${t}_${n}`)??``)}`);c+=`declare -A ${t}=(${r.join(` `)})
949
- `}continue}if(d.length>0){let n=d.map(n=>`[${n}]=${jj(e.state.env.get(`${t}_${n}`)??``)}`);c+=`declare -a ${t}=(${n.join(` `)})
947
+ `,i=!0)}}return $(n,r,+!!i)}function Rj(e,t){let{filterExport:n,filterReadonly:r,filterNameref:i,filterIndexedArray:a,filterAssocArray:o}=t,s=n||r||i||a||o,c=``,l=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let e=t.slice(0,-8);l.add(e);continue}let n=t.lastIndexOf(`_`);if(n>0){let r=t.slice(0,n),i=t.slice(n+1);if(/^\d+$/.test(i)||e.state.associativeArrays?.has(r)){l.add(r);continue}}l.add(t)}if(e.state.localVarDepth)for(let t of e.state.localVarDepth.keys())l.add(t);if(e.state.associativeArrays)for(let t of e.state.associativeArrays)l.add(t);let u=Array.from(l).sort();for(let t of u){let l=Fj(e,t),u=e.state.associativeArrays?.has(t),d=mT(e,t),f=!u&&(d.length>0||e.state.env.has(`${t}__length`));if(s&&(o&&!u||a&&!f||n&&!e.state.exportedVars?.has(t)||r&&!e.state.readonlyVars?.has(t)||i&&!FT(e,t)))continue;if(u){let n=gT(e,t);if(n.length===0)c+=`declare -A ${t}=()
948
+ `;else{let r=n.map(n=>`['${n}']=${Ij(e.state.env.get(`${t}_${n}`)??``)}`);c+=`declare -A ${t}=(${r.join(` `)})
949
+ `}continue}if(d.length>0){let n=d.map(n=>`[${n}]=${Nj(e.state.env.get(`${t}_${n}`)??``)}`);c+=`declare -a ${t}=(${n.join(` `)})
950
950
  `;continue}if(e.state.env.has(`${t}__length`)){c+=`declare -a ${t}=()
951
- `;continue}let p=e.state.env.get(t);p!==void 0&&(c+=`declare ${l} ${t}=${Mj(p)}
952
- `)}return Bk(c)}function Lj(e){let t=``,n=Array.from(e.state.associativeArrays??[]).sort();for(let r of n){let n=lT(e,r);if(n.length===0)t+=`declare -A ${r}=()
953
- `;else{let i=n.map(t=>`['${t}']=${Pj(e.state.env.get(`${r}_${t}`)??``)}`);t+=`declare -A ${r}=(${i.join(` `)})
954
- `}}return Bk(t)}function Rj(e){let t=``,n=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let r=t.slice(0,-8);e.state.associativeArrays?.has(r)||n.add(r);continue}let r=t.lastIndexOf(`_`);if(r>0){let i=t.slice(0,r),a=t.slice(r+1);/^\d+$/.test(a)&&(e.state.associativeArrays?.has(i)||n.add(i))}}let r=Array.from(n).sort();for(let n of r){let r=sT(e,n);if(r.length===0)t+=`declare -a ${n}=()
955
- `;else{let i=r.map(t=>`[${t}]=${jj(e.state.env.get(`${n}_${t}`)??``)}`);t+=`declare -a ${n}=(${i.join(` `)})
956
- `}}return Bk(t)}function zj(e){let t=``,n=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let e=t.slice(0,-8);n.add(e);continue}let r=t.lastIndexOf(`_`);if(r>0){let i=t.slice(0,r),a=t.slice(r+1);if(/^\d+$/.test(a)||e.state.associativeArrays?.has(i)){n.add(i);continue}}n.add(t)}let r=Array.from(n).sort();for(let n of r){if(e.state.associativeArrays?.has(n)||sT(e,n).length>0||e.state.env.has(`${n}__length`))continue;let r=e.state.env.get(n);r!==void 0&&(t+=`${n}=${Aj(r)}
957
- `)}return Bk(t)}function Bj(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Vj(e,t){return e.state.integerVars?.has(t)??!1}function Hj(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function Uj(e,t){return e.state.lowercaseVars?.has(t)??!1}function Wj(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function Gj(e,t){return e.state.uppercaseVars?.has(t)??!1}function Kj(e,t,n){return Uj(e,t)?n.toLowerCase():Gj(e,t)?n.toUpperCase():n}async function qj(e,t){try{let n=await Z(e,vC(new Ww,t).expression);return String(n)}catch{return`0`}}function Jj(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!==`[`)return null;let i=0,a=r+1;for(;r<e.length;r++)if(e[r]===`[`)i++;else if(e[r]===`]`&&(i--,i===0))break;if(i!==0)return null;let o=e.slice(a,r);return r++,e[r]===`=`?(r++,{name:n,indexExpr:o,value:e.slice(r)}):null}async function Yj(e,t){let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!1,f=!1,p=!1,m=!1,h=!1,g=!1,_=[];for(let e=0;e<t.length;e++){let v=t[e];if(v===`-a`)n=!0;else if(v===`-A`)r=!0;else if(v===`-r`)i=!0;else if(v===`-x`)a=!0;else if(v===`-p`)o=!0;else if(v===`-n`)s=!0;else if(v===`+n`)c=!0;else if(v===`+a`)l=!0;else if(v===`+x`)u=!0;else if(v===`--`){_.push(...t.slice(e+1));break}else if(v.startsWith(`+`)){for(let e of v.slice(1))if(e===`n`)c=!0;else if(e===`a`)l=!0;else if(e===`x`)u=!0;else if(e!==`r`&&e!==`i`&&!(e===`f`||e===`F`))return $(``,`bash: typeset: +${e}: invalid option
951
+ `;continue}let p=e.state.env.get(t);p!==void 0&&(c+=`declare ${l} ${t}=${Pj(p)}
952
+ `)}return Hk(c)}function zj(e){let t=``,n=Array.from(e.state.associativeArrays??[]).sort();for(let r of n){let n=gT(e,r);if(n.length===0)t+=`declare -A ${r}=()
953
+ `;else{let i=n.map(t=>`['${t}']=${Ij(e.state.env.get(`${r}_${t}`)??``)}`);t+=`declare -A ${r}=(${i.join(` `)})
954
+ `}}return Hk(t)}function Bj(e){let t=``,n=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let r=t.slice(0,-8);e.state.associativeArrays?.has(r)||n.add(r);continue}let r=t.lastIndexOf(`_`);if(r>0){let i=t.slice(0,r),a=t.slice(r+1);/^\d+$/.test(a)&&(e.state.associativeArrays?.has(i)||n.add(i))}}let r=Array.from(n).sort();for(let n of r){let r=mT(e,n);if(r.length===0)t+=`declare -a ${n}=()
955
+ `;else{let i=r.map(t=>`[${t}]=${Nj(e.state.env.get(`${n}_${t}`)??``)}`);t+=`declare -a ${n}=(${i.join(` `)})
956
+ `}}return Hk(t)}function Vj(e){let t=``,n=new Set;for(let t of e.state.env.keys()){if(t.startsWith(`BASH_`))continue;if(t.endsWith(`__length`)){let e=t.slice(0,-8);n.add(e);continue}let r=t.lastIndexOf(`_`);if(r>0){let i=t.slice(0,r),a=t.slice(r+1);if(/^\d+$/.test(a)||e.state.associativeArrays?.has(i)){n.add(i);continue}}n.add(t)}let r=Array.from(n).sort();for(let n of r){if(e.state.associativeArrays?.has(n)||mT(e,n).length>0||e.state.env.has(`${n}__length`))continue;let r=e.state.env.get(n);r!==void 0&&(t+=`${n}=${Mj(r)}
957
+ `)}return Hk(t)}function Hj(e,t){e.state.integerVars??=new Set,e.state.integerVars.add(t)}function Uj(e,t){return e.state.integerVars?.has(t)??!1}function Wj(e,t){e.state.lowercaseVars??=new Set,e.state.lowercaseVars.add(t),e.state.uppercaseVars?.delete(t)}function Gj(e,t){return e.state.lowercaseVars?.has(t)??!1}function Kj(e,t){e.state.uppercaseVars??=new Set,e.state.uppercaseVars.add(t),e.state.lowercaseVars?.delete(t)}function qj(e,t){return e.state.uppercaseVars?.has(t)??!1}function Jj(e,t,n){return Gj(e,t)?n.toLowerCase():qj(e,t)?n.toUpperCase():n}async function Yj(e,t){try{let n=await Z(e,TC(new Zw,t).expression);return String(n)}catch{return`0`}}function Xj(e){let t=e.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);if(!t)return null;let n=t[0],r=n.length;if(e[r]!==`[`)return null;let i=0,a=r+1;for(;r<e.length;r++)if(e[r]===`[`)i++;else if(e[r]===`]`&&(i--,i===0))break;if(i!==0)return null;let o=e.slice(a,r);return r++,e[r]===`=`?(r++,{name:n,indexExpr:o,value:e.slice(r)}):null}async function Zj(e,t){let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!1,f=!1,p=!1,m=!1,h=!1,g=!1,_=[];for(let e=0;e<t.length;e++){let v=t[e];if(v===`-a`)n=!0;else if(v===`-A`)r=!0;else if(v===`-r`)i=!0;else if(v===`-x`)a=!0;else if(v===`-p`)o=!0;else if(v===`-n`)s=!0;else if(v===`+n`)c=!0;else if(v===`+a`)l=!0;else if(v===`+x`)u=!0;else if(v===`--`){_.push(...t.slice(e+1));break}else if(v.startsWith(`+`)){for(let e of v.slice(1))if(e===`n`)c=!0;else if(e===`a`)l=!0;else if(e===`x`)u=!0;else if(e!==`r`&&e!==`i`&&!(e===`f`||e===`F`))return $(``,`bash: typeset: +${e}: invalid option
958
958
  `,2)}else if(v===`-i`)d=!0;else if(v===`-l`)f=!0;else if(v===`-u`)p=!0;else if(v===`-f`)m=!0;else if(v===`-F`)h=!0;else if(v===`-g`)g=!0;else if(v.startsWith(`-`))for(let e of v.slice(1))if(e===`a`)n=!0;else if(e===`A`)r=!0;else if(e===`r`)i=!0;else if(e===`x`)a=!0;else if(e===`p`)o=!0;else if(e===`n`)s=!0;else if(e===`i`)d=!0;else if(e===`l`)f=!0;else if(e===`u`)p=!0;else if(e===`f`)m=!0;else if(e===`F`)h=!0;else if(e===`g`)g=!0;else return $(``,`bash: typeset: -${e}: invalid option
959
- `,2);else _.push(v)}let v=e.state.localScopes.length>0&&!g,y=t=>{if(!v)return;let n=e.state.localScopes[e.state.localScopes.length-1];n.has(t)||n.set(t,e.state.env.get(t))},ee=t=>{if(!v)return;let n=e.state.localScopes[e.state.localScopes.length-1];n.has(t)||n.set(t,e.state.env.get(t));let r=`${t}_`;for(let t of e.state.env.keys())t.startsWith(r)&&!t.includes(`__`)&&(n.has(t)||n.set(t,e.state.env.get(t)));let i=`${t}__length`;e.state.env.has(i)&&!n.has(i)&&n.set(i,e.state.env.get(i))},te=t=>{v&&NA(e,t)};if(h){if(_.length===0){let t=Array.from(e.state.functions.keys()).sort(),n=``;for(let e of t)n+=`declare -f ${e}
960
- `;return Bk(n)}let t=!0,n=``;for(let r of _)e.state.functions.has(r)?n+=`${r}
959
+ `,2);else _.push(v)}let v=e.state.localScopes.length>0&&!g,y=t=>{if(!v)return;let n=e.state.localScopes[e.state.localScopes.length-1];n.has(t)||n.set(t,e.state.env.get(t))},ee=t=>{if(!v)return;let n=e.state.localScopes[e.state.localScopes.length-1];n.has(t)||n.set(t,e.state.env.get(t));let r=`${t}_`;for(let t of e.state.env.keys())t.startsWith(r)&&!t.includes(`__`)&&(n.has(t)||n.set(t,e.state.env.get(t)));let i=`${t}__length`;e.state.env.has(i)&&!n.has(i)&&n.set(i,e.state.env.get(i))},te=t=>{v&&FA(e,t)};if(h){if(_.length===0){let t=Array.from(e.state.functions.keys()).sort(),n=``;for(let e of t)n+=`declare -f ${e}
960
+ `;return Hk(n)}let t=!0,n=``;for(let r of _)e.state.functions.has(r)?n+=`${r}
961
961
  `:t=!1;return $(n,``,+!t)}if(m){if(_.length===0){let t=``,n=Array.from(e.state.functions.keys()).sort();for(let e of n)t+=`${e} ()
962
962
  {
963
963
  # function body
964
964
  }
965
- `;return Bk(t)}let t=!0;for(let n of _)e.state.functions.has(n)||(t=!1);return $(``,``,+!t)}if(o&&_.length>0)return Fj(e,_);if(o&&_.length===0)return Ij(e,{filterExport:a,filterReadonly:i,filterNameref:s,filterIndexedArray:n,filterAssocArray:r});if(_.length===0&&r&&!o)return Lj(e);if(_.length===0&&n&&!o)return Rj(e);if(_.length===0&&!o)return zj(e);let ne=``,b=0;for(let t of _){let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(o&&!l){let t=o[1],s=o[2];if(r&&sT(e,t).length>0){ne+=`bash: declare: ${t}: cannot convert indexed to associative array
965
+ `;return Hk(t)}let t=!0;for(let n of _)e.state.functions.has(n)||(t=!1);return $(``,``,+!t)}if(o&&_.length>0)return Lj(e,_);if(o&&_.length===0)return Rj(e,{filterExport:a,filterReadonly:i,filterNameref:s,filterIndexedArray:n,filterAssocArray:r});if(_.length===0&&r&&!o)return zj(e);if(_.length===0&&n&&!o)return Bj(e);if(_.length===0&&!o)return Vj(e);let ne=``,b=0;for(let t of _){let o=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(o&&!l){let t=o[1],s=o[2];if(r&&mT(e,t).length>0){ne+=`bash: declare: ${t}: cannot convert indexed to associative array
966
966
  `,b=1;continue}if((n||!r&&!n)&&e.state.associativeArrays?.has(t)){ne+=`bash: declare: ${t}: cannot convert associative to indexed array
967
- `,b=1;continue}if(ee(t),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(t)),cT(e,t),e.state.env.delete(t),e.state.env.delete(`${t}__length`),r&&s.includes(`[`)){let n=kA(s);for(let[r,i]of n){let n=Dj(e,i);e.state.env.set(`${t}_${r}`,n)}}else if(r){let n=OA(s);for(let r=0;r<n.length;r+=2){let i=n[r],a=r+1<n.length?Dj(e,n[r+1]):``;e.state.env.set(`${t}_${i}`,a)}}else{let n=OA(s);if(n.some(e=>/^\[[^\]]+\]=/.test(e))){let r=0;for(let i of n){let n=i.match(/^\[([^\]]+)\]=(.*)$/);if(n){let i=n[1],a=n[2],o=Dj(e,a),s;if(/^-?\d+$/.test(i))s=Number.parseInt(i,10);else try{s=await Z(e,vC(new Ww,i).expression)}catch{s=0}e.state.env.set(`${t}_${s}`,o),r=s+1}else{let n=Dj(e,i);e.state.env.set(`${t}_${r}`,n),r++}}}else{for(let r=0;r<n.length;r++)e.state.env.set(`${t}_${r}`,n[r]);e.state.env.set(`${t}__length`,String(n.length))}}te(t),i&&SE(e,t),a&&TE(e,t);continue}if(c&&(AT(e,t.includes(`=`)?t.slice(0,t.indexOf(`=`)):t),!t.includes(`=`))||u&&(EE(e,t.includes(`=`)?t.slice(0,t.indexOf(`=`)):t),!t.includes(`=`)))continue;let m=Jj(t);if(m){let{name:t,indexExpr:n,value:r}=m,o=wE(e,t);if(o)return o;ee(t);let s;try{s=await Z(e,vC(new Ww,n).expression)}catch{let e=parseInt(n,10);s=Number.isNaN(e)?0:e}e.state.env.set(`${t}_${s}`,r);let c=parseInt(e.state.env.get(`${t}__length`)??`0`,10);s>=c&&e.state.env.set(`${t}__length`,String(s+1)),te(t),i&&SE(e,t),a&&TE(e,t);continue}let h=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h&&!l){let t=h[1],n=h[2],r=wE(e,t);if(r)return r;ee(t);let o=OA(n);if(e.state.associativeArrays?.has(t)){let r=kA(n);for(let[n,i]of r){let r=Dj(e,i);e.state.env.set(`${t}_${n}`,r)}}else{let n=sT(e,t),r=0,i=e.state.env.get(t);n.length===0&&i!==void 0?(e.state.env.set(`${t}_0`,i),e.state.env.delete(t),r=1):n.length>0&&(r=Math.max(...n)+1);for(let n=0;n<o.length;n++)e.state.env.set(`${t}_${r+n}`,Dj(e,o[n]));let a=r+o.length;e.state.env.set(`${t}__length`,String(a))}te(t),i&&SE(e,t),a&&TE(e,t);continue}let g=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(g){let t=g[1],n=Dj(e,g[2]),r=wE(e,t);if(r)return r;y(t),d&&Bj(e,t),f&&Hj(e,t),p&&Wj(e,t);let o=sT(e,t).length>0||e.state.associativeArrays?.has(t);if(Vj(e,t)){let r=e.state.env.get(t)??`0`,i=parseInt(r,10)||0,a=parseInt(await qj(e,n),10)||0;n=String(i+a),e.state.env.set(t,n)}else if(o){n=Kj(e,t,n);let r=`${t}_0`,i=e.state.env.get(r)??``;e.state.env.set(r,i+n)}else{n=Kj(e,t,n);let r=e.state.env.get(t)??``;e.state.env.set(t,r+n)}te(t),i&&SE(e,t),a&&TE(e,t),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t));continue}if(t.includes(`=`)){let n=t.indexOf(`=`),r=t.slice(0,n),o=t.slice(n+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){ne+=`bash: typeset: \`${r}': not a valid identifier
968
- `,b=1;continue}let c=wE(e,r);if(c)return c;if(y(r),s){if(o!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o)){ne+=`bash: declare: \`${o}': invalid variable name for name reference
969
- `,b=1;continue}e.state.env.set(r,o),kT(e,r),o!==``&&PT(e,o)&&NT(e,r),te(r),i&&SE(e,r),a&&TE(e,r);continue}if(d&&Bj(e,r),f&&Hj(e,r),p&&Wj(e,r),Vj(e,r)&&(o=await qj(e,o)),o=Kj(e,r,o),OT(e,r)){let t=FT(e,r);t&&t!==r?e.state.env.set(t,o):e.state.env.set(r,o)}else e.state.env.set(r,o);te(r),i&&SE(e,r),a&&TE(e,r),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(r))}else{let o=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){ne+=`bash: typeset: \`${o}': not a valid identifier
970
- `,b=1;continue}if(n||r?ee(o):y(o),s){kT(e,o);let t=e.state.env.get(o);t!==void 0&&t!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t)?jT(e,o):t&&PT(e,t)&&NT(e,o),te(o),i&&SE(e,o),a&&TE(e,o);continue}if(d&&Bj(e,o),f&&Hj(e,o),p&&Wj(e,o),r){if(sT(e,o).length>0){ne+=`bash: declare: ${o}: cannot convert indexed to associative array
971
- `,b=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(o)}let c=Array.from(e.state.env.keys()).some(e=>e.startsWith(`${o}_`)&&!e.startsWith(`${o}__length`));!e.state.env.has(o)&&!c&&(n||r?e.state.env.set(`${o}__length`,`0`):(e.state.declaredVars??=new Set,e.state.declaredVars.add(o))),te(o),i&&SE(e,o),a&&TE(e,o)}}return $(``,ne,b)}async function Xj(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r!==`-a`&&r!==`-A`&&r!==`-p`)if(r===`--`){n.push(...t.slice(e+1));break}else r.startsWith(`-`)||n.push(r)}if(n.length===0){let t=``,n=Array.from(e.state.readonlyVars||[]).sort();for(let r of n){let n=e.state.env.get(r);if(n!==void 0){let e=n.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t+=`declare -r ${r}="${e}"
972
- `}}return Bk(t)}for(let t of n){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(n){let t=n[1],r=n[2],i=wE(e,t);if(i)return i;let a=OA(r);if(e.state.associativeArrays?.has(t)){let n=kA(r);for(let[r,i]of n){let n=Dj(e,i);e.state.env.set(`${t}_${r}`,n)}}else{let n=sT(e,t),r=0,i=e.state.env.get(t);n.length===0&&i!==void 0?(e.state.env.set(`${t}_0`,i),e.state.env.delete(t),r=1):n.length>0&&(r=Math.max(...n)+1);for(let n=0;n<a.length;n++)e.state.env.set(`${t}_${r+n}`,Dj(e,a[n]));let o=r+a.length;e.state.env.set(`${t}__length`,String(o))}SE(e,t);continue}let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(r){let t=r[1],n=Dj(e,r[2]),i=wE(e,t);if(i)return i;let a=e.state.env.get(t)??``;e.state.env.set(t,a+n),SE(e,t);continue}let i=AA(t);if(i.value===void 0&&!i.isArray){SE(e,i.name);continue}let a=await MA(e,i,{makeReadonly:!0});if(a)return a}return zk}function Zj(e){return e.state.directoryStack??=[],e.state.directoryStack}function Qj(e,t){return t&&e===t?`~`:t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function $j(e){let t=e.split(`/`).filter(e=>e&&e!==`.`),n=[];for(let e of t)e===`..`?n.pop():n.push(e);return`/${n.join(`/`)}`}async function eM(e,t){let n=Zj(e),r;for(let e=0;e<t.length;e++){let n=t[e];if(n===`--`){if(e+1<t.length){if(r!==void 0)return Q(`bash: pushd: too many arguments
967
+ `,b=1;continue}if(ee(t),r&&(e.state.associativeArrays??=new Set,e.state.associativeArrays.add(t)),hT(e,t),e.state.env.delete(t),e.state.env.delete(`${t}__length`),r&&s.includes(`[`)){let n=jA(s);for(let[r,i]of n){let n=kj(e,i);e.state.env.set(`${t}_${r}`,n)}}else if(r){let n=AA(s);for(let r=0;r<n.length;r+=2){let i=n[r],a=r+1<n.length?kj(e,n[r+1]):``;e.state.env.set(`${t}_${i}`,a)}}else{let n=AA(s);if(n.some(e=>/^\[[^\]]+\]=/.test(e))){let r=0;for(let i of n){let n=i.match(/^\[([^\]]+)\]=(.*)$/);if(n){let i=n[1],a=n[2],o=kj(e,a),s;if(/^-?\d+$/.test(i))s=Number.parseInt(i,10);else try{s=await Z(e,TC(new Zw,i).expression)}catch{s=0}e.state.env.set(`${t}_${s}`,o),r=s+1}else{let n=kj(e,i);e.state.env.set(`${t}_${r}`,n),r++}}}else{for(let r=0;r<n.length;r++)e.state.env.set(`${t}_${r}`,n[r]);e.state.env.set(`${t}__length`,String(n.length))}}te(t),i&&kE(e,t),a&&ME(e,t);continue}if(c&&(LT(e,t.includes(`=`)?t.slice(0,t.indexOf(`=`)):t),!t.includes(`=`))||u&&(NE(e,t.includes(`=`)?t.slice(0,t.indexOf(`=`)):t),!t.includes(`=`)))continue;let m=Xj(t);if(m){let{name:t,indexExpr:n,value:r}=m,o=jE(e,t);if(o)return o;ee(t);let s;try{s=await Z(e,TC(new Zw,n).expression)}catch{let e=parseInt(n,10);s=Number.isNaN(e)?0:e}e.state.env.set(`${t}_${s}`,r);let c=parseInt(e.state.env.get(`${t}__length`)??`0`,10);s>=c&&e.state.env.set(`${t}__length`,String(s+1)),te(t),i&&kE(e,t),a&&ME(e,t);continue}let h=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(h&&!l){let t=h[1],n=h[2],r=jE(e,t);if(r)return r;ee(t);let o=AA(n);if(e.state.associativeArrays?.has(t)){let r=jA(n);for(let[n,i]of r){let r=kj(e,i);e.state.env.set(`${t}_${n}`,r)}}else{let n=mT(e,t),r=0,i=e.state.env.get(t);n.length===0&&i!==void 0?(e.state.env.set(`${t}_0`,i),e.state.env.delete(t),r=1):n.length>0&&(r=Math.max(...n)+1);for(let n=0;n<o.length;n++)e.state.env.set(`${t}_${r+n}`,kj(e,o[n]));let a=r+o.length;e.state.env.set(`${t}__length`,String(a))}te(t),i&&kE(e,t),a&&ME(e,t);continue}let g=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(g){let t=g[1],n=kj(e,g[2]),r=jE(e,t);if(r)return r;y(t),d&&Hj(e,t),f&&Wj(e,t),p&&Kj(e,t);let o=mT(e,t).length>0||e.state.associativeArrays?.has(t);if(Uj(e,t)){let r=e.state.env.get(t)??`0`,i=parseInt(r,10)||0,a=parseInt(await Yj(e,n),10)||0;n=String(i+a),e.state.env.set(t,n)}else if(o){n=Jj(e,t,n);let r=`${t}_0`,i=e.state.env.get(r)??``;e.state.env.set(r,i+n)}else{n=Jj(e,t,n);let r=e.state.env.get(t)??``;e.state.env.set(t,r+n)}te(t),i&&kE(e,t),a&&ME(e,t),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(t));continue}if(t.includes(`=`)){let n=t.indexOf(`=`),r=t.slice(0,n),o=t.slice(n+1);if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)){ne+=`bash: typeset: \`${r}': not a valid identifier
968
+ `,b=1;continue}let c=jE(e,r);if(c)return c;if(y(r),s){if(o!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(o)){ne+=`bash: declare: \`${o}': invalid variable name for name reference
969
+ `,b=1;continue}e.state.env.set(r,o),IT(e,r),o!==``&&VT(e,o)&&BT(e,r),te(r),i&&kE(e,r),a&&ME(e,r);continue}if(d&&Hj(e,r),f&&Wj(e,r),p&&Kj(e,r),Uj(e,r)&&(o=await Yj(e,o)),o=Jj(e,r,o),FT(e,r)){let t=HT(e,r);t&&t!==r?e.state.env.set(t,o):e.state.env.set(r,o)}else e.state.env.set(r,o);te(r),i&&kE(e,r),a&&ME(e,r),e.state.options.allexport&&!u&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(r))}else{let o=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(o)){ne+=`bash: typeset: \`${o}': not a valid identifier
970
+ `,b=1;continue}if(n||r?ee(o):y(o),s){IT(e,o);let t=e.state.env.get(o);t!==void 0&&t!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(t)?RT(e,o):t&&VT(e,t)&&BT(e,o),te(o),i&&kE(e,o),a&&ME(e,o);continue}if(d&&Hj(e,o),f&&Wj(e,o),p&&Kj(e,o),r){if(mT(e,o).length>0){ne+=`bash: declare: ${o}: cannot convert indexed to associative array
971
+ `,b=1;continue}e.state.associativeArrays??=new Set,e.state.associativeArrays.add(o)}let c=Array.from(e.state.env.keys()).some(e=>e.startsWith(`${o}_`)&&!e.startsWith(`${o}__length`));!e.state.env.has(o)&&!c&&(n||r?e.state.env.set(`${o}__length`,`0`):(e.state.declaredVars??=new Set,e.state.declaredVars.add(o))),te(o),i&&kE(e,o),a&&ME(e,o)}}return $(``,ne,b)}async function Qj(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r!==`-a`&&r!==`-A`&&r!==`-p`)if(r===`--`){n.push(...t.slice(e+1));break}else r.startsWith(`-`)||n.push(r)}if(n.length===0){let t=``,n=Array.from(e.state.readonlyVars||[]).sort();for(let r of n){let n=e.state.env.get(r);if(n!==void 0){let e=n.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t+=`declare -r ${r}="${e}"
972
+ `}}return Hk(t)}for(let t of n){let n=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(n){let t=n[1],r=n[2],i=jE(e,t);if(i)return i;let a=AA(r);if(e.state.associativeArrays?.has(t)){let n=jA(r);for(let[r,i]of n){let n=kj(e,i);e.state.env.set(`${t}_${r}`,n)}}else{let n=mT(e,t),r=0,i=e.state.env.get(t);n.length===0&&i!==void 0?(e.state.env.set(`${t}_0`,i),e.state.env.delete(t),r=1):n.length>0&&(r=Math.max(...n)+1);for(let n=0;n<a.length;n++)e.state.env.set(`${t}_${r+n}`,kj(e,a[n]));let o=r+a.length;e.state.env.set(`${t}__length`,String(o))}kE(e,t);continue}let r=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(r){let t=r[1],n=kj(e,r[2]),i=jE(e,t);if(i)return i;let a=e.state.env.get(t)??``;e.state.env.set(t,a+n),kE(e,t);continue}let i=MA(t);if(i.value===void 0&&!i.isArray){kE(e,i.name);continue}let a=await PA(e,i,{makeReadonly:!0});if(a)return a}return Vk}function $j(e){return e.state.directoryStack??=[],e.state.directoryStack}function eM(e,t){return t&&e===t?`~`:t&&e.startsWith(`${t}/`)?`~${e.slice(t.length)}`:e}function tM(e){let t=e.split(`/`).filter(e=>e&&e!==`.`),n=[];for(let e of t)e===`..`?n.pop():n.push(e);return`/${n.join(`/`)}`}async function nM(e,t){let n=$j(e),r;for(let e=0;e<t.length;e++){let n=t[e];if(n===`--`){if(e+1<t.length){if(r!==void 0)return Q(`bash: pushd: too many arguments
973
973
  `,2);r=t[e+1],e++}}else{if(n.startsWith(`-`)&&n!==`-`)return Q(`bash: pushd: ${n}: invalid option
974
974
  `,2);if(r!==void 0)return Q(`bash: pushd: too many arguments
975
975
  `,2);r=n}}if(r===void 0){if(n.length<2)return Q(`bash: pushd: no other directory
976
- `,1);let e=n[0];n[0]=n[1],n[1]=e,r=n[0]}let i;if(r.startsWith(`/`))i=r;else if(r===`..`){let t=e.state.cwd.split(`/`).filter(e=>e);t.pop(),i=`/${t.join(`/`)}`}else i=r===`.`?e.state.cwd:r.startsWith(`~`)?(e.state.env.get(`HOME`)||`/`)+r.slice(1):`${e.state.cwd}/${r}`;i=$j(i);try{if(!(await e.fs.stat(i)).isDirectory)return Q(`bash: pushd: ${r}: Not a directory
976
+ `,1);let e=n[0];n[0]=n[1],n[1]=e,r=n[0]}let i;if(r.startsWith(`/`))i=r;else if(r===`..`){let t=e.state.cwd.split(`/`).filter(e=>e);t.pop(),i=`/${t.join(`/`)}`}else i=r===`.`?e.state.cwd:r.startsWith(`~`)?(e.state.env.get(`HOME`)||`/`)+r.slice(1):`${e.state.cwd}/${r}`;i=tM(i);try{if(!(await e.fs.stat(i)).isDirectory)return Q(`bash: pushd: ${r}: Not a directory
977
977
  `,1)}catch{return Q(`bash: pushd: ${r}: No such file or directory
978
- `,1)}n.unshift(e.state.cwd),e.state.previousDir=e.state.cwd,e.state.cwd=i,e.state.env.set(`PWD`,i),e.state.env.set(`OLDPWD`,e.state.previousDir);let a=e.state.env.get(`HOME`)||``;return Bk(`${[i,...n].map(e=>Qj(e,a)).join(` `)}
979
- `)}function tM(e,t){let n=Zj(e);for(let e of t)if(e!==`--`)return e.startsWith(`-`)&&e!==`-`?Q(`bash: popd: ${e}: invalid option
978
+ `,1)}n.unshift(e.state.cwd),e.state.previousDir=e.state.cwd,e.state.cwd=i,e.state.env.set(`PWD`,i),e.state.env.set(`OLDPWD`,e.state.previousDir);let a=e.state.env.get(`HOME`)||``;return Hk(`${[i,...n].map(e=>eM(e,a)).join(` `)}
979
+ `)}function rM(e,t){let n=$j(e);for(let e of t)if(e!==`--`)return e.startsWith(`-`)&&e!==`-`?Q(`bash: popd: ${e}: invalid option
980
980
  `,2):Q(`bash: popd: too many arguments
981
981
  `,2);if(n.length===0)return Q(`bash: popd: directory stack empty
982
982
  `,1);let r=n.shift();if(!r)return Q(`bash: popd: directory stack empty
983
- `,1);e.state.previousDir=e.state.cwd,e.state.cwd=r,e.state.env.set(`PWD`,r),e.state.env.set(`OLDPWD`,e.state.previousDir);let i=e.state.env.get(`HOME`)||``;return Bk(`${[r,...n].map(e=>Qj(e,i)).join(` `)}
984
- `)}function nM(e,t){let n=Zj(e),r=!1,i=!1,a=!1,o=!1;for(let e of t)if(e!==`--`)if(e.startsWith(`-`))for(let t of e.slice(1))if(t===`c`)r=!0;else if(t===`l`)i=!0;else if(t===`p`)a=!0;else if(t===`v`)a=!0,o=!0;else return Q(`bash: dirs: -${t}: invalid option
983
+ `,1);e.state.previousDir=e.state.cwd,e.state.cwd=r,e.state.env.set(`PWD`,r),e.state.env.set(`OLDPWD`,e.state.previousDir);let i=e.state.env.get(`HOME`)||``;return Hk(`${[r,...n].map(e=>eM(e,i)).join(` `)}
984
+ `)}function iM(e,t){let n=$j(e),r=!1,i=!1,a=!1,o=!1;for(let e of t)if(e!==`--`)if(e.startsWith(`-`))for(let t of e.slice(1))if(t===`c`)r=!0;else if(t===`l`)i=!0;else if(t===`p`)a=!0;else if(t===`v`)a=!0,o=!0;else return Q(`bash: dirs: -${t}: invalid option
985
985
  `,2);else return Q(`bash: dirs: too many arguments
986
- `,1);if(r)return e.state.directoryStack=[],zk;let s=[e.state.cwd,...n],c=e.state.env.get(`HOME`)||``,l;return o?(l=s.map((e,t)=>` ${t} ${i?e:Qj(e,c)}`).join(`
986
+ `,1);if(r)return e.state.directoryStack=[],Vk;let s=[e.state.cwd,...n],c=e.state.env.get(`HOME`)||``,l;return o?(l=s.map((e,t)=>` ${t} ${i?e:eM(e,c)}`).join(`
987
987
  `),l+=`
988
- `):l=a?s.map(e=>i?e:Qj(e,c)).join(`
988
+ `):l=a?s.map(e=>i?e:eM(e,c)).join(`
989
989
  `)+`
990
- `:s.map(e=>i?e:Qj(e,c)).join(` `)+`
991
- `,Bk(l)}Gw(),A();async function rM(e,t,n){let r=t;if(r.length>0){let e=r[0];if(e===`--`)r=r.slice(1);else if(e.startsWith(`-`)&&e!==`-`&&e.length>1)return Q(`bash: eval: ${e}: invalid option
990
+ `:s.map(e=>i?e:eM(e,c)).join(` `)+`
991
+ `,Hk(l)}Qw(),A();async function aM(e,t,n){let r=t;if(r.length>0){let e=r[0];if(e===`--`)r=r.slice(1);else if(e.startsWith(`-`)&&e!==`-`&&e.length>1)return Q(`bash: eval: ${e}: invalid option
992
992
  eval: usage: eval [arg ...]
993
- `,2)}if(r.length===0)return zk;let i=r.join(` `);if(i.trim()===``)return zk;let a=e.state.groupStdin,o=n??e.state.groupStdin;o!==void 0&&(e.state.groupStdin=o);try{let t=Uw(i);return await e.executeScript(t)}catch(e){if(e instanceof jr||e instanceof Mr||e instanceof Nr||e instanceof Ir)throw e;if(e.name===`ParseException`)return Q(`bash: eval: ${e.message}
994
- `);throw e}finally{e.state.groupStdin=a}}A();function iM(e,t){let n,r=``;if(t.length===0)n=e.state.lastExitCode;else{let e=t[0],i=Number.parseInt(e,10);e===``||Number.isNaN(i)||!/^-?\d+$/.test(e)?(r=`bash: exit: ${e}: numeric argument required
995
- `,n=2):n=(i%256+256)%256}throw new Ir(n,``,r)}DE();function aM(e,t){let n=!1,r=[];for(let e of t)e===`-n`?n=!0:e===`-p`||e===`--`||r.push(e);if(r.length===0&&!n){let t=``,n=e.state.exportedVars??new Set,r=Array.from(n).sort();for(let n of r){let r=e.state.env.get(n);if(r!==void 0){let e=r.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t+=`declare -x ${n}="${e}"
996
- `}}return Bk(t)}if(n){for(let t of r){let n,r;if(t.includes(`=`)){let i=t.indexOf(`=`);n=t.slice(0,i),r=Dj(e,t.slice(i+1)),e.state.env.set(n,r)}else n=t;EE(e,n)}return zk}let i=``,a=0;for(let t of r){let n,r,o=!1,s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(s)n=s[1],r=Dj(e,s[2]),o=!0;else if(t.includes(`=`)){let i=t.indexOf(`=`);n=t.slice(0,i),r=Dj(e,t.slice(i+1))}else n=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)){i+=`bash: export: \`${t}': not a valid identifier
997
- `,a=1;continue}if(r!==void 0)if(o){let t=e.state.env.get(n)??``;e.state.env.set(n,t+r)}else e.state.env.set(n,r);else e.state.env.has(n)||e.state.env.set(n,``);TE(e,n)}return $(``,i,a)}function oM(e,t){if(t.length<2)return Q(`bash: getopts: usage: getopts optstring name [arg ...]
998
- `);let n=t[0],r=t[1],i=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),a=n.startsWith(`:`),o=a?n.slice(1):n,s;if(t.length>2)s=t.slice(2);else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);s=[];for(let n=1;n<=t;n++)s.push(e.state.env.get(String(n))||``)}let c=Number.parseInt(e.state.env.get(`OPTIND`)||`1`,10);c<1&&(c=1);let l=Number.parseInt(e.state.env.get(`__GETOPTS_CHARINDEX`)||`0`,10);if(e.state.env.set(`OPTARG`,``),c>s.length)return i||e.state.env.set(r,`?`),e.state.env.set(`OPTIND`,String(s.length+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),{exitCode:i?2:1,stdout:``,stderr:``};let u=s[c-1];if(!u||u===`-`||!u.startsWith(`-`))return i||e.state.env.set(r,`?`),{exitCode:i?2:1,stdout:``,stderr:``};if(u===`--`)return e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),i||e.state.env.set(r,`?`),{exitCode:i?2:1,stdout:``,stderr:``};let d=l===0?1:l,f=u[d];if(!f)return e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),oM(e,t);let p=o.indexOf(f);if(p===-1){let t=``;return a?e.state.env.set(`OPTARG`,f):t=`bash: illegal option -- ${f}
993
+ `,2)}if(r.length===0)return Vk;let i=r.join(` `);if(i.trim()===``)return Vk;let a=e.state.groupStdin,o=n??e.state.groupStdin;o!==void 0&&(e.state.groupStdin=o);try{let t=Xw(i);return await e.executeScript(t)}catch(e){if(e instanceof jr||e instanceof Mr||e instanceof Nr||e instanceof Ir)throw e;if(e.name===`ParseException`)return Q(`bash: eval: ${e.message}
994
+ `);throw e}finally{e.state.groupStdin=a}}A();function oM(e,t){let n,r=``;if(t.length===0)n=e.state.lastExitCode;else{let e=t[0],i=Number.parseInt(e,10);e===``||Number.isNaN(i)||!/^-?\d+$/.test(e)?(r=`bash: exit: ${e}: numeric argument required
995
+ `,n=2):n=(i%256+256)%256}throw new Ir(n,``,r)}PE();function sM(e,t){let n=!1,r=[];for(let e of t)e===`-n`?n=!0:e===`-p`||e===`--`||r.push(e);if(r.length===0&&!n){let t=``,n=e.state.exportedVars??new Set,r=Array.from(n).sort();for(let n of r){let r=e.state.env.get(n);if(r!==void 0){let e=r.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t+=`declare -x ${n}="${e}"
996
+ `}}return Hk(t)}if(n){for(let t of r){let n,r;if(t.includes(`=`)){let i=t.indexOf(`=`);n=t.slice(0,i),r=kj(e,t.slice(i+1)),e.state.env.set(n,r)}else n=t;NE(e,n)}return Vk}let i=``,a=0;for(let t of r){let n,r,o=!1,s=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(s)n=s[1],r=kj(e,s[2]),o=!0;else if(t.includes(`=`)){let i=t.indexOf(`=`);n=t.slice(0,i),r=kj(e,t.slice(i+1))}else n=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(n)){i+=`bash: export: \`${t}': not a valid identifier
997
+ `,a=1;continue}if(r!==void 0)if(o){let t=e.state.env.get(n)??``;e.state.env.set(n,t+r)}else e.state.env.set(n,r);else e.state.env.has(n)||e.state.env.set(n,``);ME(e,n)}return $(``,i,a)}function cM(e,t){if(t.length<2)return Q(`bash: getopts: usage: getopts optstring name [arg ...]
998
+ `);let n=t[0],r=t[1],i=!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r),a=n.startsWith(`:`),o=a?n.slice(1):n,s;if(t.length>2)s=t.slice(2);else{let t=Number.parseInt(e.state.env.get(`#`)||`0`,10);s=[];for(let n=1;n<=t;n++)s.push(e.state.env.get(String(n))||``)}let c=Number.parseInt(e.state.env.get(`OPTIND`)||`1`,10);c<1&&(c=1);let l=Number.parseInt(e.state.env.get(`__GETOPTS_CHARINDEX`)||`0`,10);if(e.state.env.set(`OPTARG`,``),c>s.length)return i||e.state.env.set(r,`?`),e.state.env.set(`OPTIND`,String(s.length+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),{exitCode:i?2:1,stdout:``,stderr:``};let u=s[c-1];if(!u||u===`-`||!u.startsWith(`-`))return i||e.state.env.set(r,`?`),{exitCode:i?2:1,stdout:``,stderr:``};if(u===`--`)return e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),i||e.state.env.set(r,`?`),{exitCode:i?2:1,stdout:``,stderr:``};let d=l===0?1:l,f=u[d];if(!f)return e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),cM(e,t);let p=o.indexOf(f);if(p===-1){let t=``;return a?e.state.env.set(`OPTARG`,f):t=`bash: illegal option -- ${f}
999
999
  `,i||e.state.env.set(r,`?`),d+1<u.length?(e.state.env.set(`__GETOPTS_CHARINDEX`,String(d+1)),e.state.env.set(`OPTIND`,String(c))):(e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`)),{exitCode:i?2:0,stdout:``,stderr:t}}if(p+1<o.length&&o[p+1]===`:`)if(d+1<u.length)e.state.env.set(`OPTARG`,u.slice(d+1)),e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`);else{if(c>=s.length){let t=``;return a?(e.state.env.set(`OPTARG`,f),i||e.state.env.set(r,`:`)):(t=`bash: option requires an argument -- ${f}
1000
- `,i||e.state.env.set(r,`?`)),e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),{exitCode:i?2:0,stdout:``,stderr:t}}e.state.env.set(`OPTARG`,s[c]),e.state.env.set(`OPTIND`,String(c+2)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`)}else d+1<u.length?(e.state.env.set(`__GETOPTS_CHARINDEX`,String(d+1)),e.state.env.set(`OPTIND`,String(c))):(e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`));return i||e.state.env.set(r,f),{exitCode:i?2:0,stdout:``,stderr:``}}async function sM(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,i=!1,a=!1,o=!1,s=``,c=[],l=0;for(;l<t.length;){let e=t[l];if(e===`--`){l++,c.push(...t.slice(l));break}if(e===`-r`)n=!0,l++;else if(e===`-d`)r=!0,l++;else if(e===`-l`)i=!0,l++;else if(e===`-t`)o=!0,l++;else if(e===`-p`){if(a=!0,l++,l>=t.length)return Q(`bash: hash: -p: option requires an argument
1000
+ `,i||e.state.env.set(r,`?`)),e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`),{exitCode:i?2:0,stdout:``,stderr:t}}e.state.env.set(`OPTARG`,s[c]),e.state.env.set(`OPTIND`,String(c+2)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`)}else d+1<u.length?(e.state.env.set(`__GETOPTS_CHARINDEX`,String(d+1)),e.state.env.set(`OPTIND`,String(c))):(e.state.env.set(`OPTIND`,String(c+1)),e.state.env.set(`__GETOPTS_CHARINDEX`,`0`));return i||e.state.env.set(r,f),{exitCode:i?2:0,stdout:``,stderr:``}}async function lM(e,t){e.state.hashTable||(e.state.hashTable=new Map);let n=!1,r=!1,i=!1,a=!1,o=!1,s=``,c=[],l=0;for(;l<t.length;){let e=t[l];if(e===`--`){l++,c.push(...t.slice(l));break}if(e===`-r`)n=!0,l++;else if(e===`-d`)r=!0,l++;else if(e===`-l`)i=!0,l++;else if(e===`-t`)o=!0,l++;else if(e===`-p`){if(a=!0,l++,l>=t.length)return Q(`bash: hash: -p: option requires an argument
1001
1001
  `,1);s=t[l],l++}else if(e.startsWith(`-`)&&e.length>1){for(let t of e.slice(1))if(t===`r`)n=!0;else if(t===`d`)r=!0;else if(t===`l`)i=!0;else if(t===`t`)o=!0;else return Q(t===`p`?`bash: hash: -p: option requires an argument
1002
1002
  `:`bash: hash: -${t}: invalid option
1003
- `,1);l++}else c.push(e),l++}if(n)return e.state.hashTable.clear(),zk;if(r){if(c.length===0)return Q(`bash: hash: -d: option requires an argument
1003
+ `,1);l++}else c.push(e),l++}if(n)return e.state.hashTable.clear(),Vk;if(r){if(c.length===0)return Q(`bash: hash: -d: option requires an argument
1004
1004
  `,1);let t=!1,n=``;for(let r of c)e.state.hashTable.has(r)?e.state.hashTable.delete(r):(n+=`bash: hash: ${r}: not found
1005
- `,t=!0);return t?Q(n,1):zk}if(o){if(c.length===0)return Q(`bash: hash: -t: option requires an argument
1005
+ `,t=!0);return t?Q(n,1):Vk}if(o){if(c.length===0)return Q(`bash: hash: -t: option requires an argument
1006
1006
  `,1);let t=``,n=!1,r=``;for(let i of c){let a=e.state.hashTable.get(i);a?c.length>1?t+=`${i} ${a}
1007
1007
  `:t+=`${a}
1008
1008
  `:(r+=`bash: hash: ${i}: not found
1009
- `,n=!0)}return n?{exitCode:1,stdout:t,stderr:r}:Bk(t)}if(a){if(c.length===0)return Q(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
1010
- `,1);let t=c[0];return e.state.hashTable.set(t,s),zk}if(c.length===0){if(e.state.hashTable.size===0)return Bk(`hash: hash table empty
1009
+ `,n=!0)}return n?{exitCode:1,stdout:t,stderr:r}:Hk(t)}if(a){if(c.length===0)return Q(`bash: hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
1010
+ `,1);let t=c[0];return e.state.hashTable.set(t,s),Vk}if(c.length===0){if(e.state.hashTable.size===0)return Hk(`hash: hash table empty
1011
1011
  `);let t=``;if(i)for(let[n,r]of e.state.hashTable)t+=`builtin hash -p ${r} ${n}
1012
1012
  `;else{t=`hits command
1013
1013
  `;for(let[,n]of e.state.hashTable)t+=` 1 ${n}
1014
- `}return Bk(t)}let u=!1,d=``,f=(e.state.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`);for(let t of c){if(t.includes(`/`)){d+=`bash: hash: ${t}: cannot use / in name
1014
+ `}return Hk(t)}let u=!1,d=``,f=(e.state.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`);for(let t of c){if(t.includes(`/`)){d+=`bash: hash: ${t}: cannot use / in name
1015
1015
  `,u=!0;continue}let n=!1;for(let r of f){if(!r)continue;let i=`${r}/${t}`;if(await e.fs.exists(i)){e.state.hashTable.set(t,i),n=!0;break}}n||(d+=`bash: hash: ${t}: not found
1016
- `,u=!0)}return u?Q(d,1):zk}Ss();var cM=new Map([[`:`,[`: [arguments]`,`Null command.
1016
+ `,u=!0)}return u?Q(d,1):Vk}xs();var uM=new Map([[`:`,[`: [arguments]`,`Null command.
1017
1017
  No effect; the command does nothing.
1018
1018
  Exit Status:
1019
1019
  Always succeeds.`]],[`.`,[`. filename [arguments]`,`Execute commands from a file in the current shell.
@@ -1360,33 +1360,33 @@ eval: usage: eval [arg ...]
1360
1360
  job specification, and reports its termination status.
1361
1361
  Exit Status:
1362
1362
  Returns the status of the last ID; fails if ID is invalid or an invalid
1363
- option is given.`]]]),lM=[...cM.keys()].sort();function uM(e,t){let n=!1,r=[],i=0;for(;i<t.length;){let e=t[i];if(e===`--`){for(i++;i<t.length;)r.push(t[i]),i++;break}if(e.startsWith(`-`)&&e.length>1){for(let t=1;t<e.length;t++){let r=e[t];if(r===`s`)n=!0;else return Q(`bash: help: -${r}: invalid option
1364
- `,2)}i++}else r.push(e),i++}if(r.length===0)return fM();let a=``,o=!1,s=``;for(let e of r){let t=dM(e);if(t.length===0){s+=`bash: help: no help topics match \`${e}'. Try \`help help' or \`man -k ${e}' or \`info ${e}'.
1365
- `,o=!0;continue}for(let e of t){let t=cM.get(e);if(!t)continue;let[r,i]=t;n?a+=`${e}: ${r}
1363
+ option is given.`]]]),dM=[...uM.keys()].sort();function fM(e,t){let n=!1,r=[],i=0;for(;i<t.length;){let e=t[i];if(e===`--`){for(i++;i<t.length;)r.push(t[i]),i++;break}if(e.startsWith(`-`)&&e.length>1){for(let t=1;t<e.length;t++){let r=e[t];if(r===`s`)n=!0;else return Q(`bash: help: -${r}: invalid option
1364
+ `,2)}i++}else r.push(e),i++}if(r.length===0)return mM();let a=``,o=!1,s=``;for(let e of r){let t=pM(e);if(t.length===0){s+=`bash: help: no help topics match \`${e}'. Try \`help help' or \`man -k ${e}' or \`info ${e}'.
1365
+ `,o=!0;continue}for(let e of t){let t=uM.get(e);if(!t)continue;let[r,i]=t;n?a+=`${e}: ${r}
1366
1366
  `:a+=`${e}: ${r}
1367
1367
  ${i}
1368
- `}}return{exitCode:+!!o,stdout:a,stderr:s}}function dM(e){let t=R(`^${e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`)}$`);return lM.filter(e=>t.test(e))}function fM(){let e=[];e.push(`just-bash shell builtins`),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push(``);let t=lM.slice(),n=Math.ceil(t.length/2);for(let r=0;r<n;r++){let i=t[r]||``,a=t[r+n]||``,o=i.padEnd(36);e.push(a?`${o}${a}`:i)}return Bk(`${e.join(`
1368
+ `}}return{exitCode:+!!o,stdout:a,stderr:s}}function pM(e){let t=z(`^${e.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`).replace(/\?/g,`.`)}$`);return dM.filter(e=>t.test(e))}function mM(){let e=[];e.push(`just-bash shell builtins`),e.push("These shell commands are defined internally. Type `help' to see this list."),e.push("Type `help name' to find out more about the function `name'."),e.push(``);let t=dM.slice(),n=Math.ceil(t.length/2);for(let r=0;r<n;r++){let i=t[r]||``,a=t[r+n]||``,o=i.padEnd(36);e.push(a?`${o}${a}`:i)}return Hk(`${e.join(`
1369
1369
  `)}
1370
- `)}Gw(),BO();function pM(e){let t=[],n=``,r=0;for(let i of e){for(let e of i)e===`(`?r++:e===`)`&&r--;n?n+=` ${i}`:n=i,r===0&&(t.push(n),n=``)}return n&&t.push(n),t}async function mM(e,t){if(t.length===0)return Q(`bash: let: expression expected
1371
- `);let n=pM(t),r=0;for(let t of n)try{let n=Uw(`(( ${t} ))`).statements[0];if(n&&n.pipelines.length>0&&n.pipelines[0].commands.length>0){let t=n.pipelines[0].commands[0];t.type===`ArithmeticCommand`&&(r=await Z(e,t.expression.expression))}}catch(e){return Q(`bash: let: ${t}: ${e.message}
1372
- `)}return $(``,``,+(r===0))}zC(),Gw(),BO(),mT(),RT(),DE();async function hM(e,t){if(e.state.localScopes.length===0)return Q(`bash: local: can only be used in a function
1370
+ `)}Qw(),qO();function hM(e){let t=[],n=``,r=0;for(let i of e){for(let e of i)e===`(`?r++:e===`)`&&r--;n?n+=` ${i}`:n=i,r===0&&(t.push(n),n=``)}return n&&t.push(n),t}async function gM(e,t){if(t.length===0)return Q(`bash: let: expression expected
1371
+ `);let n=hM(t),r=0;for(let t of n)try{let n=Xw(`(( ${t} ))`).statements[0];if(n&&n.pipelines.length>0&&n.pipelines[0].commands.length>0){let t=n.pipelines[0].commands[0];t.type===`ArithmeticCommand`&&(r=await Z(e,t.expression.expression))}}catch(e){return Q(`bash: let: ${t}: ${e.message}
1372
+ `)}return $(``,``,+(r===0))}KC(),Qw(),qO(),xT(),GT(),PE();async function _M(e,t){if(e.state.localScopes.length===0)return Q(`bash: local: can only be used in a function
1373
1373
  `);let n=e.state.localScopes[e.state.localScopes.length-1],r=``,i=0,a=!1,o=!1,s=[];for(let e of t)if(e===`-n`)a=!0;else if(e===`-a`)o=!0;else if(e!==`-p`)if(e.startsWith(`-`)&&!e.includes(`=`))for(let t of e.slice(1))t===`n`?a=!0:t===`a`&&(o=!0);else s.push(e);if(s.length===0){let t=``,r=Array.from(n.keys()).filter(e=>!e.includes(`_`)||!e.match(/_\d+$/)).filter(e=>!e.includes(`__length`)).sort();for(let n of r){let r=e.state.env.get(n);r!==void 0&&(t+=`${n}=${r}
1374
1374
  `)}return $(t,``,0)}for(let t of s){let s,c,l=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\((.*)\)$/s);if(l){s=l[1];let o=l[2];if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){r+=`bash: local: \`${t}': not a valid identifier
1375
- `,i=1;continue}if(wE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)))}let c=`${s}_`;for(let t of e.state.env.keys())t.startsWith(c)&&!t.includes(`__`)&&e.state.env.delete(t);let u=OA(o);for(let t=0;t<u.length;t++)e.state.env.set(`${s}_${t}`,u[t]);e.state.env.set(`${s}__length`,String(u.length)),NA(e,s),a&&kT(e,s);continue}let u=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(u){s=u[1];let t=u[2];if(wE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}let r=OA(t),i=sT(e,s),o=0,c=e.state.env.get(s);i.length===0&&c!==void 0?(e.state.env.set(`${s}_0`,c),e.state.env.delete(s),o=1):i.length>0&&(o=Math.max(...i)+1);for(let t=0;t<r.length;t++)e.state.env.set(`${s}_${o+t}`,Dj(e,r[t]));let l=o+r.length;e.state.env.set(`${s}__length`,String(l)),NA(e,s),a&&kT(e,s);continue}let d=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){s=d[1];let t=Dj(e,d[2]);wE(e,s,`bash`),n.has(s)||n.set(s,e.state.env.get(s));let r=e.state.env.get(s)??``;e.state.env.set(s,r+t),NA(e,s),a&&kT(e,s);continue}let f=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(f){s=f[1];let t=f[2],r=Dj(e,f[3]);if(wE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}let i;try{i=await Z(e,vC(new Ww,t).expression)}catch{let e=parseInt(t,10);i=Number.isNaN(e)?0:e}e.state.env.set(`${s}_${i}`,r);let o=parseInt(e.state.env.get(`${s}__length`)??`0`,10);i>=o&&e.state.env.set(`${s}__length`,String(i+1)),NA(e,s),a&&kT(e,s);continue}if(t.includes(`=`)){let n=t.indexOf(`=`);s=t.slice(0,n),c=Dj(e,t.slice(n+1))}else s=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){r+=`bash: local: \`${t}': not a valid identifier
1376
- `,i=1;continue}let p=n.has(s);if(c!==void 0){let t=e.state.env.get(s);if(e.state.tempEnvBindings){let n=e.state.accessedTempEnvVars?.has(s),r=e.state.mutatedTempEnvVars?.has(s);if(!n&&!r)for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(s)){t=r.get(s);break}}}IA(e,s,t)}if(!p){let t=e.state.env.get(s);if(e.state.tempEnvBindings)for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(s)){t=r.get(s);break}}if(n.set(s,t),o){let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}}if(o&&c===void 0){let t=`${s}_`;for(let n of e.state.env.keys())n.startsWith(t)&&!n.includes(`__`)&&e.state.env.delete(n);e.state.env.set(`${s}__length`,`0`)}else if(c!==void 0){if(wE(e,s,`bash`),a&&c!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(c)){r+=`bash: local: \`${c}': invalid variable name for name reference
1377
- `,i=1;continue}e.state.env.set(s,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(s))}else{let t=e.state.tempEnvBindings?.some(e=>e.has(s));!p&&!t&&e.state.env.delete(s)}NA(e,s),a&&kT(e,s)}return $(``,r,i)}mT();function gM(e,t,n){let r=`
1375
+ `,i=1;continue}if(jE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)))}let c=`${s}_`;for(let t of e.state.env.keys())t.startsWith(c)&&!t.includes(`__`)&&e.state.env.delete(t);let u=AA(o);for(let t=0;t<u.length;t++)e.state.env.set(`${s}_${t}`,u[t]);e.state.env.set(`${s}__length`,String(u.length)),FA(e,s),a&&IT(e,s);continue}let u=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=\((.*)\)$/s);if(u){s=u[1];let t=u[2];if(jE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}let r=AA(t),i=mT(e,s),o=0,c=e.state.env.get(s);i.length===0&&c!==void 0?(e.state.env.set(`${s}_0`,c),e.state.env.delete(s),o=1):i.length>0&&(o=Math.max(...i)+1);for(let t=0;t<r.length;t++)e.state.env.set(`${s}_${o+t}`,kj(e,r[t]));let l=o+r.length;e.state.env.set(`${s}__length`,String(l)),FA(e,s),a&&IT(e,s);continue}let d=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\+=(.*)$/);if(d){s=d[1];let t=kj(e,d[2]);jE(e,s,`bash`),n.has(s)||n.set(s,e.state.env.get(s));let r=e.state.env.get(s)??``;e.state.env.set(s,r+t),FA(e,s),a&&IT(e,s);continue}let f=t.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[([^\]]+)\]=(.*)$/s);if(f){s=f[1];let t=f[2],r=kj(e,f[3]);if(jE(e,s,`bash`),!n.has(s)){n.set(s,e.state.env.get(s));let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}let i;try{i=await Z(e,TC(new Zw,t).expression)}catch{let e=parseInt(t,10);i=Number.isNaN(e)?0:e}e.state.env.set(`${s}_${i}`,r);let o=parseInt(e.state.env.get(`${s}__length`)??`0`,10);i>=o&&e.state.env.set(`${s}__length`,String(i+1)),FA(e,s),a&&IT(e,s);continue}if(t.includes(`=`)){let n=t.indexOf(`=`);s=t.slice(0,n),c=kj(e,t.slice(n+1))}else s=t;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s)){r+=`bash: local: \`${t}': not a valid identifier
1376
+ `,i=1;continue}let p=n.has(s);if(c!==void 0){let t=e.state.env.get(s);if(e.state.tempEnvBindings){let n=e.state.accessedTempEnvVars?.has(s),r=e.state.mutatedTempEnvVars?.has(s);if(!n&&!r)for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(s)){t=r.get(s);break}}}RA(e,s,t)}if(!p){let t=e.state.env.get(s);if(e.state.tempEnvBindings)for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(s)){t=r.get(s);break}}if(n.set(s,t),o){let t=`${s}_`;for(let r of e.state.env.keys())r.startsWith(t)&&!r.includes(`__`)&&(n.has(r)||n.set(r,e.state.env.get(r)));let r=`${s}__length`;e.state.env.has(r)&&!n.has(r)&&n.set(r,e.state.env.get(r))}}if(o&&c===void 0){let t=`${s}_`;for(let n of e.state.env.keys())n.startsWith(t)&&!n.includes(`__`)&&e.state.env.delete(n);e.state.env.set(`${s}__length`,`0`)}else if(c!==void 0){if(jE(e,s,`bash`),a&&c!==``&&!/^[a-zA-Z_][a-zA-Z0-9_]*(\[.+\])?$/.test(c)){r+=`bash: local: \`${c}': invalid variable name for name reference
1377
+ `,i=1;continue}e.state.env.set(s,c),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(s))}else{let t=e.state.tempEnvBindings?.some(e=>e.has(s));!p&&!t&&e.state.env.delete(s)}FA(e,s),a&&IT(e,s)}return $(``,r,i)}xT();function vM(e,t,n){let r=`
1378
1378
  `,i=0,a=0,o=0,s=!1,c=`MAPFILE`,l=0;for(;l<t.length;){let e=t[l];e===`-d`&&l+1<t.length?(r=t[l+1]===``?`\0`:t[l+1]||`
1379
1379
  `,l+=2):e===`-n`&&l+1<t.length?(i=Number.parseInt(t[l+1],10)||0,l+=2):e===`-O`&&l+1<t.length?(a=Number.parseInt(t[l+1],10)||0,l+=2):e===`-s`&&l+1<t.length?(o=Number.parseInt(t[l+1],10)||0,l+=2):e===`-t`?(s=!0,l++):e===`-u`||e===`-C`||e===`-c`?l+=2:(e.startsWith(`-`)||(c=e),l++)}let u=n;!u&&e.state.groupStdin!==void 0&&(u=e.state.groupStdin);let d=[],f=u,p=0,m=0,h=e.limits?.maxArrayElements??1e5;for(;f.length>0;){let e=f.indexOf(r);if(e===-1){if(f.length>0){if(m<o)m++;else if(i===0||p<i){if(a+p>=h)return $(``,`mapfile: array element limit exceeded (${h})
1380
1380
  `,1);let e=f,t=e.indexOf(`\0`);t!==-1&&(e=e.substring(0,t)),d.push(e),p++}}break}let t=f.substring(0,e),n=t.indexOf(`\0`);if(n!==-1&&(t=t.substring(0,n)),!s&&r!==`\0`&&(t+=r),f=f.substring(e+r.length),m<o){m++;continue}if(i>0&&p>=i)break;if(a+p>=h)return $(``,`mapfile: array element limit exceeded (${h})
1381
- `,1);d.push(t),p++}a===0&&cT(e,c);for(let t=0;t<d.length;t++)e.state.env.set(`${c}_${a+t}`,d[t]);let g=parseInt(e.state.env.get(`${c}__length`)||`0`,10),_=a+d.length;return e.state.env.set(`${c}__length`,String(Math.max(g,_))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=``),$(``,``,0)}mT(),DT();function _M(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}function vM(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function yM(e,t,n,r=-1){let i=!1,a=`
1382
- `,o=-1,s=-1,c=null,l=-1,u=-1,d=[],f=0,p=!1,m=(e,n)=>{let r=1;for(;r<e.length;){let d=e[r];if(d===`r`)i=!0,r++;else if(d===`s`)r++;else{if(d===`d`)return r+1<e.length?(a=e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(a=t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`n`){if(r+1<e.length){let t=e.substring(r+1);return o=Number.parseInt(t,10),(Number.isNaN(o)||o<0)&&(p=!0,o=0),{nextArgIndex:n+1}}else if(n+1<t.length)return o=Number.parseInt(t[n+1],10),(Number.isNaN(o)||o<0)&&(p=!0,o=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`N`){if(r+1<e.length){let t=e.substring(r+1);return s=Number.parseInt(t,10),(Number.isNaN(s)||s<0)&&(p=!0,s=0),{nextArgIndex:n+1}}else if(n+1<t.length)return s=Number.parseInt(t[n+1],10),(Number.isNaN(s)||s<0)&&(p=!0,s=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else{if(d===`a`)return r+1<e.length?(c=e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(c=t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`p`)return r+1<e.length?(e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`u`){if(r+1<e.length){let t=e.substring(r+1);return l=Number.parseInt(t,10),Number.isNaN(l)||l<0?{nextArgIndex:-2}:{nextArgIndex:n+1}}else if(n+1<t.length)return l=Number.parseInt(t[n+1],10),Number.isNaN(l)||l<0?{nextArgIndex:-2}:{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`t`){if(r+1<e.length){let t=e.substring(r+1);return u=Number.parseFloat(t),Number.isNaN(u)&&(u=0),{nextArgIndex:n+1}}else if(n+1<t.length)return u=Number.parseFloat(t[n+1]),Number.isNaN(u)&&(u=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`e`||d===`i`||d===`P`){if(d===`i`&&n+1<t.length)return{nextArgIndex:n+2};r++}else r++}}}return{nextArgIndex:n+1}};for(;f<t.length;){let e=t[f];if(e.startsWith(`-`)&&e.length>1&&e!==`--`){let t=m(e,f);if(t.nextArgIndex===-1)return{stdout:``,stderr:``,exitCode:2};if(t.nextArgIndex===-2)return{stdout:``,stderr:``,exitCode:1};f=t.nextArgIndex}else if(e===`--`)for(f++;f<t.length;)d.push(t[f]),f++;else d.push(e),f++}if(p)return $(``,``,1);if(d.length===0&&c===null&&d.push(`REPLY`),u===0){if(c)cT(e,c);else{for(let t of d)e.state.env.set(t,``);d.length===0&&e.state.env.set(`REPLY`,``)}return $(``,``,0)}if(u<0&&u!==-1)return $(``,``,1);let h=n;l>=0?h=e.state.fileDescriptors&&e.state.fileDescriptors.get(l)||``:!h&&e.state.groupStdin!==void 0&&(h=e.state.groupStdin);let g=a===``?`\0`:a,_=``,v=0,y=!0,ee=t=>{if(l>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(l,h.substring(t));else if(r>=0&&e.state.fileDescriptors){let n=e.state.fileDescriptors.get(r);if(n?.startsWith(`__rw__:`)){let i=_M(n);if(i){let n=i.position+t;e.state.fileDescriptors.set(r,vM(i.path,n,i.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=h.substring(t))};if(s>=0){let t=Math.min(s,h.length);_=h.substring(0,t),v=t,y=t>=s,ee(v);let n=d[0]||`REPLY`;e.state.env.set(n,_);for(let t=1;t<d.length;t++)e.state.env.set(d[t],``);return $(``,``,+!y)}else if(o>=0){let e=0,t=0,n=!1;for(;t<h.length&&e<o;){let r=h[t];if(r===g){v=t+1,n=!0;break}if(!i&&r===`\\`&&t+1<h.length){let n=h[t+1];if(n===g&&g===`
1381
+ `,1);d.push(t),p++}a===0&&hT(e,c);for(let t=0;t<d.length;t++)e.state.env.set(`${c}_${a+t}`,d[t]);let g=parseInt(e.state.env.get(`${c}__length`)||`0`,10),_=a+d.length;return e.state.env.set(`${c}__length`,String(Math.max(g,_))),e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=``),$(``,``,0)}xT(),PT();function yM(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}function bM(e,t,n){return`__rw__:${e.length}:${e}:${t}:${n}`}function xM(e,t,n,r=-1){let i=!1,a=`
1382
+ `,o=-1,s=-1,c=null,l=-1,u=-1,d=[],f=0,p=!1,m=(e,n)=>{let r=1;for(;r<e.length;){let d=e[r];if(d===`r`)i=!0,r++;else if(d===`s`)r++;else{if(d===`d`)return r+1<e.length?(a=e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(a=t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`n`){if(r+1<e.length){let t=e.substring(r+1);return o=Number.parseInt(t,10),(Number.isNaN(o)||o<0)&&(p=!0,o=0),{nextArgIndex:n+1}}else if(n+1<t.length)return o=Number.parseInt(t[n+1],10),(Number.isNaN(o)||o<0)&&(p=!0,o=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`N`){if(r+1<e.length){let t=e.substring(r+1);return s=Number.parseInt(t,10),(Number.isNaN(s)||s<0)&&(p=!0,s=0),{nextArgIndex:n+1}}else if(n+1<t.length)return s=Number.parseInt(t[n+1],10),(Number.isNaN(s)||s<0)&&(p=!0,s=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else{if(d===`a`)return r+1<e.length?(c=e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(c=t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`p`)return r+1<e.length?(e.substring(r+1),{nextArgIndex:n+1}):n+1<t.length?(t[n+1],{nextArgIndex:n+2}):{nextArgIndex:n+1};if(d===`u`){if(r+1<e.length){let t=e.substring(r+1);return l=Number.parseInt(t,10),Number.isNaN(l)||l<0?{nextArgIndex:-2}:{nextArgIndex:n+1}}else if(n+1<t.length)return l=Number.parseInt(t[n+1],10),Number.isNaN(l)||l<0?{nextArgIndex:-2}:{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`t`){if(r+1<e.length){let t=e.substring(r+1);return u=Number.parseFloat(t),Number.isNaN(u)&&(u=0),{nextArgIndex:n+1}}else if(n+1<t.length)return u=Number.parseFloat(t[n+1]),Number.isNaN(u)&&(u=0),{nextArgIndex:n+2};return{nextArgIndex:n+1}}else if(d===`e`||d===`i`||d===`P`){if(d===`i`&&n+1<t.length)return{nextArgIndex:n+2};r++}else r++}}}return{nextArgIndex:n+1}};for(;f<t.length;){let e=t[f];if(e.startsWith(`-`)&&e.length>1&&e!==`--`){let t=m(e,f);if(t.nextArgIndex===-1)return{stdout:``,stderr:``,exitCode:2};if(t.nextArgIndex===-2)return{stdout:``,stderr:``,exitCode:1};f=t.nextArgIndex}else if(e===`--`)for(f++;f<t.length;)d.push(t[f]),f++;else d.push(e),f++}if(p)return $(``,``,1);if(d.length===0&&c===null&&d.push(`REPLY`),u===0){if(c)hT(e,c);else{for(let t of d)e.state.env.set(t,``);d.length===0&&e.state.env.set(`REPLY`,``)}return $(``,``,0)}if(u<0&&u!==-1)return $(``,``,1);let h=n;l>=0?h=e.state.fileDescriptors&&e.state.fileDescriptors.get(l)||``:!h&&e.state.groupStdin!==void 0&&(h=e.state.groupStdin);let g=a===``?`\0`:a,_=``,v=0,y=!0,ee=t=>{if(l>=0&&e.state.fileDescriptors)e.state.fileDescriptors.set(l,h.substring(t));else if(r>=0&&e.state.fileDescriptors){let n=e.state.fileDescriptors.get(r);if(n?.startsWith(`__rw__:`)){let i=yM(n);if(i){let n=i.position+t;e.state.fileDescriptors.set(r,bM(i.path,n,i.content))}}}else e.state.groupStdin!==void 0&&!n&&(e.state.groupStdin=h.substring(t))};if(s>=0){let t=Math.min(s,h.length);_=h.substring(0,t),v=t,y=t>=s,ee(v);let n=d[0]||`REPLY`;e.state.env.set(n,_);for(let t=1;t<d.length;t++)e.state.env.set(d[t],``);return $(``,``,+!y)}else if(o>=0){let e=0,t=0,n=!1;for(;t<h.length&&e<o;){let r=h[t];if(r===g){v=t+1,n=!0;break}if(!i&&r===`\\`&&t+1<h.length){let n=h[t+1];if(n===g&&g===`
1383
1383
  `){t+=2,v=t;continue}if(n===g){t+=2,e++,_+=n,v=t;continue}_+=n,t+=2,e++,v=t}else _+=r,t++,e++,v=t}y=e>=o||n,ee(v)}else{v=0;let t=0;for(;t<h.length;){let e=h[t];if(e===g){v=t+g.length,y=!0;break}if(!i&&e===`\\`&&t+1<h.length){let n=h[t+1];if(n===`
1384
- `){t+=2;continue}if(n===g){_+=n,t+=2;continue}_+=e,_+=n,t+=2;continue}_+=e,t++}if(t>=h.length&&(y=!1,v=t,_.length===0&&h.length===0)){for(let t of d)e.state.env.set(t,``);return c&&cT(e,c),$(``,``,1)}ee(v)}g===`
1384
+ `){t+=2;continue}if(n===g){_+=n,t+=2;continue}_+=e,_+=n,t+=2;continue}_+=e,t++}if(t>=h.length&&(y=!1,v=t,_.length===0&&h.length===0)){for(let t of d)e.state.env.set(t,``);return c&&hT(e,c),$(``,``,1)}ee(v)}g===`
1385
1385
  `&&_.endsWith(`
1386
- `)&&(_=_.slice(0,-1));let te=e=>i?e:e.replace(/\\(.)/g,`$1`);if(d.length===1&&d[0]===`REPLY`)return e.state.env.set(`REPLY`,te(_)),$(``,``,+!y);let ne=hT(e.state.env);if(c){let{words:t}=xT(_,ne,void 0,i),n=e.limits?.maxArrayElements??1e5;if(t.length>n)return $(``,`read: array element limit exceeded (${n})
1387
- `,1);cT(e,c);for(let n=0;n<t.length;n++)e.state.env.set(`${c}_${n}`,te(t[n]));return $(``,``,+!y)}let b=d.length,{words:re,wordStarts:x}=xT(_,ne,b,i);for(let t=0;t<d.length;t++){let n=d[t];if(t<d.length-1)e.state.env.set(n,te(re[t]??``));else if(t<x.length){let r=_.substring(x[t]);r=TT(r,ne,i),r=te(r),e.state.env.set(n,r)}else e.state.env.set(n,``)}return $(``,``,+!y)}A();function bM(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return Q(`bash: return: can only \`return' from a function or sourced script
1386
+ `)&&(_=_.slice(0,-1));let te=e=>i?e:e.replace(/\\(.)/g,`$1`);if(d.length===1&&d[0]===`REPLY`)return e.state.env.set(`REPLY`,te(_)),$(``,``,+!y);let ne=ST(e.state.env);if(c){let{words:t}=OT(_,ne,void 0,i),n=e.limits?.maxArrayElements??1e5;if(t.length>n)return $(``,`read: array element limit exceeded (${n})
1387
+ `,1);hT(e,c);for(let n=0;n<t.length;n++)e.state.env.set(`${c}_${n}`,te(t[n]));return $(``,``,+!y)}let b=d.length,{words:re,wordStarts:x}=OT(_,ne,b,i);for(let t=0;t<d.length;t++){let n=d[t];if(t<d.length-1)e.state.env.set(n,te(re[t]??``));else if(t<x.length){let r=_.substring(x[t]);r=MT(r,ne,i),r=te(r),e.state.env.set(n,r)}else e.state.env.set(n,``)}return $(``,``,+!y)}A();function SM(e,t){if(e.state.callDepth===0&&e.state.sourceDepth===0)return Q(`bash: return: can only \`return' from a function or sourced script
1388
1388
  `);let n=e.state.lastExitCode;if(t.length>0){let e=t[0],r=Number.parseInt(e,10);if(e===``||Number.isNaN(r)||!/^-?\d+$/.test(e))return Q(`bash: return: ${e}: numeric argument required
1389
- `,2);n=(r%256+256)%256}throw new Nr(n)}A(),mT();var xM=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1389
+ `,2);n=(r%256+256)%256}throw new Nr(n)}A(),xT();var CM=`set: usage: set [-eux] [+eux] [-o option] [+o option]
1390
1390
  Options:
1391
1391
  -e Exit immediately if a command exits with non-zero status
1392
1392
  +e Disable -e
@@ -1402,57 +1402,57 @@ Options:
1402
1402
  +o pipefail Disable pipefail
1403
1403
  -o xtrace Same as -x
1404
1404
  +o xtrace Disable xtrace
1405
- `,SM=new Map([[`e`,`errexit`],[`u`,`nounset`],[`x`,`xtrace`],[`v`,`verbose`],[`f`,`noglob`],[`C`,`noclobber`],[`a`,`allexport`],[`n`,`noexec`],[`h`,null],[`b`,null],[`m`,null],[`B`,null],[`H`,null],[`P`,null],[`T`,null],[`E`,null],[`p`,null]]),CM=new Map([[`errexit`,`errexit`],[`pipefail`,`pipefail`],[`nounset`,`nounset`],[`xtrace`,`xtrace`],[`verbose`,`verbose`],[`noclobber`,`noclobber`],[`noglob`,`noglob`],[`allexport`,`allexport`],[`noexec`,`noexec`],[`posix`,`posix`],[`vi`,`vi`],[`emacs`,`emacs`],[`notify`,null],[`monitor`,null],[`braceexpand`,null],[`histexpand`,null],[`physical`,null],[`functrace`,null],[`errtrace`,null],[`privileged`,null],[`hashall`,null],[`ignoreeof`,null],[`interactive-comments`,null],[`keyword`,null],[`onecmd`,null]]),wM=[`errexit`,`nounset`,`pipefail`,`verbose`,`xtrace`,`posix`,`allexport`,`noclobber`,`noglob`,`noexec`,`vi`,`emacs`],TM=[`braceexpand`,`errtrace`,`functrace`,`hashall`,`histexpand`,`history`,`ignoreeof`,`interactive-comments`,`keyword`,`monitor`,`nolog`,`notify`,`onecmd`,`physical`,`privileged`];function EM(e,t,n){t!==null&&(n&&(t===`vi`?e.state.options.emacs=!1:t===`emacs`&&(e.state.options.vi=!1)),e.state.options[t]=n,wk(e))}function DM(e,t){return t+1<e.length&&!e[t+1].startsWith(`-`)&&!e[t+1].startsWith(`+`)}function OM(e,t){let n=sT(e,t);return n.length===0?`${t}=()`:`${t}=(${n.map(n=>`[${n}]=${jj(e.state.env.get(`${t}_${n}`)??``)}`).join(` `)})`}function kM(e){return/^[a-zA-Z0-9_]+$/.test(e)?e:`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function AM(e,t){let n=lT(e,t);return n.length===0?`${t}=()`:`${t}=(${n.map(n=>{let r=e.state.env.get(`${t}_${n}`)??``;return`[${kM(n)}]=${jj(r)}`}).join(` `)} )`}function jM(e){let t=new Set,n=e.state.associativeArrays??new Set;for(let r of e.state.env.keys()){let e=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(e){let r=e[1];n.has(r)||t.add(r)}}return t}function MM(e){return e.state.associativeArrays??new Set}function NM(e,t){if(t.includes(`--help`))return Bk(xM);if(t.length===0){let t=jM(e),n=MM(e),r=e=>{for(let t of n){let n=`${t}_`;if(e!==`${t}__length`&&e.startsWith(n)){if(e.slice(n.length).startsWith(`_length`))continue;return!0}}return!1},i=[];for(let[a,o]of e.state.env){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)||t.has(a)||n.has(a))continue;let e=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(e&&t.has(e[1]))continue;let s=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);s&&t.has(s[1])||r(a)||s&&n.has(s[1])||i.push([a,o])}let a=[];for(let[e,t]of i.sort(([e],[t])=>e<t?-1:+(e>t)))a.push(`${e}=${Aj(t)}`);for(let n of[...t].sort((e,t)=>e<t?-1:+(e>t)))a.push(OM(e,n));for(let t of[...n].sort((e,t)=>e<t?-1:+(e>t)))a.push(AM(e,t));return a.sort((e,t)=>{let n=e.split(`=`)[0],r=t.split(`=`)[0];return n<r?-1:+(n>r)}),Bk(a.length>0?`${a.join(`
1405
+ `,wM=new Map([[`e`,`errexit`],[`u`,`nounset`],[`x`,`xtrace`],[`v`,`verbose`],[`f`,`noglob`],[`C`,`noclobber`],[`a`,`allexport`],[`n`,`noexec`],[`h`,null],[`b`,null],[`m`,null],[`B`,null],[`H`,null],[`P`,null],[`T`,null],[`E`,null],[`p`,null]]),TM=new Map([[`errexit`,`errexit`],[`pipefail`,`pipefail`],[`nounset`,`nounset`],[`xtrace`,`xtrace`],[`verbose`,`verbose`],[`noclobber`,`noclobber`],[`noglob`,`noglob`],[`allexport`,`allexport`],[`noexec`,`noexec`],[`posix`,`posix`],[`vi`,`vi`],[`emacs`,`emacs`],[`notify`,null],[`monitor`,null],[`braceexpand`,null],[`histexpand`,null],[`physical`,null],[`functrace`,null],[`errtrace`,null],[`privileged`,null],[`hashall`,null],[`ignoreeof`,null],[`interactive-comments`,null],[`keyword`,null],[`onecmd`,null]]),EM=[`errexit`,`nounset`,`pipefail`,`verbose`,`xtrace`,`posix`,`allexport`,`noclobber`,`noglob`,`noexec`,`vi`,`emacs`],DM=[`braceexpand`,`errtrace`,`functrace`,`hashall`,`histexpand`,`history`,`ignoreeof`,`interactive-comments`,`keyword`,`monitor`,`nolog`,`notify`,`onecmd`,`physical`,`privileged`];function OM(e,t,n){t!==null&&(n&&(t===`vi`?e.state.options.emacs=!1:t===`emacs`&&(e.state.options.vi=!1)),e.state.options[t]=n,Ek(e))}function kM(e,t){return t+1<e.length&&!e[t+1].startsWith(`-`)&&!e[t+1].startsWith(`+`)}function AM(e,t){let n=mT(e,t);return n.length===0?`${t}=()`:`${t}=(${n.map(n=>`[${n}]=${Nj(e.state.env.get(`${t}_${n}`)??``)}`).join(` `)})`}function jM(e){return/^[a-zA-Z0-9_]+$/.test(e)?e:`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function MM(e,t){let n=gT(e,t);return n.length===0?`${t}=()`:`${t}=(${n.map(n=>{let r=e.state.env.get(`${t}_${n}`)??``;return`[${jM(n)}]=${Nj(r)}`}).join(` `)} )`}function NM(e){let t=new Set,n=e.state.associativeArrays??new Set;for(let r of e.state.env.keys()){let e=r.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(e){let r=e[1];n.has(r)||t.add(r)}}return t}function PM(e){return e.state.associativeArrays??new Set}function FM(e,t){if(t.includes(`--help`))return Hk(CM);if(t.length===0){let t=NM(e),n=PM(e),r=e=>{for(let t of n){let n=`${t}_`;if(e!==`${t}__length`&&e.startsWith(n)){if(e.slice(n.length).startsWith(`_length`))continue;return!0}}return!1},i=[];for(let[a,o]of e.state.env){if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a)||t.has(a)||n.has(a))continue;let e=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)_(\d+)$/);if(e&&t.has(e[1]))continue;let s=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)__length$/);s&&t.has(s[1])||r(a)||s&&n.has(s[1])||i.push([a,o])}let a=[];for(let[e,t]of i.sort(([e],[t])=>e<t?-1:+(e>t)))a.push(`${e}=${Mj(t)}`);for(let n of[...t].sort((e,t)=>e<t?-1:+(e>t)))a.push(AM(e,n));for(let t of[...n].sort((e,t)=>e<t?-1:+(e>t)))a.push(MM(e,t));return a.sort((e,t)=>{let n=e.split(`=`)[0],r=t.split(`=`)[0];return n<r?-1:+(n>r)}),Hk(a.length>0?`${a.join(`
1406
1406
  `)}
1407
- `:``)}let n=0;for(;n<t.length;){let r=t[n];if((r===`-o`||r===`+o`)&&DM(t,n)){let i=t[n+1];if(!CM.has(i)){let t=`bash: set: ${i}: invalid option name
1408
- ${xM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}EM(e,CM.get(i)??null,r===`-o`),n+=2;continue}if(r===`-o`){let t=wM.map(t=>`${t.padEnd(16)}${e.state.options[t]?`on`:`off`}`),n=TM.map(e=>`${e.padEnd(16)}off`);return Bk(`${[...t,...n].sort().join(`
1407
+ `:``)}let n=0;for(;n<t.length;){let r=t[n];if((r===`-o`||r===`+o`)&&kM(t,n)){let i=t[n+1];if(!TM.has(i)){let t=`bash: set: ${i}: invalid option name
1408
+ ${CM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}OM(e,TM.get(i)??null,r===`-o`),n+=2;continue}if(r===`-o`){let t=EM.map(t=>`${t.padEnd(16)}${e.state.options[t]?`on`:`off`}`),n=DM.map(e=>`${e.padEnd(16)}off`);return Hk(`${[...t,...n].sort().join(`
1409
1409
  `)}
1410
- `)}if(r===`+o`){let t=wM.map(t=>`set ${e.state.options[t]?`-o`:`+o`} ${t}`),n=TM.map(e=>`set +o ${e}`);return Bk(`${[...t,...n].sort().join(`
1410
+ `)}if(r===`+o`){let t=EM.map(t=>`set ${e.state.options[t]?`-o`:`+o`} ${t}`),n=DM.map(e=>`set +o ${e}`);return Hk(`${[...t,...n].sort().join(`
1411
1411
  `)}
1412
- `)}if(r.length>1&&(r[0]===`-`||r[0]===`+`)&&r[1]!==`-`){let t=r[0]===`-`;for(let n=1;n<r.length;n++){let i=r[n];if(!SM.has(i)){let t=`bash: set: ${r[0]}${i}: invalid option
1413
- ${xM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}EM(e,SM.get(i)??null,t)}n++;continue}if(r===`--`)return PM(e,t.slice(n+1)),zk;if(r===`-`){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,wk(e),n+1<t.length)return PM(e,t.slice(n+1)),zk;n++;continue}if(r===`+`){n++;continue}if(r.startsWith(`-`)||r.startsWith(`+`)){let t=`bash: set: ${r}: invalid option
1414
- ${xM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}return PM(e,t.slice(n)),zk}return zk}function PM(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let n=0;n<t.length;n++)e.state.env.set(String(n+1),t[n]);e.state.env.set(`#`,String(t.length)),e.state.env.set(`@`,t.join(` `)),e.state.env.set(`*`,t.join(` `))}A();function FM(e,t){let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<0){let n=`bash: shift: ${t[0]}: numeric argument required
1412
+ `)}if(r.length>1&&(r[0]===`-`||r[0]===`+`)&&r[1]!==`-`){let t=r[0]===`-`;for(let n=1;n<r.length;n++){let i=r[n];if(!wM.has(i)){let t=`bash: set: ${r[0]}${i}: invalid option
1413
+ ${CM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}OM(e,wM.get(i)??null,t)}n++;continue}if(r===`--`)return IM(e,t.slice(n+1)),Vk;if(r===`-`){if(e.state.options.xtrace=!1,e.state.options.verbose=!1,Ek(e),n+1<t.length)return IM(e,t.slice(n+1)),Vk;n++;continue}if(r===`+`){n++;continue}if(r.startsWith(`-`)||r.startsWith(`+`)){let t=`bash: set: ${r}: invalid option
1414
+ ${CM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}return IM(e,t.slice(n)),Vk}return Vk}function IM(e,t){let n=1;for(;e.state.env.has(String(n));)e.state.env.delete(String(n)),n++;for(let n=0;n<t.length;n++)e.state.env.set(String(n+1),t[n]);e.state.env.set(`#`,String(t.length)),e.state.env.set(`@`,t.join(` `)),e.state.env.set(`*`,t.join(` `))}A();function LM(e,t){let n=1;if(t.length>0){let r=Number.parseInt(t[0],10);if(Number.isNaN(r)||r<0){let n=`bash: shift: ${t[0]}: numeric argument required
1415
1415
  `;if(e.state.options.posix)throw new Ur(1,``,n);return Q(n)}n=r}let r=Number.parseInt(e.state.env.get(`#`)||`0`,10);if(n>r){let t=`bash: shift: shift count out of range
1416
- `;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}if(n===0)return zk;let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=i.slice(n);for(let t=1;t<=r;t++)e.state.env.delete(String(t));for(let t=0;t<a.length;t++)e.state.env.set(String(t+1),a[t]);return e.state.env.set(`#`,String(a.length)),e.state.env.set(`@`,a.join(` `)),zk}Gw(),A();async function IM(e,t){let n=t;if(n.length>0&&n[0]===`--`&&(n=n.slice(1)),n.length===0)return $(``,`bash: source: filename argument required
1416
+ `;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}if(n===0)return Vk;let i=[];for(let t=1;t<=r;t++)i.push(e.state.env.get(String(t))||``);let a=i.slice(n);for(let t=1;t<=r;t++)e.state.env.delete(String(t));for(let t=0;t<a.length;t++)e.state.env.set(String(t+1),a[t]);return e.state.env.set(`#`,String(a.length)),e.state.env.set(`@`,a.join(` `)),Vk}Qw(),A();async function RM(e,t){let n=t;if(n.length>0&&n[0]===`--`&&(n=n.slice(1)),n.length===0)return $(``,`bash: source: filename argument required
1417
1417
  `,2);let r=n[0],i=null;if(r.includes(`/`)){let t=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(t)}catch{}}else{let t=(e.state.env.get(`PATH`)||``).split(`:`).filter(e=>e);for(let n of t){let t=e.fs.resolvePath(e.state.cwd,`${n}/${r}`);try{if((await e.fs.stat(t)).isDirectory)continue;i=await e.fs.readFile(t);break}catch{}}if(i===null){let t=e.fs.resolvePath(e.state.cwd,r);try{i=await e.fs.readFile(t)}catch{}}}if(i===null)return Q(`bash: ${r}: No such file or directory
1418
- `);let a=new Map;if(n.length>1){for(let t=1;t<=9;t++)a.set(String(t),e.state.env.get(String(t)));a.set(`#`,e.state.env.get(`#`)),a.set(`@`,e.state.env.get(`@`));let t=n.slice(1);e.state.env.set(`#`,String(t.length)),e.state.env.set(`@`,t.join(` `));for(let n=0;n<t.length&&n<9;n++)e.state.env.set(String(n+1),t[n]);for(let n=t.length+1;n<=9;n++)e.state.env.delete(String(n))}let o=e.state.currentSource,s=()=>{if(e.state.sourceDepth--,e.state.currentSource=o,n.length>1)for(let[t,n]of a)n===void 0?e.state.env.delete(t):e.state.env.set(t,n)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new k(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,`recursion`);e.state.currentSource=r;try{let t=Uw(i),n=await e.executeScript(t);return s(),n}catch(e){if(s(),e instanceof Ir)throw e;if(e instanceof Nr)return $(e.stdout,e.stderr,e.exitCode);if(e.name===`ParseException`)return Q(`bash: ${r}: ${e.message}
1419
- `);throw e}}zC(),Gw(),BO(),UT(),AO(),RT(),DE();function LM(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function RM(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)}async function zM(e,t){if(RM(t))return null;try{return await Z(e,vC(new Ww,t).expression)}catch{let e=parseInt(t,10);return Number.isNaN(e)?0:e}}function BM(e,t){if(e.state.localVarStack?.has(t)){let n=LA(e,t);if(n){n.value===void 0?e.state.env.delete(t):e.state.env.set(t,n.value);let r=e.state.localVarStack?.get(t);if(!r||r.length===0)FA(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,n.scopeIndex),VM(e,t);else{let n=r[r.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,n.scopeIndex+1)}return!0}return e.state.env.delete(t),FA(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let n=e.state.localScopes.length-1;n>=0;n--){let r=e.state.localScopes[n];if(r.has(t)){let i=r.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),r.delete(t);let a=!1;for(let r=n-1;r>=0;r--)if(e.state.localScopes[r].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,r+1),a=!0;break}return a||FA(e,t),!0}}return!1}function VM(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let n=r.get(t);return n===void 0?e.state.env.delete(t):e.state.env.set(t,n),r.delete(t),!0}}return!1}async function HM(e,t){if(t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`"`)&&t.endsWith(`"`)){let n=t.slice(1,-1);return X(e,new Ww().parseWordFromString(n,!0,!1))}return t.includes(`$`)?X(e,new Ww().parseWordFromString(t,!1,!1)):t}async function UM(e,t){let n=`both`,r=``,i=0;for(let a of t){if(a===`-v`){n=`variable`;continue}if(a===`-f`){n=`function`;continue}if(n===`function`){e.state.functions.delete(a);continue}if(n===`variable`){let t=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(t){let n=t[1],a=t[2];if(a===`@`||a===`*`){let t=J(e,n);for(let[r]of t)e.state.env.delete(`${n}_${r}`);e.state.env.delete(n);continue}let o=e.state.associativeArrays?.has(n);if(o){let t=await HM(e,a);e.state.env.delete(`${n}_${t}`);continue}let s=BT(e,n),c=e.state.declaredVars?.has(n);if((e.state.env.has(n)||c)&&!s&&!o){r+=`bash: unset: ${n}: not an array variable
1420
- `,i=1;continue}let l=await zM(e,a);if(l===null&&s){r+=`bash: unset: ${a}: not a valid identifier
1418
+ `);let a=new Map;if(n.length>1){for(let t=1;t<=9;t++)a.set(String(t),e.state.env.get(String(t)));a.set(`#`,e.state.env.get(`#`)),a.set(`@`,e.state.env.get(`@`));let t=n.slice(1);e.state.env.set(`#`,String(t.length)),e.state.env.set(`@`,t.join(` `));for(let n=0;n<t.length&&n<9;n++)e.state.env.set(String(n+1),t[n]);for(let n=t.length+1;n<=9;n++)e.state.env.delete(String(n))}let o=e.state.currentSource,s=()=>{if(e.state.sourceDepth--,e.state.currentSource=o,n.length>1)for(let[t,n]of a)n===void 0?e.state.env.delete(t):e.state.env.set(t,n)};if(e.state.sourceDepth++,e.state.sourceDepth>e.limits.maxSourceDepth)throw e.state.sourceDepth--,new k(`source: maximum nesting depth (${e.limits.maxSourceDepth}) exceeded, increase executionLimits.maxSourceDepth`,`recursion`);e.state.currentSource=r;try{let t=Xw(i),n=await e.executeScript(t);return s(),n}catch(e){if(s(),e instanceof Ir)throw e;if(e instanceof Nr)return $(e.stdout,e.stderr,e.exitCode);if(e.name===`ParseException`)return Q(`bash: ${r}: ${e.message}
1419
+ `);throw e}}KC(),Qw(),qO(),XT(),LO(),GT(),PE();function zM(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)}function BM(e){return e.startsWith(`'`)&&e.endsWith(`'`)||e.startsWith(`"`)&&e.endsWith(`"`)}async function VM(e,t){if(BM(t))return null;try{return await Z(e,TC(new Zw,t).expression)}catch{let e=parseInt(t,10);return Number.isNaN(e)?0:e}}function HM(e,t){if(e.state.localVarStack?.has(t)){let n=zA(e,t);if(n){n.value===void 0?e.state.env.delete(t):e.state.env.set(t,n.value);let r=e.state.localVarStack?.get(t);if(!r||r.length===0)LA(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,n.scopeIndex),UM(e,t);else{let n=r[r.length-1];e.state.localVarDepth=e.state.localVarDepth||new Map,e.state.localVarDepth.set(t,n.scopeIndex+1)}return!0}return e.state.env.delete(t),LA(e,t),e.state.localVarStack?.delete(t),e.state.fullyUnsetLocals=e.state.fullyUnsetLocals||new Map,e.state.fullyUnsetLocals.set(t,0),!0}for(let n=e.state.localScopes.length-1;n>=0;n--){let r=e.state.localScopes[n];if(r.has(t)){let i=r.get(t);i===void 0?e.state.env.delete(t):e.state.env.set(t,i),r.delete(t);let a=!1;for(let r=n-1;r>=0;r--)if(e.state.localScopes[r].has(t)){e.state.localVarDepth&&e.state.localVarDepth.set(t,r+1),a=!0;break}return a||LA(e,t),!0}}return!1}function UM(e,t){if(!e.state.tempEnvBindings||e.state.tempEnvBindings.length===0)return!1;for(let n=e.state.tempEnvBindings.length-1;n>=0;n--){let r=e.state.tempEnvBindings[n];if(r.has(t)){let n=r.get(t);return n===void 0?e.state.env.delete(t):e.state.env.set(t,n),r.delete(t),!0}}return!1}async function WM(e,t){if(t.startsWith(`'`)&&t.endsWith(`'`))return t.slice(1,-1);if(t.startsWith(`"`)&&t.endsWith(`"`)){let n=t.slice(1,-1);return X(e,new Zw().parseWordFromString(n,!0,!1))}return t.includes(`$`)?X(e,new Zw().parseWordFromString(t,!1,!1)):t}async function GM(e,t){let n=`both`,r=``,i=0;for(let a of t){if(a===`-v`){n=`variable`;continue}if(a===`-f`){n=`function`;continue}if(n===`function`){e.state.functions.delete(a);continue}if(n===`variable`){let t=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(t){let n=t[1],a=t[2];if(a===`@`||a===`*`){let t=J(e,n);for(let[r]of t)e.state.env.delete(`${n}_${r}`);e.state.env.delete(n);continue}let o=e.state.associativeArrays?.has(n);if(o){let t=await WM(e,a);e.state.env.delete(`${n}_${t}`);continue}let s=qT(e,n),c=e.state.declaredVars?.has(n);if((e.state.env.has(n)||c)&&!s&&!o){r+=`bash: unset: ${n}: not an array variable
1420
+ `,i=1;continue}let l=await VM(e,a);if(l===null&&s){r+=`bash: unset: ${a}: not a valid identifier
1421
1421
  `,i=1;continue}if(l===null)continue;if(l<0){let t=J(e,n),a=t.length,o=e.state.currentLine;if(a===0){r+=`bash: line ${o}: unset: [${l}]: bad array subscript
1422
1422
  `,i=1;continue}let s=a+l;if(s<0){r+=`bash: line ${o}: unset: [${l}]: bad array subscript
1423
- `,i=1;continue}let c=t[s][0];e.state.env.delete(`${n}_${c}`);continue}e.state.env.delete(`${n}_${l}`);continue}if(!LM(a)){r+=`bash: unset: \`${a}': not a valid identifier
1424
- `,i=1;continue}let n=a;if(OT(e,a)){let t=FT(e,a);t&&t!==a&&(n=t)}if(CE(e,n)){r+=`bash: unset: ${n}: cannot unset: readonly variable
1425
- `,i=1;continue}let o=PA(e,n);if(o!==void 0&&o!==e.state.callDepth)BM(e,n);else if(e.state.fullyUnsetLocals?.has(n))e.state.env.delete(n);else if(o!==void 0){let t=e.state.accessedTempEnvVars?.has(n),r=e.state.mutatedTempEnvVars?.has(n);if((t||r)&&e.state.localVarStack?.has(n)){let t=LA(e,n);t?t.value===void 0?e.state.env.delete(n):e.state.env.set(n,t.value):e.state.env.delete(n)}else e.state.env.delete(n)}else VM(e,n)||e.state.env.delete(n);e.state.exportedVars?.delete(n);continue}let t=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(t){let n=t[1],a=t[2];if(a===`@`||a===`*`){let t=J(e,n);for(let[r]of t)e.state.env.delete(`${n}_${r}`);e.state.env.delete(n);continue}let o=e.state.associativeArrays?.has(n);if(o){let t=await HM(e,a);e.state.env.delete(`${n}_${t}`);continue}let s=BT(e,n);if(e.state.env.has(n)&&!s&&!o){r+=`bash: unset: ${n}: not an array variable
1426
- `,i=1;continue}let c=await zM(e,a);if(c===null&&s){r+=`bash: unset: ${a}: not a valid identifier
1423
+ `,i=1;continue}let c=t[s][0];e.state.env.delete(`${n}_${c}`);continue}e.state.env.delete(`${n}_${l}`);continue}if(!zM(a)){r+=`bash: unset: \`${a}': not a valid identifier
1424
+ `,i=1;continue}let n=a;if(FT(e,a)){let t=HT(e,a);t&&t!==a&&(n=t)}if(AE(e,n)){r+=`bash: unset: ${n}: cannot unset: readonly variable
1425
+ `,i=1;continue}let o=IA(e,n);if(o!==void 0&&o!==e.state.callDepth)HM(e,n);else if(e.state.fullyUnsetLocals?.has(n))e.state.env.delete(n);else if(o!==void 0){let t=e.state.accessedTempEnvVars?.has(n),r=e.state.mutatedTempEnvVars?.has(n);if((t||r)&&e.state.localVarStack?.has(n)){let t=zA(e,n);t?t.value===void 0?e.state.env.delete(n):e.state.env.set(n,t.value):e.state.env.delete(n)}else e.state.env.delete(n)}else UM(e,n)||e.state.env.delete(n);e.state.exportedVars?.delete(n);continue}let t=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(t){let n=t[1],a=t[2];if(a===`@`||a===`*`){let t=J(e,n);for(let[r]of t)e.state.env.delete(`${n}_${r}`);e.state.env.delete(n);continue}let o=e.state.associativeArrays?.has(n);if(o){let t=await WM(e,a);e.state.env.delete(`${n}_${t}`);continue}let s=qT(e,n);if(e.state.env.has(n)&&!s&&!o){r+=`bash: unset: ${n}: not an array variable
1426
+ `,i=1;continue}let c=await VM(e,a);if(c===null&&s){r+=`bash: unset: ${a}: not a valid identifier
1427
1427
  `,i=1;continue}if(c===null)continue;if(c<0){let t=J(e,n),a=t.length,o=e.state.currentLine;if(a===0){r+=`bash: line ${o}: unset: [${c}]: bad array subscript
1428
1428
  `,i=1;continue}let s=a+c;if(s<0){r+=`bash: line ${o}: unset: [${c}]: bad array subscript
1429
- `,i=1;continue}let l=t[s][0];e.state.env.delete(`${n}_${l}`);continue}e.state.env.delete(`${n}_${c}`);continue}if(!LM(a)){r+=`bash: unset: \`${a}': not a valid identifier
1430
- `,i=1;continue}let o=a;if(OT(e,a)){let t=FT(e,a);t&&t!==a&&(o=t)}if(CE(e,o)){r+=`bash: unset: ${o}: cannot unset: readonly variable
1431
- `,i=1;continue}let s=PA(e,o);if(s!==void 0&&s!==e.state.callDepth)BM(e,o);else if(e.state.fullyUnsetLocals?.has(o))e.state.env.delete(o);else if(s!==void 0){let t=e.state.accessedTempEnvVars?.has(o),n=e.state.mutatedTempEnvVars?.has(o);if((t||n)&&e.state.localVarStack?.has(o)){let t=LA(e,o);t?t.value===void 0?e.state.env.delete(o):e.state.env.set(o,t.value):e.state.env.delete(o)}else e.state.env.delete(o)}else VM(e,o)||e.state.env.delete(o);e.state.exportedVars?.delete(o),e.state.functions.delete(a)}return $(``,r,i)}var WM=[`extglob`,`dotglob`,`nullglob`,`failglob`,`globstar`,`globskipdots`,`nocaseglob`,`nocasematch`,`expand_aliases`,`lastpipe`,`xpg_echo`],GM=`autocd.cdable_vars.cdspell.checkhash.checkjobs.checkwinsize.cmdhist.compat31.compat32.compat40.compat41.compat42.compat43.compat44.complete_fullquote.direxpand.dirspell.execfail.extdebug.extquote.force_fignore.globasciiranges.gnu_errfmt.histappend.histreedit.histverify.hostcomplete.huponexit.inherit_errexit.interactive_comments.lithist.localvar_inherit.localvar_unset.login_shell.mailwarn.no_empty_cmd_completion.progcomp.progcomp_alias.promptvars.restricted_shell.shift_verbose.sourcepath`.split(`.`);function KM(e){return WM.includes(e)}function qM(e){return GM.includes(e)}function JM(e,t){let n=!1,r=!1,i=!1,a=!1,o=!1,s=[],c=0;for(;c<t.length;){let e=t[c];if(e===`--`){c++;break}if(e.startsWith(`-`)&&e.length>1){for(let t=1;t<e.length;t++){let s=e[t];switch(s){case`s`:n=!0;break;case`u`:r=!0;break;case`p`:i=!0;break;case`q`:a=!0;break;case`o`:o=!0;break;default:return{exitCode:2,stdout:``,stderr:`shopt: -${s}: invalid option
1432
- `}}}c++}else break}for(;c<t.length;)s.push(t[c]),c++;if(o)return YM(e,s,n,r,i,a);if(n&&r)return{exitCode:1,stdout:``,stderr:`shopt: cannot set and unset shell options simultaneously
1433
- `};if(s.length===0){if(n||r){let t=[];for(let a of WM){let o=e.state.shoptOptions[a];n&&o?t.push(i?`shopt -s ${a}`:`${a} on`):r&&!o&&t.push(i?`shopt -u ${a}`:`${a} off`)}return{exitCode:0,stdout:t.length>0?`${t.join(`
1429
+ `,i=1;continue}let l=t[s][0];e.state.env.delete(`${n}_${l}`);continue}e.state.env.delete(`${n}_${c}`);continue}if(!zM(a)){r+=`bash: unset: \`${a}': not a valid identifier
1430
+ `,i=1;continue}let o=a;if(FT(e,a)){let t=HT(e,a);t&&t!==a&&(o=t)}if(AE(e,o)){r+=`bash: unset: ${o}: cannot unset: readonly variable
1431
+ `,i=1;continue}let s=IA(e,o);if(s!==void 0&&s!==e.state.callDepth)HM(e,o);else if(e.state.fullyUnsetLocals?.has(o))e.state.env.delete(o);else if(s!==void 0){let t=e.state.accessedTempEnvVars?.has(o),n=e.state.mutatedTempEnvVars?.has(o);if((t||n)&&e.state.localVarStack?.has(o)){let t=zA(e,o);t?t.value===void 0?e.state.env.delete(o):e.state.env.set(o,t.value):e.state.env.delete(o)}else e.state.env.delete(o)}else UM(e,o)||e.state.env.delete(o);e.state.exportedVars?.delete(o),e.state.functions.delete(a)}return $(``,r,i)}var KM=[`extglob`,`dotglob`,`nullglob`,`failglob`,`globstar`,`globskipdots`,`nocaseglob`,`nocasematch`,`expand_aliases`,`lastpipe`,`xpg_echo`],qM=`autocd.cdable_vars.cdspell.checkhash.checkjobs.checkwinsize.cmdhist.compat31.compat32.compat40.compat41.compat42.compat43.compat44.complete_fullquote.direxpand.dirspell.execfail.extdebug.extquote.force_fignore.globasciiranges.gnu_errfmt.histappend.histreedit.histverify.hostcomplete.huponexit.inherit_errexit.interactive_comments.lithist.localvar_inherit.localvar_unset.login_shell.mailwarn.no_empty_cmd_completion.progcomp.progcomp_alias.promptvars.restricted_shell.shift_verbose.sourcepath`.split(`.`);function JM(e){return KM.includes(e)}function YM(e){return qM.includes(e)}function XM(e,t){let n=!1,r=!1,i=!1,a=!1,o=!1,s=[],c=0;for(;c<t.length;){let e=t[c];if(e===`--`){c++;break}if(e.startsWith(`-`)&&e.length>1){for(let t=1;t<e.length;t++){let s=e[t];switch(s){case`s`:n=!0;break;case`u`:r=!0;break;case`p`:i=!0;break;case`q`:a=!0;break;case`o`:o=!0;break;default:return{exitCode:2,stdout:``,stderr:`shopt: -${s}: invalid option
1432
+ `}}}c++}else break}for(;c<t.length;)s.push(t[c]),c++;if(o)return ZM(e,s,n,r,i,a);if(n&&r)return{exitCode:1,stdout:``,stderr:`shopt: cannot set and unset shell options simultaneously
1433
+ `};if(s.length===0){if(n||r){let t=[];for(let a of KM){let o=e.state.shoptOptions[a];n&&o?t.push(i?`shopt -s ${a}`:`${a} on`):r&&!o&&t.push(i?`shopt -u ${a}`:`${a} off`)}return{exitCode:0,stdout:t.length>0?`${t.join(`
1434
1434
  `)}
1435
- `:``,stderr:``}}let t=[];for(let n of WM){let r=e.state.shoptOptions[n];t.push(i?`shopt ${r?`-s`:`-u`} ${n}`:`${n} ${r?`on`:`off`}`)}return{exitCode:0,stdout:`${t.join(`
1435
+ `:``,stderr:``}}let t=[];for(let n of KM){let r=e.state.shoptOptions[n];t.push(i?`shopt ${r?`-s`:`-u`} ${n}`:`${n} ${r?`on`:`off`}`)}return{exitCode:0,stdout:`${t.join(`
1436
1436
  `)}
1437
- `,stderr:``}}let l=!1,u=``,d=[];for(let t of s){if(!KM(t)&&!qM(t)){u+=`shopt: ${t}: invalid shell option name
1438
- `,l=!0;continue}if(n)KM(t)&&(e.state.shoptOptions[t]=!0,Dk(e));else if(r)KM(t)&&(e.state.shoptOptions[t]=!1,Dk(e));else if(KM(t)){let n=e.state.shoptOptions[t];a?n||(l=!0):i?(d.push(`shopt ${n?`-s`:`-u`} ${t}`),n||(l=!0)):(d.push(`${t} ${n?`on`:`off`}`),n||(l=!0))}else a?l=!0:i?(d.push(`shopt -u ${t}`),l=!0):(d.push(`${t} off`),l=!0)}return{exitCode:+!!l,stdout:d.length>0?`${d.join(`
1437
+ `,stderr:``}}let l=!1,u=``,d=[];for(let t of s){if(!JM(t)&&!YM(t)){u+=`shopt: ${t}: invalid shell option name
1438
+ `,l=!0;continue}if(n)JM(t)&&(e.state.shoptOptions[t]=!0,kk(e));else if(r)JM(t)&&(e.state.shoptOptions[t]=!1,kk(e));else if(JM(t)){let n=e.state.shoptOptions[t];a?n||(l=!0):i?(d.push(`shopt ${n?`-s`:`-u`} ${t}`),n||(l=!0)):(d.push(`${t} ${n?`on`:`off`}`),n||(l=!0))}else a?l=!0:i?(d.push(`shopt -u ${t}`),l=!0):(d.push(`${t} off`),l=!0)}return{exitCode:+!!l,stdout:d.length>0?`${d.join(`
1439
1439
  `)}
1440
- `:``,stderr:u}}function YM(e,t,n,r,i,a){let o=new Map([[`errexit`,`errexit`],[`pipefail`,`pipefail`],[`nounset`,`nounset`],[`xtrace`,`xtrace`],[`verbose`,`verbose`],[`posix`,`posix`],[`allexport`,`allexport`],[`noclobber`,`noclobber`],[`noglob`,`noglob`],[`noexec`,`noexec`],[`vi`,`vi`],[`emacs`,`emacs`]]),s=[`braceexpand`,`errtrace`,`functrace`,`hashall`,`histexpand`,`history`,`ignoreeof`,`interactive-comments`,`keyword`,`monitor`,`nolog`,`notify`,`onecmd`,`physical`,`privileged`],c=[...o.keys(),...s].sort();if(t.length===0){let t=[];for(let a of c){let c=s.includes(a),l=o.get(a),u=c||!l?!1:e.state.options[l];n&&!u||r&&u||t.push(i?`set ${u?`-o`:`+o`} ${a}`:`${a} ${u?`on`:`off`}`)}return{exitCode:0,stdout:t.length>0?`${t.join(`
1440
+ `:``,stderr:u}}function ZM(e,t,n,r,i,a){let o=new Map([[`errexit`,`errexit`],[`pipefail`,`pipefail`],[`nounset`,`nounset`],[`xtrace`,`xtrace`],[`verbose`,`verbose`],[`posix`,`posix`],[`allexport`,`allexport`],[`noclobber`,`noclobber`],[`noglob`,`noglob`],[`noexec`,`noexec`],[`vi`,`vi`],[`emacs`,`emacs`]]),s=[`braceexpand`,`errtrace`,`functrace`,`hashall`,`histexpand`,`history`,`ignoreeof`,`interactive-comments`,`keyword`,`monitor`,`nolog`,`notify`,`onecmd`,`physical`,`privileged`],c=[...o.keys(),...s].sort();if(t.length===0){let t=[];for(let a of c){let c=s.includes(a),l=o.get(a),u=c||!l?!1:e.state.options[l];n&&!u||r&&u||t.push(i?`set ${u?`-o`:`+o`} ${a}`:`${a} ${u?`on`:`off`}`)}return{exitCode:0,stdout:t.length>0?`${t.join(`
1441
1441
  `)}
1442
1442
  `:``,stderr:``}}let l=!1,u=``,d=[];for(let c of t){let t=o.has(c),f=s.includes(c);if(!t&&!f){u+=`shopt: ${c}: invalid option name
1443
- `,l=!0;continue}if(f){n||r||(a?l=!0:i?(d.push(`set +o ${c}`),l=!0):(d.push(`${c} off`),l=!0));continue}let p=o.get(c);if(p)if(n)p===`vi`?e.state.options.emacs=!1:p===`emacs`&&(e.state.options.vi=!1),e.state.options[p]=!0,wk(e);else if(r)e.state.options[p]=!1,wk(e);else{let t=e.state.options[p];a?t||(l=!0):i?(d.push(`set ${t?`-o`:`+o`} ${c}`),t||(l=!0)):(d.push(`${c} ${t?`on`:`off`}`),t||(l=!0))}}return{exitCode:+!!l,stdout:d.length>0?`${d.join(`
1443
+ `,l=!0;continue}if(f){n||r||(a?l=!0:i?(d.push(`set +o ${c}`),l=!0):(d.push(`${c} off`),l=!0));continue}let p=o.get(c);if(p)if(n)p===`vi`?e.state.options.emacs=!1:p===`emacs`&&(e.state.options.vi=!1),e.state.options[p]=!0,Ek(e);else if(r)e.state.options[p]=!1,Ek(e);else{let t=e.state.options[p];a?t||(l=!0):i?(d.push(`set ${t?`-o`:`+o`} ${c}`),t||(l=!0)):(d.push(`${c} ${t?`on`:`off`}`),t||(l=!0))}}return{exitCode:+!!l,stdout:d.length>0?`${d.join(`
1444
1444
  `)}
1445
- `:``,stderr:u}}async function XM(e,t,n){if(t.includes(`/`)){let n=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(n))return{error:`not_found`,path:n};let r=n.split(`/`).pop()||t,i=e.commands.get(r);try{let t=await e.fs.stat(n);return t.isDirectory?{error:`permission_denied`,path:n}:i?{cmd:i,path:n}:t.mode&73?{script:!0,path:n}:{error:`permission_denied`,path:n}}catch{return{error:`not_found`,path:n}}}if(!n&&e.state.hashTable){let n=e.state.hashTable.get(t);if(n)if(await e.fs.exists(n)){let r=e.commands.get(t);if(r)return{cmd:r,path:n};try{let t=await e.fs.stat(n);if(!t.isDirectory&&t.mode&73)return{script:!0,path:n}}catch{}}else e.state.hashTable.delete(t)}let r=(n??e.state.env.get(`PATH`)??`/usr/bin:/bin`).split(`:`);for(let n of r){if(!n)continue;let r=`${n.startsWith(`/`)?n:e.fs.resolvePath(e.state.cwd,n)}/${t}`;if(await e.fs.exists(r))try{let i=await e.fs.stat(r);if(i.isDirectory)continue;let a=(i.mode&73)!=0,o=e.commands.get(t),s=n===`/bin`||n===`/usr/bin`;if(o&&s)return{cmd:o,path:r};if(a&&(o&&!s||!o))return{script:!0,path:r}}catch{}}if(!await e.fs.exists(`/usr/bin`)){let n=e.commands.get(t);if(n)return{cmd:n,path:`/usr/bin/${t}`}}return null}async function ZM(e,t){let n=[];if(t.includes(`/`)){let r=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(r))try{let i=await e.fs.stat(r);i.isDirectory||i.mode&73&&n.push(t)}catch{}return n}let r=(e.state.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`);for(let i of r){if(!i)continue;let r=`${i.startsWith(`/`)?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(r)){try{if((await e.fs.stat(r)).isDirectory)continue}catch{continue}n.push(i.startsWith(`/`)?r:`${i}/${t}`)}}return n}pl();function QM(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function $M(e,t,n,r){return((...i)=>{dl(t,n,`${r} call`);let a=e(...i);return QM(a)?a.then(e=>(dl(t,n,`${r} post-await`),e),e=>{throw dl(t,n,`${r} post-await`),e}):(dl(t,n,`${r} return`),a)})}function eN(e,t,n){let r={readFile:$M(e.readFile.bind(e),t,n,`fs.readFile`),readFileBuffer:$M(e.readFileBuffer.bind(e),t,n,`fs.readFileBuffer`),writeFile:$M(e.writeFile.bind(e),t,n,`fs.writeFile`),appendFile:$M(e.appendFile.bind(e),t,n,`fs.appendFile`),exists:$M(e.exists.bind(e),t,n,`fs.exists`),stat:$M(e.stat.bind(e),t,n,`fs.stat`),mkdir:$M(e.mkdir.bind(e),t,n,`fs.mkdir`),readdir:$M(e.readdir.bind(e),t,n,`fs.readdir`),rm:$M(e.rm.bind(e),t,n,`fs.rm`),cp:$M(e.cp.bind(e),t,n,`fs.cp`),mv:$M(e.mv.bind(e),t,n,`fs.mv`),resolvePath:$M(e.resolvePath.bind(e),t,n,`fs.resolvePath`),getAllPaths:$M(e.getAllPaths.bind(e),t,n,`fs.getAllPaths`),chmod:$M(e.chmod.bind(e),t,n,`fs.chmod`),symlink:$M(e.symlink.bind(e),t,n,`fs.symlink`),link:$M(e.link.bind(e),t,n,`fs.link`),readlink:$M(e.readlink.bind(e),t,n,`fs.readlink`),lstat:$M(e.lstat.bind(e),t,n,`fs.lstat`),realpath:$M(e.realpath.bind(e),t,n,`fs.realpath`),utimes:$M(e.utimes.bind(e),t,n,`fs.utimes`)};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=$M(e.readdirWithFileTypes.bind(e),t,n,`fs.readdirWithFileTypes`)),r}function tN(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:eN(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=$M(e.exec,e.requireDefenseContext,n,`exec`)),e.fetch&&(r.fetch=$M(e.fetch,e.requireDefenseContext,n,`fetch`)),e.sleep&&(r.sleep=$M(e.sleep,e.requireDefenseContext,n,`sleep`)),e.getRegisteredCommands&&(r.getRegisteredCommands=$M(e.getRegisteredCommands,e.requireDefenseContext,n,`getRegisteredCommands`)),r}A(),Gr();async function nN(e,t,n,r){let i=!1,a=!1,o=!1,s=!1,c=!1,l=[];for(let e of t)if(e.startsWith(`-`)&&e.length>1)for(let t of e.slice(1))t===`t`?i=!0:t===`p`?a=!0:t===`P`?o=!0:t===`a`?s=!0:t===`f`&&(c=!0);else l.push(e);let u=``,d=``,f=0,p=!1,m=!1;for(let t of l){let l=!1;if(o){if(s){let e=await r(t);if(e.length>0){for(let t of e)u+=`${t}
1445
+ `:``,stderr:u}}async function QM(e,t,n){if(t.includes(`/`)){let n=e.fs.resolvePath(e.state.cwd,t);if(!await e.fs.exists(n))return{error:`not_found`,path:n};let r=n.split(`/`).pop()||t,i=e.commands.get(r);try{let t=await e.fs.stat(n);return t.isDirectory?{error:`permission_denied`,path:n}:i?{cmd:i,path:n}:t.mode&73?{script:!0,path:n}:{error:`permission_denied`,path:n}}catch{return{error:`not_found`,path:n}}}if(!n&&e.state.hashTable){let n=e.state.hashTable.get(t);if(n)if(await e.fs.exists(n)){let r=e.commands.get(t);if(r)return{cmd:r,path:n};try{let t=await e.fs.stat(n);if(!t.isDirectory&&t.mode&73)return{script:!0,path:n}}catch{}}else e.state.hashTable.delete(t)}let r=(n??e.state.env.get(`PATH`)??`/usr/bin:/bin`).split(`:`);for(let n of r){if(!n)continue;let r=`${n.startsWith(`/`)?n:e.fs.resolvePath(e.state.cwd,n)}/${t}`;if(await e.fs.exists(r))try{let i=await e.fs.stat(r);if(i.isDirectory)continue;let a=(i.mode&73)!=0,o=e.commands.get(t),s=n===`/bin`||n===`/usr/bin`;if(o&&s)return{cmd:o,path:r};if(a&&(o&&!s||!o))return{script:!0,path:r}}catch{}}if(!await e.fs.exists(`/usr/bin`)){let n=e.commands.get(t);if(n)return{cmd:n,path:`/usr/bin/${t}`}}return null}async function $M(e,t){let n=[];if(t.includes(`/`)){let r=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(r))try{let i=await e.fs.stat(r);i.isDirectory||i.mode&73&&n.push(t)}catch{}return n}let r=(e.state.env.get(`PATH`)||`/usr/bin:/bin`).split(`:`);for(let i of r){if(!i)continue;let r=`${i.startsWith(`/`)?i:e.fs.resolvePath(e.state.cwd,i)}/${t}`;if(await e.fs.exists(r)){try{if((await e.fs.stat(r)).isDirectory)continue}catch{continue}n.push(i.startsWith(`/`)?r:`${i}/${t}`)}}return n}fl();function eN(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function tN(e,t,n,r){return((...i)=>{ul(t,n,`${r} call`);let a=e(...i);return eN(a)?a.then(e=>(ul(t,n,`${r} post-await`),e),e=>{throw ul(t,n,`${r} post-await`),e}):(ul(t,n,`${r} return`),a)})}function nN(e,t,n){let r={readFile:tN(e.readFile.bind(e),t,n,`fs.readFile`),readFileBuffer:tN(e.readFileBuffer.bind(e),t,n,`fs.readFileBuffer`),writeFile:tN(e.writeFile.bind(e),t,n,`fs.writeFile`),appendFile:tN(e.appendFile.bind(e),t,n,`fs.appendFile`),exists:tN(e.exists.bind(e),t,n,`fs.exists`),stat:tN(e.stat.bind(e),t,n,`fs.stat`),mkdir:tN(e.mkdir.bind(e),t,n,`fs.mkdir`),readdir:tN(e.readdir.bind(e),t,n,`fs.readdir`),rm:tN(e.rm.bind(e),t,n,`fs.rm`),cp:tN(e.cp.bind(e),t,n,`fs.cp`),mv:tN(e.mv.bind(e),t,n,`fs.mv`),resolvePath:tN(e.resolvePath.bind(e),t,n,`fs.resolvePath`),getAllPaths:tN(e.getAllPaths.bind(e),t,n,`fs.getAllPaths`),chmod:tN(e.chmod.bind(e),t,n,`fs.chmod`),symlink:tN(e.symlink.bind(e),t,n,`fs.symlink`),link:tN(e.link.bind(e),t,n,`fs.link`),readlink:tN(e.readlink.bind(e),t,n,`fs.readlink`),lstat:tN(e.lstat.bind(e),t,n,`fs.lstat`),realpath:tN(e.realpath.bind(e),t,n,`fs.realpath`),utimes:tN(e.utimes.bind(e),t,n,`fs.utimes`)};return e.readdirWithFileTypes&&(r.readdirWithFileTypes=tN(e.readdirWithFileTypes.bind(e),t,n,`fs.readdirWithFileTypes`)),r}function rN(e,t){if(!e.requireDefenseContext)return e;let n=`command:${t}`,r={...e,fs:nN(e.fs,e.requireDefenseContext,n)};return e.exec&&(r.exec=tN(e.exec,e.requireDefenseContext,n,`exec`)),e.fetch&&(r.fetch=tN(e.fetch,e.requireDefenseContext,n,`fetch`)),e.sleep&&(r.sleep=tN(e.sleep,e.requireDefenseContext,n,`sleep`)),e.getRegisteredCommands&&(r.getRegisteredCommands=tN(e.getRegisteredCommands,e.requireDefenseContext,n,`getRegisteredCommands`)),r}A(),Gr();async function iN(e,t,n,r){let i=!1,a=!1,o=!1,s=!1,c=!1,l=[];for(let e of t)if(e.startsWith(`-`)&&e.length>1)for(let t of e.slice(1))t===`t`?i=!0:t===`p`?a=!0:t===`P`?o=!0:t===`a`?s=!0:t===`f`&&(c=!0);else l.push(e);let u=``,d=``,f=0,p=!1,m=!1;for(let t of l){let l=!1;if(o){if(s){let e=await r(t);if(e.length>0){for(let t of e)u+=`${t}
1446
1446
  `;p=!0,l=!0}}else{let e=await n(t);e&&(u+=`${e}
1447
1447
  `,p=!0,l=!0)}l||(m=!0);continue}let f=!c&&e.state.functions.has(t);if(s&&f){if(!a)if(i)u+=`function
1448
- `;else{let n=e.state.functions.get(t),r=n?rN(t,n):`${t} is a function
1448
+ `;else{let n=e.state.functions.get(t),r=n?aN(t,n):`${t} is a function
1449
1449
  `;u+=r}l=!0}let h=e.state.env.get(`BASH_ALIAS_${t}`);if(!(h!==void 0&&(s||!l)&&(a||(i?u+=`alias
1450
1450
  `:u+=`${t} is aliased to \`${h}'
1451
- `),l=!0,!s)||VA.has(t)&&(s||!l)&&(a||(i?u+=`keyword
1451
+ `),l=!0,!s)||UA.has(t)&&(s||!l)&&(a||(i?u+=`keyword
1452
1452
  `:u+=`${t} is a shell keyword
1453
1453
  `),l=!0,!s))){if(!s&&f&&!l){if(!a)if(i)u+=`function
1454
- `;else{let n=e.state.functions.get(t),r=n?rN(t,n):`${t} is a function
1455
- `;u+=r}l=!0;continue}if(!(HA.has(t)&&(s||!l)&&(a||(i?u+=`builtin
1454
+ `;else{let n=e.state.functions.get(t),r=n?aN(t,n):`${t} is a function
1455
+ `;u+=r}l=!0;continue}if(!(WA.has(t)&&(s||!l)&&(a||(i?u+=`builtin
1456
1456
  `:u+=`${t} is a shell builtin
1457
1457
  `),l=!0,!s))){if(s){let e=await r(t);for(let n of e)a?u+=`${n}
1458
1458
  `:i?u+=`file
@@ -1461,16 +1461,16 @@ ${xM}`;if(e.state.options.posix)throw new Ur(1,``,t);return Q(t)}return PM(e,t.s
1461
1461
  `:i?u+=`file
1462
1462
  `:u+=`${t} is ${e}
1463
1463
  `,p=!0,l=!0)}if(!l&&(m=!0,!i&&!a)){let n=!0;if(t.includes(`/`)){let r=e.fs.resolvePath(e.state.cwd,t);await e.fs.exists(r)&&(n=!1)}n&&(d+=`bash: type: ${t}: not found
1464
- `)}}}}return f=a?m&&!p?1:0:+!!m,$(u,d,f)}function rN(e,t){let n;return n=t.body.type===`Group`?t.body.body.map(e=>iN(e)).join(`; `):iN(t.body),`${e} is a function
1464
+ `)}}}}return f=a?m&&!p?1:0:+!!m,$(u,d,f)}function aN(e,t){let n;return n=t.body.type===`Group`?t.body.body.map(e=>oN(e)).join(`; `):oN(t.body),`${e} is a function
1465
1465
  ${e} ()
1466
1466
  {
1467
1467
  ${n}
1468
1468
  }
1469
- `}function iN(e){if(Array.isArray(e))return e.map(e=>iN(e)).join(`; `);if(e.type===`Statement`){let t=[];for(let n=0;n<e.pipelines.length;n++){let r=e.pipelines[n];t.push(aN(r)),e.operators[n]&&t.push(e.operators[n])}return t.join(` `)}if(e.type===`SimpleCommand`){let t=e,n=[];t.name&&n.push(oN(t.name));for(let e of t.args)n.push(oN(e));return n.join(` `)}return e.type===`Group`?`{ ${e.body.map(e=>iN(e)).join(`; `)}; }`:`...`}function aN(e){let t=e.commands.map(e=>iN(e));return(e.negated?`! `:``)+t.join(` | `)}function oN(e){let t=``;for(let n of e.parts)n.type===`Literal`?t+=n.value:n.type===`DoubleQuoted`?t+=`"${n.parts.map(e=>sN(e)).join(``)}"`:n.type===`SingleQuoted`?t+=`'${n.value}'`:t+=sN(n);return t}function sN(e){let t=e;return t.type===`Literal`?t.value??``:t.type===`Variable`?`$${t.name}`:``}async function cN(e,t,n,r){let i=``,a=``,o=0;for(let n of t){if(!n){o=1;continue}let t=e.state.env.get(`BASH_ALIAS_${n}`);if(t!==void 0)r?i+=`${n} is an alias for "${t}"
1469
+ `}function oN(e){if(Array.isArray(e))return e.map(e=>oN(e)).join(`; `);if(e.type===`Statement`){let t=[];for(let n=0;n<e.pipelines.length;n++){let r=e.pipelines[n];t.push(sN(r)),e.operators[n]&&t.push(e.operators[n])}return t.join(` `)}if(e.type===`SimpleCommand`){let t=e,n=[];t.name&&n.push(cN(t.name));for(let e of t.args)n.push(cN(e));return n.join(` `)}return e.type===`Group`?`{ ${e.body.map(e=>oN(e)).join(`; `)}; }`:`...`}function sN(e){let t=e.commands.map(e=>oN(e));return(e.negated?`! `:``)+t.join(` | `)}function cN(e){let t=``;for(let n of e.parts)n.type===`Literal`?t+=n.value:n.type===`DoubleQuoted`?t+=`"${n.parts.map(e=>lN(e)).join(``)}"`:n.type===`SingleQuoted`?t+=`'${n.value}'`:t+=lN(n);return t}function lN(e){let t=e;return t.type===`Literal`?t.value??``:t.type===`Variable`?`$${t.name}`:``}async function uN(e,t,n,r){let i=``,a=``,o=0;for(let n of t){if(!n){o=1;continue}let t=e.state.env.get(`BASH_ALIAS_${n}`);if(t!==void 0)r?i+=`${n} is an alias for "${t}"
1470
1470
  `:i+=`alias ${n}='${t}'
1471
- `;else if(VA.has(n))r?i+=`${n} is a shell keyword
1471
+ `;else if(UA.has(n))r?i+=`${n} is a shell keyword
1472
1472
  `:i+=`${n}
1473
- `;else if(HA.has(n))r?i+=`${n} is a shell builtin
1473
+ `;else if(WA.has(n))r?i+=`${n} is a shell builtin
1474
1474
  `:i+=`${n}
1475
1475
  `;else if(e.state.functions.has(n))r?i+=`${n} is a function
1476
1476
  `:i+=`${n}
@@ -1480,105 +1480,105 @@ ${e} ()
1480
1480
  `),o=1)}else if(e.commands.has(n)){let t=(e.state.env.get(`PATH`)??`/usr/bin:/bin`).split(`:`),a=null;for(let r of t){if(!r)continue;let t=`${r}/${n}`;try{let n=await e.fs.stat(t);if(!n.isDirectory&&n.mode&73){a=t;break}}catch{}}a||=`/usr/bin/${n}`,r?i+=`${n} is ${a}
1481
1481
  `:i+=`${a}
1482
1482
  `}else r&&(a+=`${n}: not found
1483
- `),o=1}return $(i,a,o)}async function lN(e,t){if(t.includes(`/`)){let n=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(n)){try{let t=await e.fs.stat(n);if(t.isDirectory||!(t.mode&73))return null}catch{return null}return t}return null}let n=(e.state.env.get(`PATH`)??`/usr/bin:/bin`).split(`:`);for(let r of n){if(!r)continue;let n=`${r.startsWith(`/`)?r:e.fs.resolvePath(e.state.cwd,r)}/${t}`;if(await e.fs.exists(n)){try{if((await e.fs.stat(n)).isDirectory)continue}catch{continue}return`${r}/${t}`}}if(e.commands.has(t)){for(let e of n)if(e===`/usr/bin`||e===`/bin`)return`${e}/${t}`;return`/usr/bin/${t}`}return null}async function uN(e,t,n,r,i,a,o,s){let{ctx:c,runCommand:l}=e;if(c.coverage&&HA.has(t)&&c.coverage.hit(`bash:builtin:${t}`),t===`export`)return aM(c,n);if(t===`unset`)return UM(c,n);if(t===`exit`)return iM(c,n);if(t===`local`)return hM(c,n);if(t===`set`)return NM(c,n);if(t===`break`)return Wk(c,n);if(t===`continue`)return Ej(c,n);if(t===`return`)return bM(c,n);if(t===`eval`&&c.state.options.posix)return rM(c,n,i);if(t===`shift`)return FM(c,n);if(t===`getopts`)return oM(c,n);if(t===`compgen`)return ij(c,n);if(t===`complete`)return Sj(c,n);if(t===`compopt`)return Tj(c,n);if(t===`pushd`)return await eM(c,n);if(t===`popd`)return tM(c,n);if(t===`dirs`)return nM(c,n);if(t===`source`||t===`.`)return IM(c,n);if(t===`read`)return yM(c,n,i,s);if(t===`mapfile`||t===`readarray`)return gM(c,n,i);if(t===`declare`||t===`typeset`)return Yj(c,n);if(t===`readonly`)return Xj(c,n);if(!a){let e=c.state.functions.get(t);if(e)return $A(c,e,n,i)}if(t===`eval`)return rM(c,n,i);if(t===`cd`)return await Gk(c,n);if(t===`:`||t===`true`)return zk;if(t===`false`)return Vk(!1);if(t===`let`)return mM(c,n);if(t===`command`)return dN(e,n,i);if(t===`builtin`)return fN(e,n,i);if(t===`shopt`)return JM(c,n);if(t===`exec`){if(n.length===0)return zk;let[e,...t]=n;return l(e,t,[],i,!1,!1,-1)}if(t===`wait`)return zk;if(t===`type`)return await nN(c,n,e=>lN(c,e),e=>ZM(c,e));if(t===`hash`)return sM(c,n);if(t===`help`)return uM(c,n);if(t===`[`||t===`test`){let e=n;if(t===`[`){if(n[n.length-1]!==`]`)return Q(`[: missing \`]'
1484
- `,2);e=n.slice(0,-1)}return lA(c,e)}return null}async function dN(e,t,n){let{ctx:r,runCommand:i}=e;if(t.length===0)return zk;let a=!1,o=!1,s=!1,c=t;for(;c.length>0&&c[0].startsWith(`-`);){let e=c[0];if(e===`--`){c=c.slice(1);break}for(let t of e.slice(1))t===`p`?a=!0:t===`V`?o=!0:t===`v`&&(s=!0);c=c.slice(1)}if(c.length===0)return zk;if(s||o)return await cN(r,c,s,o);let[l,...u]=c;return i(l,u,[],n,!0,a,-1)}async function fN(e,t,n){let{runCommand:r}=e;if(t.length===0)return zk;let i=t;if(i[0]===`--`&&(i=i.slice(1),i.length===0))return zk;let a=i[0];if(!HA.has(a))return Q(`bash: builtin: ${a}: not a shell builtin
1485
- `);let[,...o]=i;return r(a,o,[],n,!0,!1,-1)}async function pN(e,t,n,r,i){let{ctx:a,buildExportedEnv:o,executeUserScript:s}=e,c=await XM(a,t,i?`/usr/bin:/bin`:void 0);if(!c)return Rk(t)?Q(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1483
+ `),o=1}return $(i,a,o)}async function dN(e,t){if(t.includes(`/`)){let n=e.fs.resolvePath(e.state.cwd,t);if(await e.fs.exists(n)){try{let t=await e.fs.stat(n);if(t.isDirectory||!(t.mode&73))return null}catch{return null}return t}return null}let n=(e.state.env.get(`PATH`)??`/usr/bin:/bin`).split(`:`);for(let r of n){if(!r)continue;let n=`${r.startsWith(`/`)?r:e.fs.resolvePath(e.state.cwd,r)}/${t}`;if(await e.fs.exists(n)){try{if((await e.fs.stat(n)).isDirectory)continue}catch{continue}return`${r}/${t}`}}if(e.commands.has(t)){for(let e of n)if(e===`/usr/bin`||e===`/bin`)return`${e}/${t}`;return`/usr/bin/${t}`}return null}async function fN(e,t,n,r,i,a,o,s){let{ctx:c,runCommand:l}=e;if(c.coverage&&WA.has(t)&&c.coverage.hit(`bash:builtin:${t}`),t===`export`)return sM(c,n);if(t===`unset`)return GM(c,n);if(t===`exit`)return oM(c,n);if(t===`local`)return _M(c,n);if(t===`set`)return FM(c,n);if(t===`break`)return Kk(c,n);if(t===`continue`)return Oj(c,n);if(t===`return`)return SM(c,n);if(t===`eval`&&c.state.options.posix)return aM(c,n,i);if(t===`shift`)return LM(c,n);if(t===`getopts`)return cM(c,n);if(t===`compgen`)return oj(c,n);if(t===`complete`)return wj(c,n);if(t===`compopt`)return Dj(c,n);if(t===`pushd`)return await nM(c,n);if(t===`popd`)return rM(c,n);if(t===`dirs`)return iM(c,n);if(t===`source`||t===`.`)return RM(c,n);if(t===`read`)return xM(c,n,i,s);if(t===`mapfile`||t===`readarray`)return vM(c,n,i);if(t===`declare`||t===`typeset`)return Zj(c,n);if(t===`readonly`)return Qj(c,n);if(!a){let e=c.state.functions.get(t);if(e)return tj(c,e,n,i)}if(t===`eval`)return aM(c,n,i);if(t===`cd`)return await qk(c,n);if(t===`:`||t===`true`)return Vk;if(t===`false`)return Uk(!1);if(t===`let`)return gM(c,n);if(t===`command`)return pN(e,n,i);if(t===`builtin`)return mN(e,n,i);if(t===`shopt`)return XM(c,n);if(t===`exec`){if(n.length===0)return Vk;let[e,...t]=n;return l(e,t,[],i,!1,!1,-1)}if(t===`wait`)return Vk;if(t===`type`)return await iN(c,n,e=>dN(c,e),e=>$M(c,e));if(t===`hash`)return lM(c,n);if(t===`help`)return fM(c,n);if(t===`[`||t===`test`){let e=n;if(t===`[`){if(n[n.length-1]!==`]`)return Q(`[: missing \`]'
1484
+ `,2);e=n.slice(0,-1)}return dA(c,e)}return null}async function pN(e,t,n){let{ctx:r,runCommand:i}=e;if(t.length===0)return Vk;let a=!1,o=!1,s=!1,c=t;for(;c.length>0&&c[0].startsWith(`-`);){let e=c[0];if(e===`--`){c=c.slice(1);break}for(let t of e.slice(1))t===`p`?a=!0:t===`V`?o=!0:t===`v`&&(s=!0);c=c.slice(1)}if(c.length===0)return Vk;if(s||o)return await uN(r,c,s,o);let[l,...u]=c;return i(l,u,[],n,!0,a,-1)}async function mN(e,t,n){let{runCommand:r}=e;if(t.length===0)return Vk;let i=t;if(i[0]===`--`&&(i=i.slice(1),i.length===0))return Vk;let a=i[0];if(!WA.has(a))return Q(`bash: builtin: ${a}: not a shell builtin
1485
+ `);let[,...o]=i;return r(a,o,[],n,!0,!1,-1)}async function hN(e,t,n,r,i){let{ctx:a,buildExportedEnv:o,executeUserScript:s}=e,c=await QM(a,t,i?`/usr/bin:/bin`:void 0);if(!c)return Bk(t)?Q(`bash: ${t}: command not available in browser environments. Exclude '${t}' from your commands or use the Node.js bundle.
1486
1486
  `,127):Q(`bash: ${t}: command not found
1487
1487
  `,127);if(`error`in c)return c.error===`permission_denied`?Q(`bash: ${t}: Permission denied
1488
1488
  `,126):Q(`bash: ${t}: No such file or directory
1489
- `,127);if(`script`in c)return t.includes(`/`)||(a.state.hashTable||(a.state.hashTable=new Map),a.state.hashTable.set(t,c.path)),await s(c.path,n,r);let{cmd:l,path:u}=c;t.includes(`/`)||(a.state.hashTable||(a.state.hashTable=new Map),a.state.hashTable.set(t,u));let d=r||a.state.groupStdin||``,f=o(),p=tN({fs:a.fs,cwd:a.state.cwd,env:a.state.env,exportedEnv:f,stdin:d,limits:a.limits,exec:a.execFn,fetch:a.fetch,getRegisteredCommands:()=>Array.from(a.commands.keys()),sleep:a.sleep,trace:a.trace,fileDescriptors:a.state.fileDescriptors,xpgEcho:a.state.shoptOptions.xpg_echo,coverage:a.coverage,signal:a.state.signal,requireDefenseContext:a.requireDefenseContext,jsBootstrapCode:a.jsBootstrapCode},t);try{let e=()=>fl(a.requireDefenseContext,`command`,`${t} execution`,()=>l.execute(n,p));return l.trusted?await rr.runTrustedAsync(()=>e()):await e()}catch(e){if(e instanceof k||e instanceof w)throw e;return Q(`${t}: ${Ii(Wr(e))}
1490
- `)}}BO(),A(),AO();async function mN(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r=``,i=``,a=0;try{for(let n of t){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}finally{e.state.inCondition=n}return{stdout:r,stderr:i,exitCode:a}}A(),Gr();function hN(e,t,n,r){if(e instanceof jr)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:`rethrow`,stdout:t,stderr:n,error:e}):{action:`break`,stdout:t,stderr:n};if(e instanceof Mr)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:`rethrow`,stdout:t,stderr:n,error:e}):{action:`continue`,stdout:t,stderr:n};if(e instanceof Nr||e instanceof Pr||e instanceof Ir||e instanceof k)return e.prependOutput(t,n),{action:`rethrow`,stdout:t,stderr:n,error:e};let i=Wr(e);return{action:`error`,stdout:t,stderr:`${n}${i}
1491
- `,exitCode:1}}A(),Gr();async function gN(e,t,n=``,r=``){let i=n,a=r,o=0;try{for(let n of t){let t=await e.executeStatement(n);i+=t.stdout,a+=t.stderr,o=t.exitCode}}catch(e){if(kr(e)||e instanceof Pr||e instanceof Ir||e instanceof k||e instanceof Hr)throw e.prependOutput(i,a),e;return{stdout:i,stderr:`${a}${Wr(e)}
1492
- `,exitCode:1}}return{stdout:i,stderr:a,exitCode:o}}async function _N(e,t){let n=``,r=``;for(let i of t.clauses){let t=await mN(e,i.condition);if(n+=t.stdout,r+=t.stderr,t.exitCode===0)return gN(e,i.body,n,r)}return t.elseBody?gN(e,t.elseBody,n,r):$(n,r,0)}async function vN(e,t){let n=await YA(e,t.redirections);if(n)return n;let r=``,i=``,a=0,o=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return Q(`bash: \`${t.variable}': not a valid identifier
1493
- `);let s=[];if(t.words===null)s=(e.state.env.get(`@`)||``).split(` `).filter(Boolean);else if(t.words.length===0)s=[];else try{for(let n of t.words){let t=await SO(e,n);s.push(...t.values)}}catch(e){if(e instanceof zr)return{stdout:``,stderr:e.stderr,exitCode:1};throw e}e.state.loopDepth++;try{for(let n of s){o++,o>e.limits.maxLoopIterations&&Hk(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,r,i),e.state.env.set(t.variable,n);try{for(let n of t.body){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}catch(n){let a=hN(n,r,i,e.state.loopDepth);if(r=a.stdout,i=a.stderr,a.action===`break`)break;if(a.action===`continue`)continue;if(a.action===`error`)return XA(e,$(r,i,a.exitCode??1),t.redirections);throw a.error}}}finally{e.state.loopDepth--}return XA(e,$(r,i,a),t.redirections)}async function yN(e,t){let n=await YA(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let i=``,a=``,o=0,s=0;t.init&&await Z(e,t.init.expression),e.state.loopDepth++;try{for(;s++,s>e.limits.maxLoopIterations&&Hk(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,i,a),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await Z(e,t.condition.expression)===0));){try{for(let n of t.body){let t=await e.executeStatement(n);i+=t.stdout,a+=t.stderr,o=t.exitCode}}catch(n){let r=hN(n,i,a,e.state.loopDepth);if(i=r.stdout,a=r.stderr,r.action===`break`)break;if(r.action===`continue`){t.update&&await Z(e,t.update.expression);continue}if(r.action===`error`)return XA(e,$(i,a,r.exitCode??1),t.redirections);throw r.error}t.update&&await Z(e,t.update.expression)}}finally{e.state.loopDepth--}return XA(e,$(i,a,o),t.redirections)}async function bN(e,t,n=``){let r=``,i=``,a=0,o=0,s=n;for(let n of t.redirections)if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let t=n.target,r=await X(e,t.content);t.stripTabs&&(r=r.split(`
1489
+ `,127);if(`script`in c)return t.includes(`/`)||(a.state.hashTable||(a.state.hashTable=new Map),a.state.hashTable.set(t,c.path)),await s(c.path,n,r);let{cmd:l,path:u}=c;t.includes(`/`)||(a.state.hashTable||(a.state.hashTable=new Map),a.state.hashTable.set(t,u));let d=r||a.state.groupStdin||``,f=o(),p=rN({fs:a.fs,cwd:a.state.cwd,env:a.state.env,exportedEnv:f,stdin:d,limits:a.limits,exec:a.execFn,fetch:a.fetch,getRegisteredCommands:()=>Array.from(a.commands.keys()),sleep:a.sleep,trace:a.trace,fileDescriptors:a.state.fileDescriptors,xpgEcho:a.state.shoptOptions.xpg_echo,coverage:a.coverage,signal:a.state.signal,requireDefenseContext:a.requireDefenseContext,jsBootstrapCode:a.jsBootstrapCode},t);try{let e=()=>dl(a.requireDefenseContext,`command`,`${t} execution`,()=>l.execute(n,p));return l.trusted?await rr.runTrustedAsync(()=>e()):await e()}catch(e){if(e instanceof k||e instanceof w)throw e;return Q(`${t}: ${Ii(Wr(e))}
1490
+ `)}}qO(),A(),LO();async function gN(e,t){let n=e.state.inCondition;e.state.inCondition=!0;let r=``,i=``,a=0;try{for(let n of t){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}finally{e.state.inCondition=n}return{stdout:r,stderr:i,exitCode:a}}A(),Gr();function _N(e,t,n,r){if(e instanceof jr)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:`rethrow`,stdout:t,stderr:n,error:e}):{action:`break`,stdout:t,stderr:n};if(e instanceof Mr)return t+=e.stdout,n+=e.stderr,e.levels>1&&r>1?(e.levels--,e.stdout=t,e.stderr=n,{action:`rethrow`,stdout:t,stderr:n,error:e}):{action:`continue`,stdout:t,stderr:n};if(e instanceof Nr||e instanceof Pr||e instanceof Ir||e instanceof k)return e.prependOutput(t,n),{action:`rethrow`,stdout:t,stderr:n,error:e};let i=Wr(e);return{action:`error`,stdout:t,stderr:`${n}${i}
1491
+ `,exitCode:1}}A(),Gr();async function vN(e,t,n=``,r=``){let i=n,a=r,o=0;try{for(let n of t){let t=await e.executeStatement(n);i+=t.stdout,a+=t.stderr,o=t.exitCode}}catch(e){if(kr(e)||e instanceof Pr||e instanceof Ir||e instanceof k||e instanceof Hr)throw e.prependOutput(i,a),e;return{stdout:i,stderr:`${a}${Wr(e)}
1492
+ `,exitCode:1}}return{stdout:i,stderr:a,exitCode:o}}async function yN(e,t){let n=``,r=``;for(let i of t.clauses){let t=await gN(e,i.condition);if(n+=t.stdout,r+=t.stderr,t.exitCode===0)return vN(e,i.body,n,r)}return t.elseBody?vN(e,t.elseBody,n,r):$(n,r,0)}async function bN(e,t){let n=await ZA(e,t.redirections);if(n)return n;let r=``,i=``,a=0,o=0;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(t.variable))return Q(`bash: \`${t.variable}': not a valid identifier
1493
+ `);let s=[];if(t.words===null)s=(e.state.env.get(`@`)||``).split(` `).filter(Boolean);else if(t.words.length===0)s=[];else try{for(let n of t.words){let t=await kO(e,n);s.push(...t.values)}}catch(e){if(e instanceof zr)return{stdout:``,stderr:e.stderr,exitCode:1};throw e}e.state.loopDepth++;try{for(let n of s){o++,o>e.limits.maxLoopIterations&&Wk(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,r,i),e.state.env.set(t.variable,n);try{for(let n of t.body){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}catch(n){let a=_N(n,r,i,e.state.loopDepth);if(r=a.stdout,i=a.stderr,a.action===`break`)break;if(a.action===`continue`)continue;if(a.action===`error`)return QA(e,$(r,i,a.exitCode??1),t.redirections);throw a.error}}}finally{e.state.loopDepth--}return QA(e,$(r,i,a),t.redirections)}async function xN(e,t){let n=await ZA(e,t.redirections);if(n)return n;let r=t.line;r!==void 0&&(e.state.currentLine=r);let i=``,a=``,o=0,s=0;t.init&&await Z(e,t.init.expression),e.state.loopDepth++;try{for(;s++,s>e.limits.maxLoopIterations&&Wk(`for loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,i,a),!(t.condition&&(r!==void 0&&(e.state.currentLine=r),await Z(e,t.condition.expression)===0));){try{for(let n of t.body){let t=await e.executeStatement(n);i+=t.stdout,a+=t.stderr,o=t.exitCode}}catch(n){let r=_N(n,i,a,e.state.loopDepth);if(i=r.stdout,a=r.stderr,r.action===`break`)break;if(r.action===`continue`){t.update&&await Z(e,t.update.expression);continue}if(r.action===`error`)return QA(e,$(i,a,r.exitCode??1),t.redirections);throw r.error}t.update&&await Z(e,t.update.expression)}}finally{e.state.loopDepth--}return QA(e,$(i,a,o),t.redirections)}async function SN(e,t,n=``){let r=``,i=``,a=0,o=0,s=n;for(let n of t.redirections)if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let t=n.target,r=await X(e,t.content);t.stripTabs&&(r=r.split(`
1494
1494
  `).map(e=>e.replace(/^\t+/,``)).join(`
1495
1495
  `)),s=r}else if(n.operator===`<<<`&&n.target.type===`Word`)s=`${await X(e,n.target)}
1496
1496
  `;else if(n.operator===`<`&&n.target.type===`Word`)try{let t=await X(e,n.target),r=e.fs.resolvePath(e.state.cwd,t);s=await e.fs.readFile(r)}catch{return Q(`bash: ${await X(e,n.target)}: No such file or directory
1497
- `)}let c=e.state.groupStdin;s&&(e.state.groupStdin=s),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&Hk(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,r,i);let n=0,s=!1,c=!1,l=e.state.inCondition;e.state.inCondition=!0;try{for(let a of t.condition){let t=await e.executeStatement(a);r+=t.stdout,i+=t.stderr,n=t.exitCode}}catch(t){if(t instanceof jr){if(r+=t.stdout,i+=t.stderr,t.levels>1&&e.state.loopDepth>1)throw t.levels--,t.stdout=r,t.stderr=i,e.state.inCondition=l,t;s=!0}else if(t instanceof Mr){if(r+=t.stdout,i+=t.stderr,t.levels>1&&e.state.loopDepth>1)throw t.levels--,t.stdout=r,t.stderr=i,e.state.inCondition=l,t;c=!0}else throw e.state.inCondition=l,t}finally{e.state.inCondition=l}if(s)break;if(!c){if(n!==0)break;try{for(let n of t.body){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}catch(t){let n=hN(t,r,i,e.state.loopDepth);if(r=n.stdout,i=n.stderr,n.action===`break`)break;if(n.action===`continue`)continue;if(n.action===`error`)return $(r,i,n.exitCode??1);throw n.error}}}}finally{e.state.loopDepth--,e.state.groupStdin=c}return $(r,i,a)}async function xN(e,t){let n=``,r=``,i=0,a=0;e.state.loopDepth++;try{for(;;){a++,a>e.limits.maxLoopIterations&&Hk(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,n,r);let o=await mN(e,t.condition);if(n+=o.stdout,r+=o.stderr,o.exitCode===0)break;try{for(let a of t.body){let t=await e.executeStatement(a);n+=t.stdout,r+=t.stderr,i=t.exitCode}}catch(t){let i=hN(t,n,r,e.state.loopDepth);if(n=i.stdout,r=i.stderr,i.action===`break`)break;if(i.action===`continue`)continue;if(i.action===`error`)return $(n,r,i.exitCode??1);throw i.error}}}finally{e.state.loopDepth--}return $(n,r,i)}async function SN(e,t){let n=await YA(e,t.redirections);if(n)return n;let r=``,i=``,a=0,o=await X(e,t.word),s=!1;for(let n=0;n<t.items.length;n++){let c=t.items[n],l=s;if(!s)for(let t of c.patterns){let n=await X(e,t);pO(t)&&(n=nE(n));let r=e.state.shoptOptions.nocasematch,i=e.state.shoptOptions.extglob;if(hA(o,n,r,i)){l=!0;break}}if(l){let t=await gN(e,c.body,r,i);if(r=t.stdout,i=t.stderr,a=t.exitCode,c.terminator===`;;`)break;s=c.terminator===`;&`}else s=!1}return XA(e,$(r,i,a),t.redirections)}A(),AO();function CN(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type===`Literal`?t.includes(n.value):!1}function wN(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}Gw(),AO();var TN=`+ `;async function EN(e){let t=e.state.env.get(`PS4`);if(t===void 0)return TN;if(t===``)return``;try{return await X(e,new Ww().parseWordFromString(t,!1,!1))}catch{return e.state.expansionStderr=`${e.state.expansionStderr||``}bash: ${t}: bad substitution
1498
- `,t||TN}}function DN(e){return e.map(e=>ON(e)).join(` `)}function ON(e){if(e===``)return`''`;if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let t=/[\x00-\x1f\x7f]/.test(e),n=e.includes(`
1497
+ `)}let c=e.state.groupStdin;s&&(e.state.groupStdin=s),e.state.loopDepth++;try{for(;;){o++,o>e.limits.maxLoopIterations&&Wk(`while loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,r,i);let n=0,s=!1,c=!1,l=e.state.inCondition;e.state.inCondition=!0;try{for(let a of t.condition){let t=await e.executeStatement(a);r+=t.stdout,i+=t.stderr,n=t.exitCode}}catch(t){if(t instanceof jr){if(r+=t.stdout,i+=t.stderr,t.levels>1&&e.state.loopDepth>1)throw t.levels--,t.stdout=r,t.stderr=i,e.state.inCondition=l,t;s=!0}else if(t instanceof Mr){if(r+=t.stdout,i+=t.stderr,t.levels>1&&e.state.loopDepth>1)throw t.levels--,t.stdout=r,t.stderr=i,e.state.inCondition=l,t;c=!0}else throw e.state.inCondition=l,t}finally{e.state.inCondition=l}if(s)break;if(!c){if(n!==0)break;try{for(let n of t.body){let t=await e.executeStatement(n);r+=t.stdout,i+=t.stderr,a=t.exitCode}}catch(t){let n=_N(t,r,i,e.state.loopDepth);if(r=n.stdout,i=n.stderr,n.action===`break`)break;if(n.action===`continue`)continue;if(n.action===`error`)return $(r,i,n.exitCode??1);throw n.error}}}}finally{e.state.loopDepth--,e.state.groupStdin=c}return $(r,i,a)}async function CN(e,t){let n=``,r=``,i=0,a=0;e.state.loopDepth++;try{for(;;){a++,a>e.limits.maxLoopIterations&&Wk(`until loop: too many iterations (${e.limits.maxLoopIterations}), increase executionLimits.maxLoopIterations`,`iterations`,n,r);let o=await gN(e,t.condition);if(n+=o.stdout,r+=o.stderr,o.exitCode===0)break;try{for(let a of t.body){let t=await e.executeStatement(a);n+=t.stdout,r+=t.stderr,i=t.exitCode}}catch(t){let i=_N(t,n,r,e.state.loopDepth);if(n=i.stdout,r=i.stderr,i.action===`break`)break;if(i.action===`continue`)continue;if(i.action===`error`)return $(n,r,i.exitCode??1);throw i.error}}}finally{e.state.loopDepth--}return $(n,r,i)}async function wN(e,t){let n=await ZA(e,t.redirections);if(n)return n;let r=``,i=``,a=0,o=await X(e,t.word),s=!1;for(let n=0;n<t.items.length;n++){let c=t.items[n],l=s;if(!s)for(let t of c.patterns){let n=await X(e,t);bO(t)&&(n=lE(n));let r=e.state.shoptOptions.nocasematch,i=e.state.shoptOptions.extglob;if(_A(o,n,r,i)){l=!0;break}}if(l){let t=await vN(e,c.body,r,i);if(r=t.stdout,i=t.stderr,a=t.exitCode,c.terminator===`;;`)break;s=c.terminator===`;&`}else s=!1}return QA(e,$(r,i,a),t.redirections)}A(),LO();function TN(e,t){if(e.parts.length!==1)return!1;let n=e.parts[0];return n.type===`Literal`?t.includes(n.value):!1}function EN(e){if(!e.startsWith(`__rw__:`))return null;let t=e.slice(7),n=t.indexOf(`:`);if(n===-1)return null;let r=Number.parseInt(t.slice(0,n),10);if(Number.isNaN(r)||r<0)return null;let i=n+1,a=t.slice(i,i+r),o=i+r+1,s=t.slice(o),c=s.indexOf(`:`);if(c===-1)return null;let l=Number.parseInt(s.slice(0,c),10);return Number.isNaN(l)||l<0?null:{path:a,position:l,content:s.slice(c+1)}}Qw(),LO();var DN=`+ `;async function ON(e){let t=e.state.env.get(`PS4`);if(t===void 0)return DN;if(t===``)return``;try{return await X(e,new Zw().parseWordFromString(t,!1,!1))}catch{return e.state.expansionStderr=`${e.state.expansionStderr||``}bash: ${t}: bad substitution
1498
+ `,t||DN}}function kN(e){return e.map(e=>AN(e)).join(` `)}function AN(e){if(e===``)return`''`;if(!/[\s'"\\$`!*?[\]{}|&;<>()~#\n\t]/.test(e))return e;let t=/[\x00-\x1f\x7f]/.test(e),n=e.includes(`
1499
1499
  `),r=e.includes(` `),i=e.includes(`\\`),a=e.includes(`'`);if(t||n||r||i){let t=``;for(let n of e){let e=n.charCodeAt(0);n===`
1500
- `?t+=`\\n`:n===` `?t+=`\\t`:n===`\\`?t+=`\\\\`:n===`'`?t+=`'`:n===`"`?t+=`"`:e<32||e===127?e<256?t+=`\\x${e.toString(16).padStart(2,`0`)}`:t+=`\\u${e.toString(16).padStart(4,`0`)}`:t+=n}return`$'${t}'`}return a?`"${e.replace(/([\\$`"])/g,`\\$1`)}"`:`'${e}'`}async function kN(e,t,n){return e.state.options.xtrace?`${await EN(e)}${DN([t,...n])}
1501
- `:``}async function AN(e,t,n){return e.state.options.xtrace?`${await EN(e)}${t}=${n}
1502
- `:``}Gv(),A();async function jN(e,t,n){let r=t.timed?Uv():0,i=``,a=zk,o=0,s=[],c=``,l=t.commands.length>1,u=e.state.lastArg;for(let r=0;r<t.commands.length;r++){let u=t.commands[r],d=r===t.commands.length-1,f=r===0;l&&(e.state.lastArg=``,f||(e.state.groupStdin=void 0));let p=l&&(!d||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,m;try{m=await n(u,i)}catch(n){if(n instanceof Rr)m={stdout:n.stdout,stderr:n.stderr,exitCode:1};else if(n instanceof Ir&&t.commands.length>1)m={stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode};else if(n instanceof Pr&&t.commands.length>1)m={stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode};else throw p&&(e.state.env=p),n}p&&(e.state.env=p),s.push(m.exitCode),m.exitCode!==0&&(o=m.exitCode),d?a=m:(t.pipeStderr?.[r]??!1?i=m.stderr+m.stdout:(i=m.stdout,c+=m.stderr),a={stdout:``,stderr:``,exitCode:m.exitCode})}if(c&&(a={...a,stderr:c+a.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type===`SimpleCommand`){for(let t of e.state.env.keys())t.startsWith(`PIPESTATUS_`)&&e.state.env.delete(t);for(let t=0;t<s.length;t++)e.state.env.set(`PIPESTATUS_${t}`,String(s[t]));e.state.env.set(`PIPESTATUS__length`,String(s.length))}if(e.state.options.pipefail&&o!==0&&(a={...a,exitCode:o}),t.negated&&(a={...a,exitCode:+(a.exitCode===0)}),t.timed){let e=(Uv()-r)/1e3,n=Math.floor(e/60),i=e%60,o;o=t.timePosix?`real ${e.toFixed(2)}
1500
+ `?t+=`\\n`:n===` `?t+=`\\t`:n===`\\`?t+=`\\\\`:n===`'`?t+=`'`:n===`"`?t+=`"`:e<32||e===127?e<256?t+=`\\x${e.toString(16).padStart(2,`0`)}`:t+=`\\u${e.toString(16).padStart(4,`0`)}`:t+=n}return`$'${t}'`}return a?`"${e.replace(/([\\$`"])/g,`\\$1`)}"`:`'${e}'`}async function jN(e,t,n){return e.state.options.xtrace?`${await ON(e)}${kN([t,...n])}
1501
+ `:``}async function MN(e,t,n){return e.state.options.xtrace?`${await ON(e)}${t}=${n}
1502
+ `:``}Gv(),A();async function NN(e,t,n){let r=t.timed?Uv():0,i=``,a=Vk,o=0,s=[],c=``,l=t.commands.length>1,u=e.state.lastArg;for(let r=0;r<t.commands.length;r++){let u=t.commands[r],d=r===t.commands.length-1,f=r===0;l&&(e.state.lastArg=``,f||(e.state.groupStdin=void 0));let p=l&&(!d||!e.state.shoptOptions.lastpipe)?new Map(e.state.env):null,m;try{m=await n(u,i)}catch(n){if(n instanceof Rr)m={stdout:n.stdout,stderr:n.stderr,exitCode:1};else if(n instanceof Ir&&t.commands.length>1)m={stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode};else if(n instanceof Pr&&t.commands.length>1)m={stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode};else throw p&&(e.state.env=p),n}p&&(e.state.env=p),s.push(m.exitCode),m.exitCode!==0&&(o=m.exitCode),d?a=m:(t.pipeStderr?.[r]??!1?i=m.stderr+m.stdout:(i=m.stdout,c+=m.stderr),a={stdout:``,stderr:``,exitCode:m.exitCode})}if(c&&(a={...a,stderr:c+a.stderr}),t.commands.length>1||t.commands.length===1&&t.commands[0].type===`SimpleCommand`){for(let t of e.state.env.keys())t.startsWith(`PIPESTATUS_`)&&e.state.env.delete(t);for(let t=0;t<s.length;t++)e.state.env.set(`PIPESTATUS_${t}`,String(s[t]));e.state.env.set(`PIPESTATUS__length`,String(s.length))}if(e.state.options.pipefail&&o!==0&&(a={...a,exitCode:o}),t.negated&&(a={...a,exitCode:+(a.exitCode===0)}),t.timed){let e=(Uv()-r)/1e3,n=Math.floor(e/60),i=e%60,o;o=t.timePosix?`real ${e.toFixed(2)}
1503
1503
  user 0.00
1504
1504
  sys 0.00
1505
1505
  `:`
1506
1506
  real ${`${n}m${i.toFixed(3)}s`}
1507
1507
  user 0m0.000s
1508
1508
  sys 0m0.000s
1509
- `,a={...a,stderr:a.stderr+o}}return l&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),a}zC(),Gw(),BO(),A(),AO(),mT(),RT(),DE();async function MN(e,t){let n=new Map,r=``;for(let i of t.assignments){let a=i.name;if(i.array){let o=await NN(e,t,a,i.array,i.append,n);if(o.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:o.error};if(r+=o.xtraceOutput,o.continueToNext)continue}let o=i.value?await X(e,i.value):``;if(a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:$(``,`bash: ${a}: bad array subscript
1510
- `,1)};let s=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let a=await RN(e,t,s[1],s[2],o,i.append,n);if(a.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:a.error};if(a.continueToNext)continue}let c=await VN(e,t,a,o,i.append,n);if(c.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:c.error};r+=c.xtraceOutput,c.continueToNext}return{continueToNext:!1,xtraceOutput:r,tempAssignments:n}}async function NN(e,t,n,r,i,a){let o=``;if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: cannot assign list to array member
1511
- `,1)};if(OT(e,n)){let t=IT(e,n);if(t===void 0||t===``)throw new Ir(1,``,``);let r=FT(e,n);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(r))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: cannot assign list to array member
1512
- `,1)}}if(CE(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1513
- `,{continueToNext:!0,xtraceOutput:o};let r=wE(e,n);if(r)return{continueToNext:!1,xtraceOutput:``,error:r}}let s=e.state.associativeArrays?.has(n),c=PN(r),l=()=>{let t=`${n}_`;for(let n of e.state.env.keys())n.startsWith(t)&&!n.includes(`__`)&&e.state.env.delete(n);e.state.env.delete(n)};if(s&&c?await FN(e,t,n,r,i,l,e=>{o+=e}):c?await IN(e,n,r,i,l):await LN(e,n,r,i,l),t.name){a.set(n,e.state.env.get(n));let t=`(${r.map(e=>pT(e)).join(` `)})`;e.state.env.set(n,t)}return{continueToNext:!0,xtraceOutput:o}}function PN(e){return e.some(e=>{if(e.parts.length>=2){let t=e.parts[0],n=e.parts[1];if(t.type!==`Glob`||!t.pattern.startsWith(`[`))return!1;if(t.pattern===`[`&&(n.type===`DoubleQuoted`||n.type===`SingleQuoted`)){if(e.parts.length<3)return!1;let t=e.parts[2];return t.type===`Literal`?t.value.startsWith(`]=`)||t.value.startsWith(`]+=`):!1}return n.type===`Literal`?n.value.startsWith(`]`)?n.value.startsWith(`]=`)||n.value.startsWith(`]+=`):t.pattern.endsWith(`]`)?n.value.startsWith(`=`)||n.value.startsWith(`+=`):!1:!1}return!1})}async function FN(e,t,n,r,i,a,o){let s=[];for(let t of r){let n=dT(t);if(n){let{key:t,valueParts:r,append:i}=n,a;a=r.length>0?await X(e,{type:`Word`,parts:r}):``,a=Dj(e,a),s.push({type:`keyed`,key:t,value:a,append:i})}else{let n=await X(e,t);s.push({type:`invalid`,expandedValue:n})}}i||a();for(let r of s)if(r.type===`keyed`)if(r.append){let t=e.state.env.get(`${n}_${r.key}`)??``;e.state.env.set(`${n}_${r.key}`,t+r.value)}else e.state.env.set(`${n}_${r.key}`,r.value);else o(`bash: line ${t.line??e.state.currentLine??1}: ${n}: ${r.expandedValue}: must use subscript when assigning associative array
1514
- `)}async function IN(e,t,n,r,i){let a=[];for(let t of n){let n=dT(t);if(n){let{key:t,valueParts:r,append:i}=n,o;o=r.length>0?await X(e,{type:`Word`,parts:r}):``,o=Dj(e,o),a.push({type:`keyed`,indexExpr:t,value:o,append:i})}else{let n=await SO(e,t);a.push({type:`non-keyed`,values:n.values})}}r||i();let o=0;for(let n of a)if(n.type===`keyed`){let r;try{r=await Z(e,vC(new Ww,n.indexExpr).expression,!1)}catch{if(/^-?\d+$/.test(n.indexExpr))r=Number.parseInt(n.indexExpr,10);else{let t=e.state.env.get(n.indexExpr);r=t?Number.parseInt(t,10):0,Number.isNaN(r)&&(r=0)}}if(n.append){let i=e.state.env.get(`${t}_${r}`)??``;e.state.env.set(`${t}_${r}`,i+n.value)}else e.state.env.set(`${t}_${r}`,n.value);o=r+1}else for(let r of n.values)e.state.env.set(`${t}_${o++}`,r)}async function LN(e,t,n,r,i){let a=[];for(let t of n){let n=await SO(e,t);a.push(...n.values)}let o=0;if(r){let n=J(e,t);if(n.length>0)o=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1;else{let n=e.state.env.get(t);n!==void 0&&(e.state.env.set(`${t}_0`,n),e.state.env.delete(t),o=1)}}else i();for(let n=0;n<a.length;n++)e.state.env.set(`${t}_${o+n}`,a[n]);r||e.state.env.set(`${t}__length`,String(a.length))}async function RN(e,t,n,r,i,a,o){let s=n;if(OT(e,n)){let t=FT(e,n);if(t&&t!==n){if(t.includes(`[`))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: \`${t}': not a valid identifier
1515
- `,1)};s=t}}if(CE(e,s)){if(t.name)return{continueToNext:!0,xtraceOutput:``};let n=wE(e,s);if(n)return{continueToNext:!1,xtraceOutput:``,error:n}}let c=e.state.associativeArrays?.has(s),l;if(c)l=await zN(e,s,r);else{let t=await BN(e,s,r);if(t.error)return{continueToNext:!1,xtraceOutput:``,error:t.error};l=`${s}_${t.index}`}let u=a?(e.state.env.get(l)||``)+i:i;if(t.name)o.set(l,e.state.env.get(l)),e.state.env.set(l,u);else{let t=PA(e,s);if(t!==void 0&&t===e.state.callDepth&&e.state.localScopes.length>0){let t=e.state.localScopes[e.state.localScopes.length-1];t.has(l)||t.set(l,e.state.env.get(l))}e.state.env.set(l,u)}return{continueToNext:!0,xtraceOutput:``}}async function zN(e,t,n){let r;if(n.startsWith(`'`)&&n.endsWith(`'`))r=n.slice(1,-1);else if(n.startsWith(`"`)&&n.endsWith(`"`)){let t=n.slice(1,-1);r=await X(e,new Ww().parseWordFromString(t,!0,!1))}else r=n.includes(`$`)?await X(e,new Ww().parseWordFromString(n,!1,!1)):n;return`${t}_${r}`}async function BN(e,t,n){let r=n;n.startsWith(`"`)&&n.endsWith(`"`)&&n.length>=2&&(r=n.slice(1,-1));let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{i=await Z(e,vC(new Ww,r).expression,!1)}catch(t){if(t instanceof Lr){let r=`bash: line ${e.state.currentLine}: ${n}: ${t.message}
1509
+ `,a={...a,stderr:a.stderr+o}}return l&&!e.state.shoptOptions.lastpipe&&(e.state.lastArg=u),a}KC(),Qw(),qO(),A(),LO(),xT(),GT(),PE();async function PN(e,t){let n=new Map,r=``;for(let i of t.assignments){let a=i.name;if(i.array){let o=await FN(e,t,a,i.array,i.append,n);if(o.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:o.error};if(r+=o.xtraceOutput,o.continueToNext)continue}let o=i.value?await X(e,i.value):``;if(a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[\]$/))return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:$(``,`bash: ${a}: bad array subscript
1510
+ `,1)};let s=a.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);if(s){let a=await BN(e,t,s[1],s[2],o,i.append,n);if(a.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:a.error};if(a.continueToNext)continue}let c=await UN(e,t,a,o,i.append,n);if(c.error)return{continueToNext:!1,xtraceOutput:r,tempAssignments:n,error:c.error};r+=c.xtraceOutput,c.continueToNext}return{continueToNext:!1,xtraceOutput:r,tempAssignments:n}}async function FN(e,t,n,r,i,a){let o=``;if(/\[.+\]$/.test(n))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: cannot assign list to array member
1511
+ `,1)};if(FT(e,n)){let t=UT(e,n);if(t===void 0||t===``)throw new Ir(1,``,``);let r=HT(e,n);if(r&&/^[a-zA-Z_][a-zA-Z0-9_]*\[@\]$/.test(r))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: cannot assign list to array member
1512
+ `,1)}}if(AE(e,n)){if(t.name)return o+=`bash: ${n}: readonly variable
1513
+ `,{continueToNext:!0,xtraceOutput:o};let r=jE(e,n);if(r)return{continueToNext:!1,xtraceOutput:``,error:r}}let s=e.state.associativeArrays?.has(n),c=IN(r),l=()=>{let t=`${n}_`;for(let n of e.state.env.keys())n.startsWith(t)&&!n.includes(`__`)&&e.state.env.delete(n);e.state.env.delete(n)};if(s&&c?await LN(e,t,n,r,i,l,e=>{o+=e}):c?await RN(e,n,r,i,l):await zN(e,n,r,i,l),t.name){a.set(n,e.state.env.get(n));let t=`(${r.map(e=>bT(e)).join(` `)})`;e.state.env.set(n,t)}return{continueToNext:!0,xtraceOutput:o}}function IN(e){return e.some(e=>{if(e.parts.length>=2){let t=e.parts[0],n=e.parts[1];if(t.type!==`Glob`||!t.pattern.startsWith(`[`))return!1;if(t.pattern===`[`&&(n.type===`DoubleQuoted`||n.type===`SingleQuoted`)){if(e.parts.length<3)return!1;let t=e.parts[2];return t.type===`Literal`?t.value.startsWith(`]=`)||t.value.startsWith(`]+=`):!1}return n.type===`Literal`?n.value.startsWith(`]`)?n.value.startsWith(`]=`)||n.value.startsWith(`]+=`):t.pattern.endsWith(`]`)?n.value.startsWith(`=`)||n.value.startsWith(`+=`):!1:!1}return!1})}async function LN(e,t,n,r,i,a,o){let s=[];for(let t of r){let n=vT(t);if(n){let{key:t,valueParts:r,append:i}=n,a;a=r.length>0?await X(e,{type:`Word`,parts:r}):``,a=kj(e,a),s.push({type:`keyed`,key:t,value:a,append:i})}else{let n=await X(e,t);s.push({type:`invalid`,expandedValue:n})}}i||a();for(let r of s)if(r.type===`keyed`)if(r.append){let t=e.state.env.get(`${n}_${r.key}`)??``;e.state.env.set(`${n}_${r.key}`,t+r.value)}else e.state.env.set(`${n}_${r.key}`,r.value);else o(`bash: line ${t.line??e.state.currentLine??1}: ${n}: ${r.expandedValue}: must use subscript when assigning associative array
1514
+ `)}async function RN(e,t,n,r,i){let a=[];for(let t of n){let n=vT(t);if(n){let{key:t,valueParts:r,append:i}=n,o;o=r.length>0?await X(e,{type:`Word`,parts:r}):``,o=kj(e,o),a.push({type:`keyed`,indexExpr:t,value:o,append:i})}else{let n=await kO(e,t);a.push({type:`non-keyed`,values:n.values})}}r||i();let o=0;for(let n of a)if(n.type===`keyed`){let r;try{r=await Z(e,TC(new Zw,n.indexExpr).expression,!1)}catch{if(/^-?\d+$/.test(n.indexExpr))r=Number.parseInt(n.indexExpr,10);else{let t=e.state.env.get(n.indexExpr);r=t?Number.parseInt(t,10):0,Number.isNaN(r)&&(r=0)}}if(n.append){let i=e.state.env.get(`${t}_${r}`)??``;e.state.env.set(`${t}_${r}`,i+n.value)}else e.state.env.set(`${t}_${r}`,n.value);o=r+1}else for(let r of n.values)e.state.env.set(`${t}_${o++}`,r)}async function zN(e,t,n,r,i){let a=[];for(let t of n){let n=await kO(e,t);a.push(...n.values)}let o=0;if(r){let n=J(e,t);if(n.length>0)o=Math.max(...n.map(([e])=>typeof e==`number`?e:0))+1;else{let n=e.state.env.get(t);n!==void 0&&(e.state.env.set(`${t}_0`,n),e.state.env.delete(t),o=1)}}else i();for(let n=0;n<a.length;n++)e.state.env.set(`${t}_${o+n}`,a[n]);r||e.state.env.set(`${t}__length`,String(a.length))}async function BN(e,t,n,r,i,a,o){let s=n;if(FT(e,n)){let t=HT(e,n);if(t&&t!==n){if(t.includes(`[`))return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: \`${t}': not a valid identifier
1515
+ `,1)};s=t}}if(AE(e,s)){if(t.name)return{continueToNext:!0,xtraceOutput:``};let n=jE(e,s);if(n)return{continueToNext:!1,xtraceOutput:``,error:n}}let c=e.state.associativeArrays?.has(s),l;if(c)l=await VN(e,s,r);else{let t=await HN(e,s,r);if(t.error)return{continueToNext:!1,xtraceOutput:``,error:t.error};l=`${s}_${t.index}`}let u=a?(e.state.env.get(l)||``)+i:i;if(t.name)o.set(l,e.state.env.get(l)),e.state.env.set(l,u);else{let t=IA(e,s);if(t!==void 0&&t===e.state.callDepth&&e.state.localScopes.length>0){let t=e.state.localScopes[e.state.localScopes.length-1];t.has(l)||t.set(l,e.state.env.get(l))}e.state.env.set(l,u)}return{continueToNext:!0,xtraceOutput:``}}async function VN(e,t,n){let r;if(n.startsWith(`'`)&&n.endsWith(`'`))r=n.slice(1,-1);else if(n.startsWith(`"`)&&n.endsWith(`"`)){let t=n.slice(1,-1);r=await X(e,new Zw().parseWordFromString(t,!0,!1))}else r=n.includes(`$`)?await X(e,new Zw().parseWordFromString(n,!1,!1)):n;return`${t}_${r}`}async function HN(e,t,n){let r=n;n.startsWith(`"`)&&n.endsWith(`"`)&&n.length>=2&&(r=n.slice(1,-1));let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{i=await Z(e,TC(new Zw,r).expression,!1)}catch(t){if(t instanceof Lr){let r=`bash: line ${e.state.currentLine}: ${n}: ${t.message}
1516
1516
  `;if(t.fatal)throw new Ir(1,``,r);return{index:0,error:$(``,r,1)}}let r=e.state.env.get(n);i=r?Number.parseInt(r,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let r=J(e,t);if(r.length===0){let r=e.state.currentLine;return{index:0,error:$(``,`bash: line ${r}: ${t}[${n}]: bad array subscript
1517
1517
  `,1)}}if(i=Math.max(...r.map(([e])=>typeof e==`number`?e:0))+1+i,i<0){let r=e.state.currentLine;return{index:0,error:$(``,`bash: line ${r}: ${t}[${n}]: bad array subscript
1518
- `,1)}}}return{index:i}}async function VN(e,t,n,r,i,a){let o=``,s=n,c=null;if(OT(e,n)){let t=LT(e,n,r);if(t===void 0)return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: circular name reference
1519
- `,1)};if(t===null)return{continueToNext:!0,xtraceOutput:``};s=t;let i=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);i&&(c={arrayName:i[1],subscriptExpr:i[2]},s=i[1])}if(CE(e,s)){if(t.name)return o+=`bash: ${s}: readonly variable
1520
- `,{continueToNext:!0,xtraceOutput:o};let n=wE(e,s);if(n)return{continueToNext:!1,xtraceOutput:``,error:n}}let l;if(Vj(e,s))try{let t=new Ww;if(i){let n=vC(t,`(${e.state.env.get(s)||`0`}) + (${r})`);l=String(await Z(e,n.expression))}else{let n=vC(t,r);l=String(await Z(e,n.expression))}}catch{l=`0`}else{let{isArray:t}=await Promise.resolve().then(()=>(AO(),lO)),n=t(e,s)?`${s}_0`:s;l=i?(e.state.env.get(n)||``)+r:r}l=Kj(e,s,l),o+=await AN(e,s,l);let u=s;if(c)u=await HN(e,c);else{let{isArray:t}=await Promise.resolve().then(()=>(AO(),lO));t(e,s)&&(u=`${s}_0`)}return t.name?(a.set(u,e.state.env.get(u)),e.state.env.set(u,l)):(e.state.env.set(u,l),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(s)),e.state.tempEnvBindings?.some(e=>e.has(s))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(s))),{continueToNext:!1,xtraceOutput:o}}async function HN(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return zN(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{i=await Z(e,vC(new Ww,r).expression,!1)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let t=J(e,n);t.length>0&&(i=Math.max(...t.map(e=>e[0]))+1+i)}return`${n}_${i}`}Gw(),A(),AO(),Gr();async function UN(e,t,n,r){let i=await YA(e,t.redirections);if(i)return i;let a=new Map(e.state.env),o=e.state.cwd,s={...e.state.options},c=new Map(e.state.functions),l=e.state.localScopes,u=e.state.localVarStack,d=e.state.localVarDepth,f=e.state.fullyUnsetLocals;if(e.state.localScopes=l.map(e=>new Map(e)),u){e.state.localVarStack=new Map;for(let[t,n]of u.entries())e.state.localVarStack.set(t,n.map(e=>({...e})))}d&&(e.state.localVarDepth=new Map(d)),f&&(e.state.fullyUnsetLocals=new Map(f));let p=e.state.loopDepth,m=e.state.parentHasLoopContext;e.state.parentHasLoopContext=p>0,e.state.loopDepth=0;let h=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let _=e.state.groupStdin;n&&(e.state.groupStdin=n);let v=``,y=``,ee=0,te=()=>{e.state.env=a,e.state.cwd=o,e.state.options=s,e.state.functions=c,e.state.localScopes=l,e.state.localVarStack=u,e.state.localVarDepth=d,e.state.fullyUnsetLocals=f,e.state.loopDepth=p,e.state.parentHasLoopContext=m,e.state.groupStdin=_,e.state.bashPid=g,e.state.lastArg=h};try{for(let e of t.body){let t=await r(e);v+=t.stdout,y+=t.stderr,ee=t.exitCode}}catch(n){if(te(),n instanceof k)throw n;return n instanceof Hr||n instanceof jr||n instanceof Mr?(v+=n.stdout,y+=n.stderr,XA(e,$(v,y,0),t.redirections)):n instanceof Ir||n instanceof Nr?(v+=n.stdout,y+=n.stderr,XA(e,$(v,y,n.exitCode),t.redirections)):n instanceof Pr?XA(e,$(v+n.stdout,y+n.stderr,n.exitCode),t.redirections):XA(e,$(v,`${y}${Wr(n)}
1521
- `,1),t.redirections)}return te(),XA(e,$(v,y,ee),t.redirections)}async function WN(e,t,n,r){let i=``,a=``,o=0,s=await JA(e,t.redirections);if(s)return s;let c=n;for(let n of t.redirections)if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let t=n.target,r=await X(e,t.content);t.stripTabs&&(r=r.split(`
1518
+ `,1)}}}return{index:i}}async function UN(e,t,n,r,i,a){let o=``,s=n,c=null;if(FT(e,n)){let t=WT(e,n,r);if(t===void 0)return{continueToNext:!1,xtraceOutput:``,error:$(``,`bash: ${n}: circular name reference
1519
+ `,1)};if(t===null)return{continueToNext:!0,xtraceOutput:``};s=t;let i=s.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\[(.+)\]$/);i&&(c={arrayName:i[1],subscriptExpr:i[2]},s=i[1])}if(AE(e,s)){if(t.name)return o+=`bash: ${s}: readonly variable
1520
+ `,{continueToNext:!0,xtraceOutput:o};let n=jE(e,s);if(n)return{continueToNext:!1,xtraceOutput:``,error:n}}let l;if(Uj(e,s))try{let t=new Zw;if(i){let n=TC(t,`(${e.state.env.get(s)||`0`}) + (${r})`);l=String(await Z(e,n.expression))}else{let n=TC(t,r);l=String(await Z(e,n.expression))}}catch{l=`0`}else{let{isArray:t}=await Promise.resolve().then(()=>(LO(),gO)),n=t(e,s)?`${s}_0`:s;l=i?(e.state.env.get(n)||``)+r:r}l=Jj(e,s,l),o+=await MN(e,s,l);let u=s;if(c)u=await WN(e,c);else{let{isArray:t}=await Promise.resolve().then(()=>(LO(),gO));t(e,s)&&(u=`${s}_0`)}return t.name?(a.set(u,e.state.env.get(u)),e.state.env.set(u,l)):(e.state.env.set(u,l),e.state.options.allexport&&(e.state.exportedVars=e.state.exportedVars||new Set,e.state.exportedVars.add(s)),e.state.tempEnvBindings?.some(e=>e.has(s))&&(e.state.mutatedTempEnvVars=e.state.mutatedTempEnvVars||new Set,e.state.mutatedTempEnvVars.add(s))),{continueToNext:!1,xtraceOutput:o}}async function WN(e,t){let{arrayName:n,subscriptExpr:r}=t;if(e.state.associativeArrays?.has(n))return VN(e,n,r);let i;if(/^-?\d+$/.test(r))i=Number.parseInt(r,10);else{try{i=await Z(e,TC(new Zw,r).expression,!1)}catch{let t=e.state.env.get(r);i=t?Number.parseInt(t,10):0}Number.isNaN(i)&&(i=0)}if(i<0){let t=J(e,n);t.length>0&&(i=Math.max(...t.map(e=>e[0]))+1+i)}return`${n}_${i}`}Qw(),A(),LO(),Gr();async function GN(e,t,n,r){let i=await ZA(e,t.redirections);if(i)return i;let a=new Map(e.state.env),o=e.state.cwd,s={...e.state.options},c=new Map(e.state.functions),l=e.state.localScopes,u=e.state.localVarStack,d=e.state.localVarDepth,f=e.state.fullyUnsetLocals;if(e.state.localScopes=l.map(e=>new Map(e)),u){e.state.localVarStack=new Map;for(let[t,n]of u.entries())e.state.localVarStack.set(t,n.map(e=>({...e})))}d&&(e.state.localVarDepth=new Map(d)),f&&(e.state.fullyUnsetLocals=new Map(f));let p=e.state.loopDepth,m=e.state.parentHasLoopContext;e.state.parentHasLoopContext=p>0,e.state.loopDepth=0;let h=e.state.lastArg,g=e.state.bashPid;e.state.bashPid=e.state.nextVirtualPid++;let _=e.state.groupStdin;n&&(e.state.groupStdin=n);let v=``,y=``,ee=0,te=()=>{e.state.env=a,e.state.cwd=o,e.state.options=s,e.state.functions=c,e.state.localScopes=l,e.state.localVarStack=u,e.state.localVarDepth=d,e.state.fullyUnsetLocals=f,e.state.loopDepth=p,e.state.parentHasLoopContext=m,e.state.groupStdin=_,e.state.bashPid=g,e.state.lastArg=h};try{for(let e of t.body){let t=await r(e);v+=t.stdout,y+=t.stderr,ee=t.exitCode}}catch(n){if(te(),n instanceof k)throw n;return n instanceof Hr||n instanceof jr||n instanceof Mr?(v+=n.stdout,y+=n.stderr,QA(e,$(v,y,0),t.redirections)):n instanceof Ir||n instanceof Nr?(v+=n.stdout,y+=n.stderr,QA(e,$(v,y,n.exitCode),t.redirections)):n instanceof Pr?QA(e,$(v+n.stdout,y+n.stderr,n.exitCode),t.redirections):QA(e,$(v,`${y}${Wr(n)}
1521
+ `,1),t.redirections)}return te(),QA(e,$(v,y,ee),t.redirections)}async function KN(e,t,n,r){let i=``,a=``,o=0,s=await XA(e,t.redirections);if(s)return s;let c=n;for(let n of t.redirections)if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let t=n.target,r=await X(e,t.content);t.stripTabs&&(r=r.split(`
1522
1522
  `).map(e=>e.replace(/^\t+/,``)).join(`
1523
- `));let i=n.fd??0;i===0?c=r:(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),Uk(e),e.state.fileDescriptors.set(i,r))}else if(n.operator===`<<<`&&n.target.type===`Word`)c=`${await X(e,n.target)}
1523
+ `));let i=n.fd??0;i===0?c=r:(e.state.fileDescriptors||(e.state.fileDescriptors=new Map),Gk(e),e.state.fileDescriptors.set(i,r))}else if(n.operator===`<<<`&&n.target.type===`Word`)c=`${await X(e,n.target)}
1524
1524
  `;else if(n.operator===`<`&&n.target.type===`Word`)try{let t=await X(e,n.target),r=e.fs.resolvePath(e.state.cwd,t);c=await e.fs.readFile(r)}catch{return $(``,`bash: ${await X(e,n.target)}: No such file or directory
1525
1525
  `,1)}let l=e.state.groupStdin;c&&(e.state.groupStdin=c);try{for(let e of t.body){let t=await r(e);i+=t.stdout,a+=t.stderr,o=t.exitCode}}catch(t){if(e.state.groupStdin=l,t instanceof k)throw t;if(kr(t)||t instanceof Pr||t instanceof Ir)throw t.prependOutput(i,a),t;return $(i,`${a}${Wr(t)}
1526
- `,1)}return e.state.groupStdin=l,XA(e,$(i,a,o),t.redirections)}async function GN(e,t,n,r,i){let a;try{a=await e.fs.readFile(t)}catch{return Q(`bash: ${t}: No such file or directory
1526
+ `,1)}return e.state.groupStdin=l,QA(e,$(i,a,o),t.redirections)}async function qN(e,t,n,r,i){let a;try{a=await e.fs.readFile(t)}catch{return Q(`bash: ${t}: No such file or directory
1527
1527
  `,127)}if(a.startsWith(`#!`)){let e=a.indexOf(`
1528
- `);e!==-1&&(a=a.slice(e+1))}let o=new Map(e.state.env),s=e.state.cwd,c={...e.state.options},l=e.state.loopDepth,u=e.state.parentHasLoopContext,d=e.state.lastArg,f=e.state.bashPid,p=e.state.groupStdin,m=e.state.currentSource;e.state.parentHasLoopContext=l>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,r&&(e.state.groupStdin=r),e.state.currentSource=t,e.state.env.set(`0`,t),e.state.env.set(`#`,String(n.length)),e.state.env.set(`@`,n.join(` `)),e.state.env.set(`*`,n.join(` `));for(let t=0;t<n.length&&t<9;t++)e.state.env.set(String(t+1),n[t]);for(let t=n.length+1;t<=9;t++)e.state.env.delete(String(t));let h=()=>{e.state.env=o,e.state.cwd=s,e.state.options=c,e.state.loopDepth=l,e.state.parentHasLoopContext=u,e.state.lastArg=d,e.state.bashPid=f,e.state.groupStdin=p,e.state.currentSource=m};try{let e=await i(new Ww().parse(a));return h(),e}catch(e){if(h(),e instanceof Ir||e instanceof k)throw e;if(e.name===`ParseException`)return Q(`bash: ${t}: ${e.message}
1529
- `);throw e}}var KN=class{ctx;constructor(e,t){this.ctx={state:t,fs:e.fs,commands:e.commands,limits:e.limits,execFn:e.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:e.fetch,sleep:e.sleep,trace:e.trace,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext??!1,jsBootstrapCode:e.jsBootstrapCode}}assertDefenseContext(e){if(!this.ctx.requireDefenseContext||rr.isInSandboxedContext())return;let t=`interpreter ${e} attempted outside defense context`;throw new w(t,{timestamp:Date.now(),type:`missing_defense_context`,message:t,path:`DefenseInDepthBox.context`,stack:Error().stack,executionId:rr.getCurrentExecutionId()})}buildExportedEnv(){let e=this.ctx.state.exportedVars,t=this.ctx.state.tempExportedVars,n=new Set;if(e)for(let t of e)n.add(t);if(t)for(let e of t)n.add(e);if(n.size===0)return Object.create(null);let r=Object.create(null);for(let e of n){let t=this.ctx.state.env.get(e);t!==void 0&&(r[e]=t)}return r}async executeScript(e){this.assertDefenseContext(`execution`);let t=``,n=``,r=0,i=this.ctx.limits.maxOutputSize,a=(e,r)=>{t.length+n.length+e.length+r.length>i&&Hk(`total output size exceeded (>${i} bytes), increase executionLimits.maxOutputSize`,`output_size`),t+=e,n+=r};for(let i of e.statements)try{let e=await this.executeStatement(i);a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r))}catch(e){if(e instanceof Ir)throw e.prependOutput(t,n),e;if(e instanceof Ur)return a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:Jl(this.ctx.state.env)};if(e instanceof k)throw e;if(e instanceof Pr)return a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:Jl(this.ctx.state.env)};if(e instanceof Fr||e instanceof Rr)return a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:Jl(this.ctx.state.env)};if(e instanceof Lr){a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r));continue}if(e instanceof Br){a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r));continue}if(e instanceof jr||e instanceof Mr){if(this.ctx.state.loopDepth>0)throw e.prependOutput(t,n),e;a(e.stdout,e.stderr);continue}throw e instanceof Nr&&e.prependOutput(t,n),e}return{stdout:t,stderr:n,exitCode:r,env:Jl(this.ctx.state.env)}}async executeUserScript(e,t,n=``){return GN(this.ctx,e,t,n,e=>this.executeScript(e))}async executeStatement(e){if(this.assertDefenseContext(`statement`),this.ctx.state.signal?.aborted)throw new Vr;if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&Hk(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,`commands`),e.deferredError)throw new sC(e.deferredError.message,e.line??1,1);if(this.ctx.state.options.noexec)return zk;this.ctx.state.errexitSafe=!1;let t=``,n=``;this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&e.sourceText&&(n+=`${e.sourceText}
1530
- `);let r=0,i=-1,a=!1;for(let o=0;o<e.pipelines.length;o++){let s=e.pipelines[o],c=o>0?e.operators[o-1]:null;if(c===`&&`&&r!==0||c===`||`&&r===0)continue;let l=await this.executePipeline(s);t+=l.stdout,n+=l.stderr,r=l.exitCode,i=o,a=s.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r))}let o=i<e.pipelines.length-1,s=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||a||s,this.ctx.state.options.errexit&&r!==0&&i===e.pipelines.length-1&&!a&&!this.ctx.state.inCondition&&!s)throw new Pr(r,t,n);return $(t,n,r)}async executePipeline(e){return jN(this.ctx,e,(e,t)=>this.executeCommand(e,t))}async executeCommand(e,t){switch(this.assertDefenseContext(`command`),this.ctx.coverage?.hit(`bash:cmd:${e.type}`),e.type){case`SimpleCommand`:return this.executeSimpleCommand(e,t);case`If`:return _N(this.ctx,e);case`For`:return vN(this.ctx,e);case`CStyleFor`:return yN(this.ctx,e);case`While`:return bN(this.ctx,e,t);case`Until`:return xN(this.ctx,e);case`Case`:return SN(this.ctx,e);case`Subshell`:return this.executeSubshell(e,t);case`Group`:return this.executeGroup(e,t);case`FunctionDef`:return ZA(this.ctx,e);case`ArithmeticCommand`:return this.executeArithmeticCommand(e);case`ConditionalCommand`:return this.executeConditionalCommand(e);default:return zk}}async executeSimpleCommand(e,t){try{return await this.executeSimpleCommandInner(e,t)}catch(e){if(e instanceof zr)return Q(e.stderr);throw e}}async executeSimpleCommandInner(e,t){if(e.line!==void 0&&(this.ctx.state.currentLine=e.line),this.ctx.state.shoptOptions.expand_aliases&&e.name){let t=e,n=100;for(;n>0;){let e=this.expandAlias(t);if(e===t)break;t=e,n--}this.aliasExpansionStack.clear(),t!==e&&(e=t)}this.ctx.state.expansionStderr=``;let n=await MN(this.ctx,e);if(n.error)return n.error;let r=n.tempAssignments,i=n.xtraceOutput;if(!e.name){if(e.redirections.length>0){let t=await YA(this.ctx,e.redirections);if(t)return t;let n=$(``,i,0);return XA(this.ctx,n,e.redirections)}this.ctx.state.lastArg=``;let t=(this.ctx.state.expansionStderr||``)+i;return this.ctx.state.expansionStderr=``,$(``,t,this.ctx.state.lastExitCode)}let a=e.name&&CN(e.name,[`local`,`declare`,`typeset`,`export`,`readonly`]),o=Array.from(r.keys());if(o.length>0&&!a){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let e of o)this.ctx.state.tempExportedVars.add(e)}let s=await JA(this.ctx,e.redirections);if(s){for(let[e,t]of r)t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t);return s}let c=-1;for(let n of e.redirections){if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let e=n.target,r=await X(this.ctx,e.content);e.stripTabs&&(r=r.split(`
1528
+ `);e!==-1&&(a=a.slice(e+1))}let o=new Map(e.state.env),s=e.state.cwd,c={...e.state.options},l=e.state.loopDepth,u=e.state.parentHasLoopContext,d=e.state.lastArg,f=e.state.bashPid,p=e.state.groupStdin,m=e.state.currentSource;e.state.parentHasLoopContext=l>0,e.state.loopDepth=0,e.state.bashPid=e.state.nextVirtualPid++,r&&(e.state.groupStdin=r),e.state.currentSource=t,e.state.env.set(`0`,t),e.state.env.set(`#`,String(n.length)),e.state.env.set(`@`,n.join(` `)),e.state.env.set(`*`,n.join(` `));for(let t=0;t<n.length&&t<9;t++)e.state.env.set(String(t+1),n[t]);for(let t=n.length+1;t<=9;t++)e.state.env.delete(String(t));let h=()=>{e.state.env=o,e.state.cwd=s,e.state.options=c,e.state.loopDepth=l,e.state.parentHasLoopContext=u,e.state.lastArg=d,e.state.bashPid=f,e.state.groupStdin=p,e.state.currentSource=m};try{let e=await i(new Zw().parse(a));return h(),e}catch(e){if(h(),e instanceof Ir||e instanceof k)throw e;if(e.name===`ParseException`)return Q(`bash: ${t}: ${e.message}
1529
+ `);throw e}}var JN=class{ctx;constructor(e,t){this.ctx={state:t,fs:e.fs,commands:e.commands,limits:e.limits,execFn:e.exec,executeScript:this.executeScript.bind(this),executeStatement:this.executeStatement.bind(this),executeCommand:this.executeCommand.bind(this),fetch:e.fetch,sleep:e.sleep,trace:e.trace,coverage:e.coverage,requireDefenseContext:e.requireDefenseContext??!1,jsBootstrapCode:e.jsBootstrapCode}}assertDefenseContext(e){if(!this.ctx.requireDefenseContext||rr.isInSandboxedContext())return;let t=`interpreter ${e} attempted outside defense context`;throw new w(t,{timestamp:Date.now(),type:`missing_defense_context`,message:t,path:`DefenseInDepthBox.context`,stack:Error().stack,executionId:rr.getCurrentExecutionId()})}buildExportedEnv(){let e=this.ctx.state.exportedVars,t=this.ctx.state.tempExportedVars,n=new Set;if(e)for(let t of e)n.add(t);if(t)for(let e of t)n.add(e);if(n.size===0)return Object.create(null);let r=Object.create(null);for(let e of n){let t=this.ctx.state.env.get(e);t!==void 0&&(r[e]=t)}return r}async executeScript(e){this.assertDefenseContext(`execution`);let t=``,n=``,r=0,i=this.ctx.limits.maxOutputSize,a=(e,r)=>{t.length+n.length+e.length+r.length>i&&Wk(`total output size exceeded (>${i} bytes), increase executionLimits.maxOutputSize`,`output_size`),t+=e,n+=r};for(let i of e.statements)try{let e=await this.executeStatement(i);a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r))}catch(e){if(e instanceof Ir)throw e.prependOutput(t,n),e;if(e instanceof Ur)return a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:ql(this.ctx.state.env)};if(e instanceof k)throw e;if(e instanceof Pr)return a(e.stdout,e.stderr),r=e.exitCode,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:ql(this.ctx.state.env)};if(e instanceof Fr||e instanceof Rr)return a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r)),{stdout:t,stderr:n,exitCode:r,env:ql(this.ctx.state.env)};if(e instanceof Lr){a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r));continue}if(e instanceof Br){a(e.stdout,e.stderr),r=1,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r));continue}if(e instanceof jr||e instanceof Mr){if(this.ctx.state.loopDepth>0)throw e.prependOutput(t,n),e;a(e.stdout,e.stderr);continue}throw e instanceof Nr&&e.prependOutput(t,n),e}return{stdout:t,stderr:n,exitCode:r,env:ql(this.ctx.state.env)}}async executeUserScript(e,t,n=``){return qN(this.ctx,e,t,n,e=>this.executeScript(e))}async executeStatement(e){if(this.assertDefenseContext(`statement`),this.ctx.state.signal?.aborted)throw new Vr;if(this.ctx.state.commandCount++,this.ctx.state.commandCount>this.ctx.limits.maxCommandCount&&Wk(`too many commands executed (>${this.ctx.limits.maxCommandCount}), increase executionLimits.maxCommandCount`,`commands`),e.deferredError)throw new mC(e.deferredError.message,e.line??1,1);if(this.ctx.state.options.noexec)return Vk;this.ctx.state.errexitSafe=!1;let t=``,n=``;this.ctx.state.options.verbose&&!this.ctx.state.suppressVerbose&&e.sourceText&&(n+=`${e.sourceText}
1530
+ `);let r=0,i=-1,a=!1;for(let o=0;o<e.pipelines.length;o++){let s=e.pipelines[o],c=o>0?e.operators[o-1]:null;if(c===`&&`&&r!==0||c===`||`&&r===0)continue;let l=await this.executePipeline(s);t+=l.stdout,n+=l.stderr,r=l.exitCode,i=o,a=s.negated,this.ctx.state.lastExitCode=r,this.ctx.state.env.set(`?`,String(r))}let o=i<e.pipelines.length-1,s=this.ctx.state.errexitSafe;if(this.ctx.state.errexitSafe=o||a||s,this.ctx.state.options.errexit&&r!==0&&i===e.pipelines.length-1&&!a&&!this.ctx.state.inCondition&&!s)throw new Pr(r,t,n);return $(t,n,r)}async executePipeline(e){return NN(this.ctx,e,(e,t)=>this.executeCommand(e,t))}async executeCommand(e,t){switch(this.assertDefenseContext(`command`),this.ctx.coverage?.hit(`bash:cmd:${e.type}`),e.type){case`SimpleCommand`:return this.executeSimpleCommand(e,t);case`If`:return yN(this.ctx,e);case`For`:return bN(this.ctx,e);case`CStyleFor`:return xN(this.ctx,e);case`While`:return SN(this.ctx,e,t);case`Until`:return CN(this.ctx,e);case`Case`:return wN(this.ctx,e);case`Subshell`:return this.executeSubshell(e,t);case`Group`:return this.executeGroup(e,t);case`FunctionDef`:return $A(this.ctx,e);case`ArithmeticCommand`:return this.executeArithmeticCommand(e);case`ConditionalCommand`:return this.executeConditionalCommand(e);default:return Vk}}async executeSimpleCommand(e,t){try{return await this.executeSimpleCommandInner(e,t)}catch(e){if(e instanceof zr)return Q(e.stderr);throw e}}async executeSimpleCommandInner(e,t){if(e.line!==void 0&&(this.ctx.state.currentLine=e.line),this.ctx.state.shoptOptions.expand_aliases&&e.name){let t=e,n=100;for(;n>0;){let e=this.expandAlias(t);if(e===t)break;t=e,n--}this.aliasExpansionStack.clear(),t!==e&&(e=t)}this.ctx.state.expansionStderr=``;let n=await PN(this.ctx,e);if(n.error)return n.error;let r=n.tempAssignments,i=n.xtraceOutput;if(!e.name){if(e.redirections.length>0){let t=await ZA(this.ctx,e.redirections);if(t)return t;let n=$(``,i,0);return QA(this.ctx,n,e.redirections)}this.ctx.state.lastArg=``;let t=(this.ctx.state.expansionStderr||``)+i;return this.ctx.state.expansionStderr=``,$(``,t,this.ctx.state.lastExitCode)}let a=e.name&&TN(e.name,[`local`,`declare`,`typeset`,`export`,`readonly`]),o=Array.from(r.keys());if(o.length>0&&!a){this.ctx.state.tempExportedVars=this.ctx.state.tempExportedVars||new Set;for(let e of o)this.ctx.state.tempExportedVars.add(e)}let s=await XA(this.ctx,e.redirections);if(s){for(let[e,t]of r)t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t);return s}let c=-1;for(let n of e.redirections){if((n.operator===`<<`||n.operator===`<<-`)&&n.target.type===`HereDoc`){let e=n.target,r=await X(this.ctx,e.content);e.stripTabs&&(r=r.split(`
1531
1531
  `).map(e=>e.replace(/^\t+/,``)).join(`
1532
- `));let i=n.fd??0;i===0?t=r:(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Uk(this.ctx),this.ctx.state.fileDescriptors.set(i,r));continue}if(n.operator===`<<<`&&n.target.type===`Word`){t=`${await X(this.ctx,n.target)}
1532
+ `));let i=n.fd??0;i===0?t=r:(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),Gk(this.ctx),this.ctx.state.fileDescriptors.set(i,r));continue}if(n.operator===`<<<`&&n.target.type===`Word`){t=`${await X(this.ctx,n.target)}
1533
1533
  `;continue}if(n.operator===`<`&&n.target.type===`Word`)try{let e=await X(this.ctx,n.target),r=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);t=await this.ctx.fs.readFile(r)}catch{let e=await X(this.ctx,n.target);for(let[e,t]of r)t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t);return Q(`bash: ${e}: No such file or directory
1534
- `)}if(n.operator===`<&`&&n.target.type===`Word`){let e=await X(this.ctx,n.target),r=Number.parseInt(e,10);if(!Number.isNaN(r)&&this.ctx.state.fileDescriptors){let e=this.ctx.state.fileDescriptors.get(r);if(e!==void 0)if(e.startsWith(`__rw__:`)){let n=wN(e);n&&(t=n.content.slice(n.position),c=r)}else e.startsWith(`__file__:`)||e.startsWith(`__file_append__:`)||(t=e)}}}let l=await X(this.ctx,e.name),u=[],d=[];if(CN(e.name,[`local`,`declare`,`typeset`,`export`,`readonly`])&&(l===`local`||l===`declare`||l===`typeset`||l===`export`||l===`readonly`))for(let t of e.args){let e=await Fk(this.ctx,t);if(e)u.push(e),d.push(!0);else{let e=await Ik(this.ctx,t);if(e!==null)u.push(e),d.push(!0);else{let e=await SO(this.ctx,t);for(let t of e.values)u.push(t),d.push(e.quoted)}}}else for(let t of e.args){let e=await SO(this.ctx,t);for(let t of e.values)u.push(t),d.push(e.quoted)}if(!l){if(e.name.parts.every(e=>e.type===`CommandSubstitution`||e.type===`ParameterExpansion`||e.type===`ArithmeticExpansion`)){if(u.length>0){let e=u.shift();return d.shift(),await this.runCommand(e,u,d,t,!1,!1,c)}return $(``,``,this.ctx.state.lastExitCode)}return Q(`bash: : command not found
1535
- `,127)}if(l===`exec`&&(u.length===0||u[0]===`--`)){for(let t of e.redirections){if(t.target.type===`HereDoc`||t.fdVariable)continue;let e=await X(this.ctx,t.target),n=t.fd??(t.operator===`<`||t.operator===`<>`?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),t.operator){case`>`:case`>|`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);await this.ctx.fs.writeFile(t,``,`utf8`),Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__file__:${t}`);break}case`>>`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__file_append__:${t}`);break}case`<`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);try{let e=await this.ctx.fs.readFile(t);Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,e)}catch{return Q(`bash: ${e}: No such file or directory
1536
- `)}break}case`<>`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);try{let e=await this.ctx.fs.readFile(t);Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__rw__:${t.length}:${t}:0:${e}`)}catch{await this.ctx.fs.writeFile(t,``,`utf8`),Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__rw__:${t.length}:${t}:0:`)}break}case`>&`:if(e===`-`)this.ctx.state.fileDescriptors.delete(n);else if(e.endsWith(`-`)){let t=e.slice(0,-1),r=Number.parseInt(t,10);if(!Number.isNaN(r)){let e=this.ctx.state.fileDescriptors.get(r);e===void 0?this.ctx.state.fileDescriptors.set(n,`__dupout__:${r}`):this.ctx.state.fileDescriptors.set(n,e),this.ctx.state.fileDescriptors.delete(r)}}else{let t=Number.parseInt(e,10);Number.isNaN(t)||(Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__dupout__:${t}`))}break;case`<&`:if(e===`-`)this.ctx.state.fileDescriptors.delete(n);else if(e.endsWith(`-`)){let t=e.slice(0,-1),r=Number.parseInt(t,10);if(!Number.isNaN(r)){let e=this.ctx.state.fileDescriptors.get(r);e===void 0?this.ctx.state.fileDescriptors.set(n,`__dupin__:${r}`):this.ctx.state.fileDescriptors.set(n,e),this.ctx.state.fileDescriptors.delete(r)}}else{let t=Number.parseInt(e,10);Number.isNaN(t)||(Uk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__dupin__:${t}`))}break}}for(let[e,t]of r)t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t);if(this.ctx.state.tempExportedVars)for(let e of r.keys())this.ctx.state.tempExportedVars.delete(e);return zk}if(this.ctx.state.extraArgs){u.push(...this.ctx.state.extraArgs);for(let e=0;e<this.ctx.state.extraArgs.length;e++)d.push(!0);this.ctx.state.extraArgs=void 0}let f=await kN(this.ctx,l,u);r.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(r)));let p,m=null;try{p=await this.runCommand(l,u,d,t,!1,!1,c)}catch(e){if(e instanceof jr||e instanceof Mr)m=e,p=zk;else throw e}let h=i+f;if(h&&(p={...p,stderr:h+p.stderr}),p=await XA(this.ctx,p,e.redirections),m)throw m;if(u.length>0){let e=u[u.length-1];if((l===`declare`||l===`local`||l===`typeset`)&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(e)){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);t&&(e=t[1])}this.ctx.state.lastArg=e}else this.ctx.state.lastArg=l;let g=BA(l)&&l!==`unset`&&l!==`eval`;if(!this.ctx.state.options.posix||!g)for(let[e,t]of r)this.ctx.state.fullyUnsetLocals?.has(e)||(t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t));if(this.ctx.state.tempExportedVars)for(let e of r.keys())this.ctx.state.tempExportedVars.delete(e);return r.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(p={...p,stderr:this.ctx.state.expansionStderr+p.stderr},this.ctx.state.expansionStderr=``),p}async runCommand(e,t,n,r,i=!1,a=!1,o=-1){let s={ctx:this.ctx,runCommand:(e,t,n,r,i,a,o)=>this.runCommand(e,t,n,r,i,a,o),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(e,t,n)=>this.executeUserScript(e,t,n)},c=await uN(s,e,t,n,r,i,a,o);return c===null?pN(s,e,t,r,a):c}aliasExpansionStack=new Set;expandAlias(e){return Mk(this.ctx.state,e,this.aliasExpansionStack)}async findCommandInPath(e){return ZM(this.ctx,e)}async executeSubshell(e,t=``){return UN(this.ctx,e,t,e=>this.executeStatement(e))}async executeGroup(e,t=``){return WN(this.ctx,e,t,e=>this.executeStatement(e))}async executeArithmeticCommand(e){e.line!==void 0&&(this.ctx.state.currentLine=e.line);let t=await YA(this.ctx,e.redirections);if(t)return t;try{let t=Vk(await Z(this.ctx,e.expression.expression)!==0);return this.ctx.state.expansionStderr&&(t={...t,stderr:this.ctx.state.expansionStderr+t.stderr},this.ctx.state.expansionStderr=``),XA(this.ctx,t,e.redirections)}catch(t){let n=Q(`bash: arithmetic expression: ${t.message}
1537
- `);return XA(this.ctx,n,e.redirections)}}async executeConditionalCommand(e){e.line!==void 0&&(this.ctx.state.currentLine=e.line);let t=await YA(this.ctx,e.redirections);if(t)return t;try{let t=Vk(await cA(this.ctx,e.expression));return this.ctx.state.expansionStderr&&(t={...t,stderr:this.ctx.state.expansionStderr+t.stderr},this.ctx.state.expansionStderr=``),XA(this.ctx,t,e.redirections)}catch(t){let n=t instanceof Lr?1:2,r=Q(`bash: conditional expression: ${t.message}
1538
- `,n);return XA(this.ctx,r,e.redirections)}}},qN={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function JN(e){return e?{maxCallDepth:e.maxCallDepth??qN.maxCallDepth,maxCommandCount:e.maxCommandCount??qN.maxCommandCount,maxLoopIterations:e.maxLoopIterations??qN.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??qN.maxAwkIterations,maxSedIterations:e.maxSedIterations??qN.maxSedIterations,maxJqIterations:e.maxJqIterations??qN.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??qN.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??qN.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??qN.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??qN.maxGlobOperations,maxStringLength:e.maxStringLength??qN.maxStringLength,maxArrayElements:e.maxArrayElements??qN.maxArrayElements,maxHeredocSize:e.maxHeredocSize??qN.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??qN.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??qN.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??qN.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??qN.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??qN.maxSourceDepth}:{...qN}}function YN(){throw Error(`node:dns is not available in browser environments`)}ir(),ur();function XN(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function ZN(e){let t=XN(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function QN(e){if(e.includes(`\\`))return!0;let t=e.toLowerCase();return t.includes(`%2f`)||t.includes(`%5c`)}function $N(e,t){return t===`/`||t===``?!0:t.endsWith(`/`)?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function eP(e,t){let n=XN(e);if(!n)return!1;let r=ZN(t);return!r||n.origin!==r.origin||r.pathPrefix!==`/`&&r.pathPrefix!==``&&QN(n.pathname)?!1:$N(n.pathname,r.pathPrefix)}function tP(e){return typeof e==`string`?e:e.url}function nP(e,t){return!t||t.length===0?!1:t.some(t=>eP(e,tP(t)))}function rP(e){let t=iP(e);if(t===`localhost`||t.endsWith(`.localhost`))return!0;let n=oP(t);if(n)return cP(n);let r=sP(t);return r?lP(r):!1}function iP(e){let t=e.trim().toLowerCase();return t.startsWith(`[`)&&t.endsWith(`]`)?t.slice(1,-1):t}function aP(e){if(!e)return null;let t=10,n=e;if(n.startsWith(`0x`)||n.startsWith(`0X`)?(t=16,n=n.slice(2)):n.length>1&&n.startsWith(`0`)&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function oP(e){let t=e.split(`.`);if(t.length===0||t.length>4)return null;let n=t.map(e=>aP(e));if(n.some(e=>e===null))return null;let r=n;if(t.length===1){let e=r[0];return e>4294967295?null:[e>>>24&255,e>>>16&255,e>>>8&255,e&255]}if(t.length===2){let[e,t]=r;return e>255||t>16777215?null:[e,t>>>16&255,t>>>8&255,t&255]}if(t.length===3){let[e,t,n]=r;return e>255||t>255||n>65535?null:[e,t,n>>>8&255,n&255]}let[i,a,o,s]=r;return i>255||a>255||o>255||s>255?null:[i,a,o,s]}function sP(e){let t=e,n=null;if(t.includes(`.`)){let e=t.lastIndexOf(`:`);if(e<0)return null;let r=oP(t.slice(e+1));if(!r)return null;n=r,t=t.slice(0,e)}let r=t.includes(`::`)?t.split(`::`).length-1:0;if(r>1)return null;let[i,a]=t.split(`::`),o=i?i.split(`:`).filter(Boolean):[],s=a?a.split(`:`).filter(Boolean):[],c=e=>/^[0-9a-f]{1,4}$/i.test(e)?Number.parseInt(e,16):null,l=o.map(c),u=s.map(c);if(l.some(e=>e===null)||u.some(e=>e===null))return null;let d=n?2:0,f=l.length+u.length+d,p=0;if(r===1){if(p=8-f,p<0)return null}else if(f!==8)return null;let m=[...l,...Array(p).fill(0),...u];return n&&(m.push(n[0]<<8|n[1]),m.push(n[2]<<8|n[3])),m.length===8?m:null}function cP(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function lP(e){return e.every(e=>e===0)||e.slice(0,7).every(e=>e===0)&&e[7]===1||(e[0]&65472)==65152||(e[0]&65024)==64512?!0:e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535?cP([e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255]):e[0]===8193&&e[1]===3512?!0:e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0?cP([e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255]):e[0]===100&&e[1]===65435&&e[2]===1?!0:e[0]===8194?cP([e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255]):!1}function uP(e){let t=[];for(let n of e){if(typeof n!=`string`&&(typeof n!=`object`||!n||!(`url`in n)||typeof n.url!=`string`)){t.push(`Invalid allow-list entry: must be a string URL or an object with a "url" string property`);continue}let e=tP(n);if(!XN(e)){t.push(`Invalid URL in allow-list: "${e}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let r=new URL(e);if(r.protocol!==`http:`&&r.protocol!==`https:`){t.push(`Only http and https URLs are allowed in allow-list: "${e}"`);continue}if(!r.hostname){t.push(`Allow-list entry must include a hostname: "${e}"`);continue}if(r.pathname!==`/`&&r.pathname!==``&&QN(r.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${e}"`);continue}(r.search||r.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${e}"`)}return t}var dP=class extends Error{constructor(e,t){super(`Network access denied: ${t??`URL not in allow-list`}: ${e}`),this.name=`NetworkAccessDeniedError`}},fP=class extends Error{constructor(e){super(`Too many redirects (max: ${e})`),this.name=`TooManyRedirectsError`}},pP=class extends Error{constructor(e){super(`Redirect target not in allow-list: ${e}`),this.name=`RedirectNotAllowedError`}},mP=class extends Error{constructor(e,t){super(`HTTP method '${e}' not allowed. Allowed methods: ${t.join(`, `)}`),this.name=`MethodNotAllowedError`}},hP=class extends Error{constructor(e){super(`Response body too large (max: ${e} bytes)`),this.name=`ResponseTooLargeError`}};function gP(e){return new Promise((t,n)=>{YN(e,{all:!0},(e,r)=>{e?n(e):t(r)})})}var _P=20,vP=3e4,yP=10485760,bP=[`GET`,`HEAD`],xP=new Set([`GET`,`HEAD`,`OPTIONS`]),SP=new Set([301,302,303,307,308]);function CP(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let e=uP(t);if(e.length>0)throw Error(`Invalid network allow-list:
1534
+ `)}if(n.operator===`<&`&&n.target.type===`Word`){let e=await X(this.ctx,n.target),r=Number.parseInt(e,10);if(!Number.isNaN(r)&&this.ctx.state.fileDescriptors){let e=this.ctx.state.fileDescriptors.get(r);if(e!==void 0)if(e.startsWith(`__rw__:`)){let n=EN(e);n&&(t=n.content.slice(n.position),c=r)}else e.startsWith(`__file__:`)||e.startsWith(`__file_append__:`)||(t=e)}}}let l=await X(this.ctx,e.name),u=[],d=[];if(TN(e.name,[`local`,`declare`,`typeset`,`export`,`readonly`])&&(l===`local`||l===`declare`||l===`typeset`||l===`export`||l===`readonly`))for(let t of e.args){let e=await Lk(this.ctx,t);if(e)u.push(e),d.push(!0);else{let e=await Rk(this.ctx,t);if(e!==null)u.push(e),d.push(!0);else{let e=await kO(this.ctx,t);for(let t of e.values)u.push(t),d.push(e.quoted)}}}else for(let t of e.args){let e=await kO(this.ctx,t);for(let t of e.values)u.push(t),d.push(e.quoted)}if(!l){if(e.name.parts.every(e=>e.type===`CommandSubstitution`||e.type===`ParameterExpansion`||e.type===`ArithmeticExpansion`)){if(u.length>0){let e=u.shift();return d.shift(),await this.runCommand(e,u,d,t,!1,!1,c)}return $(``,``,this.ctx.state.lastExitCode)}return Q(`bash: : command not found
1535
+ `,127)}if(l===`exec`&&(u.length===0||u[0]===`--`)){for(let t of e.redirections){if(t.target.type===`HereDoc`||t.fdVariable)continue;let e=await X(this.ctx,t.target),n=t.fd??(t.operator===`<`||t.operator===`<>`?0:1);switch(this.ctx.state.fileDescriptors||(this.ctx.state.fileDescriptors=new Map),t.operator){case`>`:case`>|`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);await this.ctx.fs.writeFile(t,``,`utf8`),Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__file__:${t}`);break}case`>>`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__file_append__:${t}`);break}case`<`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);try{let e=await this.ctx.fs.readFile(t);Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,e)}catch{return Q(`bash: ${e}: No such file or directory
1536
+ `)}break}case`<>`:{let t=this.ctx.fs.resolvePath(this.ctx.state.cwd,e);try{let e=await this.ctx.fs.readFile(t);Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__rw__:${t.length}:${t}:0:${e}`)}catch{await this.ctx.fs.writeFile(t,``,`utf8`),Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__rw__:${t.length}:${t}:0:`)}break}case`>&`:if(e===`-`)this.ctx.state.fileDescriptors.delete(n);else if(e.endsWith(`-`)){let t=e.slice(0,-1),r=Number.parseInt(t,10);if(!Number.isNaN(r)){let e=this.ctx.state.fileDescriptors.get(r);e===void 0?this.ctx.state.fileDescriptors.set(n,`__dupout__:${r}`):this.ctx.state.fileDescriptors.set(n,e),this.ctx.state.fileDescriptors.delete(r)}}else{let t=Number.parseInt(e,10);Number.isNaN(t)||(Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__dupout__:${t}`))}break;case`<&`:if(e===`-`)this.ctx.state.fileDescriptors.delete(n);else if(e.endsWith(`-`)){let t=e.slice(0,-1),r=Number.parseInt(t,10);if(!Number.isNaN(r)){let e=this.ctx.state.fileDescriptors.get(r);e===void 0?this.ctx.state.fileDescriptors.set(n,`__dupin__:${r}`):this.ctx.state.fileDescriptors.set(n,e),this.ctx.state.fileDescriptors.delete(r)}}else{let t=Number.parseInt(e,10);Number.isNaN(t)||(Gk(this.ctx),this.ctx.state.fileDescriptors.set(n,`__dupin__:${t}`))}break}}for(let[e,t]of r)t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t);if(this.ctx.state.tempExportedVars)for(let e of r.keys())this.ctx.state.tempExportedVars.delete(e);return Vk}if(this.ctx.state.extraArgs){u.push(...this.ctx.state.extraArgs);for(let e=0;e<this.ctx.state.extraArgs.length;e++)d.push(!0);this.ctx.state.extraArgs=void 0}let f=await jN(this.ctx,l,u);r.size>0&&(this.ctx.state.tempEnvBindings=this.ctx.state.tempEnvBindings||[],this.ctx.state.tempEnvBindings.push(new Map(r)));let p,m=null;try{p=await this.runCommand(l,u,d,t,!1,!1,c)}catch(e){if(e instanceof jr||e instanceof Mr)m=e,p=Vk;else throw e}let h=i+f;if(h&&(p={...p,stderr:h+p.stderr}),p=await QA(this.ctx,p,e.redirections),m)throw m;if(u.length>0){let e=u[u.length-1];if((l===`declare`||l===`local`||l===`typeset`)&&/^[a-zA-Z_][a-zA-Z0-9_]*=\(/.test(e)){let t=e.match(/^([a-zA-Z_][a-zA-Z0-9_]*)=\(/);t&&(e=t[1])}this.ctx.state.lastArg=e}else this.ctx.state.lastArg=l;let g=HA(l)&&l!==`unset`&&l!==`eval`;if(!this.ctx.state.options.posix||!g)for(let[e,t]of r)this.ctx.state.fullyUnsetLocals?.has(e)||(t===void 0?this.ctx.state.env.delete(e):this.ctx.state.env.set(e,t));if(this.ctx.state.tempExportedVars)for(let e of r.keys())this.ctx.state.tempExportedVars.delete(e);return r.size>0&&this.ctx.state.tempEnvBindings&&this.ctx.state.tempEnvBindings.pop(),this.ctx.state.expansionStderr&&(p={...p,stderr:this.ctx.state.expansionStderr+p.stderr},this.ctx.state.expansionStderr=``),p}async runCommand(e,t,n,r,i=!1,a=!1,o=-1){let s={ctx:this.ctx,runCommand:(e,t,n,r,i,a,o)=>this.runCommand(e,t,n,r,i,a,o),buildExportedEnv:()=>this.buildExportedEnv(),executeUserScript:(e,t,n)=>this.executeUserScript(e,t,n)},c=await fN(s,e,t,n,r,i,a,o);return c===null?hN(s,e,t,r,a):c}aliasExpansionStack=new Set;expandAlias(e){return Pk(this.ctx.state,e,this.aliasExpansionStack)}async findCommandInPath(e){return $M(this.ctx,e)}async executeSubshell(e,t=``){return GN(this.ctx,e,t,e=>this.executeStatement(e))}async executeGroup(e,t=``){return KN(this.ctx,e,t,e=>this.executeStatement(e))}async executeArithmeticCommand(e){e.line!==void 0&&(this.ctx.state.currentLine=e.line);let t=await ZA(this.ctx,e.redirections);if(t)return t;try{let t=Uk(await Z(this.ctx,e.expression.expression)!==0);return this.ctx.state.expansionStderr&&(t={...t,stderr:this.ctx.state.expansionStderr+t.stderr},this.ctx.state.expansionStderr=``),QA(this.ctx,t,e.redirections)}catch(t){let n=Q(`bash: arithmetic expression: ${t.message}
1537
+ `);return QA(this.ctx,n,e.redirections)}}async executeConditionalCommand(e){e.line!==void 0&&(this.ctx.state.currentLine=e.line);let t=await ZA(this.ctx,e.redirections);if(t)return t;try{let t=Uk(await uA(this.ctx,e.expression));return this.ctx.state.expansionStderr&&(t={...t,stderr:this.ctx.state.expansionStderr+t.stderr},this.ctx.state.expansionStderr=``),QA(this.ctx,t,e.redirections)}catch(t){let n=t instanceof Lr?1:2,r=Q(`bash: conditional expression: ${t.message}
1538
+ `,n);return QA(this.ctx,r,e.redirections)}}},YN={maxCallDepth:100,maxCommandCount:1e4,maxLoopIterations:1e4,maxAwkIterations:1e4,maxSedIterations:1e4,maxJqIterations:1e4,maxSqliteTimeoutMs:5e3,maxPythonTimeoutMs:1e4,maxJsTimeoutMs:1e4,maxGlobOperations:1e5,maxStringLength:10485760,maxArrayElements:1e5,maxHeredocSize:10485760,maxSubstitutionDepth:50,maxBraceExpansionResults:1e4,maxOutputSize:10485760,maxFileDescriptors:1024,maxSourceDepth:100};function XN(e){return e?{maxCallDepth:e.maxCallDepth??YN.maxCallDepth,maxCommandCount:e.maxCommandCount??YN.maxCommandCount,maxLoopIterations:e.maxLoopIterations??YN.maxLoopIterations,maxAwkIterations:e.maxAwkIterations??YN.maxAwkIterations,maxSedIterations:e.maxSedIterations??YN.maxSedIterations,maxJqIterations:e.maxJqIterations??YN.maxJqIterations,maxSqliteTimeoutMs:e.maxSqliteTimeoutMs??YN.maxSqliteTimeoutMs,maxPythonTimeoutMs:e.maxPythonTimeoutMs??YN.maxPythonTimeoutMs,maxJsTimeoutMs:e.maxJsTimeoutMs??YN.maxJsTimeoutMs,maxGlobOperations:e.maxGlobOperations??YN.maxGlobOperations,maxStringLength:e.maxStringLength??YN.maxStringLength,maxArrayElements:e.maxArrayElements??YN.maxArrayElements,maxHeredocSize:e.maxHeredocSize??YN.maxHeredocSize,maxSubstitutionDepth:e.maxSubstitutionDepth??YN.maxSubstitutionDepth,maxBraceExpansionResults:e.maxBraceExpansionResults??YN.maxBraceExpansionResults,maxOutputSize:e.maxOutputSize??YN.maxOutputSize,maxFileDescriptors:e.maxFileDescriptors??YN.maxFileDescriptors,maxSourceDepth:e.maxSourceDepth??YN.maxSourceDepth}:{...YN}}function ZN(){throw Error(`node:dns is not available in browser environments`)}ir(),ur();function QN(e){try{let t=new URL(e);return{origin:t.origin,pathname:t.pathname,href:t.href}}catch{return null}}function $N(e){let t=QN(e);return t?{origin:t.origin,pathPrefix:t.pathname}:null}function eP(e){if(e.includes(`\\`))return!0;let t=e.toLowerCase();return t.includes(`%2f`)||t.includes(`%5c`)}function tP(e,t){return t===`/`||t===``?!0:t.endsWith(`/`)?e.startsWith(t):e===t||e.startsWith(`${t}/`)}function nP(e,t){let n=QN(e);if(!n)return!1;let r=$N(t);return!r||n.origin!==r.origin||r.pathPrefix!==`/`&&r.pathPrefix!==``&&eP(n.pathname)?!1:tP(n.pathname,r.pathPrefix)}function rP(e){return typeof e==`string`?e:e.url}function iP(e,t){return!t||t.length===0?!1:t.some(t=>nP(e,rP(t)))}function aP(e){let t=oP(e);if(t===`localhost`||t.endsWith(`.localhost`))return!0;let n=cP(t);if(n)return uP(n);let r=lP(t);return r?dP(r):!1}function oP(e){let t=e.trim().toLowerCase();return t.startsWith(`[`)&&t.endsWith(`]`)?t.slice(1,-1):t}function sP(e){if(!e)return null;let t=10,n=e;if(n.startsWith(`0x`)||n.startsWith(`0X`)?(t=16,n=n.slice(2)):n.length>1&&n.startsWith(`0`)&&(t=8),!n||t===16&&!/^[0-9a-fA-F]+$/.test(n)||t===10&&!/^\d+$/.test(n)||t===8&&!/^[0-7]+$/.test(n))return null;let r=Number.parseInt(n,t);return!Number.isFinite(r)||r<0?null:r}function cP(e){let t=e.split(`.`);if(t.length===0||t.length>4)return null;let n=t.map(e=>sP(e));if(n.some(e=>e===null))return null;let r=n;if(t.length===1){let e=r[0];return e>4294967295?null:[e>>>24&255,e>>>16&255,e>>>8&255,e&255]}if(t.length===2){let[e,t]=r;return e>255||t>16777215?null:[e,t>>>16&255,t>>>8&255,t&255]}if(t.length===3){let[e,t,n]=r;return e>255||t>255||n>65535?null:[e,t,n>>>8&255,n&255]}let[i,a,o,s]=r;return i>255||a>255||o>255||s>255?null:[i,a,o,s]}function lP(e){let t=e,n=null;if(t.includes(`.`)){let e=t.lastIndexOf(`:`);if(e<0)return null;let r=cP(t.slice(e+1));if(!r)return null;n=r,t=t.slice(0,e)}let r=t.includes(`::`)?t.split(`::`).length-1:0;if(r>1)return null;let[i,a]=t.split(`::`),o=i?i.split(`:`).filter(Boolean):[],s=a?a.split(`:`).filter(Boolean):[],c=e=>/^[0-9a-f]{1,4}$/i.test(e)?Number.parseInt(e,16):null,l=o.map(c),u=s.map(c);if(l.some(e=>e===null)||u.some(e=>e===null))return null;let d=n?2:0,f=l.length+u.length+d,p=0;if(r===1){if(p=8-f,p<0)return null}else if(f!==8)return null;let m=[...l,...Array(p).fill(0),...u];return n&&(m.push(n[0]<<8|n[1]),m.push(n[2]<<8|n[3])),m.length===8?m:null}function uP(e){let[t,n]=e;return t===127||t===10||t===172&&n>=16&&n<=31||t===192&&n===168||t===169&&n===254||t===0||t===100&&n>=64&&n<=127||t===198&&(n===18||n===19)||t===192&&n===0&&e[2]===0||t===192&&n===0&&e[2]===2||t===198&&n===51&&e[2]===100||t===203&&n===0&&e[2]===113||t>=240}function dP(e){return e.every(e=>e===0)||e.slice(0,7).every(e=>e===0)&&e[7]===1||(e[0]&65472)==65152||(e[0]&65024)==64512?!0:e[0]===0&&e[1]===0&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===65535?uP([e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255]):e[0]===8193&&e[1]===3512?!0:e[0]===100&&e[1]===65435&&e[2]===0&&e[3]===0&&e[4]===0&&e[5]===0?uP([e[6]>>>8&255,e[6]&255,e[7]>>>8&255,e[7]&255]):e[0]===100&&e[1]===65435&&e[2]===1?!0:e[0]===8194?uP([e[1]>>>8&255,e[1]&255,e[2]>>>8&255,e[2]&255]):!1}function fP(e){let t=[];for(let n of e){if(typeof n!=`string`&&(typeof n!=`object`||!n||!(`url`in n)||typeof n.url!=`string`)){t.push(`Invalid allow-list entry: must be a string URL or an object with a "url" string property`);continue}let e=rP(n);if(!QN(e)){t.push(`Invalid URL in allow-list: "${e}" - must be a valid URL with scheme and host (e.g., "https://example.com")`);continue}let r=new URL(e);if(r.protocol!==`http:`&&r.protocol!==`https:`){t.push(`Only http and https URLs are allowed in allow-list: "${e}"`);continue}if(!r.hostname){t.push(`Allow-list entry must include a hostname: "${e}"`);continue}if(r.pathname!==`/`&&r.pathname!==``&&eP(r.pathname)){t.push(`Allow-list entry contains ambiguous path separators: "${e}"`);continue}(r.search||r.hash)&&t.push(`Query strings and fragments are ignored in allow-list entries: "${e}"`)}return t}var pP=class extends Error{constructor(e,t){super(`Network access denied: ${t??`URL not in allow-list`}: ${e}`),this.name=`NetworkAccessDeniedError`}},mP=class extends Error{constructor(e){super(`Too many redirects (max: ${e})`),this.name=`TooManyRedirectsError`}},hP=class extends Error{constructor(e){super(`Redirect target not in allow-list: ${e}`),this.name=`RedirectNotAllowedError`}},gP=class extends Error{constructor(e,t){super(`HTTP method '${e}' not allowed. Allowed methods: ${t.join(`, `)}`),this.name=`MethodNotAllowedError`}},_P=class extends Error{constructor(e){super(`Response body too large (max: ${e} bytes)`),this.name=`ResponseTooLargeError`}};function vP(e){return new Promise((t,n)=>{ZN(e,{all:!0},(e,r)=>{e?n(e):t(r)})})}var yP=20,bP=3e4,xP=10485760,SP=[`GET`,`HEAD`],CP=new Set([`GET`,`HEAD`,`OPTIONS`]),wP=new Set([301,302,303,307,308]);function TP(e){let t=e.allowedUrlPrefixes??[];if(!e.dangerouslyAllowFullInternetAccess){let e=fP(t);if(e.length>0)throw Error(`Invalid network allow-list:
1539
1539
  ${e.join(`
1540
- `)}`)}let n=[];for(let e of t)typeof e==`object`&&e.transform&&e.transform.length>0&&n.push(e);function r(e){if(n.length===0)return null;let t=null;for(let r of n)if(eP(e,r.url)&&r.transform){t||=new Headers;for(let e of r.transform)for(let[n,r]of Object.entries(e.headers))t.set(n,r)}return t}let i=e.maxRedirects??_P,a=e.timeoutMs??vP,o=e.maxResponseSize??yP,s=e.dangerouslyAllowFullInternetAccess?[`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`PATCH`,`OPTIONS`]:e.allowedMethods??bP,c=e.denyPrivateRanges??(typeof process<`u`&&!0),l=e._dnsResolve??gP;async function u(n){if(!e.dangerouslyAllowFullInternetAccess&&!nP(n,t))throw new dP(n);if(c)try{let e=new URL(n);if(rP(e.hostname))throw new dP(n,`private/loopback IP address blocked`);let t=e.hostname;if(/[a-zA-Z]/.test(t))try{let e=await l(t);for(let{address:t}of e)if(rP(t))throw new dP(n,`hostname resolves to private/loopback IP address`)}catch(e){if(e instanceof dP)throw e;let t=e?.code;if(!(t===`ENOTFOUND`||t===`ENODATA`))throw new dP(n,`DNS resolution failed for private IP check`)}}catch(e){if(e instanceof dP)throw e}}function d(t){if(e.dangerouslyAllowFullInternetAccess)return;let n=t.toUpperCase();if(!s.includes(n))throw new mP(n,s)}async function f(e,t={}){let n=t.method?.toUpperCase()??`GET`;await u(e),d(n);let s=e,c=0,l=t.followRedirects??!0,f=t.timeoutMs===void 0?a:Math.min(t.timeoutMs,a);for(;;){let e=new AbortController,a=cr(()=>e.abort(),f);try{let a=await rr.runTrustedAsync(()=>{let i=r(s),a={method:n,headers:wP(t.headers,i),signal:e.signal,redirect:`manual`};return t.body&&!xP.has(n)&&(a.body=t.body),fetch(s,a)});if(SP.has(a.status)&&l){let e=a.headers.get(`location`);if(!e)return await TP(a,s,o);let t=new URL(e,s).href;try{await u(t)}catch{throw new pP(t)}if(c++,c>i)throw new fP(i);s=t;continue}return await TP(a,s,o)}finally{lr(a)}}}return f}function wP(e,t){if(!e&&!t)return;if(!t)return e;let n=(e instanceof Headers,new Headers(e));for(let[e,r]of t)n.set(e,r);return n}async function TP(e,t,n){let r=Object.create(null);if(e.headers.forEach((e,t)=>{r[t.toLowerCase()]=e}),n>0){let t=e.headers.get(`content-length`);if(t){let e=parseInt(t,10);if(!Number.isNaN(e)&&e>n)throw new hP(n)}}let i;if(n>0&&e.body){let t=e.body.getReader(),r=new TextDecoder,a=[],o=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(o+=i.byteLength,o>n)throw t.cancel(),new hP(n);a.push(r.decode(i,{stream:!0}))}a.push(r.decode()),i=a.join(``)}else i=await e.text();return{status:e.status,statusText:e.statusText,headers:r,body:i,url:t}}$S(),Gw(),ir();function EP(e){return DP(e)}function DP(e){return e.statements.map(OP).join(`
1541
- `)}function OP(e){let t=[];for(let n=0;n<e.pipelines.length;n++)t.push(kP(e.pipelines[n])),n<e.operators.length&&t.push(e.operators[n]);let n=t.join(` `);return e.background&&(n+=` &`),n}function kP(e){let t=[];e.timed&&t.push(e.timePosix?`time -p`:`time`),e.negated&&t.push(`!`);let n=[];for(let t=0;t<e.commands.length;t++)if(n.push(AP(e.commands[t])),t<e.commands.length-1){let r=e.pipeStderr?.[t];n.push(r?`|&`:`|`)}return(t.length>0?`${t.join(` `)} `:``)+n.join(` `)}function AP(e){switch(e.type){case`SimpleCommand`:return jP(e);case`If`:return JP(e);case`For`:return YP(e);case`CStyleFor`:return XP(e);case`While`:return ZP(e);case`Until`:return QP(e);case`Case`:return $P(e);case`Subshell`:return tF(e);case`Group`:return nF(e);case`ArithmeticCommand`:return rF(e);case`ConditionalCommand`:return iF(e);case`FunctionDef`:return aF(e);default:throw Error(`Unsupported command type: ${e.type}`)}}function jP(e){let t=[];for(let n of e.assignments)t.push(MP(n));e.name&&t.push(NP(e.name));for(let n of e.args)t.push(NP(n));for(let n of e.redirections)t.push(GP(n));return t.join(` `)}function MP(e){let t=e.append?`+=`:`=`;if(e.array){let n=e.array.map(NP).join(` `);return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${NP(e.value)}`:`${e.name}${t}`}function NP(e){return e.parts.map(e=>FP(e,!1)).join(``)}function PP(e){return e.parts.map(e=>FP(e,!0)).join(``)}function FP(e,t){switch(e.type){case`Literal`:return t?LP(e.value):IP(e.value);case`SingleQuoted`:return`'${e.value}'`;case`DoubleQuoted`:return`"${e.parts.map(e=>FP(e,!0)).join(``)}"`;case`Escaped`:return`\\${e.value}`;case`ParameterExpansion`:return BP(e);case`CommandSubstitution`:return e.legacy?`\`${DP(e.body)}\``:`$(${DP(e.body)})`;case`ArithmeticExpansion`:return`$((${oF(e.expression.expression)}))`;case`ProcessSubstitution`:return e.direction===`input`?`<(${DP(e.body)})`:`>(${DP(e.body)})`;case`BraceExpansion`:return UP(e);case`TildeExpansion`:return e.user===null?`~`:`~${e.user}`;case`Glob`:return e.pattern;default:throw Error(`Unsupported word part type: ${e.type}`)}}function IP(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,`\\$&`)}function LP(e){return e.replace(/[$`"\\]/g,`\\$&`)}function RP(e,t){return e.parts.map(e=>zP(e,t)).join(``)}function zP(e,t){switch(e.type){case`Literal`:return t?e.value:e.value.replace(/[$`]/g,`\\$&`);case`Escaped`:return`\\${e.value}`;case`ParameterExpansion`:return BP(e);case`CommandSubstitution`:return e.legacy?`\`${DP(e.body)}\``:`$(${DP(e.body)})`;case`ArithmeticExpansion`:return`$((${oF(e.expression.expression)}))`;default:return FP(e,!1)}}function BP(e){return e.operation?`\${${HP(e.parameter,e.operation)}}`:VP(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function VP(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function HP(e,t){switch(t.type){case`Length`:return`#${e}`;case`LengthSliceError`:return`#${e}:`;case`BadSubstitution`:return t.text;case`DefaultValue`:return`${e}${t.checkEmpty?`:`:``}-${PP(t.word)}`;case`AssignDefault`:return`${e}${t.checkEmpty?`:`:``}=${PP(t.word)}`;case`ErrorIfUnset`:return`${e}${t.checkEmpty?`:`:``}?${t.word?PP(t.word):``}`;case`UseAlternative`:return`${e}${t.checkEmpty?`:`:``}+${PP(t.word)}`;case`Substring`:{let n=oF(t.offset.expression);return t.length?`${e}:${n}:${oF(t.length.expression)}`:`${e}:${n}`}case`PatternRemoval`:{let n=t.side===`prefix`?`#`:`%`;return`${e}${t.greedy?`${n}${n}`:n}${PP(t.pattern)}`}case`PatternReplacement`:{let n=`/`;t.all?n=`//`:t.anchor===`start`?n=`/#`:t.anchor===`end`&&(n=`/%`);let r=t.replacement?`/${PP(t.replacement)}`:``;return`${e}${n}${PP(t.pattern)}${r}`}case`CaseModification`:{let n=t.direction===`upper`?`^`:`,`;return`${e}${t.all?`${n}${n}`:n}${t.pattern?PP(t.pattern):``}`}case`Transform`:return`${e}@${t.operator}`;case`Indirection`:return t.innerOp?`!${HP(e,t.innerOp)}`:`!${e}`;case`ArrayKeys`:return`!${t.array}[${t.star?`*`:`@`}]`;case`VarNamePrefix`:return`!${t.prefix}${t.star?`*`:`@`}`;default:throw Error(`Unsupported parameter operation type: ${t.type}`)}}function UP(e){return`{${e.items.map(WP).join(`,`)}}`}function WP(e){if(e.type===`Word`)return NP(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step===void 0?`${t}..${n}`:`${t}..${n}..${e.step}`}function GP(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd===null?``:String(e.fd);if(e.operator===`<<`||e.operator===`<<-`){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,i=RP(n.content,n.quoted);return`${t}${e.operator}${r}
1542
- ${i}${n.delimiter}`}return e.operator===`<<<`?`${t}<<< ${NP(e.target)}`:e.operator===`&>`||e.operator===`&>>`?`${e.operator} ${NP(e.target)}`:`${t}${e.operator} ${NP(e.target)}`}function KP(e){return e.length===0?``:` ${e.map(GP).join(` `)}`}function qP(e){return e.map(OP).join(`
1543
- `)}function JP(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],i=n===0?`if`:`elif`;t.push(`${i} ${qP(r.condition)}; then
1544
- ${qP(r.body)}`)}return e.elseBody&&t.push(`else
1545
- ${qP(e.elseBody)}`),`${t.join(`
1540
+ `)}`)}let n=[];for(let e of t)typeof e==`object`&&e.transform&&e.transform.length>0&&n.push(e);function r(e){if(n.length===0)return null;let t=null;for(let r of n)if(nP(e,r.url)&&r.transform){t||=new Headers;for(let e of r.transform)for(let[n,r]of Object.entries(e.headers))t.set(n,r)}return t}let i=e.maxRedirects??yP,a=e.timeoutMs??bP,o=e.maxResponseSize??xP,s=e.dangerouslyAllowFullInternetAccess?[`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`PATCH`,`OPTIONS`]:e.allowedMethods??SP,c=e.denyPrivateRanges??(typeof process<`u`&&!0),l=e._dnsResolve??vP;async function u(n){if(!e.dangerouslyAllowFullInternetAccess&&!iP(n,t))throw new pP(n);if(c)try{let e=new URL(n);if(aP(e.hostname))throw new pP(n,`private/loopback IP address blocked`);let t=e.hostname;if(/[a-zA-Z]/.test(t))try{let e=await l(t);for(let{address:t}of e)if(aP(t))throw new pP(n,`hostname resolves to private/loopback IP address`)}catch(e){if(e instanceof pP)throw e;let t=e?.code;if(!(t===`ENOTFOUND`||t===`ENODATA`))throw new pP(n,`DNS resolution failed for private IP check`)}}catch(e){if(e instanceof pP)throw e}}function d(t){if(e.dangerouslyAllowFullInternetAccess)return;let n=t.toUpperCase();if(!s.includes(n))throw new gP(n,s)}async function f(e,t={}){let n=t.method?.toUpperCase()??`GET`;await u(e),d(n);let s=e,c=0,l=t.followRedirects??!0,f=t.timeoutMs===void 0?a:Math.min(t.timeoutMs,a);for(;;){let e=new AbortController,a=cr(()=>e.abort(),f);try{let a=await rr.runTrustedAsync(()=>{let i=r(s),a={method:n,headers:EP(t.headers,i),signal:e.signal,redirect:`manual`};return t.body&&!CP.has(n)&&(a.body=t.body),fetch(s,a)});if(wP.has(a.status)&&l){let e=a.headers.get(`location`);if(!e)return await DP(a,s,o);let t=new URL(e,s).href;try{await u(t)}catch{throw new hP(t)}if(c++,c>i)throw new mP(i);s=t;continue}return await DP(a,s,o)}finally{lr(a)}}}return f}function EP(e,t){if(!e&&!t)return;if(!t)return e;let n=(e instanceof Headers,new Headers(e));for(let[e,r]of t)n.set(e,r);return n}async function DP(e,t,n){let r=Object.create(null);if(e.headers.forEach((e,t)=>{r[t.toLowerCase()]=e}),n>0){let t=e.headers.get(`content-length`);if(t){let e=parseInt(t,10);if(!Number.isNaN(e)&&e>n)throw new _P(n)}}let i;if(n>0&&e.body){let t=e.body.getReader(),r=[],a=0;for(;;){let{done:e,value:i}=await t.read();if(e)break;if(i){if(a+=i.byteLength,a>n)throw t.cancel(),new _P(n);r.push(i)}}i=new Uint8Array(a);let o=0;for(let e of r)i.set(e,o),o+=e.byteLength}else{let t=await e.arrayBuffer();if(n>0&&t.byteLength>n)throw new _P(n);i=new Uint8Array(t)}return{status:e.status,statusText:e.statusText,headers:r,body:i,url:t}}oC(),Qw(),ir();function OP(e){return kP(e)}function kP(e){return e.statements.map(AP).join(`
1541
+ `)}function AP(e){let t=[];for(let n=0;n<e.pipelines.length;n++)t.push(jP(e.pipelines[n])),n<e.operators.length&&t.push(e.operators[n]);let n=t.join(` `);return e.background&&(n+=` &`),n}function jP(e){let t=[];e.timed&&t.push(e.timePosix?`time -p`:`time`),e.negated&&t.push(`!`);let n=[];for(let t=0;t<e.commands.length;t++)if(n.push(MP(e.commands[t])),t<e.commands.length-1){let r=e.pipeStderr?.[t];n.push(r?`|&`:`|`)}return(t.length>0?`${t.join(` `)} `:``)+n.join(` `)}function MP(e){switch(e.type){case`SimpleCommand`:return NP(e);case`If`:return XP(e);case`For`:return ZP(e);case`CStyleFor`:return QP(e);case`While`:return $P(e);case`Until`:return eF(e);case`Case`:return tF(e);case`Subshell`:return rF(e);case`Group`:return iF(e);case`ArithmeticCommand`:return aF(e);case`ConditionalCommand`:return oF(e);case`FunctionDef`:return sF(e);default:throw Error(`Unsupported command type: ${e.type}`)}}function NP(e){let t=[];for(let n of e.assignments)t.push(PP(n));e.name&&t.push(FP(e.name));for(let n of e.args)t.push(FP(n));for(let n of e.redirections)t.push(qP(n));return t.join(` `)}function PP(e){let t=e.append?`+=`:`=`;if(e.array){let n=e.array.map(FP).join(` `);return`${e.name}${t}(${n})`}return e.value?`${e.name}${t}${FP(e.value)}`:`${e.name}${t}`}function FP(e){return e.parts.map(e=>LP(e,!1)).join(``)}function IP(e){return e.parts.map(e=>LP(e,!0)).join(``)}function LP(e,t){switch(e.type){case`Literal`:return t?zP(e.value):RP(e.value);case`SingleQuoted`:return`'${e.value}'`;case`DoubleQuoted`:return`"${e.parts.map(e=>LP(e,!0)).join(``)}"`;case`Escaped`:return`\\${e.value}`;case`ParameterExpansion`:return HP(e);case`CommandSubstitution`:return e.legacy?`\`${kP(e.body)}\``:`$(${kP(e.body)})`;case`ArithmeticExpansion`:return`$((${cF(e.expression.expression)}))`;case`ProcessSubstitution`:return e.direction===`input`?`<(${kP(e.body)})`:`>(${kP(e.body)})`;case`BraceExpansion`:return GP(e);case`TildeExpansion`:return e.user===null?`~`:`~${e.user}`;case`Glob`:return e.pattern;default:throw Error(`Unsupported word part type: ${e.type}`)}}function RP(e){return e.replace(/[\s\\'"`!|&;()<>{}[\]*?~#]/g,`\\$&`)}function zP(e){return e.replace(/[$`"\\]/g,`\\$&`)}function BP(e,t){return e.parts.map(e=>VP(e,t)).join(``)}function VP(e,t){switch(e.type){case`Literal`:return t?e.value:e.value.replace(/[$`]/g,`\\$&`);case`Escaped`:return`\\${e.value}`;case`ParameterExpansion`:return HP(e);case`CommandSubstitution`:return e.legacy?`\`${kP(e.body)}\``:`$(${kP(e.body)})`;case`ArithmeticExpansion`:return`$((${cF(e.expression.expression)}))`;default:return LP(e,!1)}}function HP(e){return e.operation?`\${${WP(e.parameter,e.operation)}}`:UP(e.parameter)?`\${${e.parameter}}`:`$${e.parameter}`}function UP(e){return!(/^[?#@*$!\-0-9]$/.test(e)||/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))}function WP(e,t){switch(t.type){case`Length`:return`#${e}`;case`LengthSliceError`:return`#${e}:`;case`BadSubstitution`:return t.text;case`DefaultValue`:return`${e}${t.checkEmpty?`:`:``}-${IP(t.word)}`;case`AssignDefault`:return`${e}${t.checkEmpty?`:`:``}=${IP(t.word)}`;case`ErrorIfUnset`:return`${e}${t.checkEmpty?`:`:``}?${t.word?IP(t.word):``}`;case`UseAlternative`:return`${e}${t.checkEmpty?`:`:``}+${IP(t.word)}`;case`Substring`:{let n=cF(t.offset.expression);return t.length?`${e}:${n}:${cF(t.length.expression)}`:`${e}:${n}`}case`PatternRemoval`:{let n=t.side===`prefix`?`#`:`%`;return`${e}${t.greedy?`${n}${n}`:n}${IP(t.pattern)}`}case`PatternReplacement`:{let n=`/`;t.all?n=`//`:t.anchor===`start`?n=`/#`:t.anchor===`end`&&(n=`/%`);let r=t.replacement?`/${IP(t.replacement)}`:``;return`${e}${n}${IP(t.pattern)}${r}`}case`CaseModification`:{let n=t.direction===`upper`?`^`:`,`;return`${e}${t.all?`${n}${n}`:n}${t.pattern?IP(t.pattern):``}`}case`Transform`:return`${e}@${t.operator}`;case`Indirection`:return t.innerOp?`!${WP(e,t.innerOp)}`:`!${e}`;case`ArrayKeys`:return`!${t.array}[${t.star?`*`:`@`}]`;case`VarNamePrefix`:return`!${t.prefix}${t.star?`*`:`@`}`;default:throw Error(`Unsupported parameter operation type: ${t.type}`)}}function GP(e){return`{${e.items.map(KP).join(`,`)}}`}function KP(e){if(e.type===`Word`)return FP(e.word);let t=e.startStr??String(e.start),n=e.endStr??String(e.end);return e.step===void 0?`${t}..${n}`:`${t}..${n}..${e.step}`}function qP(e){let t=e.fdVariable?`{${e.fdVariable}}`:e.fd===null?``:String(e.fd);if(e.operator===`<<`||e.operator===`<<-`){let n=e.target,r=n.quoted?`'${n.delimiter}'`:n.delimiter,i=BP(n.content,n.quoted);return`${t}${e.operator}${r}
1542
+ ${i}${n.delimiter}`}return e.operator===`<<<`?`${t}<<< ${FP(e.target)}`:e.operator===`&>`||e.operator===`&>>`?`${e.operator} ${FP(e.target)}`:`${t}${e.operator} ${FP(e.target)}`}function JP(e){return e.length===0?``:` ${e.map(qP).join(` `)}`}function YP(e){return e.map(AP).join(`
1543
+ `)}function XP(e){let t=[];for(let n=0;n<e.clauses.length;n++){let r=e.clauses[n],i=n===0?`if`:`elif`;t.push(`${i} ${YP(r.condition)}; then
1544
+ ${YP(r.body)}`)}return e.elseBody&&t.push(`else
1545
+ ${YP(e.elseBody)}`),`${t.join(`
1546
1546
  `)}
1547
- fi${KP(e.redirections)}`}function YP(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(NP).join(` `);t=`for ${e.variable} in ${n}`}return`${t}; do
1548
- ${qP(e.body)}
1549
- done${KP(e.redirections)}`}function XP(e){return`for ((${e.init?oF(e.init.expression):``}; ${e.condition?oF(e.condition.expression):``}; ${e.update?oF(e.update.expression):``})); do
1550
- ${qP(e.body)}
1551
- done${KP(e.redirections)}`}function ZP(e){return`while ${qP(e.condition)}; do
1552
- ${qP(e.body)}
1553
- done${KP(e.redirections)}`}function QP(e){return`until ${qP(e.condition)}; do
1554
- ${qP(e.body)}
1555
- done${KP(e.redirections)}`}function $P(e){let t=e.items.map(eF).join(`
1556
- `);return`case ${NP(e.word)} in
1547
+ fi${JP(e.redirections)}`}function ZP(e){let t;if(e.words===null)t=`for ${e.variable}`;else{let n=e.words.map(FP).join(` `);t=`for ${e.variable} in ${n}`}return`${t}; do
1548
+ ${YP(e.body)}
1549
+ done${JP(e.redirections)}`}function QP(e){return`for ((${e.init?cF(e.init.expression):``}; ${e.condition?cF(e.condition.expression):``}; ${e.update?cF(e.update.expression):``})); do
1550
+ ${YP(e.body)}
1551
+ done${JP(e.redirections)}`}function $P(e){return`while ${YP(e.condition)}; do
1552
+ ${YP(e.body)}
1553
+ done${JP(e.redirections)}`}function eF(e){return`until ${YP(e.condition)}; do
1554
+ ${YP(e.body)}
1555
+ done${JP(e.redirections)}`}function tF(e){let t=e.items.map(nF).join(`
1556
+ `);return`case ${FP(e.word)} in
1557
1557
  ${t}
1558
- esac${KP(e.redirections)}`}function eF(e){let t=e.patterns.map(NP).join(` | `),n=qP(e.body);return n?`${t})
1558
+ esac${JP(e.redirections)}`}function nF(e){let t=e.patterns.map(FP).join(` | `),n=YP(e.body);return n?`${t})
1559
1559
  ${n}
1560
1560
  ${e.terminator}`:`${t})
1561
- ${e.terminator}`}function tF(e){return`(${qP(e.body)})${KP(e.redirections)}`}function nF(e){return`{ ${qP(e.body)}; }${KP(e.redirections)}`}function rF(e){return`((${oF(e.expression.expression)}))${KP(e.redirections)}`}function iF(e){return`[[ ${sF(e.expression)} ]]${KP(e.redirections)}`}function aF(e){let t=AP(e.body);return`${e.name}() ${t}${KP(e.redirections)}`}function oF(e){switch(e.type){case`ArithNumber`:return String(e.value);case`ArithVariable`:return e.hasDollarPrefix?`$${e.name}`:e.name;case`ArithSpecialVar`:return`$${e.name}`;case`ArithBinary`:return`${oF(e.left)} ${e.operator} ${oF(e.right)}`;case`ArithUnary`:return e.prefix?`${e.operator}${oF(e.operand)}`:`${oF(e.operand)}${e.operator}`;case`ArithTernary`:return`${oF(e.condition)} ? ${oF(e.consequent)} : ${oF(e.alternate)}`;case`ArithAssignment`:return`${e.subscript?`${e.variable}[${oF(e.subscript)}]`:e.stringKey===void 0?e.variable:`${e.variable}[${e.stringKey}]`} ${e.operator} ${oF(e.value)}`;case`ArithDynamicAssignment`:return`${e.subscript?`${oF(e.target)}[${oF(e.subscript)}]`:oF(e.target)} ${e.operator} ${oF(e.value)}`;case`ArithDynamicElement`:return`${oF(e.nameExpr)}[${oF(e.subscript)}]`;case`ArithGroup`:return`(${oF(e.expression)})`;case`ArithNested`:return`$((${oF(e.expression)}))`;case`ArithCommandSubst`:return`$(${e.command})`;case`ArithBracedExpansion`:return`\${${e.content}}`;case`ArithArrayElement`:return e.stringKey===void 0?e.index?`${e.array}[${oF(e.index)}]`:e.array:`${e.array}[${e.stringKey}]`;case`ArithDynamicBase`:return`\${${e.baseExpr}}#${e.value}`;case`ArithDynamicNumber`:return`\${${e.prefix}}${e.suffix}`;case`ArithConcat`:return e.parts.map(oF).join(``);case`ArithDoubleSubscript`:return`${e.array}[${oF(e.index)}]`;case`ArithNumberSubscript`:return`${e.number}[${e.errorToken}]`;case`ArithSyntaxError`:return e.errorToken;case`ArithSingleQuote`:return`'${e.content}'`;default:throw Error(`Unsupported arithmetic expression type: ${e.type}`)}}function sF(e){switch(e.type){case`CondBinary`:return`${NP(e.left)} ${e.operator} ${NP(e.right)}`;case`CondUnary`:return`${e.operator} ${NP(e.operand)}`;case`CondNot`:return`! ${sF(e.operand)}`;case`CondAnd`:return`${sF(e.left)} && ${sF(e.right)}`;case`CondOr`:return`${sF(e.left)} || ${sF(e.right)}`;case`CondGroup`:return`( ${sF(e.expression)} )`;case`CondWord`:return NP(e.word);default:throw Error(`Unsupported conditional expression type: ${e.type}`)}}var cF=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;transformPlugins=[];state;constructor(e={}){let t=e.fs??new hk(e.files);this.fs=t,this.useDefaultLayout=!e.cwd&&!e.files;let n=e.cwd||(this.useDefaultLayout?`/home/user`:`/`),r=new Map([[`HOME`,this.useDefaultLayout?`/home/user`:`/`],[`PATH`,`/usr/bin:/bin`],[`IFS`,`
1562
- `],[`OSTYPE`,`linux-gnu`],[`MACHTYPE`,`x86_64-pc-linux-gnu`],[`HOSTTYPE`,`x86_64`],[`HOSTNAME`,`localhost`],[`PWD`,n],[`OLDPWD`,n],[`OPTIND`,`1`],...Object.entries(e.env??{})]);if(this.limits=JN({...e.executionLimits,...e.maxCallDepth!==void 0&&{maxCallDepth:e.maxCallDepth},...e.maxCommandCount!==void 0&&{maxCommandCount:e.maxCommandCount},...e.maxLoopIterations!==void 0&&{maxLoopIterations:e.maxLoopIterations}}),e.fetch?this.secureFetch=e.fetch:e.network&&(this.secureFetch=CP(e.network)),this.sleepFn=e.sleep,this.traceFn=e.trace,this.logger=e.logger,this.defenseInDepthConfig=e.defenseInDepth??!0,this.coverageWriter=e.coverage,this.state={env:r,cwd:n,previousDir:`/home/user`,functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:``,startTime:Date.now(),lastBackgroundPid:0,virtualPid:e.processInfo?.pid??1,virtualPpid:e.processInfo?.ppid??0,virtualUid:e.processInfo?.uid??1e3,virtualGid:e.processInfo?.gid??1e3,bashPid:e.processInfo?.pid??1,nextVirtualPid:(e.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set([`HOME`,`PATH`,`PWD`,`OLDPWD`,...Object.keys(e.env||{})]),readonlyVars:new Set([`SHELLOPTS`,`BASHOPTS`]),hashTable:new Map},this.state.env.set(`SHELLOPTS`,Ck(this.state.options)),this.state.env.set(`BASHOPTS`,Ek(this.state.shoptOptions)),bk(t,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),n!==`/`&&t instanceof hk)try{t.mkdirSync(n,{recursive:!0})}catch{}for(let t of YO(e.commands))this.registerCommand(t);if(e.fetch||e.network)for(let e of XO())this.registerCommand(e);if(e.python)for(let e of ZO())this.registerCommand(e);if(e.javascript){for(let e of QO())this.registerCommand(e);let t=typeof e.javascript==`object`?e.javascript:Object.create(null);t.bootstrap&&(this.jsBootstrapCode=t.bootstrap)}if(e.customCommands)for(let t of e.customCommands)$O(t)?this.registerCommand(tk(t)):this.registerCommand({...t,trusted:t.trusted??!0})}registerCommand(e){this.commands.set(e.name,e);let t=this.fs;if(typeof t.writeFileSync==`function`){let n=`#!/bin/bash
1561
+ ${e.terminator}`}function rF(e){return`(${YP(e.body)})${JP(e.redirections)}`}function iF(e){return`{ ${YP(e.body)}; }${JP(e.redirections)}`}function aF(e){return`((${cF(e.expression.expression)}))${JP(e.redirections)}`}function oF(e){return`[[ ${lF(e.expression)} ]]${JP(e.redirections)}`}function sF(e){let t=MP(e.body);return`${e.name}() ${t}${JP(e.redirections)}`}function cF(e){switch(e.type){case`ArithNumber`:return String(e.value);case`ArithVariable`:return e.hasDollarPrefix?`$${e.name}`:e.name;case`ArithSpecialVar`:return`$${e.name}`;case`ArithBinary`:return`${cF(e.left)} ${e.operator} ${cF(e.right)}`;case`ArithUnary`:return e.prefix?`${e.operator}${cF(e.operand)}`:`${cF(e.operand)}${e.operator}`;case`ArithTernary`:return`${cF(e.condition)} ? ${cF(e.consequent)} : ${cF(e.alternate)}`;case`ArithAssignment`:return`${e.subscript?`${e.variable}[${cF(e.subscript)}]`:e.stringKey===void 0?e.variable:`${e.variable}[${e.stringKey}]`} ${e.operator} ${cF(e.value)}`;case`ArithDynamicAssignment`:return`${e.subscript?`${cF(e.target)}[${cF(e.subscript)}]`:cF(e.target)} ${e.operator} ${cF(e.value)}`;case`ArithDynamicElement`:return`${cF(e.nameExpr)}[${cF(e.subscript)}]`;case`ArithGroup`:return`(${cF(e.expression)})`;case`ArithNested`:return`$((${cF(e.expression)}))`;case`ArithCommandSubst`:return`$(${e.command})`;case`ArithBracedExpansion`:return`\${${e.content}}`;case`ArithArrayElement`:return e.stringKey===void 0?e.index?`${e.array}[${cF(e.index)}]`:e.array:`${e.array}[${e.stringKey}]`;case`ArithDynamicBase`:return`\${${e.baseExpr}}#${e.value}`;case`ArithDynamicNumber`:return`\${${e.prefix}}${e.suffix}`;case`ArithConcat`:return e.parts.map(cF).join(``);case`ArithDoubleSubscript`:return`${e.array}[${cF(e.index)}]`;case`ArithNumberSubscript`:return`${e.number}[${e.errorToken}]`;case`ArithSyntaxError`:return e.errorToken;case`ArithSingleQuote`:return`'${e.content}'`;default:throw Error(`Unsupported arithmetic expression type: ${e.type}`)}}function lF(e){switch(e.type){case`CondBinary`:return`${FP(e.left)} ${e.operator} ${FP(e.right)}`;case`CondUnary`:return`${e.operator} ${FP(e.operand)}`;case`CondNot`:return`! ${lF(e.operand)}`;case`CondAnd`:return`${lF(e.left)} && ${lF(e.right)}`;case`CondOr`:return`${lF(e.left)} || ${lF(e.right)}`;case`CondGroup`:return`( ${lF(e.expression)} )`;case`CondWord`:return FP(e.word);default:throw Error(`Unsupported conditional expression type: ${e.type}`)}}var uF=class{fs;commands=new Map;useDefaultLayout=!1;limits;secureFetch;sleepFn;traceFn;logger;defenseInDepthConfig;coverageWriter;jsBootstrapCode;transformPlugins=[];state;constructor(e={}){let t=e.fs??new _k(e.files);this.fs=t,this.useDefaultLayout=!e.cwd&&!e.files;let n=e.cwd||(this.useDefaultLayout?`/home/user`:`/`),r=new Map([[`HOME`,this.useDefaultLayout?`/home/user`:`/`],[`PATH`,`/usr/bin:/bin`],[`IFS`,`
1562
+ `],[`OSTYPE`,`linux-gnu`],[`MACHTYPE`,`x86_64-pc-linux-gnu`],[`HOSTTYPE`,`x86_64`],[`HOSTNAME`,`localhost`],[`PWD`,n],[`OLDPWD`,n],[`OPTIND`,`1`],...Object.entries(e.env??{})]);if(this.limits=XN({...e.executionLimits,...e.maxCallDepth!==void 0&&{maxCallDepth:e.maxCallDepth},...e.maxCommandCount!==void 0&&{maxCommandCount:e.maxCommandCount},...e.maxLoopIterations!==void 0&&{maxLoopIterations:e.maxLoopIterations}}),e.fetch?this.secureFetch=e.fetch:e.network&&(this.secureFetch=TP(e.network)),this.sleepFn=e.sleep,this.traceFn=e.trace,this.logger=e.logger,this.defenseInDepthConfig=e.defenseInDepth??!0,this.coverageWriter=e.coverage,this.state={env:r,cwd:n,previousDir:`/home/user`,functions:new Map,localScopes:[],callDepth:0,sourceDepth:0,commandCount:0,lastExitCode:0,lastArg:``,startTime:Date.now(),lastBackgroundPid:0,virtualPid:e.processInfo?.pid??1,virtualPpid:e.processInfo?.ppid??0,virtualUid:e.processInfo?.uid??1e3,virtualGid:e.processInfo?.gid??1e3,bashPid:e.processInfo?.pid??1,nextVirtualPid:(e.processInfo?.pid??1)+1,currentLine:1,options:{errexit:!1,pipefail:!1,nounset:!1,xtrace:!1,verbose:!1,posix:!1,allexport:!1,noclobber:!1,noglob:!1,noexec:!1,vi:!1,emacs:!1},shoptOptions:{extglob:!1,dotglob:!1,nullglob:!1,failglob:!1,globstar:!1,globskipdots:!0,nocaseglob:!1,nocasematch:!1,expand_aliases:!1,lastpipe:!1,xpg_echo:!1},inCondition:!1,loopDepth:0,exportedVars:new Set([`HOME`,`PATH`,`PWD`,`OLDPWD`,...Object.keys(e.env||{})]),readonlyVars:new Set([`SHELLOPTS`,`BASHOPTS`]),hashTable:new Map},this.state.env.set(`SHELLOPTS`,Tk(this.state.options)),this.state.env.set(`BASHOPTS`,Ok(this.state.shoptOptions)),Sk(t,this.useDefaultLayout,{pid:this.state.virtualPid,ppid:this.state.virtualPpid,uid:this.state.virtualUid,gid:this.state.virtualGid}),n!==`/`&&t instanceof _k)try{t.mkdirSync(n,{recursive:!0})}catch{}for(let t of nk(e.commands))this.registerCommand(t);if(e.fetch||e.network)for(let e of rk())this.registerCommand(e);if(e.python)for(let e of ik())this.registerCommand(e);if(e.javascript){for(let e of ak())this.registerCommand(e);let t=typeof e.javascript==`object`?e.javascript:Object.create(null);t.bootstrap&&(this.jsBootstrapCode=t.bootstrap)}if(e.customCommands)for(let t of e.customCommands)ok(t)?this.registerCommand(ck(t)):this.registerCommand({...t,trusted:t.trusted??!0})}registerCommand(e){this.commands.set(e.name,e);let t=this.fs;if(typeof t.writeFileSync==`function`){let n=`#!/bin/bash
1563
1563
  # Built-in command: ${e.name}
1564
- `;try{t.writeFileSync(`/bin/${e.name}`,n)}catch{}try{t.writeFileSync(`/usr/bin/${e.name}`,n)}catch{}}}logResult(e){return this.logger&&(e.stdout&&this.logger.debug(`stdout`,{output:e.stdout}),e.stderr&&this.logger.info(`stderr`,{output:e.stderr}),this.logger.info(`exit`,{exitCode:e.exitCode})),e.stdout=dF(e.stdout),e.stderr=dF(e.stderr),e}async exec(e,t){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:``,stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
1565
- `,exitCode:1,env:Yl(this.state.env,t?.env)};if(!e.trim())return{stdout:``,stderr:``,exitCode:0,env:Yl(this.state.env,t?.env)};this.logger?.info(`exec`,{command:e});let n=t?.cwd??this.state.cwd,r,i=n;if(t?.cwd)if(t.env&&`PWD`in t.env)r=t.env.PWD;else if(t?.env&&!(`PWD`in t.env))try{r=await this.fs.realpath(n),i=r}catch{r=n}else r=n;let a=t?.replaceEnv?new Map:new Map(this.state.env);if(t?.env)for(let[e,n]of Object.entries(t.env))a.set(e,n);r!==void 0&&a.set(`PWD`,r);let o={...this.state,env:a,cwd:i,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:t?.stdin,signal:t?.signal,extraArgs:t?.args},s=e;t?.rawScript||(s=lF(e));let c=this.defenseInDepthConfig?rr.getInstance(this.defenseInDepthConfig):null,l=c?.activate();try{let e=async()=>{let e=Uw(s,{maxHeredocSize:this.limits.maxHeredocSize}),t;if(this.transformPlugins.length>0){let n=Object.create(null);for(let t of this.transformPlugins){let r=t.transform({ast:e,metadata:n});e=r.ast,r.metadata&&(n=Xl(n,r.metadata))}t=n}let n=await new KN({fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:c?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode},o).executeScript(e);return t&&(n.metadata=t),this.logResult(n)};return l?await l.run(e):await e()}catch(e){if(e instanceof Ir||e instanceof Ur)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:e.exitCode,env:Yl(this.state.env,t?.env)});if(e instanceof Lr)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:1,env:Yl(this.state.env,t?.env)});if(e instanceof Vr)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:124,env:Yl(this.state.env,t?.env)});if(e instanceof k)return this.logResult({stdout:e.stdout,stderr:Ii(e.stderr),exitCode:k.EXIT_CODE,env:Yl(this.state.env,t?.env)});if(e instanceof w)return this.logResult({stdout:``,stderr:`bash: security violation: ${Ii(e.message)}
1566
- `,exitCode:1,env:Yl(this.state.env,t?.env)});if(e.name===`ParseException`)return this.logResult({stdout:``,stderr:`bash: syntax error: ${Ii(e.message)}
1567
- `,exitCode:2,env:Yl(this.state.env,t?.env)});if(e instanceof qS)return this.logResult({stdout:``,stderr:`bash: ${Ii(e.message)}
1568
- `,exitCode:2,env:Yl(this.state.env,t?.env)});if(e instanceof RangeError)return this.logResult({stdout:``,stderr:`bash: ${Ii(e.message)}
1569
- `,exitCode:1,env:Yl(this.state.env,t?.env)});throw e}finally{l?.deactivate()}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,t){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),t)}getCwd(){return this.state.cwd}getEnv(){return Jl(this.state.env)}registerTransformPlugin(e){this.transformPlugins.push(e)}transform(e){let t=Uw(lF(e),{maxHeredocSize:this.limits.maxHeredocSize}),n=Object.create(null);for(let e of this.transformPlugins){let r=e.transform({ast:t,metadata:n});t=r.ast,r.metadata&&(n=Xl(n,r.metadata))}return{script:EP(t),ast:t,metadata:n}}};function lF(e){let t=e.split(`
1564
+ `;try{t.writeFileSync(`/bin/${e.name}`,n)}catch{}try{t.writeFileSync(`/usr/bin/${e.name}`,n)}catch{}}}logResult(e){return this.logger&&(e.stdout&&this.logger.debug(`stdout`,{output:e.stdout}),e.stderr&&this.logger.info(`stderr`,{output:e.stderr}),this.logger.info(`exit`,{exitCode:e.exitCode})),e.stdout=pF(e.stdout),e.stderr=pF(e.stderr),e}async exec(e,t){if(this.state.callDepth===0&&(this.state.commandCount=0),this.state.commandCount++,this.state.commandCount>this.limits.maxCommandCount)return{stdout:``,stderr:`bash: maximum command count (${this.limits.maxCommandCount}) exceeded (possible infinite loop). Increase with executionLimits.maxCommandCount option.
1565
+ `,exitCode:1,env:Jl(this.state.env,t?.env)};if(!e.trim())return{stdout:``,stderr:``,exitCode:0,env:Jl(this.state.env,t?.env)};this.logger?.info(`exec`,{command:e});let n=t?.cwd??this.state.cwd,r,i=n;if(t?.cwd)if(t.env&&`PWD`in t.env)r=t.env.PWD;else if(t?.env&&!(`PWD`in t.env))try{r=await this.fs.realpath(n),i=r}catch{r=n}else r=n;let a=t?.replaceEnv?new Map:new Map(this.state.env);if(t?.env)for(let[e,n]of Object.entries(t.env))a.set(e,n);r!==void 0&&a.set(`PWD`,r);let o={...this.state,env:a,cwd:i,functions:new Map(this.state.functions),localScopes:[...this.state.localScopes],options:{...this.state.options},hashTable:this.state.hashTable,groupStdin:t?.stdin,signal:t?.signal,extraArgs:t?.args},s=e;t?.rawScript||(s=dF(e));let c=this.defenseInDepthConfig?rr.getInstance(this.defenseInDepthConfig):null,l=c?.activate();try{let e=async()=>{let e=Xw(s,{maxHeredocSize:this.limits.maxHeredocSize}),t;if(this.transformPlugins.length>0){let n=Object.create(null);for(let t of this.transformPlugins){let r=t.transform({ast:e,metadata:n});e=r.ast,r.metadata&&(n=Yl(n,r.metadata))}t=n}let n=await new JN({fs:this.fs,commands:this.commands,limits:this.limits,exec:this.exec.bind(this),fetch:this.secureFetch,sleep:this.sleepFn,trace:this.traceFn,coverage:this.coverageWriter,requireDefenseContext:c?.isEnabled()===!0,jsBootstrapCode:this.jsBootstrapCode},o).executeScript(e);return t&&(n.metadata=t),this.logResult(n)};return l?await l.run(e):await e()}catch(e){if(e instanceof Ir||e instanceof Ur)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:e.exitCode,env:Jl(this.state.env,t?.env)});if(e instanceof Lr)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:1,env:Jl(this.state.env,t?.env)});if(e instanceof Vr)return this.logResult({stdout:e.stdout,stderr:e.stderr,exitCode:124,env:Jl(this.state.env,t?.env)});if(e instanceof k)return this.logResult({stdout:e.stdout,stderr:Ii(e.stderr),exitCode:k.EXIT_CODE,env:Jl(this.state.env,t?.env)});if(e instanceof w)return this.logResult({stdout:``,stderr:`bash: security violation: ${Ii(e.message)}
1566
+ `,exitCode:1,env:Jl(this.state.env,t?.env)});if(e.name===`ParseException`)return this.logResult({stdout:``,stderr:`bash: syntax error: ${Ii(e.message)}
1567
+ `,exitCode:2,env:Jl(this.state.env,t?.env)});if(e instanceof eC)return this.logResult({stdout:``,stderr:`bash: ${Ii(e.message)}
1568
+ `,exitCode:2,env:Jl(this.state.env,t?.env)});if(e instanceof RangeError)return this.logResult({stdout:``,stderr:`bash: ${Ii(e.message)}
1569
+ `,exitCode:1,env:Jl(this.state.env,t?.env)});throw e}finally{l?.deactivate()}}async readFile(e){return this.fs.readFile(this.fs.resolvePath(this.state.cwd,e))}async writeFile(e,t){return this.fs.writeFile(this.fs.resolvePath(this.state.cwd,e),t)}getCwd(){return this.state.cwd}getEnv(){return ql(this.state.env)}registerTransformPlugin(e){this.transformPlugins.push(e)}transform(e){let t=Xw(dF(e),{maxHeredocSize:this.limits.maxHeredocSize}),n=Object.create(null);for(let e of this.transformPlugins){let r=e.transform({ast:t,metadata:n});t=r.ast,r.metadata&&(n=Yl(n,r.metadata))}return{script:OP(t),ast:t,metadata:n}}};function dF(e){let t=e.split(`
1570
1570
  `),n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(r.length>0){let e=r[r.length-1];if((e.stripTabs?i.replace(/^\t+/,``):i)===e.delimiter){n.push(i.trimStart()),r.pop();continue}n.push(i);continue}let a=i.trimStart();n.push(a);for(let e of a.matchAll(/<<(-?)\s*(['"]?)([\w-]+)\2/g)){let t=e[1]===`-`,n=e[3];r.push({delimiter:n,stripTabs:t})}}return n.join(`
1571
- `)}var uF=new TextDecoder(`utf-8`,{fatal:!0});function dF(e){if(!e)return e;let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>255)return e;r>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);try{return uF.decode(n)}catch{return e}}var fF=t({createCostCommand:()=>bF,registerSessionCostsProvider:()=>mF}),pF=null;function mF(e){pF=e}function hF(){return`cost - show session cost breakdown
1571
+ `)}var fF=new TextDecoder(`utf-8`,{fatal:!0});function pF(e){if(!e)return e;let t=!1;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>255)return e;r>127&&(t=!0)}if(!t)return e;let n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);try{return fF.decode(n)}catch{return e}}var mF=t({createCostCommand:()=>SF,registerSessionCostsProvider:()=>gF}),hF=null;function gF(e){hF=e}function _F(){return`cost - show session cost breakdown
1572
1572
 
1573
1573
  Usage: cost [options]
1574
1574
 
1575
1575
  Options:
1576
1576
  --json Output as JSON (for programmatic use)
1577
1577
  -h, --help Show this help message
1578
- `}function gF(e){return e.toLocaleString(`en-US`)}function _F(e){return`$${e.toFixed(2)}`}function vF(e,t){return e.length<=t?e:e.slice(0,t-3)+`...`}function yF(e){let t=[];t.push(`Session Cost Breakdown:
1579
- `);let n=` ─────────────────────────────────────────────────────────────────────────────────────────`;t.push(` Agent Model Tokens (in/out) Cache (r/w) Cost`),t.push(n);let r=0,i=0,a=0,o=0,s=0;for(let n of e){let e=(n.type===`cone`?`${n.name} (cone)`:`${n.name} (scoop)`).padEnd(19),c=vF(n.model,24).padEnd(24),l=`${gF(n.usage.input)} / ${gF(n.usage.output)}`.padEnd(18),u=`${gF(n.usage.cacheRead)} / ${gF(n.usage.cacheWrite)}`.padEnd(17),d=_F(n.usage.cost.total);t.push(` ${e} ${c} ${l} ${u} ${d}`),r+=n.usage.input,i+=n.usage.output,a+=n.usage.cacheRead,o+=n.usage.cacheWrite,s+=n.usage.cost.total}t.push(n);let c=`Total`.padEnd(19),l=``.padEnd(24),u=`${gF(r)} / ${gF(i)}`.padEnd(18),d=`${gF(a)} / ${gF(o)}`.padEnd(17),f=_F(s);return t.push(` ${c} ${l} ${u} ${d} ${f}`),t.join(`
1578
+ `}function vF(e){return e.toLocaleString(`en-US`)}function yF(e){return`$${e.toFixed(2)}`}function bF(e,t){return e.length<=t?e:e.slice(0,t-3)+`...`}function xF(e){let t=[];t.push(`Session Cost Breakdown:
1579
+ `);let n=` ─────────────────────────────────────────────────────────────────────────────────────────`;t.push(` Agent Model Tokens (in/out) Cache (r/w) Cost`),t.push(n);let r=0,i=0,a=0,o=0,s=0;for(let n of e){let e=(n.type===`cone`?`${n.name} (cone)`:`${n.name} (scoop)`).padEnd(19),c=bF(n.model,24).padEnd(24),l=`${vF(n.usage.input)} / ${vF(n.usage.output)}`.padEnd(18),u=`${vF(n.usage.cacheRead)} / ${vF(n.usage.cacheWrite)}`.padEnd(17),d=yF(n.usage.cost.total);t.push(` ${e} ${c} ${l} ${u} ${d}`),r+=n.usage.input,i+=n.usage.output,a+=n.usage.cacheRead,o+=n.usage.cacheWrite,s+=n.usage.cost.total}t.push(n);let c=`Total`.padEnd(19),l=``.padEnd(24),u=`${vF(r)} / ${vF(i)}`.padEnd(18),d=`${vF(a)} / ${vF(o)}`.padEnd(17),f=yF(s);return t.push(` ${c} ${l} ${u} ${d} ${f}`),t.join(`
1580
1580
  `)+`
1581
- `}function bF(){return ek(`cost`,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:hF(),stderr:``,exitCode:0};if(!pF)return{stdout:``,stderr:`Cost data not available.
1582
- `,exitCode:1};let t=await pF();return t.length===0?{stdout:`No session cost data yet.
1581
+ `}function SF(){return sk(`cost`,async e=>{if(e.includes(`--help`)||e.includes(`-h`))return{stdout:_F(),stderr:``,exitCode:0};if(!hF)return{stdout:``,stderr:`Cost data not available.
1582
+ `,exitCode:1};let t=await hF();return t.length===0?{stdout:`No session cost data yet.
1583
1583
  `,stderr:``,exitCode:0}:e.includes(`--json`)?{stdout:JSON.stringify(t,null,2)+`
1584
- `,stderr:``,exitCode:0}:{stdout:yF(t),stderr:``,exitCode:0}})}export{cF as a,ek as i,bF as n,JO as o,mF as r,qO as s,fF as t};
1584
+ `,stderr:``,exitCode:0}:{stdout:xF(t),stderr:``,exitCode:0}})}export{tk as a,ek as i,SF as n,sk as o,gF as r,uF as s,mF as t};